Package net.minecraftforge.registries
Class RegisterEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.registries.RegisterEvent
- All Implemented Interfaces:
- IModBusEvent
This event fires for each forge and vanilla registry when all registries are ready to have modded objects registered.
 
 Fired on the mod bus.
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Eventnet.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
- 
Field SummaryFieldsModifier and TypeFieldDescription(package private) final @Nullable ForgeRegistry<?>private final @NotNull ResourceKey<? extends Registry<?>>private final @Nullable Registry<?>
- 
Constructor SummaryConstructorsConstructorDescriptionRegisterEvent(@NotNull ResourceKey<? extends Registry<?>> registryKey, @Nullable ForgeRegistry<?> forgeRegistry, @Nullable Registry<?> vanillaRegistry) 
- 
Method SummaryModifier and TypeMethodDescription<T> @Nullable IForgeRegistry<T>@NotNull ResourceKey<? extends Registry<?>><T> @Nullable Registry<T><T> voidregister(ResourceKey<? extends Registry<T>> registryKey, Consumer<RegisterEvent.RegisterHelper<T>> consumer) Calls the provided consumer with a register helper if the provided registry key matches this event's registry key.<T> voidregister(ResourceKey<? extends Registry<T>> registryKey, ResourceLocation name, Supplier<T> valueSupplier) Registers the value with the given name to the stored registry if the provided registry key matches this event's registry key.toString()Methods inherited from class net.minecraftforge.eventbus.api.EventgetListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
- 
Field Details- 
registryKey
- 
forgeRegistry
- 
vanillaRegistry
 
- 
- 
Constructor Details- 
RegisterEventRegisterEvent(@NotNull @NotNull ResourceKey<? extends Registry<?>> registryKey, @Nullable @Nullable ForgeRegistry<?> forgeRegistry, @Nullable @Nullable Registry<?> vanillaRegistry) 
 
- 
- 
Method Details- 
registerpublic <T> void register(ResourceKey<? extends Registry<T>> registryKey, ResourceLocation name, Supplier<T> valueSupplier) Registers the value with the given name to the stored registry if the provided registry key matches this event's registry key.- Type Parameters:
- T- the type of the registry
- Parameters:
- registryKey- the key of the registry to register the value to
- name- the name of the object to register as its key
- valueSupplier- a supplier of the object value
- See Also:
 
- 
registerpublic <T> void register(ResourceKey<? extends Registry<T>> registryKey, Consumer<RegisterEvent.RegisterHelper<T>> consumer) Calls the provided consumer with a register helper if the provided registry key matches this event's registry key.- Type Parameters:
- T- the type of the registry
- Parameters:
- registryKey- the key of the registry to register objects to
- See Also:
 
- 
getRegistryKey- Returns:
- The registry key linked to this event
 
- 
getForgeRegistry- Returns:
- The forge registry for the given registry key, or nullif the registry is not a forge registry
 
- 
getVanillaRegistry- Returns:
- The vanilla registry for the given registry key, or nullif the registry is not a vanilla registry
 
- 
toString
 
-