Continue mapping migration
This commit is contained in:
parent
99ade39404
commit
f03fd03bd0
499 changed files with 12567 additions and 12723 deletions
|
@ -1,10 +1,9 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.basis.UnderwaterPlantWithAgeBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -14,24 +13,21 @@ public class EndLilySeedBlock extends UnderwaterPlantWithAgeBlock {
|
|||
@Override
|
||||
public void grow(WorldGenLevel world, Random random, BlockPos pos) {
|
||||
if (canGrow(world, pos)) {
|
||||
BlocksHelper.setWithoutUpdate(world, pos,
|
||||
EndBlocks.END_LILY.defaultBlockState().with(EndLilyBlock.SHAPE, TripleShape.BOTTOM));
|
||||
BlockPos up = pos.up();
|
||||
while (world.getFluidState(up).isStill()) {
|
||||
BlocksHelper.setWithoutUpdate(world, up,
|
||||
EndBlocks.END_LILY.defaultBlockState().with(EndLilyBlock.SHAPE, TripleShape.MIDDLE));
|
||||
up = up.up();
|
||||
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.END_LILY.defaultBlockState().setValue(EndLilyBlock.SHAPE, TripleShape.BOTTOM));
|
||||
BlockPos up = pos.above();
|
||||
while (world.getFluidState(up).isSource()) {
|
||||
BlocksHelper.setWithoutUpdate(world, up, EndBlocks.END_LILY.defaultBlockState().setValue(EndLilyBlock.SHAPE, TripleShape.MIDDLE));
|
||||
up = up.above();
|
||||
}
|
||||
BlocksHelper.setWithoutUpdate(world, up,
|
||||
EndBlocks.END_LILY.defaultBlockState().with(EndLilyBlock.SHAPE, TripleShape.TOP));
|
||||
BlocksHelper.setWithoutUpdate(world, up, EndBlocks.END_LILY.defaultBlockState().setValue(EndLilyBlock.SHAPE, TripleShape.TOP));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean canGrow(WorldGenLevel world, BlockPos pos) {
|
||||
BlockPos up = pos.up();
|
||||
while (world.getBlockState(up).getFluidState().getFluid().equals(Fluids.WATER.getStill())) {
|
||||
up = up.up();
|
||||
BlockPos up = pos.above();
|
||||
while (world.getBlockState(up).getFluidState().getType().equals(Fluids.WATER.getSource())) {
|
||||
up = up.above();
|
||||
}
|
||||
return world.isAir(up);
|
||||
return world.isEmptyBlock(up);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue