Record Class BattleRuleSet

java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.battles.api.rules.BattleRuleSet
Record Components:
name - The name of the rule set, used for display purposes.
description - The description of the rule set, used for display purposes.
icon - The icon of the rule set, used for display purposes.
minPokemonInclusive - The minimum number of Pokémon (inclusive) that must be selected for a battle. [1, 6]
maxPokemonInclusive - The maximum number of Pokémon (inclusive) that can be selected for a battle. [1, 6]
rules - The set of rules that are used to create the BattleRules for a battle.
All Implemented Interfaces:
Iterable<net.minecraft.core.Holder<BattleRule>>, Collection<net.minecraft.core.Holder<BattleRule>>, Set<net.minecraft.core.Holder<BattleRule>>

public record BattleRuleSet(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, TextureProvider icon, int minPokemonInclusive, int maxPokemonInclusive, Set<net.minecraft.core.Holder<BattleRule>> rules) extends Record implements Set<net.minecraft.core.Holder<BattleRule>>
This represents a set of BattleRules that can be applied to a battle.
This is intended to be used for defining a clear "battle type" or "battle ruleset" through datapack and is used for players easily selecting a set of rules for their battle.
  • Field Details

    • DIRECT_CODEC

      public static final com.mojang.serialization.Codec<BattleRuleSet> DIRECT_CODEC
    • NETWORK_CODEC

      public static final com.mojang.serialization.Codec<BattleRuleSet> NETWORK_CODEC
    • CODEC

      public static final com.mojang.serialization.Codec<net.minecraft.core.Holder<BattleRuleSet>> CODEC
    • AG

      public static final net.minecraft.resources.ResourceKey<BattleRuleSet> AG
  • Constructor Details

    • BattleRuleSet

      public BattleRuleSet(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, TextureProvider icon)
    • BattleRuleSet

      public BattleRuleSet(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, TextureProvider icon, List<net.minecraft.core.Holder<BattleRule>> rules)
    • BattleRuleSet

      public BattleRuleSet(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, TextureProvider icon, int minPokemonInclusive, int maxPokemonInclusive, List<net.minecraft.core.Holder<BattleRule>> rules)
    • BattleRuleSet

      public BattleRuleSet(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, TextureProvider icon, int minPokemonInclusive, int maxPokemonInclusive, Set<net.minecraft.core.Holder<BattleRule>> rules)
      Creates an instance of a BattleRuleSet record class.
      Parameters:
      name - the value for the name record component
      description - the value for the description record component
      icon - the value for the icon record component
      minPokemonInclusive - the value for the minPokemonInclusive record component
      maxPokemonInclusive - the value for the maxPokemonInclusive record component
      rules - the value for the rules record component
  • Method Details

    • createRules

      public BattleRules createRules()
    • createAGRules

      public static BattleRules createAGRules(net.minecraft.core.RegistryAccess registryAccess)
    • getAG

      public static net.minecraft.core.Holder<BattleRuleSet> getAG(net.minecraft.core.RegistryAccess registryAccess)
    • size

      public int size()
      Specified by:
      size in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      size in interface Set<net.minecraft.core.Holder<BattleRule>>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      isEmpty in interface Set<net.minecraft.core.Holder<BattleRule>>
    • contains

      public boolean contains(Object o)
      Specified by:
      contains in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      contains in interface Set<net.minecraft.core.Holder<BattleRule>>
    • iterator

      @NotNull public @NotNull Iterator<net.minecraft.core.Holder<BattleRule>> iterator()
      Specified by:
      iterator in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      iterator in interface Iterable<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      iterator in interface Set<net.minecraft.core.Holder<BattleRule>>
    • toArray

      @NotNull public @NotNull Object[] toArray()
      Specified by:
      toArray in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      toArray in interface Set<net.minecraft.core.Holder<BattleRule>>
    • toArray

      @NotNull public <T> T[] toArray(@NotNull T[] a)
      Specified by:
      toArray in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      toArray in interface Set<net.minecraft.core.Holder<BattleRule>>
    • add

      public boolean add(net.minecraft.core.Holder<BattleRule> battleRule)
      Specified by:
      add in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      add in interface Set<net.minecraft.core.Holder<BattleRule>>
    • remove

      public boolean remove(Object o)
      Specified by:
      remove in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      remove in interface Set<net.minecraft.core.Holder<BattleRule>>
    • containsAll

      public boolean containsAll(@NotNull @NotNull Collection<?> c)
      Specified by:
      containsAll in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      containsAll in interface Set<net.minecraft.core.Holder<BattleRule>>
    • addAll

      public boolean addAll(@NotNull @NotNull Collection<? extends net.minecraft.core.Holder<BattleRule>> c)
      Specified by:
      addAll in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      addAll in interface Set<net.minecraft.core.Holder<BattleRule>>
    • retainAll

      public boolean retainAll(@NotNull @NotNull Collection<?> c)
      Specified by:
      retainAll in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      retainAll in interface Set<net.minecraft.core.Holder<BattleRule>>
    • removeAll

      public boolean removeAll(@NotNull @NotNull Collection<?> c)
      Specified by:
      removeAll in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      removeAll in interface Set<net.minecraft.core.Holder<BattleRule>>
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      clear in interface Set<net.minecraft.core.Holder<BattleRule>>
    • 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 interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      hashCode in interface Set<net.minecraft.core.Holder<BattleRule>>
      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in interface Collection<net.minecraft.core.Holder<BattleRule>>
      Specified by:
      equals in interface Set<net.minecraft.core.Holder<BattleRule>>
      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.
    • name

      public net.minecraft.network.chat.Component name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • description

      public net.minecraft.network.chat.Component description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • icon

      public TextureProvider icon()
      Returns the value of the icon record component.
      Returns:
      the value of the icon record component
    • minPokemonInclusive

      public int minPokemonInclusive()
      Returns the value of the minPokemonInclusive record component.
      Returns:
      the value of the minPokemonInclusive record component
    • maxPokemonInclusive

      public int maxPokemonInclusive()
      Returns the value of the maxPokemonInclusive record component.
      Returns:
      the value of the maxPokemonInclusive record component
    • rules

      public Set<net.minecraft.core.Holder<BattleRule>> rules()
      Returns the value of the rules record component.
      Returns:
      the value of the rules record component