use of net.minecraft.entity.passive.TurtleEntity in project upgrade-aquatic by team-abnormals.
the class PikeEntity method registerGoals.
@Override
protected void registerGoals() {
super.registerGoals();
if (this.getPikeType() != PikeType.SPECTRAL) {
this.goalSelector.addGoal(2, new AvoidEntityGoal<PikeEntity>(this, PikeEntity.class, 8.0F, 1.6D, 1.4D, UAEntityPredicates.IS_SPECTRAL::test) {
@Override
public boolean shouldExecute() {
return super.shouldExecute() && this.entity != null && ((PikeEntity) this.entity).getPikeType() != PikeType.SPECTRAL;
}
});
}
this.goalSelector.addGoal(3, new PikeTemptGoal(this));
this.goalSelector.addGoal(4, new RandomSwimmingGoal(this, 1.1D, 40) {
@Override
public boolean shouldExecute() {
return ((PikeEntity) creature).isHidingInPickerelweed() ? super.shouldExecute() && creature.getRNG().nextInt(6) == 0 : super.shouldExecute();
}
});
this.goalSelector.addGoal(4, new HideInPickerelweedGoal(this));
this.goalSelector.addGoal(4, new PikeSwimToItemsGoal(this));
this.goalSelector.addGoal(4, new PikeAttackGoal(this, 12D, true));
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<AbstractFishEntity>(this, AbstractFishEntity.class, true) {
@Override
public boolean shouldExecute() {
return ((PikeEntity) this.goalOwner).getAttackCooldown() <= 0 && super.shouldExecute();
}
});
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<TurtleEntity>(this, TurtleEntity.class, 10, true, false, UAEntityPredicates.IS_CHILD::test) {
@Override
public boolean shouldExecute() {
return ((PikeEntity) this.goalOwner).getAttackCooldown() <= 0 && super.shouldExecute();
}
});
this.targetSelector.addGoal(2, new HurtByTargetGoal(this));
}
use of net.minecraft.entity.passive.TurtleEntity 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