Record Class BattleAnimation

java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.battles.animation.BattleAnimation

public record BattleAnimation(Set<net.minecraft.resources.ResourceKey<InteractionEvent>> triggers, InteractionCondition condition, Map<String,Integer> markers, List<ScheduledBattleAnimationAction> actions, BattleAnimationAudience audience) extends Record
Datapack-backed definition for a battle animation sequence.

A battle animation declares the interaction events that trigger it, the condition required to play it, timeline markers, scheduled actions, and the battle audience that should receive the visible effect.

  • Field Details

    • REGISTRY

      public static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<BattleAnimation>> REGISTRY
    • CODEC

      public static final com.mojang.serialization.Codec<BattleAnimation> CODEC
  • Constructor Details

  • Method Details

    • play

      public void play(BattleController controller, PixelmonWrapper user, PixelmonWrapper target, Attack attack)
      Plays this animation for an attack context.
      Parameters:
      controller - the battle controller receiving the animation
      user - the attacking Pokemon
      target - the targeted Pokemon
      attack - the attack being animated
    • play

      public void play(BattleAnimationContext context)
      Plays this animation using a prepared animation context.
      Parameters:
      context - the battle animation context
    • create

      Creates the runtime animation instance for this definition.
      Parameters:
      context - the battle animation context
      Returns:
      a runtime animation timeline
    • handleEvent

      public boolean handleEvent(net.minecraft.core.Holder<InteractionEvent> event, StoredContext context)
      Attempts to trigger this animation from an interaction event context.
      Parameters:
      event - the interaction event holder
      context - the collected event context
      Returns:
      true if the animation was triggered; false otherwise
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • triggers

      public Set<net.minecraft.resources.ResourceKey<InteractionEvent>> triggers()
      Returns the value of the triggers record component.
      Returns:
      the value of the triggers record component
    • condition

      public InteractionCondition condition()
      Returns the value of the condition record component.
      Returns:
      the value of the condition record component
    • markers

      public Map<String,Integer> markers()
      Returns the value of the markers record component.
      Returns:
      the value of the markers record component
    • actions

      Returns the value of the actions record component.
      Returns:
      the value of the actions record component
    • audience

      public BattleAnimationAudience audience()
      Returns the value of the audience record component.
      Returns:
      the value of the audience record component