if (drainable != null && drainable.amount > 0)
{
List<Fluid> fluidFilter = getFilterFluids(inventory.slots);
IAEItemStack toImport = Util.createItemStack(new ItemStack(FLUIDDISPLAY.getItemInstance(), drainable.amount, drainable.fluidID));
IMEInventoryHandler cellArray = getGrid().getCellArray();
if (cellArray != null)
{
IAEItemStack notImported = cellArray.calculateItemAddition(toImport.copy());
if (fluidFilter != null && !fluidFilter.isEmpty() && fluidFilter.size() > 0)
{
if (fluidFilter.contains(drainable.getFluid()))
{
if (notImported == null && grid.useMEEnergy(modeCost, "Import Fluid"))
{
FluidStack drained = fluidHandler.drain(facing.getOpposite(), (int) toImport.getStackSize(), true);
if (drained != null)
cellArray.addItems(toImport.copy());
}
}
} else
{
if (notImported == null && grid.useMEEnergy(modeCost, "Import Fluid"))
{
FluidStack drained = fluidHandler.drain(facing.getOpposite(), (int) toImport.getStackSize(), true);
if (drained != null)
cellArray.addItems(toImport.copy());
}
}
}
}
}