Interface IHolderExtension<T>
- All Superinterfaces:
IWithData<T>
- All Known Subinterfaces:
Holder<T>
- All Known Implementing Classes:
DeferredBlock, DeferredHolder, DeferredItem, Holder.Direct, Holder.Reference, PatchedRegistry.LazyHolder
-
Method Summary
Modifier and TypeMethodDescriptionReturns the holder that this holder wraps.default @Nullable ResourceKey<T> getKey()Deprecated, for removal: This API element is subject to removal in a future version.default ResourceKey<T> key()Get the resource key held by this Holder.default @Nullable ResourceKey<T> Get the resource key held by this Holder, or null if none is present.default @Nullable HolderLookup.RegistryLookup<T> Attempts to resolve the underlyingHolderLookup.RegistryLookupfrom aHolder.
-
Method Details
-
getDelegate
Returns the holder that this holder wraps. Used byRegistry.safeCastToReference(Holder)to resolve the underlyingHolder.Referencefor delegating holders.- Returns:
- the holder that this holder wraps
-
unwrapLookup
Attempts to resolve the underlyingHolderLookup.RegistryLookupfrom aHolder.This will only succeed if the underlying holder is a
Holder.Reference. -
getKey
Deprecated, for removal: This API element is subject to removal in a future version.Call eitherkey()orkeyOrNull()Get the resource key held by this Holder, or null if none is present. This method will be overridden by Holder implementations to avoid allocation associated withHolder.unwrapKey(). -
key
Get the resource key held by this Holder. This method will be overridden by Holder implementations to avoid allocation associated withHolder.unwrapKey()- Throws:
IllegalStateException- If the key has not yet been bound and this is aHolder.ReferenceNoSuchElementException- If this is aHolder.Direct
-
keyOrNull
Get 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().
-
key()orkeyOrNull()