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
NewRegistryEvent.RegistryData<V extends IForgeRegistryEntry<V>>
private static class
NewRegistryEvent.RegistryHolder<V extends IForgeRegistryEntry<V>>
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 TypeMethodDescription<V extends IForgeRegistryEntry<V>>
Supplier<IForgeRegistry<V>>create
(RegistryBuilder<V> builder) Adds a registry builder to be created.<V extends IForgeRegistryEntry<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, getParentListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult, setup
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
registries
-
-
Constructor Details
-
NewRegistryEvent
public NewRegistryEvent()
-
-
Method Details
-
create
public <V extends IForgeRegistryEntry<V>> Supplier<IForgeRegistry<V>> create(RegistryBuilder<V> builder) 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 extends IForgeRegistryEntry<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() -
toString
-