melee ghast animation

This commit is contained in:
FatherToast 2022-09-13 18:46:19 -05:00
parent e1a7b9af17
commit 77030521b3
2 changed files with 9 additions and 7 deletions

View file

@ -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 ) {

View file

@ -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;