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.
An event for when an entry is added to a registry.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> voidallEntries(Registry<T> registry, Consumer<RegistryEntry.Reference<T>> consumer) Register a callback for all present and future entries in the registry.static <T> Event<RegistryEntryAddedCallback<T>> Get theEventfor theRegistryEntryAddedCallbackfor the given registry.voidonEntryAdded(int rawId, Identifier id, T object) Called when a new entry is added to the registry.
-
Method Details
-
onEntryAdded
Called when a new entry is added to the registry.- Parameters:
rawId- the raw id of the entryid- the identifier of the entryobject- the object that was added
-
event
Get theEventfor theRegistryEntryAddedCallbackfor the given registry.- Parameters:
registry- the registry to get the event for- Returns:
- the event
-
allEntries
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 toconsumer- the callback that accepts aRegistryEntry.Reference
-