Interface RegisterRegistryValueEvent

All Superinterfaces:
Event, LifecycleEvent
All Known Subinterfaces:
RegisterRegistryValueEvent.EngineScoped<E>, RegisterRegistryValueEvent.GameScoped, RegisterRegistryValueEvent.WorldScoped

public interface RegisterRegistryValueEvent extends LifecycleEvent
Lifecycle event for registering entries to a Registry.

This event may be called multiple times for the same layer as the registry is being appended and as dependencies become available. Plugins should only execute code inside the consumers.

Note: Layers might be reloadable! When a registry is being reloaded, this event is fired again for the relevant registries. The implementation does not keep a reference to the Consumer observed in the last stage and expects plugins to fill a new set of entries.

Additionally, plugins may request to take a dependency on another registry in order to access registered entries early to enrich its own content. This can prove to be useful when both registries are in the same layer and would have no access to each other otherwise.

The available registries and their content are not guaranteed to be accessible unless they have been added as a dependency. Plugins might observe registries they have not marked as a dependency due to the platform having natural dependency on them or due to the registries dependency graph.

  • Method Details

    • registry

      default <T> void registry(RegistryType<T> registryType, Consumer<RegisterRegistryValueEvent.RegistryStep<T>> consumer)

      Register new entries against a specific Registry.

      The consumer will be called if it matches the current set of registries being created.

      Parameters:
      registryType - The registry type to append.
      consumer - The consumer to be called if found.
    • registry

      <T> void registry(RegistryType<T> registryType, BiConsumer<RegistryHolder,RegisterRegistryValueEvent.RegistryStep<T>> consumer)

      Register new entries against a specific Registry.

      The consumer will be called if it matches the current set of registries being created.

      Parameters:
      registryType - The registry type to append.
      consumer - The consumer to be called if found.
    • registry

      <T> void registry(RegistryType<T> registryType, BiConsumer<RegistryHolder,RegisterRegistryValueEvent.RegistryStep<T>> consumer, RegistryType<?>... dependencies)

      Register new entries against a specific Registry.

      The consumer will be called if it matches the current set of registries being created.

      Parameters:
      registryType - The registry type to append.
      consumer - The consumer to be called if found.
      dependencies - The list of registries to create before invoking the consumer.
    • register

      default <T> void register(RegistryRegistrationSet<T> registrationSet)

      Register new entries against a specific Registry.

      The registration set will be appended if it matches the current set of registries being created.

      Parameters:
      registrationSet - The registration set.
    • register

      default <T> void register(RegistryRegistrationSet<T> registrationSet, RegistryType<?>... dependencies)

      Register new entries against a specific Registry.

      The registration set will be appended if it matches the current set of registries being created.

      Parameters:
      registrationSet - The registration set.
      dependencies - The list of registries to create before appending the registration set.