All Known Implementing Classes:
AnyOfAnimationLifetime, DurationAnimationLifetime, EffectRemovedAnimationLifetime

public interface AnimationLifetime
Defines the removal condition for an active battle animation.

An AnimationLifetime decides when an ActiveBattleAnimation has finished and should be cleaned up. Implementations may use a fixed duration, a model animation ending, a battle state condition being removed, the battle ending, or any other animation-specific lifetime rule.

Lifetimes are data-driven and dispatched through the animation lifetime registry using AnimationLifetimeType. Each implementation provides its registered type via type(), allowing CODEC to decode the correct lifetime rule from animation data.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<AnimationLifetime>
    Codec for decoding registered animation lifetime implementations.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks whether the supplied animation has finished and should be removed.
    Gets the registered lifetime type for this implementation.
  • Field Details

    • CODEC

      static final com.mojang.serialization.Codec<AnimationLifetime> CODEC
      Codec for decoding registered animation lifetime implementations.

      The concrete lifetime type is resolved through the animation lifetime registry, then dispatched to the matching AnimationLifetimeType.codec().

  • Method Details

    • type

      Gets the registered lifetime type for this implementation.

      This is used by CODEC to dispatch to the correct implementation-specific codec when decoding data-driven animation definitions.

      Returns:
      the registered animation lifetime type
    • isFinished

      boolean isFinished(ActiveBattleAnimation animation)
      Checks whether the supplied animation has finished and should be removed.
      Parameters:
      animation - the active battle animation
      Returns:
      true if the animation should be removed; otherwise false