Start migration

This commit is contained in:
Aleksey 2021-04-08 21:55:07 +03:00
parent 6630ce0cab
commit 47ed597358
491 changed files with 12045 additions and 11953 deletions

View file

@ -2,18 +2,18 @@ package ru.betterend.world.features;
import java.util.Random;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.world.StructureWorldAccess;
public abstract class UnderwaterPlantScatter extends ScatterFeature {
private static final Mutable POS = new Mutable();
private static final MutableBlockPos POS = new MutableBlockPos();
public UnderwaterPlantScatter(int radius) {
super(radius);
}
@Override
protected BlockPos getCenterGround(StructureWorldAccess world, BlockPos pos) {
POS.setX(pos.getX());
@ -21,33 +21,34 @@ public abstract class UnderwaterPlantScatter extends ScatterFeature {
POS.setY(0);
return getGround(world, POS).toImmutable();
}
@Override
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos, float radius) {
return world.getBlockState(blockPos).isOf(Blocks.WATER);
public boolean canGenerate(StructureWorldAccess world, Random random, BlockPos center, BlockPos blockPos,
float radius) {
return world.getBlockState(blockPos).is(Blocks.WATER);
}
@Override
protected boolean canSpawn(StructureWorldAccess world, BlockPos pos) {
return world.getBlockState(pos).isOf(Blocks.WATER);
return world.getBlockState(pos).is(Blocks.WATER);
}
@Override
protected boolean getGroundPlant(StructureWorldAccess world, Mutable pos) {
protected boolean getGroundPlant(StructureWorldAccess world, MutableBlockPos pos) {
return getGround(world, pos).getY() < 128;
}
@Override
protected int getYOffset() {
return -5;
}
@Override
protected int getChance() {
return 5;
}
private BlockPos getGround(StructureWorldAccess world, Mutable pos) {
private BlockPos getGround(StructureWorldAccess world, MutableBlockPos pos) {
while (pos.getY() < 128 && world.getFluidState(pos).isEmpty()) {
pos.setY(pos.getY() + 1);
}