Non default Terrain Heights for EndBiomeSource

This commit is contained in:
Frank 2022-06-19 22:06:25 +02:00
parent 35b968eb93
commit 73cd08fa69
6 changed files with 63 additions and 33 deletions

View file

@ -73,7 +73,7 @@ public class BCLChunkGenerator extends NoiseBasedChunkGenerator {
if (BCLib.RUNS_TERRABLENDER) {
BCLib.LOGGER.info("Make sure features are loaded from terrablender for " + biomeSource);
//terrablender is completley invalidating the feature imitialization
//terrablender is invalidating the feature initialization
//we redo it at this point, otherwise we will get blank biomes
rebuildFeaturesPerStep(biomeSource);
}

View file

@ -34,7 +34,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import java.util.function.BiFunction;
public class BCLibEndBiomeSource extends BCLBiomeSource {
private static final OpenSimplexNoise SMALL_NOISE = new OpenSimplexNoise(8324);
@ -62,11 +62,13 @@ public class BCLibEndBiomeSource extends BCLBiomeSource {
private final Holder<Biome> centerBiome;
private final Holder<Biome> barrens;
private final Point pos;
private final Function<Point, Boolean> endLandFunction;
private final BiFunction<Point, Integer, Boolean> endLandFunction;
private SimplexNoise noise;
private BiomeMap mapLand;
private BiomeMap mapVoid;
private static int worldHeight;
private final BiomePicker endLandBiomePicker;
private final BiomePicker endVoidBiomePicker;
@ -158,6 +160,15 @@ public class BCLibEndBiomeSource extends BCLBiomeSource {
);
}
/**
* Set world height, used when Nether is larger than vanilla 128 blocks tall.
*
* @param worldHeight height of the Nether ceiling.
*/
public static void setWorldHeight(int worldHeight) {
BCLibEndBiomeSource.worldHeight = worldHeight;
}
private static List<Holder<Biome>> getBclBiomes(Registry<Biome> biomeRegistry) {
List<String> include = Configs.BIOMES_CONFIG.getEntry(
"force_include",
@ -320,7 +331,7 @@ public class BCLibEndBiomeSource extends BCLBiomeSource {
}
} else {
pos.setLocation(biomeX, biomeZ);
if (endLandFunction.apply(pos)) {
if (endLandFunction.apply(pos, worldHeight)) {
return dist <= farEndBiomes ? centerBiome : mapLand.getBiome(posX, biomeY << 2, posZ).biome;
} else {
return dist <= farEndBiomes ? barrens : mapVoid.getBiome(posX, biomeY << 2, posZ).biome;

View file

@ -5,14 +5,14 @@ import org.betterx.bclib.config.Configs;
import net.minecraft.util.Mth;
import java.awt.*;
import java.util.function.Function;
import java.util.function.BiFunction;
public class GeneratorOptions {
private static int biomeSizeNether;
private static int biomeVSizeNether;
private static int biomeSizeEndLand;
private static int biomeSizeEndVoid;
private static Function<Point, Boolean> endLandFunction;
private static BiFunction<Point, Integer, Boolean> endLandFunction;
private static boolean customNetherBiomeSource = true;
private static boolean customEndBiomeSource = true;
private static boolean verticalBiomes = true;
@ -52,11 +52,11 @@ public class GeneratorOptions {
return Mth.clamp(biomeSizeEndVoid, 1, 8192);
}
public static void setEndLandFunction(Function<Point, Boolean> endLandFunction) {
public static void setEndLandFunction(BiFunction<Point, Integer, Boolean> endLandFunction) {
GeneratorOptions.endLandFunction = endLandFunction;
}
public static Function<Point, Boolean> getEndLandFunction() {
public static BiFunction<Point, Integer, Boolean> getEndLandFunction() {
return endLandFunction;
}

View file

@ -348,7 +348,11 @@ public class LevelGenUtil {
}
BCLib.LOGGER.info("Set world to BiomeSource Version " + biomeSourceVersion);
BCLWorldPreset.writeWorldPresetSettings(new BCLWorldPresetSettings(biomeSourceVersion, biomeSourceVersion));
BCLWorldPreset.writeWorldPresetSettings(new BCLWorldPresetSettings(
biomeSourceVersion,
biomeSourceVersion,
true
));
}
}