Search in sources :

Example 1 with TurtleEntity

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));
}
Also used : TurtleEntity(net.minecraft.entity.passive.TurtleEntity) AbstractFishEntity(net.minecraft.entity.passive.fish.AbstractFishEntity) HurtByTargetGoal(net.minecraft.entity.ai.goal.HurtByTargetGoal) UAEntityPredicates(com.minecraftabnormals.upgrade_aquatic.api.util.UAEntityPredicates) RandomSwimmingGoal(net.minecraft.entity.ai.goal.RandomSwimmingGoal)

Example 2 with TurtleEntity

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();
}
Also used : TurtleEntity(net.minecraft.entity.passive.TurtleEntity) AbstractFishEntity(net.minecraft.entity.passive.fish.AbstractFishEntity) PikeEntity(com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity)

Aggregations

TurtleEntity (net.minecraft.entity.passive.TurtleEntity)2 AbstractFishEntity (net.minecraft.entity.passive.fish.AbstractFishEntity)2 UAEntityPredicates (com.minecraftabnormals.upgrade_aquatic.api.util.UAEntityPredicates)1 PikeEntity (com.minecraftabnormals.upgrade_aquatic.common.entities.pike.PikeEntity)1 HurtByTargetGoal (net.minecraft.entity.ai.goal.HurtByTargetGoal)1 RandomSwimmingGoal (net.minecraft.entity.ai.goal.RandomSwimmingGoal)1