package electricexpansion.client.gui;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import universalelectricity.core.electricity.ElectricityDisplay;
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electricexpansion.client.misc.TextureLocations;
import electricexpansion.common.containers.ContainerWireMill;
import electricexpansion.common.tile.TileEntityWireMill;
@SideOnly(Side.CLIENT)
public class GuiWireMill extends GuiContainer
{
private TileEntityWireMill tileEntity;
private int containerWidth;
private int containerHeight;
public GuiWireMill(InventoryPlayer par1InventoryPlayer, TileEntityWireMill tileEntity)
{
super(new ContainerWireMill(par1InventoryPlayer, tileEntity));
this.tileEntity = tileEntity;
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of
* the items)
*/
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRenderer.drawString("Wire Mill", 60, 6, 4210752);
String displayText = "";
if (this.tileEntity.getTimeRemaining() > 0)
{
displayText = "Working";
}
else
{
displayText = "Idle";
}
this.fontRenderer.drawString("Status: " + displayText, 82, 45, 4210752);
this.fontRenderer.drawString("Voltage: " + ElectricityDisplay.getDisplayShort(this.tileEntity.getVoltage(), ElectricUnit.VOLTAGE), 82, 56, 4210752);
this.fontRenderer.drawString("Require: " + ElectricityDisplay.getDisplayShort(TileEntityWireMill.WATTS_PER_TICK * 20, ElectricUnit.WATT), 82, 68, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
/**
* Draw the background layer for the GuiContainer (everything behind the
* items)
*/
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(TextureLocations.GUI_MACHINE);
this.containerWidth = (this.width - this.xSize) / 2;
this.containerHeight = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, this.xSize, this.ySize);
if (this.tileEntity.getTimeRemaining() > 0)
{
int scale = (int) ((double) this.tileEntity.getTimeRemaining() / this.tileEntity.getProcessTime() * 23);
this.drawTexturedModalRect(this.containerWidth + 77, this.containerHeight + 27, 176, 0, 23 - scale, 13);
}
if (this.tileEntity.getEnergyStored() >= 0)
{
int scale = (int) (this.tileEntity.getEnergyStored() / this.tileEntity.getEnergyStored() * 50);
this.drawTexturedModalRect(this.containerWidth + 35, this.containerHeight + 20, 176, 13, 4, 50 - scale);
}
}
}