Revert "Changes to GUI's for more flexibility & consistancy"

This reverts commit 61406c2b2d.
This commit is contained in:
aidancbrady 2015-04-26 19:41:03 -07:00
parent 2cbcaf0a3b
commit c839ce5697
33 changed files with 297 additions and 308 deletions

View file

@ -38,14 +38,11 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
super(tentity, new ContainerAdvancedElectricMachine(inventory, tentity));
tileEntity = tentity;
xSize = 176;
ySize = 186;
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation, xSize, 63));
guiElements.add(new GuiUpgradeTab(this, tileEntity, tileEntity.guiLocation, xSize, 5));
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, tileEntity.guiLocation,-26, 5));
guiElements.add(new GuiTransporterConfigTab(this, tileEntity, tileEntity.guiLocation,-26, 34));
guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 7, 35));
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiUpgradeTab(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiTransporterConfigTab(this, 34, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 164, 15));
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
@ -53,12 +50,12 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick);
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + multiplier + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
}
}, this, tileEntity.guiLocation,-26, 63));
}, this, tileEntity.guiLocation));
guiElements.add(new GuiSlot(SlotType.INPUT, this, tileEntity.guiLocation, 39, 20));
guiElements.add(new GuiSlot(SlotType.POWER, this, tileEntity.guiLocation, 13, 71).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.EXTRA, this, tileEntity.guiLocation, 39, 56));
guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, tileEntity.guiLocation, 111, 34));
guiElements.add(new GuiSlot(SlotType.INPUT, this, tileEntity.guiLocation, 55, 16));
guiElements.add(new GuiSlot(SlotType.POWER, this, tileEntity.guiLocation, 30, 34).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.EXTRA, this, tileEntity.guiLocation, 55, 52));
guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, tileEntity.guiLocation, 111, 30));
guiElements.add(new GuiProgress(new IProgressInfoHandler()
{
@ -67,7 +64,7 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
{
return tileEntity.getScaledProgress();
}
}, getProgressType(), this, tileEntity.guiLocation, 57, 39));
}, getProgressType(), this, tileEntity.guiLocation, 77, 37));
}
public ProgressBar getProgressType()
@ -78,17 +75,13 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
int xAxis = mouseX - guiLeft;
int yAxis = mouseY - guiTop;
mc.renderEngine.bindTexture(tileEntity.guiLocation);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
drawTexturedModalRect(guiLeft + 44, guiTop + 40, 176, 0, 8, 14);
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
fontRendererObj.drawString(tileEntity.getInventoryName(), (xSize/2)-(fontRendererObj.getStringWidth(tileEntity.getInventoryName())/2), 6, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
if(xAxis >= 43 && xAxis <= 52 && yAxis >= 39 && yAxis <= 54)
if(xAxis >= 61 && xAxis <= 67 && yAxis >= 37 && yAxis <= 49)
{
drawCreativeTabHoveringText(tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas().getLocalizedName() + ": " + tileEntity.gasTank.getStored() : MekanismUtils.localize("gui.none"), xAxis, yAxis);
}
@ -101,14 +94,16 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
{
mc.renderEngine.bindTexture(tileEntity.guiLocation);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
int displayInt;
if(tileEntity.getScaledGasLevel(12) > 0)
{
displayInt = tileEntity.getScaledGasLevel(12);
displayGauge(45, 41 + 12 - displayInt, 6, displayInt, tileEntity.gasTank.getGas());
displayGauge(61, 37 + 12 - displayInt, 6, displayInt, tileEntity.gasTank.getGas());
}
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
@ -121,7 +116,10 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
return;
}
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
drawTexturedModelRectFromIcon(guiLeft + xPos, guiTop + yPos, gas.getGas().getIcon(), sizeX, sizeY);
drawTexturedModelRectFromIcon(guiWidth + xPos, guiHeight + yPos, gas.getGas().getIcon(), sizeX, sizeY);
}
}

View file

@ -7,9 +7,9 @@ import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSideConfigurationTab;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
@ -36,14 +36,11 @@ public class GuiChanceMachine extends GuiMekanism
super(tentity, new ContainerChanceMachine(inventory, tentity));
tileEntity = tentity;
xSize = 176;
ySize = 186;
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation, xSize, 63));
guiElements.add(new GuiUpgradeTab(this, tileEntity, tileEntity.guiLocation, xSize, 5));
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, tileEntity.guiLocation,-26, 5));
guiElements.add(new GuiTransporterConfigTab(this, tileEntity, tileEntity.guiLocation,-26, 34));
guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 7, 35));
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiUpgradeTab(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiTransporterConfigTab(this, 34, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 164, 15));
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
@ -51,11 +48,11 @@ public class GuiChanceMachine extends GuiMekanism
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick);
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + multiplier + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
}
}, this, tileEntity.guiLocation,-26, 63));
}, this, tileEntity.guiLocation));
guiElements.add(new GuiSlot(SlotType.INPUT, this, tileEntity.guiLocation, 31, 38));
guiElements.add(new GuiSlot(SlotType.POWER, this, tileEntity.guiLocation, 13, 71).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.OUTPUT_WIDE, this, tileEntity.guiLocation, 103, 34));
guiElements.add(new GuiSlot(SlotType.INPUT, this, tileEntity.guiLocation, 55, 16));
guiElements.add(new GuiSlot(SlotType.POWER, this, tileEntity.guiLocation, 55, 52).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.OUTPUT_WIDE, this, tileEntity.guiLocation, 111, 30));
guiElements.add(new GuiProgress(new IProgressInfoHandler()
{
@ -64,7 +61,7 @@ public class GuiChanceMachine extends GuiMekanism
{
return tileEntity.getScaledProgress();
}
}, getProgressType(), this, tileEntity.guiLocation, 49, 39));
}, getProgressType(), this, tileEntity.guiLocation, 77, 37));
}
public ProgressBar getProgressType()
@ -86,7 +83,9 @@ public class GuiChanceMachine extends GuiMekanism
{
mc.renderEngine.bindTexture(tileEntity.guiLocation);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}

