From 0aca2f986da4150bc4befab90e9c9ed11f8d0072 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 8 Oct 2022 12:13:36 +0200 Subject: [PATCH] Do not deserialize Datapack Dimensions when still using the global Registry (#44) --- .../together/worldPreset/TogetherWorldPreset.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/betterx/worlds/together/worldPreset/TogetherWorldPreset.java b/src/main/java/org/betterx/worlds/together/worldPreset/TogetherWorldPreset.java index 378be2b9..2ea951e7 100644 --- a/src/main/java/org/betterx/worlds/together/worldPreset/TogetherWorldPreset.java +++ b/src/main/java/org/betterx/worlds/together/worldPreset/TogetherWorldPreset.java @@ -107,8 +107,14 @@ public class TogetherWorldPreset extends WorldPreset { public static @NotNull Map, ChunkGenerator> loadWorldDimensions() { try { final RegistryAccess registryAccess = WorldBootstrap.getLastRegistryAccessOrElseBuiltin(); - if (registryAccess == BuiltinRegistries.ACCESS && Configs.MAIN_CONFIG.verboseLogging()) { - BCLib.LOGGER.info("Loading from builtin Registry"); + boolean globalRegistry = false; + if (registryAccess == BuiltinRegistries.ACCESS) { + if (Configs.MAIN_CONFIG.verboseLogging()) + BCLib.LOGGER.info("Loading from builtin Registry"); + globalRegistry = true; + } else { + if (Configs.MAIN_CONFIG.verboseLogging()) + BCLib.LOGGER.info("Loading from datapack Registry"); } final RegistryOps registryOps = RegistryOps.create(NbtOps.INSTANCE, registryAccess); if (DEFAULT_DIMENSIONS_WRAPPER == null) { @@ -116,7 +122,7 @@ public class TogetherWorldPreset extends WorldPreset { } CompoundTag presetNBT = WorldGenUtil.getPresetsNbt(); - if (!presetNBT.contains("dimensions")) { + if (!presetNBT.contains("dimensions") || globalRegistry) { return DEFAULT_DIMENSIONS_WRAPPER.dimensions; }