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 Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<BattleAnimation> static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<BattleAnimation>> -
Constructor Summary
ConstructorsConstructorDescriptionBattleAnimation(List<net.minecraft.resources.ResourceKey<InteractionEvent>> triggers, InteractionCondition condition, Map<String, Integer> markers, List<ScheduledBattleAnimationAction> actions, BattleAnimationAudience audience) BattleAnimation(Set<net.minecraft.resources.ResourceKey<InteractionEvent>> triggers, InteractionCondition condition, Map<String, Integer> markers, List<ScheduledBattleAnimationAction> actions, BattleAnimationAudience audience) Creates an instance of aBattleAnimationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionactions()Returns the value of theactionsrecord component.audience()Returns the value of theaudiencerecord component.Returns the value of theconditionrecord component.create(BattleAnimationContext context) Creates the runtime animation instance for this definition.final booleanIndicates whether some other object is "equal to" this one.booleanhandleEvent(net.minecraft.core.Holder<InteractionEvent> event, StoredContext context) Attempts to trigger this animation from an interaction event context.final inthashCode()Returns a hash code value for this object.markers()Returns the value of themarkersrecord component.voidplay(BattleAnimationContext context) Plays this animation using a prepared animation context.voidplay(BattleController controller, PixelmonWrapper user, PixelmonWrapper target, Attack attack) Plays this animation for an attack context.final StringtoString()Returns a string representation of this record class.Set<net.minecraft.resources.ResourceKey<InteractionEvent>> triggers()Returns the value of thetriggersrecord component.
-
Field Details
-
REGISTRY
public static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<BattleAnimation>> REGISTRY -
CODEC
-
-
Constructor Details
-
BattleAnimation
public BattleAnimation(List<net.minecraft.resources.ResourceKey<InteractionEvent>> triggers, InteractionCondition condition, Map<String, Integer> markers, List<ScheduledBattleAnimationAction> actions, BattleAnimationAudience audience) -
BattleAnimation
public BattleAnimation(Set<net.minecraft.resources.ResourceKey<InteractionEvent>> triggers, InteractionCondition condition, Map<String, Integer> markers, List<ScheduledBattleAnimationAction> actions, BattleAnimationAudience audience) Creates an instance of aBattleAnimationrecord class.- Parameters:
triggers- the value for thetriggersrecord componentcondition- the value for theconditionrecord componentmarkers- the value for themarkersrecord componentactions- the value for theactionsrecord componentaudience- the value for theaudiencerecord component
-
-
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 animationuser- the attacking Pokemontarget- the targeted Pokemonattack- the attack being animated
-
play
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 holdercontext- the collected event context- Returns:
trueif the animation was triggered;falseotherwise
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
triggers
Returns the value of thetriggersrecord component.- Returns:
- the value of the
triggersrecord component
-
condition
Returns the value of theconditionrecord component.- Returns:
- the value of the
conditionrecord component
-
markers
Returns the value of themarkersrecord component.- Returns:
- the value of the
markersrecord component
-
actions
Returns the value of theactionsrecord component.- Returns:
- the value of the
actionsrecord component
-
audience
Returns the value of theaudiencerecord component.- Returns:
- the value of the
audiencerecord component
-