Class RegistryManager

java.lang.Object
net.neoforged.neoforge.registries.RegistryManager

@Internal public class RegistryManager extends Object
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • REGISTRIES

      private static final org.slf4j.Marker REGISTRIES
    • pendingModdedRegistries

      private static Set<net.minecraft.resources.ResourceLocation> pendingModdedRegistries
    • vanillaRegistryKeys

      private static Set<net.minecraft.resources.ResourceLocation> vanillaRegistryKeys
    • vanillaSnapshot

      private static Map<net.minecraft.resources.ResourceLocation,RegistrySnapshot> vanillaSnapshot
    • frozenSnapshot

      private static Map<net.minecraft.resources.ResourceLocation,RegistrySnapshot> frozenSnapshot
    • dataMaps

      private static Map<net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<?>>,Map<net.minecraft.resources.ResourceLocation,DataMapType<?,?>>> dataMaps
    • ATTRIBUTE_KNOWN_DATA_MAPS

      public static final io.netty.util.AttributeKey<Map<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>,Collection<net.minecraft.resources.ResourceLocation>>> ATTRIBUTE_KNOWN_DATA_MAPS
  • Constructor Details

    • RegistryManager

      public RegistryManager()
  • Method Details

    • trackModdedRegistry

      static void trackModdedRegistry(net.minecraft.resources.ResourceLocation registry)
      Called by RegistryBuilder to make sure that modders don't forget to register their registries.
    • getDataMap

      @Nullable public static <R> @Nullable DataMapType<R,?> getDataMap(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<R>> registry, net.minecraft.resources.ResourceLocation key)
    • getDataMaps

      public static Map<net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<?>>,Map<net.minecraft.resources.ResourceLocation,DataMapType<?,?>>> getDataMaps()
      Returns a view of all registered data maps.
      Returns:
      a view of all registered data maps
    • postNewRegistryEvent

      public static void postNewRegistryEvent()
    • initDataMaps

      public static void initDataMaps()
    • takeVanillaSnapshot

      static void takeVanillaSnapshot()
    • takeFrozenSnapshot

      static void takeFrozenSnapshot()
    • revertToVanilla

      public static void revertToVanilla()
    • revertToFrozen

      public static void revertToFrozen()
    • applySnapshot

      public static Set<net.minecraft.resources.ResourceKey<?>> applySnapshot(Map<net.minecraft.resources.ResourceLocation,RegistrySnapshot> snapshots, boolean allowMissing, boolean isLocalWorld)
      Applies the snapshot to the current state of the BuiltInRegistries.
      Parameters:
      snapshots - the map of registry name to snapshot
      allowMissing - if true, missing registries will be skipped but will log a warning. Otherwise, an exception will be thrown if a registry name in the snapshot map is missing.
      isLocalWorld - changes the logging depending on if the snapshot is coming from a local save or a remote connection
      Returns:
      the set of unhandled missing registry entries after firing remapping events for mods
    • applySnapshot

      private static <T> void applySnapshot(net.minecraft.core.MappedRegistry<T> registry, RegistrySnapshot snapshot, Set<net.minecraft.resources.ResourceKey<?>> missing)
    • takeSnapshot

      public static Map<net.minecraft.resources.ResourceLocation,RegistrySnapshot> takeSnapshot(RegistryManager.SnapshotType snapshotType)
      Takes a snapshot of the current registries registered to BuiltInRegistries.REGISTRY.
      Parameters:
      snapshotType - If RegistryManager.SnapshotType.SYNC_TO_CLIENT, only takes a snapshot of registries set to sync to the client. If RegistryManager.SnapshotType.FULL, takes a snapshot of all registries including entries.
      Returns:
      the snapshot map of registry name to snapshot data
    • generateRegistryPackets

      public static List<FrozenRegistryPayload> generateRegistryPackets(boolean isLocal)
    • getRegistryNamesForSyncToClient

      public static List<net.minecraft.resources.ResourceLocation> getRegistryNamesForSyncToClient()
    • getVanillaRegistryKeys

      public static Set<net.minecraft.resources.ResourceLocation> getVanillaRegistryKeys()
    • handleKnownDataMapsReply

      @Internal public static void handleKnownDataMapsReply(KnownRegistryDataMapsReplyPayload payload, IPayloadContext context)
    • isNonSyncedBuiltInRegistry

      public static boolean isNonSyncedBuiltInRegistry(net.minecraft.core.Registry<?> registry)