/** * Draws the Title of the current chapter, current index entry or just "Actually Additions" if * neither is present */ public static void drawTitle(GuiBooklet booklet) { // Upper title booklet.drawTexturedModalRect( booklet.guiLeft + booklet.xSize / 2 - 142 / 2, booklet.guiTop - 12, 0, 240, 142, 12); // Lower title booklet.drawTexturedModalRect( booklet.guiLeft + booklet.xSize / 2 - 142 / 2, booklet.guiTop + booklet.ySize, 0, 243, 142, 13); String strg = booklet.currentChapter == null ? (booklet.currentIndexEntry == null ? StringUtil.localize("itemGroup." + ModUtil.MOD_ID_LOWER) : booklet.currentIndexEntry.getLocalizedName()) : booklet.currentChapter.getLocalizedName(); booklet.drawCenteredString( booklet.getFontRenderer(), strg, booklet.guiLeft + booklet.xSize / 2, booklet.guiTop - 9, StringUtil.DECIMAL_COLOR_WHITE); }
/** * Pre-renders the booklet page, including -the number of a page and its content (text, crafting * recipe etc.) -the number of a page in a chapter -the amount of words and chars in the index * (Just for teh lulz) */ public static void renderPre( GuiBooklet booklet, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed) { if (booklet.currentIndexEntry != null) { // Renders Booklet Page Number and Content if (booklet.currentChapter != null && booklet.currentPage != null) { booklet.drawCenteredString( booklet.getFontRenderer(), booklet.currentPage.getID() + "/" + booklet.currentChapter.pages.length, booklet.guiLeft + booklet.xSize / 2, booklet.guiTop + 172, StringUtil.DECIMAL_COLOR_WHITE); booklet.currentPage.renderPre(booklet, mouseX, mouseY, ticksElapsed, mousePressed); } // Renders Chapter Page Number else { booklet.drawCenteredString( booklet.getFontRenderer(), booklet.pageOpenInIndex + "/" + booklet.indexPageAmount, booklet.guiLeft + booklet.xSize / 2, booklet.guiTop + 172, StringUtil.DECIMAL_COLOR_WHITE); } } // Renders the amount of words and chars the book has else { String wordCountString = StringUtil.localizeFormatted( "booklet." + ModUtil.MOD_ID_LOWER + ".amountOfWords", InitBooklet.wordCount); booklet .getFontRenderer() .drawString( EnumChatFormatting.ITALIC + wordCountString, booklet.guiLeft + booklet.xSize - booklet.getFontRenderer().getStringWidth(wordCountString) - 15, booklet.guiTop + booklet.ySize - 18 - booklet.getFontRenderer().FONT_HEIGHT, 0); String charCountString = StringUtil.localizeFormatted( "booklet." + ModUtil.MOD_ID_LOWER + ".amountOfChars", InitBooklet.charCount); booklet .getFontRenderer() .drawString( EnumChatFormatting.ITALIC + charCountString, booklet.guiLeft + booklet.xSize - booklet.getFontRenderer().getStringWidth(charCountString) - 15, booklet.guiTop + booklet.ySize - 18, 0); } }
/** Draws all of the hovering texts for the buttons that need explanation in the booklet */ @SuppressWarnings("unchecked") public static void doHoverTexts(GuiBooklet booklet, int mouseX, int mouseY) { // Achievements Hover Text if (booklet.buttonAchievements.func_146115_a()) { booklet.drawHoveringText( Collections.singletonList(EnumChatFormatting.GOLD + "Show Achievements"), mouseX, mouseY); } // Config Hover Text else if (booklet.buttonConfig.func_146115_a()) { ArrayList list = new ArrayList(); list.add(EnumChatFormatting.GOLD + "Show Configuration GUI"); list.addAll( booklet .getFontRenderer() .listFormattedStringToWidth( "It is highly recommended that you restart your game after changing anything as that prevents possible bugs occuring!", GuiBooklet.TOOLTIP_SPLIT_LENGTH)); booklet.drawHoveringText(list, mouseX, mouseY); } // Twitter Hover Text else if (booklet.buttonTwitter.func_146115_a()) { booklet.drawHoveringText( Collections.singletonList( EnumChatFormatting.GOLD + "Open @ActAddMod on Twitter in Browser"), mouseX, mouseY); } // Forum Hover Text else if (booklet.buttonForum.func_146115_a()) { booklet.drawHoveringText( Collections.singletonList( EnumChatFormatting.GOLD + "Open Minecraft Forum Post in Browser"), mouseX, mouseY); } // Update Checker Hover Text else if (booklet.buttonUpdate.func_146115_a()) { ArrayList list = new ArrayList(); if (UpdateChecker.checkFailed) { list.add( IChatComponent.Serializer.func_150699_a( StringUtil.localize("info." + ModUtil.MOD_ID_LOWER + ".update.failed")) .getFormattedText()); } else if (UpdateChecker.needsUpdateNotify) { list.add( IChatComponent.Serializer.func_150699_a( StringUtil.localize("info." + ModUtil.MOD_ID_LOWER + ".update.generic")) .getFormattedText()); list.add( IChatComponent.Serializer.func_150699_a( StringUtil.localizeFormatted( "info." + ModUtil.MOD_ID_LOWER + ".update.versionCompare", ModUtil.VERSION, UpdateChecker.updateVersion)) .getFormattedText()); list.add(StringUtil.localize("info." + ModUtil.MOD_ID_LOWER + ".update.buttonOptions")); } booklet.drawHoveringText(list, mouseX, mouseY); } else { for (GuiButton button : booklet.bookmarkButtons) { if (button instanceof BookmarkButton && button.func_146115_a()) { ((BookmarkButton) button).drawHover(mouseX, mouseY); } } } }