Fixed animations starting over instead of jumping to the current frame.

This commit is contained in:
luisc committed 2025-02-11 17:59:35 -06:00
1 parent 00af353e65
commit 272b1c5e5a
2 files changed
+10 -9

No files matched your search

@@ -75,19 +75,18 @@ public final class UpdateAnimationsPacket extends AbstractPacket {
}
if (animationData != null) {
int animationId;
if (nbt.hasKey("AnimationID")) {
animationId = nbt.getInteger("AnimationID");
} else {
if (nbt.hasKey("Animation")) {
Animation animation = new Animation();
animation.readFromNBT(nbt.getCompoundTag("Animation"));
ClientCacheHandler.animationCache.put(animation.getID(), animation);
animationId = animation.getID();
animationData.setAnimation(animation);
} else {
animationData.setAnimation(null);
}
animationData.setAnimation(ClientCacheHandler.animationCache.get(animationId));
animationData.readFromNBT(nbt);
PacketClient.sendClient(new AnimationCachePacket(animationId));
if (nbt.hasKey("Frame")) {
animationData.animation.jumpToFrameAtTime(
nbt.getInteger("Frame"), nbt.getInteger("Time"));
}
}
}
}
@@ -221,6 +221,8 @@ public class AnimationData implements IAnimationData {
if (animationNBT != null) {
data.setTag("Animation", animationNBT);
} else if (animation != null) {
data.setTag("Animation", animation.writeToNBT());
}
IAnimatable animatable = animationData.getEntity();