Record Class BattleRule
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.battles.api.rules.BattleRule
- Record Components:
modifiers- The modifiers that apply to the battle.requirements- The requirements that the participants' Pokémon must meet to be valid for the battle.
public record BattleRule(List<BattleModifier> modifiers, List<ReasonedBattleRequirement> requirements)
extends Record
A battle rule is a single rule that can be applied to a battle.
They are used to modify the battle, and check that the participants' Pokémon meet some set of requirements.
To see a list of all available modifiers, and requirements, check out the
All BattleRules are immutable, and are intended to be created through the datapackable registry
They are used to modify the battle, and check that the participants' Pokémon meet some set of requirements.
To see a list of all available modifiers, and requirements, check out the
PixelmonRegistry, or BattleModifierTypes,
and BattleRequirementTypes respectively.
All BattleRules are immutable, and are intended to be created through the datapackable registry
PixelmonRegistry.BATTLE_RULE_REGISTRY.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<net.minecraft.core.Holder<BattleRule>> static final com.mojang.serialization.Codec<BattleRule> static final BattleRule -
Constructor Summary
ConstructorsConstructorDescriptionBattleRule(List<BattleModifier> modifiers, List<ReasonedBattleRequirement> requirements) Creates an instance of aBattleRulerecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(BattleController controller) final booleanIndicates whether some other object is "equal to" this one.List<net.minecraft.network.chat.Component> getFailureReasons(Pokemon... pokemon) List<net.minecraft.network.chat.Component> getFailureReasons(PartyStorage storage) List<net.minecraft.network.chat.Component> getFailureReasons(BattleParticipant participant) List<net.minecraft.network.chat.Component> getFailureReasons(Collection<Pokemon> pokemon) final inthashCode()Returns a hash code value for this object.Returns the value of themodifiersrecord component.Returns the value of therequirementsrecord component.final StringtoString()Returns a string representation of this record class.booleanbooleanvalidate(PartyStorage storage) booleanvalidate(BattleParticipant participant) booleanvalidate(Collection<Pokemon> pokemon)
-
Field Details
-
DIRECT_CODEC
-
CODEC
-
EMPTY
-
-
Constructor Details
-
BattleRule
Creates an instance of aBattleRulerecord class.- Parameters:
modifiers- the value for themodifiersrecord componentrequirements- the value for therequirementsrecord component
-
-
Method Details
-
validate
-
validate
-
validate
-
validate
-
getFailureReasons
-
getFailureReasons
-
getFailureReasons
-
getFailureReasons
-
apply
-
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). -
modifiers
Returns the value of themodifiersrecord component.- Returns:
- the value of the
modifiersrecord component
-
requirements
Returns the value of therequirementsrecord component.- Returns:
- the value of the
requirementsrecord component
-