{
int ret = 0;
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te instanceof TileEntityFactoryInventory)
{
TileEntityFactoryInventory inv = (TileEntityFactoryInventory)te;
ILiquidTank tank = inv.getTank();
float tankPercent = 0, invPercent = 0;
boolean hasTank = false, hasInventory = false;
if (tank != null)
{
hasTank = true;
if (tank.getLiquid() != null)
{
tankPercent = ((float)tank.getLiquid().amount) / tank.getCapacity();
}
}
int[] accSlots = inv.getAccessibleSlotsFromSide(side);
if (accSlots.length > 0)
{
hasInventory = true;
invPercent = inv.getComparatorOutput(side);
}
float mult = hasTank & hasInventory ? (tankPercent + invPercent) / 2 : hasTank ? tankPercent : hasInventory ? invPercent : 0f;
ret = (int)Math.ceil(15 * mult);
}
return ret;