Class NewRegistryEvent

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

public class NewRegistryEvent extends net.neoforged.bus.api.Event implements net.neoforged.fml.event.IModBusEvent
Fired when new registries can be constructed and registered. This event is fired to register builtin registries, like the registries in BuiltInRegistries. Builtin registries are registries which can only load entries registered in code.

For registering datapack registries that only load entries through JSON, see DataPackRegistryEvent.NewRegistry.

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

See Also:
  • Field Details

  • Constructor Details

    • NewRegistryEvent

      NewRegistryEvent()
  • Method Details

    • create

      public <T> Registry<T> create(RegistryBuilder<T> builder)
      Creates a registry using the builder and registers it.
      Parameters:
      builder - the builder to turn into a Registry
      Returns:
      the built Registry
    • register

      public <T> void register(Registry<T> registry)
      Registers an already-created registry. This allows storing registries in static final fields and registering them later.
      Parameters:
      registry - the registry to register
    • fill

      void fill()
    • registerToRootRegistry

      private void registerToRootRegistry(Registry<?> registry)