View file

@ -17,6 +17,6 @@ public class GuiCombiner extends GuiAdvancedElectricMachine
@Override
public ProgressBar getProgressType()
{
return ProgressBar.COMBINE;
return ProgressBar.STONE;
}
}

View file

@ -17,6 +17,6 @@ public class GuiCrusher extends GuiElectricMachine
@Override
public ProgressBar getProgressType()
{
return ProgressBar.CRUSH2;
return ProgressBar.CRUSH;
}
}

View file

@ -28,7 +28,6 @@ import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -44,19 +43,15 @@ public class GuiDigitalMiner extends GuiMekanism
public GuiButton stopButton;
public GuiButton configButton;
public ResourceLocation guiLocation = MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png");
public GuiDigitalMiner(InventoryPlayer inventory, TileEntityDigitalMiner tentity)
{
super(tentity, new ContainerDigitalMiner(inventory, tentity));
tileEntity = tentity;
//guiLocation = MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png");
guiElements.add(new GuiRedstoneControl(this, tileEntity, guiLocation, 176, 107));
guiElements.add(new GuiUpgradeTab(this, tileEntity, guiLocation, 176, 5));
guiElements.add(new GuiPowerBar(this, tileEntity, guiLocation, 7, 23));
guiElements.add(new GuiVisualsTab(this, tileEntity, guiLocation, -26, 5));
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png")));
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png")));
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png"), 163, 23));
guiElements.add(new GuiVisualsTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png")));
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
@ -64,10 +59,10 @@ public class GuiDigitalMiner extends GuiMekanism
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.getPerTick());
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + multiplier + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
}
}, this, guiLocation,-26, 107));
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png")));
guiElements.add(new GuiSlot(SlotType.POWER, this, guiLocation, 13, 59).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, guiLocation, 13, 17));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png"), 151, 5).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png"), 143, 26));
ySize+=64;
}
@ -81,21 +76,21 @@ public class GuiDigitalMiner extends GuiMekanism
int guiHeight = (height - ySize) / 2;
buttonList.clear();
startButton = new GuiButton(0, guiWidth + 49, guiHeight + 17, 60, 20, MekanismUtils.localize("gui.start"));
startButton = new GuiButton(0, guiWidth + 69, guiHeight + 17, 60, 20, MekanismUtils.localize("gui.start"));
if(tileEntity.searcher.state != State.IDLE && tileEntity.running)
{
startButton.enabled = false;
}
stopButton = new GuiButton(1, guiWidth + 49, guiHeight + 37, 60, 20, MekanismUtils.localize("gui.stop"));
stopButton = new GuiButton(1, guiWidth + 69, guiHeight + 37, 60, 20, MekanismUtils.localize("gui.stop"));
if(tileEntity.searcher.state == State.IDLE || !tileEntity.running)
{
stopButton.enabled = false;
}
configButton = new GuiButton(2, guiWidth + 49, guiHeight + 57, 60, 20, MekanismUtils.localize("gui.config"));
configButton = new GuiButton(2, guiWidth + 69, guiHeight + 57, 60, 20, MekanismUtils.localize("gui.config"));
if(tileEntity.searcher.state != State.IDLE)
{
@ -165,21 +160,21 @@ public class GuiDigitalMiner extends GuiMekanism
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
int xAxis = mouseX - guiLeft;
int yAxis = mouseY - guiTop;
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
fontRendererObj.drawString(tileEntity.getInventoryName(), 8, 6, 0x404040);
fontRendererObj.drawString(tileEntity.getInventoryName(), 69, 6, 0x404040);
fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
fontRendererObj.drawString(tileEntity.running ? MekanismUtils.localize("gui.digitalMiner.running") : MekanismUtils.localize("gui.idle"), 113, 10, 0x00CD00);
fontRendererObj.drawString(tileEntity.searcher.state.desc, 113, 19, 0x00CD00);
fontRendererObj.drawString(tileEntity.running ? MekanismUtils.localize("gui.digitalMiner.running") : MekanismUtils.localize("gui.idle"), 9, 10, 0x00CD00);
fontRendererObj.drawString(tileEntity.searcher.state.desc, 9, 19, 0x00CD00);
fontRendererObj.drawString(MekanismUtils.localize("gui.eject") + ": " + MekanismUtils.localize("gui." + (tileEntity.doEject ? "on" : "off")), 113, 30, 0x00CD00);
fontRendererObj.drawString(MekanismUtils.localize("gui.digitalMiner.pull") + ": " + MekanismUtils.localize("gui." + (tileEntity.doPull ? "on" : "off")), 113, 39, 0x00CD00);
fontRendererObj.drawString(MekanismUtils.localize("gui.digitalMiner.silk") + ": " + MekanismUtils.localize("gui." + (tileEntity.silkTouch ? "on" : "off")), 113, 48, 0x00CD00);
fontRendererObj.drawString(MekanismUtils.localize("gui.eject") + ": " + MekanismUtils.localize("gui." + (tileEntity.doEject ? "on" : "off")), 9, 30, 0x00CD00);
fontRendererObj.drawString(MekanismUtils.localize("gui.digitalMiner.pull") + ": " + MekanismUtils.localize("gui." + (tileEntity.doPull ? "on" : "off")), 9, 39, 0x00CD00);
fontRendererObj.drawString(MekanismUtils.localize("gui.digitalMiner.silk") + ": " + MekanismUtils.localize("gui." + (tileEntity.silkTouch ? "on" : "off")), 9, 48, 0x00CD00);
fontRendererObj.drawString(MekanismUtils.localize("gui.digitalMiner.toMine") + ":", 113, 59, 0x00CD00);
fontRendererObj.drawString("" + tileEntity.clientToMine, 113, 68, 0x00CD00);
fontRendererObj.drawString(MekanismUtils.localize("gui.digitalMiner.toMine") + ":", 9, 59, 0x00CD00);
fontRendererObj.drawString("" + tileEntity.clientToMine, 9, 68, 0x00CD00);
if(tileEntity.missingStack != null)
{
@ -190,15 +185,15 @@ public class GuiDigitalMiner extends GuiMekanism
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
itemRender.renderIcon(14, 18, MekanismRenderer.getColorIcon(EnumColor.DARK_RED), 16, 16);
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), tileEntity.missingStack, 14, 18);
itemRender.renderIcon(144, 27, MekanismRenderer.getColorIcon(EnumColor.DARK_RED), 16, 16);
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), tileEntity.missingStack, 144, 27);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
else {
mc.getTextureManager().bindTexture(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiSlot.png"));
drawTexturedModalRect(13, 17, SlotOverlay.CHECK.textureX, SlotOverlay.CHECK.textureY, 18, 18);
drawTexturedModalRect(143, 26, SlotOverlay.CHECK.textureX, SlotOverlay.CHECK.textureY, 18, 18);
}
if(xAxis >= 164 && xAxis <= 168 && yAxis >= 25 && yAxis <= 77)
@ -206,19 +201,17 @@ public class GuiDigitalMiner extends GuiMekanism
drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis);
}
// Auto eject
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 32 && yAxis <= 45)
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 47 && yAxis <= 61)
{
drawCreativeTabHoveringText(MekanismUtils.localize("gui.autoEject"), xAxis, yAxis);
}
// Auto pull
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 48 && yAxis <= 61)
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 63 && yAxis <= 77)
{
drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.autoPull"), xAxis, yAxis);
}
if(xAxis >= 13 && xAxis <= 30 && yAxis >= 17 && yAxis <= 34)
if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43)
{
if(tileEntity.missingStack != null)
{
@ -229,14 +222,12 @@ public class GuiDigitalMiner extends GuiMekanism
}
}
// Reset
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 17 && yAxis <= 30)
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 47 && yAxis <= 61)
{
drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.reset"), xAxis, yAxis);
}
// Silk touch
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 63 && yAxis <= 76)
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 63 && yAxis <= 77)
{
drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.silkTouch"), xAxis, yAxis);
}
@ -249,31 +240,49 @@ public class GuiDigitalMiner extends GuiMekanism
{
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
int xAxis = mouseX - guiLeft;
int yAxis = mouseY - guiTop;
int xAxis = mouseX - guiWidth;
int yAxis = mouseY - guiHeight;
int displayInt;
displayInt = tileEntity.getScaledEnergyLevel(52);
drawTexturedModalRect(guiLeft + 164, guiTop + 25 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
drawTexturedModalRect(guiWidth + 164, guiHeight + 25 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
// Reset
boolean mouseOver = xAxis >= 33 && xAxis <= 46 && yAxis >= 17 && yAxis <= 30;
drawTexturedModalRect(guiLeft + 33, guiTop + 17, 180, mouseOver? 0: 14, 14, 14);
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 47 && yAxis <= 61)
{
drawTexturedModalRect(guiWidth + 147, guiHeight + 47, 176 + 4, 0, 14, 14);
}
else {
drawTexturedModalRect(guiWidth + 147, guiHeight + 47, 176 + 4, 14, 14, 14);
}
// Auto eject
mouseOver = xAxis >= 33 && xAxis <= 46 && yAxis >= 32 && yAxis <= 45;
drawTexturedModalRect(guiLeft + 33, guiTop + 32, tileEntity.doEject ? 194 : 180, mouseOver? 28: 42, 14, 14);
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 63 && yAxis <= 77)
{
drawTexturedModalRect(guiWidth + 147, guiHeight + 63, 176 + 4 + 14, 0, 14, 14);
}
else {
drawTexturedModalRect(guiWidth + 147, guiHeight + 63, 176 + 4 + 14, 14, 14, 14);
}
// Auto pull
mouseOver = xAxis >= 33 && xAxis <= 46 && yAxis >= 48 && yAxis <= 61;
drawTexturedModalRect(guiLeft + 33, guiTop + 48, tileEntity.doPull ? 194 : 180, mouseOver? 56: 70, 14, 14);
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 47 && yAxis <= 61)
{
drawTexturedModalRect(guiWidth + 131, guiHeight + 47, 176 + 4 + 28, 0, 14, 14);
}
else {
drawTexturedModalRect(guiWidth + 131, guiHeight + 47, 176 + 4 + 28, 14, 14, 14);
}
// Silk touch
mouseOver = xAxis >= 33 && xAxis <= 46 && yAxis >= 63 && yAxis <= 76;
drawTexturedModalRect(guiLeft + 33, guiTop + 63, tileEntity.silkTouch ? 194 : 180, mouseOver? 84: 98, 14, 14);
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 63 && yAxis <= 77)
{
drawTexturedModalRect(guiWidth + 131, guiHeight + 63, 176 + 4 + 42, 0, 14, 14);
}
else {
drawTexturedModalRect(guiWidth + 131, guiHeight + 63, 176 + 4 + 42, 14, 14, 14);
}
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}
@ -285,11 +294,10 @@ public class GuiDigitalMiner extends GuiMekanism
if(button == 0)
{
int xAxis = mouseX - guiLeft;
int yAxis = mouseY - guiTop;
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
// Auto eject
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 32 && yAxis <= 45)
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 47 && yAxis <= 61)
{
SoundHandler.playSound("gui.button.press");
@ -299,8 +307,7 @@ public class GuiDigitalMiner extends GuiMekanism
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
// Auto pull
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 48 && yAxis <= 61)
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 63 && yAxis <= 77)
{
SoundHandler.playSound("gui.button.press");
@ -310,8 +317,7 @@ public class GuiDigitalMiner extends GuiMekanism
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
// Reset
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 17 && yAxis <= 30)
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 47 && yAxis <= 61)
{
SoundHandler.playSound("gui.button.press");
@ -321,8 +327,7 @@ public class GuiDigitalMiner extends GuiMekanism
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
// Silk touch
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 63 && yAxis <= 76)
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 63 && yAxis <= 77)
{
SoundHandler.playSound("gui.button.press");

View file

@ -36,14 +36,11 @@ public class GuiElectricMachine extends GuiMekanism
super(tentity, new ContainerElectricMachine(inventory, tentity));
tileEntity = tentity;
xSize = 176;
ySize = 186;
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation, xSize, 63));
guiElements.add(new GuiUpgradeTab(this, tileEntity, tileEntity.guiLocation, xSize, 5));
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, tileEntity.guiLocation,-26, 5));
guiElements.add(new GuiTransporterConfigTab(this, tileEntity, tileEntity.guiLocation,-26, 34));
guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 7, 35));
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiUpgradeTab(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiSideConfigurationTab(this, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiTransporterConfigTab(this, 34, tileEntity, tileEntity.guiLocation));
guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 164, 15));
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
@ -51,11 +48,11 @@ public class GuiElectricMachine extends GuiMekanism
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyPerTick);
return ListUtils.asList(MekanismUtils.localize("gui.using") + ": " + multiplier + "/t", MekanismUtils.localize("gui.needed") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
}
}, this, tileEntity.guiLocation,-26, 63));
}, this, tileEntity.guiLocation));
guiElements.add(new GuiSlot(SlotType.INPUT, this, tileEntity.guiLocation, 39, 38));
guiElements.add(new GuiSlot(SlotType.POWER, this, tileEntity.guiLocation, 13, 71).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, tileEntity.guiLocation, 111, 34));
guiElements.add(new GuiSlot(SlotType.INPUT, this, tileEntity.guiLocation, 55, 16));
guiElements.add(new GuiSlot(SlotType.POWER, this, tileEntity.guiLocation, 55, 52).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, tileEntity.guiLocation, 111, 30));
guiElements.add(new GuiProgress(new IProgressInfoHandler()
{
@ -64,7 +61,7 @@ public class GuiElectricMachine extends GuiMekanism
{
return tileEntity.getScaledProgress();
}
}, getProgressType(), this, tileEntity.guiLocation, 57, 39));
}, getProgressType(), this, tileEntity.guiLocation, 77, 37));
}
public ProgressBar getProgressType()
@ -86,7 +83,9 @@ public class GuiElectricMachine extends GuiMekanism
{
mc.renderEngine.bindTexture(tileEntity.guiLocation);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}

