From be2162816186ebeefbb24fa84b0a415c157c560a Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 27 Nov 2015 16:44:39 +0100 Subject: [PATCH] Fix some bugs with the NEI Integration of the Booklet --- .../booklet/BookletUtils.java | 15 +++++ .../booklet/InitBooklet.java | 3 +- .../chapter/BookletChapterReconstructor.java | 52 ---------------- .../booklet/page/BookletPage.java | 18 +++--- .../nei/NEIBookletRecipe.java | 59 ++++++++++--------- .../nei/NEICoffeeMachineRecipe.java | 6 +- .../nei/NEICompostRecipe.java | 6 +- .../nei/NEICrusherRecipe.java | 10 ++-- .../nei/NEIFurnaceDoubleRecipe.java | 6 +- .../nei/NEIHairyBallRecipe.java | 6 +- .../nei/NEITreasureChestRecipe.java | 6 +- 11 files changed, 81 insertions(+), 106 deletions(-) delete mode 100644 src/main/java/ellpeck/actuallyadditions/booklet/chapter/BookletChapterReconstructor.java diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java b/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java index b2f0378d4..9d2aa88d1 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/BookletUtils.java @@ -431,6 +431,21 @@ public class BookletUtils{ } } + public static ArrayList getPagesForStack(ItemStack stack){ + ArrayList possiblePages = new ArrayList(); + for(BookletPage page : InitBooklet.pagesWithItemStackData){ + if(ItemUtil.contains(page.getItemStacksForPage(), stack, true)){ + possiblePages.add(page); + } + } + return possiblePages; + } + + public static BookletPage getFirstPageForStack(ItemStack stack){ + ArrayList pages = getPagesForStack(stack); + return pages.isEmpty() ? null : pages.get(0); + } + public static class TexturedButton extends GuiButton{ public int texturePosX; diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java index 45379e3bc..2e5f0900d 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java @@ -16,7 +16,6 @@ import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; import ellpeck.actuallyadditions.booklet.chapter.BookletChapter; import ellpeck.actuallyadditions.booklet.chapter.BookletChapterCoffee; import ellpeck.actuallyadditions.booklet.chapter.BookletChapterCrusher; -import ellpeck.actuallyadditions.booklet.chapter.BookletChapterReconstructor; import ellpeck.actuallyadditions.booklet.entry.BookletEntry; import ellpeck.actuallyadditions.booklet.entry.BookletEntryAllSearch; import ellpeck.actuallyadditions.booklet.page.*; @@ -56,7 +55,7 @@ public class InitBooklet{ //Getting Started chapterIntro = new BookletChapter("intro", entryGettingStarted, new ItemStack(InitItems.itemLexicon), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3)); new BookletChapter("bookTutorial", entryGettingStarted, new ItemStack(InitItems.itemLexicon), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook)); - new BookletChapterReconstructor("crystals", entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.RECONSTRUCTOR_BASE_ENERGY_USE.getValue()), new PageTextOnly(2), new PagePicture(3, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(4), new PageCrafting(5, BlockCrafting.recipeAtomicReconstructor).setNoText(), new PageCrafting(6, ItemCrafting.recipeLens).setNoText()).setSpecial(); + new BookletChapter("crystals", entryGettingStarted, new ItemStack(InitBlocks.blockAtomicReconstructor), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.RECONSTRUCTOR_BASE_ENERGY_USE.getValue()), new PageTextOnly(2), new PagePicture(3, "pageAtomicReconstructor", 0).setNoText(), new PageTextOnly(4), new PageCrafting(5, BlockCrafting.recipeAtomicReconstructor).setNoText(), new PageCrafting(6, ItemCrafting.recipeLens).setNoText(), new PageCrafting(7, MiscCrafting.recipesCrystals).setNoText(), new PageCrafting(8, MiscCrafting.recipesCrystalBlocks).setNoText(), new PageReconstructor(9, ReconstructorRecipeHandler.mainPageRecipes).setNoText()).setSpecial(); new BookletChapter("coalGen", entryGettingStarted, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen).addTextReplacement("", ConfigIntValues.COAL_GEN_ENERGY_PRODUCED.getValue())); new BookletChapter("craftingIngs", entryGettingStarted, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeCoil).setNoText(), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced).setNoText(), new PageCrafting(4, BlockCrafting.recipeCase).setNoText(), new PageCrafting(5, BlockCrafting.recipeStoneCase).setNoText(), new PageCrafting(6, BlockCrafting.recipeEnderPearlBlock).setNoText(), new PageCrafting(7, BlockCrafting.recipeEnderCase).setNoText(), new PageCrafting(8, ItemCrafting.recipeRing).setNoText(), new PageCrafting(9, ItemCrafting.recipeKnifeHandle).setNoText(), new PageCrafting(10, ItemCrafting.recipeKnifeBlade).setNoText(), new PageCrafting(11, ItemCrafting.recipeKnife).setNoText(), new PageCrafting(12, ItemCrafting.recipeDough).setNoText(), new PageCrafting(13, ItemCrafting.recipeRiceDough).setNoText(), new PageCrafting(14, BlockCrafting.recipeIronCase).setNoText()).setImportant(); diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/chapter/BookletChapterReconstructor.java b/src/main/java/ellpeck/actuallyadditions/booklet/chapter/BookletChapterReconstructor.java deleted file mode 100644 index b7819eed6..000000000 --- a/src/main/java/ellpeck/actuallyadditions/booklet/chapter/BookletChapterReconstructor.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file ("BookletChapterReconstructor.java") is part of the Actually Additions Mod for Minecraft. - * It is created and owned by Ellpeck and distributed - * under the Actually Additions License to be found at - * http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md - * View the source code at https://github.com/Ellpeck/ActuallyAdditions - * - * © 2015 Ellpeck - */ - -package ellpeck.actuallyadditions.booklet.chapter; - -import ellpeck.actuallyadditions.booklet.entry.BookletEntry; -import ellpeck.actuallyadditions.booklet.page.BookletPage; -import ellpeck.actuallyadditions.booklet.page.PageCrafting; -import ellpeck.actuallyadditions.booklet.page.PageReconstructor; -import ellpeck.actuallyadditions.crafting.MiscCrafting; -import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler; -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; -import java.util.Arrays; - -public class BookletChapterReconstructor extends BookletChapter{ - - public BookletChapterReconstructor(String unlocalizedName, BookletEntry entry, ItemStack displayStack, BookletPage... pages){ - super(unlocalizedName, entry, displayStack, getPages(pages)); - } - - @SuppressWarnings("unchecked") - private static BookletPage[] getPages(BookletPage... pages){ - ArrayList allPages = new ArrayList(); - allPages.addAll(Arrays.asList(pages)); - - allPages.add(new PageCrafting(allPages.size()+1, MiscCrafting.recipesCrystals){ - @Override - public ItemStack[] getItemStacksForPage(){ - return new ItemStack[0]; - } - }.setNoText()); - allPages.add(new PageCrafting(allPages.size()+1, MiscCrafting.recipesCrystalBlocks){ - @Override - public ItemStack[] getItemStacksForPage(){ - return new ItemStack[0]; - } - }.setNoText()); - - allPages.add(new PageReconstructor(allPages.size()+1, ReconstructorRecipeHandler.mainPageRecipes).setNoText()); - - return allPages.toArray(new BookletPage[allPages.size()]); - } -} diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java index 083f9d402..7d30d20fd 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java @@ -14,7 +14,6 @@ import ellpeck.actuallyadditions.booklet.BookletUtils; import ellpeck.actuallyadditions.booklet.GuiBooklet; import ellpeck.actuallyadditions.booklet.InitBooklet; import ellpeck.actuallyadditions.booklet.chapter.BookletChapter; -import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.Minecraft; @@ -143,17 +142,14 @@ public class BookletPage{ } if(checkAndTransfer){ - for(BookletPage page : InitBooklet.pagesWithItemStackData){ - if(ItemUtil.contains(page.getItemStacksForPage(), stack, true)){ - list.add(EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe")); + BookletPage page = BookletUtils.getFirstPageForStack(stack); + if(page != null){ + list.add(EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe")); - if(mousePressed){ - BookletUtils.openIndexEntry(gui, page.getChapter().entry, InitBooklet.entries.indexOf(page.getChapter().entry)/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true); - BookletUtils.openChapter(gui, page.getChapter(), page); - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); - } - - break; + if(mousePressed){ + BookletUtils.openIndexEntry(gui, page.getChapter().entry, InitBooklet.entries.indexOf(page.getChapter().entry)/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true); + BookletUtils.openChapter(gui, page.getChapter(), page); + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEIBookletRecipe.java b/src/main/java/ellpeck/actuallyadditions/nei/NEIBookletRecipe.java index 4402c1456..5644035c6 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/NEIBookletRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEIBookletRecipe.java @@ -14,6 +14,7 @@ import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.RecipeInfo; import codechicken.nei.recipe.TemplateRecipeHandler; +import ellpeck.actuallyadditions.booklet.BookletUtils; import ellpeck.actuallyadditions.booklet.InitBooklet; import ellpeck.actuallyadditions.booklet.chapter.BookletChapter; import ellpeck.actuallyadditions.booklet.page.BookletPage; @@ -28,6 +29,7 @@ import net.minecraft.util.EnumChatFormatting; import org.lwjgl.opengl.GL11; import java.awt.*; +import java.util.ArrayList; import java.util.List; public class NEIBookletRecipe extends TemplateRecipeHandler implements INEIRecipeHandler{ @@ -39,8 +41,8 @@ public class NEIBookletRecipe extends TemplateRecipeHandler implements INEIRecip } @Override - public ItemStack getStackForInfo(int page){ - return ((CachedInfoStack)this.arecipes.get(page)).theStack; + public BookletPage getPageForInfo(int page){ + return ((CachedInfoStack)this.arecipes.get(page)).thePage; } @Override @@ -53,8 +55,15 @@ public class NEIBookletRecipe extends TemplateRecipeHandler implements INEIRecip public void loadCraftingRecipes(String outputId, Object... results){ if(outputId.equals(NAME) && getClass() == NEIBookletRecipe.class){ for(BookletPage page : InitBooklet.pagesWithItemStackData){ - for(ItemStack stack : page.getItemStacksForPage()){ - arecipes.add(new CachedInfoStack(stack)); + ItemStack[] stacks = page.getItemStacksForPage(); + + //So that you don't see things like Mashed Food more than once + ArrayList nonDoubleStacks = new ArrayList(); + for(ItemStack stack : stacks){ + if(!ItemUtil.contains(nonDoubleStacks, stack, true)){ + arecipes.add(new CachedInfoStack(stack, page)); + nonDoubleStacks.add(stack); + } } } } @@ -66,22 +75,20 @@ public class NEIBookletRecipe extends TemplateRecipeHandler implements INEIRecip @SuppressWarnings("unchecked") @Override public void loadCraftingRecipes(ItemStack result){ - for(BookletPage page : InitBooklet.pagesWithItemStackData){ - if(ItemUtil.contains(page.getItemStacksForPage(), result, true)){ - CachedInfoStack theRecipe = new CachedInfoStack(result); - arecipes.add(theRecipe); - } + ArrayList allPages = BookletUtils.getPagesForStack(result); + for(BookletPage page : allPages){ + CachedInfoStack theRecipe = new CachedInfoStack(result, page); + arecipes.add(theRecipe); } } @SuppressWarnings("unchecked") @Override public void loadUsageRecipes(ItemStack ingredient){ - for(BookletPage page : InitBooklet.pagesWithItemStackData){ - if(ItemUtil.contains(page.getItemStacksForPage(), ingredient, true)){ - CachedInfoStack theRecipe = new CachedInfoStack(ingredient); - arecipes.add(theRecipe); - } + ArrayList allPages = BookletUtils.getPagesForStack(ingredient); + for(BookletPage page : allPages){ + CachedInfoStack theRecipe = new CachedInfoStack(ingredient, page); + arecipes.add(theRecipe); } } @@ -104,19 +111,15 @@ public class NEIBookletRecipe extends TemplateRecipeHandler implements INEIRecip GuiDraw.drawString((String)header.get(i), 0, 18+i*(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT+1), 0, false); } - for(BookletPage page : InitBooklet.pagesWithItemStackData){ - if(ItemUtil.contains(page.getItemStacksForPage(), stack.theStack, true)){ - int maxLines = 6; - - BookletChapter chapter = page.getChapter(); - String aText = (chapter.pages[0] instanceof PagePicture && chapter.pages.length > 1 ? chapter.pages[1] : chapter.pages[0]).getText(); - List text = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(aText != null ? aText : EnumChatFormatting.DARK_RED+StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".booklet.noText"), 165); - for(int i = 0; i < Math.min(maxLines, text.size()); i++){ - GuiDraw.drawString(text.get(i)+(i == maxLines-1 && text.size() > maxLines ? EnumChatFormatting.RESET+""+EnumChatFormatting.BLACK+"..." : ""), 0, 18+25+i*(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT+1), 0, false); - } - break; - } + int maxLines = 5; + BookletChapter chapter = stack.thePage.getChapter(); + String aText = (chapter.pages[0] instanceof PagePicture && chapter.pages.length > 1 ? chapter.pages[1] : chapter.pages[0]).getText(); + List text = Minecraft.getMinecraft().fontRenderer.listFormattedStringToWidth(aText != null ? aText : EnumChatFormatting.DARK_RED+StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".booklet.noText"), 165); + for(int i = 0; i < Math.min(maxLines, text.size()); i++){ + GuiDraw.drawString(text.get(i)+(i == maxLines-1 && text.size() > maxLines ? EnumChatFormatting.RESET+""+EnumChatFormatting.BLACK+"..." : ""), 0, 18+25+i*(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT+1), 0, false); } + GuiDraw.drawString(EnumChatFormatting.GOLD+chapter.getLocalizedName(), 0, 95, 0, false); + GuiDraw.drawString(EnumChatFormatting.GOLD+"Page "+stack.thePage.getID(), 0, 105, 0, false); } } @@ -150,9 +153,11 @@ public class NEIBookletRecipe extends TemplateRecipeHandler implements INEIRecip public class CachedInfoStack extends CachedRecipe{ public ItemStack theStack; + public BookletPage thePage; - public CachedInfoStack(ItemStack theStack){ + public CachedInfoStack(ItemStack theStack, BookletPage thePage){ this.theStack = theStack; + this.thePage = thePage; } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEICoffeeMachineRecipe.java b/src/main/java/ellpeck/actuallyadditions/nei/NEICoffeeMachineRecipe.java index 1b4d65d5f..6abafff4e 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/NEICoffeeMachineRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEICoffeeMachineRecipe.java @@ -16,6 +16,8 @@ import codechicken.nei.PositionedStack; import codechicken.nei.recipe.RecipeInfo; import codechicken.nei.recipe.TemplateRecipeHandler; import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.booklet.BookletUtils; +import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.inventory.gui.GuiCoffeeMachine; import ellpeck.actuallyadditions.items.InitItems; @@ -42,8 +44,8 @@ public class NEICoffeeMachineRecipe extends TemplateRecipeHandler implements INE } @Override - public ItemStack getStackForInfo(int page){ - return new ItemStack(InitBlocks.blockCoffeeMachine); + public BookletPage getPageForInfo(int page){ + return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockCoffeeMachine)); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEICompostRecipe.java b/src/main/java/ellpeck/actuallyadditions/nei/NEICompostRecipe.java index a0dcd9f1d..1c732496e 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/NEICompostRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEICompostRecipe.java @@ -16,6 +16,8 @@ import codechicken.nei.PositionedStack; import codechicken.nei.recipe.RecipeInfo; import codechicken.nei.recipe.TemplateRecipeHandler; import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.booklet.BookletUtils; +import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; @@ -38,8 +40,8 @@ public class NEICompostRecipe extends TemplateRecipeHandler implements INEIRecip } @Override - public ItemStack getStackForInfo(int page){ - return new ItemStack(InitBlocks.blockCompost); + public BookletPage getPageForInfo(int page){ + return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockCompost)); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEICrusherRecipe.java b/src/main/java/ellpeck/actuallyadditions/nei/NEICrusherRecipe.java index 76b00a573..27ef9f877 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/NEICrusherRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEICrusherRecipe.java @@ -15,6 +15,8 @@ import codechicken.nei.PositionedStack; import codechicken.nei.recipe.RecipeInfo; import codechicken.nei.recipe.TemplateRecipeHandler; import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.booklet.BookletUtils; +import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.inventory.gui.GuiGrinder; import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry; import ellpeck.actuallyadditions.util.ItemUtil; @@ -36,8 +38,8 @@ public class NEICrusherRecipe extends TemplateRecipeHandler implements INEIRecip } @Override - public ItemStack getStackForInfo(int page){ - return new ItemStack(InitBlocks.blockGrinder); + public BookletPage getPageForInfo(int page){ + return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockGrinder)); } @Override @@ -131,8 +133,8 @@ public class NEICrusherRecipe extends TemplateRecipeHandler implements INEIRecip public static class Double extends NEICrusherRecipe{ @Override - public ItemStack getStackForInfo(int page){ - return new ItemStack(InitBlocks.blockGrinderDouble); + public BookletPage getPageForInfo(int page){ + return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockGrinderDouble)); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEIFurnaceDoubleRecipe.java b/src/main/java/ellpeck/actuallyadditions/nei/NEIFurnaceDoubleRecipe.java index c0b56d87d..d159ce4a9 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/NEIFurnaceDoubleRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEIFurnaceDoubleRecipe.java @@ -16,6 +16,8 @@ import codechicken.nei.PositionedStack; import codechicken.nei.recipe.RecipeInfo; import codechicken.nei.recipe.TemplateRecipeHandler; import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.booklet.BookletUtils; +import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.inventory.gui.GuiFurnaceDouble; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; @@ -38,8 +40,8 @@ public class NEIFurnaceDoubleRecipe extends TemplateRecipeHandler implements INE } @Override - public ItemStack getStackForInfo(int page){ - return new ItemStack(InitBlocks.blockFurnaceDouble); + public BookletPage getPageForInfo(int page){ + return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockFurnaceDouble)); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEIHairyBallRecipe.java b/src/main/java/ellpeck/actuallyadditions/nei/NEIHairyBallRecipe.java index ec19b1712..1554a6b64 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/NEIHairyBallRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEIHairyBallRecipe.java @@ -15,6 +15,8 @@ import codechicken.nei.NEIServerUtils; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.RecipeInfo; import codechicken.nei.recipe.TemplateRecipeHandler; +import ellpeck.actuallyadditions.booklet.BookletUtils; +import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.recipe.HairyBallHandler; import ellpeck.actuallyadditions.util.ModUtil; @@ -37,8 +39,8 @@ public class NEIHairyBallRecipe extends TemplateRecipeHandler implements INEIRec } @Override - public ItemStack getStackForInfo(int page){ - return new ItemStack(InitItems.itemHairyBall); + public BookletPage getPageForInfo(int page){ + return BookletUtils.getFirstPageForStack(new ItemStack(InitItems.itemHairyBall)); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/nei/NEITreasureChestRecipe.java b/src/main/java/ellpeck/actuallyadditions/nei/NEITreasureChestRecipe.java index 4961bb07e..107edeaf5 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/NEITreasureChestRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/NEITreasureChestRecipe.java @@ -16,6 +16,8 @@ import codechicken.nei.PositionedStack; import codechicken.nei.recipe.RecipeInfo; import codechicken.nei.recipe.TemplateRecipeHandler; import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.booklet.BookletUtils; +import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.recipe.TreasureChestHandler; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; @@ -37,8 +39,8 @@ public class NEITreasureChestRecipe extends TemplateRecipeHandler implements INE } @Override - public ItemStack getStackForInfo(int page){ - return new ItemStack(InitBlocks.blockTreasureChest); + public BookletPage getPageForInfo(int page){ + return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockTreasureChest)); } @Override