类 RegisterEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.registries.RegisterEvent
- 所有已实现的接口:
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
.
- 另请参阅:
-
嵌套类概要
嵌套类从类继承的嵌套类/接口 net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
字段概要
字段修饰符和类型字段说明private final @Nullable ForgeRegistry
<?> private final @NotNull ResourceKey
<? extends Registry<?>> private final @Nullable Registry
<?> -
构造器概要
构造器构造器说明RegisterEvent
(@NotNull ResourceKey<? extends Registry<?>> registryKey, @Nullable ForgeRegistry<?> forgeRegistry, @Nullable Registry<?> vanillaRegistry) -
方法概要
修饰符和类型方法说明<T> @Nullable IForgeRegistry
<T> @NotNull ResourceKey
<? extends Registry<?>> <T> @Nullable Registry
<T> <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.toString()
从类继承的方法 net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
字段详细资料
-
registryKey
-
forgeRegistry
-
vanillaRegistry
-
-
构造器详细资料
-
RegisterEvent
RegisterEvent(@NotNull @NotNull ResourceKey<? extends Registry<?>> registryKey, @Nullable @Nullable ForgeRegistry<?> forgeRegistry, @Nullable @Nullable Registry<?> vanillaRegistry)
-
-
方法详细资料
-
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
-
getForgeRegistry
- 返回:
- The forge registry for the given registry key, or
null
if the registry is not a forge registry
-
getVanillaRegistry
- 返回:
- The vanilla registry for the given registry key, or
null
if the registry is not a vanilla registry
-
toString
-