Biome include lists

This commit is contained in:
paulevsGitch 2021-11-20 20:24:00 +03:00
parent c0b7ccca72
commit df214cdb24
8 changed files with 57 additions and 13 deletions

View file

@ -14,6 +14,7 @@ import net.minecraft.world.level.levelgen.WorldgenRandom;
import net.minecraft.world.level.levelgen.synth.SimplexNoise;
import ru.bclib.BCLib;
import ru.bclib.api.BiomeAPI;
import ru.bclib.config.ConfigKeeper.StringArrayEntry;
import ru.bclib.config.Configs;
import ru.bclib.noise.OpenSimplexNoise;
import ru.bclib.world.biomes.BCLBiome;
@ -87,8 +88,15 @@ public class BCLibEndBiomeSource extends BiomeSource {
}
private static List<Biome> getBiomes(Registry<Biome> biomeRegistry) {
List<String> include = Configs.BIOMES_CONFIG.getEntry("force_include", "end_biomes", StringArrayEntry.class).getValue();
return biomeRegistry.stream().filter(biome -> {
ResourceLocation key = biomeRegistry.getKey(biome);
if (include.contains(key.toString())) {
return true;
}
BCLBiome bclBiome = BiomeAPI.getBiome(key);
if (bclBiome != BiomeAPI.EMPTY_BIOME) {
if (bclBiome.hasParentBiome()) {

View file

@ -10,6 +10,7 @@ import net.minecraft.world.level.biome.Biome.BiomeCategory;
import net.minecraft.world.level.biome.BiomeSource;
import ru.bclib.BCLib;
import ru.bclib.api.BiomeAPI;
import ru.bclib.config.ConfigKeeper.StringArrayEntry;
import ru.bclib.config.Configs;
import ru.bclib.world.biomes.BCLBiome;
@ -65,8 +66,15 @@ public class BCLibNetherBiomeSource extends BiomeSource {
}
private static List<Biome> getBiomes(Registry<Biome> biomeRegistry) {
List<String> include = Configs.BIOMES_CONFIG.getEntry("force_include", "nether_biomes", StringArrayEntry.class).getValue();
return biomeRegistry.stream().filter(biome -> {
ResourceLocation key = biomeRegistry.getKey(biome);
if (include.contains(key.toString())) {
return true;
}
BCLBiome bclBiome = BiomeAPI.getBiome(key);
if (bclBiome != BiomeAPI.EMPTY_BIOME) {
if (bclBiome.hasParentBiome()) {

View file

@ -14,6 +14,8 @@ public class GeneratorOptions {
private static boolean farEndBiomes = true;
private static boolean customNetherBiomeSource = true;
private static boolean customEndBiomeSource = true;
private static boolean addNetherBiomesByCategory = false;
private static boolean addEndBiomesByCategory = false;
public static void init() {
biomeSizeNether = Configs.GENERATOR_CONFIG.getInt("nether.biomeMap", "biomeSize", 256);
@ -21,6 +23,8 @@ public class GeneratorOptions {
biomeSizeEndVoid = Configs.GENERATOR_CONFIG.getInt("end.biomeMap", "biomeSizeVoid", 256);
customNetherBiomeSource = Configs.GENERATOR_CONFIG.getBoolean("options", "customNetherBiomeSource", true);
customEndBiomeSource = Configs.GENERATOR_CONFIG.getBoolean("options", "customEndBiomeSource", true);
addNetherBiomesByCategory = Configs.GENERATOR_CONFIG.getBoolean("options", "addNetherBiomesByCategory", false);
addEndBiomesByCategory = Configs.GENERATOR_CONFIG.getBoolean("options", "addEndBiomesByCategory", false);
}
public static int getBiomeSizeNether() {
@ -58,4 +62,12 @@ public class GeneratorOptions {
public static boolean customEndBiomeSource() {
return customEndBiomeSource;
}
public static boolean addNetherBiomesByCategory() {
return addNetherBiomesByCategory;
}
public static boolean addEndBiomesByCategory() {
return addEndBiomesByCategory;
}
}