Continue migration

This commit is contained in:
Aleksey 2021-04-12 16:34:13 +03:00
parent 47ed597358
commit 33dbfbe633
263 changed files with 1450 additions and 1486 deletions

View file

@ -5,7 +5,7 @@ import java.util.Random;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.level.WorldGenLevel;
public abstract class UnderwaterPlantScatter extends ScatterFeature {
private static final MutableBlockPos POS = new MutableBlockPos();
@ -15,26 +15,25 @@ public abstract class UnderwaterPlantScatter extends ScatterFeature {
}
@Override
protected BlockPos getCenterGround(StructureWorldAccess world, BlockPos pos) {
protected BlockPos getCenterGround(WorldGenLevel world, BlockPos pos) {
POS.setX(pos.getX());
POS.setZ(pos.getZ());
POS.setY(0);
return getGround(world, POS).toImmutable();
return getGround(world, POS).immutable();
}
@Override
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
float radius) {
public boolean canGenerate(WorldGenLevel world, Random random, BlockPos center, BlockPos blockPos, float radius) {
return world.getBlockState(blockPos).is(Blocks.WATER);
}
@Override
protected boolean canSpawn(StructureWorldAccess world, BlockPos pos) {
protected boolean canSpawn(WorldGenLevel world, BlockPos pos) {
return world.getBlockState(pos).is(Blocks.WATER);
}
@Override
protected boolean getGroundPlant(StructureWorldAccess world, MutableBlockPos pos) {
protected boolean getGroundPlant(WorldGenLevel world, MutableBlockPos pos) {
return getGround(world, pos).getY() < 128;
}
@ -48,7 +47,7 @@ public abstract class UnderwaterPlantScatter extends ScatterFeature {
return 5;
}
private BlockPos getGround(StructureWorldAccess world, MutableBlockPos pos) {
private BlockPos getGround(WorldGenLevel world, MutableBlockPos pos) {
while (pos.getY() < 128 && world.getFluidState(pos).isEmpty()) {
pos.setY(pos.getY() + 1);
}