mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Booklet Word Counter
This commit is contained in:
parent
1209aa7d29
commit
a104ef88aa
3 changed files with 26 additions and 1 deletions
|
@ -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);
|
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);
|
super.drawScreen(x, y, f);
|
||||||
this.searchField.drawTextBox();
|
this.searchField.drawTextBox();
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class InitBooklet{
|
||||||
|
|
||||||
public static ArrayList<BookletIndexEntry> entries = new ArrayList<BookletIndexEntry>();
|
public static ArrayList<BookletIndexEntry> entries = new ArrayList<BookletIndexEntry>();
|
||||||
public static ArrayList<BookletPage> pagesWithItemStackData = new ArrayList<BookletPage>();
|
public static ArrayList<BookletPage> pagesWithItemStackData = new ArrayList<BookletPage>();
|
||||||
|
public static int wordCount;
|
||||||
|
|
||||||
public static BookletChapter chapterIntro;
|
public static BookletChapter chapterIntro;
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ public class InitBooklet{
|
||||||
public static BookletIndexEntry entryMisc = new BookletIndexEntry("misc");
|
public static BookletIndexEntry entryMisc = new BookletIndexEntry("misc");
|
||||||
public static BookletIndexEntry allAndSearch = new BookletEntryAllSearch("allAndSearch").setImportant();
|
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();
|
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
|
//Miscellaneous
|
||||||
|
@ -120,4 +121,23 @@ public class InitBooklet{
|
||||||
new BookletChapter("waterRemovalRing", entryItemsRF, new ItemStack(InitItems.itemWaterRemovalRing), new PageCrafting(1, ItemCrafting.recipeWaterRing));
|
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());
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,6 +425,7 @@ booklet.actuallyadditions.indexEntry.itemsRF.name=Items that use RF
|
||||||
#Booklet Info
|
#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.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.clickToSeeRecipe=Click to see more Information
|
||||||
|
booklet.actuallyadditions.amountOfWords=%s words in total
|
||||||
|
|
||||||
#Booklet Chapters
|
#Booklet Chapters
|
||||||
booklet.actuallyadditions.chapter.intro.name=An Introduction to ActAdd
|
booklet.actuallyadditions.chapter.intro.name=An Introduction to ActAdd
|
||||||
|
|
Loading…
Reference in a new issue