Package net.minecraftforge.registries
Class NewRegistryEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.registries.NewRegistryEvent
- All Implemented Interfaces:
IModBusEvent
Register new registries when you receive this event through
RegistryBuilder
and create(RegistryBuilder)
.-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static final record
private static class
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
private final List<NewRegistryEvent.RegistryData<?>>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate <T> void
buildRegistry
(Map<RegistryBuilder<?>, IForgeRegistry<?>> builtRegistries, NewRegistryEvent.RegistryData<T> data) <V> Supplier<IForgeRegistry<V>>
create
(RegistryBuilder<V> builder) Adds a registry builder to be created.<V> Supplier<IForgeRegistry<V>>
create
(RegistryBuilder<V> builder, @Nullable Consumer<IForgeRegistry<V>> onFill) Adds a registry builder to be created.(package private) void
fill()
toString()
Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
registries
-
-
Constructor Details
-
NewRegistryEvent
public NewRegistryEvent()
-
-
Method Details
-
create
Adds a registry builder to be created.- Parameters:
builder
- The builder to turn into aIForgeRegistry
- Returns:
- A supplier of the
IForgeRegistry
created by the builder. Resolving too early will return null.
-
create
public <V> Supplier<IForgeRegistry<V>> create(RegistryBuilder<V> builder, @Nullable @Nullable Consumer<IForgeRegistry<V>> onFill) Adds a registry builder to be created.- Parameters:
builder
- The builder to turn into aIForgeRegistry
onFill
- Called when the returned supplier is filled with the registry- Returns:
- a supplier of the
IForgeRegistry
created by the builder. Resolving too early will return null.
-
fill
void fill() -
buildRegistry
private <T> void buildRegistry(Map<RegistryBuilder<?>, IForgeRegistry<?>> builtRegistries, NewRegistryEvent.RegistryData<T> data) -
toString
-