Mekanism-tilera-Edition/common/mekanism/generators/client/gui/GuiHydrogenGenerator.java

80 lines
3.1 KiB
Java
Raw Normal View History

package mekanism.generators.client.gui;
2014-04-07 01:50:34 +02:00
import java.util.List;
import mekanism.api.ListUtils;
import mekanism.api.gas.GasTank;
2014-04-07 01:50:34 +02:00
import mekanism.client.gui.GuiEnergyInfo;
import mekanism.client.gui.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.GuiGasGauge;
import mekanism.client.gui.GuiGasGauge.IGasInfoHandler;
2014-04-08 01:00:53 +02:00
import mekanism.client.gui.GuiGauge.Type;
import mekanism.client.gui.GuiMekanism;
2014-04-07 04:28:05 +02:00
import mekanism.client.gui.GuiPowerBar;
import mekanism.client.gui.GuiRedstoneControl;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.generators.common.inventory.container.ContainerHydrogenGenerator;
import mekanism.generators.common.tile.TileEntityHydrogenGenerator;
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 GuiHydrogenGenerator extends GuiMekanism
{
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
public TileEntityHydrogenGenerator tileEntity;
v5 Beta #9 *Bumped animation textures to 32x32. *Added default parameter to TabProxy.tabMekanism(). *Added additional info to Machine/GeneratorType for better handling of metadata. *Added Reinforced Iron, a stronger version of an Iron Block. *Updated onBlockActivated() code to function correctly. *Added feature for a generator or power unit to be placed facing up or down. *Cleaned up GUI access/handler code. *Fixed electric machine shift-click bug. *Added Diamond Dust. *Fixed Energized Bow continuing to fire after it's energy is depleted. *Added HP information to armor and tools. *Fixed slot parameters. *Overhauled packet system. *Cleaned up tile entity hierarchy. *Added BuildCraft liquid support to Heat Generator to allow energy generation with both BuildCraft's fuel buckets and liquid fuel. *Fixed texture preloads. *Added Electolytic Separator -- a machine that separates hydrogen and oxygen molecules from water. It accepts water from BuildCraft pipes. *Added Hydrogen Generator -- a generator that by default generates 128 u/t, but has boosts by the block's height of up to 512 u/t. *Added Solar Generator, a generator that produces 32 u/t when it can see the sun. *Added Gas API! Simple gas management that allows for both storage of gas in items, blocks, and transfer between themselves. So far implemented gasses are oxygen and hydrogen. *Added LiquidSlot for easy management of liquid in tile entities. *Added Hydrogen Tank and Oxygen Tank items. *Added BuildCraft hooks. *Fixed zombies and skeletons spawning with Obsidian Armor, and lowered chances of spawning with any armor. *More OreDictionary registrations to fix IC2's different dust names. *Fixed some javadocs. *Added 'Solar Panel' item as a crafting element for a Solar Generator. *Minor bugfixes.
2012-11-15 21:04:12 +01:00
public GuiHydrogenGenerator(InventoryPlayer inventory, TileEntityHydrogenGenerator tentity)
{
super(new ContainerHydrogenGenerator(inventory, tentity));
tileEntity = tentity;
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png")));
2014-04-07 01:50:34 +02:00
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
{
2014-04-07 04:28:05 +02:00
return ListUtils.asList(
"Producing: " + MekanismUtils.getEnergyDisplay(tileEntity.generationRate) + "/t",
"Storing: " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()),
2014-04-08 01:00:53 +02:00
"Max Output: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t");
2014-04-07 01:50:34 +02:00
}
}, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png")));
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
@Override
public GasTank getTank()
{
return tileEntity.fuelTank;
}
2014-04-07 04:28:05 +02:00
}, Type.WIDE, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png"), 55, 18));
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png"), 164, 15));
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
fontRenderer.drawString(tileEntity.getInvName(), 45, 6, 0x404040);
fontRenderer.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
{
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.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);
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}
}