Interface IHolderExtension<T>

All Superinterfaces:
IWithData<T>
All Known Implementing Classes:
DeferredBlock, DeferredBlockBuilder, DeferredEntityTypeBuilder, DeferredHolder, DeferredItem, DeferredItemBuilder

public interface IHolderExtension<T> extends IWithData<T>
Extension for Holder
  • Method Summary

    Modifier and Type
    Method
    Description
    default net.minecraft.core.Holder<T>
    Returns the holder that this holder wraps.
    default @Nullable net.minecraft.resources.ResourceKey<T>
    Get the resource key held by this Holder, or null if none is present.
    default net.minecraft.core.HolderLookup.RegistryLookup<T>
    Attempts to resolve the underlying HolderLookup.RegistryLookup from a Holder.

    Methods inherited from interface net.neoforged.neoforge.registries.datamaps.IWithData

    getData
  • Method Details

    • getDelegate

      default net.minecraft.core.Holder<T> getDelegate()
      Returns the holder that this holder wraps. Used by Registry.safeCastToReference(net.minecraft.core.Holder<T>) to resolve the underlying Holder.Reference for delegating holders.
      Returns:
      the holder that this holder wraps
    • unwrapLookup

      @Nullable default net.minecraft.core.HolderLookup.RegistryLookup<T> unwrapLookup()
      Attempts to resolve the underlying HolderLookup.RegistryLookup from a Holder.

      This will only succeed if the underlying holder is a Holder.Reference.

    • getKey

      @Nullable default @Nullable net.minecraft.resources.ResourceKey<T> getKey()
      Get the resource key held by this Holder, or null if none is present. This method will be overriden by Holder implementations to avoid allocation associated with Holder.unwrapKey()