类 RegisterEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.registries.RegisterEvent
- 所有已实现的接口:
net.neoforged.fml.event.IModBusEvent
public class RegisterEvent
extends net.neoforged.bus.api.Event
implements net.neoforged.fml.event.IModBusEvent
Fired for each registry when it is ready to have modded objects registered.
This event is fired for all builtin registries from vanilla (see
BuiltInRegistries
) and mods.
This event is fired on the mod-specific event bus, on both logical sides.
- 另请参阅:
-
嵌套类概要
嵌套类 -
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Registry
<?> <T> @Nullable Registry
<T> getRegistry
(ResourceKey<? extends Registry<T>> key) ResourceKey
<? extends Registry<?>> <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.<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.
-
字段详细资料
-
registryKey
-
registry
-
-
构造器详细资料
-
RegisterEvent
RegisterEvent(ResourceKey<? extends Registry<?>> registryKey, Registry<?> registry)
-
-
方法详细资料
-
register
public <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.- 类型参数:
T
- the type of the registry- 参数:
registryKey
- the key of the registry to register the value toname
- the name of the object to register as its keyvalueSupplier
- a supplier of the object value- 另请参阅:
-
register
public <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.- 类型参数:
T
- the type of the registry- 参数:
registryKey
- the key of the registry to register objects to- 另请参阅:
-
getRegistryKey
- 返回:
- The registry key linked to this event
-
getRegistry
- 返回:
- The registry linked to this event
-
getRegistry
- 参数:
key
- the registry key to compare againgetRegistryKey()
- 返回:
- The registry typed to the given registry key if it matches
getRegistryKey()
, ornull
if it does not match.
-