use of com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity in project upgrade-aquatic by team-abnormals.
the class HideInPickerelweedGoal method shouldExecute.
@Override
public boolean shouldExecute() {
if (!this.mustUpdate && (this.creature.getIdleTime() >= 100 || this.creature.getRNG().nextInt(this.executionChance) != 0)) {
return false;
}
Vector3d vec3d = this.getPosition();
if (vec3d == null) {
return false;
} else {
if (((PikeEntity) this.creature).isPickerelweedNearby()) {
this.x = vec3d.x;
this.y = vec3d.y;
this.z = vec3d.z;
this.mustUpdate = false;
return true;
}
}
return false;
}
use of com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity in project upgrade-aquatic by team-abnormals.
the class HideInPickerelweedGoal method getPosition.
@Nullable
protected Vector3d getPosition() {
PikeEntity pike = (PikeEntity) this.creature;
if (pike.isPickerelweedNearby()) {
int pickedWeed = pike.getRNG().nextInt(pike.getNearbyPickerelweeds().size());
BlockPos pos = pike.getNearbyPickerelweeds().get(pickedWeed);
return new Vector3d(pos.getX(), pos.getY(), pos.getZ());
}
return null;
}
use of com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity in project upgrade-aquatic by team-abnormals.
the class PikeAttackGoal method checkAndPerformAttack.
@Override
protected void checkAndPerformAttack(LivingEntity enemy, double distToEnemySqr) {
PikeEntity pike = (PikeEntity) this.attacker;
double attackReach = this.getAttackReachSqr(enemy);
if (distToEnemySqr <= attackReach && this.func_234040_h_()) {
this.func_234039_g_();
if (pike.getAttackTarget() != null) {
if (enemy instanceof AbstractFishEntity || enemy instanceof AnimalEntity) {
pike.setAttackCooldown(pike.getRNG().nextInt(550) + 50);
enemy.startRiding(pike, true);
pike.setAttackTarget(null);
} else {
enemy.attackEntityFrom(DamageSource.causeMobDamage(pike), 1.5F);
}
}
}
}
use of com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity in project upgrade-aquatic by team-abnormals.
the class PikeAttackGoal method startExecuting.
@Override
public void startExecuting() {
PikeEntity pike = (PikeEntity) this.attacker;
if (pike.getItemStackFromSlot(EquipmentSlotType.MAINHAND) != null && pike.getAttackTarget() instanceof AbstractFishEntity || pike.getItemStackFromSlot(EquipmentSlotType.MAINHAND) != null && pike.getAttackTarget() instanceof TurtleEntity) {
pike.spitOutItem(pike.getItemStackFromSlot(EquipmentSlotType.MAINHAND));
}
super.startExecuting();
}
Aggregations