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 theBattleRules
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
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.
BattleRule
s 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceKey
<BattleRuleSet> static final com.mojang.serialization.Codec
<net.minecraft.core.Holder<BattleRuleSet>> static final com.mojang.serialization.Codec
<BattleRuleSet> static final com.mojang.serialization.Codec
<BattleRuleSet> -
Constructor Summary
ConstructorsConstructorDescriptionBattleRuleSet
(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, TextureProvider icon) 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
(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 aBattleRuleSet
record class.BattleRuleSet
(net.minecraft.network.chat.Component name, net.minecraft.network.chat.Component description, TextureProvider icon, List<net.minecraft.core.Holder<BattleRule>> rules) -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(net.minecraft.core.Holder<BattleRule> battleRule) boolean
addAll
(@NotNull Collection<? extends net.minecraft.core.Holder<BattleRule>> c) void
clear()
boolean
boolean
containsAll
(@NotNull Collection<?> c) static BattleRules
createAGRules
(net.minecraft.core.RegistryAccess registryAccess) net.minecraft.network.chat.Component
Returns the value of thedescription
record component.final boolean
Indicates whether some other object is "equal to" this one.static net.minecraft.core.Holder
<BattleRuleSet> getAG
(net.minecraft.core.RegistryAccess registryAccess) final int
hashCode()
Returns a hash code value for this object.icon()
Returns the value of theicon
record component.boolean
isEmpty()
@NotNull Iterator
<net.minecraft.core.Holder<BattleRule>> iterator()
int
Returns the value of themaxPokemonInclusive
record component.int
Returns the value of theminPokemonInclusive
record component.net.minecraft.network.chat.Component
name()
Returns the value of thename
record component.boolean
boolean
removeAll
(@NotNull Collection<?> c) boolean
retainAll
(@NotNull Collection<?> c) Set
<net.minecraft.core.Holder<BattleRule>> rules()
Returns the value of therules
record component.int
size()
@NotNull Object[]
toArray()
<T> T[]
toArray
(T[] a) final String
toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
spliterator
-
Field Details
-
DIRECT_CODEC
-
NETWORK_CODEC
-
CODEC
-
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 aBattleRuleSet
record class.- Parameters:
name
- the value for thename
record componentdescription
- the value for thedescription
record componenticon
- the value for theicon
record componentminPokemonInclusive
- the value for theminPokemonInclusive
record componentmaxPokemonInclusive
- the value for themaxPokemonInclusive
record componentrules
- the value for therules
record component
-
-
Method Details
-
createRules
-
createAGRules
-
getAG
public static net.minecraft.core.Holder<BattleRuleSet> getAG(net.minecraft.core.RegistryAccess registryAccess) -
size
public int size()- Specified by:
size
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
size
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
isEmpty
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
contains
- Specified by:
contains
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
contains
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
iterator
- Specified by:
iterator
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
iterator
in interfaceIterable<net.minecraft.core.Holder<BattleRule>>
- Specified by:
iterator
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
toArray
- Specified by:
toArray
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
toArray
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
toArray
@NotNull public <T> T[] toArray(@NotNull T[] a) - Specified by:
toArray
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
toArray
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
add
- Specified by:
add
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
add
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
remove
- Specified by:
remove
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
remove
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
containsAll
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
addAll
public boolean addAll(@NotNull @NotNull Collection<? extends net.minecraft.core.Holder<BattleRule>> c) - Specified by:
addAll
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
addAll
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
retainAll
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
removeAll
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
clear
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
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.- Specified by:
hashCode
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
hashCode
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
- Specified by:
hashCode
in classRecord
- Returns:
- a hash code value for this object
-
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='.- Specified by:
equals
in interfaceCollection<net.minecraft.core.Holder<BattleRule>>
- Specified by:
equals
in interfaceSet<net.minecraft.core.Holder<BattleRule>>
- Specified by:
equals
in classRecord
- Parameters:
o
- the object with which to compare- Returns:
true
if this object is the same as theo
argument;false
otherwise.
-
name
public net.minecraft.network.chat.Component name()Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
description
public net.minecraft.network.chat.Component description()Returns the value of thedescription
record component.- Returns:
- the value of the
description
record component
-
icon
Returns the value of theicon
record component.- Returns:
- the value of the
icon
record component
-
minPokemonInclusive
public int minPokemonInclusive()Returns the value of theminPokemonInclusive
record component.- Returns:
- the value of the
minPokemonInclusive
record component
-
maxPokemonInclusive
public int maxPokemonInclusive()Returns the value of themaxPokemonInclusive
record component.- Returns:
- the value of the
maxPokemonInclusive
record component
-
rules
Returns the value of therules
record component.- Returns:
- the value of the
rules
record component
-