Merge pull request #2585 from TehStoneMan/development

Changes to GUI's
This commit is contained in:
Aidan 2015-04-25 11:21:12 -07:00
commit f5214cacec
34 changed files with 309 additions and 298 deletions

View file

@ -38,11 +38,14 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
super(tentity, new ContainerAdvancedElectricMachine(inventory, tentity));
tileEntity = tentity;
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));
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 GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
@ -50,12 +53,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));
}, this, tileEntity.guiLocation,-26, 63));
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 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 GuiProgress(new IProgressInfoHandler()
{
@ -64,7 +67,7 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
{
return tileEntity.getScaledProgress();
}
}, getProgressType(), this, tileEntity.guiLocation, 77, 37));
}, getProgressType(), this, tileEntity.guiLocation, 57, 39));
}
public ProgressBar getProgressType()
@ -75,13 +78,17 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
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);
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 >= 61 && xAxis <= 67 && yAxis >= 37 && yAxis <= 49)
if(xAxis >= 43 && xAxis <= 52 && yAxis >= 39 && yAxis <= 54)
{
drawCreativeTabHoveringText(tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas().getLocalizedName() + ": " + tileEntity.gasTank.getStored() : MekanismUtils.localize("gui.none"), xAxis, yAxis);
}
@ -94,16 +101,14 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
{
mc.renderEngine.bindTexture(tileEntity.guiLocation);
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);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int displayInt;
if(tileEntity.getScaledGasLevel(12) > 0)
{
displayInt = tileEntity.getScaledGasLevel(12);
displayGauge(61, 37 + 12 - displayInt, 6, displayInt, tileEntity.gasTank.getGas());
displayGauge(45, 41 + 12 - displayInt, 6, displayInt, tileEntity.gasTank.getGas());
}
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
@ -116,10 +121,7 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
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);
drawTexturedModelRectFromIcon(guiLeft + xPos, guiTop + 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,11 +36,14 @@ public class GuiChanceMachine extends GuiMekanism
super(tentity, new ContainerChanceMachine(inventory, tentity));
tileEntity = tentity;
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));
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 GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
@ -48,11 +51,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));
}, this, tileEntity.guiLocation,-26, 63));
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 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 GuiProgress(new IProgressInfoHandler()
{
@ -61,7 +64,7 @@ public class GuiChanceMachine extends GuiMekanism
{
return tileEntity.getScaledProgress();
}
}, getProgressType(), this, tileEntity.guiLocation, 77, 37));
}, getProgressType(), this, tileEntity.guiLocation, 49, 39));
}
public ProgressBar getProgressType()
@ -83,9 +86,7 @@ public class GuiChanceMachine extends GuiMekanism
{
mc.renderEngine.bindTexture(tileEntity.guiLocation);
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);
drawTexturedModalRect(guiLeft, guiTop, 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.STONE;
return ProgressBar.COMBINE;
}
}

View file

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

View file

