Class RegistryManager
java.lang.Object
net.neoforged.neoforge.registries.RegistryManager
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Map<ResourceLocation,RegistrySnapshot> private static final org.slf4j.Loggerprivate static Set<ResourceLocation>private static final org.slf4j.Markerprivate static Set<ResourceLocation>private static Map<ResourceLocation,RegistrySnapshot> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Set<ResourceKey<?>>applySnapshot(Map<ResourceLocation, RegistrySnapshot> snapshots, boolean allowMissing, boolean isLocalWorld) Applies the snapshot to the current state of theBuiltInRegistries.private static <T> voidapplySnapshot(MappedRegistry<T> registry, RegistrySnapshot snapshot, Set<ResourceKey<?>> missing) generateRegistryPackets(boolean isLocal) static List<ResourceLocation>static Set<ResourceLocation>static voidstatic voidstatic void(package private) static voidstatic Map<ResourceLocation,RegistrySnapshot> takeSnapshot(RegistryManager.SnapshotType snapshotType) Takes a snapshot of the current registries registered toBuiltInRegistries.REGISTRY.(package private) static void(package private) static voidtrackModdedRegistry(ResourceLocation registry) Called byRegistryBuilderto make sure that modders don't forget to register their registries.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
REGISTRIES
private static final org.slf4j.Marker REGISTRIES -
pendingModdedRegistries
-
vanillaRegistryKeys
-
vanillaSnapshot
-
frozenSnapshot
-
-
Constructor Details
-
RegistryManager
public RegistryManager()
-
-
Method Details
-
trackModdedRegistry
Called byRegistryBuilderto make sure that modders don't forget to register their registries. -
postNewRegistryEvent
public static void postNewRegistryEvent() -
takeVanillaSnapshot
static void takeVanillaSnapshot() -
takeFrozenSnapshot
static void takeFrozenSnapshot() -
revertToVanilla
public static void revertToVanilla() -
revertToFrozen
public static void revertToFrozen() -
applySnapshot
public static Set<ResourceKey<?>> applySnapshot(Map<ResourceLocation, RegistrySnapshot> snapshots, boolean allowMissing, boolean isLocalWorld) Applies the snapshot to the current state of theBuiltInRegistries.- Parameters:
snapshots- the map of registry name to snapshotallowMissing- iftrue, 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(MappedRegistry<T> registry, RegistrySnapshot snapshot, Set<ResourceKey<?>> missing) -
takeSnapshot
public static Map<ResourceLocation,RegistrySnapshot> takeSnapshot(RegistryManager.SnapshotType snapshotType) Takes a snapshot of the current registries registered toBuiltInRegistries.REGISTRY.- Parameters:
snapshotType- IfRegistryManager.SnapshotType.SYNC_TO_CLIENT, only takes a snapshot of registries set to sync to the client. IfRegistryManager.SnapshotType.FULL, takes a snapshot of all registries including entries.- Returns:
- the snapshot map of registry name to snapshot data
-
generateRegistryPackets
public static List<MessageFunctions.LoginPacket<HandshakeMessages.S2CRegistry>> generateRegistryPackets(boolean isLocal) -
getRegistryNamesForSyncToClient
-
getVanillaRegistryKeys
-