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.

  • Field Details

  • Constructor Details

  • Method Details

    • getRegistries

      public RegistryAccess getRegistries()
      Returns a registry access.
      Returns:
      a registry access
    • getRegistry

      public Registry<?> getRegistry()
      Returns the registry that had its data maps updated.
      Returns:
      the registry that had its data maps updated
    • getRegistryKey

      public ResourceKey<? extends Registry<?>> 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

      public <T> void ifRegistry(ResourceKey<Registry<T>> type, Consumer<Registry<T>> consumer)
      Runs the given consumer if the registry is of the given type.
      Type Parameters:
      T - the registry type
      Parameters:
      type - the registry key
      consumer - the consumer
    • getCause

      Returns the reason for the update.
      Returns:
      the reason for the update