Animations now continue where they should be when players rejoin a world/server.

This commit is contained in:
Luis C.M committed 2024-03-24 18:55:03 -05:00
1 parent cee52ec9e0
commit a5ed14183e
7 files changed
+117 -34

No files matched your search

@@ -57,7 +57,6 @@ public class ClientCacheHandler {
ClientCacheHandler.skinOverlays.clear();
ClientCacheHandler.playerAnimations.clear();
ClientCacheHandler.playerData.animationData.clearCache();
CommonProxy.clientPlayingAnimations.clear();
}
public static void clearSkinCache() {
@@ -32,7 +32,7 @@ public class ClientTickHandler{
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onClientTick(TickEvent.ClientTickEvent event){
Minecraft mc = Minecraft.getMinecraft();
if ((this.prevWorld == null || mc.theWorld == null) && this.prevWorld != mc.theWorld) {
if (mc.theWorld != null && this.prevWorld != mc.theWorld) {
ClientCacheHandler.clearCache();
this.prevWorld = mc.theWorld;
}
@@ -375,8 +375,13 @@ public class PacketHandlerClient extends PacketHandlerServer{
}
animationData.setAnimation(ClientCacheHandler.animationCache.get(animationId));
animationData.readFromNBT(compound);
Client.sendData(EnumPacketServer.CacheAnimation, animationId);
animationData.viewReadFromNBT(compound);
if (compound.hasKey("Frame")) {
animationData.animation.readFromNBT(compound.getCompoundTag("Animation"));
} else if (compound.hasKey("Animation")) {
Client.sendData(EnumPacketServer.CacheAnimation, animationId);
}
}
}
else if(type == EnumPacketClient.DISABLE_MOUSE_INPUT) {