Interface RegistryEntryAddedCallback<T>

Type Parameters:
T - the type of the entry within the registry
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface RegistryEntryAddedCallback<T>
An event for when an entry is added to a registry.
  • Method Details

    • onEntryAdded

      void onEntryAdded(int rawId, Identifier id, T object)
      Called when a new entry is added to the registry.
      Parameters:
      rawId - the raw id of the entry
      id - the identifier of the entry
      object - the object that was added
    • event

      static <T> Event<RegistryEntryAddedCallback<T>> event(Registry<T> registry)
      Get the Event for the RegistryEntryAddedCallback for the given registry.
      Parameters:
      registry - the registry to get the event for
      Returns:
      the event
    • allEntries

      static <T> void allEntries(Registry<T> registry, Consumer<RegistryEntry.Reference<T>> consumer)
      Register a callback for all present and future entries in the registry.

      Note: The callback is recursive and will be invoked for anything registered within the callback itself.

      Parameters:
      registry - the registry to listen to
      consumer - the callback that accepts a RegistryEntry.Reference