Fixed CaveBiome Codecs
This commit is contained in:
parent
3f3454e634
commit
77a71cb746
10 changed files with 362 additions and 27 deletions
|
@ -64,6 +64,21 @@ public class EndBiomes {
|
||||||
public static void register() {
|
public static void register() {
|
||||||
BCLBiomeRegistry.registerBiomeCodec(BetterEnd.makeID("biome"), EndBiome.KEY_CODEC);
|
BCLBiomeRegistry.registerBiomeCodec(BetterEnd.makeID("biome"), EndBiome.KEY_CODEC);
|
||||||
BCLBiomeRegistry.registerBiomeCodec(BetterEnd.makeID("cave_biome"), EndCaveBiome.KEY_CODEC);
|
BCLBiomeRegistry.registerBiomeCodec(BetterEnd.makeID("cave_biome"), EndCaveBiome.KEY_CODEC);
|
||||||
|
BCLBiomeRegistry.registerBiomeCodec(
|
||||||
|
BetterEnd.makeID("empty_aurora_cave_biome"),
|
||||||
|
EmptyAuroraCaveBiome.KEY_CODEC
|
||||||
|
);
|
||||||
|
BCLBiomeRegistry.registerBiomeCodec(BetterEnd.makeID("empty_end_cave_biome"), EmptyEndCaveBiome.KEY_CODEC);
|
||||||
|
BCLBiomeRegistry.registerBiomeCodec(
|
||||||
|
BetterEnd.makeID("empty_smaragdant_cave_biome"),
|
||||||
|
EmptySmaragdantCaveBiome.KEY_CODEC
|
||||||
|
);
|
||||||
|
BCLBiomeRegistry.registerBiomeCodec(BetterEnd.makeID("jade_cave_biome"), JadeCaveBiome.KEY_CODEC);
|
||||||
|
BCLBiomeRegistry.registerBiomeCodec(BetterEnd.makeID("lush_aurora_cave_biome"), LushAuroraCaveBiome.KEY_CODEC);
|
||||||
|
BCLBiomeRegistry.registerBiomeCodec(
|
||||||
|
BetterEnd.makeID("lush_smaragdant_cave_biome"),
|
||||||
|
LushSmaragdantCaveBiome.KEY_CODEC
|
||||||
|
);
|
||||||
LifeCycleAPI.onLevelLoad(EndBiomes::onWorldLoad);
|
LifeCycleAPI.onLevelLoad(EndBiomes::onWorldLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,28 @@
|
||||||
package org.betterx.betterend.world.biome.cave;
|
package org.betterx.betterend.world.biome.cave;
|
||||||
|
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
|
||||||
|
import org.betterx.bclib.util.WeightedList;
|
||||||
import org.betterx.betterend.registry.EndFeatures;
|
import org.betterx.betterend.registry.EndFeatures;
|
||||||
import org.betterx.betterend.registry.EndParticles;
|
import org.betterx.betterend.registry.EndParticles;
|
||||||
import org.betterx.betterend.world.biome.EndBiome;
|
import org.betterx.betterend.world.biome.EndBiome;
|
||||||
|
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.util.KeyDispatchDataCodec;
|
||||||
|
import net.minecraft.world.level.biome.Climate;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class EmptyAuroraCaveBiome extends EndCaveBiome.Config {
|
public class EmptyAuroraCaveBiome extends EndCaveBiome.Config {
|
||||||
|
public static final Codec<EmptyAuroraCaveBiome.Biome> CODEC = EndCaveBiome.simpleCaveBiomeCodec(EmptyAuroraCaveBiome.Biome::new);
|
||||||
|
public static final KeyDispatchDataCodec<EmptyAuroraCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
|
||||||
|
|
||||||
public static class Biome extends EndCaveBiome {
|
public static class Biome extends EndCaveBiome {
|
||||||
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
|
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
|
||||||
super(biomeID, biome, settings);
|
super(biomeID, biome, settings);
|
||||||
|
@ -18,6 +31,45 @@ public class EmptyAuroraCaveBiome extends EndCaveBiome.Config {
|
||||||
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
|
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyDispatchDataCodec<? extends BCLBiome> codec() {
|
||||||
|
return EmptyAuroraCaveBiome.KEY_CODEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Biome(
|
||||||
|
float terrainHeight,
|
||||||
|
float fogDensity,
|
||||||
|
float genChance,
|
||||||
|
int edgeSize,
|
||||||
|
boolean vertical,
|
||||||
|
Optional<ResourceLocation> edge,
|
||||||
|
ResourceLocation biomeID,
|
||||||
|
Optional<List<Climate.ParameterPoint>> parameterPoints,
|
||||||
|
Optional<ResourceLocation> biomeParent,
|
||||||
|
Optional<WeightedList<ResourceLocation>> subbiomes,
|
||||||
|
Optional<String> intendedType,
|
||||||
|
boolean hasCaves,
|
||||||
|
WeightedList<Holder<ConfiguredFeature<?, ?>>> floorFeatures,
|
||||||
|
WeightedList<Holder<ConfiguredFeature<?, ?>>> ceilFeatures
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
terrainHeight,
|
||||||
|
fogDensity,
|
||||||
|
genChance,
|
||||||
|
edgeSize,
|
||||||
|
vertical,
|
||||||
|
edge,
|
||||||
|
biomeID,
|
||||||
|
parameterPoints,
|
||||||
|
biomeParent,
|
||||||
|
subbiomes,
|
||||||
|
intendedType,
|
||||||
|
hasCaves,
|
||||||
|
floorFeatures,
|
||||||
|
ceilFeatures
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFloorDensity() {
|
public float getFloorDensity() {
|
||||||
return 0.01F;
|
return 0.01F;
|
||||||
|
|
|
@ -1,14 +1,27 @@
|
||||||
package org.betterx.betterend.world.biome.cave;
|
package org.betterx.betterend.world.biome.cave;
|
||||||
|
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
|
||||||
|
import org.betterx.bclib.util.WeightedList;
|
||||||
import org.betterx.betterend.registry.EndFeatures;
|
import org.betterx.betterend.registry.EndFeatures;
|
||||||
import org.betterx.betterend.world.biome.EndBiome;
|
import org.betterx.betterend.world.biome.EndBiome;
|
||||||
|
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.util.KeyDispatchDataCodec;
|
||||||
|
import net.minecraft.world.level.biome.Climate;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class EmptyEndCaveBiome extends EndCaveBiome.Config {
|
public class EmptyEndCaveBiome extends EndCaveBiome.Config {
|
||||||
|
public static final Codec<EmptyEndCaveBiome.Biome> CODEC = EndCaveBiome.simpleCaveBiomeCodec(EmptyEndCaveBiome.Biome::new);
|
||||||
|
public static final KeyDispatchDataCodec<EmptyEndCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
|
||||||
|
|
||||||
public static class Biome extends EndCaveBiome {
|
public static class Biome extends EndCaveBiome {
|
||||||
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
|
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
|
||||||
super(biomeID, biome, settings);
|
super(biomeID, biome, settings);
|
||||||
|
@ -17,6 +30,45 @@ public class EmptyEndCaveBiome extends EndCaveBiome.Config {
|
||||||
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
|
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyDispatchDataCodec<? extends BCLBiome> codec() {
|
||||||
|
return EmptyEndCaveBiome.KEY_CODEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Biome(
|
||||||
|
float terrainHeight,
|
||||||
|
float fogDensity,
|
||||||
|
float genChance,
|
||||||
|
int edgeSize,
|
||||||
|
boolean vertical,
|
||||||
|
Optional<ResourceLocation> edge,
|
||||||
|
ResourceLocation biomeID,
|
||||||
|
Optional<List<Climate.ParameterPoint>> parameterPoints,
|
||||||
|
Optional<ResourceLocation> biomeParent,
|
||||||
|
Optional<WeightedList<ResourceLocation>> subbiomes,
|
||||||
|
Optional<String> intendedType,
|
||||||
|
boolean hasCaves,
|
||||||
|
WeightedList<Holder<ConfiguredFeature<?, ?>>> floorFeatures,
|
||||||
|
WeightedList<Holder<ConfiguredFeature<?, ?>>> ceilFeatures
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
terrainHeight,
|
||||||
|
fogDensity,
|
||||||
|
genChance,
|
||||||
|
edgeSize,
|
||||||
|
vertical,
|
||||||
|
edge,
|
||||||
|
biomeID,
|
||||||
|
parameterPoints,
|
||||||
|
biomeParent,
|
||||||
|
subbiomes,
|
||||||
|
intendedType,
|
||||||
|
hasCaves,
|
||||||
|
floorFeatures,
|
||||||
|
ceilFeatures
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFloorDensity() {
|
public float getFloorDensity() {
|
||||||
return 0.1F;
|
return 0.1F;
|
||||||
|
|
|
@ -1,15 +1,29 @@
|
||||||
package org.betterx.betterend.world.biome.cave;
|
package org.betterx.betterend.world.biome.cave;
|
||||||
|
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
|
||||||
|
import org.betterx.bclib.util.WeightedList;
|
||||||
import org.betterx.betterend.registry.EndFeatures;
|
import org.betterx.betterend.registry.EndFeatures;
|
||||||
import org.betterx.betterend.registry.EndParticles;
|
import org.betterx.betterend.registry.EndParticles;
|
||||||
import org.betterx.betterend.world.biome.EndBiome;
|
import org.betterx.betterend.world.biome.EndBiome;
|
||||||
|
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.util.KeyDispatchDataCodec;
|
||||||
|
import net.minecraft.world.level.biome.Climate;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class EmptySmaragdantCaveBiome extends EndCaveBiome.Config {
|
public class EmptySmaragdantCaveBiome extends EndCaveBiome.Config {
|
||||||
|
public static final Codec<EmptySmaragdantCaveBiome.Biome> CODEC = EndCaveBiome.simpleCaveBiomeCodec(
|
||||||
|
EmptySmaragdantCaveBiome.Biome::new);
|
||||||
|
public static final KeyDispatchDataCodec<EmptySmaragdantCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
|
||||||
|
|
||||||
public static class Biome extends EndCaveBiome {
|
public static class Biome extends EndCaveBiome {
|
||||||
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
|
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
|
||||||
super(biomeID, biome, settings);
|
super(biomeID, biome, settings);
|
||||||
|
@ -20,6 +34,45 @@ public class EmptySmaragdantCaveBiome extends EndCaveBiome.Config {
|
||||||
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
|
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyDispatchDataCodec<? extends BCLBiome> codec() {
|
||||||
|
return EmptySmaragdantCaveBiome.KEY_CODEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Biome(
|
||||||
|
float terrainHeight,
|
||||||
|
float fogDensity,
|
||||||
|
float genChance,
|
||||||
|
int edgeSize,
|
||||||
|
boolean vertical,
|
||||||
|
Optional<ResourceLocation> edge,
|
||||||
|
ResourceLocation biomeID,
|
||||||
|
Optional<List<Climate.ParameterPoint>> parameterPoints,
|
||||||
|
Optional<ResourceLocation> biomeParent,
|
||||||
|
Optional<WeightedList<ResourceLocation>> subbiomes,
|
||||||
|
Optional<String> intendedType,
|
||||||
|
boolean hasCaves,
|
||||||
|
WeightedList<Holder<ConfiguredFeature<?, ?>>> floorFeatures,
|
||||||
|
WeightedList<Holder<ConfiguredFeature<?, ?>>> ceilFeatures
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
terrainHeight,
|
||||||
|
fogDensity,
|
||||||
|
genChance,
|
||||||
|
edgeSize,
|
||||||
|
vertical,
|
||||||
|
edge,
|
||||||
|
biomeID,
|
||||||
|
parameterPoints,
|
||||||
|
biomeParent,
|
||||||
|
subbiomes,
|
||||||
|
intendedType,
|
||||||
|
hasCaves,
|
||||||
|
floorFeatures,
|
||||||
|
ceilFeatures
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFloorDensity() {
|
public float getFloorDensity() {
|
||||||
return 0.1F;
|
return 0.1F;
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.betterx.betterend.world.biome.EndBiome;
|
||||||
import org.betterx.betterend.world.features.terrain.caves.CaveChunkPopulatorFeature;
|
import org.betterx.betterend.world.features.terrain.caves.CaveChunkPopulatorFeature;
|
||||||
import org.betterx.betterend.world.features.terrain.caves.CaveChunkPopulatorFeatureConfig;
|
import org.betterx.betterend.world.features.terrain.caves.CaveChunkPopulatorFeatureConfig;
|
||||||
|
|
||||||
|
import com.mojang.datafixers.util.Function14;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -32,18 +33,22 @@ import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class EndCaveBiome extends EndBiome {
|
public class EndCaveBiome extends EndBiome {
|
||||||
public static final Codec<EndCaveBiome> CODEC = RecordCodecBuilder.create(instance ->
|
public static final Codec<EndCaveBiome> CODEC = simpleCaveBiomeCodec(EndCaveBiome::new);
|
||||||
codecWithSettings(
|
|
||||||
instance,
|
public static <T extends EndCaveBiome> Codec<T> simpleCaveBiomeCodec(Function14<Float, Float, Float, Integer, Boolean, Optional<ResourceLocation>, ResourceLocation, Optional<List<Climate.ParameterPoint>>, Optional<ResourceLocation>, Optional<WeightedList<ResourceLocation>>, Optional<String>, Boolean, WeightedList<Holder<ConfiguredFeature<?, ?>>>, WeightedList<Holder<ConfiguredFeature<?, ?>>>, T> builder) {
|
||||||
Codec.BOOL.fieldOf("has_caves").orElse(true).forGetter(EndBiome::hasCaves),
|
return RecordCodecBuilder.create(instance ->
|
||||||
WeightedList.listCodec(ConfiguredFeature.CODEC, "configured_features", "configured_feature")
|
codecWithSettings(
|
||||||
.fieldOf("floor_features")
|
instance,
|
||||||
.forGetter(o -> (WeightedList) ((EndCaveBiome) o).floorFeatures),
|
Codec.BOOL.fieldOf("has_caves").orElse(true).forGetter(EndBiome::hasCaves),
|
||||||
WeightedList.listCodec(ConfiguredFeature.CODEC, "configured_features", "configured_feature")
|
WeightedList.listCodec(ConfiguredFeature.CODEC, "configured_features", "configured_feature")
|
||||||
.fieldOf("ceil_features")
|
.fieldOf("floor_features")
|
||||||
.forGetter(o -> (WeightedList) ((EndCaveBiome) o).ceilFeatures)
|
.forGetter(o -> (WeightedList) ((EndCaveBiome) o).floorFeatures),
|
||||||
).apply(instance, EndCaveBiome::new)
|
WeightedList.listCodec(ConfiguredFeature.CODEC, "configured_features", "configured_feature")
|
||||||
);
|
.fieldOf("ceil_features")
|
||||||
|
.forGetter(o -> (WeightedList) ((EndCaveBiome) o).ceilFeatures)
|
||||||
|
).apply(instance, builder)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public static final KeyDispatchDataCodec<EndCaveBiome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
|
public static final KeyDispatchDataCodec<EndCaveBiome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
|
||||||
|
|
||||||
|
@ -102,9 +107,8 @@ public class EndCaveBiome extends EndBiome {
|
||||||
.configuration(new CaveChunkPopulatorFeatureConfig(ID))
|
.configuration(new CaveChunkPopulatorFeatureConfig(ID))
|
||||||
.buildAndRegister()
|
.buildAndRegister()
|
||||||
.place()
|
.place()
|
||||||
.decoration(GenerationStep.Decoration.RAW_GENERATION)
|
.decoration(GenerationStep.Decoration.UNDERGROUND_DECORATION)
|
||||||
.count(1)
|
.count(1)
|
||||||
.onlyInBiome()
|
|
||||||
.buildAndRegister();
|
.buildAndRegister();
|
||||||
|
|
||||||
builder.feature(feature)
|
builder.feature(feature)
|
||||||
|
|
|
@ -1,23 +1,37 @@
|
||||||
package org.betterx.betterend.world.biome.cave;
|
package org.betterx.betterend.world.biome.cave;
|
||||||
|
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
|
||||||
|
import org.betterx.bclib.util.WeightedList;
|
||||||
import org.betterx.betterend.noise.OpenSimplexNoise;
|
import org.betterx.betterend.noise.OpenSimplexNoise;
|
||||||
import org.betterx.betterend.registry.EndBlocks;
|
import org.betterx.betterend.registry.EndBlocks;
|
||||||
import org.betterx.betterend.world.biome.EndBiome;
|
import org.betterx.betterend.world.biome.EndBiome;
|
||||||
|
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.util.KeyDispatchDataCodec;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.world.level.biome.Climate;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class JadeCaveBiome extends EndCaveBiome.Config {
|
public class JadeCaveBiome extends EndCaveBiome.Config {
|
||||||
|
public static final Codec<JadeCaveBiome.Biome> CODEC = EndCaveBiome.simpleCaveBiomeCodec(JadeCaveBiome.Biome::new);
|
||||||
|
public static final KeyDispatchDataCodec<JadeCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
|
||||||
|
|
||||||
public static class Biome extends EndCaveBiome {
|
public static class Biome extends EndCaveBiome {
|
||||||
private static final OpenSimplexNoise WALL_NOISE = new OpenSimplexNoise("jade_cave".hashCode());
|
private static final OpenSimplexNoise WALL_NOISE = new OpenSimplexNoise("jade_cave".hashCode());
|
||||||
private static final OpenSimplexNoise DEPTH_NOISE = new OpenSimplexNoise("depth_noise".hashCode());
|
private static final OpenSimplexNoise DEPTH_NOISE = new OpenSimplexNoise("depth_noise".hashCode());
|
||||||
private static final BlockState[] JADE = new BlockState[3];
|
private static final BlockState[] JADE = new BlockState[3];
|
||||||
|
|
||||||
|
|
||||||
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
|
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
|
||||||
super(biomeID, biome, settings);
|
super(biomeID, biome, settings);
|
||||||
|
|
||||||
|
@ -26,6 +40,45 @@ public class JadeCaveBiome extends EndCaveBiome.Config {
|
||||||
JADE[2] = EndBlocks.SANDY_JADESTONE.stone.defaultBlockState();
|
JADE[2] = EndBlocks.SANDY_JADESTONE.stone.defaultBlockState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyDispatchDataCodec<? extends BCLBiome> codec() {
|
||||||
|
return JadeCaveBiome.KEY_CODEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Biome(
|
||||||
|
float terrainHeight,
|
||||||
|
float fogDensity,
|
||||||
|
float genChance,
|
||||||
|
int edgeSize,
|
||||||
|
boolean vertical,
|
||||||
|
Optional<ResourceLocation> edge,
|
||||||
|
ResourceLocation biomeID,
|
||||||
|
Optional<List<Climate.ParameterPoint>> parameterPoints,
|
||||||
|
Optional<ResourceLocation> biomeParent,
|
||||||
|
Optional<WeightedList<ResourceLocation>> subbiomes,
|
||||||
|
Optional<String> intendedType,
|
||||||
|
boolean hasCaves,
|
||||||
|
WeightedList<Holder<ConfiguredFeature<?, ?>>> floorFeatures,
|
||||||
|
WeightedList<Holder<ConfiguredFeature<?, ?>>> ceilFeatures
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
terrainHeight,
|
||||||
|
fogDensity,
|
||||||
|
genChance,
|
||||||
|
edgeSize,
|
||||||
|
vertical,
|
||||||
|
edge,
|
||||||
|
biomeID,
|
||||||
|
parameterPoints,
|
||||||
|
biomeParent,
|
||||||
|
subbiomes,
|
||||||
|
intendedType,
|
||||||
|
hasCaves,
|
||||||
|
floorFeatures,
|
||||||
|
ceilFeatures
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getWall(BlockPos pos) {
|
public BlockState getWall(BlockPos pos) {
|
||||||
double depth = DEPTH_NOISE.eval(pos.getX() * 0.02, pos.getZ() * 0.02) * 0.2 + 0.5;
|
double depth = DEPTH_NOISE.eval(pos.getX() * 0.02, pos.getZ() * 0.02) * 0.2 + 0.5;
|
||||||
|
@ -42,6 +95,7 @@ public class JadeCaveBiome extends EndCaveBiome.Config {
|
||||||
super("jade_cave");
|
super("jade_cave");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addCustomBuildData(BCLBiomeBuilder builder) {
|
protected void addCustomBuildData(BCLBiomeBuilder builder) {
|
||||||
super.addCustomBuildData(builder);
|
super.addCustomBuildData(builder);
|
||||||
|
|
|
@ -1,20 +1,33 @@
|
||||||
package org.betterx.betterend.world.biome.cave;
|
package org.betterx.betterend.world.biome.cave;
|
||||||
|
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
|
||||||
import org.betterx.bclib.blocks.BlockProperties;
|
import org.betterx.bclib.blocks.BlockProperties;
|
||||||
import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
|
import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
|
||||||
|
import org.betterx.bclib.util.WeightedList;
|
||||||
import org.betterx.betterend.registry.EndBlocks;
|
import org.betterx.betterend.registry.EndBlocks;
|
||||||
import org.betterx.betterend.registry.EndFeatures;
|
import org.betterx.betterend.registry.EndFeatures;
|
||||||
import org.betterx.betterend.registry.EndParticles;
|
import org.betterx.betterend.registry.EndParticles;
|
||||||
import org.betterx.betterend.world.biome.EndBiome;
|
import org.betterx.betterend.world.biome.EndBiome;
|
||||||
|
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.util.KeyDispatchDataCodec;
|
||||||
|
import net.minecraft.world.level.biome.Climate;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class LushAuroraCaveBiome extends EndCaveBiome.Config {
|
public class LushAuroraCaveBiome extends EndCaveBiome.Config {
|
||||||
|
public static final Codec<LushAuroraCaveBiome.Biome> CODEC = EndCaveBiome.simpleCaveBiomeCodec(LushAuroraCaveBiome.Biome::new);
|
||||||
|
public static final KeyDispatchDataCodec<LushAuroraCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
|
||||||
|
|
||||||
public static class Biome extends EndCaveBiome {
|
public static class Biome extends EndCaveBiome {
|
||||||
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
|
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
|
||||||
super(biomeID, biome, settings);
|
super(biomeID, biome, settings);
|
||||||
|
@ -31,6 +44,45 @@ public class LushAuroraCaveBiome extends EndCaveBiome.Config {
|
||||||
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE_CAVEMOSS.configuredFeature, 10);
|
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE_CAVEMOSS.configuredFeature, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyDispatchDataCodec<? extends BCLBiome> codec() {
|
||||||
|
return LushAuroraCaveBiome.KEY_CODEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Biome(
|
||||||
|
float terrainHeight,
|
||||||
|
float fogDensity,
|
||||||
|
float genChance,
|
||||||
|
int edgeSize,
|
||||||
|
boolean vertical,
|
||||||
|
Optional<ResourceLocation> edge,
|
||||||
|
ResourceLocation biomeID,
|
||||||
|
Optional<List<Climate.ParameterPoint>> parameterPoints,
|
||||||
|
Optional<ResourceLocation> biomeParent,
|
||||||
|
Optional<WeightedList<ResourceLocation>> subbiomes,
|
||||||
|
Optional<String> intendedType,
|
||||||
|
boolean hasCaves,
|
||||||
|
WeightedList<Holder<ConfiguredFeature<?, ?>>> floorFeatures,
|
||||||
|
WeightedList<Holder<ConfiguredFeature<?, ?>>> ceilFeatures
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
terrainHeight,
|
||||||
|
fogDensity,
|
||||||
|
genChance,
|
||||||
|
edgeSize,
|
||||||
|
vertical,
|
||||||
|
edge,
|
||||||
|
biomeID,
|
||||||
|
parameterPoints,
|
||||||
|
biomeParent,
|
||||||
|
subbiomes,
|
||||||
|
intendedType,
|
||||||
|
hasCaves,
|
||||||
|
floorFeatures,
|
||||||
|
ceilFeatures
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFloorDensity() {
|
public float getFloorDensity() {
|
||||||
return 0.2F;
|
return 0.2F;
|
||||||
|
|
|
@ -1,18 +1,32 @@
|
||||||
package org.betterx.betterend.world.biome.cave;
|
package org.betterx.betterend.world.biome.cave;
|
||||||
|
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeBuilder.BiomeSupplier;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeSettings;
|
||||||
import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
|
import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
|
||||||
|
import org.betterx.bclib.util.WeightedList;
|
||||||
import org.betterx.betterend.registry.EndBlocks;
|
import org.betterx.betterend.registry.EndBlocks;
|
||||||
import org.betterx.betterend.registry.EndFeatures;
|
import org.betterx.betterend.registry.EndFeatures;
|
||||||
import org.betterx.betterend.registry.EndParticles;
|
import org.betterx.betterend.registry.EndParticles;
|
||||||
import org.betterx.betterend.world.biome.EndBiome;
|
import org.betterx.betterend.world.biome.EndBiome;
|
||||||
|
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.util.KeyDispatchDataCodec;
|
||||||
|
import net.minecraft.world.level.biome.Climate;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class LushSmaragdantCaveBiome extends EndCaveBiome.Config {
|
public class LushSmaragdantCaveBiome extends EndCaveBiome.Config {
|
||||||
|
public static final Codec<LushSmaragdantCaveBiome.Biome> CODEC = EndCaveBiome.simpleCaveBiomeCodec(
|
||||||
|
LushSmaragdantCaveBiome.Biome::new);
|
||||||
|
public static final KeyDispatchDataCodec<LushSmaragdantCaveBiome.Biome> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
|
||||||
|
|
||||||
public static class Biome extends EndCaveBiome {
|
public static class Biome extends EndCaveBiome {
|
||||||
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
|
public Biome(ResourceLocation biomeID, net.minecraft.world.level.biome.Biome biome, BCLBiomeSettings settings) {
|
||||||
super(biomeID, biome, settings);
|
super(biomeID, biome, settings);
|
||||||
|
@ -23,6 +37,45 @@ public class LushSmaragdantCaveBiome extends EndCaveBiome.Config {
|
||||||
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
|
this.addCeilFeature(EndFeatures.END_STONE_STALACTITE.configuredFeature, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyDispatchDataCodec<? extends BCLBiome> codec() {
|
||||||
|
return LushSmaragdantCaveBiome.KEY_CODEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Biome(
|
||||||
|
float terrainHeight,
|
||||||
|
float fogDensity,
|
||||||
|
float genChance,
|
||||||
|
int edgeSize,
|
||||||
|
boolean vertical,
|
||||||
|
Optional<ResourceLocation> edge,
|
||||||
|
ResourceLocation biomeID,
|
||||||
|
Optional<List<Climate.ParameterPoint>> parameterPoints,
|
||||||
|
Optional<ResourceLocation> biomeParent,
|
||||||
|
Optional<WeightedList<ResourceLocation>> subbiomes,
|
||||||
|
Optional<String> intendedType,
|
||||||
|
boolean hasCaves,
|
||||||
|
WeightedList<Holder<ConfiguredFeature<?, ?>>> floorFeatures,
|
||||||
|
WeightedList<Holder<ConfiguredFeature<?, ?>>> ceilFeatures
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
terrainHeight,
|
||||||
|
fogDensity,
|
||||||
|
genChance,
|
||||||
|
edgeSize,
|
||||||
|
vertical,
|
||||||
|
edge,
|
||||||
|
biomeID,
|
||||||
|
parameterPoints,
|
||||||
|
biomeParent,
|
||||||
|
subbiomes,
|
||||||
|
intendedType,
|
||||||
|
hasCaves,
|
||||||
|
floorFeatures,
|
||||||
|
ceilFeatures
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFloorDensity() {
|
public float getFloorDensity() {
|
||||||
return 0.1F;
|
return 0.1F;
|
||||||
|
|
|
@ -108,9 +108,9 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
||||||
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
|
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
|
||||||
}
|
}
|
||||||
if (density > 0 && random.nextFloat() <= density) {
|
if (density > 0 && random.nextFloat() <= density) {
|
||||||
ConfiguredFeature<?, ?> feature = biome.getFloorFeature(random).value();
|
Holder<? extends ConfiguredFeature<?, ?>> feature = biome.getFloorFeature(random);
|
||||||
if (feature != null) {
|
if (feature != null && feature.isBound()) {
|
||||||
feature.place(world, generator, random, pos.above());
|
feature.value().place(world, generator, random, pos.above());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -130,9 +130,9 @@ public abstract class EndCaveFeature extends DefaultFeature {
|
||||||
BlocksHelper.setWithoutUpdate(world, pos, ceilBlock);
|
BlocksHelper.setWithoutUpdate(world, pos, ceilBlock);
|
||||||
}
|
}
|
||||||
if (density > 0 && random.nextFloat() <= density) {
|
if (density > 0 && random.nextFloat() <= density) {
|
||||||
ConfiguredFeature<?, ?> feature = biome.getCeilFeature(random).value();
|
Holder<? extends ConfiguredFeature<?, ?>> feature = biome.getCeilFeature(random);
|
||||||
if (feature != null) {
|
if (feature != null && feature.isBound()) {
|
||||||
feature.place(world, generator, random, pos.below());
|
feature.value().place(world, generator, random, pos.below());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -209,9 +209,9 @@ public class TunelCaveFeature extends EndCaveFeature {
|
||||||
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
|
BlocksHelper.setWithoutUpdate(world, pos, surfaceBlock);
|
||||||
}
|
}
|
||||||
if (density > 0 && random.nextFloat() <= density) {
|
if (density > 0 && random.nextFloat() <= density) {
|
||||||
ConfiguredFeature<?, ?> feature = biome.getFloorFeature(random).value();
|
Holder<? extends ConfiguredFeature<?, ?>> feature = biome.getFloorFeature(random);
|
||||||
if (feature != null) {
|
if (feature != null && feature.isBound()) {
|
||||||
feature.place(world, generator, random, pos.above());
|
feature.value().place(world, generator, random, pos.above());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -232,9 +232,9 @@ public class TunelCaveFeature extends EndCaveFeature {
|
||||||
BlocksHelper.setWithoutUpdate(world, pos, ceilBlock);
|
BlocksHelper.setWithoutUpdate(world, pos, ceilBlock);
|
||||||
}
|
}
|
||||||
if (density > 0 && random.nextFloat() <= density) {
|
if (density > 0 && random.nextFloat() <= density) {
|
||||||
ConfiguredFeature<?, ?> feature = biome.getCeilFeature(random).value();
|
Holder<? extends ConfiguredFeature<?, ?>> feature = biome.getCeilFeature(random);
|
||||||
if (feature != null) {
|
if (feature != null && feature.isBound()) {
|
||||||
feature.place(world, generator, random, pos.below());
|
feature.value().place(world, generator, random, pos.below());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue