Search in sources :

Example 1 with PlantBlock

use of net.minecraft.block.PlantBlock in project BleachHack by BleachDrinker420.

the class WorldUtils method getTopBlockIgnoreLeaves.

public static int getTopBlockIgnoreLeaves(int x, int z) {
    int top = mc.world.getTopY(Heightmap.Type.WORLD_SURFACE, x, z) - 1;
    while (top > mc.world.getBottomY()) {
        BlockState state = mc.world.getBlockState(new BlockPos(x, top, z));
        if (!(state.isAir() || state.getBlock() instanceof LeavesBlock || state.getBlock() instanceof PlantBlock)) {
            break;
        }
        top--;
    }
    return top;
}
Also used : BlockState(net.minecraft.block.BlockState) BlockPos(net.minecraft.util.math.BlockPos) PlantBlock(net.minecraft.block.PlantBlock) LeavesBlock(net.minecraft.block.LeavesBlock)

Aggregations

BlockState (net.minecraft.block.BlockState)1 LeavesBlock (net.minecraft.block.LeavesBlock)1 PlantBlock (net.minecraft.block.PlantBlock)1 BlockPos (net.minecraft.util.math.BlockPos)1