View file

@ -17,6 +17,6 @@ public class GuiEnrichmentChamber extends GuiElectricMachine
@Override
public ProgressBar getProgressType()
{
return ProgressBar.ENRICH;
return ProgressBar.BLUE;
}
}

View file

@ -79,8 +79,8 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper
{
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
int xAxis = mouseX - guiLeft;
int yAxis = mouseY - guiTop;
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
for(GuiElement element : guiElements)
{
@ -150,20 +150,23 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper
@Override
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
{
int xAxis = mouseX - guiLeft;
int yAxis = mouseY - guiTop;
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
int xAxis = mouseX - guiWidth;
int yAxis = mouseY - guiHeight;
for(GuiElement element : guiElements)
{
element.renderBackground(xAxis, yAxis, guiLeft, guiTop);
element.renderBackground(xAxis, yAxis, guiWidth, guiHeight);
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int button)
{
int xAxis = mouseX - guiLeft;
int yAxis = mouseY - guiTop;
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
for(GuiElement element : guiElements)
{
@ -227,8 +230,8 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper
{
super.mouseClickMove(mouseX, mouseY, button, ticks);
int xAxis = mouseX - guiLeft;
int yAxis = mouseY - guiTop;
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
for(GuiElement element : guiElements)
{
@ -241,8 +244,8 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper
{
super.mouseMovedOrUp(mouseX, mouseY, type);
int xAxis = mouseX - guiLeft;
int yAxis = mouseY - guiTop;
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
for(GuiElement element : guiElements)
{
@ -257,12 +260,12 @@ public abstract class GuiMekanism extends GuiContainer implements IGuiWrapper
public int getXPos()
{
return guiLeft;
return (width - xSize) / 2;
}
public int getYPos()
{
return guiTop;
return (height - ySize) / 2;
}
protected FontRenderer getFontRenderer()

View file

@ -17,6 +17,6 @@ public class GuiOsmiumCompressor extends GuiAdvancedElectricMachine
@Override
public ProgressBar getProgressType()
{
return ProgressBar.COMPRESS;
return ProgressBar.RED;
}
}

View file

@ -17,6 +17,6 @@ public class GuiPrecisionSawmill extends GuiChanceMachine
@Override
public ProgressBar getProgressType()
{
return ProgressBar.SAW;
return ProgressBar.PURPLE;
}
}

View file

@ -2,6 +2,8 @@ package mekanism.client.gui.element;
import java.util.List;
import org.lwjgl.opengl.GL11;
import mekanism.client.gui.IGuiWrapper;
import mekanism.common.ObfuscatedNames;
import mekanism.common.util.MekanismUtils;
@ -9,9 +11,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import codechicken.lib.vec.Rectangle4i;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -19,11 +18,6 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public abstract class GuiElement
{
protected int lmntLeft = 0;
protected int lmntTop = 0;
protected int lmntWidth = 26;
protected int lmntHeight = 26;
public static Minecraft mc = Minecraft.getMinecraft();
public ResourceLocation RESOURCE;
@ -133,10 +127,7 @@ public abstract class GuiElement
public void mouseMovedOrUp(int x, int y, int type) {}
public Rectangle4i getBounds( int guiLeft, int guiTop )
{
return new Rectangle4i(guiLeft + lmntLeft, guiTop + lmntTop, lmntWidth, lmntHeight);
}
public abstract Rectangle4i getBounds(int guiWidth, int guiHeight);
public abstract void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight);

View file

@ -8,6 +8,7 @@ import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import codechicken.lib.vec.Rectangle4i;
@SideOnly(Side.CLIENT)
public class GuiEnergyInfo extends GuiElement
@ -18,20 +19,13 @@ public class GuiEnergyInfo extends GuiElement
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiEnergyInfo.png"), gui, def);
lmntLeft = -26;
lmntTop = 138;
infoHandler = handler;
}
public GuiEnergyInfo(IInfoHandler handler, IGuiWrapper gui, ResourceLocation def, int guiLeft, int guiTop)
@Override
public Rectangle4i getBounds(int guiWidth, int guiHeight)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiEnergyInfo.png"), gui, def);
lmntLeft = guiLeft;
lmntTop = guiTop;
infoHandler = handler;
return new Rectangle4i(guiWidth - 26, guiHeight + 138, 26, 26);
}
public static interface IInfoHandler
@ -40,11 +34,11 @@ public class GuiEnergyInfo extends GuiElement
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiLeft, int guiTop)
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiLeft + lmntLeft, guiTop + lmntTop, 0, 0, lmntWidth, lmntHeight);
guiObj.drawTexturedRect(guiWidth - 26, guiHeight + 138, 0, 0, 26, 26);
mc.renderEngine.bindTexture(defaultLocation);
}
@ -52,7 +46,7 @@ public class GuiEnergyInfo extends GuiElement
@Override
public void renderForeground(int xAxis, int yAxis)
{
if(xAxis >= lmntLeft + 5 && xAxis <= lmntLeft + 23 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 142 && yAxis <= 160)
{
displayTooltips(infoHandler.getInfo(), xAxis, yAxis);
}

View file

@ -12,12 +12,17 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiPowerBar extends GuiElement
{
private int xLocation;
private int yLocation;
private int width = 6;
private int height = 56;
private int innerOffsetY = 2;
private TileEntityElectricBlock tileEntity;
private IPowerInfoHandler handler;
public GuiPowerBar(IGuiWrapper gui, TileEntityElectricBlock tile, ResourceLocation def, int guiLeft, int guiTop)
public GuiPowerBar(IGuiWrapper gui, TileEntityElectricBlock tile, ResourceLocation def, int x, int y)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiPowerBar.png"), gui, def);
@ -37,28 +42,24 @@ public class GuiPowerBar extends GuiElement
}
};
lmntLeft = guiLeft;
lmntTop = guiTop;
lmntWidth = 6;
lmntHeight = 54;
xLocation = x;
yLocation = y;
}
public GuiPowerBar(IGuiWrapper gui, IPowerInfoHandler h, ResourceLocation def, int guiLeft, int guiTop)
public GuiPowerBar(IGuiWrapper gui, IPowerInfoHandler h, ResourceLocation def, int x, int y)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiPowerBar.png"), gui, def);
handler = h;
lmntLeft = guiLeft;
lmntTop = guiTop;
lmntWidth = 6;
lmntHeight = 54;
xLocation = x;
yLocation = y;
}
@Override
public Rectangle4i getBounds(int guiLeft, int guiTop)
public Rectangle4i getBounds(int guiWidth, int guiHeight)
{
return new Rectangle4i(guiLeft + lmntLeft, guiTop + lmntTop, lmntWidth, lmntHeight);
return new Rectangle4i(guiWidth + xLocation, guiHeight + yLocation, width, height);
}
public static abstract class IPowerInfoHandler
@ -72,19 +73,16 @@ public class GuiPowerBar extends GuiElement
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiLeft, int guiTop)
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiLeft + lmntLeft, guiTop + lmntTop, 0, 0, lmntWidth, lmntHeight);
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation, 0, 0, width, height);
if(handler.getLevel() > 0)
{
int barX = lmntLeft + 1;
int barH = (int)(handler.getLevel()*52);
int barY = lmntTop + 1 + 52 - barH;
int barV = (int)((1.0 - handler.getLevel())*104);
guiObj.drawTexturedRect(guiLeft + barX, guiTop + barY, 6, barV, 4, barH);
int displayInt = (int)(handler.getLevel()*52) + innerOffsetY;
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation + height - displayInt, 6, height - displayInt, width, displayInt);
}
mc.renderEngine.bindTexture(defaultLocation);
@ -95,7 +93,7 @@ public class GuiPowerBar extends GuiElement
{
mc.renderEngine.bindTexture(RESOURCE);
if(handler.getTooltip() != null && xAxis >= lmntLeft && xAxis <= lmntLeft + lmntWidth && yAxis >= lmntTop && yAxis <= lmntTop + lmntHeight)
if(handler.getTooltip() != null && xAxis >= xLocation && xAxis <= xLocation + width && yAxis >= yLocation && yAxis <= yLocation + height)
{
displayTooltip(handler.getTooltip(), xAxis, yAxis);
}

View file

@ -71,26 +71,20 @@ public class GuiProgress extends GuiElement
public enum ProgressBar
{
BLUE(54, 18, 0, 0),
YELLOW(54, 18, 0, 18),
RED(54, 18, 0, 36),
GREEN(54, 18, 0, 54),
PURPLE(54, 18, 0, 72),
STONE(54, 18, 0, 90),
CRUSH(54, 18, 0, 108),
BLUE(28, 11, 0, 0),
YELLOW(28, 11, 0, 11),
RED(28, 11, 0, 22),
GREEN(28, 11, 0, 33),
PURPLE(28, 11, 0, 44),
STONE(28, 11, 0, 55),
CRUSH(28, 11, 0, 66),
LARGE_RIGHT(52, 10, 128, 0),
LARGE_LEFT(52, 10, 128, 10),
MEDIUM(36, 10, 128, 20),
SMALL_RIGHT(32, 10, 128, 30),
SMALL_LEFT(32, 10, 128, 40),
BI(20, 8, 128, 50),
SAW(54, 18, 0, 126),
ENRICH(54, 18, 0, 144),
COMPRESS(54, 18, 0, 162),
COMBINE(54, 18, 0, 180),
CRUSH2(54, 18, 0, 198);
BI(20, 8, 128, 50);
public int width;
public int height;

View file

@ -11,6 +11,7 @@ import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import codechicken.lib.vec.Rectangle4i;
public class GuiRedstoneControl extends GuiElement
{
@ -20,34 +21,32 @@ public class GuiRedstoneControl extends GuiElement
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiRedstoneControl.png"), gui, def);
lmntLeft = 176;
lmntTop = 138;
tileEntity = tile;
}
public GuiRedstoneControl( IGuiWrapper gui, TileEntity tile, ResourceLocation def, int guiLeft, int guiTop )
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiRedstoneControl.png"), gui, def );
lmntLeft = guiLeft;
lmntTop = guiTop;
tileEntity = tile;
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiLeft, int guiTop)
public Rectangle4i getBounds(int guiWidth, int guiHeight)
{
return new Rectangle4i(guiWidth + 176, guiHeight + 138, 26, 26);
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiLeft + lmntLeft, guiTop + lmntTop, 0, 0, lmntWidth, lmntHeight);
guiObj.drawTexturedRect(guiWidth + 176, guiHeight + 138, 0, 0, 26, 26);
IRedstoneControl control = (IRedstoneControl)tileEntity;
int renderX = 26 + (18*control.getControlType().ordinal());
boolean mouseOver = xAxis >= lmntLeft + 3 && xAxis <= lmntLeft + 21 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22;
guiObj.drawTexturedRect(guiLeft + lmntLeft + 3, guiTop + lmntTop + 4, renderX, mouseOver? 0: 18, 18, 18);
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 142 && yAxis <= 160)
{
guiObj.drawTexturedRect(guiWidth + 179, guiHeight + 142, renderX, 0, 18, 18);
}
else {
guiObj.drawTexturedRect(guiWidth + 179, guiHeight + 142, renderX, 18, 18, 18);
}
mc.renderEngine.bindTexture(defaultLocation);
}
@ -59,7 +58,7 @@ public class GuiRedstoneControl extends GuiElement
IRedstoneControl control = (IRedstoneControl)tileEntity;
if(xAxis >= lmntLeft + 3 && xAxis <= lmntLeft + 21 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 142 && yAxis <= 160)
{
displayTooltip(control.getControlType().getDisplay(), xAxis, yAxis);
}
@ -77,7 +76,7 @@ public class GuiRedstoneControl extends GuiElement
if(button == 0)
{
if(xAxis >= lmntLeft + 3 && xAxis <= lmntLeft + 21 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 142 && yAxis <= 160)
{
RedstoneControl current = control.getControlType();
int ordinalToSet = current.ordinal() < (RedstoneControl.values().length-1) ? current.ordinal()+1 : 0;

View file

@ -11,6 +11,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import codechicken.lib.vec.Rectangle4i;
@SideOnly(Side.CLIENT)
public class GuiSideConfigurationTab extends GuiElement
@ -21,31 +22,29 @@ public class GuiSideConfigurationTab extends GuiElement
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiConfigurationTab.png"), gui, def);
lmntLeft = -26;
lmntTop = 6;
tileEntity = tile;
}
public GuiSideConfigurationTab(IGuiWrapper gui, TileEntity tile, ResourceLocation def, int guiLeft, int guiTop)
@Override
public Rectangle4i getBounds(int guiWidth, int guiHeight)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiConfigurationTab.png"), gui, def);
lmntLeft = guiLeft;
lmntTop = guiTop;
tileEntity = tile;
return new Rectangle4i(guiWidth - 26, guiHeight + 6, 26, 26);
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiLeft, int guiTop)
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiLeft + lmntLeft, guiTop + lmntTop, 0, 0, lmntWidth, lmntHeight);
boolean mouseOver = xAxis >= lmntLeft + 5 && xAxis <= lmntLeft + 23 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22;
guiObj.drawTexturedRect(guiWidth - 26, guiHeight + 6, 0, 0, 26, 26);
guiObj.drawTexturedRect(guiLeft + lmntLeft + 5, guiTop + lmntTop + 4, 26, mouseOver? 0: 18, 18, 18);
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
{
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + 10, 26, 0, 18, 18);
}
else {
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + 10, 26, 18, 18, 18);
}
mc.renderEngine.bindTexture(defaultLocation);
}
@ -55,7 +54,7 @@ public class GuiSideConfigurationTab extends GuiElement
{
mc.renderEngine.bindTexture(RESOURCE);
if(xAxis >= lmntLeft + 5 && xAxis <= lmntLeft + 23 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
{
displayTooltip(MekanismUtils.localize("gui.configuration.side"), xAxis, yAxis);
}
@ -71,7 +70,7 @@ public class GuiSideConfigurationTab extends GuiElement
{
if(button == 0)
{
if(xAxis >= lmntLeft + 5 && xAxis <= lmntLeft + 23 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
{
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 9));
SoundHandler.playSound("gui.button.press");

View file

@ -4,23 +4,30 @@ import mekanism.client.gui.IGuiWrapper;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.util.ResourceLocation;
import codechicken.lib.vec.Rectangle4i;
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, IGuiWrapper gui, ResourceLocation def, int guiLeft, int guiTop)
public GuiSlot(SlotType type, IGuiWrapper gui, ResourceLocation def, int x, int y)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiSlot.png"), gui, def);
lmntLeft = guiLeft;
lmntTop = guiTop;
xLocation = x;
yLocation = y;
lmntWidth = type.width;
lmntHeight = type.height;
width = type.width;
height = type.height;
textureX = type.textureX;
textureY = type.textureY;
@ -32,19 +39,25 @@ public class GuiSlot extends GuiElement
return this;
}
@Override
public Rectangle4i getBounds(int guiWidth, int guiHeight)
{
return new Rectangle4i(guiWidth + xLocation, guiHeight + yLocation, width, height);
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiWidth + lmntLeft, guiHeight + lmntTop, textureX, textureY, lmntWidth, lmntHeight);
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation, textureX, textureY, width, height);
if(overlay != null)
{
int w = overlay.width;
int h = overlay.height;
int xLocationOverlay = lmntLeft + (lmntWidth-w)/2;
int yLocationOverlay = lmntTop + (lmntHeight-h)/2;
int xLocationOverlay = xLocation + (width-w)/2;
int yLocationOverlay = yLocation + (height-h)/2;
guiObj.drawTexturedRect(guiWidth + xLocationOverlay, guiHeight + yLocationOverlay, overlay.textureX, overlay.textureY, w, h);
}

View file

@ -9,6 +9,7 @@ import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import codechicken.lib.vec.Rectangle4i;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -16,36 +17,36 @@ import cpw.mods.fml.relauncher.SideOnly;
public class GuiTransporterConfigTab extends GuiElement
{
public TileEntity tileEntity;
public int yPos;
public GuiTransporterConfigTab(IGuiWrapper gui, int y, TileEntity tile, ResourceLocation def)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiTransporterConfigTab.png"), gui, def);
lmntLeft = -26;
lmntTop = y;
yPos = y;
tileEntity = tile;
}
public GuiTransporterConfigTab(IGuiWrapper gui, TileEntity tile, ResourceLocation def, int guiLeft, int guiTop)
@Override
public Rectangle4i getBounds(int guiWidth, int guiHeight)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiTransporterConfigTab.png"), gui, def);
lmntLeft = guiLeft;
lmntTop = guiTop;
tileEntity = tile;
return new Rectangle4i(guiWidth - 26, guiHeight + yPos, 26, 26);
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiLeft, int guiTop)
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiLeft + lmntLeft, guiTop + lmntTop, 0, 0, lmntWidth, lmntHeight);
boolean mouseOver = xAxis >= lmntLeft + 5 && xAxis <= lmntLeft + 23 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22;
guiObj.drawTexturedRect(guiWidth - 26, guiHeight + yPos, 0, 0, 26, 26);
guiObj.drawTexturedRect(guiLeft + lmntLeft + 5, guiTop + lmntTop + 4, 26, mouseOver? 0: 18, 18, 18);
if(xAxis >= -21 && xAxis <= -3 && yAxis >= yPos+4 && yAxis <= yPos+22)
{
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + yPos+4, 26, 0, 18, 18);
}
else {
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + yPos+4, 26, 18, 18, 18);
}
mc.renderEngine.bindTexture(defaultLocation);
}
@ -55,7 +56,7 @@ public class GuiTransporterConfigTab extends GuiElement
{
mc.renderEngine.bindTexture(RESOURCE);
if(xAxis >= lmntLeft + 5 && xAxis <= lmntLeft + 23 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
if(xAxis >= -21 && xAxis <= -3 && yAxis >= yPos+4 && yAxis <= yPos+22)
{
displayTooltip(MekanismUtils.localize("gui.configuration.transporter"), xAxis, yAxis);
}
@ -71,7 +72,7 @@ public class GuiTransporterConfigTab extends GuiElement
{
if(button == 0)
{
if(xAxis >= lmntLeft + 5 && xAxis <= lmntLeft + 23 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
if(xAxis >= -21 && xAxis <= -3 && yAxis >= yPos+4 && yAxis <= yPos+22)
{
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 51));
SoundHandler.playSound("gui.button.press");

View file

@ -9,6 +9,7 @@ import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import codechicken.lib.vec.Rectangle4i;
public class GuiUpgradeTab extends GuiElement
{
@ -18,32 +19,29 @@ public class GuiUpgradeTab extends GuiElement
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiUpgradeTab.png"), gui, def);
lmntLeft = 176;
lmntTop = 6;
tileEntity = tile;
}
public GuiUpgradeTab(IGuiWrapper gui, TileEntity tile, ResourceLocation def, int guiLeft, int guiTop)
@Override
public Rectangle4i getBounds(int guiWidth, int guiHeight)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiUpgradeTab.png"), gui, def);
lmntLeft = guiLeft;
lmntTop = guiTop;
tileEntity = tile;
return new Rectangle4i(guiWidth + 176, guiHeight + 6, 26, 26);
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiLeft, int guiTop)
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiLeft + lmntLeft, guiTop + lmntTop, 0, 0, lmntWidth, lmntHeight);
guiObj.drawTexturedRect(guiWidth + 176, guiHeight + 6, 0, 0, 26, 26);
boolean mouseOver = xAxis >= lmntLeft + 3 && xAxis <= lmntLeft + 21 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22;
guiObj.drawTexturedRect(guiLeft + lmntLeft + 3, guiTop + lmntTop + 4, 26, mouseOver? 0: 18, 18, 18);
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
{
guiObj.drawTexturedRect(guiWidth + 179, guiHeight + 10, 26, 0, 18, 18);
}
else {
guiObj.drawTexturedRect(guiWidth + 179, guiHeight + 10, 26, 18, 18, 18);
}
mc.renderEngine.bindTexture(defaultLocation);
}
@ -53,7 +51,7 @@ public class GuiUpgradeTab extends GuiElement
{
mc.renderEngine.bindTexture(RESOURCE);
if(xAxis >= lmntLeft + 3 && xAxis <= lmntLeft + 21 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
{
displayTooltip(MekanismUtils.localize("gui.upgrades"), xAxis, yAxis);
}
@ -69,7 +67,7 @@ public class GuiUpgradeTab extends GuiElement
{
if(button == 0)
{
if(xAxis >= lmntLeft + 3 && xAxis <= lmntLeft + 21 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 10 && yAxis <= 28)
{
Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 43));
SoundHandler.playSound("gui.button.press");

View file

@ -17,31 +17,29 @@ public class GuiVisualsTab extends GuiElement
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiVisualsTab.png"), gui, def);
lmntLeft = -26;
lmntTop = 5;
tileEntity = tile;
}
public GuiVisualsTab(IGuiWrapper gui, TileEntityDigitalMiner tile, ResourceLocation def, int guiLeft, int guiTop)
@Override
public Rectangle4i getBounds(int guiWidth, int guiHeight)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiVisualsTab.png"), gui, def);
lmntLeft = guiLeft;
lmntTop = guiTop;
tileEntity = tile;
return new Rectangle4i(guiWidth - 26, guiHeight + 6, 26, 26);
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiLeft, int guiTop)
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiLeft + lmntLeft, guiTop + lmntTop, 0, 0, lmntWidth, lmntHeight);
boolean mouseOver = xAxis >= lmntLeft + 5 && xAxis <= lmntLeft + 23 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22;
guiObj.drawTexturedRect(guiLeft + lmntLeft + 5, guiTop + lmntTop + 4, 26, mouseOver? 0: 18, 18, 18);
guiObj.drawTexturedRect(guiWidth - 26, guiHeight + 6, 0, 0, 26, 26);
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
{
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + 10, 26, 0, 18, 18);
}
else {
guiObj.drawTexturedRect(guiWidth - 21, guiHeight + 10, 26, 18, 18, 18);
}
mc.renderEngine.bindTexture(defaultLocation);
}
@ -51,7 +49,7 @@ public class GuiVisualsTab extends GuiElement
{
mc.renderEngine.bindTexture(RESOURCE);
if(xAxis >= lmntLeft + 5 && xAxis <= lmntLeft + 23 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
{
displayTooltip(MekanismUtils.localize("gui.visuals") + ": " + LangUtils.transOnOff(tileEntity.clientRendering), xAxis, yAxis);
}
@ -67,7 +65,7 @@ public class GuiVisualsTab extends GuiElement
{
if(button == 0)
{
if(xAxis >= lmntLeft + 5 && xAxis <= lmntLeft + 23 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
{
tileEntity.clientRendering = !tileEntity.clientRendering;
SoundHandler.playSound("gui.button.press");

View file

@ -21,10 +21,10 @@ public class ContainerAdvancedElectricMachine extends Container
public ContainerAdvancedElectricMachine(InventoryPlayer inventory, TileEntityAdvancedElectricMachine tentity)
{
tileEntity = tentity;
addSlotToContainer(new Slot(tentity, 0, 40, 21));
addSlotToContainer(new Slot(tentity, 1, 40, 57));
addSlotToContainer(new SlotOutput(tentity, 2, 116, 39));
addSlotToContainer(new SlotDischarge(tentity, 3, 14, 72));
addSlotToContainer(new Slot(tentity, 0, 56, 17));
addSlotToContainer(new Slot(tentity, 1, 56, 53));
addSlotToContainer(new SlotOutput(tentity, 2, 116, 35));
addSlotToContainer(new SlotDischarge(tentity, 3, 31, 35));
int slotY;
@ -32,13 +32,13 @@ public class ContainerAdvancedElectricMachine extends Container
{
for(int slotX = 0; slotX < 9; slotX++)
{
addSlotToContainer(new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, 104 + slotY * 18));
addSlotToContainer(new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, 84 + slotY * 18));
}
}
for(slotY = 0; slotY < 9; slotY++)
{
addSlotToContainer(new Slot(inventory, slotY, 8 + slotY * 18, 162));
addSlotToContainer(new Slot(inventory, slotY, 8 + slotY * 18, 142));
}
tileEntity.open(inventory.player);

View file

@ -20,10 +20,10 @@ public class ContainerChanceMachine extends Container
public ContainerChanceMachine(InventoryPlayer inventory, TileEntityChanceMachine tentity)
{
tileEntity = tentity;
addSlotToContainer(new Slot(tentity, 0, 32, 39));
addSlotToContainer(new SlotDischarge(tentity, 1, 14, 72));
addSlotToContainer(new SlotOutput(tentity, 2, 107, 39));
addSlotToContainer(new SlotOutput(tentity, 4, 125, 39));
addSlotToContainer(new Slot(tentity, 0, 56, 17));
addSlotToContainer(new SlotDischarge(tentity, 1, 56, 53));
addSlotToContainer(new SlotOutput(tentity, 2, 116, 35));
addSlotToContainer(new SlotOutput(tentity, 4, 132, 35));
int slotY;
@ -31,13 +31,13 @@ public class ContainerChanceMachine extends Container
{
for(int slotX = 0; slotX < 9; slotX++)
{
addSlotToContainer(new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, 104 + slotY * 18));
addSlotToContainer(new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, 84 + slotY * 18));
}
}
for(slotY = 0; slotY < 9; slotY++)
{
addSlotToContainer(new Slot(inventory, slotY, 8 + slotY * 18, 162));
addSlotToContainer(new Slot(inventory, slotY, 8 + slotY * 18, 142));
}
tileEntity.open(inventory.player);

View file

@ -20,9 +20,9 @@ public class ContainerElectricMachine extends Container
public ContainerElectricMachine(InventoryPlayer inventory, TileEntityElectricMachine tentity)
{
tileEntity = tentity;
addSlotToContainer(new Slot(tentity, 0, 40, 39));
addSlotToContainer(new SlotDischarge(tentity, 1, 14, 72));
addSlotToContainer(new SlotOutput(tentity, 2, 116, 39));
addSlotToContainer(new Slot(tentity, 0, 56, 17));
addSlotToContainer(new SlotDischarge(tentity, 1, 56, 53));
addSlotToContainer(new SlotOutput(tentity, 2, 116, 35));
int slotY;
@ -30,13 +30,13 @@ public class ContainerElectricMachine extends Container
{
for(int slotX = 0; slotX < 9; slotX++)
{
addSlotToContainer(new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, 104 + slotY * 18));
addSlotToContainer(new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, 84 + slotY * 18));
}
}
for(slotY = 0; slotY < 9; slotY++)
{
addSlotToContainer(new Slot(inventory, slotY, 8 + slotY * 18, 162));
addSlotToContainer(new Slot(inventory, slotY, 8 + slotY * 18, 142));
}
tileEntity.open(inventory.player);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 988 B

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 898 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB