removed reading of top/under/underwater material for now
This commit is contained in:
parent
dca9f84ccf
commit
78cc82932f
1 changed files with 11 additions and 8 deletions
|
@ -8,8 +8,6 @@ import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderBaseConfiguration;
|
|
||||||
import net.minecraft.world.level.levelgen.surfacebuilders.SurfaceBuilderConfiguration;
|
|
||||||
import ru.bclib.sdf.SDF;
|
import ru.bclib.sdf.SDF;
|
||||||
import ru.bclib.sdf.operator.SDFDisplacement;
|
import ru.bclib.sdf.operator.SDFDisplacement;
|
||||||
import ru.bclib.sdf.operator.SDFTranslate;
|
import ru.bclib.sdf.operator.SDFTranslate;
|
||||||
|
@ -25,21 +23,26 @@ public class BiomeIslandFeature extends DefaultFeature {
|
||||||
private static OpenSimplexNoise simplexNoise = new OpenSimplexNoise(412L);
|
private static OpenSimplexNoise simplexNoise = new OpenSimplexNoise(412L);
|
||||||
private static BlockState topBlock = Blocks.GRASS_BLOCK.defaultBlockState();
|
private static BlockState topBlock = Blocks.GRASS_BLOCK.defaultBlockState();
|
||||||
private static BlockState underBlock = Blocks.DIRT.defaultBlockState();
|
private static BlockState underBlock = Blocks.DIRT.defaultBlockState();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
|
||||||
final BlockPos pos = featureConfig.origin();
|
final BlockPos pos = featureConfig.origin();
|
||||||
final WorldGenLevel world = featureConfig.level();
|
final WorldGenLevel world = featureConfig.level();
|
||||||
Biome biome = world.getBiome(pos);
|
Biome biome = world.getBiome(pos);
|
||||||
SurfaceBuilderConfiguration surfaceConfig = biome.getGenerationSettings().getSurfaceBuilderConfig();
|
int dist = BlocksHelper.downRay(world, pos, 10) + 1;
|
||||||
BlockState topMaterial = surfaceConfig.getTopMaterial();
|
BlockPos surfacePos = new BlockPos(pos.getX(), pos.getY()-dist, pos.getZ());
|
||||||
|
BlockState topMaterial = world.getBlockState(surfacePos);
|
||||||
|
|
||||||
|
//TODO: 1.18 the block selection should be based on the surface rules of the biome
|
||||||
if (BlocksHelper.isFluid(topMaterial)) {
|
if (BlocksHelper.isFluid(topMaterial)) {
|
||||||
topBlock = ((SurfaceBuilderBaseConfiguration) surfaceConfig).getUnderwaterMaterial();
|
topBlock = Blocks.GRAVEL.defaultBlockState();
|
||||||
|
underBlock = Blocks.STONE.defaultBlockState();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
topBlock = topMaterial;
|
topBlock = topMaterial.is(Blocks.AIR)?Blocks.GRASS_BLOCK.defaultBlockState():topMaterial;
|
||||||
|
underBlock = Blocks.DIRT.defaultBlockState();
|
||||||
}
|
}
|
||||||
underBlock = surfaceConfig.getUnderMaterial();
|
|
||||||
simplexNoise = new OpenSimplexNoise(world.getSeed());
|
simplexNoise = new OpenSimplexNoise(world.getSeed());
|
||||||
CENTER.set(pos);
|
CENTER.set(pos);
|
||||||
ISLAND.fillRecursive(world, pos.below());
|
ISLAND.fillRecursive(world, pos.below());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue