2014-01-03 03:09:21 +01:00
|
|
|
package mekanism.client.gui;
|
2012-10-28 23:18:23 +01:00
|
|
|
|
2014-01-10 23:42:53 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
2014-01-03 01:24:22 +01:00
|
|
|
import mekanism.api.Coord4D;
|
2014-01-10 23:42:53 +01:00
|
|
|
import mekanism.api.ListUtils;
|
2014-04-08 01:00:53 +02:00
|
|
|
import mekanism.api.gas.GasTank;
|
2014-01-10 23:42:53 +01:00
|
|
|
import mekanism.client.gui.GuiEnergyInfo.IInfoHandler;
|
2014-04-08 01:00:53 +02:00
|
|
|
import mekanism.client.gui.GuiFluidGauge.IFluidInfoHandler;
|
|
|
|
import mekanism.client.gui.GuiGasGauge.IGasInfoHandler;
|
2014-01-10 23:42:53 +01:00
|
|
|
import mekanism.common.Mekanism;
|
2014-01-03 01:24:22 +01:00
|
|
|
import mekanism.common.PacketHandler;
|
|
|
|
import mekanism.common.PacketHandler.Transmission;
|
2014-01-03 03:09:21 +01:00
|
|
|
import mekanism.common.inventory.container.ContainerElectrolyticSeparator;
|
2014-01-03 01:24:22 +01:00
|
|
|
import mekanism.common.network.PacketTileEntity;
|
2014-01-08 02:55:50 +01:00
|
|
|
import mekanism.common.tile.TileEntityElectrolyticSeparator;
|
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;
|
2014-04-08 01:00:53 +02:00
|
|
|
import net.minecraftforge.fluids.FluidTank;
|
2014-01-03 05:34:52 +01:00
|
|
|
|
2012-12-20 22:53:39 +01:00
|
|
|
import org.lwjgl.opengl.GL11;
|
2012-10-28 23:18:23 +01:00
|
|
|
|
2014-01-10 23:42:53 +01:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2014-01-03 01:24:22 +01:00
|
|
|
|
2013-04-13 16:33:37 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
2014-01-05 02:23:25 +01:00
|
|
|
public class GuiElectrolyticSeparator extends GuiMekanism
|
2012-10-28 23:18:23 +01:00
|
|
|
{
|
2012-11-15 21:04:12 +01:00
|
|
|
public TileEntityElectrolyticSeparator tileEntity;
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2012-11-15 21:04:12 +01:00
|
|
|
public GuiElectrolyticSeparator(InventoryPlayer inventory, TileEntityElectrolyticSeparator tentity)
|
2014-03-08 02:00:25 +01:00
|
|
|
{
|
|
|
|
super(new ContainerElectrolyticSeparator(inventory, tentity));
|
|
|
|
|
2014-04-08 01:00:53 +02:00
|
|
|
tileEntity = tentity;
|
|
|
|
|
2014-03-08 02:00:25 +01:00
|
|
|
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
|
|
|
|
@Override
|
|
|
|
public List<String> getInfo()
|
|
|
|
{
|
2014-04-04 02:01:54 +02:00
|
|
|
String multiplier = MekanismUtils.getEnergyDisplay(Mekanism.FROM_H2*2);
|
2014-03-08 02:00:25 +01:00
|
|
|
return ListUtils.asList("Using: " + multiplier + "/t", "Needed: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
|
|
|
|
}
|
|
|
|
}, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png")));
|
2014-04-08 01:00:53 +02:00
|
|
|
guiElements.add(new GuiFluidGauge(new IFluidInfoHandler() {
|
|
|
|
@Override
|
|
|
|
public FluidTank getTank()
|
|
|
|
{
|
|
|
|
return tileEntity.fluidTank;
|
|
|
|
}
|
|
|
|
}, GuiGauge.Type.STANDARD, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 5, 10));
|
|
|
|
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
|
|
|
@Override
|
|
|
|
public GasTank getTank()
|
|
|
|
{
|
|
|
|
return tileEntity.leftTank;
|
|
|
|
}
|
|
|
|
}, GuiGauge.Type.SMALL, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 58, 18));
|
|
|
|
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
|
|
|
@Override
|
|
|
|
public GasTank getTank()
|
|
|
|
{
|
|
|
|
return tileEntity.rightTank;
|
|
|
|
}
|
|
|
|
}, GuiGauge.Type.SMALL, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 18));
|
|
|
|
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 164, 15));
|
2014-03-08 02:00:25 +01:00
|
|
|
}
|
|
|
|
|
2012-11-23 03:22:11 +01:00
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
protected void mouseClicked(int x, int y, int button)
|
|
|
|
{
|
2012-12-19 21:23:55 +01:00
|
|
|
super.mouseClicked(x, y, button);
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2012-12-19 21:23:55 +01:00
|
|
|
int xAxis = (x - (width - xSize) / 2);
|
|
|
|
int yAxis = (y - (height - ySize) / 2);
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2014-01-03 01:24:22 +01:00
|
|
|
if(xAxis > 8 && xAxis < 17 && yAxis > 73 && yAxis < 82)
|
2012-11-23 03:22:11 +01:00
|
|
|
{
|
2013-02-27 02:21:30 +01:00
|
|
|
ArrayList data = new ArrayList();
|
|
|
|
data.add((byte)0);
|
2014-01-03 01:24:22 +01:00
|
|
|
|
2013-12-20 22:09:09 +01:00
|
|
|
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Coord4D.get(tileEntity), data));
|
2013-01-12 15:52:41 +01:00
|
|
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
2014-01-03 01:24:22 +01:00
|
|
|
|
2013-01-12 15:52:41 +01:00
|
|
|
}
|
2014-01-03 01:24:22 +01:00
|
|
|
else if(xAxis > 160 && xAxis < 169 && yAxis > 73 && yAxis < 82)
|
2013-01-12 15:52:41 +01:00
|
|
|
{
|
2013-02-27 02:21:30 +01:00
|
|
|
ArrayList data = new ArrayList();
|
|
|
|
data.add((byte)1);
|
2014-03-08 02:00:25 +01:00
|
|
|
|
2013-12-20 22:09:09 +01:00
|
|
|
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Coord4D.get(tileEntity), data));
|
2012-12-19 21:23:55 +01:00
|
|
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
2014-01-03 01:24:22 +01:00
|
|
|
|
2012-11-23 03:22:11 +01:00
|
|
|
}
|
2014-03-08 02:00:25 +01:00
|
|
|
}
|
2012-10-28 23:18:23 +01:00
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2013-05-20 00:43:01 +02:00
|
|
|
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
2014-03-08 02:00:25 +01:00
|
|
|
{
|
|
|
|
fontRenderer.drawString(tileEntity.getInvName(), 45, 6, 0x404040);
|
|
|
|
|
2014-01-03 06:43:55 +01:00
|
|
|
String name = tileEntity.dumpLeft ? "Dumping..." : tileEntity.leftTank.getGas() == null ? MekanismUtils.localize("gui.none") : tileEntity.leftTank.getGas().getGas().getLocalizedName();
|
2014-03-08 02:00:25 +01:00
|
|
|
fontRenderer.drawString(name, 21, 73, 0x404040);
|
|
|
|
|
2014-01-03 06:43:55 +01:00
|
|
|
name = tileEntity.dumpRight ? "Dumping..." : tileEntity.rightTank.getGas() == null ? MekanismUtils.localize("gui.none") : tileEntity.rightTank.getGas().getGas().getLocalizedName();
|
2014-03-08 02:00:25 +01:00
|
|
|
fontRenderer.drawString(name, 156-fontRenderer.getStringWidth(name), 73, 0x404040);
|
2014-01-03 01:24:22 +01:00
|
|
|
|
2014-01-10 23:42:53 +01:00
|
|
|
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
2014-03-08 02:00:25 +01:00
|
|
|
}
|
2012-10-28 23:18:23 +01:00
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2014-03-08 02:00:25 +01:00
|
|
|
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
|
|
|
{
|
2013-09-28 03:59:47 +02:00
|
|
|
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"));
|
2014-03-08 02:00:25 +01:00
|
|
|
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 displayInt = tileEntity.dumpLeft ? 60 : 52;
|
|
|
|
drawTexturedModalRect(guiWidth + 8, guiHeight + 73, 176, displayInt, 8, 8);
|
|
|
|
|
|
|
|
displayInt = tileEntity.dumpRight ? 60 : 52;
|
|
|
|
drawTexturedModalRect(guiWidth + 160, guiHeight + 73, 176, displayInt, 8, 8);
|
|
|
|
|
2014-04-08 01:00:53 +02:00
|
|
|
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
2014-01-03 05:34:52 +01:00
|
|
|
}
|
2012-10-28 23:18:23 +01:00
|
|
|
}
|