package client.gui.container;

import client.Client;
import client.gui.element.Label;
import common.inventory.ContainerTile;
import common.inventory.IInventory;
import common.inventory.InventoryPlayer;
import common.tileentity.TileEntityDevice;

public class GuiTile extends GuiContainer {
	private final IInventory playerInv;
	private final IInventory tileInv;
	private final TileEntityDevice tile;

	private Label header;
	private Label temp;
	private Label desc;

	public GuiTile(InventoryPlayer player, IInventory inv, TileEntityDevice tile) {
		super(new ContainerTile(player, tile, inv, Client.CLIENT.player));
		this.playerInv = player;
		this.tileInv = tile;
		this.ySize = 153;
		this.tile = tile;
	}

	public void updateScreen() {
		super.updateScreen();
		this.header.setText(this.tile.getStatus().color + this.tileInv.getCommandName() + " - " + this.tile.getStatus().name);
		this.temp.setText(String.format("Temperatur: %d °", this.tile.getTemperature()));
		this.desc.setText(this.tile.formatDisplay((ContainerTile)this.inventorySlots));
	}

	public void addElements() {
		this.header = this.label("", 8, 6);
		this.label(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
		this.temp = this.label("", 8, 18);
		this.desc = this.label("", 8, 28);
	}
}
