类 RegisterEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.registries.RegisterEvent
所有已实现的接口:
IModBusEvent

public class RegisterEvent extends net.minecraftforge.eventbus.api.Event implements 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.

另请参阅:
  • 字段详细资料

    • registryKey

      @NotNull private final @NotNull ResourceKey<? extends Registry<?>> registryKey
    • forgeRegistry

      @Nullable private final @Nullable ForgeRegistry<?> forgeRegistry
    • vanillaRegistry

      @Nullable private final @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 to
      name - the name of the object to register as its key
      valueSupplier - 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

      @NotNull public @NotNull ResourceKey<? extends Registry<?>> getRegistryKey()
      返回:
      The registry key linked to this event
    • getForgeRegistry

      @Nullable public <T> @Nullable IForgeRegistry<T> getForgeRegistry()
      返回:
      The forge registry for the given registry key, or null if the registry is not a forge registry
    • getVanillaRegistry

      @Nullable public <T> @Nullable Registry<T> getVanillaRegistry()
      返回:
      The vanilla registry for the given registry key, or null if the registry is not a vanilla registry
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object