diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java index 6b4e1429a..d84746425 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java @@ -117,6 +117,10 @@ public class GuiBooklet extends GuiScreen{ this.drawCenteredString(this.fontRendererObj, this.pageOpenInIndex+"/"+this.indexPageAmount, this.guiLeft+this.xSize/2, this.guiTop+172, StringUtil.DECIMAL_COLOR_WHITE); } } + else{ + String wordCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfWords", InitBooklet.wordCount); + this.fontRendererObj.drawString(EnumChatFormatting.ITALIC+wordCountString, this.guiLeft+this.xSize-this.fontRendererObj.getStringWidth(wordCountString)-15, this.guiTop+this.ySize-18, 0); + } super.drawScreen(x, y, f); this.searchField.drawTextBox(); diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java index 93c5a4c8c..f111e3fb9 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java @@ -30,6 +30,7 @@ public class InitBooklet{ public static ArrayList entries = new ArrayList(); public static ArrayList pagesWithItemStackData = new ArrayList(); + public static int wordCount; public static BookletChapter chapterIntro; @@ -41,7 +42,7 @@ public class InitBooklet{ public static BookletIndexEntry entryMisc = new BookletIndexEntry("misc"); public static BookletIndexEntry allAndSearch = new BookletEntryAllSearch("allAndSearch").setImportant(); - static{ + private static void initChapters(){ chapterIntro = new BookletChapter("intro", entryMisc, new ItemStack(InitItems.itemLexicon), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3), new PageCrafting(4, ItemCrafting.recipeBook)).setImportant(); //Miscellaneous @@ -120,4 +121,23 @@ public class InitBooklet{ new BookletChapter("waterRemovalRing", entryItemsRF, new ItemStack(InitItems.itemWaterRemovalRing), new PageCrafting(1, ItemCrafting.recipeWaterRing)); new BookletChapter("batteries", entryItemsRF, new ItemStack(InitItems.itemBatteryTriple), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeBattery).setNoText(), new PageCrafting(3, ItemCrafting.recipeBatteryDouble).setNoText(), new PageCrafting(4, ItemCrafting.recipeBatteryTriple).setNoText(), new PageCrafting(5, ItemCrafting.recipeBatteryQuadruple).setNoText(), new PageCrafting(6, ItemCrafting.recipeBatteryQuintuple).setNoText()); } + + static{ + initChapters(); + countWords(); + } + + private static void countWords(){ + for(BookletIndexEntry entry : entries){ + for(BookletChapter chapter : entry.chapters){ + for(BookletPage page : chapter.pages){ + if(page.getText() != null){ + wordCount += page.getText().split(" ").length; + } + } + wordCount += chapter.getLocalizedName().split(" ").length; + } + wordCount += entry.getLocalizedName().split(" ").length; + } + } } diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 362383f56..ab3f779c0 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -425,6 +425,7 @@ booklet.actuallyadditions.indexEntry.itemsRF.name=Items that use RF #Booklet Info booklet.actuallyadditions.recipeDisabled=The crafting recipe for this item is disabled in the Config File! If you're on a server, ask the server author to enable it in the config. If you're on a client, press the 'Open Config'-Button on the top right and enable the recipe! booklet.actuallyadditions.clickToSeeRecipe=Click to see more Information +booklet.actuallyadditions.amountOfWords=%s words in total #Booklet Chapters booklet.actuallyadditions.chapter.intro.name=An Introduction to ActAdd