More work on Gas gauge stuff
This commit is contained in:
parent
00388cb875
commit
ffebfb0a9e
5 changed files with 37 additions and 18 deletions
|
@ -23,6 +23,8 @@ public class Gas
|
|||
|
||||
private boolean visible = true;
|
||||
|
||||
private boolean from_fluid = false;
|
||||
|
||||
/**
|
||||
* Creates a new Gas object with a defined name or key value.
|
||||
* @param s - name or key to associate this Gas with
|
||||
|
@ -40,6 +42,7 @@ public class Gas
|
|||
unlocalizedName = name = f.getName();
|
||||
icon = f.getStillIcon();
|
||||
fluid = f;
|
||||
from_fluid = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,6 +111,10 @@ public class Gas
|
|||
*/
|
||||
public Icon getIcon()
|
||||
{
|
||||
if(from_fluid)
|
||||
{
|
||||
return this.getFluid().getIcon();
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
@ -124,7 +131,7 @@ public class Gas
|
|||
{
|
||||
fluid.setIcons(getIcon());
|
||||
}
|
||||
|
||||
from_fluid = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,11 +14,10 @@ public class GuiGasGauge extends GuiElement
|
|||
private int xLocation;
|
||||
private int yLocation;
|
||||
|
||||
private int width = 6;
|
||||
private int height = 56;
|
||||
private int innerOffsetY = 2;
|
||||
private int width;
|
||||
private int height;
|
||||
|
||||
private Type gaugeType;
|
||||
private int number;
|
||||
|
||||
IGasInfoHandler infoHandler;
|
||||
|
||||
|
@ -31,16 +30,22 @@ public class GuiGasGauge extends GuiElement
|
|||
|
||||
width = type.width;
|
||||
height = type.height;
|
||||
number = type.number;
|
||||
|
||||
infoHandler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
|
||||
{
|
||||
int scale = getScaledGasLevel(height);
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
|
||||
int scale = getScaledGasLevel(height-2);
|
||||
int start = 0;
|
||||
GasStack gas = infoHandler.getTank().getGas();
|
||||
|
||||
guiObj.drawTexturedModalRect(guiWidth + xLocation, guiHeight + yLocation, 0, 0, width, height);
|
||||
|
||||
while(true)
|
||||
{
|
||||
int renderRemaining = 0;
|
||||
|
@ -57,7 +62,10 @@ public class GuiGasGauge extends GuiElement
|
|||
|
||||
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
|
||||
guiObj.drawTexturedModelRectFromIcon(guiWidth + xLocation, guiHeight + yLocation + 58 - renderRemaining - start, gas.getGas().getIcon(), 16, 16 - (16 - renderRemaining));
|
||||
for(int i = 0; i < number; i++)
|
||||
{
|
||||
guiObj.drawTexturedModelRectFromIcon(guiWidth + xLocation + 16*i + 1, guiHeight + yLocation + height - renderRemaining - start - 1, gas.getGas().getIcon(), 16, renderRemaining);
|
||||
}
|
||||
|
||||
start+=16;
|
||||
|
||||
|
@ -67,9 +75,10 @@ public class GuiGasGauge extends GuiElement
|
|||
}
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(defaultLocation);
|
||||
guiObj.drawTexturedModalRect(guiWidth + xLocation, guiHeight + yLocation, 176, 40, 16, 59);
|
||||
mc.renderEngine.bindTexture(RESOURCE);
|
||||
guiObj.drawTexturedModalRect(guiWidth + xLocation, guiHeight + yLocation, width, 0, width, height);
|
||||
|
||||
mc.renderEngine.bindTexture(defaultLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -102,17 +111,19 @@ public class GuiGasGauge extends GuiElement
|
|||
|
||||
public static enum Type
|
||||
{
|
||||
STANDARD(20, 58, "mekanism:gasGaugeStandard"),
|
||||
WIDE(100, 58, "mekanism:gasGaugeWide");
|
||||
STANDARD(18, 60, 1, "GuiGaugeStandard.png"),
|
||||
WIDE(66, 50, 4, "GuiGaugeWide.png");
|
||||
|
||||
public int width;
|
||||
public int height;
|
||||
public int number;
|
||||
public String textureLocation;
|
||||
|
||||
private Type(int w, int h, String t)
|
||||
private Type(int w, int h, int n, String t)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
number = n;
|
||||
textureLocation = t;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import mekanism.client.gui.GuiGasGauge;
|
|||
import mekanism.client.gui.GuiGasGauge.IGasInfoHandler;
|
||||
import mekanism.client.gui.GuiGasGauge.Type;
|
||||
import mekanism.client.gui.GuiMekanism;
|
||||
import mekanism.client.gui.GuiPowerBar;
|
||||
import mekanism.client.gui.GuiRedstoneControl;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -37,8 +38,10 @@ public class GuiHydrogenGenerator extends GuiMekanism
|
|||
@Override
|
||||
public List<String> getInfo()
|
||||
{
|
||||
String production = MekanismUtils.getEnergyDisplay(tileEntity.generationRate);
|
||||
return ListUtils.asList("Producing: " + production + "/t", "Storing: " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()));
|
||||
return ListUtils.asList(
|
||||
"Producing: " + MekanismUtils.getEnergyDisplay(tileEntity.generationRate) + "/t",
|
||||
"Storing: " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()),
|
||||
"Max Output: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()));
|
||||
}
|
||||
}, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png")));
|
||||
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
||||
|
@ -47,7 +50,8 @@ public class GuiHydrogenGenerator extends GuiMekanism
|
|||
{
|
||||
return tileEntity.fuelTank;
|
||||
}
|
||||
}, Type.WIDE, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiHydrogenGenerator.png"), 20, 20));
|
||||
}, 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
|
||||
|
@ -60,9 +64,6 @@ public class GuiHydrogenGenerator extends GuiMekanism
|
|||
|
||||
fontRenderer.drawString(tileEntity.getInvName(), 45, 6, 0x404040);
|
||||
fontRenderer.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
fontRenderer.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, 0x00CD00);
|
||||
fontRenderer.drawString("H: " + tileEntity.fuelTank.getStored(), 51, 35, 0x00CD00);
|
||||
fontRenderer.drawString(MekanismUtils.localize("gui.out") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t", 51, 44, 0x00CD00);
|
||||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 2.1 KiB |
BIN
resources/assets/mekanism/gui/elements/GuiGaugeWide.png
Normal file
BIN
resources/assets/mekanism/gui/elements/GuiGaugeWide.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 564 B |
Loading…
Reference in a new issue