| package mekanism.client.gui; |
| |
| import java.util.List; |
| |
| import mekanism.api.ListUtils; |
| import mekanism.api.gas.GasTank; |
| import mekanism.client.gui.GuiEnergyInfo.IInfoHandler; |
| import mekanism.client.gui.GuiGasGauge.IGasInfoHandler; |
| import mekanism.client.gui.GuiProgress.IProgressInfoHandler; |
| import mekanism.client.gui.GuiProgress.ProgressBar; |
| import mekanism.client.gui.GuiSlot.SlotOverlay; |
| import mekanism.client.gui.GuiSlot.SlotType; |
| import mekanism.common.inventory.container.ContainerChemicalOxidizer; |
| import mekanism.common.tile.TileEntityChemicalOxidizer; |
| import mekanism.common.util.MekanismUtils; |
| import mekanism.common.util.MekanismUtils.ResourceType; |
| import net.minecraft.entity.player.InventoryPlayer; |
| |
| import org.lwjgl.opengl.GL11; |
| |
| import cpw.mods.fml.relauncher.Side; |
| import cpw.mods.fml.relauncher.SideOnly; |
| |
| @SideOnly(Side.CLIENT) |
| public class GuiChemicalOxidizer extends GuiMekanism |
| { |
| public TileEntityChemicalOxidizer tileEntity; |
| |
| public GuiChemicalOxidizer(InventoryPlayer inventory, TileEntityChemicalOxidizer tentity) |
| { |
| super(tentity, new ContainerChemicalOxidizer(inventory, tentity)); |
| tileEntity = tentity; |
| |
| guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"))); |
| guiElements.add(new GuiUpgradeManagement(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"))); |
| guiElements.add(new GuiEnergyInfo(new IInfoHandler() { |
| @Override |
| public List<String> getInfo() |
| { |
| String multiplier = MekanismUtils.getEnergyDisplay(MekanismUtils.getEnergyPerTick(tileEntity, tileEntity.ENERGY_USAGE)); |
| return ListUtils.asList("Using: " + multiplier + "/t", "Needed: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy())); |
| } |
| }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"))); |
| guiElements.add(new GuiGasGauge(new IGasInfoHandler() { |
| @Override |
| public GasTank getTank() |
| { |
| return tileEntity.gasTank; |
| } |
| }, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 133, 13)); |
| |
| guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 154, 4).with(SlotOverlay.POWER)); |
| guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 25, 35)); |
| guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 154, 24).with(SlotOverlay.PLUS)); |
| |
| guiElements.add(new GuiProgress(new IProgressInfoHandler() |
| { |
| @Override |
| public double getProgress() |
| { |
| return tileEntity.getScaledProgress(); |
| } |
| }, ProgressBar.LARGE_RIGHT, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 62, 39)); |
| } |
| |
| @Override |
| protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) |
| { |
| int xAxis = (mouseX - (width - xSize) / 2); |
| int yAxis = (mouseY - (height - ySize) / 2); |
| |
| fontRendererObj.drawString(tileEntity.getInventoryName(), 45, 6, 0x404040); |
| fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040); |
| |
| super.drawGuiContainerForegroundLayer(mouseX, mouseY); |
| } |
| |
| @Override |
| protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) |
| { |
| mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png")); |
| GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); |
| int guiWidth = (width - xSize) / 2; |
| int guiHeight = (height - ySize) / 2; |
| drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize); |
| |
| int xAxis = mouseX - guiWidth; |
| int yAxis = mouseY - guiHeight; |
| |
| int displayInt; |
| |
| displayInt = tileEntity.getScaledProgress(48); |
| drawTexturedModalRect(guiWidth + 64, guiHeight + 40, 176, 63, displayInt + 1, 8); |
| |
| super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); |
| } |
| } |