Fixed 'place'-Methods

This commit is contained in:
Frank Bauer 2021-06-24 15:10:10 +02:00
parent 4bf09362be
commit a82f30b95d
17 changed files with 103 additions and 52 deletions

View file

@ -7,6 +7,7 @@ import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;
@ -26,8 +27,10 @@ public abstract class FullHeightScatterFeature extends DefaultFeature {
public abstract void generate(WorldGenLevel world, Random random, BlockPos blockPos);
@Override
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos center,
NoneFeatureConfiguration featureConfig) {
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
Random random = featureConfig.random();
BlockPos center = featureConfig.origin();
WorldGenLevel world = featureConfig.level();
int maxY = world.getHeight(Heightmap.Types.WORLD_SURFACE_WG, center.getX(), center.getZ());
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
for (int y = maxY; y > minY; y--) {