2012-10-02 20:39:40 +02:00
|
|
|
package net.uberkat.obsidian.client;
|
|
|
|
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
|
|
|
import net.minecraft.src.*;
|
|
|
|
import net.uberkat.obsidian.common.ContainerPowerUnit;
|
|
|
|
import net.uberkat.obsidian.common.ObsidianUtils;
|
|
|
|
import net.uberkat.obsidian.common.TileEntityPowerUnit;
|
|
|
|
|
|
|
|
public class GuiPowerUnit extends GuiContainer
|
|
|
|
{
|
|
|
|
private TileEntityPowerUnit tileEntity;
|
|
|
|
|
|
|
|
private int guiWidth;
|
|
|
|
private int guiHeight;
|
|
|
|
|
2012-10-03 21:12:17 +02:00
|
|
|
public GuiPowerUnit(InventoryPlayer inventory, TileEntityPowerUnit tentity)
|
2012-10-02 20:39:40 +02:00
|
|
|
{
|
2012-10-03 21:12:17 +02:00
|
|
|
super(new ContainerPowerUnit(inventory, tentity));
|
|
|
|
tileEntity = tentity;
|
2012-10-02 20:39:40 +02:00
|
|
|
}
|
|
|
|
|
2012-10-28 23:18:23 +01:00
|
|
|
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
2012-10-02 20:39:40 +02:00
|
|
|
{
|
2012-10-30 02:13:40 +01:00
|
|
|
String capacityInfo = ObsidianUtils.getDisplayedEnergyNoColor(tileEntity.energyStored) + "/" + ObsidianUtils.getDisplayedEnergyNoColor(tileEntity.MAX_ENERGY);
|
|
|
|
String outputInfo = "Out: " + ObsidianUtils.getDisplayedEnergyNoColor(tileEntity.output) + "/t";
|
2012-10-02 20:39:40 +02:00
|
|
|
fontRenderer.drawString(tileEntity.getInvName(), 43, 6, 0x404040);
|
2012-10-30 02:13:40 +01:00
|
|
|
fontRenderer.drawString(capacityInfo, 45, 40, 0x404040);
|
|
|
|
fontRenderer.drawString(outputInfo, 45, 49, 0x404040);
|
2012-10-02 20:39:40 +02:00
|
|
|
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
|
|
|
|
{
|
2012-10-23 15:23:23 +02:00
|
|
|
int texture = mc.renderEngine.getTexture("/gui/GuiPowerUnit.png");
|
2012-10-02 20:39:40 +02:00
|
|
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
2012-10-23 15:23:23 +02:00
|
|
|
mc.renderEngine.bindTexture(texture);
|
2012-10-02 20:39:40 +02:00
|
|
|
|
|
|
|
guiWidth = (width - xSize) / 2;
|
|
|
|
guiHeight = (height - ySize) / 2;
|
|
|
|
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
2012-10-28 23:18:23 +01:00
|
|
|
int scale = (int)(((double)tileEntity.energyStored / tileEntity.MAX_ENERGY) * 72);
|
2012-10-02 20:39:40 +02:00
|
|
|
drawTexturedModalRect(guiWidth + 65, guiHeight + 17, 176, 0, scale, 20);
|
|
|
|
}
|
|
|
|
}
|