@ -28,6 +28,7 @@ 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;
@ -43,15 +44,19 @@ 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;
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")));
//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 GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
@ -59,10 +64,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, MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.png")));
}, this, guiLocation,-26, 107));
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));
guiElements.add(new GuiSlot(SlotType.POWER, this, guiLocation, 13, 59).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, guiLocation, 13, 17));
ySize+=64;
}
@ -76,21 +81,21 @@ public class GuiDigitalMiner extends GuiMekanism
int guiHeight = (height - ySize) / 2;
buttonList.clear();
startButton = new GuiButton(0, guiWidth + 69, guiHeight + 17, 60, 20, MekanismUtils.localize("gui.start"));
startButton = new GuiButton(0, guiWidth + 49, guiHeight + 17, 60, 20, MekanismUtils.localize("gui.start"));
if(tileEntity.searcher.state != State.IDLE && tileEntity.running)
{
startButton.enabled = false;
}
stopButton = new GuiButton(1, guiWidth + 69, guiHeight + 37, 60, 20, MekanismUtils.localize("gui.stop"));
stopButton = new GuiButton(1, guiWidth + 49, guiHeight + 37, 60, 20, MekanismUtils.localize("gui.stop"));
if(tileEntity.searcher.state == State.IDLE || !tileEntity.running)
{
stopButton.enabled = false;
}
configButton = new GuiButton(2, guiWidth + 69, guiHeight + 57, 60, 20, MekanismUtils.localize("gui.config"));
configButton = new GuiButton(2, guiWidth + 49, guiHeight + 57, 60, 20, MekanismUtils.localize("gui.config"));
if(tileEntity.searcher.state != State.IDLE)
{
@ -160,21 +165,21 @@ public class GuiDigitalMiner extends GuiMekanism
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
int xAxis = mouseX - guiLeft;
int yAxis = mouseY - guiTop;
fontRendererObj.drawString(tileEntity.getInventoryName(), 69, 6, 0x404040);
fontRendererObj.drawString(tileEntity.getInventoryName(), 8, 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"), 9, 10, 0x00CD00);
fontRendererObj.drawString(tileEntity.searcher.state.desc, 9, 19, 0x00CD00);
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(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.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.digitalMiner.toMine") + ":", 9, 59, 0x00CD00);
fontRendererObj.drawString("" + tileEntity.clientToMine, 9, 68, 0x00CD00);
fontRendererObj.drawString(MekanismUtils.localize("gui.digitalMiner.toMine") + ":", 113, 59, 0x00CD00);
fontRendererObj.drawString("" + tileEntity.clientToMine, 113, 68, 0x00CD00);
if(tileEntity.missingStack != null)
{
@ -185,15 +190,15 @@ public class GuiDigitalMiner extends GuiMekanism
mc.getTextureManager().bindTexture(MekanismRenderer.getBlocksTexture());
itemRender.renderIcon(144, 27, MekanismRenderer.getColorIcon(EnumColor.DARK_RED), 16, 16);
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), tileEntity.missingStack, 144, 27);
itemRender.renderIcon(14, 18, MekanismRenderer.getColorIcon(EnumColor.DARK_RED), 16, 16);
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), tileEntity.missingStack, 14, 18);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
else {
mc.getTextureManager().bindTexture(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiSlot.png"));
drawTexturedModalRect(143, 26, SlotOverlay.CHECK.textureX, SlotOverlay.CHECK.textureY, 18, 18);
drawTexturedModalRect(13, 17, SlotOverlay.CHECK.textureX, SlotOverlay.CHECK.textureY, 18, 18);
}
if(xAxis >= 164 && xAxis <= 168 && yAxis >= 25 && yAxis <= 77)
@ -201,17 +206,19 @@ public class GuiDigitalMiner extends GuiMekanism
drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis);
}
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 47 && yAxis <= 61)
// Auto eject
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 32 && yAxis <= 45)
{
drawCreativeTabHoveringText(MekanismUtils.localize("gui.autoEject"), xAxis, yAxis);
}
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 63 && yAxis <= 77)
// Auto pull
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 48 && yAxis <= 61)
{
drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.autoPull"), xAxis, yAxis);
}
if(xAxis >= 144 && xAxis <= 160 && yAxis >= 27 && yAxis <= 43)
if(xAxis >= 13 && xAxis <= 30 && yAxis >= 17 && yAxis <= 34)
{
if(tileEntity.missingStack != null)
{
@ -222,12 +229,14 @@ public class GuiDigitalMiner extends GuiMekanism
}
}
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 47 && yAxis <= 61)
// Reset
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 17 && yAxis <= 30)
{
drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.reset"), xAxis, yAxis);
}
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 63 && yAxis <= 77)
// Silk touch
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 63 && yAxis <= 76)
{
drawCreativeTabHoveringText(MekanismUtils.localize("gui.digitalMiner.silkTouch"), xAxis, yAxis);
}
@ -240,49 +249,31 @@ public class GuiDigitalMiner extends GuiMekanism
{
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiDigitalMiner.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);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int xAxis = mouseX - guiWidth;
int yAxis = mouseY - guiHeight;
int xAxis = mouseX - guiLeft;
int yAxis = mouseY - guiTop;
int displayInt;
displayInt = tileEntity.getScaledEnergyLevel(52);
drawTexturedModalRect(guiWidth + 164, guiHeight + 25 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
drawTexturedModalRect(guiLeft + 164, guiTop + 25 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
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);
}
// 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 >= 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 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 >= 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);
}
// 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 >= 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);
}
// 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);
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}
@ -294,10 +285,11 @@ public class GuiDigitalMiner extends GuiMekanism
if(button == 0)
{
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
int xAxis = mouseX - guiLeft;
int yAxis = mouseY - guiTop;
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 47 && yAxis <= 61)
// Auto eject
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 32 && yAxis <= 45)
{
SoundHandler.playSound("gui.button.press");
@ -307,7 +299,8 @@ public class GuiDigitalMiner extends GuiMekanism
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
if(xAxis >= 147 && xAxis <= 161 && yAxis >= 63 && yAxis <= 77)
// Auto pull
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 48 && yAxis <= 61)
{
SoundHandler.playSound("gui.button.press");
@ -317,7 +310,8 @@ public class GuiDigitalMiner extends GuiMekanism
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 47 && yAxis <= 61)
// Reset
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 17 && yAxis <= 30)
{
SoundHandler.playSound("gui.button.press");
@ -327,7 +321,8 @@ public class GuiDigitalMiner extends GuiMekanism
Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data));
}
if(xAxis >= 131 && xAxis <= 145 && yAxis >= 63 && yAxis <= 77)
// Silk touch
if(xAxis >= 33 && xAxis <= 46 && yAxis >= 63 && yAxis <= 76)
{
SoundHandler.playSound("gui.button.press");

View file

@ -36,11 +36,14 @@ public class GuiElectricMachine extends GuiMekanism
super(tentity, new ContainerElectricMachine(inventory, tentity));
tileEntity = tentity;
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));
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 GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
@ -48,11 +51,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));
}, this, tileEntity.guiLocation,-26, 63));
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 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 GuiProgress(new IProgressInfoHandler()
{
@ -61,7 +64,7 @@ public class GuiElectricMachine extends GuiMekanism
{
return tileEntity.getScaledProgress();
}
}, getProgressType(), this, tileEntity.guiLocation, 77, 37));
}, getProgressType(), this, tileEntity.guiLocation, 57, 39));
}
public ProgressBar getProgressType()
@ -83,9 +86,7 @@ public class GuiElectricMachine extends GuiMekanism
{
mc.renderEngine.bindTexture(tileEntity.guiLocation);
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);
drawTexturedModalRect(guiLeft, guiTop, 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.BLUE;
return ProgressBar.ENRICH;
}
}

