Separate options for dimensions

This commit is contained in:
paulevsGitch 2022-01-03 19:40:07 +03:00
parent 384fe3a327
commit 7dd8554aff
2 changed files with 27 additions and 17 deletions

View file

@ -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;

View file

@ -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;
}
}