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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> Registry
<T> create
(RegistryBuilder<T> builder) Creates a registry using thebuilder
and registers it.(package private) void
fill()
<T> void
Registers an already-created registry.private void
registerToRootRegistry
(Registry<?> registry)
-
Field Details
-
registries
-
-
Constructor Details
-
NewRegistryEvent
NewRegistryEvent()
-
-
Method Details
-
create
Creates a registry using thebuilder
and registers it. -
register
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
-