View file

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

View file

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

View file

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

View file

@ -2,8 +2,6 @@ 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;
@ -11,6 +9,9 @@ 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;
@ -18,6 +19,11 @@ 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;
@ -127,7 +133,10 @@ public abstract class GuiElement
public void mouseMovedOrUp(int x, int y, int type) {}
public abstract Rectangle4i getBounds(int guiWidth, int guiHeight);
public Rectangle4i getBounds( int guiLeft, int guiTop )
{
return new Rectangle4i(guiLeft + lmntLeft, guiTop + lmntTop, lmntWidth, lmntHeight);
}
public abstract void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight);

View file

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

View file

@ -12,17 +12,12 @@ 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 x, int y)
public GuiPowerBar(IGuiWrapper gui, TileEntityElectricBlock tile, ResourceLocation def, int guiLeft, int guiTop)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiPowerBar.png"), gui, def);
@ -42,24 +37,28 @@ public class GuiPowerBar extends GuiElement
}
};
xLocation = x;
yLocation = y;
lmntLeft = guiLeft;
lmntTop = guiTop;
lmntWidth = 6;
lmntHeight = 54;
}
public GuiPowerBar(IGuiWrapper gui, IPowerInfoHandler h, ResourceLocation def, int x, int y)
public GuiPowerBar(IGuiWrapper gui, IPowerInfoHandler h, ResourceLocation def, int guiLeft, int guiTop)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiPowerBar.png"), gui, def);
handler = h;
xLocation = x;
yLocation = y;
lmntLeft = guiLeft;
lmntTop = guiTop;
lmntWidth = 6;
lmntHeight = 54;
}
@Override
public Rectangle4i getBounds(int guiWidth, int guiHeight)
public Rectangle4i getBounds(int guiLeft, int guiTop)
{
return new Rectangle4i(guiWidth + xLocation, guiHeight + yLocation, width, height);
return new Rectangle4i(guiLeft + lmntLeft, guiTop + lmntTop, lmntWidth, lmntHeight);
}
public static abstract class IPowerInfoHandler
@ -73,16 +72,19 @@ public class GuiPowerBar extends GuiElement
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
public void renderBackground(int xAxis, int yAxis, int guiLeft, int guiTop)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation, 0, 0, width, height);
guiObj.drawTexturedRect(guiLeft + lmntLeft, guiTop + lmntTop, 0, 0, lmntWidth, lmntHeight);
if(handler.getLevel() > 0)
{
int displayInt = (int)(handler.getLevel()*52) + innerOffsetY;
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation + height - displayInt, 6, height - displayInt, width, displayInt);
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);
}
mc.renderEngine.bindTexture(defaultLocation);
@ -93,7 +95,7 @@ public class GuiPowerBar extends GuiElement
{
mc.renderEngine.bindTexture(RESOURCE);
if(handler.getTooltip() != null && xAxis >= xLocation && xAxis <= xLocation + width && yAxis >= yLocation && yAxis <= yLocation + height)
if(handler.getTooltip() != null && xAxis >= lmntLeft && xAxis <= lmntLeft + lmntWidth && yAxis >= lmntTop && yAxis <= lmntTop + lmntHeight)
{
displayTooltip(handler.getTooltip(), xAxis, yAxis);
}

View file

@ -71,20 +71,26 @@ public class GuiProgress extends GuiElement
public enum ProgressBar
{
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),
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),
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);
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);
public int width;
public int height;

