public int getComparatorOutput(int side)
	{
		IFluidTank[] tanks = getTanks();
		IFluidTank tank = null;
		if (tanks.length > 0)
			tank = tanks[0];
		float tankPercent = 0, invPercent = 0;
		boolean hasTank = false, hasInventory = false;
		if (tank != null)
		{
			hasTank = true;
			if (tank.getFluid() != null)
			{
				tankPercent = ((float)tank.getFluid().amount) / tank.getCapacity();
			}
		}
		int[] accSlots = getAccessibleSlotsFromSide(side);
		if (accSlots.length > 0)
		{
			hasInventory = true;
			int[] slots = accSlots;
			int len = 0;
			float ret = 0;
			for (int i = slots.length; i --> 0; )
			{
				if (canInsertItem(slots[i], null, side))
				{
					ItemStack stack = getStackInSlot(slots[i]);
					if (stack != null)
					{
						float maxStack = Math.min(stack.getMaxStackSize(), getInventoryStackLimit()); 
						ret += Math.max(Math.min(stack.stackSize / maxStack, 1), 0);
					}
					++len;
				}
			}
			invPercent = ret / len;
		}
		float mult = hasTank & hasInventory ? (tankPercent + invPercent) / 2 : hasTank ? tankPercent : hasInventory ? invPercent : 0f;
		return (int)Math.ceil(15 * mult);
	}
 public void drawFluidTank(IFluidTank tank, int x, int y) {
   FluidStack fluid = tank.getFluid();
   TextureManager manager = Minecraft.getMinecraft().renderEngine;
   if (fluid != null) {
     manager.bindTexture(manager.getResourceLocation(0));
     float amount = fluid.amount;
     float capacity = tank.getCapacity();
     float scale = amount / capacity;
     int fluidTankHeight = 60;
     int fluidAmount = (int) (scale * fluidTankHeight);
     drawFluid(
         x, y + fluidTankHeight - fluidAmount, fluid.getFluid().getIcon(fluid), 16, fluidAmount);
     manager.bindTexture(PymParticleProducerGuiTextures);
     drawTexturedModalRect(x - 1, y - 1, 238, 0, 18, 62);
   }
 }
  /**
   * Returns true if the given fluid can be extracted from the given direction.
   *
   * <p>More formally, this should return true if fluid is able to leave from the given direction.
   */
  public boolean canDrain(ForgeDirection from, Fluid fluid) {
    int tankIdx = 0;
    if (from != ForgeDirection.UNKNOWN) {
      tankIdx = getExposedTankFromSide(from.ordinal());
    }

    if (tankIdx == FLUIDTANK_NONE) {
      return false;
    }

    IFluidTank tank = tanks[tankIdx];
    if (tank.getFluidAmount() <= 0) {
      return false;
    } else {
      return tank.getFluid().fluidID == fluid.getID();
    }
  }