Got GUIs working with new fanciness

This commit is contained in:
Aidan Brady 2014-01-16 21:26:40 -05:00
parent 9acc264726
commit 175f3e8646
4 changed files with 50 additions and 8 deletions

View file

@ -3,7 +3,9 @@ package mekanism.client.gui;
import java.util.List;
import mekanism.api.ListUtils;
import mekanism.api.gas.GasStack;
import mekanism.client.gui.GuiEnergyInfo.IInfoHandler;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.inventory.container.ContainerAdvancedElectricMachine;
import mekanism.common.tile.TileEntityAdvancedElectricMachine;
import mekanism.common.util.MekanismUtils;
@ -47,6 +49,11 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
fontRenderer.drawString(tileEntity.getInvName(), (xSize/2)-(fontRenderer.getStringWidth(tileEntity.getInvName())/2), 6, 0x404040);
fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040);
if(xAxis >= 61 && xAxis <= 66 && yAxis >= 37 && yAxis <= 49)
{
drawCreativeTabHoveringText(tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas().getLocalizedName() + ": " + tileEntity.gasTank.getStored() : MekanismUtils.localize("gui.none"), xAxis, yAxis);
}
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
@ -64,12 +71,29 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
int displayInt;
displayInt = tileEntity.getScaledGasLevel(12);
drawTexturedModalRect(guiWidth + 61, guiHeight + 37 + 12 - displayInt, 176, 7 + 12 - displayInt, 5, displayInt);
displayInt = tileEntity.getScaledProgress(24);
drawTexturedModalRect(guiWidth + 79, guiHeight + 39, 176, 0, displayInt + 1, 7);
if(tileEntity.getScaledGasLevel(12) > 0)
{
displayInt = tileEntity.getScaledGasLevel(12);
displayGauge(61, 37 + 12 - displayInt, 5, displayInt, tileEntity.gasTank.getGas());
}
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}
public void displayGauge(int xPos, int yPos, int sizeX, int sizeY, GasStack gas)
{
if(gas == null)
{
return;
}
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
drawTexturedModelRectFromIcon(guiWidth + xPos, guiHeight + yPos, gas.getGas().getIcon(), sizeX, sizeY);
}
}

View file

@ -3,7 +3,9 @@ package mekanism.client.gui;
import java.util.List;
import mekanism.api.ListUtils;
import mekanism.api.gas.GasStack;
import mekanism.client.gui.GuiEnergyInfo.IInfoHandler;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.IFactory.RecipeType;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.inventory.container.ContainerFactory;
@ -60,7 +62,7 @@ public class GuiFactory extends GuiMekanism
if(xAxis >= 8 && xAxis <= 168 && yAxis >= 78 && yAxis <= 83)
{
drawCreativeTabHoveringText(MekanismUtils.localize("gui.factory.secondaryEnergy") + ": " + tileEntity.gasTank.getStored(), xAxis, yAxis);
drawCreativeTabHoveringText(tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas().getLocalizedName() + ": " + tileEntity.gasTank.getStored() : MekanismUtils.localize("gui.none"), xAxis, yAxis);
}
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
@ -131,7 +133,23 @@ public class GuiFactory extends GuiMekanism
recipeFuelY += 15;
}
displayInt = tileEntity.getScaledGasLevel(160);
drawTexturedModalRect(guiWidth + 8, guiHeight + 78, 0, recipeFuelY, displayInt, 5);
if(tileEntity.getScaledGasLevel(160) > 0)
{
displayGauge(8, 78, tileEntity.getScaledGasLevel(160), 5, tileEntity.gasTank.getGas());
}
}
public void displayGauge(int xPos, int yPos, int sizeX, int sizeY, GasStack gas)
{
if(gas == null)
{
return;
}
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
drawTexturedModelRectFromIcon(guiWidth + xPos, guiHeight + yPos, gas.getGas().getIcon(), sizeX, sizeY);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -165,6 +165,8 @@ gas.sulfurDioxideGas=Sulfur Dioxide
gas.sulfurTrioxideGas=Sulfur Trioxide
gas.sulfuricAcid=Sulfuric Acid
gas.hydrogenChloride=Hydrogen Chloride
gas.liquidOsmium=Liquid Osmium
gas.liquidStone=Liquid Stone
//Fluids
fluid.hydrogen=Liquid Hydrogen
@ -175,8 +177,6 @@ fluid.sulfurTrioxideGas=Liquid Sulfur Trioxide
fluid.sulfuricAcid=Liquid Sulfuric Acid
fluid.hydrogenChloride=Liquid Hydrogen Chloride
fluid.brine=Brine
fluid.liquidOsmium=Liquid Osmium
fluid.liquidStone=Liquid Stone
//Gui text
gui.removeSpeedUpgrade=Remove speed upgrade