[API] isPlayingAnimation() does not return correctly
Description
Calling isPlayingAnimation()
(or getAnimation()
) in the same tick asplayAnimation()
always returns false
/ null
with the new State‑Machine system.
public static void playAnimation(ActiveModel activeModel,String animationID,int priority){
AnimationHandler iHandler = activeModel.getAnimationHandler();
if(!(iHandler instanceof IStateMachineHandler handler)) return;
IAnimationProperty animation = handler.playAnimation(priority,animationID,1,1,1,true);
//handler.prepare(); <- Calling this before isPlayingAnimation() makes isPlayingAnimation() return true as correctly. But the animation runs 1 tick much faster.
handler.isPlayingAnimation(priority,animationID); // <- always false in the same tick. It returns true since the next tick
handler.getAnimation(priority,animationID); // likewise, returns null
}
I expect stopAnimation() or forceStopAnimation() kind of methods also would not work if called in the same tick as playAnimation()
(+) calling playanimation() just next of stopanimation() or forcestopanimation() does not play a animation.
public static void test(ActiveModel activeModel,String animationID,int priority){
AnimationHandler iHandler = activeModel.getAnimationHandler();
if(!(iHandler instanceof IStateMachineHandler handler)) return;
handler.playAnimation(priority,animationID,1,1,1,true);
//wait a few ticks
//ex. Wait 5 tick
handler.forceStopAnimation(priority,animationID); // animation stops well.
handler.playAnimation(priority,animationID,1,1,1,true); // <- this animation will not play even if force = true.
}
Only the new state-machine system has these problems. The old priority system with these methods was ok.
Minecraft Version: 1.21.4 Server: Purpur 1.21.4 ModelEngine Version: R4.0.9
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information