Do not deserialize Datapack Dimensions when still using the global Registry (#44)

This commit is contained in:
Frank 2022-10-08 12:13:36 +02:00
parent 05d332863f
commit 0aca2f986d

View file

@ -107,8 +107,14 @@ public class TogetherWorldPreset extends WorldPreset {
public static @NotNull Map<ResourceKey<LevelStem>, ChunkGenerator> loadWorldDimensions() { public static @NotNull Map<ResourceKey<LevelStem>, ChunkGenerator> loadWorldDimensions() {
try { try {
final RegistryAccess registryAccess = WorldBootstrap.getLastRegistryAccessOrElseBuiltin(); final RegistryAccess registryAccess = WorldBootstrap.getLastRegistryAccessOrElseBuiltin();
if (registryAccess == BuiltinRegistries.ACCESS && Configs.MAIN_CONFIG.verboseLogging()) { boolean globalRegistry = false;
BCLib.LOGGER.info("Loading from builtin Registry"); 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<Tag> registryOps = RegistryOps.create(NbtOps.INSTANCE, registryAccess); final RegistryOps<Tag> registryOps = RegistryOps.create(NbtOps.INSTANCE, registryAccess);
if (DEFAULT_DIMENSIONS_WRAPPER == null) { if (DEFAULT_DIMENSIONS_WRAPPER == null) {
@ -116,7 +122,7 @@ public class TogetherWorldPreset extends WorldPreset {
} }
CompoundTag presetNBT = WorldGenUtil.getPresetsNbt(); CompoundTag presetNBT = WorldGenUtil.getPresetsNbt();
if (!presetNBT.contains("dimensions")) { if (!presetNBT.contains("dimensions") || globalRegistry) {
return DEFAULT_DIMENSIONS_WRAPPER.dimensions; return DEFAULT_DIMENSIONS_WRAPPER.dimensions;
} }