From 7dd8554affc6778a35a37afde7af1a159b0470f8 Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Mon, 3 Jan 2022 19:40:07 +0300 Subject: [PATCH] Separate options for dimensions --- src/main/java/ru/bclib/BCLibPatch.java | 30 +++++++++++-------- .../world/generator/GeneratorOptions.java | 14 ++++++--- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/main/java/ru/bclib/BCLibPatch.java b/src/main/java/ru/bclib/BCLibPatch.java index 8ef4fe24..667813ac 100644 --- a/src/main/java/ru/bclib/BCLibPatch.java +++ b/src/main/java/ru/bclib/BCLibPatch.java @@ -8,7 +8,7 @@ import ru.bclib.world.generator.GeneratorOptions; public final class BCLibPatch { public static void register(){ - if (GeneratorOptions.fixBiomeSource()) { + if (GeneratorOptions.fixEndBiomeSource() || GeneratorOptions.fixNetherBiomeSource()) { DataFixerAPI.registerPatch(BiomeSourcePatch::new); } } @@ -29,20 +29,24 @@ final class BiomeSourcePatch extends ForcedLevelPatch{ long seed = worldGenSettings.getLong("seed"); boolean result = false; - if (!dimensions.contains("minecraft:the_nether") || !isBCLibEntry(dimensions.getCompound("minecraft:the_nether"))) { - CompoundTag dimRoot = new CompoundTag(); - dimRoot.put("generator", makeNetherGenerator(seed)); - dimRoot.putString("type", "minecraft:the_nether"); - dimensions.put("minecraft:the_nether", dimRoot); - result = true; + if (GeneratorOptions.fixNetherBiomeSource()) { + if (!dimensions.contains("minecraft:the_nether") || !isBCLibEntry(dimensions.getCompound("minecraft:the_nether"))) { + CompoundTag dimRoot = new CompoundTag(); + dimRoot.put("generator", makeNetherGenerator(seed)); + dimRoot.putString("type", "minecraft:the_nether"); + dimensions.put("minecraft:the_nether", dimRoot); + result = true; + } } - if (!dimensions.contains("minecraft:the_end") || !isBCLibEntry(dimensions.getCompound("minecraft:the_end"))) { - CompoundTag dimRoot = new CompoundTag(); - dimRoot.put("generator", makeEndGenerator(seed)); - dimRoot.putString("type", "minecraft:the_end"); - dimensions.put("minecraft:the_end", dimRoot); - result = true; + if (GeneratorOptions.fixEndBiomeSource()) { + if (!dimensions.contains("minecraft:the_end") || !isBCLibEntry(dimensions.getCompound("minecraft:the_end"))) { + CompoundTag dimRoot = new CompoundTag(); + dimRoot.put("generator", makeEndGenerator(seed)); + dimRoot.putString("type", "minecraft:the_end"); + dimensions.put("minecraft:the_end", dimRoot); + result = true; + } } return result; diff --git a/src/main/java/ru/bclib/world/generator/GeneratorOptions.java b/src/main/java/ru/bclib/world/generator/GeneratorOptions.java index 7e37a647..62de21f2 100644 --- a/src/main/java/ru/bclib/world/generator/GeneratorOptions.java +++ b/src/main/java/ru/bclib/world/generator/GeneratorOptions.java @@ -19,7 +19,8 @@ public class GeneratorOptions { private static boolean useOldBiomeGenerator = false; private static boolean verticalBiomes = true; private static long farEndBiomesSqr = 1000000; - private static boolean fixBiomeSource = true; + private static boolean fixEndBiomeSource = true; + private static boolean fixNetherBiomeSource = true; public static void init() { biomeSizeNether = Configs.GENERATOR_CONFIG.getInt("nether.biomeMap", "biomeSize", 256); @@ -32,7 +33,8 @@ public class GeneratorOptions { addEndBiomesByCategory = Configs.GENERATOR_CONFIG.getBoolean("options", "addEndBiomesByCategory", false); useOldBiomeGenerator = Configs.GENERATOR_CONFIG.useOldGenerator(); verticalBiomes = Configs.GENERATOR_CONFIG.getBoolean("options", "verticalBiomesInTallNether", true); - fixBiomeSource = Configs.GENERATOR_CONFIG.getBoolean("options", "fixBiomeSource", true); + fixEndBiomeSource = Configs.GENERATOR_CONFIG.getBoolean("options.biomeSource", "fixEndBiomeSource", true); + fixNetherBiomeSource = Configs.GENERATOR_CONFIG.getBoolean("options.biomeSource", "fixNetherBiomeSource", true); } public static int getBiomeSizeNether() { @@ -103,7 +105,11 @@ public class GeneratorOptions { return verticalBiomes; } - public static boolean fixBiomeSource() { - return fixBiomeSource; + public static boolean fixEndBiomeSource() { + return fixEndBiomeSource; + } + + public static boolean fixNetherBiomeSource() { + return fixNetherBiomeSource; } }