}
if(getEnergy() >= ENERGY_USAGE && MekanismUtils.canFunction(this) && isValidGas(gasTank.getGas()) && (fluidTank.getFluid() == null || (fluidTank.getFluid().amount < MAX_FLUID && gasEquals(gasTank.getGas(), fluidTank.getFluid()))))
{
setActive(true);
fluidTank.fill(new FluidStack(gasTank.getGas().getGas().getFluid(), 1), true);
gasTank.draw(1, true);
setEnergy(getEnergy() - ENERGY_USAGE);
}
else {
if(prevEnergy >= getEnergy())
{
setActive(false);
}
}
}
else if(mode == 1)
{
if(inventory[0] != null && gasTank.getGas() != null)
{
gasTank.draw(GasTransmission.addGas(inventory[0], gasTank.getGas()), true);
}
if(gasTank.getGas() != null)
{
GasStack toSend = new GasStack(gasTank.getGas().getGas(), Math.min(gasTank.getGas().amount, gasOutput));
TileEntity tileEntity = Coord4D.get(this).getFromSide(MekanismUtils.getLeft(facing)).getTileEntity(worldObj);
if(tileEntity instanceof IGasHandler)
{
if(((IGasHandler)tileEntity).canReceiveGas(MekanismUtils.getLeft(facing).getOpposite(), gasTank.getGas().getGas()))
{
gasTank.draw(((IGasHandler)tileEntity).receiveGas(MekanismUtils.getLeft(facing).getOpposite(), toSend), true);
}
}
}
if(inventory[2] != null)
{
if(inventory[2].getItem() instanceof IFluidContainerItem)
{
fluidTank.fill(FluidContainerUtils.extractFluid(fluidTank, inventory[2]), true);
if(((IFluidContainerItem)inventory[2].getItem()).getFluid(inventory[2]) == null || fluidTank.getFluidAmount() == fluidTank.getCapacity())
{
if(inventory[3] == null)
{
inventory[3] = inventory[2].copy();
inventory[2] = null;
markDirty();
}
}
}
else if(FluidContainerRegistry.isFilledContainer(inventory[2]))
{
FluidStack itemFluid = FluidContainerRegistry.getFluidForFilledItem(inventory[2]);
if((fluidTank.getFluid() == null && itemFluid.amount <= MAX_FLUID) || fluidTank.getFluid().amount+itemFluid.amount <= MAX_FLUID)
{
if(fluidTank.getFluid() != null && !fluidTank.getFluid().isFluidEqual(itemFluid))
{