diff --git a/src/main/java/noppes/npcs/controllers/data/Animation.java b/src/main/java/noppes/npcs/controllers/data/Animation.java index 29dd816e7..5de123d88 100644 --- a/src/main/java/noppes/npcs/controllers/data/Animation.java +++ b/src/main/java/noppes/npcs/controllers/data/Animation.java @@ -251,7 +251,7 @@ public class Animation implements IAnimation { } this.currentFrameTime++; - if (this.currentFrameTime == this.currentFrame().getDuration()) { + if (this.currentFrame() != null && this.currentFrameTime == this.currentFrame().getDuration()) { EventHooks.onAnimationFrameExited(this, this.currentFrame()); Frame prevFrame = (Frame) this.currentFrame(); diff --git a/src/main/java/noppes/npcs/controllers/data/AnimationData.java b/src/main/java/noppes/npcs/controllers/data/AnimationData.java index 112a461cf..ba7fde579 100644 --- a/src/main/java/noppes/npcs/controllers/data/AnimationData.java +++ b/src/main/java/noppes/npcs/controllers/data/AnimationData.java @@ -264,10 +264,13 @@ public class AnimationData implements IAnimationData { CommonProxy.clientPlayingAnimations.add(newAnim); } } + + Animation prevAnim = this.animation; this.animation = newAnim; - if (this.isActive() && newAnim != null && !newAnim.frames.isEmpty()) { - Frame frame = (Frame) this.animation.currentFrame(); + if (this.getMCEntity() != null && this.getMCEntity().worldObj.isRemote && + this.isActive() && prevAnim != null && newAnim != null && !newAnim.frames.isEmpty()) { + Frame frame = (Frame) prevAnim.currentFrame(); if (frame != null) { Frame firstFrame = newAnim.frames.get(0); for (Map.Entry entry : frame.frameParts.entrySet()) {