List of usage examples for net.minecraftforge.fluids IFluidBlock drain
@Nonnull FluidStack drain(World world, BlockPos pos, IFluidHandler.FluidAction action);
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 a 2 s . c o m 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; } }