mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 03:47:27 +00:00
Fixed animations not ticking correctly sometimes.
This commit is contained in:
1 parent
a07a33c068
commit
ae2edfd79f
3 files changed
+55
-37
No files matched your search
@@ -32,6 +32,7 @@ public class AnimationData implements IAnimationData {
|
||||
|
||||
public Animation animation;
|
||||
public boolean allowAnimation = false;
|
||||
public long animatingTime = 0;
|
||||
|
||||
public Animation currentClientAnimation;
|
||||
private boolean isClientAnimating;
|
||||
@@ -93,6 +94,7 @@ public class AnimationData implements IAnimationData {
|
||||
EventHooks.onAnimationEnded(this.currentClientAnimation);
|
||||
}
|
||||
if (this.isClientAnimating) {
|
||||
this.animatingTime = 0;
|
||||
this.currentClientAnimation = this.animation;
|
||||
}
|
||||
|
||||
@@ -105,7 +107,7 @@ public class AnimationData implements IAnimationData {
|
||||
synchronized (CommonProxy.serverPlayingAnimations) {
|
||||
if (this.isClientAnimating && this.getMCEntity() != null &&
|
||||
!this.getMCEntity().worldObj.isRemote && this.animation != null) {
|
||||
CommonProxy.serverPlayingAnimations.add(this.animation);
|
||||
CommonProxy.serverPlayingAnimations.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +162,14 @@ public class AnimationData implements IAnimationData {
|
||||
}
|
||||
}
|
||||
|
||||
public void increaseTime() {
|
||||
if (this.isActive()) {
|
||||
this.animation.increaseTime();
|
||||
} else if (this.isActive(animation.parent.currentClientAnimation)) {
|
||||
this.currentClientAnimation.increaseTime();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCached(int id) {
|
||||
return this.cachedAnimationIDs.contains(id);
|
||||
}
|
||||
@@ -259,9 +269,11 @@ public class AnimationData implements IAnimationData {
|
||||
newAnim.parent = this;
|
||||
}
|
||||
|
||||
synchronized (CommonProxy.clientPlayingAnimations) {
|
||||
if (this.getMCEntity() != null && this.getMCEntity().worldObj.isRemote && newAnim != null) {
|
||||
CommonProxy.clientPlayingAnimations.add(newAnim);
|
||||
|
||||
if (this.getMCEntity() != null && this.getMCEntity().worldObj.isRemote && newAnim != null) {
|
||||
this.animatingTime = 0;
|
||||
synchronized (CommonProxy.clientPlayingAnimations) {
|
||||
CommonProxy.clientPlayingAnimations.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,4 +302,8 @@ public class AnimationData implements IAnimationData {
|
||||
public IAnimation getAnimation() {
|
||||
return animation;
|
||||
}
|
||||
|
||||
public long getAnimatingTime() {
|
||||
return this.animatingTime;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user