Class DynamicRegistryRegistry

java.lang.Object
io.github.vampirestudios.vampirelib.DynamicRegistryRegistry

@Experimental public class DynamicRegistryRegistry extends Object
Methods for registering dynamically loadable registries. These registries are loaded after static registries are frozen and have full access to them, alongside any other dynamic registry loaded before them.

NOTE: These registries are not reloadable.

Experimental feature, dynamic registries are a pretty new feature, and Mojang can make any changes to these registries during snapshots. Since we cannot guarantee this will work in the next snapshots, we reserve the right to remove or change it without further notice.

The path used for key is used as path for resource search as well, so "fabric-api:dynamic_data" would be searched in "resources/data/modid/dynamic_data/", modid being mod id of any mod, it is recommended to use your mod id in registry path to avoid path clashes, like "fabric-api:fabric-api/dynamic_data".

  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> net.minecraft.resources.RegistryDataLoader.RegistryData<T>
    register(net.minecraft.resources.RegistryDataLoader.RegistryData<T> entry)
    Registers a dynamically loaded registry.
    static <T> net.minecraft.resources.RegistryDataLoader.RegistryData<T>
    register(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> key, com.mojang.serialization.Codec<T> codec)
    Registers a dynamically loaded registry.
    static <T> net.minecraft.resources.RegistryDataLoader.RegistryData<T>
    registerAfter(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> after, net.minecraft.resources.RegistryDataLoader.RegistryData<T> entry)
    Registers a dynamically loaded registry after a specific entry.
    static <T> net.minecraft.resources.RegistryDataLoader.RegistryData<T>
    registerAfter(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> after, net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> key, com.mojang.serialization.Codec<T> codec)
    Registers a dynamically loaded registry after a specific entry.
    static <T> net.minecraft.resources.RegistryDataLoader.RegistryData<T>
    registerBefore(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> before, net.minecraft.resources.RegistryDataLoader.RegistryData<T> entry)
    Registers a dynamically loaded registry before a specific entry.
    static <T> net.minecraft.resources.RegistryDataLoader.RegistryData<T>
    registerBefore(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> before, net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> key, com.mojang.serialization.Codec<T> codec)
    Registers a dynamically loaded registry before a specific entry.

    Methods inherited from class java.lang.Object

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

    • register

      public static <T> net.minecraft.resources.RegistryDataLoader.RegistryData<T> register(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> key, com.mojang.serialization.Codec<T> codec)
      Registers a dynamically loaded registry.
      Parameters:
      key - Registry key for the registry
      codec - The codec used for deserialization
      Throws:
      IllegalStateException - if key path clashes with an already registered entry
    • register

      public static <T> net.minecraft.resources.RegistryDataLoader.RegistryData<T> register(net.minecraft.resources.RegistryDataLoader.RegistryData<T> entry)
      Registers a dynamically loaded registry.
      Parameters:
      entry - The entry
      Throws:
      IllegalStateException - if key path clashes with an already registered entry
    • registerBefore

      public static <T> net.minecraft.resources.RegistryDataLoader.RegistryData<T> registerBefore(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> before, net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> key, com.mojang.serialization.Codec<T> codec)
      Registers a dynamically loaded registry before a specific entry. If there is no matching entry with key, entry is added to the end of the list.
      Parameters:
      before - Entry key to register before.
      key - Registry key for the registry
      codec - The codec used for deserialization
      Throws:
      IllegalStateException - if key path clashes with an already registered entry
    • registerBefore

      public static <T> net.minecraft.resources.RegistryDataLoader.RegistryData<T> registerBefore(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> before, net.minecraft.resources.RegistryDataLoader.RegistryData<T> entry)
      Registers a dynamically loaded registry before a specific entry. If there is no matching entry with key, entry is added to the end of the list.
      Parameters:
      before - Entry key to register before.
      entry - The entry
      Throws:
      IllegalStateException - if key path clashes with an already registered entry
    • registerAfter

      public static <T> net.minecraft.resources.RegistryDataLoader.RegistryData<T> registerAfter(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> after, net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> key, com.mojang.serialization.Codec<T> codec)
      Registers a dynamically loaded registry after a specific entry. If there is no matching entry with key, entry is added to the end of the list.
      Parameters:
      after - Entry key to register after.
      key - Registry key for the registry
      codec - The codec used for deserialization
      Throws:
      IllegalStateException - if key path clashes with an already registered entry
    • registerAfter

      public static <T> net.minecraft.resources.RegistryDataLoader.RegistryData<T> registerAfter(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> after, net.minecraft.resources.RegistryDataLoader.RegistryData<T> entry)
      Registers a dynamically loaded registry after a specific entry. If there is no matching entry with key, entry is added to the end of the list.
      Parameters:
      after - Entry key to register after.
      entry - The entry
      Throws:
      IllegalStateException - if key path clashes with an already registered entry