View file

@ -11,7 +11,6 @@ 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
{
@ -21,32 +20,34 @@ 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 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)
public void renderBackground(int xAxis, int yAxis, int guiLeft, int guiTop)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiWidth + 176, guiHeight + 138, 0, 0, 26, 26);
guiObj.drawTexturedRect(guiLeft + lmntLeft, guiTop + lmntTop, 0, 0, lmntWidth, lmntHeight);
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;
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);
}
guiObj.drawTexturedRect(guiLeft + lmntLeft + 3, guiTop + lmntTop + 4, renderX, mouseOver? 0: 18, 18, 18);
mc.renderEngine.bindTexture(defaultLocation);
}
@ -58,7 +59,7 @@ public class GuiRedstoneControl extends GuiElement
IRedstoneControl control = (IRedstoneControl)tileEntity;
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 142 && yAxis <= 160)
if(xAxis >= lmntLeft + 3 && xAxis <= lmntLeft + 21 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
{
displayTooltip(control.getControlType().getDisplay(), xAxis, yAxis);
}
@ -76,7 +77,7 @@ public class GuiRedstoneControl extends GuiElement
if(button == 0)
{
if(xAxis >= 179 && xAxis <= 197 && yAxis >= 142 && yAxis <= 160)
if(xAxis >= lmntLeft + 3 && xAxis <= lmntLeft + 21 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
{
RedstoneControl current = control.getControlType();
int ordinalToSet = current.ordinal() < (RedstoneControl.values().length-1) ? current.ordinal()+1 : 0;

View file

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

View file

@ -4,30 +4,23 @@ 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 x, int y)
public GuiSlot(SlotType type, IGuiWrapper gui, ResourceLocation def, int guiLeft, int guiTop)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiSlot.png"), gui, def);
xLocation = x;
yLocation = y;
lmntLeft = guiLeft;
lmntTop = guiTop;
width = type.width;
height = type.height;
lmntWidth = type.width;
lmntHeight = type.height;
textureX = type.textureX;
textureY = type.textureY;
@ -39,25 +32,19 @@ 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 + xLocation, guiHeight + yLocation, textureX, textureY, width, height);
guiObj.drawTexturedRect(guiWidth + lmntLeft, guiHeight + lmntTop, textureX, textureY, lmntWidth, lmntHeight);
if(overlay != null)
{
int w = overlay.width;
int h = overlay.height;
int xLocationOverlay = xLocation + (width-w)/2;
int yLocationOverlay = yLocation + (height-h)/2;
int xLocationOverlay = lmntLeft + (lmntWidth-w)/2;
int yLocationOverlay = lmntTop + (lmntHeight-h)/2;
guiObj.drawTexturedRect(guiWidth + xLocationOverlay, guiHeight + yLocationOverlay, overlay.textureX, overlay.textureY, w, h);
}

View file

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

View file

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

View file

@ -17,29 +17,31 @@ 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)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiVisualsTab.png"), gui, def);
lmntLeft = guiLeft;
lmntTop = guiTop;
tileEntity = tile;
}
@Override
public Rectangle4i getBounds(int guiWidth, int guiHeight)
{
return new Rectangle4i(guiWidth - 26, guiHeight + 6, 26, 26);
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
public void renderBackground(int xAxis, int yAxis, int guiLeft, int guiTop)
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiWidth - 26, guiHeight + 6, 0, 0, 26, 26);
guiObj.drawTexturedRect(guiLeft + lmntLeft, guiTop + lmntTop, 0, 0, lmntWidth, lmntHeight);
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);
}
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);
mc.renderEngine.bindTexture(defaultLocation);
}
@ -49,7 +51,7 @@ public class GuiVisualsTab extends GuiElement
{
mc.renderEngine.bindTexture(RESOURCE);
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
if(xAxis >= lmntLeft + 5 && xAxis <= lmntLeft + 23 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
{
displayTooltip(MekanismUtils.localize("gui.visuals") + ": " + LangUtils.transOnOff(tileEntity.clientRendering), xAxis, yAxis);
}
@ -65,7 +67,7 @@ public class GuiVisualsTab extends GuiElement
{
if(button == 0)
{
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 10 && yAxis <= 28)
if(xAxis >= lmntLeft + 5 && xAxis <= lmntLeft + 23 && yAxis >= lmntTop + 4 && yAxis <= lmntTop + 22)
{
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, 56, 17));
addSlotToContainer(new Slot(tentity, 1, 56, 53));
addSlotToContainer(new SlotOutput(tentity, 2, 116, 35));
addSlotToContainer(new SlotDischarge(tentity, 3, 31, 35));
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));
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, 84 + slotY * 18));
addSlotToContainer(new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, 104 + slotY * 18));
}
}
for(slotY = 0; slotY < 9; slotY++)
{
addSlotToContainer(new Slot(inventory, slotY, 8 + slotY * 18, 142));
addSlotToContainer(new Slot(inventory, slotY, 8 + slotY * 18, 162));
}
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, 56, 17));
addSlotToContainer(new SlotDischarge(tentity, 1, 56, 53));
addSlotToContainer(new SlotOutput(tentity, 2, 116, 35));
addSlotToContainer(new SlotOutput(tentity, 4, 132, 35));
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));
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, 84 + slotY * 18));
addSlotToContainer(new Slot(inventory, slotX + slotY * 9 + 9, 8 + slotX * 18, 104 + slotY * 18));
}
}
for(slotY = 0; slotY < 9; slotY++)
{
addSlotToContainer(new Slot(inventory, slotY, 8 + slotY * 18, 142));
addSlotToContainer(new Slot(inventory, slotY, 8 + slotY * 18, 162));
}
tileEntity.open(inventory.player);

View file

@ -26,7 +26,7 @@ public class ContainerDigitalMiner extends Container
}
}
addSlotToContainer(new SlotDischarge(tentity, 27, 152, 6));
addSlotToContainer(new SlotDischarge(tentity, 27, 14, 60));
int slotX;

View file

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 12 KiB