Add info about top/underMaterial to BE-biomes

This commit is contained in:
Frank 2021-12-08 23:38:52 +01:00
parent 5c12813b3e
commit 633c5ad553
26 changed files with 430 additions and 67 deletions

View file

@ -15,6 +15,7 @@ import ru.bclib.sdf.primitive.SDFCappedCone;
import ru.bclib.util.BlocksHelper;
import ru.bclib.world.features.DefaultFeature;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.world.biome.EndBiome;
public class BiomeIslandFeature extends DefaultFeature {
private static final MutableBlockPos CENTER = new MutableBlockPos();
@ -31,7 +32,7 @@ public class BiomeIslandFeature extends DefaultFeature {
Biome biome = world.getBiome(pos);
int dist = BlocksHelper.downRay(world, pos, 10) + 1;
BlockPos surfacePos = new BlockPos(pos.getX(), pos.getY()-dist, pos.getZ());
BlockState topMaterial = world.getBlockState(surfacePos);
BlockState topMaterial = EndBiome.findTopMaterial(world, surfacePos);;
//TODO: 1.18 the block selection should be based on the surface rules of the biome
if (BlocksHelper.isFluid(topMaterial)) {
@ -39,8 +40,7 @@ public class BiomeIslandFeature extends DefaultFeature {
underBlock = Blocks.STONE.defaultBlockState();
}
else {
topBlock = topMaterial.is(Blocks.AIR)?Blocks.GRASS_BLOCK.defaultBlockState():topMaterial;
underBlock = Blocks.DIRT.defaultBlockState();
underBlock = EndBiome.findUnderMaterial(world, surfacePos);
}
simplexNoise = new OpenSimplexNoise(world.getSeed());

View file

@ -18,6 +18,7 @@ import ru.bclib.world.features.DefaultFeature;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlockFixer;
import ru.betterend.world.biome.EndBiome;
public class DesertLakeFeature extends DefaultFeature {
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
@ -124,7 +125,7 @@ public class DesertLakeFeature extends DefaultFeature {
pos = POS.below();
if (world.getBlockState(pos).is(TagAPI.BLOCK_GEN_TERRAIN)) {
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState(); //world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
state = EndBiome.findTopMaterial(world, pos); //world.getBiome(pos).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
if (y > waterLevel + 1) BlocksHelper.setWithoutUpdate(world, pos, state);
else if (y > waterLevel)
BlocksHelper.setWithoutUpdate(
@ -197,7 +198,7 @@ public class DesertLakeFeature extends DefaultFeature {
else if (y < waterLevel) {
if (world.isEmptyBlock(POS.above())) {
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState(); //world.getBiome(POS).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
state = EndBiome.findTopMaterial(world, pos); //world.getBiome(POS).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
BlocksHelper.setWithoutUpdate(
world,
POS,

View file

@ -18,11 +18,16 @@ import ru.bclib.world.features.DefaultFeature;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlockFixer;
import ru.betterend.world.biome.EndBiome;
public class EndLakeFeature extends DefaultFeature {
private static final BlockState END_STONE = Blocks.END_STONE.defaultBlockState();
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(15152);
private static final MutableBlockPos POS = new MutableBlockPos();
public EndLakeFeature(){
}
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
@ -124,8 +129,8 @@ public class EndLakeFeature extends DefaultFeature {
pos = POS.below();
if (world.getBlockState(pos).is(TagAPI.BLOCK_GEN_TERRAIN)) {
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState();
// state = world.getBiome(pos)
state = EndBiome.findTopMaterial(world, pos);
//state = world.getBiome(pos)
// .getGenerationSettings()
// .getSurfaceBuilderConfig()
// .getTopMaterial();
@ -196,7 +201,7 @@ public class EndLakeFeature extends DefaultFeature {
else if (y < waterLevel && y2 + x2 + z2 <= rb) {
if (world.isEmptyBlock(POS.above())) {
//TODO: 1.18 this needs to change to a dynamic block
state = Blocks.END_STONE.defaultBlockState();
state = EndBiome.findTopMaterial(world, pos);
// state = world.getBiome(POS)
// .getGenerationSettings()
// .getSurfaceBuilderConfig()

View file

@ -21,6 +21,7 @@ import ru.bclib.util.MHelper;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndFeatures;
import ru.betterend.world.biome.EndBiome;
public class FloatingSpireFeature extends SpireFeature {
@Override
@ -65,11 +66,11 @@ public class FloatingSpireFeature extends SpireFeature {
support.add(info.getPos().above());
}
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();//world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
return EndBiome.findTopMaterial(world, info.getPos());//world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
}
else if (info.getState(Direction.UP, 3).isAir()) {
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();
return EndBiome.findUnderMaterial(world, info.getPos());
// return world.getBiome(info.getPos())
// .getGenerationSettings()
// .getSurfaceBuilderConfig()

View file

@ -29,6 +29,7 @@ import ru.bclib.world.features.DefaultFeature;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndFeatures;
import ru.betterend.world.biome.EndBiome;
public class SpireFeature extends DefaultFeature {
protected static final Function<BlockState, Boolean> REPLACE;
@ -68,12 +69,12 @@ public class SpireFeature extends DefaultFeature {
support.add(info.getPos().above());
}
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();
return EndBiome.findTopMaterial(world, info.getPos());
//return world.getBiome(info.getPos()).getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial();
}
else if (info.getState(Direction.UP, 3).isAir()) {
//TODO: 1.18 this needs to change to a dynamic block
return Blocks.END_STONE.defaultBlockState();
return EndBiome.findUnderMaterial(world, info.getPos());
// return world.getBiome(info.getPos())
// .getGenerationSettings()
// .getSurfaceBuilderConfig()