Block class rename
This commit is contained in:
parent
4b55bf30a8
commit
5f3547de8e
157 changed files with 748 additions and 756 deletions
34
src/main/java/ru/betterend/blocks/EndLilySeedBlock.java
Normal file
34
src/main/java/ru/betterend/blocks/EndLilySeedBlock.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.basis.UnderwaterPlantWithAgeBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
public class EndLilySeedBlock extends UnderwaterPlantWithAgeBlock {
|
||||
@Override
|
||||
public void grow(StructureWorldAccess world, Random random, BlockPos pos) {
|
||||
if (canGrow(world, pos)) {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.END_LILY.getDefaultState().with(EndLilyBlock.SHAPE, TripleShape.BOTTOM));
|
||||
BlockPos up = pos.up();
|
||||
while (world.getFluidState(up).isStill()) {
|
||||
BlocksHelper.setWithoutUpdate(world, up, EndBlocks.END_LILY.getDefaultState().with(EndLilyBlock.SHAPE, TripleShape.MIDDLE));
|
||||
up = up.up();
|
||||
}
|
||||
BlocksHelper.setWithoutUpdate(world, up, EndBlocks.END_LILY.getDefaultState().with(EndLilyBlock.SHAPE, TripleShape.TOP));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canGrow(StructureWorldAccess world, BlockPos pos) {
|
||||
BlockPos up = pos.up();
|
||||
while (world.getBlockState(up).getFluidState().getFluid().equals(Fluids.WATER.getStill())) {
|
||||
up = up.up();
|
||||
}
|
||||
return world.isAir(up);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue