Interface AnimationHandler

All Superinterfaces:
DataIO
All Known Subinterfaces:
IPriorityHandler, IStateMachineHandler

public interface AnimationHandler extends DataIO
  • Method Details

    • getActiveModel

      ActiveModel getActiveModel()
    • prepare

      void prepare()
    • updateBone

      void updateBone(ModelBone bone)
    • hasFinishedAllAnimations

      boolean hasFinishedAllAnimations()
    • setDefaultProperty

      void setDefaultProperty(AnimationHandler.DefaultProperty defaultProperty)
    • getDefaultProperty

      AnimationHandler.DefaultProperty getDefaultProperty(ModelState state)
    • tickGlobal

      void tickGlobal()
      Update method for global keyframes that is called every tick.
    • playAnimation

      @Nullable @Nullable IAnimationProperty 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:
      Created animation property 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.
    • getAnimation

      @Nullable @Nullable 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

      Map<String,IAnimationProperty> getAnimations()
      Get an unordered immutable map of all AnimationProperties.
    • getId

      String getId()
    • save

      default void save(SavedData data)
      Specified by:
      save in interface DataIO
    • load

      default void load(SavedData data)
      Specified by:
      load in interface DataIO