diff --git a/src/main/java/noppes/npcs/controllers/data/Animation.java b/src/main/java/noppes/npcs/controllers/data/Animation.java index 80fc28400..29dd816e7 100644 --- a/src/main/java/noppes/npcs/controllers/data/Animation.java +++ b/src/main/java/noppes/npcs/controllers/data/Animation.java @@ -278,7 +278,7 @@ public class Animation implements IAnimation { } } } else if (this.parent != null && this.currentFrame > this.loop) { - this.parent.finishedTime = this.parent.animationEntity.getAge(); + this.parent.finishedTime = this.parent.getMCEntity().getAge(); } } } diff --git a/src/main/java/noppes/npcs/controllers/data/AnimationData.java b/src/main/java/noppes/npcs/controllers/data/AnimationData.java index 577f7cc6a..112a461cf 100644 --- a/src/main/java/noppes/npcs/controllers/data/AnimationData.java +++ b/src/main/java/noppes/npcs/controllers/data/AnimationData.java @@ -39,13 +39,11 @@ public class AnimationData implements IAnimationData { private final HashSet cachedAnimationIDs = new HashSet<>(); //Client-side values - public EntityLivingBase animationEntity; public int finishedTime = -1; public int finishedFrame = -1; public AnimationData(Object parent){ this.parent = parent; - this.animationEntity = this.getMCEntity(); } public static AnimationData getData(Entity entity) { @@ -67,20 +65,14 @@ public class AnimationData implements IAnimationData { } public EntityLivingBase getMCEntity() { - if (this.animationEntity != null) { - return this.animationEntity; - } - if (this.parent instanceof DataDisplay) { - return ((DataDisplay) this.parent).npc; + return ((DataDisplay) this.parent).npc; } else { - EntityPlayer player; if (this.parent instanceof PlayerData) { - player = ((PlayerData) this.parent).player; + return ((PlayerData) this.parent).player; } else { - player = (EntityPlayer) this.parent; + return (EntityPlayer) this.parent; } - return player; } } @@ -111,8 +103,8 @@ public class AnimationData implements IAnimationData { } synchronized (CommonProxy.serverPlayingAnimations) { - if (this.isClientAnimating && this.animationEntity != null && - !this.animationEntity.worldObj.isRemote && this.animation != null) { + if (this.isClientAnimating && this.getMCEntity() != null && + !this.getMCEntity().worldObj.isRemote && this.animation != null) { CommonProxy.serverPlayingAnimations.add(this.animation); } } @@ -268,7 +260,7 @@ public class AnimationData implements IAnimationData { } synchronized (CommonProxy.clientPlayingAnimations) { - if (this.animationEntity != null && this.animationEntity.worldObj.isRemote && newAnim != null) { + if (this.getMCEntity() != null && this.getMCEntity().worldObj.isRemote && newAnim != null) { CommonProxy.clientPlayingAnimations.add(newAnim); } }