Class Holder.Reference<T>
java.lang.Object
net.minecraft.core.Holder.Reference<T>
- All Implemented Interfaces:
Holder<T>, IHolderExtension<T>, IWithData<T>
- Direct Known Subclasses:
DeferredHolder, PatchedRegistry.LazyHolder
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface Holder
Holder.Direct<T>, Holder.Kind, Holder.Reference<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate @Nullable DataComponentMapprivate @Nullable ResourceKey<T> private final HolderOwner<T> private final Holder.Reference.Type -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedReference(Holder.Reference.Type type, HolderOwner<T> owner, @Nullable ResourceKey<T> key, @Nullable T value) -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidbindComponents(DataComponentMap components) (package private) voidbindKey(ResourceKey<T> key) (package private) voidbindTags(Collection<TagKey<T>> tags) protected voidbooleancanSerializeIn(HolderOwner<T> context) static <T> Holder.Reference<T> createIntrusive(HolderOwner<T> owner, @Nullable T value) Deprecated.static <T> Holder.Reference<T> createStandAlone(HolderOwner<T> owner, ResourceKey<T> key) boolean<A> @Nullable AgetData(DataMapType<T, A> type) Returns the data of the given type that is attached to this object, ornullif one isn't.inthashCode()booleanis(Predicate<ResourceKey<T>> predicate) booleanbooleanis(Identifier key) booleanis(ResourceKey<T> key) booleanbooleanisBound()key()Get the resource key held by this Holder.Get the resource key held by this Holder, or null if none is present.kind()tags()toString()com.mojang.datafixers.util.Either<ResourceKey<T>, T> unwrap()Attempts to resolve the underlyingHolderLookup.RegistryLookupfrom aHolder.value()Methods inherited from interface Holder
getRegisteredName, getRegisteredNameIfPresentMethods inherited from interface IHolderExtension
getDelegate, getKey
-
Field Details
-
owner
-
tags
-
components
-
type
-
key
-
value
-
-
Constructor Details
-
Reference
protected Reference(Holder.Reference.Type type, HolderOwner<T> owner, @Nullable ResourceKey<T> key, @Nullable T value)
-
-
Method Details
-
createStandAlone
-
createIntrusive
@Deprecated public static <T> Holder.Reference<T> createIntrusive(HolderOwner<T> owner, @Nullable T value) Deprecated. -
key
Description copied from interface:IHolderExtensionGet the resource key held by this Holder. This method will be overridden by Holder implementations to avoid allocation associated withHolder.unwrapKey()- Specified by:
keyin interfaceIHolderExtension<T>
-
value
-
is
-
is
-
boundTags
-
is
-
is
-
is
-
canSerializeIn
- Specified by:
canSerializeInin interfaceHolder<T>
-
unwrap
-
unwrapKey
-
kind
-
isBound
-
areComponentsBound
public boolean areComponentsBound()- Specified by:
areComponentsBoundin interfaceHolder<T>
-
bindKey
-
bindValue
-
bindTags
-
bindComponents
-
tags
-
components
- Specified by:
componentsin interfaceHolder<T>
-
toString
-
hashCode
-
equals
-
unwrapLookup
Description copied from interface:IHolderExtensionAttempts to resolve the underlyingHolderLookup.RegistryLookupfrom aHolder.This will only succeed if the underlying holder is a
Holder.Reference.- Specified by:
unwrapLookupin interfaceIHolderExtension<T>
-
keyOrNull
Description copied from interface:IHolderExtensionGet the resource key held by this Holder, or null if none is present. This may be the case for intrusive reference holders that have not been bound yet, or for direct holders. This method will be overridden by Holder implementations to avoid allocation associated withHolder.unwrapKey(), and to bypass any key not yet bound checks that would occur inHolder.unwrapKey().- Specified by:
keyOrNullin interfaceIHolderExtension<T>
-
getData
Description copied from interface:IWithDataReturns the data of the given type that is attached to this object, ornullif one isn't.
-