mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-11 23:07:37 +00:00
Animations now continue where they should be when players rejoin a world/server.
This commit is contained in:
1 parent
cee52ec9e0
commit
a5ed14183e
7 files changed
+117
-34
No files matched your search
@@ -497,12 +497,24 @@ public class ServerEventsHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerTracking(PlayerEvent.StartTracking event){
|
||||
if(!(event.target instanceof EntityNPCInterface) || event.target.worldObj.isRemote)
|
||||
return;
|
||||
if (event.target.worldObj.isRemote) return;
|
||||
|
||||
MarkData data = MarkData.get((EntityNPCInterface) event.target);
|
||||
if(data.marks.isEmpty())
|
||||
return;
|
||||
Server.sendData((EntityPlayerMP)event.entityPlayer, EnumPacketClient.MARK_DATA, event.target.getEntityId(), data.getNBT());
|
||||
if(event.target instanceof EntityPlayerMP || event.target instanceof EntityNPCInterface) {
|
||||
AnimationData animationData = AnimationData.getData(event.target);
|
||||
if (animationData.isClientAnimating()) {
|
||||
AnimationData playerAnimData = AnimationData.getData(event.entityPlayer);
|
||||
Animation currentAnimation = animationData.currentClientAnimation;
|
||||
NBTTagCompound compound = currentAnimation.writeToNBT();
|
||||
playerAnimData.viewAnimation(currentAnimation, animationData, compound,
|
||||
animationData.isClientAnimating(), currentAnimation.currentFrame, currentAnimation.currentFrameTime);
|
||||
}
|
||||
|
||||
if (event.target instanceof EntityNPCInterface) {
|
||||
MarkData data = MarkData.get((EntityNPCInterface) event.target);
|
||||
if (data.marks.isEmpty())
|
||||
return;
|
||||
Server.sendData((EntityPlayerMP) event.entityPlayer, EnumPacketClient.MARK_DATA, event.target.getEntityId(), data.getNBT());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user