java.lang.Object
com.pixelmonmod.pixelmon.battles.api.rules.clauses.BattleClause
All Implemented Interfaces:
IEncodeable, Comparable<BattleClause>
Direct Known Subclasses:
AbilityClause, ItemPreventClause, LogicalAndBattleClause, LogicalOrBattleClause, MaximumOneBatonPass, MoveClause, MultipleSpeciesClause, NoDuplicateItemClause, PokemonBanClause, SkyBattleClause, SpeedPassClause, Tier

public class BattleClause extends Object implements Comparable<BattleClause>, IEncodeable
A clause that imposes restrictions on a battle. The unique ID of the battle clause. Should not be the same as another clause ID, and should not be a reserved keyword ("e", "f", "n"). The description of the clause, if not using the default lang key. If this is null, the description will use the lang key at "gui.battlerules.description.".
  • Constructor Details

    • BattleClause

      public BattleClause(String id)
      Initializes a battle clause definition.
      Parameters:
      id - The unique ID of the battle clause.
  • Method Details

    • setDescription

      public BattleClause setDescription(String description)
      Sets a non-default description for the clause.
      Parameters:
      description - The description of the clause.
      Returns:
      The battle clause instance.
    • getID

      public String getID()
      Gets the unique ID of the battle clause.
      Returns:
      The unique ID of the battle clause.
    • getDescription

      public String getDescription()
      Gets a description of the battle clause.
      Returns:
      A description of the battle clause.
    • getLocalizedName

      public String getLocalizedName()
      Gets the translated name of the battle clause.
      Returns:
      The translated name of the battle clause.
    • getLocalizedName

      public static String getLocalizedName(String clauseID)
      Gets the translated name of the battle clause.
      Parameters:
      clauseID - The ID of the clause to translate.
      Returns:
      The translated name of the battle clause.
    • validateSingle

      public boolean validateSingle(Pokemon pokemon)
      Checks if the rule allows a Pokémon to be chosen for battle.
      Parameters:
      pokemon - The Pokémon to check.
      Returns:
      Whether the rule allows the given Pokémon to be chosen for battle.
    • validateTeam

      public boolean validateTeam(List<Pokemon> team)
      Checks if the rule allows a list of Pokémon to be chosen for battle.
      Parameters:
      team - The Pokémon to check.
      Returns:
      Whether the rule allows the given team to be chosen for battle.
    • encodeInto

      public void encodeInto(net.minecraft.network.FriendlyByteBuf buffer)
      Description copied from interface: IEncodeable
      Encodes the object into a buffer.
      Specified by:
      encodeInto in interface IEncodeable
      Parameters:
      buffer - The buffer to encode the object into.
    • decodeInto

      public void decodeInto(net.minecraft.network.FriendlyByteBuf buffer)
      Description copied from interface: IEncodeable
      Decodes the object from a buffer.
      Specified by:
      decodeInto in interface IEncodeable
      Parameters:
      buffer - The buffer to decode the object from.
    • compareTo

      public int compareTo(BattleClause o)
      Specified by:
      compareTo in interface Comparable<BattleClause>
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object