diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java b/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java index f4574a362..f0b1623e4 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java @@ -83,38 +83,38 @@ public class BookletUtils{ * Draws an Achievement Info if the page has items that trigger achievements * @param pre If the hover info texts or the icon should be drawn */ - @SuppressWarnings("unchecked") public static void drawAchievementInfo(GuiBooklet booklet, boolean pre, int mouseX, int mouseY){ - if(booklet.currentPage == null){ + if(booklet.currentChapter == null){ return; } - ItemStack[] stacks = booklet.currentPage.getItemStacksForPage(); - ArrayList list = null; - - for(ItemStack stack : stacks){ - for(Achievement achievement : InitAchievements.achievementList){ - if(stack != null && achievement.theItemStack != null && achievement.theItemStack.isItemEqual(stack)){ - if(pre){ - booklet.drawTexturedModalRect(booklet.guiLeft+booklet.xSize+1, booklet.guiTop-18, 166, 154, 22, 21); - return; - } - else{ - if(mouseX >= booklet.guiLeft+booklet.xSize+1 && mouseX < booklet.guiLeft+booklet.xSize+1+22 && mouseY >= booklet.guiTop-18 && mouseY < booklet.guiTop-18+21){ - if(list == null){ - list = new ArrayList(); - list.add(EnumChatFormatting.GOLD+"Achievements related to this page:"); + ArrayList infoList = null; + for(BookletPage page : booklet.currentChapter.pages){ + for(ItemStack stack : page.getItemStacksForPage()){ + for(Achievement achievement : InitAchievements.achievementList){ + if(stack != null && achievement.theItemStack != null && achievement.theItemStack.isItemEqual(stack)){ + if(pre){ + booklet.mc.getTextureManager().bindTexture(GuiBooklet.resLoc); + booklet.drawTexturedModalRect(booklet.guiLeft+booklet.xSize+1, booklet.guiTop-18, 166, 154, 22, 21); + return; + } + else{ + if(mouseX >= booklet.guiLeft+booklet.xSize+1 && mouseX < booklet.guiLeft+booklet.xSize+1+22 && mouseY >= booklet.guiTop-18 && mouseY < booklet.guiTop-18+21){ + if(infoList == null){ + infoList = new ArrayList(); + infoList.add(EnumChatFormatting.GOLD+"Achievements related to this chapter:"); + } + infoList.add("-"+StringUtil.localize(achievement.statId)); + infoList.add(EnumChatFormatting.GRAY+"("+achievement.getDescription()+")"); } - list.add("-"+StringUtil.localize(achievement.statId)); - list.add(EnumChatFormatting.GRAY+"("+achievement.getDescription()+")"); } } } } } - if(list != null){ - booklet.drawHoveringText(list, mouseX, mouseY); + if(infoList != null){ + booklet.drawHoveringText(infoList, mouseX, mouseY); } } diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java index 28107ab1f..eeeb8be15 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java @@ -88,22 +88,24 @@ public class GuiBooklet extends GuiScreen{ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(ClientProxy.jingleAllTheWay ? resLocChristmas : (ClientProxy.pumpkinBlurPumpkinBlur ? resLocHalloween : (ClientProxy.bulletForMyValentine ? resLocValentine : resLoc))); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); - this.mc.getTextureManager().bindTexture(resLoc); //Draws the search bar if(this.currentIndexEntry instanceof BookletEntryAllSearch && this.currentChapter == null){ + this.mc.getTextureManager().bindTexture(resLoc); this.drawTexturedModalRect(this.guiLeft+146, this.guiTop+160, 146, 80, 70, 14); } + //Draws Achievement Info + BookletUtils.drawAchievementInfo(this, true, x, y); + + //Pre-Renders the current page's content etc. + BookletUtils.renderPre(this, x, y, this.ticksElapsed, this.mousePressed); + //Draws the title this.fontRendererObj.setUnicodeFlag(false); BookletUtils.drawTitle(this); this.fontRendererObj.setUnicodeFlag(true); - //Pre-Renders the current page's content etc. - BookletUtils.renderPre(this, x, y, this.ticksElapsed, this.mousePressed); - BookletUtils.drawAchievementInfo(this, true, x, y); - //Does vanilla drawing stuff super.drawScreen(x, y, f); this.searchField.drawTextBox();