Backportat latest changes from master
This commit is contained in:
parent
9183293329
commit
53911dfe91
63 changed files with 1002 additions and 351 deletions
|
@ -9,13 +9,13 @@ import net.minecraft.world.level.biome.Biome;
|
|||
import net.minecraft.world.level.biome.Biome.BiomeCategory;
|
||||
import net.minecraft.world.level.biome.BiomeSource;
|
||||
import net.minecraft.world.level.biome.Biomes;
|
||||
import net.minecraft.world.level.biome.Climate;
|
||||
import net.minecraft.world.level.biome.TheEndBiomeSource;
|
||||
import net.minecraft.world.level.levelgen.LegacyRandomSource;
|
||||
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;
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class BCLibEndBiomeSource extends BiomeSource {
|
|||
BiomeAPI.END_LAND_BIOME_PICKER.clearMutables();
|
||||
BiomeAPI.END_VOID_BIOME_PICKER.clearMutables();
|
||||
|
||||
this.possibleBiomes().forEach(biome -> {
|
||||
this.possibleBiomes.forEach(biome -> {
|
||||
ResourceLocation key = biomeRegistry.getKey(biome);
|
||||
if (!BiomeAPI.hasBiome(key)) {
|
||||
BCLBiome bclBiome = new BCLBiome(key, biome, 1, 1);
|
||||
|
@ -64,6 +64,8 @@ public class BCLibEndBiomeSource extends BiomeSource {
|
|||
}
|
||||
});
|
||||
|
||||
Configs.BIOMES_CONFIG.saveChanges();
|
||||
|
||||
BiomeAPI.END_LAND_BIOME_PICKER.getBiomes().forEach(biome -> biome.updateActualBiomes(biomeRegistry));
|
||||
BiomeAPI.END_VOID_BIOME_PICKER.getBiomes().forEach(biome -> biome.updateActualBiomes(biomeRegistry));
|
||||
|
||||
|
@ -86,8 +88,19 @@ 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;
|
||||
}
|
||||
|
||||
if (GeneratorOptions.addEndBiomesByCategory() && biome.getBiomeCategory() == BiomeCategory.THEEND) {
|
||||
return true;
|
||||
}
|
||||
|
||||
BCLBiome bclBiome = BiomeAPI.getBiome(key);
|
||||
if (bclBiome != BiomeAPI.EMPTY_BIOME) {
|
||||
if (bclBiome.hasParentBiome()) {
|
||||
|
@ -100,7 +113,7 @@ public class BCLibEndBiomeSource extends BiomeSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Biome getNoiseBiome(int biomeX, int biomeY, int biomeZ, Climate.Sampler sampler) {
|
||||
public Biome getBiomeForNoiseGen(int biomeX, int biomeY, int biomeZ) {
|
||||
long i = (long) biomeX * (long) biomeX;
|
||||
long j = (long) biomeZ * (long) biomeZ;
|
||||
long check = GeneratorOptions.isFarEndBiomes() ? 65536L : 625L;
|
||||
|
|
|
@ -8,9 +8,10 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biome.BiomeCategory;
|
||||
import net.minecraft.world.level.biome.BiomeSource;
|
||||
import net.minecraft.world.level.biome.Climate;
|
||||
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;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
@ -37,7 +38,7 @@ public class BCLibNetherBiomeSource extends BiomeSource {
|
|||
|
||||
BiomeAPI.NETHER_BIOME_PICKER.clearMutables();
|
||||
|
||||
this.possibleBiomes().forEach(biome -> {
|
||||
this.possibleBiomes.forEach(biome -> {
|
||||
ResourceLocation key = biomeRegistry.getKey(biome);
|
||||
if (!BiomeAPI.hasBiome(key)) {
|
||||
BCLBiome bclBiome = new BCLBiome(key, biome, 1, 1);
|
||||
|
@ -53,6 +54,7 @@ public class BCLibNetherBiomeSource extends BiomeSource {
|
|||
}
|
||||
});
|
||||
|
||||
Configs.BIOMES_CONFIG.saveChanges();
|
||||
BiomeAPI.NETHER_BIOME_PICKER.getBiomes().forEach(biome -> biome.updateActualBiomes(biomeRegistry));
|
||||
BiomeAPI.NETHER_BIOME_PICKER.rebuild();
|
||||
|
||||
|
@ -64,8 +66,19 @@ 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;
|
||||
}
|
||||
|
||||
if (GeneratorOptions.addNetherBiomesByCategory() && biome.getBiomeCategory() == BiomeCategory.NETHER) {
|
||||
return true;
|
||||
}
|
||||
|
||||
BCLBiome bclBiome = BiomeAPI.getBiome(key);
|
||||
if (bclBiome != BiomeAPI.EMPTY_BIOME) {
|
||||
if (bclBiome.hasParentBiome()) {
|
||||
|
@ -78,7 +91,7 @@ public class BCLibNetherBiomeSource extends BiomeSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Biome getNoiseBiome(int biomeX, int biomeY, int biomeZ, Climate.Sampler sampler) {
|
||||
public Biome getBiomeForNoiseGen(int biomeX, int biomeY, int biomeZ) {
|
||||
if ((biomeX & 63) == 0 && (biomeZ & 63) == 0) {
|
||||
biomeMap.clearCache();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package ru.bclib.world.generator;
|
|||
|
||||
import com.google.common.collect.Maps;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.levelgen.LegacyRandomSource;
|
||||
import net.minecraft.world.level.levelgen.WorldgenRandom;
|
||||
import ru.bclib.noise.OpenSimplexNoise;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue