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 theBattleRulesfor 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.
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 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 aBattleRuleSetrecord 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 TypeMethodDescriptionbooleanadd(net.minecraft.core.Holder<BattleRule> battleRule) booleanaddAll(@NotNull Collection<? extends net.minecraft.core.Holder<BattleRule>> c) voidclear()booleanbooleancontainsAll(@NotNull Collection<?> c) static BattleRulescreateAGRules(net.minecraft.core.RegistryAccess registryAccess) net.minecraft.network.chat.ComponentReturns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.static net.minecraft.core.Holder<BattleRuleSet> getAG(net.minecraft.core.RegistryAccess registryAccess) final inthashCode()Returns a hash code value for this object.icon()Returns the value of theiconrecord component.booleanisEmpty()@NotNull Iterator<net.minecraft.core.Holder<BattleRule>> iterator()intReturns the value of themaxPokemonInclusiverecord component.intReturns the value of theminPokemonInclusiverecord component.net.minecraft.network.chat.Componentname()Returns the value of thenamerecord component.booleanbooleanremoveAll(@NotNull Collection<?> c) booleanretainAll(@NotNull Collection<?> c) Set<net.minecraft.core.Holder<BattleRule>> rules()Returns the value of therulesrecord component.intsize()@NotNull Object[]toArray()<T> T[]toArray(T[] a) final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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 aBattleRuleSetrecord class.- Parameters:
name- the value for thenamerecord componentdescription- the value for thedescriptionrecord componenticon- the value for theiconrecord componentminPokemonInclusive- the value for theminPokemonInclusiverecord componentmaxPokemonInclusive- the value for themaxPokemonInclusiverecord componentrules- the value for therulesrecord 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:
sizein interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
sizein interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
isEmptyin interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
contains
- Specified by:
containsin interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
containsin interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
iterator
- Specified by:
iteratorin interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
iteratorin interfaceIterable<net.minecraft.core.Holder<BattleRule>>- Specified by:
iteratorin interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
toArray
- Specified by:
toArrayin interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
toArrayin interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
toArray
@NotNull public <T> T[] toArray(@NotNull T[] a) - Specified by:
toArrayin interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
toArrayin interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
add
- Specified by:
addin interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
addin interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
remove
- Specified by:
removein interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
removein interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
containsAll
- Specified by:
containsAllin interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
containsAllin interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
addAll
public boolean addAll(@NotNull @NotNull Collection<? extends net.minecraft.core.Holder<BattleRule>> c) - Specified by:
addAllin interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
addAllin interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
retainAll
- Specified by:
retainAllin interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
retainAllin interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
removeAll
- Specified by:
removeAllin interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
removeAllin interfaceSet<net.minecraft.core.Holder<BattleRule>>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
clearin 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:
hashCodein interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
hashCodein interfaceSet<net.minecraft.core.Holder<BattleRule>>- Specified by:
hashCodein 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:
equalsin interfaceCollection<net.minecraft.core.Holder<BattleRule>>- Specified by:
equalsin interfaceSet<net.minecraft.core.Holder<BattleRule>>- Specified by:
equalsin classRecord- Parameters:
o- the object with which to compare- Returns:
trueif this object is the same as theoargument;falseotherwise.
-
name
public net.minecraft.network.chat.Component name()Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
description
public net.minecraft.network.chat.Component description()Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
icon
Returns the value of theiconrecord component.- Returns:
- the value of the
iconrecord component
-
minPokemonInclusive
public int minPokemonInclusive()Returns the value of theminPokemonInclusiverecord component.- Returns:
- the value of the
minPokemonInclusiverecord component
-
maxPokemonInclusive
public int maxPokemonInclusive()Returns the value of themaxPokemonInclusiverecord component.- Returns:
- the value of the
maxPokemonInclusiverecord component
-
rules
Returns the value of therulesrecord component.- Returns:
- the value of the
rulesrecord component
-