/** * 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 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); }