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 Summary

    Modifier and Type
    Method
    Description
    static <T> void
    allEntries(net.minecraft.core.Registry<T> registry, Consumer<net.minecraft.core.Holder.Reference<T>> consumer)
    Register a callback for all present and future entries in the registry.
    event(net.minecraft.core.Registry<T> registry)
    Get the Event for the RegistryEntryAddedCallback for the given registry.
    void
    onEntryAdded(int rawId, net.minecraft.resources.Identifier id, T object)
    Called when a new entry is added to the registry.
  • Method Details

    • onEntryAdded

      void onEntryAdded(int rawId, net.minecraft.resources.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(net.minecraft.core.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(net.minecraft.core.Registry<T> registry, Consumer<net.minecraft.core.Holder.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 Holder.Reference