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

@ -11,6 +11,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
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.blocks.BlockProperties;
import ru.bclib.util.BlocksHelper;
@ -34,8 +35,10 @@ public class SilkMothNestFeature extends DefaultFeature {
}
@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, center.getX(), center.getZ());
int minY = BlocksHelper.upRay(world, new BlockPos(center.getX(), 0, center.getZ()), maxY);
POS.set(center);