Interface AnimationHandler


public interface AnimationHandler
The class that handles everything animation related such as animation updates, calculations, and removal.
  • Method Details

    • getModel

      ActiveModel getModel()
      Get the owner of this animation handler.
    • updateAll

      void updateAll()
      Update method that is called every tick.
    • tickEffects

      void tickEffects()
      Update method for effects that is called every tick.
    • forEachProperty

      void forEachProperty(BiConsumer<String,IAnimationProperty> consumer)
      Shorthand for looping through all animation properties.
      Parameters:
      consumer - action performed per property
    • getAnimation

      IAnimationProperty getAnimation(String animation)
      Get the SimpleProperty object that contains the animation information of the provided ID.
      Parameters:
      animation - the ID of the animation
      Returns:
      the SimpleProperty object of the animation, or null if there is no animation playing under that ID.
    • getAnimations

      List<IAnimationProperty> getAnimations()
      Get an immutable list of all AnimationProperties, ordered by animation priority.
    • getFinalPosition

      org.bukkit.util.Vector getFinalPosition(ModelBone bone)
      Calculate the final position of the specified bone.
      Parameters:
      bone - any bone
      Returns:
      a vector representing the position of the bone in world space
    • getFinalRotation

      org.bukkit.util.EulerAngle getFinalRotation(ModelBone bone)
      Calculate the final rotation of the specified bone.
      Parameters:
      bone - any bone
      Returns:
      an euler rotation representing the rotation of the bone in model space
    • playAnimation

      boolean playAnimation(String animation, double lerpIn, double lerpOut, double speed, boolean force)
      Attempt to play an animation of the specified ID.
      Parameters:
      animation - the animation ID
      lerpIn - time taken to interpolate into the animation (in seconds)
      lerpOut - time taken to interpolate out of the animation (in seconds)
      speed - raw speed multiplier (1 for default speed)
      force - if false, the animation would only play if the model is not currently playing the animation, or the animation is in LERPOUT phase
      Returns:
      true if the animation is being played successfully
    • playAnimation

      boolean playAnimation(IAnimationProperty property, boolean force)
      Attempt to play an animation of the specified ID.
      Parameters:
      property - the IAnimationProperty of the animation
      force - if false, the animation would only play if the model is not currently playing the animation, or the animation is in LERPOUT phase
      Returns:
      true if the animation is being played successfully
    • isPlayingAnimation

      boolean isPlayingAnimation(String animation)
      Check if the handler is already playing the animation.
    • stopAnimation

      void stopAnimation(String animation)
      Stop the animation and start playing the lerp out animation.
      To stop the animation immediately, use forceStopAnimation(String).
    • forceStopAnimation

      void forceStopAnimation(String animation)
      Ignore lerp out animation and stop the animation immediately.
      To stop the animation gracefully, use stopAnimation(String).
    • forceStopAllAnimations

      void forceStopAllAnimations()
      Ignore all lerp out animations and stop all animations immediately.
      This is used to cancel all ongoing animations before playing the death animation.