Gui work
This commit is contained in:
parent
2b9c859618
commit
5edf734292
7 changed files with 144 additions and 6 deletions
|
@ -3,6 +3,8 @@ package mekanism.client.gui;
|
||||||
import mekanism.api.gas.GasTank;
|
import mekanism.api.gas.GasTank;
|
||||||
import mekanism.client.gui.GuiFluidGauge.IFluidInfoHandler;
|
import mekanism.client.gui.GuiFluidGauge.IFluidInfoHandler;
|
||||||
import mekanism.client.gui.GuiGasGauge.IGasInfoHandler;
|
import mekanism.client.gui.GuiGasGauge.IGasInfoHandler;
|
||||||
|
import mekanism.client.gui.GuiSlot.SlotOverlay;
|
||||||
|
import mekanism.client.gui.GuiSlot.SlotType;
|
||||||
import mekanism.common.inventory.container.ContainerPRC;
|
import mekanism.common.inventory.container.ContainerPRC;
|
||||||
import mekanism.common.tile.TileEntityPRC;
|
import mekanism.common.tile.TileEntityPRC;
|
||||||
import mekanism.common.util.MekanismUtils;
|
import mekanism.common.util.MekanismUtils;
|
||||||
|
@ -28,22 +30,26 @@ public class GuiPRC extends GuiMekanism
|
||||||
{
|
{
|
||||||
return tileEntity.inputFluidTank;
|
return tileEntity.inputFluidTank;
|
||||||
}
|
}
|
||||||
}, GuiGauge.Type.STANDARD, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 5, 10));
|
}, GuiGauge.Type.STANDARD, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 5, 10));
|
||||||
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
||||||
@Override
|
@Override
|
||||||
public GasTank getTank()
|
public GasTank getTank()
|
||||||
{
|
{
|
||||||
return tileEntity.inputGasTank;
|
return tileEntity.inputGasTank;
|
||||||
}
|
}
|
||||||
}, GuiGauge.Type.SMALL, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 33, 18));
|
}, GuiGauge.Type.STANDARD, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 28, 10));
|
||||||
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
|
||||||
@Override
|
@Override
|
||||||
public GasTank getTank()
|
public GasTank getTank()
|
||||||
{
|
{
|
||||||
return tileEntity.outputGasTank;
|
return tileEntity.outputGasTank;
|
||||||
}
|
}
|
||||||
}, GuiGauge.Type.SMALL, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 18));
|
}, GuiGauge.Type.SMALL, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 140, 40));
|
||||||
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 164, 15));
|
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 164, 15));
|
||||||
|
|
||||||
|
guiElements.add(new GuiSlot(SlotType.INPUT, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 53, 34));
|
||||||
|
guiElements.add(new GuiSlot(SlotType.POWER, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 140, 18).with(SlotOverlay.POWER));
|
||||||
|
guiElements.add(new GuiSlot(SlotType.OUTPUT, this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 115, 34));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,7 +58,7 @@ public class GuiPRC extends GuiMekanism
|
||||||
int xAxis = (mouseX - (width - xSize) / 2);
|
int xAxis = (mouseX - (width - xSize) / 2);
|
||||||
int yAxis = (mouseY - (height - ySize) / 2);
|
int yAxis = (mouseY - (height - ySize) / 2);
|
||||||
|
|
||||||
fontRenderer.drawString(tileEntity.getInvName(), 45, 6, 0x404040);
|
fontRenderer.drawString(tileEntity.getInvName(), 81, 6, 0x404040);
|
||||||
fontRenderer.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
fontRenderer.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||||
|
|
||||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||||
|
|
124
common/mekanism/client/gui/GuiSlot.java
Normal file
124
common/mekanism/client/gui/GuiSlot.java
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
package mekanism.client.gui;
|
||||||
|
|
||||||
|
import mekanism.common.util.MekanismUtils;
|
||||||
|
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||||
|
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class GuiSlot extends GuiElement
|
||||||
|
{
|
||||||
|
protected int xLocation;
|
||||||
|
protected int yLocation;
|
||||||
|
|
||||||
|
protected int textureX;
|
||||||
|
protected int textureY;
|
||||||
|
|
||||||
|
protected int width;
|
||||||
|
protected int height;
|
||||||
|
|
||||||
|
protected SlotOverlay overlay = null;
|
||||||
|
|
||||||
|
public GuiSlot(SlotType type, GuiMekanism gui, TileEntity tile, ResourceLocation def, int x, int y)
|
||||||
|
{
|
||||||
|
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiSlot.png"), gui, tile, def);
|
||||||
|
|
||||||
|
xLocation = x;
|
||||||
|
yLocation = y;
|
||||||
|
|
||||||
|
width = type.width;
|
||||||
|
height = type.height;
|
||||||
|
|
||||||
|
textureX = type.textureX;
|
||||||
|
textureY = type.textureY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiSlot with(SlotOverlay overlay)
|
||||||
|
{
|
||||||
|
this.overlay = overlay;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
|
||||||
|
{
|
||||||
|
mc.renderEngine.bindTexture(RESOURCE);
|
||||||
|
|
||||||
|
guiObj.drawTexturedModalRect(guiWidth + xLocation, guiHeight + yLocation, textureX, textureY, width, height);
|
||||||
|
|
||||||
|
if(overlay != null)
|
||||||
|
{
|
||||||
|
int w = overlay.width;
|
||||||
|
int h = overlay.height;
|
||||||
|
int xLocationOverlay = xLocation + (width-w)/2;
|
||||||
|
int yLocationOverlay = yLocation + (height-h)/2;
|
||||||
|
|
||||||
|
guiObj.drawTexturedModalRect(guiWidth + xLocationOverlay, guiHeight + yLocationOverlay, overlay.textureX, overlay.textureY, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
mc.renderEngine.bindTexture(defaultLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderForeground(int xAxis, int yAxis)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preMouseClicked(int xAxis, int yAxis, int button)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(int xAxis, int yAxis, int button)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum SlotType
|
||||||
|
{
|
||||||
|
NORMAL(18, 18, 0, 0),
|
||||||
|
POWER(18, 18, 18, 0),
|
||||||
|
INPUT(18, 18, 36, 0),
|
||||||
|
EXTRA(18, 18, 54, 0),
|
||||||
|
OUTPUT(18, 18, 72, 0),
|
||||||
|
OUTPUT_LARGE(26, 26, 90, 0),
|
||||||
|
OUTPUT_WIDE(42, 26, 116, 0);
|
||||||
|
|
||||||
|
public int width;
|
||||||
|
public int height;
|
||||||
|
|
||||||
|
public int textureX;
|
||||||
|
public int textureY;
|
||||||
|
|
||||||
|
private SlotType(int w, int h, int x, int y)
|
||||||
|
{
|
||||||
|
width = w;
|
||||||
|
height = h;
|
||||||
|
|
||||||
|
textureX = x;
|
||||||
|
textureY = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum SlotOverlay
|
||||||
|
{
|
||||||
|
MINUS(18, 18, 0, 18),
|
||||||
|
PLUS(18, 18, 18, 18),
|
||||||
|
POWER(18, 18, 36, 18);
|
||||||
|
|
||||||
|
public int width;
|
||||||
|
public int height;
|
||||||
|
|
||||||
|
public int textureX;
|
||||||
|
public int textureY;
|
||||||
|
|
||||||
|
private SlotOverlay(int w, int h, int x, int y)
|
||||||
|
{
|
||||||
|
width = w;
|
||||||
|
height = h;
|
||||||
|
|
||||||
|
textureX = x;
|
||||||
|
textureY = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -663,6 +663,7 @@ public class Mekanism
|
||||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(BlockHDPE, 4, 15), new Object[] {
|
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(BlockHDPE, 4, 15), new Object[] {
|
||||||
"SSS", "S S", "SSS", Character.valueOf('S'), new ItemStack(Polyethene, 1, 2)
|
"SSS", "S S", "SSS", Character.valueOf('S'), new ItemStack(Polyethene, 1, 2)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
for(int i = 0; i < EnumColor.DYES.length-1; i++)
|
for(int i = 0; i < EnumColor.DYES.length-1; i++)
|
||||||
{
|
{
|
||||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(BlockHDPE, 4, i), new Object[] {
|
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(BlockHDPE, 4, i), new Object[] {
|
||||||
|
|
|
@ -20,8 +20,8 @@ public class ContainerPRC extends Container
|
||||||
public ContainerPRC(InventoryPlayer inventory, TileEntityPRC tentity)
|
public ContainerPRC(InventoryPlayer inventory, TileEntityPRC tentity)
|
||||||
{
|
{
|
||||||
tileEntity = tentity;
|
tileEntity = tentity;
|
||||||
addSlotToContainer(new Slot(tentity, 0, 56, 17));
|
addSlotToContainer(new Slot(tentity, 0, 54, 35));
|
||||||
addSlotToContainer(new SlotDischarge(tentity, 1, 56, 53));
|
addSlotToContainer(new SlotDischarge(tentity, 1, 141, 19));
|
||||||
addSlotToContainer(new SlotOutput(tentity, 2, 116, 35));
|
addSlotToContainer(new SlotOutput(tentity, 2, 116, 35));
|
||||||
addSlotToContainer(new SlotMachineUpgrade(tentity, 3, 180, 11));
|
addSlotToContainer(new SlotMachineUpgrade(tentity, 3, 180, 11));
|
||||||
int slotX;
|
int slotX;
|
||||||
|
|
|
@ -329,6 +329,12 @@ public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandl
|
||||||
nbtTags.setBoolean("dumpRight", dumpRight);
|
nbtTags.setBoolean("dumpRight", dumpRight);
|
||||||
*/ }
|
*/ }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getInvName()
|
||||||
|
{
|
||||||
|
return MekanismUtils.localize(getBlockType().getUnlocalizedName() + "." + fullName + ".short.name");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map getRecipes()
|
public Map getRecipes()
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 879 B After Width: | Height: | Size: 873 B |
|
@ -99,6 +99,7 @@ tile.MachineBlock2.ChemicalWasher.name=Chemical Washer
|
||||||
tile.MachineBlock2.ChemicalCrystalizer.name=Chemical Crystalizer
|
tile.MachineBlock2.ChemicalCrystalizer.name=Chemical Crystalizer
|
||||||
tile.MachineBlock2.SeismicVibrator.name=Seismic Vibrator
|
tile.MachineBlock2.SeismicVibrator.name=Seismic Vibrator
|
||||||
tile.MachineBlock2.PressurizedReactionChamber.name=Pressurized Reaction Chamber
|
tile.MachineBlock2.PressurizedReactionChamber.name=Pressurized Reaction Chamber
|
||||||
|
tile.MachineBlock2.PressurizedReactionChamber.short.name=PRC
|
||||||
|
|
||||||
//Plastic
|
//Plastic
|
||||||
tile.PlasticBlock.PlasticBlock.name=Plastic Block
|
tile.PlasticBlock.PlasticBlock.name=Plastic Block
|
||||||
|
|
Loading…
Reference in a new issue