2013-08-27 00:49:32 +02:00
|
|
|
package mekanism.client.gui;
|
2012-11-21 16:14:35 +01:00
|
|
|
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.common.inventory.container.ContainerGasTank;
|
|
|
|
import mekanism.common.tileentity.TileEntityGasTank;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.common.util.MekanismUtils;
|
|
|
|
import mekanism.common.util.MekanismUtils.ResourceType;
|
2012-12-20 22:53:39 +01:00
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
|
|
import net.minecraft.util.StatCollector;
|
|
|
|
|
|
|
|
import org.lwjgl.opengl.GL11;
|
2012-11-21 16:14:35 +01:00
|
|
|
|
2013-04-13 16:33:37 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2013-08-27 00:28:55 +02:00
|
|
|
public class GuiGasTank extends GuiMekanism
|
2012-11-21 16:14:35 +01:00
|
|
|
{
|
2013-08-02 09:16:38 +02:00
|
|
|
public TileEntityGasTank tileEntity;
|
2012-11-21 16:14:35 +01:00
|
|
|
|
|
|
|
public GuiGasTank(InventoryPlayer inventory, TileEntityGasTank tentity)
|
|
|
|
{
|
|
|
|
super(new ContainerGasTank(inventory, tentity));
|
|
|
|
tileEntity = tentity;
|
2013-08-27 00:28:55 +02:00
|
|
|
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiGasTank.png")));
|
2012-11-21 16:14:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-08-02 09:16:38 +02:00
|
|
|
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
2012-11-21 16:14:35 +01:00
|
|
|
{
|
2013-08-27 00:28:55 +02:00
|
|
|
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
|
|
|
|
2013-08-02 09:16:38 +02:00
|
|
|
int xAxis = (mouseX - (width - xSize) / 2);
|
|
|
|
int yAxis = (mouseY - (height - ySize) / 2);
|
|
|
|
|
2012-11-21 16:14:35 +01:00
|
|
|
String capacityInfo = tileEntity.gasStored + "/" + tileEntity.MAX_GAS;
|
2013-08-02 09:16:38 +02:00
|
|
|
|
2012-11-21 16:14:35 +01:00
|
|
|
fontRenderer.drawString("Gas Tank", 43, 6, 0x404040);
|
|
|
|
fontRenderer.drawString(capacityInfo, 45, 40, 0x404040);
|
|
|
|
fontRenderer.drawString("Gas: " + tileEntity.gasType.name, 45, 49, 0x404040);
|
|
|
|
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-10-25 06:23:38 +02:00
|
|
|
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
2012-11-21 16:14:35 +01:00
|
|
|
{
|
2013-10-25 06:23:38 +02:00
|
|
|
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
2013-08-27 00:28:55 +02:00
|
|
|
|
2013-09-28 03:59:47 +02:00
|
|
|
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiGasTank.png"));
|
2012-11-21 16:14:35 +01:00
|
|
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
2013-08-02 09:16:38 +02:00
|
|
|
int guiWidth = (width - xSize) / 2;
|
|
|
|
int guiHeight = (height - ySize) / 2;
|
2012-11-21 16:14:35 +01:00
|
|
|
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
2013-08-02 09:16:38 +02:00
|
|
|
|
2013-08-27 00:28:55 +02:00
|
|
|
int xAxis = mouseX - guiWidth;
|
|
|
|
int yAxis = mouseY - guiHeight;
|
2013-08-02 09:16:38 +02:00
|
|
|
|
2012-11-21 16:14:35 +01:00
|
|
|
int scale = (int)(((double)tileEntity.gasStored / tileEntity.MAX_GAS) * 72);
|
|
|
|
drawTexturedModalRect(guiWidth + 65, guiHeight + 17, 176, 0, scale, 20);
|
|
|
|
}
|
|
|
|
}
|