Interface RegistryMonitor<V>
- Type Parameters:
V- the entry type of the monitoredRegistry
- 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 TypeMethodDescriptionstatic <V> RegistryMonitor<V>create(net.minecraft.core.Registry<V> registry) Creates a newRegistryMonitorto monitor the specifiedRegistry.filter(Predicate<RegistryEntryContext<V>> filter) A builder-like method to append a filter to the current registry monitor, for determining what entries to invoke registered callbacks for.voidforAll(RegistryEvents.EntryAdded<V> callback) Registers the specified callback to be invoked for every entry ever to be registered in the monitor's registry.voidforUpcoming(RegistryEvents.EntryAdded<V> callback) 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
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 theRegistryEntryContext.registry()method to get the registry instance, for example:context.register(id, block);.- Parameters:
callback- the callback to be invoked on entries
-
forUpcoming
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
Creates a newRegistryMonitorto monitor the specifiedRegistry.- Type Parameters:
V- the entry type of theRegistrybeing monitored- Parameters:
registry- theRegistryto monitor- Returns:
- a new
RegistryMonitormonitoring the specifiedRegistry
-