@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { super.drawGuiContainerForegroundLayer(mouseX, mouseY); fontRendererObj.drawString(tileEntity.getInventoryName(), 45, 6, 0x404040); fontRendererObj.drawString( MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040); fontRendererObj.drawString( MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, 0x00CD00); fontRendererObj.drawString( MekanismUtils.localize("gui.power") + ": " + powerFormat.format(MekanismGenerators.windGenerationMin * tileEntity.getMultiplier()), 51, 35, 0x00CD00); fontRendererObj.drawString( MekanismUtils.localize("gui.out") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t", 51, 44, 0x00CD00); int size = 44; if (!tileEntity .getWorldObj() .canBlockSeeTheSky(tileEntity.xCoord, tileEntity.yCoord + 4, tileEntity.zCoord)) { size += 9; fontRendererObj.drawString(EnumColor.DARK_RED + "Sky blocked", 51, size, 0x00CD00); } }
@Override public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int width, int height) { if (gui instanceof GuiMekanism) { GuiMekanism guiMek = (GuiMekanism) gui; Rectangle4i rect = new Rectangle4i(x, y, width, height); for (GuiElement element : guiMek.guiElements) { if (element.getBounds(guiMek.getXPos(), guiMek.getYPos()).intersects(rect)) { return true; } } } return false; }
@Override protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) { mc.renderEngine.bindTexture( MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCrystallizer.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); super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); }
@Override public void mouseClicked(int mouseX, int mouseY, int button) throws IOException { super.mouseClicked(mouseX, mouseY, button); int xAxis = (mouseX - (width - xSize) / 2); int yAxis = (mouseY - (height - ySize) / 2); if (button == 0) { if (xAxis >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20) { SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK); Mekanism.packetHandler.sendToServer(new SimpleGuiMessage(Coord4D.get(tileEntity), 1, 10)); } } }
@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { int xAxis = (mouseX - (width - xSize) / 2); int yAxis = (mouseY - (height - ySize) / 2); fontRendererObj.drawString(tileEntity.getInventoryName(), 45, 4, 0x404040); if (xAxis >= 116 && xAxis <= 168 && yAxis >= 76 && yAxis <= 80) { drawCreativeTabHoveringText( MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis); } super.drawGuiContainerForegroundLayer(mouseX, mouseY); }
@Override public void mouseClicked(int mouseX, int mouseY, int button) { super.mouseClicked(mouseX, mouseY, button); int xAxis = (mouseX - (width - xSize) / 2); int yAxis = (mouseY - (height - ySize) / 2); if (button == 0) { if (xAxis >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20) { SoundHandler.playSound("gui.button.press"); MekanismGenerators.packetHandler.sendToServer( new GeneratorsGuiMessage(Coord4D.get(tileEntity), 10)); } } }
@Override protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) { mc.renderEngine.bindTexture( MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalWasher.png")); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int guiWidth = (width - xSize) / 2; int guiHeight = (height - ySize) / 2; drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize); int displayInt; displayInt = tileEntity.getScaledEnergyLevel(52); drawTexturedModalRect(guiWidth + 116, guiHeight + 76, 176, 0, displayInt, 4); super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); }
@Override protected void mouseClicked(int x, int y, int button) { super.mouseClicked(x, y, button); if (button == 0) { int xAxis = (x - (width - xSize) / 2); int yAxis = (y - (height - ySize) / 2); if (xAxis > 45 && xAxis < 63 && yAxis > 13 && yAxis < 21) { ArrayList data = new ArrayList(); data.add(0); Mekanism.packetHandler.sendToServer(new TileEntityMessage(Coord4D.get(tileEntity), data)); SoundHandler.playSound("gui.button.press"); } } }
@Override protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) { mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiWindTurbine.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( guiWidth + 20, guiHeight + 37, 176, (tileEntity.getVolumeMultiplier() > 0 ? 52 : 64), 12, 12); super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); }
@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { int xAxis = (mouseX - (width - xSize) / 2); int yAxis = (mouseY - (height - ySize) / 2); fontRendererObj.drawString(tileEntity.getInventoryName(), 37, 4, 0x404040); if (tileEntity.inputTank.getGas() != null) { fontRendererObj.drawString( tileEntity.inputTank.getGas().getGas().getLocalizedName(), 29, 15, 0x00CD00); if (tileEntity.inputTank.getGas().getGas() instanceof OreGas) { fontRendererObj.drawString( "(" + ((OreGas) tileEntity.inputTank.getGas().getGas()).getOreName() + ")", 29, 24, 0x00CD00); } else { CrystallizerRecipe recipe = tileEntity.getRecipe(); if (recipe == null) { fontRendererObj.drawString( "(" + LangUtils.localize("gui.noRecipe") + ")", 29, 24, 0x00CD00); } else { fontRendererObj.drawString( "(" + recipe.recipeOutput.output.getDisplayName() + ")", 29, 24, 0x00CD00); } } } if (renderStack != null) { try { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_LIGHTING); itemRender.renderItemAndEffectIntoGUI( fontRendererObj, mc.getTextureManager(), renderStack, 131, 14); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } catch (Exception e) { } } super.drawGuiContainerForegroundLayer(mouseX, mouseY); }
@Override protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY) { mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiTall.png")); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int guiWidth = (width - xSize) / 2; int guiHeight = (height - ySize) / 2; drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize); int xAxis = (mouseX - (width - xSize) / 2); int yAxis = (mouseY - (height - ySize) / 2); if (xAxis >= 6 && xAxis <= 20 && yAxis >= 6 && yAxis <= 20) { drawTexturedModalRect(guiWidth + 6, guiHeight + 6, 176, 0, 14, 14); } else { drawTexturedModalRect(guiWidth + 6, guiHeight + 6, 176, 14, 14, 14); } super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); }
@Override public void updateScreen() { super.updateScreen(); if (prevGas != getInputGas()) { prevGas = getInputGas(); boolean reset = false; if (prevGas == null || !(prevGas instanceof OreGas) || !((OreGas) prevGas).isClean()) { reset = true; resetStacks(); } if (!reset) { OreGas gas = (OreGas) prevGas; String oreDictName = "ore" + gas.getName().substring(5); updateStackList(oreDictName); } } if (stackSwitch > 0) { stackSwitch--; } if (stackSwitch == 0 && iterStacks != null && iterStacks.size() > 0) { stackSwitch = 20; if (stackIndex == -1 || stackIndex == iterStacks.size() - 1) { stackIndex = 0; } else if (stackIndex < iterStacks.size() - 1) { stackIndex++; } renderStack = iterStacks.get(stackIndex); } else if (iterStacks != null && iterStacks.size() == 0) { renderStack = null; } }
@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { fontRendererObj.drawString(tileEntity.getName(), 46, 6, 0x404040); if (tileEntity.isFormed()) { fontRendererObj.drawString( EnumColor.DARK_GREEN + LangUtils.localize("gui.passive"), 6, 26, 0x404040); fontRendererObj.drawString( LangUtils.localize("gui.minInject") + ": " + (tileEntity.getReactor().getMinInjectionRate(false)), 16, 36, 0x404040); fontRendererObj.drawString( LangUtils.localize("gui.ignition") + ": " + (MekanismUtils.getTemperatureDisplay( tileEntity.getReactor().getIgnitionTemperature(false), TemperatureUnit.AMBIENT)), 16, 46, 0x404040); fontRendererObj.drawString( LangUtils.localize("gui.maxPlasma") + ": " + (MekanismUtils.getTemperatureDisplay( tileEntity.getReactor().getMaxPlasmaTemperature(false), TemperatureUnit.AMBIENT)), 16, 56, 0x404040); fontRendererObj.drawString( LangUtils.localize("gui.maxCasing") + ": " + (MekanismUtils.getTemperatureDisplay( tileEntity.getReactor().getMaxCasingTemperature(false), TemperatureUnit.AMBIENT)), 16, 66, 0x404040); fontRendererObj.drawString( LangUtils.localize("gui.passiveGeneration") + ": " + MekanismUtils.getEnergyDisplay( tileEntity.getReactor().getPassiveGeneration(false, false)) + "/t", 16, 76, 0x404040); fontRendererObj.drawString( EnumColor.DARK_BLUE + LangUtils.localize("gui.active"), 6, 92, 0x404040); fontRendererObj.drawString( LangUtils.localize("gui.minInject") + ": " + (tileEntity.getReactor().getMinInjectionRate(true)), 16, 102, 0x404040); fontRendererObj.drawString( LangUtils.localize("gui.ignition") + ": " + (MekanismUtils.getTemperatureDisplay( tileEntity.getReactor().getIgnitionTemperature(true), TemperatureUnit.AMBIENT)), 16, 112, 0x404040); fontRendererObj.drawString( LangUtils.localize("gui.maxPlasma") + ": " + (MekanismUtils.getTemperatureDisplay( tileEntity.getReactor().getMaxPlasmaTemperature(true), TemperatureUnit.AMBIENT)), 16, 122, 0x404040); fontRendererObj.drawString( LangUtils.localize("gui.maxCasing") + ": " + (MekanismUtils.getTemperatureDisplay( tileEntity.getReactor().getMaxCasingTemperature(true), TemperatureUnit.AMBIENT)), 16, 132, 0x404040); fontRendererObj.drawString( LangUtils.localize("gui.passiveGeneration") + ": " + MekanismUtils.getEnergyDisplay( tileEntity.getReactor().getPassiveGeneration(true, false)) + "/t", 16, 142, 0x404040); fontRendererObj.drawString( LangUtils.localize("gui.steamProduction") + ": " + nf.format(tileEntity.getReactor().getSteamPerTick(false)) + "mB/t", 16, 152, 0x404040); } super.drawGuiContainerForegroundLayer(mouseX, mouseY); }