if(tank.isFull()) {
return false;
}
IFluidHandler extTank = getTankContainer(advancedLiquidConduit, dir);
if(extTank != null) {
int maxExtract = Math.min(maxExtractPerTick, tank.getAvailableSpace());
if(liquidType == null || !tank.containsValidLiquid()) {
FluidStack drained = extTank.drain(dir.getOpposite(), maxExtract, true);
if(drained == null || drained.amount <= 0) {
return false;
}
setFluidType(drained);
tank.setLiquid(drained.copy());
return true;
}
FluidStack couldDrain = liquidType.copy();
couldDrain.amount = maxExtract;
boolean foundFluid = false;
FluidTankInfo[] info = extTank.getTankInfo(dir.getOpposite());
if(info != null) {
for (FluidTankInfo inf : info) {
if(inf != null && inf.fluid != null && inf.fluid.amount > 0) {
foundFluid = true;
}
}
}
if(!foundFluid) {
return false;
}
// FluidStack drained = extTank.drain(dir.getOpposite(), couldDrain, true);
// if(drained == null || drained.amount <= 0) {
// return false;
// }
// tank.addAmount(drained.amount);
//Have to use this 'double handle' approach to work around an issue with TiC
FluidStack drained = extTank.drain(dir.getOpposite(), maxExtract, false);
if(drained == null || drained.amount == 0) {
return false;
} else {
if(drained.isFluidEqual(getFluidType())) {
drained = extTank.drain(dir.getOpposite(), maxExtract, true);
tank.addAmount(drained.amount);
}
}
return true;
}