}
@Override
public IAEItemStack addItems(IAEItemStack input)
{
IAEItemStack addedStack = input.copy();
if (input.getItem() == fluidItem && (!isPreformatted() || (isPreformatted() && isItemInPreformattedItems(input.getItemStack()))))
{
for (int i = 0; i < totalTypes; i++)
{
FluidStack currentStack = cachedInventory.get(i);
if (currentStack != null && currentStack.fluidID == input.getItemDamage())
{
if (input.getStackSize() <= freeBytes())
{
writeFluidStackToSlot(i, new FluidStack(input.getItemDamage(), currentStack.amount + (int) input.getStackSize()));
addedStack = null;
} else
{
writeFluidStackToSlot(i, new FluidStack(input.getItemDamage(), currentStack.amount + (int) freeBytes()));
addedStack.setStackSize(input.getStackSize() - freeBytes());
}
return addedStack;
}
}
for (int i = 0; i < totalTypes; i++)
{
FluidStack currentStack = cachedInventory.get(i);
if (currentStack == null)
{
if (input.getStackSize() <= freeBytes())
{
writeFluidStackToSlot(i, new FluidStack(input.getItemDamage(), (int) input.getStackSize()));
addedStack = null;
} else
{
writeFluidStackToSlot(i, new FluidStack(input.getItemDamage(), (int) freeBytes()));
addedStack.setStackSize(input.getStackSize() - freeBytes());
}
return addedStack;
}
}
}