mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 06:37:34 +00:00
Animation Resync on Teleport
This commit is contained in:
1 parent
a981060e9e
commit
d3346111c7
1 file changed
+18
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user