Record Class BattleAnimationContext
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.battles.animation.BattleAnimationContext
public record BattleAnimationContext(BattleController controller, @Nullable BattleController rootController, @Nullable PixelmonWrapper user, @Nullable PixelmonWrapper target, @Nullable Attack attack)
extends Record
Shared server-side context for creating and playing battle animations.
The root controller is populated for multi-lane battles so UI-scoped animations can still be coordinated across the whole raid or battle group when necessary.
-
Constructor Summary
ConstructorsConstructorDescriptionBattleAnimationContext(BattleController controller, BattleController rootController, PixelmonWrapper user, PixelmonWrapper target, Attack attack) Creates an instance of aBattleAnimationContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionattack()Returns the value of theattackrecord component.static BattleAnimationContextattack(BattleController controller, PixelmonWrapper user, PixelmonWrapper target, Attack attack) Creates an animation context for an attack animation and derives the root controller when the attack is part of a multi-lane battle.Returns the value of thecontrollerrecord component.final booleanIndicates whether some other object is "equal to" this one.static BattleAnimationContextfrom(StoredContext context) Builds an animation context from an interaction or battle stored context.final inthashCode()Returns a hash code value for this object.Returns the value of therootControllerrecord component.target()Returns the value of thetargetrecord component.final StringtoString()Returns a string representation of this record class.user()Returns the value of theuserrecord component.withController(BattleController controller) Returns a copy of this context bound to another battle controller.
-
Constructor Details
-
BattleAnimationContext
public BattleAnimationContext(BattleController controller, @Nullable BattleController rootController, @Nullable PixelmonWrapper user, @Nullable PixelmonWrapper target, @Nullable Attack attack) Creates an instance of aBattleAnimationContextrecord class.- Parameters:
controller- the value for thecontrollerrecord componentrootController- the value for therootControllerrecord componentuser- the value for theuserrecord componenttarget- the value for thetargetrecord componentattack- the value for theattackrecord component
-
-
Method Details
-
attack
public static BattleAnimationContext attack(BattleController controller, PixelmonWrapper user, PixelmonWrapper target, Attack attack) Creates an animation context for an attack animation and derives the root controller when the attack is part of a multi-lane battle.- Parameters:
controller- the battle controller that produced the attackuser- the attacking Pokemontarget- the targeted Pokemonattack- the attack being animated- Returns:
- a populated attack animation context
-
withController
Returns a copy of this context bound to another battle controller.- Parameters:
controller- the replacement controller- Returns:
- a copied context using the replacement controller
-
from
Builds an animation context from an interaction or battle stored context.- Parameters:
context- the source context- Returns:
- an animation context, or
nullwhen no battle controller is present
-
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). -
controller
Returns the value of thecontrollerrecord component.- Returns:
- the value of the
controllerrecord component
-
rootController
Returns the value of therootControllerrecord component.- Returns:
- the value of the
rootControllerrecord component
-
user
Returns the value of theuserrecord component.- Returns:
- the value of the
userrecord component
-
target
Returns the value of thetargetrecord component.- Returns:
- the value of the
targetrecord component
-
attack
Returns the value of theattackrecord component.- Returns:
- the value of the
attackrecord component
-