Class RegistrarManager

java.lang.Object
dev.architectury.registry.registries.RegistrarManager

public final class RegistrarManager extends Object
Platform-agnostic wrapper of minecraft registries, should be used to register content.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final <T> RegistrarBuilder<T>
    builder(net.minecraft.resources.ResourceLocation registryId, T... typeGetter)
     
    <T> void
    forRegistry(net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> key, Consumer<Registrar<T>> callback)
    Listen to registry registration, the callback is called when content should be registered.
    get(String modId)
     
    <T> Registrar<T>
    get(net.minecraft.core.Registry<T> registry)
    Deprecated.
    <T> Registrar<T>
    get(net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> key)
     
    static <T> @Nullable net.minecraft.resources.ResourceLocation
    getId(T object, @Nullable net.minecraft.core.Registry<T> fallback)
    Deprecated.
    static <T> @Nullable net.minecraft.resources.ResourceLocation
    getId(T object, @Nullable net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> fallback)
    Forge: If the object is IForgeRegistryEntry, use `getRegistryName`, else null Fabric: Use registry
     

    Methods inherited from class java.lang.Object

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

    • get

      public static RegistrarManager get(String modId)
    • get

      public <T> Registrar<T> get(net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> key)
    • get

      @Deprecated public <T> Registrar<T> get(net.minecraft.core.Registry<T> registry)
      Deprecated.
    • forRegistry

      public <T> void forRegistry(net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> key, Consumer<Registrar<T>> callback)
      Listen to registry registration, the callback is called when content should be registered. On forge, this is invoked after RegistryEvent.Register. On fabric, this is invoked immediately.
      Type Parameters:
      T - the type of registry entry
      Parameters:
      key - the key of the registry
      callback - the callback to be invoked
    • builder

      @SafeVarargs public final <T> RegistrarBuilder<T> builder(net.minecraft.resources.ResourceLocation registryId, T... typeGetter)
    • getId

      @Nullable public static <T> @Nullable net.minecraft.resources.ResourceLocation getId(T object, @Nullable @Nullable net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> fallback)
      Forge: If the object is IForgeRegistryEntry, use `getRegistryName`, else null Fabric: Use registry
    • getId

      @Nullable @Deprecated public static <T> @Nullable net.minecraft.resources.ResourceLocation getId(T object, @Nullable @Nullable net.minecraft.core.Registry<T> fallback)
      Deprecated.
      Forge: If the object is IForgeRegistryEntry, use `getRegistryName`, else null Fabric: Use registry
    • getModId

      public String getModId()