List of usage examples for net.minecraftforge.fluids IFluidBlock canDrain
boolean canDrain(World world, BlockPos pos);
From source file:buildcraft.lib.misc.BlockUtil.java
License:Minecraft Mod Public
public static FluidStack drainBlock(IBlockState state, World world, BlockPos pos, boolean doDrain) { Block block = state.getBlock();//from ww w . ja v a2s .com Fluid fluid = getFluidWithFlowing(block); if (fluid != null && FluidRegistry.isFluidRegistered(fluid)) { if (block instanceof IFluidBlock) { IFluidBlock fluidBlock = (IFluidBlock) block; if (!fluidBlock.canDrain(world, pos)) { return null; } return fluidBlock.drain(world, pos, doDrain); } else { // FIXME: this should probably check the level... int level = state.getValue(BlockLiquid.LEVEL); // if (level != 0) { // return null; // } if (doDrain) { world.setBlockToAir(pos); } return new FluidStack(fluid, 1000); } } else { return null; } }