diff --git a/src/main/java/com/teammetallurgy/atum/entity/ai/controller/AssassinLookController.java b/src/main/java/com/teammetallurgy/atum/entity/ai/controller/AssassinLookController.java new file mode 100644 index 000000000..3f8ac0a5e --- /dev/null +++ b/src/main/java/com/teammetallurgy/atum/entity/ai/controller/AssassinLookController.java @@ -0,0 +1,19 @@ +package com.teammetallurgy.atum.entity.ai.controller; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.MobEntity; +import net.minecraft.entity.ai.controller.LookController; + +public class AssassinLookController extends LookController { + + public AssassinLookController(MobEntity mob) { + super(mob); + } + + @Override + public void setLookPositionWithEntity(Entity entity, float deltaYaw, float deltaPitch) { + if (entity != null) { + super.setLookPositionWithEntity(entity, deltaYaw, deltaPitch); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/teammetallurgy/atum/entity/bandit/AssassinEntity.java b/src/main/java/com/teammetallurgy/atum/entity/bandit/AssassinEntity.java index bfc9eba29..d7259865b 100644 --- a/src/main/java/com/teammetallurgy/atum/entity/bandit/AssassinEntity.java +++ b/src/main/java/com/teammetallurgy/atum/entity/bandit/AssassinEntity.java @@ -1,11 +1,13 @@ package com.teammetallurgy.atum.entity.bandit; +import com.teammetallurgy.atum.entity.ai.controller.AssassinLookController; import com.teammetallurgy.atum.entity.ai.goal.OpenAnyDoorGoal; import com.teammetallurgy.atum.entity.ai.pathfinding.ClimberGroundPathNavigator; import com.teammetallurgy.atum.entity.undead.UndeadBaseEntity; import com.teammetallurgy.atum.init.AtumItems; import net.minecraft.block.BlockState; import net.minecraft.entity.*; +import net.minecraft.entity.ai.controller.LookController; import net.minecraft.entity.ai.goal.HurtByTargetGoal; import net.minecraft.entity.ai.goal.MeleeAttackGoal; import net.minecraft.entity.ai.goal.NearestAttackableTargetGoal; @@ -55,7 +57,13 @@ protected void registerGoals() { super.registerGoals(); this.goalSelector.addGoal(1, new MarkedForDeathGoal(this, this.markedTarget)); this.goalSelector.addGoal(3, new OpenAnyDoorGoal(this, false)); - this.goalSelector.addGoal(4, new AssassinMeleeAttackGoal(this, 1.2D, true)); + this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.2D, true)); + } + + @Override + @Nonnull + public LookController getLookController() { + return new AssassinLookController(this); } @Override @@ -228,23 +236,4 @@ public void resetTask() { ((AssassinEntity) this.goalOwner).markedTarget = null; } } - - public static class AssassinMeleeAttackGoal extends MeleeAttackGoal { - - public AssassinMeleeAttackGoal(CreatureEntity creature, double speedIn, boolean useLongMemory) { - super(creature, speedIn, useLongMemory); - } - - @Override - public boolean shouldExecute() { - return this.attacker != null && super.shouldExecute(); - } - - @Override - public void tick() { - if (this.attacker != null && this.attacker.getLookController() != null) { - super.tick(); - } - } - } } \ No newline at end of file