mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 03:47:27 +00:00
Important IAnimation takeTasksFrom global instance in AnimationController to local instance in entity AnimationData
This commit is contained in:
1 parent
db0aa94a3a
commit
e8ef60deb4
2 files changed
+17
No files matched your search
@@ -353,6 +353,22 @@ public class Animation implements IAnimation {
|
||||
this.onAnimationEnd.accept(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Only called on setAnimation, to transfer tasks from
|
||||
* this global instance stored in AnimationController
|
||||
* to the new local instance on entity's AnimationData,
|
||||
* and clear them from the global instance.
|
||||
*/
|
||||
public void takeTasksFrom(Animation animation) {
|
||||
this.onAnimationStart = animation.onAnimationStart;
|
||||
this.onAnimationFrame = animation.onAnimationFrame;
|
||||
this.onAnimationEnd = animation.onAnimationEnd;
|
||||
|
||||
animation.onAnimationEnd = null;
|
||||
animation.onAnimationFrame = null;
|
||||
animation.onAnimationStart = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -272,6 +272,7 @@ public class AnimationData implements IAnimationData {
|
||||
newAnim.currentFrame = 0;
|
||||
newAnim.currentFrameTime = 0;
|
||||
newAnim.parent = this;
|
||||
newAnim.takeTasksFrom((Animation) animation);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user