mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 09:55:11 +00:00
Fixed animations starting over instead of jumping to the current frame.
This commit is contained in:
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();
|
||||
|
||||
Reference in new issue
Block a user