From d2a189ac3add5b0643a3956ea1281d82a0e0ceda Mon Sep 17 00:00:00 2001 From: luisc Date: Tue, 2 Apr 2024 15:26:55 -0500 Subject: [PATCH] Fixes to servers not ticking animations correctly on the server-side. --- .../noppes/npcs/controllers/data/AnimationData.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/noppes/npcs/controllers/data/AnimationData.java b/src/main/java/noppes/npcs/controllers/data/AnimationData.java index 0ddf23d92..08e8d29f9 100644 --- a/src/main/java/noppes/npcs/controllers/data/AnimationData.java +++ b/src/main/java/noppes/npcs/controllers/data/AnimationData.java @@ -110,6 +110,13 @@ public class AnimationData implements IAnimationData { EventHooks.onAnimationFrameEntered(this.animation, this.animation.currentFrame()); } + synchronized (CommonProxy.serverPlayingAnimations) { + if (this.isClientAnimating && this.animationEntity != null && + !this.animationEntity.worldObj.isRemote && this.animation != null) { + CommonProxy.serverPlayingAnimations.add(this.animation); + } + } + List entities = sendingEntity.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox( sendingEntity.posX - range, sendingEntity.posY - range, sendingEntity.posZ - range, sendingEntity.posX + range, sendingEntity.posY + range, sendingEntity.posZ + range)); @@ -187,12 +194,6 @@ public class AnimationData implements IAnimationData { NBTTagCompound data = animationData.viewWriteNBT(new NBTTagCompound()); animationData.allowAnimation = prevEnabled; - synchronized (CommonProxy.serverPlayingAnimations) { - if (animationData.animationEntity != null && !animationData.animationEntity.worldObj.isRemote && animation != null) { - CommonProxy.serverPlayingAnimations.add(animation); - } - } - if (animation != null && currentFrame >= 0 && currentFrame < animation.frames.size()) { data.setInteger("Frame", currentFrame); data.setInteger("Time", time);