Interface RegistryMonitor<V>

Type Parameters:
V - the entry type of the monitored Registry
All Known Implementing Classes:
RegistryMonitorImpl

@NonExtendable public interface RegistryMonitor<V>
A higher level tool for monitoring the manipulation of Minecraft's content registries.

Modified to work on Fabric

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static <V> RegistryMonitor<V>
    create(net.minecraft.core.Registry<V> registry)
    Creates a new RegistryMonitor to monitor the specified Registry.
    A builder-like method to append a filter to the current registry monitor, for determining what entries to invoke registered callbacks for.
    void
    Registers the specified callback to be invoked for every entry ever to be registered in the monitor's registry.
    void
    Registers the specified callback to be invoked for all future entries to registered in the monitor's registry.
  • Method Details

    • filter

      A builder-like method to append a filter to the current registry monitor, for determining what entries to invoke registered callbacks for.
      Parameters:
      filter - a predicate which determines what entries to invoke callbacks for
      Returns:
      the current registry monitor object, so as to allow chaining other methods in builder-like fashion
    • forAll

      void forAll(RegistryEvents.EntryAdded<V> callback)
      Registers the specified callback to be invoked for every entry ever to be registered in the monitor's registry.

      Entries must also match the monitor's filters.

      Registration to the registry being iterated must use the RegistryEntryContext.register(ResourceLocation, Object) method inside the callback, or alternatively use the RegistryEntryContext.registry() method to get the registry instance, for example: context.register(id, block);.

      Parameters:
      callback - the callback to be invoked on entries
    • forUpcoming

      void forUpcoming(RegistryEvents.EntryAdded<V> callback)
      Registers the specified callback to be invoked for all future entries to registered in the monitor's registry.

      Entries must also match the monitor's filters.

      Parameters:
      callback - the callback to be invoked on entries
    • create

      static <V> RegistryMonitor<V> create(net.minecraft.core.Registry<V> registry)
      Creates a new RegistryMonitor to monitor the specified Registry.
      Type Parameters:
      V - the entry type of the Registry being monitored
      Parameters:
      registry - the Registry to monitor
      Returns:
      a new RegistryMonitor monitoring the specified Registry