Class RegistryManager
java.lang.Object
net.neoforged.neoforge.registries.RegistryManager
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final io.netty.util.AttributeKey<Map<ResourceKey<? extends Registry<?>>, Collection<ResourceLocation>>> private static Map<ResourceKey<Registry<?>>, Map<ResourceLocation, DataMapType<?, ?>>> private 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) static List<FrozenRegistryPayload> generateRegistryPackets(boolean isLocal) static <R> @Nullable DataMapType<R, ?> getDataMap(ResourceKey<? extends Registry<R>> registry, ResourceLocation key) static Map<ResourceKey<Registry<?>>, Map<ResourceLocation, DataMapType<?, ?>>> Returns a view of all registered data maps.static List<ResourceLocation> static Set<ResourceLocation> static voidhandleKnownDataMapsReply(KnownRegistryDataMapsReplyPayload payload, IPayloadContext context) static voidstatic booleanisNonSyncedBuiltInRegistry(Registry<?> registry) 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
-
dataMaps
-
ATTRIBUTE_KNOWN_DATA_MAPS
public static final io.netty.util.AttributeKey<Map<ResourceKey<? extends Registry<?>>,Collection<ResourceLocation>>> ATTRIBUTE_KNOWN_DATA_MAPS
-
-
Constructor Details
-
RegistryManager
public RegistryManager()
-
-
Method Details
-
trackModdedRegistry
Called byRegistryBuilderto make sure that modders don't forget to register their registries. -
getDataMap
@Nullable public static <R> @Nullable DataMapType<R,?> getDataMap(ResourceKey<? extends Registry<R>> registry, ResourceLocation key) -
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<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
-
getRegistryNamesForSyncToClient
-
getVanillaRegistryKeys
-
handleKnownDataMapsReply
@Internal public static void handleKnownDataMapsReply(KnownRegistryDataMapsReplyPayload payload, IPayloadContext context) -
isNonSyncedBuiltInRegistry
-