Interface RegistryObject<T>

Type Parameters:
T - the operand of the object
All Superinterfaces:
Supplier<T>

public interface RegistryObject<T> extends Supplier<T>
Represents a lazy wrapper for registry object.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.core.Holder<T>
    Gets this object wrapped in a vanilla Holder.
    get()
    Gets the object behind this wrapper.
    net.minecraft.resources.ResourceLocation
    Gets the id of the object.
    net.minecraft.resources.ResourceKey<T>
    Gets the ResourceKey of the registry of the object wrapped.
    boolean
     
  • Method Details

    • getResourceKey

      net.minecraft.resources.ResourceKey<T> getResourceKey()
      Gets the ResourceKey of the registry of the object wrapped.
      Returns:
      the ResourceKey of the registry
    • getId

      net.minecraft.resources.ResourceLocation getId()
      Gets the id of the object.
      Returns:
      the id of the object
    • isPresent

      boolean isPresent()
      Returns:
      If the initializer has been registered and assigned
    • get

      T get()
      Gets the object behind this wrapper.
      Specified by:
      get in interface Supplier<T>
      Returns:
      the object behind this wrapper
      Throws:
      NullPointerException - If isPresent() returns false
    • asHolder

      net.minecraft.core.Holder<T> asHolder()
      Gets this object wrapped in a vanilla Holder.
      Returns:
      the holder