diff --git a/src/main/java/noppes/npcs/client/PacketHandlerClient.java b/src/main/java/noppes/npcs/client/PacketHandlerClient.java index 61a4ba4c3..d7a0c6365 100644 --- a/src/main/java/noppes/npcs/client/PacketHandlerClient.java +++ b/src/main/java/noppes/npcs/client/PacketHandlerClient.java @@ -28,18 +28,18 @@ import noppes.npcs.client.gui.customoverlay.OverlayCustom; import noppes.npcs.client.gui.player.GuiBook; import noppes.npcs.client.gui.util.*; import noppes.npcs.config.ConfigClient; +import noppes.npcs.constants.EnumAnimationPart; import noppes.npcs.constants.EnumGuiType; import noppes.npcs.constants.EnumPacketClient; import noppes.npcs.constants.EnumPacketServer; import noppes.npcs.controllers.RecipeController; -import noppes.npcs.controllers.data.Animation; -import noppes.npcs.controllers.data.AnimationData; -import noppes.npcs.controllers.data.RecipeCarpentry; +import noppes.npcs.controllers.data.*; import noppes.npcs.entity.EntityDialogNpc; import noppes.npcs.entity.EntityNPCInterface; import java.io.IOException; import java.util.HashMap; +import java.util.Map; public class PacketHandlerClient extends PacketHandlerServer{ @@ -331,6 +331,22 @@ public class PacketHandlerClient extends PacketHandlerServer{ if (animationData.allowAnimation) { Animation animation = new Animation(); animation.readFromNBT(ClientCacheHandler.animationCache.get(animationId).writeToNBT()); + if (animationData.animation != null && animation.frames.size() > 0) { + Frame frame = (Frame) animationData.animation.currentFrame(); + if (frame != null) { + Frame firstFrame = animation.frames.get(0); + for (Map.Entry entry : frame.frameParts.entrySet()) { + if (firstFrame.frameParts.containsKey(entry.getKey())) { + FramePart prevFramePart = entry.getValue(); + FramePart newFramePart = firstFrame.frameParts.get(entry.getKey()); + for (int i = 0; i < 3; i++) { + newFramePart.prevPivots[i] = prevFramePart.prevPivots[i]; + newFramePart.prevRotations[i] = prevFramePart.prevRotations[i]; + } + } + } + } + } animationData.animation = animation; animation.parent = animationData; Client.sendData(EnumPacketServer.CacheAnimation, animationId);