java.lang.Object
org.quiltmc.qsl.frozenblock.core.registry.api.event.RegistryEvents

public class RegistryEvents extends Object
Events for listening to the manipulation of Minecraft's content registries.

The events are to be used for very low-level purposes, and callbacks are only called on registry manipulations occurring after the event registration. This means that mod load order can affect what is picked up by these events.

For more high-level monitoring of registries, including methods to ease the inconvenience of mod load order, use RegistryMonitor.

Modified to work on Fabric

  • Field Details

    • DYNAMIC_REGISTRY_SETUP

      public static final net.fabricmc.fabric.api.event.Event<RegistryEvents.DynamicRegistrySetupCallback> DYNAMIC_REGISTRY_SETUP
      This event gets triggered when a new RegistryAccess gets created, but before it gets filled.

      This event can be used to register callbacks to dynamic registries, or to pre-fill some values.

      Important Note: The passed dynamic registry manager might not contain the registry, as this event is invoked for each layer of the combined registry manager, and each layer holds different registries. Use RegistryAccess.registry(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<? extends E>>) to prevent crashes.

    • DYNAMIC_REGISTRY_LOADED

      public static final net.fabricmc.fabric.api.event.Event<RegistryEvents.DynamicRegistryLoadedCallback> DYNAMIC_REGISTRY_LOADED
      This event gets triggered when a new RegistryAccess gets created, after it has been filled with the registry entries specified by data packs.

      This event can be used to register callbacks to dynamic registries, or to inspect values.

      Important Note: The passed dynamic registry manager might not contain the registry, as this event is invoked for each layer of the combined registry manager, and each layer holds different registries. Use RegistryAccess.registry(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<? extends E>>) to prevent crashes.

  • Constructor Details

    • RegistryEvents

      public RegistryEvents()
  • Method Details

    • getEntryAddEvent

      public static <V> net.fabricmc.fabric.api.event.Event<RegistryEvents.EntryAdded<V>> getEntryAddEvent(net.minecraft.core.Registry<V> registry)
      Gets the entry added event for a specific Minecraft registry.

      The event is invoked upon the addition or assignment of an entry in the specified registry.

      Type Parameters:
      V - the entry type of the Registry to listen for
      Parameters:
      registry - the Registry for this event to listen for. Must be an instance of MappedRegistry.
      Returns:
      the entry added event for the specified registry, which can have callbacks registered to it
      Throws:
      ClassCastException - if the registry is not a MappedRegistry