Class EntityAnimator<E extends net.minecraft.world.entity.LivingEntity,M extends IModelPartProvider<E>>

java.lang.Object
dev.oxydien.mathimations.animations.EntityAnimator<E,M>
Type Parameters:
E - The type of the entity
M - Model part provider

public class EntityAnimator<E extends net.minecraft.world.entity.LivingEntity,M extends IModelPartProvider<E>> extends Object
The main controller that manages all animation layers for an entity. Coordinates updates and uses the mixer to produce final poses. If you don't know what you are doing, you probably want to use EntityAnimationWrapper instead.
  • Constructor Summary

    Constructors
    Constructor
    Description
    EntityAnimator(E entity, M modelProvider, byte layerCount)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the number of layers in this animator
    void
    playAnimation(byte layerIndex, short animationId)
    Play an animation on a specific layer
    void
    playAnimationIf(byte layerIndex, short animationId, IAnimationCondition condition)
    Play an animation on a specific layer if the condition is met
    void
    registerAnimation(byte layerIndex, short animationId, IMathAnimation<E> animation)
    Register an animation to a specific layer
    void
    Reset all model parts to their default pose
    void
    stopAnimation(byte layerIndex, short animationId, float transitionTime)
    Stop an animation on a specific layer
    void
    stopLayer(byte layerIndex, float transitionTime)
    Stop all animations on a specific layer
    updatePose(float partialTicks)
    Update all layers and apply final pose to the model

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EntityAnimator

      public EntityAnimator(@NotNull E entity, @NotNull M modelProvider, byte layerCount)
  • Method Details

    • registerAnimation

      public void registerAnimation(byte layerIndex, short animationId, IMathAnimation<E> animation)
      Register an animation to a specific layer
      Parameters:
      layerIndex - The layer index (0 = highest priority)
      animationId - The animation ID
      animation - The animation implementation
    • playAnimation

      public void playAnimation(byte layerIndex, short animationId)
      Play an animation on a specific layer
      Parameters:
      layerIndex - The layer index
      animationId - The animation ID (if not found: ignored)
    • stopAnimation

      public void stopAnimation(byte layerIndex, short animationId, float transitionTime)
      Stop an animation on a specific layer
      Parameters:
      layerIndex - The layer index
      animationId - The animation ID
      transitionTime - Time to fade out (-1 to use animation's default transition time)
    • stopLayer

      public void stopLayer(byte layerIndex, float transitionTime)
      Stop all animations on a specific layer
      Parameters:
      layerIndex - The layer index
      transitionTime - Time to fade out (-1 to use animation's default transition time)
    • playAnimationIf

      public void playAnimationIf(byte layerIndex, short animationId, IAnimationCondition condition)
      Play an animation on a specific layer if the condition is met
      Parameters:
      layerIndex - The layer index
      animationId - The animation ID
      condition - The condition to check
    • updatePose

      public Pose updatePose(float partialTicks)
      Update all layers and apply final pose to the model
      Parameters:
      partialTicks - The partial tick time
      Returns:
      The final merged pose (for debugging/inspection)
    • reset

      public void reset()
      Reset all model parts to their default pose
    • getLayerCount

      public int getLayerCount()
      Get the number of layers in this animator
      Returns:
      The number of layers