Class RegistrationContext

java.lang.Object
org.moddingx.libx.registration.RegistrationContext
Direct Known Subclasses:
SetupContext

public sealed class RegistrationContext extends Object permits SetupContext
Provides some data that is present during registration like the id and registry key of the object being registered.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RegistrationContext(ModXRegistration mod, net.minecraft.resources.ResourceLocation id, net.minecraft.resources.ResourceKey<?> key)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.resources.ResourceLocation
    id()
    Gets the id of the object being registered.
    Optional<net.minecraft.resources.ResourceKey<?>>
    key()
    Gets the ResourceKey of the object being registered.
    mod()
    Gets the mod to which object belongs.
    Optional<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>>
    Gets the registry key of the registry the object is registered in.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RegistrationContext

      public RegistrationContext(ModXRegistration mod, net.minecraft.resources.ResourceLocation id, @Nullable net.minecraft.resources.ResourceKey<?> key)
  • Method Details

    • mod

      public ModXRegistration mod()
      Gets the mod to which object belongs.
    • id

      public net.minecraft.resources.ResourceLocation id()
      Gets the id of the object being registered.
    • key

      public Optional<net.minecraft.resources.ResourceKey<?>> key()
      Gets the ResourceKey of the object being registered. If the object is registered without a registry key, the Optional will be empty.
    • registry

      public Optional<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>> registry()
      Gets the registry key of the registry the object is registered in. If the object is registered without a registry key, the Optional will be empty.