Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Model Engine 4 Model Engine 4
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 112
    • Issues 112
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • MythicCraft
  • Model Engine 4Model Engine 4
  • Issues
  • #221

Closed
Open
Created Jun 06, 2025 by EIQQ@eiqq

[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

Edited Jun 10, 2025 by EIQQ
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking