Record Class AnyHolderSet<T>
java.lang.Object
java.lang.Record
net.minecraftforge.registries.holdersets.AnyHolderSet<T>
- All Implemented Interfaces:
Iterable<Holder<T>>,HolderSet<T>,IForgeHolderSet<T>,ICustomHolderSet<T>
Holderset that represents all elements of a registry. Json format:
{
"type": "forge:any"
}
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.core.HolderSet
HolderSet.Direct<T>, HolderSet.ListBacked<T>, HolderSet.Named<T> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAnyHolderSet(Registry<T> registry) Creates an instance of aAnyHolderSetrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> com.mojang.serialization.Codec<? extends ICustomHolderSet<T>>codec(ResourceKey<? extends Registry<T>> registryKey, com.mojang.serialization.Codec<Holder<T>> holderCodec, boolean forceList) booleanfinal booleanIndicates whether some other object is "equal to" this one.get(int i) getRandomElement(RandomSource random) final inthashCode()Returns a hash code value for this object.booleanisValidInRegistry(Registry<T> registry) iterator()registry()Returns the value of theregistryrecord component.intsize()stream()toString()Returns a string representation of this record class.type()Returns HolderSetType registered toForgeRegistries.HOLDER_SET_TYPES.unwrap()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraftforge.common.extensions.IForgeHolderSet
addInvalidationListenerMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
registry
The field for theregistryrecord component.
-
-
Constructor Details
-
AnyHolderSet
Creates an instance of aAnyHolderSetrecord class.- Parameters:
registry- the value for theregistryrecord component
-
-
Method Details
-
codec
public static <T> com.mojang.serialization.Codec<? extends ICustomHolderSet<T>> codec(ResourceKey<? extends Registry<T>> registryKey, com.mojang.serialization.Codec<Holder<T>> holderCodec, boolean forceList) -
type
Description copied from interface:ICustomHolderSetReturns HolderSetType registered toForgeRegistries.HOLDER_SET_TYPES.- Specified by:
typein interfaceICustomHolderSet<T>- Returns:
- HolderSetType registered to
ForgeRegistries.HOLDER_SET_TYPES
-
iterator
-
stream
-
size
public int size() -
unwrap
-
getRandomElement
- Specified by:
getRandomElementin interfaceHolderSet<T>
-
get
-
contains
-
isValidInRegistry
- Specified by:
isValidInRegistryin interfaceHolderSet<T>
-
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). -
registry
Returns the value of theregistryrecord component.- Returns:
- the value of the
registryrecord component
-