Class DataMapsUpdatedEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.registries.datamaps.DataMapsUpdatedEvent
public class DataMapsUpdatedEvent
extends net.neoforged.bus.api.Event
Event fired on the
game event bus
when the data maps of
a registry have either been synced to the client or reloaded on the server.
This event can be used to build caches (like weighed lists) or for post-processing the data map values.
Remember however that the data map values should not end up referencing their owner, as they're not copied when attached to tags.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate final DataMapsUpdatedEvent.UpdateCause
private final Registry
<?> private final RegistryAccess
-
Constructor Summary
ConstructorDescriptionDataMapsUpdatedEvent
(RegistryAccess registryAccess, Registry<?> registry, DataMapsUpdatedEvent.UpdateCause cause) -
Method Summary
Modifier and TypeMethodDescriptiongetCause()
Returns the reason for the update.Returns a registry access.Registry
<?> Returns the registry that had its data maps updated.ResourceKey
<? extends Registry<?>> Returns the key of the registry that had its data maps updated.<T> void
ifRegistry
(ResourceKey<Registry<T>> type, Consumer<Registry<T>> consumer) Runs the givenconsumer
if the registry is of the giventype
.
-
Field Details
-
registryAccess
-
registry
-
cause
-
-
Constructor Details
-
DataMapsUpdatedEvent
@Internal public DataMapsUpdatedEvent(RegistryAccess registryAccess, Registry<?> registry, DataMapsUpdatedEvent.UpdateCause cause)
-
-
Method Details
-
getRegistries
Returns a registry access.- Returns:
- a registry access
-
getRegistry
Returns the registry that had its data maps updated.- Returns:
- the registry that had its data maps updated
-
getRegistryKey
Returns the key of the registry that had its data maps updated.- Returns:
- the key of the registry that had its data maps updated
-
ifRegistry
Runs the givenconsumer
if the registry is of the giventype
.- Type Parameters:
T
- the registry type- Parameters:
type
- the registry keyconsumer
- the consumer
-
getCause
Returns the reason for the update.- Returns:
- the reason for the update
-