diff --git a/common/mekanism/client/gui/GuiAdvancedElectricMachine.java b/common/mekanism/client/gui/GuiAdvancedElectricMachine.java index a8281286a..ed964b8da 100644 --- a/common/mekanism/client/gui/GuiAdvancedElectricMachine.java +++ b/common/mekanism/client/gui/GuiAdvancedElectricMachine.java @@ -27,6 +27,7 @@ public class GuiAdvancedElectricMachine extends GuiMekanism guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation)); guiElements.add(new GuiUpgradeManagement(this, tileEntity, tileEntity.guiLocation)); guiElements.add(new GuiConfigurationTab(this, tileEntity, tileEntity.guiLocation)); + guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 164, 15)); guiElements.add(new GuiEnergyInfo(new IInfoHandler() { @Override public List getInfo() @@ -45,11 +46,6 @@ public class GuiAdvancedElectricMachine extends GuiMekanism fontRenderer.drawString(tileEntity.getInvName(), (xSize/2)-(fontRenderer.getStringWidth(tileEntity.getInvName())/2), 6, 0x404040); fontRenderer.drawString("Inventory", 8, (ySize - 96) + 2, 0x404040); - - if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69) - { - drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis); - } super.drawGuiContainerForegroundLayer(mouseX, mouseY); } @@ -57,8 +53,6 @@ public class GuiAdvancedElectricMachine extends GuiMekanism @Override protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) { - super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); - mc.renderEngine.bindTexture(tileEntity.guiLocation); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int guiWidth = (width - xSize) / 2; @@ -69,14 +63,13 @@ public class GuiAdvancedElectricMachine extends GuiMekanism int yAxis = mouseY - guiHeight; int displayInt; - - displayInt = tileEntity.getScaledEnergyLevel(52); - drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 19 + 52 - displayInt, 4, displayInt); displayInt = tileEntity.getScaledSecondaryEnergyLevel(12); drawTexturedModalRect(guiWidth + 61, guiHeight + 37 + 12 - displayInt, 176, 7 + 12 - displayInt, 5, displayInt); displayInt = tileEntity.getScaledProgress(24); drawTexturedModalRect(guiWidth + 79, guiHeight + 39, 176, 0, displayInt + 1, 7); - } + + super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); + } } \ No newline at end of file diff --git a/common/mekanism/client/gui/GuiElectricMachine.java b/common/mekanism/client/gui/GuiElectricMachine.java index 45dd880b0..c2d323fef 100644 --- a/common/mekanism/client/gui/GuiElectricMachine.java +++ b/common/mekanism/client/gui/GuiElectricMachine.java @@ -27,6 +27,7 @@ public class GuiElectricMachine extends GuiMekanism guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.guiLocation)); guiElements.add(new GuiUpgradeManagement(this, tileEntity, tileEntity.guiLocation)); guiElements.add(new GuiConfigurationTab(this, tileEntity, tileEntity.guiLocation)); + guiElements.add(new GuiPowerBar(this, tileEntity, tileEntity.guiLocation, 164, 15)); guiElements.add(new GuiEnergyInfo(new IInfoHandler() { @Override public List getInfo() @@ -45,11 +46,6 @@ public class GuiElectricMachine extends GuiMekanism fontRenderer.drawString(tileEntity.getInvName(), 45, 6, 0x404040); fontRenderer.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040); - - if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69) - { - drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis); - } super.drawGuiContainerForegroundLayer(mouseX, mouseY); } @@ -57,8 +53,6 @@ public class GuiElectricMachine extends GuiMekanism @Override protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) { - super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); - mc.renderEngine.bindTexture(tileEntity.guiLocation); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int guiWidth = (width - xSize) / 2; @@ -70,10 +64,9 @@ public class GuiElectricMachine extends GuiMekanism int displayInt; - displayInt = tileEntity.getScaledEnergyLevel(52); - drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 7 + 52 - displayInt, 4, displayInt); - displayInt = tileEntity.getScaledProgress(24); drawTexturedModalRect(guiWidth + 79, guiHeight + 39, 176, 0, displayInt + 1, 7); - } + + super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); + } } \ No newline at end of file diff --git a/common/mekanism/client/gui/GuiElectricPump.java b/common/mekanism/client/gui/GuiElectricPump.java index 5b4a02f27..7318b16be 100644 --- a/common/mekanism/client/gui/GuiElectricPump.java +++ b/common/mekanism/client/gui/GuiElectricPump.java @@ -6,6 +6,7 @@ import mekanism.common.tile.TileEntityElectricPump; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidStack; import org.lwjgl.opengl.GL11; @@ -17,11 +18,15 @@ import cpw.mods.fml.relauncher.SideOnly; public class GuiElectricPump extends GuiMekanism { public TileEntityElectricPump tileEntity; + + public ResourceLocation guiLocation = MekanismUtils.getResource(ResourceType.GUI, "GuiElectricPump.png"); public GuiElectricPump(InventoryPlayer inventory, TileEntityElectricPump tentity) { super(new ContainerElectricPump(inventory, tentity)); tileEntity = tentity; + + guiElements.add(new GuiPowerBar(this, tileEntity, guiLocation, 164, 15)); } @Override @@ -40,33 +45,24 @@ public class GuiElectricPump extends GuiMekanism drawCreativeTabHoveringText(tileEntity.fluidTank.getFluid() != null ? tileEntity.fluidTank.getFluid().getFluid().getLocalizedName() + ": " + tileEntity.fluidTank.getFluid().amount + "mB" : MekanismUtils.localize("gui.empty"), xAxis, yAxis); } - if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69) - { - drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis); - } - super.drawGuiContainerForegroundLayer(mouseX, mouseY); } @Override protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) { - super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); - - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiElectricPump.png")); + mc.renderEngine.bindTexture(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); - int displayInt; - - displayInt = tileEntity.getScaledEnergyLevel(52); - drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt); - + if(tileEntity.getScaledFluidLevel(58) > 0) { displayGauge(7, 14, tileEntity.getScaledFluidLevel(58), tileEntity.fluidTank.getFluid()); } + + super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); } public void displayGauge(int xPos, int yPos, int scale, FluidStack fluid) @@ -105,7 +101,7 @@ public class GuiElectricPump extends GuiMekanism } } - mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiElectricPump.png")); + mc.renderEngine.bindTexture(guiLocation); drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos, 176, 52, 16, 60); } } diff --git a/common/mekanism/client/gui/GuiElement.java b/common/mekanism/client/gui/GuiElement.java index 5115f1b63..74912358e 100644 --- a/common/mekanism/client/gui/GuiElement.java +++ b/common/mekanism/client/gui/GuiElement.java @@ -2,12 +2,8 @@ package mekanism.client.gui; import java.util.List; -import mekanism.common.ObfuscatedNames; -import mekanism.common.util.MekanismUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; @@ -43,33 +39,17 @@ public abstract class GuiElement protected void offsetX(int xSize) { - if(guiObj instanceof GuiContainer) - { - try { - int size = (Integer)MekanismUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_xSize); - MekanismUtils.setPrivateValue(guiObj, size+xSize, GuiContainer.class, ObfuscatedNames.GuiContainer_xSize); - } catch(Exception e) {} - } + guiObj.xSize += xSize; } protected void offsetY(int ySize) { - if(guiObj instanceof GuiContainer) - { - try { - int size = (Integer)MekanismUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_ySize); - MekanismUtils.setPrivateValue(guiObj, size+ySize, GuiContainer.class, ObfuscatedNames.GuiContainer_ySize); - } catch(Exception e) {} - } + guiObj.ySize += ySize; } protected FontRenderer getFontRenderer() { - try { - return (FontRenderer)MekanismUtils.getPrivateValue(guiObj, GuiScreen.class, ObfuscatedNames.GuiScreen_fontRenderer); - } catch(Exception e) {} - - return null; + return guiObj.getFontRenderer(); } public abstract void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight); diff --git a/common/mekanism/client/gui/GuiMekanism.java b/common/mekanism/client/gui/GuiMekanism.java index a2c31a1c6..e04ddc2a6 100644 --- a/common/mekanism/client/gui/GuiMekanism.java +++ b/common/mekanism/client/gui/GuiMekanism.java @@ -9,6 +9,8 @@ import mekanism.common.IInvConfiguration; import mekanism.common.SideData; import mekanism.common.item.ItemConfigurator; import mekanism.common.tile.TileEntityContainerBlock; + +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -148,4 +150,9 @@ public abstract class GuiMekanism extends GuiContainer super.func_102021_a(list, x, y); GL11.glPopAttrib(); } + + protected FontRenderer getFontRenderer() + { + return fontRenderer; + } } diff --git a/common/mekanism/client/gui/GuiPowerBar.java b/common/mekanism/client/gui/GuiPowerBar.java new file mode 100644 index 000000000..1a04f55d2 --- /dev/null +++ b/common/mekanism/client/gui/GuiPowerBar.java @@ -0,0 +1,59 @@ +package mekanism.client.gui; + +import mekanism.common.tile.TileEntityElectricBlock; +import mekanism.common.util.MekanismUtils; +import mekanism.common.util.MekanismUtils.ResourceType; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +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 tileEntityElectric; + + public GuiPowerBar(GuiMekanism gui, TileEntityElectricBlock tile, ResourceLocation def, int x, int y) + { + super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiPowerBar.png"), gui, tile, def); + tileEntityElectric = tile; + xLocation = x; + yLocation = y; + } + + @Override + public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight) + { + mc.renderEngine.bindTexture(RESOURCE); + + guiObj.drawTexturedModalRect(guiWidth + xLocation, guiHeight + yLocation, 0, 0, width, height); + int displayInt = tileEntityElectric.getScaledEnergyLevel(52) + innerOffsetY; + guiObj.drawTexturedModalRect(guiWidth + xLocation, guiHeight + yLocation + height - displayInt, 6, height - displayInt, width, displayInt); + + mc.renderEngine.bindTexture(defaultLocation); + } + + @Override + public void renderForeground(int xAxis, int yAxis) + { + mc.renderEngine.bindTexture(RESOURCE); + + if(xAxis >= xLocation && xAxis <= xLocation + width && yAxis >= yLocation && yAxis <= yLocation + height) + { + displayTooltip(MekanismUtils.getEnergyDisplay(tileEntityElectric.getEnergy()), xAxis, yAxis); + } + + mc.renderEngine.bindTexture(defaultLocation); + } + + @Override + public void preMouseClicked(int xAxis, int yAxis, int button) {} + + @Override + public void mouseClicked(int xAxis, int yAxis, int button) {} +} diff --git a/common/mekanism/generators/common/tile/TileEntitySolarGenerator.java b/common/mekanism/generators/common/tile/TileEntitySolarGenerator.java index c87154552..85aab487d 100644 --- a/common/mekanism/generators/common/tile/TileEntitySolarGenerator.java +++ b/common/mekanism/generators/common/tile/TileEntitySolarGenerator.java @@ -75,22 +75,7 @@ public class TileEntitySolarGenerator extends TileEntityGenerator else { seesSun = false; } - - for(int y = yCoord+1; y < 256; y++) - { - Coord4D obj = new Coord4D(xCoord, y, zCoord, worldObj.provider.dimensionId); - Block block = Block.blocksList[obj.getBlockId(worldObj)]; - - if(block != null) - { - if(block.isOpaqueCube() || block.blockID == MekanismGenerators.generatorID && obj.getMetadata(worldObj) == GeneratorType.SOLAR_GENERATOR.meta) - { - seesSun = false; - break; - } - } - } - + if(canOperate()) { setActive(true); diff --git a/resources/assets/mekanism/gui/GuiChamber.png b/resources/assets/mekanism/gui/GuiChamber.png index 791796cb1..c127fff17 100644 Binary files a/resources/assets/mekanism/gui/GuiChamber.png and b/resources/assets/mekanism/gui/GuiChamber.png differ diff --git a/resources/assets/mekanism/gui/GuiChemicalInjectionChamber.png b/resources/assets/mekanism/gui/GuiChemicalInjectionChamber.png index bf1276089..7f35ae351 100644 Binary files a/resources/assets/mekanism/gui/GuiChemicalInjectionChamber.png and b/resources/assets/mekanism/gui/GuiChemicalInjectionChamber.png differ diff --git a/resources/assets/mekanism/gui/GuiCombiner.png b/resources/assets/mekanism/gui/GuiCombiner.png index c2b982a8d..343b50e39 100644 Binary files a/resources/assets/mekanism/gui/GuiCombiner.png and b/resources/assets/mekanism/gui/GuiCombiner.png differ diff --git a/resources/assets/mekanism/gui/GuiCompressor.png b/resources/assets/mekanism/gui/GuiCompressor.png index 39773552c..58b879acc 100644 Binary files a/resources/assets/mekanism/gui/GuiCompressor.png and b/resources/assets/mekanism/gui/GuiCompressor.png differ diff --git a/resources/assets/mekanism/gui/GuiCrusher.png b/resources/assets/mekanism/gui/GuiCrusher.png index 384b876f6..7354719d0 100644 Binary files a/resources/assets/mekanism/gui/GuiCrusher.png and b/resources/assets/mekanism/gui/GuiCrusher.png differ diff --git a/resources/assets/mekanism/gui/GuiEnergizedSmelter.png b/resources/assets/mekanism/gui/GuiEnergizedSmelter.png index bc2a1f896..e3cdb34ba 100644 Binary files a/resources/assets/mekanism/gui/GuiEnergizedSmelter.png and b/resources/assets/mekanism/gui/GuiEnergizedSmelter.png differ diff --git a/resources/assets/mekanism/gui/elements/GuiPowerBar.png b/resources/assets/mekanism/gui/elements/GuiPowerBar.png new file mode 100644 index 000000000..f4e9da5ea Binary files /dev/null and b/resources/assets/mekanism/gui/elements/GuiPowerBar.png differ