package storagecraft.gui;

import net.minecraft.inventory.Container;
import storagecraft.gui.sidebutton.SideButtonRedstoneMode;
import storagecraft.tile.TileWirelessTransmitter;

public class GuiWirelessTransmitter extends GuiBase
{
	private TileWirelessTransmitter wirelessTransmitter;

	public GuiWirelessTransmitter(Container container, TileWirelessTransmitter wirelessTransmitter)
	{
		super(container, 176, 137);

		this.wirelessTransmitter = wirelessTransmitter;
	}

	@Override
	public void init(int x, int y)
	{
		addSideButton(new SideButtonRedstoneMode(wirelessTransmitter));
	}

	@Override
	public void update(int x, int y)
	{
	}

	@Override
	public void drawBackground(int x, int y, int mouseX, int mouseY)
	{
		bindTexture("gui/wireless_transmitter.png");

		drawTexture(x, y, 0, 0, xSize, ySize);

		if (wirelessTransmitter.isWorking())
		{
			int progress = (int) ((float) wirelessTransmitter.getProgress() / (float) TileWirelessTransmitter.TOTAL_PROGRESS * 14f);

			drawTexture(x + 36 - 1, y + 21 - 1 + progress, 178, 0 + progress, 14, 14);
		}
	}

	@Override
	public void drawForeground(int mouseX, int mouseY)
	{
		drawString(7, 7, t("gui.storagecraft:wireless_transmitter"));
		drawString(7, 43, t("container.inventory"));
	}
}

@@ -1278,20 +1278,348 @@
 ventory%22));%0D
+%0A%0D%0A%09%09if (inBounds(36, 21, 14, 14, mouseX, mouseY) && wirelessTransmitter.isWorking())%0D%0A%09%09%7B%0D%0A%09%09%09int workRemaining = (int) (((float) (TileWirelessTransmitter.TOTAL_PROGRESS - wirelessTransmitter.getProgress())) / (float) TileWirelessTransmitter.TOTAL_PROGRESS * 100f);%0D%0A%0D%0A%09%09%09drawTooltip(mouseX, mouseY, workRemaining + %22%25%22);%0D%0A%09%09%7D%0D
 %0A%09%7D%0D%0A%7D%0D%0A

add work remaining to wireless transmitter