diff --git a/src/main/java/fathertoast/specialmobs/common/entity/ai/goal/SpecialGhastMeleeAttackGoal.java b/src/main/java/fathertoast/specialmobs/common/entity/ai/goal/SpecialGhastMeleeAttackGoal.java index 862a424..2a2c8c7 100644 --- a/src/main/java/fathertoast/specialmobs/common/entity/ai/goal/SpecialGhastMeleeAttackGoal.java +++ b/src/main/java/fathertoast/specialmobs/common/entity/ai/goal/SpecialGhastMeleeAttackGoal.java @@ -68,17 +68,19 @@ public class SpecialGhastMeleeAttackGoal extends Goal { } } + // Attack the target when able + final double rangeDiff = target.distanceToSqr( ghast ) - + ((ghast.getBbWidth() * ghast.getBbWidth() + target.getBbWidth() * target.getBbWidth()) / 4.0 + 5.0); if( attackTimer > 0 ) { attackTimer--; } - else { - final double reachSq = (ghast.getBbWidth() * ghast.getBbWidth() + target.getBbWidth() * target.getBbWidth()) / 4.0 + 5.0; - if( target.distanceToSqr( ghast ) < reachSq ) { - attackTimer = 20; - ghast.doHurtTarget( target ); - } + else if( rangeDiff <= 0 ) { + attackTimer = 20; + ghast.doHurtTarget( target ); } + + ghast.setCharging( attackTimer < 6 && rangeDiff <= 10.0 ); } private void setWantedPosition( LivingEntity target ) { diff --git a/src/main/java/fathertoast/specialmobs/common/event/PlayerVelocityWatcher.java b/src/main/java/fathertoast/specialmobs/common/event/PlayerVelocityWatcher.java index 38ee683..18b2ba1 100644 --- a/src/main/java/fathertoast/specialmobs/common/event/PlayerVelocityWatcher.java +++ b/src/main/java/fathertoast/specialmobs/common/event/PlayerVelocityWatcher.java @@ -64,7 +64,7 @@ public class PlayerVelocityWatcher { } } - /** Called when the server is starts shutting down. */ + /** Called when the server starts shutting down. */ @SubscribeEvent protected static void onServerStopping( FMLServerStoppingEvent event ) { cleanupCounter = 0;