Added character counter, just for teh lulz

This commit is contained in:
Ellpeck 2015-11-11 19:01:19 +01:00
parent f9a9ee4dc6
commit 2ab300a9a5
3 changed files with 12 additions and 3 deletions

View file

@ -80,7 +80,7 @@ public class BookletUtils{
* 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 in the index
* -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){
@ -94,10 +94,13 @@ public class BookletUtils{
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 the book has
//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, 0);
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);
}
}

View file

@ -35,7 +35,9 @@ public class InitBooklet{
public static ArrayList<BookletEntry> entries = new ArrayList<BookletEntry>();
public static ArrayList<BookletPage> pagesWithItemStackData = new ArrayList<BookletPage>();
public static int wordCount;
public static int charCount;
public static BookletChapter chapterIntro;
@ -138,11 +140,14 @@ public class InitBooklet{
for(BookletPage page : chapter.pages){
if(page.getText() != null){
wordCount += page.getText().split(" ").length;
charCount += page.getText().length();
}
}
wordCount += chapter.getLocalizedName().split(" ").length;
charCount += chapter.getLocalizedName().length();
}
wordCount += entry.getLocalizedName().split(" ").length;
charCount += entry.getLocalizedName().length();
}
}
}

View file

@ -426,6 +426,7 @@ booklet.actuallyadditions.indexEntry.itemsRF.name=Items that use RF
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.actuallyadditions.amountOfChars=%s characters in total
#Booklet Chapters
booklet.actuallyadditions.chapter.intro.name=An Introduction to ActAdd