Re-Added seed in serialization
This commit is contained in:
parent
dc7a875679
commit
38b8883b6a
3 changed files with 382 additions and 342 deletions
|
@ -19,13 +19,14 @@ public abstract class BCLBiomeSource extends BiomeSource {
|
|||
|
||||
protected BCLBiomeSource(Registry<Biome> biomeRegistry, List<Holder<Biome>> list) {
|
||||
super(preInit(biomeRegistry, list));
|
||||
|
||||
System.out.println(this + " with Registry: "+biomeRegistry);
|
||||
this.biomeRegistry = biomeRegistry;
|
||||
|
||||
BiomeAPI.initRegistry(biomeRegistry);
|
||||
}
|
||||
|
||||
public void setSeed(long seed){
|
||||
System.out.println(this+" set Seed: " + seed);
|
||||
this.currentSeed = seed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package ru.bclib.world.generator;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.RegistryOps;
|
||||
|
@ -15,6 +13,9 @@ import net.minecraft.world.level.biome.Climate;
|
|||
import net.minecraft.world.level.levelgen.LegacyRandomSource;
|
||||
import net.minecraft.world.level.levelgen.WorldgenRandom;
|
||||
import net.minecraft.world.level.levelgen.synth.SimplexNoise;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import ru.bclib.BCLib;
|
||||
import ru.bclib.api.biomes.BiomeAPI;
|
||||
import ru.bclib.config.ConfigKeeper.StringArrayEntry;
|
||||
|
@ -25,21 +26,39 @@ import ru.bclib.world.biomes.BCLBiome;
|
|||
import ru.bclib.world.generator.map.hex.HexBiomeMap;
|
||||
import ru.bclib.world.generator.map.square.SquareBiomeMap;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BCLibEndBiomeSource extends BCLBiomeSource {
|
||||
public static Codec<BCLibEndBiomeSource> CODEC = RecordCodecBuilder.create((instance) -> instance.group(RegistryOps.retrieveRegistry(Registry.BIOME_REGISTRY).forGetter((theEndBiomeSource) -> null)).apply(instance, instance.stable(BCLibEndBiomeSource::new)));
|
||||
private static final OpenSimplexNoise SMALL_NOISE = new OpenSimplexNoise(8324);
|
||||
private Function<Point, Boolean> endLandFunction;
|
||||
|
||||
private SimplexNoise noise;
|
||||
public static Codec<BCLibEndBiomeSource> CODEC
|
||||
= RecordCodecBuilder.create((instance) -> instance.group(
|
||||
RegistryOps
|
||||
.retrieveRegistry(Registry.BIOME_REGISTRY)
|
||||
.forGetter((theEndBiomeSource) -> theEndBiomeSource.biomeRegistry),
|
||||
Codec
|
||||
.LONG
|
||||
.fieldOf("seed")
|
||||
.stable()
|
||||
.forGetter(source -> source.currentSeed))
|
||||
.apply(instance,
|
||||
instance.stable(BCLibEndBiomeSource::new)
|
||||
)
|
||||
);
|
||||
private final Holder<Biome> centerBiome;
|
||||
private final Holder<Biome> barrens;
|
||||
private final Point pos;
|
||||
private Function<Point, Boolean> endLandFunction;
|
||||
private SimplexNoise noise;
|
||||
private BiomeMap mapLand;
|
||||
private BiomeMap mapVoid;
|
||||
private final Point pos;
|
||||
|
||||
|
||||
public BCLibEndBiomeSource(Registry<Biome> biomeRegistry, long seed) {
|
||||
this(biomeRegistry);
|
||||
this.setSeed(seed);
|
||||
}
|
||||
|
||||
public BCLibEndBiomeSource(Registry<Biome> biomeRegistry) {
|
||||
super(biomeRegistry, getBiomes(biomeRegistry));
|
||||
|
@ -47,7 +66,9 @@ public class BCLibEndBiomeSource extends BCLBiomeSource {
|
|||
BiomeAPI.END_LAND_BIOME_PICKER.clearMutables();
|
||||
BiomeAPI.END_VOID_BIOME_PICKER.clearMutables();
|
||||
|
||||
List<String> includeVoid = Configs.BIOMES_CONFIG.getEntry("force_include", "end_void_biomes", StringArrayEntry.class).getValue();
|
||||
List<String> includeVoid = Configs.BIOMES_CONFIG.getEntry("force_include",
|
||||
"end_void_biomes",
|
||||
StringArrayEntry.class).getValue();
|
||||
this.possibleBiomes().forEach(biome -> {
|
||||
ResourceLocation key = biome.unwrapKey().orElseThrow().location();
|
||||
String group = key.getNamespace() + "." + key.getPath();
|
||||
|
@ -57,20 +78,18 @@ public class BCLibEndBiomeSource extends BCLBiomeSource {
|
|||
|
||||
if (includeVoid.contains(key.toString())) {
|
||||
BiomeAPI.END_VOID_BIOME_PICKER.addBiomeMutable(bclBiome);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
BiomeAPI.END_LAND_BIOME_PICKER.addBiomeMutable(bclBiome);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
BCLBiome bclBiome = BiomeAPI.getBiome(key);
|
||||
if (bclBiome != BiomeAPI.EMPTY_BIOME) {
|
||||
if (bclBiome.getParentBiome() == null) {
|
||||
if (!BiomeAPI.END_LAND_BIOME_PICKER.containsImmutable(key) && !BiomeAPI.END_VOID_BIOME_PICKER.containsImmutable(key)) {
|
||||
if (!BiomeAPI.END_LAND_BIOME_PICKER.containsImmutable(key) && !BiomeAPI.END_VOID_BIOME_PICKER.containsImmutable(
|
||||
key)) {
|
||||
if (includeVoid.contains(key.toString())) {
|
||||
BiomeAPI.END_VOID_BIOME_PICKER.addBiomeMutable(bclBiome);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
BiomeAPI.END_LAND_BIOME_PICKER.addBiomeMutable(bclBiome);
|
||||
}
|
||||
}
|
||||
|
@ -93,30 +112,13 @@ public class BCLibEndBiomeSource extends BCLBiomeSource {
|
|||
this.pos = new Point();
|
||||
}
|
||||
|
||||
private void initMap(long seed){
|
||||
if (GeneratorOptions.useOldBiomeGenerator()) {
|
||||
this.mapLand = new SquareBiomeMap(seed, GeneratorOptions.getBiomeSizeEndLand(), BiomeAPI.END_LAND_BIOME_PICKER);
|
||||
this.mapVoid = new SquareBiomeMap(seed, GeneratorOptions.getBiomeSizeEndVoid(), BiomeAPI.END_VOID_BIOME_PICKER);
|
||||
}
|
||||
else {
|
||||
this.mapLand = new HexBiomeMap(seed, GeneratorOptions.getBiomeSizeEndLand(), BiomeAPI.END_LAND_BIOME_PICKER);
|
||||
this.mapVoid = new HexBiomeMap(seed, GeneratorOptions.getBiomeSizeEndVoid(), BiomeAPI.END_VOID_BIOME_PICKER);
|
||||
}
|
||||
|
||||
WorldgenRandom chunkRandom = new WorldgenRandom(new LegacyRandomSource(seed));
|
||||
chunkRandom.consumeCount(17292);
|
||||
this.noise = new SimplexNoise(chunkRandom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSeed(long seed) {
|
||||
super.setSeed(seed);
|
||||
initMap(seed);
|
||||
}
|
||||
|
||||
private static List<Holder<Biome>> getBiomes(Registry<Biome> biomeRegistry) {
|
||||
List<String> includeLand = Configs.BIOMES_CONFIG.getEntry("force_include", "end_land_biomes", StringArrayEntry.class).getValue();
|
||||
List<String> includeVoid = Configs.BIOMES_CONFIG.getEntry("force_include", "end_void_biomes", StringArrayEntry.class).getValue();
|
||||
List<String> includeLand = Configs.BIOMES_CONFIG.getEntry("force_include",
|
||||
"end_land_biomes",
|
||||
StringArrayEntry.class).getValue();
|
||||
List<String> includeVoid = Configs.BIOMES_CONFIG.getEntry("force_include",
|
||||
"end_void_biomes",
|
||||
StringArrayEntry.class).getValue();
|
||||
|
||||
return biomeRegistry.stream()
|
||||
.filter(biome -> biomeRegistry.getResourceKey(biome).isPresent())
|
||||
|
@ -141,13 +143,69 @@ public class BCLibEndBiomeSource extends BCLBiomeSource {
|
|||
}
|
||||
key = bclBiome.getID();
|
||||
}
|
||||
return BiomeAPI.END_LAND_BIOME_PICKER.containsImmutable(key) || BiomeAPI.END_VOID_BIOME_PICKER.containsImmutable(key) || (isEndBiome && BiomeAPI.isDatapackBiome(key));
|
||||
return BiomeAPI.END_LAND_BIOME_PICKER.containsImmutable(key) || BiomeAPI.END_VOID_BIOME_PICKER.containsImmutable(
|
||||
key) || (isEndBiome && BiomeAPI.isDatapackBiome(key));
|
||||
}).toList();
|
||||
}
|
||||
|
||||
public static float getLegacyHeightValue(SimplexNoise simplexNoise, int i, int j) {
|
||||
int k = i / 2;
|
||||
int l = j / 2;
|
||||
int m = i % 2;
|
||||
int n = j % 2;
|
||||
float f = 100.0f - Mth.sqrt(i * i + j * j) * 8.0f;
|
||||
f = Mth.clamp(f, -100.0f, 80.0f);
|
||||
for (int o = -12; o <= 12; ++o) {
|
||||
for (int p = -12; p <= 12; ++p) {
|
||||
long q = k + o;
|
||||
long r = l + p;
|
||||
if (q * q + r * r <= 4096L || !(simplexNoise.getValue(q, r) < (double) -0.9f)) continue;
|
||||
float g = (Mth.abs(q) * 3439.0f + Mth.abs(r) * 147.0f) % 13.0f + 9.0f;
|
||||
float h = m - o * 2;
|
||||
float s = n - p * 2;
|
||||
float t = 100.0f - Mth.sqrt(h * h + s * s) * g;
|
||||
t = Mth.clamp(t, -100.0f, 80.0f);
|
||||
f = Math.max(f, t);
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
Registry.register(Registry.BIOME_SOURCE, BCLib.makeID("end_biome_source"), CODEC);
|
||||
}
|
||||
|
||||
private void initMap(long seed) {
|
||||
if (GeneratorOptions.useOldBiomeGenerator()) {
|
||||
this.mapLand = new SquareBiomeMap(seed,
|
||||
GeneratorOptions.getBiomeSizeEndLand(),
|
||||
BiomeAPI.END_LAND_BIOME_PICKER);
|
||||
this.mapVoid = new SquareBiomeMap(seed,
|
||||
GeneratorOptions.getBiomeSizeEndVoid(),
|
||||
BiomeAPI.END_VOID_BIOME_PICKER);
|
||||
} else {
|
||||
this.mapLand = new HexBiomeMap(seed,
|
||||
GeneratorOptions.getBiomeSizeEndLand(),
|
||||
BiomeAPI.END_LAND_BIOME_PICKER);
|
||||
this.mapVoid = new HexBiomeMap(seed,
|
||||
GeneratorOptions.getBiomeSizeEndVoid(),
|
||||
BiomeAPI.END_VOID_BIOME_PICKER);
|
||||
}
|
||||
|
||||
WorldgenRandom chunkRandom = new WorldgenRandom(new LegacyRandomSource(seed));
|
||||
chunkRandom.consumeCount(17292);
|
||||
this.noise = new SimplexNoise(chunkRandom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSeed(long seed) {
|
||||
super.setSeed(seed);
|
||||
initMap(seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Holder<Biome> getNoiseBiome(int biomeX, int biomeY, int biomeZ, Climate.Sampler sampler) {
|
||||
if (mapLand==null || mapVoid==null)
|
||||
if (mapLand == null || mapVoid == null)
|
||||
return this.possibleBiomes().stream().findFirst().get();
|
||||
long posX = biomeX << 2;
|
||||
long posZ = biomeZ << 2;
|
||||
|
@ -173,54 +231,24 @@ public class BCLibEndBiomeSource extends BCLBiomeSource {
|
|||
|
||||
if (height < -10F) {
|
||||
return mapVoid.getBiome(posX, biomeY << 2, posZ).getActualBiome();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return mapLand.getBiome(posX, biomeY << 2, posZ).getActualBiome();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pos.setLocation(biomeX, biomeZ);
|
||||
if (endLandFunction.apply(pos)) {
|
||||
return dist <= farEndBiomes ? centerBiome : mapLand.getBiome(posX, biomeY << 2, posZ).getActualBiome();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return dist <= farEndBiomes ? barrens : mapVoid.getBiome(posX, biomeY << 2, posZ).getActualBiome();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static float getLegacyHeightValue(SimplexNoise simplexNoise, int i, int j) {
|
||||
int k = i / 2;
|
||||
int l = j / 2;
|
||||
int m = i % 2;
|
||||
int n = j % 2;
|
||||
float f = 100.0f - Mth.sqrt(i * i + j * j) * 8.0f;
|
||||
f = Mth.clamp(f, -100.0f, 80.0f);
|
||||
for (int o = -12; o <= 12; ++o) {
|
||||
for (int p = -12; p <= 12; ++p) {
|
||||
long q = k + o;
|
||||
long r = l + p;
|
||||
if (q * q + r * r <= 4096L || !(simplexNoise.getValue(q, r) < (double)-0.9f)) continue;
|
||||
float g = (Mth.abs(q) * 3439.0f + Mth.abs(r) * 147.0f) % 13.0f + 9.0f;
|
||||
float h = m - o * 2;
|
||||
float s = n - p * 2;
|
||||
float t = 100.0f - Mth.sqrt(h * h + s * s) * g;
|
||||
t = Mth.clamp(t, -100.0f, 80.0f);
|
||||
f = Math.max(f, t);
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Codec<? extends BiomeSource> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
Registry.register(Registry.BIOME_SOURCE, BCLib.makeID("end_biome_source"), CODEC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BCLib - The End BiomeSource";
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package ru.bclib.world.generator;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
|
||||
import net.minecraft.core.DefaultedRegistry;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.MappedRegistry;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.resources.RegistryOps;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BiomeTags;
|
||||
import net.minecraft.util.ExtraCodecs;
|
||||
import net.minecraft.world.level.biome.*;
|
||||
|
||||
import com.mojang.datafixers.kinds.Applicative;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import org.apache.commons.lang3.function.TriFunction;
|
||||
import ru.bclib.BCLib;
|
||||
import ru.bclib.api.biomes.BiomeAPI;
|
||||
|
@ -25,46 +26,30 @@ import ru.bclib.world.generator.map.hex.HexBiomeMap;
|
|||
import ru.bclib.world.generator.map.square.SquareBiomeMap;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BCLibNetherBiomeSource extends BCLBiomeSource {
|
||||
|
||||
private static boolean forceLegacyGenerator = false;
|
||||
private static int lastWorldHeight;
|
||||
private static int worldHeight;
|
||||
public static final Codec<BCLibNetherBiomeSource> CODEC = RecordCodecBuilder
|
||||
.create(instance -> instance
|
||||
.group(RegistryOps
|
||||
.retrieveRegistry(Registry.BIOME_REGISTRY)
|
||||
.forGetter(source -> source.biomeRegistry)
|
||||
|
||||
.forGetter(source -> source.biomeRegistry),
|
||||
Codec
|
||||
.LONG
|
||||
.fieldOf("seed")
|
||||
.stable()
|
||||
.forGetter(source -> {
|
||||
return source.currentSeed;
|
||||
})
|
||||
)
|
||||
.apply(instance, instance.stable(BCLibNetherBiomeSource::new))
|
||||
);
|
||||
|
||||
private BiomeMap biomeMap;
|
||||
|
||||
private static boolean forceLegacyGenerator = false;
|
||||
private static int lastWorldHeight;
|
||||
private static int worldHeight;
|
||||
|
||||
/**
|
||||
* When true, the older square generator is used for the nether.
|
||||
*
|
||||
* This override is used (for example) by BetterNether to force the legacy generation for worlds
|
||||
* that were created before 1.18
|
||||
* @param val wether or not you want to force the old generatore.
|
||||
*/
|
||||
public static void setForceLegacyGeneration(boolean val){
|
||||
forceLegacyGenerator = val;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
BCLibNetherBiomeSource.worldHeight = worldHeight;
|
||||
}
|
||||
public BCLibNetherBiomeSource(Registry<Biome> biomeRegistry) {
|
||||
super(biomeRegistry, getBiomes(biomeRegistry));
|
||||
|
||||
BiomeAPI.NETHER_BIOME_PICKER.clearMutables();
|
||||
|
||||
this.possibleBiomes().forEach(biome -> {
|
||||
|
@ -73,8 +58,7 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource {
|
|||
if (!BiomeAPI.hasBiome(key)) {
|
||||
BCLBiome bclBiome = new BCLBiome(key, biome.value());
|
||||
BiomeAPI.NETHER_BIOME_PICKER.addBiomeMutable(bclBiome);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
BCLBiome bclBiome = BiomeAPI.getBiome(key);
|
||||
if (bclBiome != BiomeAPI.EMPTY_BIOME) {
|
||||
if (bclBiome.getParentBiome() == null) {
|
||||
|
@ -88,20 +72,37 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource {
|
|||
|
||||
BiomeAPI.NETHER_BIOME_PICKER.getBiomes().forEach(biome -> biome.updateActualBiomes(biomeRegistry));
|
||||
BiomeAPI.NETHER_BIOME_PICKER.rebuild();
|
||||
|
||||
initMap(0);
|
||||
}
|
||||
@Override
|
||||
public void setSeed(long seed) {
|
||||
seed = 0;
|
||||
super.setSeed(seed);
|
||||
initMap(seed);
|
||||
}
|
||||
|
||||
public BCLibNetherBiomeSource(Registry<Biome> biomeRegistry, long seed) {
|
||||
this(biomeRegistry);
|
||||
setSeed(seed);
|
||||
}
|
||||
|
||||
/**
|
||||
* When true, the older square generator is used for the nether.
|
||||
* <p>
|
||||
* This override is used (for example) by BetterNether to force the legacy generation for worlds
|
||||
* that were created before 1.18
|
||||
*
|
||||
* @param val wether or not you want to force the old generatore.
|
||||
*/
|
||||
public static void setForceLegacyGeneration(boolean val) {
|
||||
forceLegacyGenerator = val;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
BCLibNetherBiomeSource.worldHeight = worldHeight;
|
||||
}
|
||||
|
||||
private static List<Holder<Biome>> getBiomes(Registry<Biome> biomeRegistry) {
|
||||
List<String> include = Configs.BIOMES_CONFIG.getEntry("force_include", "nether_biomes", StringArrayEntry.class).getValue();
|
||||
List<String> include = Configs.BIOMES_CONFIG.getEntry("force_include", "nether_biomes", StringArrayEntry.class)
|
||||
.getValue();
|
||||
|
||||
return biomeRegistry.stream()
|
||||
.filter(biome -> biomeRegistry.getResourceKey(biome).isPresent())
|
||||
|
@ -125,13 +126,29 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource {
|
|||
key = bclBiome.getID();
|
||||
}
|
||||
final boolean isNetherBiome = biome.is(BiomeTags.IS_NETHER);
|
||||
return BiomeAPI.NETHER_BIOME_PICKER.containsImmutable(key) || (isNetherBiome && BiomeAPI.isDatapackBiome(key));
|
||||
return BiomeAPI.NETHER_BIOME_PICKER.containsImmutable(key) || (isNetherBiome && BiomeAPI.isDatapackBiome(
|
||||
key));
|
||||
}).toList();
|
||||
}
|
||||
|
||||
public static <T> void debug(Object el, Registry<T> reg) {
|
||||
System.out.println("Unknown " + el + " in " + reg);
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
Registry.register(Registry.BIOME_SOURCE, BCLib.makeID("nether_biome_source"), CODEC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSeed(long seed) {
|
||||
|
||||
super.setSeed(seed);
|
||||
initMap(seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Holder<Biome> getNoiseBiome(int biomeX, int biomeY, int biomeZ, Climate.Sampler var4) {
|
||||
if (biomeMap==null)
|
||||
if (biomeMap == null)
|
||||
return this.possibleBiomes().stream().findFirst().get();
|
||||
|
||||
if (lastWorldHeight != worldHeight) {
|
||||
|
@ -142,26 +159,19 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource {
|
|||
biomeMap.clearCache();
|
||||
}
|
||||
BCLBiome bb = biomeMap.getBiome(biomeX << 2, biomeY << 2, biomeZ << 2);
|
||||
if(biomeRegistry.getId(bb.getActualBiome().value())<0) debug(bb, biomeRegistry);
|
||||
return bb.getActualBiome();
|
||||
}
|
||||
|
||||
public static<T> void debug(Object el, Registry<T> reg){
|
||||
System.out.println("Unknown " + el + " in " + reg);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Codec<? extends BiomeSource> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
Registry.register(Registry.BIOME_SOURCE, BCLib.makeID("nether_biome_source"), CODEC);
|
||||
}
|
||||
|
||||
private void initMap(long seed) {
|
||||
boolean useLegacy = GeneratorOptions.useOldBiomeGenerator() || forceLegacyGenerator;
|
||||
TriFunction<Long, Integer, BiomePicker, BiomeMap> mapConstructor = useLegacy ? SquareBiomeMap::new : HexBiomeMap::new;
|
||||
TriFunction<Long, Integer, BiomePicker, BiomeMap> mapConstructor = useLegacy
|
||||
? SquareBiomeMap::new
|
||||
: HexBiomeMap::new;
|
||||
if (worldHeight > 128 && GeneratorOptions.useVerticalBiomes()) {
|
||||
this.biomeMap = new MapStack(
|
||||
seed,
|
||||
|
@ -171,9 +181,10 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource {
|
|||
worldHeight,
|
||||
mapConstructor
|
||||
);
|
||||
}
|
||||
else {
|
||||
this.biomeMap = mapConstructor.apply(seed, GeneratorOptions.getBiomeSizeNether(), BiomeAPI.NETHER_BIOME_PICKER);
|
||||
} else {
|
||||
this.biomeMap = mapConstructor.apply(seed,
|
||||
GeneratorOptions.getBiomeSizeNether(),
|
||||
BiomeAPI.NETHER_BIOME_PICKER);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue