Work on GUIs
This commit is contained in:
parent
6114463852
commit
5a241ce8ee
8 changed files with 156 additions and 27 deletions
|
@ -4,6 +4,7 @@ package mekanism.client;
|
|||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mekanism.client.gui.GuiChemicalFormulator;
|
||||
import mekanism.client.gui.GuiCombiner;
|
||||
import mekanism.client.gui.GuiConfiguration;
|
||||
import mekanism.client.gui.GuiCredits;
|
||||
|
@ -72,6 +73,7 @@ import mekanism.common.tileentity.TileEntityAdvancedElectricMachine;
|
|||
import mekanism.common.tileentity.TileEntityAdvancedFactory;
|
||||
import mekanism.common.tileentity.TileEntityBin;
|
||||
import mekanism.common.tileentity.TileEntityChargepad;
|
||||
import mekanism.common.tileentity.TileEntityChemicalFormulator;
|
||||
import mekanism.common.tileentity.TileEntityCombiner;
|
||||
import mekanism.common.tileentity.TileEntityCrusher;
|
||||
import mekanism.common.tileentity.TileEntityDigitalMiner;
|
||||
|
@ -369,6 +371,8 @@ public class ClientProxy extends CommonProxy
|
|||
}
|
||||
case 25:
|
||||
return new GuiRobitRepair(player.inventory, world, x);
|
||||
case 29:
|
||||
return new GuiChemicalFormulator(player.inventory, (TileEntityChemicalFormulator)tileEntity);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -1,6 +1,128 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
public class GuiChemicalFormulator
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.inventory.container.ContainerChemicalFormulator;
|
||||
import mekanism.common.tileentity.TileEntityChemicalFormulator;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiChemicalFormulator extends GuiMekanism
|
||||
{
|
||||
|
||||
public TileEntityChemicalFormulator tileEntity;
|
||||
|
||||
public GuiChemicalFormulator(InventoryPlayer inventory, TileEntityChemicalFormulator tentity)
|
||||
{
|
||||
super(tentity, new ContainerChemicalFormulator(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalFormulator.png")));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int 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);
|
||||
|
||||
if(xAxis >= 116 && xAxis <= 168 && yAxis >= 76 && yAxis <= 80)
|
||||
{
|
||||
drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis);
|
||||
}
|
||||
|
||||
if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14 && yAxis <= 72)
|
||||
{
|
||||
drawCreativeTabHoveringText(tileEntity.gasTank != null ? tileEntity.gasTank.getGas().getLocalizedName() + ": " + tileEntity.gasTank.amount : MekanismUtils.localize("gui.empty"), xAxis, yAxis);
|
||||
}
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalFormulator.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.getScaledEnergyLevel(52);
|
||||
drawTexturedModalRect(guiWidth + 116, guiHeight + 76, 176, 36, displayInt, 4);
|
||||
|
||||
displayInt = tileEntity.getScaledProgress(48);
|
||||
drawTexturedModalRect(guiWidth + 64, guiHeight + 40, 176, 63, displayInt + 1, 8);
|
||||
|
||||
if(tileEntity.getScaledGasLevel(58) > 0)
|
||||
{
|
||||
displayGauge(134, 14, tileEntity.getScaledGasLevel(58), null, tileEntity.gasTank);
|
||||
}
|
||||
}
|
||||
|
||||
public void displayGauge(int xPos, int yPos, int scale, FluidStack fluid, GasStack gas)
|
||||
{
|
||||
if(fluid == null && gas == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
int start = 0;
|
||||
|
||||
while(true)
|
||||
{
|
||||
int renderRemaining = 0;
|
||||
|
||||
if(scale > 16)
|
||||
{
|
||||
renderRemaining = 16;
|
||||
scale -= 16;
|
||||
}
|
||||
else {
|
||||
renderRemaining = scale;
|
||||
scale = 0;
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
|
||||
if(fluid != null)
|
||||
{
|
||||
drawTexturedModelRectFromIcon(guiWidth + xPos, guiHeight + yPos + 58 - renderRemaining - start, fluid.getFluid().getIcon(), 16, 16 - (16 - renderRemaining));
|
||||
}
|
||||
else if(gas != null)
|
||||
{
|
||||
drawTexturedModelRectFromIcon(guiWidth + xPos, guiHeight + yPos + 58 - renderRemaining - start, gas.getGas().getIcon(), 16, 16 - (16 - renderRemaining));
|
||||
}
|
||||
|
||||
start+=16;
|
||||
|
||||
if(renderRemaining == 0 || scale == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalFormulator.png"));
|
||||
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos, 176, 40, 16, 59);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,6 @@ public class GuiDynamicTank extends GuiMekanism
|
|||
{
|
||||
public TileEntityDynamicTank tileEntity;
|
||||
|
||||
private int guiWidth;
|
||||
private int guiHeight;
|
||||
|
||||
public GuiDynamicTank(InventoryPlayer inventory, TileEntityDynamicTank tentity)
|
||||
{
|
||||
super(new ContainerDynamicTank(inventory, tentity));
|
||||
|
@ -59,8 +56,8 @@ public class GuiDynamicTank extends GuiMekanism
|
|||
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiDynamicTank.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
guiWidth = (width - xSize) / 2;
|
||||
guiHeight = (height - ySize) / 2;
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
|
||||
if(tileEntity.getScaledFluidLevel(58) > 0)
|
||||
|
@ -70,9 +67,6 @@ public class GuiDynamicTank extends GuiMekanism
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Credit to BuildCraft for both the gauge texture and parts of the code.
|
||||
*/
|
||||
public void displayGauge(int xPos, int yPos, int scale, FluidStack fluid, int side /*0-left, 1-right*/)
|
||||
{
|
||||
if(fluid == null)
|
||||
|
@ -80,6 +74,9 @@ public class GuiDynamicTank extends GuiMekanism
|
|||
return;
|
||||
}
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
int start = 0;
|
||||
|
||||
while(true)
|
||||
|
|
|
@ -3,7 +3,6 @@ package mekanism.client.gui;
|
|||
import mekanism.common.inventory.container.ContainerElectricMachine;
|
||||
import mekanism.common.tileentity.TileEntityElectricMachine;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -37,9 +36,7 @@ public class GuiElectricMachine extends GuiMekanism
|
|||
|
||||
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.inventory.container.ContainerElectricPump;
|
||||
import mekanism.common.tileentity.TileEntityElectricPump;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
|
@ -19,9 +18,6 @@ public class GuiElectricPump extends GuiMekanism
|
|||
{
|
||||
public TileEntityElectricPump tileEntity;
|
||||
|
||||
private int guiWidth;
|
||||
private int guiHeight;
|
||||
|
||||
public GuiElectricPump(InventoryPlayer inventory, TileEntityElectricPump tentity)
|
||||
{
|
||||
super(new ContainerElectricPump(inventory, tentity));
|
||||
|
@ -59,8 +55,8 @@ public class GuiElectricPump extends GuiMekanism
|
|||
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiElectricPump.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
guiWidth = (width - xSize) / 2;
|
||||
guiHeight = (height - ySize) / 2;
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
int displayInt;
|
||||
|
||||
|
@ -73,9 +69,6 @@ public class GuiElectricPump extends GuiMekanism
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Credit to BuildCraft for both the gauge texture and parts of the code.
|
||||
*/
|
||||
public void displayGauge(int xPos, int yPos, int scale, FluidStack fluid)
|
||||
{
|
||||
if(fluid == null)
|
||||
|
@ -83,6 +76,9 @@ public class GuiElectricPump extends GuiMekanism
|
|||
return;
|
||||
}
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
int start = 0;
|
||||
|
||||
while(true)
|
||||
|
|
|
@ -26,9 +26,6 @@ public class GuiRotaryCondensentrator extends GuiMekanism
|
|||
{
|
||||
public TileEntityRotaryCondensentrator tileEntity;
|
||||
|
||||
private int guiWidth;
|
||||
private int guiHeight;
|
||||
|
||||
public GuiRotaryCondensentrator(InventoryPlayer inventory, TileEntityRotaryCondensentrator tentity)
|
||||
{
|
||||
super(new ContainerRotaryCondensentrator(inventory, tentity));
|
||||
|
@ -76,8 +73,8 @@ public class GuiRotaryCondensentrator extends GuiMekanism
|
|||
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiRotaryCondensentrator.png"));
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
guiWidth = (width - xSize) / 2;
|
||||
guiHeight = (height - ySize) / 2;
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
|
||||
int displayInt;
|
||||
|
||||
|
@ -143,6 +140,9 @@ public class GuiRotaryCondensentrator extends GuiMekanism
|
|||
return;
|
||||
}
|
||||
|
||||
int guiWidth = (width - xSize) / 2;
|
||||
int guiHeight = (height - ySize) / 2;
|
||||
|
||||
int start = 0;
|
||||
|
||||
while(true)
|
||||
|
|
|
@ -3,6 +3,8 @@ package mekanism.common;
|
|||
import java.io.File;
|
||||
|
||||
import mekanism.common.inventory.container.ContainerAdvancedElectricMachine;
|
||||
import mekanism.common.inventory.container.ContainerChemicalFormulator;
|
||||
import mekanism.common.inventory.container.ContainerChemicalInfuser;
|
||||
import mekanism.common.inventory.container.ContainerDictionary;
|
||||
import mekanism.common.inventory.container.ContainerDigitalMiner;
|
||||
import mekanism.common.inventory.container.ContainerDynamicTank;
|
||||
|
@ -25,6 +27,8 @@ import mekanism.common.tileentity.TileEntityAdvancedElectricMachine;
|
|||
import mekanism.common.tileentity.TileEntityAdvancedFactory;
|
||||
import mekanism.common.tileentity.TileEntityBin;
|
||||
import mekanism.common.tileentity.TileEntityChargepad;
|
||||
import mekanism.common.tileentity.TileEntityChemicalFormulator;
|
||||
import mekanism.common.tileentity.TileEntityChemicalInfuser;
|
||||
import mekanism.common.tileentity.TileEntityCombiner;
|
||||
import mekanism.common.tileentity.TileEntityContainerBlock;
|
||||
import mekanism.common.tileentity.TileEntityCrusher;
|
||||
|
@ -299,6 +303,7 @@ public class CommonProxy
|
|||
return new ContainerDynamicTank(player.inventory, (TileEntityDynamicTank)tileEntity);
|
||||
case 21:
|
||||
EntityRobit robit = (EntityRobit)world.getEntityByID(x);
|
||||
|
||||
if(robit != null)
|
||||
{
|
||||
return new ContainerRobitMain(player.inventory, robit);
|
||||
|
@ -307,12 +312,14 @@ public class CommonProxy
|
|||
return new ContainerRobitCrafting(player.inventory, world);
|
||||
case 23:
|
||||
EntityRobit robit1 = (EntityRobit)world.getEntityByID(x);
|
||||
|
||||
if(robit1 != null)
|
||||
{
|
||||
return new ContainerRobitInventory(player.inventory, robit1);
|
||||
}
|
||||
case 24:
|
||||
EntityRobit robit2 = (EntityRobit)world.getEntityByID(x);
|
||||
|
||||
if(robit2 != null)
|
||||
{
|
||||
return new ContainerRobitSmelting(player.inventory, robit2);
|
||||
|
@ -325,6 +332,10 @@ public class CommonProxy
|
|||
return new ContainerFilter(player.inventory, (TileEntityContainerBlock)tileEntity);
|
||||
case 28:
|
||||
return new ContainerFilter(player.inventory, (TileEntityContainerBlock)tileEntity);
|
||||
case 29:
|
||||
return new ContainerChemicalFormulator(player.inventory, (TileEntityChemicalFormulator)tileEntity);
|
||||
case 30:
|
||||
return new ContainerChemicalInfuser(player.inventory, (TileEntityChemicalInfuser)tileEntity);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -66,6 +66,8 @@ tile.MachineBlock.DigitalMiner.name=Digital Miner
|
|||
|
||||
//Machine Block 2 (second ID iteration)
|
||||
tile.MachineBlock2.RotaryCondensentrator.name=Rotary Condensentrator
|
||||
tile.MachineBlock2.ChemicalFormulator.name=Chemical Formulator
|
||||
tile.MachineBlock2.ChemicalInfuser.name=Chemical Infuser
|
||||
|
||||
//Ore Block
|
||||
tile.OreBlock.OsmiumOre.name=Osmium Ore
|
||||
|
|
Loading…
Reference in a new issue