Class ModifyRegistriesEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.registries.ModifyRegistriesEvent
All Implemented Interfaces:
net.neoforged.fml.event.IModBusEvent

public class ModifyRegistriesEvent extends net.neoforged.bus.api.Event implements net.neoforged.fml.event.IModBusEvent
Fired during startup after builtin registries are constructed. For vanilla registries, this event is fired after vanilla entries are registered but before modded entries. For modded registries, this event is fired before any entry is registered.

This event can be used to register callbacks to the registry.

This event cannot be used to modify datapack registries.

This event is not cancellable.

This event is fired on the mod-specific event bus, on both logical sides.

See Also:
  • Constructor Details

    • ModifyRegistriesEvent

      ModifyRegistriesEvent()
  • Method Details

    • getRegistries

      public Iterable<? extends Registry<?>> getRegistries()
      Returns all builtin registries.
    • getRegistry

      public <T> Registry<T> getRegistry(ResourceKey<? extends Registry<T>> key)
      Retrieve a builtin registry by its key.
      Parameters:
      key - the key of the registry to retrieve
      Returns:
      the registry typed to the given registry key
      Throws:
      IllegalArgumentException - if the registry does not exist