diff --git a/src/main/java/noppes/npcs/controllers/data/PlayerAbilityData.java b/src/main/java/noppes/npcs/controllers/data/PlayerAbilityData.java index 1330b34fa..b6aa3f4d0 100644 --- a/src/main/java/noppes/npcs/controllers/data/PlayerAbilityData.java +++ b/src/main/java/noppes/npcs/controllers/data/PlayerAbilityData.java @@ -8,6 +8,8 @@ import kamkeel.npcs.controllers.data.ability.data.ChainedAbility; import kamkeel.npcs.controllers.data.ability.data.IAbilityAction; import kamkeel.npcs.controllers.data.ability.data.entry.AbilityToggleEntry; import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance; +import kamkeel.npcs.network.PacketHandler; +import kamkeel.npcs.network.packets.data.UpdateAnimationsPacket; import kamkeel.npcs.network.packets.data.ability.AbilityCooldownSyncPacket; import kamkeel.npcs.network.packets.data.ability.PlayerAbilityStatePacket; import kamkeel.npcs.network.packets.data.ability.PlayerAbilitySyncPacket; @@ -177,6 +179,22 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA protected void clearAnimationData() { playerData.animationData.setAnimation(null); playerData.animationData.updateClient(); + + // Directly send animation clear to the owning player. updateClient() uses + // getEntitiesWithinAABB to find recipients, but during teleport the player + // entity hasn't migrated to the new chunk yet — so the AABB search centered + // on the new position won't find them, and the clear packet is never delivered. + // This guarantees the player's client always receives the clear. + EntityPlayer player = playerData.player; + if (player instanceof EntityPlayerMP) { + NBTTagCompound data = new NBTTagCompound(); + data.setBoolean("AllowAnimation", playerData.animationData.enabled()); + PacketHandler.Instance.sendToPlayer( + new UpdateAnimationsPacket(data, player.getCommandSenderName()), + (EntityPlayerMP) player + ); + } + playingAbilityAnimation = false; }