Record Class AnyHolderSet<T>
java.lang.Object
java.lang.Record
net.neoforged.neoforge.registries.holdersets.AnyHolderSet<T>
- All Implemented Interfaces:
Iterable<Holder<T>>
,HolderSet<T>
,IHolderSetExtension<T>
,ICustomHolderSet<T>
public record AnyHolderSet<T>(HolderLookup.RegistryLookup<T> registryLookup)
extends Record
implements ICustomHolderSet<T>
Holderset that represents all elements of a registry. Json format:
{ "type": "neoforge:any" }
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.core.HolderSet
HolderSet.Direct<T>, HolderSet.ListBacked<T>, HolderSet.Named<T>
Nested classes/interfaces inherited from interface net.neoforged.neoforge.common.extensions.IHolderSetExtension
IHolderSetExtension.SerializationType
-
Field Summary
Modifier and TypeFieldDescriptionprivate final HolderLookup.RegistryLookup
<T> The field for theregistryLookup
record component. -
Constructor Summary
ConstructorDescriptionAnyHolderSet
(HolderLookup.RegistryLookup<T> registryLookup) Creates an instance of aAnyHolderSet
record class. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canSerializeIn
(HolderOwner<T> holderOwner) static <T> com.mojang.serialization.MapCodec
<? extends ICustomHolderSet<T>> codec
(ResourceKey<? extends Registry<T>> registryKey, com.mojang.serialization.Codec<Holder<T>> holderCodec, boolean forceList) boolean
final boolean
Indicates whether some other object is "equal to" this one.get
(int i) getRandomElement
(RandomSource random) final int
hashCode()
Returns a hash code value for this object.iterator()
Returns the value of theregistryLookup
record component.int
size()
stream()
toString()
Returns a string representation of this record class.type()
Returns HolderSetType registered toinvalid reference
ForgeRegistries.HOLDER_SET_TYPES
unwrap()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.neoforged.neoforge.registries.holdersets.ICustomHolderSet
serializationType
Methods inherited from interface net.neoforged.neoforge.common.extensions.IHolderSetExtension
addInvalidationListener
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
registryLookup
The field for theregistryLookup
record component.
-
-
Constructor Details
-
AnyHolderSet
Creates an instance of aAnyHolderSet
record class.- Parameters:
registryLookup
- the value for theregistryLookup
record component
-
-
Method Details
-
codec
public static <T> com.mojang.serialization.MapCodec<? extends ICustomHolderSet<T>> codec(ResourceKey<? extends Registry<T>> registryKey, com.mojang.serialization.Codec<Holder<T>> holderCodec, boolean forceList) -
type
Description copied from interface:ICustomHolderSet
Returns HolderSetType registered toinvalid reference
ForgeRegistries.HOLDER_SET_TYPES
- Specified by:
type
in interfaceICustomHolderSet<T>
- Returns:
- HolderSetType registered to
invalid reference
ForgeRegistries.HOLDER_SET_TYPES
-
iterator
-
stream
-
size
public int size() -
unwrap
-
getRandomElement
- Specified by:
getRandomElement
in interfaceHolderSet<T>
-
get
-
contains
-
canSerializeIn
- Specified by:
canSerializeIn
in interfaceHolderSet<T>
-
unwrapKey
-
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)
. -
registryLookup
Returns the value of theregistryLookup
record component.- Returns:
- the value of the
registryLookup
record component
-