diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapter.java b/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapter.java index a1ebbbbd3..5fa0b3cb3 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapter.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapter.java @@ -10,25 +10,28 @@ package ellpeck.actuallyadditions.booklet; -import ellpeck.actuallyadditions.booklet.page.IBookletPage; +import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.StringUtil; +import net.minecraft.item.ItemStack; public class BookletChapter{ - public final IBookletPage[] pages; + public final BookletPage[] pages; private final String unlocalizedName; public final BookletIndexEntry entry; + public final ItemStack displayStack; - public BookletChapter(String unlocalizedName, BookletIndexEntry entry, IBookletPage... pages){ + public BookletChapter(String unlocalizedName, BookletIndexEntry entry, ItemStack displayStack, BookletPage... pages){ this.pages = pages.clone(); this.unlocalizedName = unlocalizedName; entry.addChapter(this); InitBooklet.allAndSearch.addChapter(this); this.entry = entry; + this.displayStack = displayStack; - for(IBookletPage page : this.pages){ + for(BookletPage page : this.pages){ page.setChapter(this); } } diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterCrusher.java b/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterCrusher.java index 03925deb0..cbcbdf360 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterCrusher.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterCrusher.java @@ -10,26 +10,27 @@ package ellpeck.actuallyadditions.booklet; -import ellpeck.actuallyadditions.booklet.page.IBookletPage; +import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.booklet.page.PageCrusherRecipe; import ellpeck.actuallyadditions.recipe.CrusherRecipeManualRegistry; +import net.minecraft.item.ItemStack; import scala.actors.threadpool.Arrays; import java.util.ArrayList; public class BookletChapterCrusher extends BookletChapter{ - public BookletChapterCrusher(String unlocalizedName, BookletIndexEntry entry, IBookletPage... pages){ - super(unlocalizedName, entry, getAllPages(pages)); + public BookletChapterCrusher(String unlocalizedName, BookletIndexEntry entry, ItemStack displayStack, BookletPage... pages){ + super(unlocalizedName, entry, displayStack, getAllPages(pages)); } @SuppressWarnings("unchecked") - private static IBookletPage[] getAllPages(IBookletPage... pages){ - ArrayList list = new ArrayList(); + private static BookletPage[] getAllPages(BookletPage... pages){ + ArrayList list = new ArrayList(); list.addAll(Arrays.asList(pages)); for(CrusherRecipeManualRegistry.CrusherRecipe rec : CrusherRecipeManualRegistry.recipes){ list.add(new PageCrusherRecipe(list.size()+1, rec)); } - return list.toArray(new IBookletPage[list.size()]); + return list.toArray(new BookletPage[list.size()]); } } diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterFurnace.java b/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterFurnace.java index a68fe0b67..57aaaa994 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterFurnace.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/BookletChapterFurnace.java @@ -10,7 +10,7 @@ package ellpeck.actuallyadditions.booklet; -import ellpeck.actuallyadditions.booklet.page.IBookletPage; +import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.booklet.page.PageFurnace; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; @@ -21,17 +21,17 @@ import java.util.Map; public class BookletChapterFurnace extends BookletChapter{ - public BookletChapterFurnace(String unlocalizedName, BookletIndexEntry entry, IBookletPage... pages){ - super(unlocalizedName, entry, getAllPages(pages)); + public BookletChapterFurnace(String unlocalizedName, BookletIndexEntry entry, ItemStack displayStack, BookletPage... pages){ + super(unlocalizedName, entry, displayStack, getAllPages(pages)); } @SuppressWarnings("unchecked") - private static IBookletPage[] getAllPages(IBookletPage... pages){ - ArrayList list = new ArrayList(); + private static BookletPage[] getAllPages(BookletPage... pages){ + ArrayList list = new ArrayList(); list.addAll(Arrays.asList(pages)); for(Object o : FurnaceRecipes.smelting().getSmeltingList().entrySet()){ list.add(new PageFurnace(list.size()+1, (ItemStack)((Map.Entry)o).getKey(), (ItemStack)((Map.Entry)o).getValue())); } - return list.toArray(new IBookletPage[list.size()]); + return list.toArray(new BookletPage[list.size()]); } } diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java index d46adbab5..592952293 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java @@ -12,7 +12,7 @@ package ellpeck.actuallyadditions.booklet; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import ellpeck.actuallyadditions.booklet.page.IBookletPage; +import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.config.GuiConfiguration; import ellpeck.actuallyadditions.update.UpdateChecker; import ellpeck.actuallyadditions.util.*; @@ -44,7 +44,7 @@ public class GuiBooklet extends GuiScreen{ public int guiLeft; public int guiTop; - public IBookletPage currentPage; + public BookletPage currentPage; public BookletChapter currentChapter; public BookletIndexEntry currentIndexEntry; public int pageOpenInIndex; @@ -145,7 +145,7 @@ public class GuiBooklet extends GuiScreen{ this.addButton(new TexturedButton(BUTTON_RETURN_ID, this.guiLeft+this.xSize/2-7, this.guiTop+this.ySize+2, 182, 0, 15, 10)); for(int i = 0; i < BUTTONS_PER_PAGE; i++){ - this.addButton(new IndexButton(this.unicodeRenderer, CHAPTER_BUTTONS_START+i, guiLeft+15, guiTop+10+(i*12), 110, 10, "")); + this.addButton(new IndexButton(CHAPTER_BUTTONS_START+i, guiLeft+15, guiTop+10+(i*12), 110, 10, "", this)); } this.addButton(new TexturedButton(BUTTON_UPDATE_ID, this.guiLeft-11, this.guiTop-11, 245, 0, 11, 11)); @@ -294,7 +294,7 @@ public class GuiBooklet extends GuiScreen{ return KeyUtil.isControlPressed() && KeyUtil.isShiftPressed() && KeyUtil.isAltPressed(); } - private IBookletPage getNextPage(BookletChapter chapter, IBookletPage currentPage){ + private BookletPage getNextPage(BookletChapter chapter, BookletPage currentPage){ for(int i = 0; i < chapter.pages.length; i++){ if(chapter.pages[i] == currentPage){ if(i+1 < chapter.pages.length){ @@ -305,7 +305,7 @@ public class GuiBooklet extends GuiScreen{ return null; } - private IBookletPage getPrevPage(BookletChapter chapter, IBookletPage currentPage){ + private BookletPage getPrevPage(BookletChapter chapter, BookletPage currentPage){ for(int i = 0; i < chapter.pages.length; i++){ if(chapter.pages[i] == currentPage){ if(i-1 >= 0){ @@ -359,7 +359,7 @@ public class GuiBooklet extends GuiScreen{ else if(button.id == BUTTON_FORWARD_ID){ if(this.currentIndexEntry != null){ if(this.currentPage != null){ - IBookletPage page = this.getNextPage(this.currentChapter, this.currentPage); + BookletPage page = this.getNextPage(this.currentChapter, this.currentPage); if(page != null) this.currentPage = page; } else{ @@ -370,7 +370,7 @@ public class GuiBooklet extends GuiScreen{ else if(button.id == BUTTON_BACK_ID){ if(this.currentIndexEntry != null){ if(this.currentPage != null){ - IBookletPage page = this.getPrevPage(this.currentChapter, this.currentPage); + BookletPage page = this.getPrevPage(this.currentChapter, this.currentPage); if(page != null) this.currentPage = page; } else{ @@ -436,25 +436,28 @@ public class GuiBooklet extends GuiScreen{ this.getButton(BUTTON_BACK_ID).visible = this.pageOpenInIndex > 1; for(int i = 0; i < BUTTONS_PER_PAGE; i++){ - GuiButton button = this.getButton(CHAPTER_BUTTONS_START+i); + IndexButton button = (IndexButton)this.getButton(CHAPTER_BUTTONS_START+i); if(entry == null){ boolean entryExists = InitBooklet.entries.size() > i+(BUTTONS_PER_PAGE*this.pageOpenInIndex-BUTTONS_PER_PAGE); button.visible = entryExists; if(entryExists){ button.displayString = InitBooklet.entries.get(i+(BUTTONS_PER_PAGE*this.pageOpenInIndex-BUTTONS_PER_PAGE)).getLocalizedName(); + button.chap = null; } } else{ boolean entryExists = entry.chapters.size() > i+(BUTTONS_PER_PAGE*this.pageOpenInIndex-BUTTONS_PER_PAGE); button.visible = entryExists; if(entryExists){ - button.displayString = entry.chapters.get(i+(BUTTONS_PER_PAGE*this.pageOpenInIndex-BUTTONS_PER_PAGE)).getLocalizedName(); + BookletChapter chap = entry.chapters.get(i+(BUTTONS_PER_PAGE*this.pageOpenInIndex-BUTTONS_PER_PAGE)); + button.displayString = chap.getLocalizedName(); + button.chap = chap; } } } } - public void openChapter(BookletChapter chapter, IBookletPage page){ + public void openChapter(BookletChapter chapter, BookletPage page){ if(chapter == null) return; this.searchField.setVisible(false); @@ -473,8 +476,8 @@ public class GuiBooklet extends GuiScreen{ } } - private boolean hasPage(BookletChapter chapter, IBookletPage page){ - for(IBookletPage aPage : chapter.pages){ + private boolean hasPage(BookletChapter chapter, BookletPage page){ + for(BookletPage aPage : chapter.pages){ if(aPage == page){ return true; } @@ -484,11 +487,12 @@ public class GuiBooklet extends GuiScreen{ private static class IndexButton extends GuiButton{ - private FontRenderer renderer; + private GuiBooklet gui; + public BookletChapter chap; - public IndexButton(FontRenderer renderer, int id, int x, int y, int width, int height, String text){ + public IndexButton(int id, int x, int y, int width, int height, String text, GuiBooklet gui){ super(id, x, y, width, height, text); - this.renderer = renderer; + this.gui = gui; } @Override @@ -505,7 +509,17 @@ public class GuiBooklet extends GuiScreen{ color = 38144; } - this.renderer.drawString((this.field_146123_n ? EnumChatFormatting.UNDERLINE : "")+this.displayString, this.xPosition, this.yPosition+(this.height-8)/2, color); + int textOffsetX = 0; + if(this.chap != null){ + if(this.chap.displayStack != null){ + GL11.glPushMatrix(); + BookletPage.renderItem(this.gui, this.chap.displayStack, this.xPosition-5, this.yPosition, 0.725F); + GL11.glPopMatrix(); + textOffsetX = 8; + } + } + + this.gui.unicodeRenderer.drawString((this.field_146123_n ? EnumChatFormatting.UNDERLINE : "")+this.displayString, this.xPosition+textOffsetX, this.yPosition+(this.height-8)/2, color); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java index ee575ffb1..f593bcbb6 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java @@ -11,26 +11,30 @@ package ellpeck.actuallyadditions.booklet; import ellpeck.actuallyadditions.blocks.InitBlocks; +import ellpeck.actuallyadditions.blocks.metalists.TheColoredLampColors; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; -import ellpeck.actuallyadditions.booklet.page.IBookletPage; +import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.booklet.page.PageCrafting; import ellpeck.actuallyadditions.booklet.page.PageFurnace; -import ellpeck.actuallyadditions.booklet.page.PageText; +import ellpeck.actuallyadditions.booklet.page.PageTextOnly; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.crafting.BlockCrafting; import ellpeck.actuallyadditions.crafting.FoodCrafting; import ellpeck.actuallyadditions.crafting.ItemCrafting; +import ellpeck.actuallyadditions.crafting.ToolCrafting; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheFoods; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; import java.util.ArrayList; public class InitBooklet{ public static ArrayList entries = new ArrayList(); - public static ArrayList pagesWithItemStackData = new ArrayList(); + public static ArrayList pagesWithItemStackData = new ArrayList(); public static BookletChapter chapterIntro; @@ -43,47 +47,64 @@ public class InitBooklet{ public static BookletIndexEntry allAndSearch = new BookletEntryAllSearch("allAndSearch"); static{ - chapterIntro = new BookletChapter("intro", entryMisc, new PageText(1), new PageText(2), new PageCrafting(3, ItemCrafting.recipeBook)); + chapterIntro = new BookletChapter("intro", entryMisc, new ItemStack(InitItems.itemLexicon), new PageTextOnly(1), new PageTextOnly(2), new PageCrafting(3, ItemCrafting.recipeBook)); - new BookletChapter("craftingIngs", entryMisc, new PageText(1), new PageCrafting(2, ItemCrafting.recipeCoil), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced), new PageCrafting(4, BlockCrafting.recipeCase), new PageCrafting(5, BlockCrafting.recipeStoneCase), new PageCrafting(6, BlockCrafting.recipeEnderPearlBlock), new PageCrafting(7, BlockCrafting.recipeEnderCase), new PageCrafting(8, ItemCrafting.recipeRing), new PageCrafting(9, ItemCrafting.recipeKnifeHandle), new PageCrafting(10, ItemCrafting.recipeKnifeBlade), new PageCrafting(11, ItemCrafting.recipeKnife), new PageCrafting(12, ItemCrafting.recipeDough), new PageCrafting(13, ItemCrafting.recipeRiceDough)); - new BookletChapter("quartz", entryMisc, new PageText(1).setStack(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())), new PageText(2).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock), new PageCrafting(4, BlockCrafting.recipeQuartzPillar), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled)); - new BookletChapter("cloud", entryMisc, new PageText(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud)); - new BookletChapter("coalStuff", entryMisc, new PageCrafting(1, ItemCrafting.recipeTinyCoal), new PageCrafting(2, ItemCrafting.recipeTinyChar), new PageCrafting(3, BlockCrafting.recipeBlockChar)); - new BookletChapter("lamps", entryMisc, new PageText(1), new PageCrafting(2, BlockCrafting.recipePowerer), new PageCrafting(3, BlockCrafting.recipesLamps[0]), new PageCrafting(4, BlockCrafting.recipesLamps[1]), new PageCrafting(5, BlockCrafting.recipesLamps[2]), new PageCrafting(6, BlockCrafting.recipesLamps[3]), new PageCrafting(7, BlockCrafting.recipesLamps[4]), new PageCrafting(8, BlockCrafting.recipesLamps[5]), new PageCrafting(9, BlockCrafting.recipesLamps[6]), new PageCrafting(10, BlockCrafting.recipesLamps[7]), new PageCrafting(11, BlockCrafting.recipesLamps[8]), new PageCrafting(12, BlockCrafting.recipesLamps[9]), new PageCrafting(13, BlockCrafting.recipesLamps[10]), new PageCrafting(14, BlockCrafting.recipesLamps[11]), new PageCrafting(15, BlockCrafting.recipesLamps[12]), new PageCrafting(16, BlockCrafting.recipesLamps[13]), new PageCrafting(17, BlockCrafting.recipesLamps[14]), new PageCrafting(18, BlockCrafting.recipesLamps[15])); - new BookletChapter("treasureChest", entryMisc, new PageText(1).setStack(new ItemStack(InitBlocks.blockTreasureChest))); + new BookletChapter("craftingIngs", entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeCoil), new PageCrafting(3, ItemCrafting.recipeCoilAdvanced), new PageCrafting(4, BlockCrafting.recipeCase), new PageCrafting(5, BlockCrafting.recipeStoneCase), new PageCrafting(6, BlockCrafting.recipeEnderPearlBlock), new PageCrafting(7, BlockCrafting.recipeEnderCase), new PageCrafting(8, ItemCrafting.recipeRing), new PageCrafting(9, ItemCrafting.recipeKnifeHandle), new PageCrafting(10, ItemCrafting.recipeKnifeBlade), new PageCrafting(11, ItemCrafting.recipeKnife), new PageCrafting(12, ItemCrafting.recipeDough), new PageCrafting(13, ItemCrafting.recipeRiceDough)); + new BookletChapter("quartz", entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal())), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())), new PageCrafting(3, BlockCrafting.recipeQuartzBlock), new PageCrafting(4, BlockCrafting.recipeQuartzPillar), new PageCrafting(5, BlockCrafting.recipeQuartzChiseled)); + new BookletChapter("cloud", entryMisc, new ItemStack(InitBlocks.blockSmileyCloud), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSmileyCloud)); + new BookletChapter("coalStuff", entryMisc, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.TINY_COAL.ordinal()), new PageCrafting(1, ItemCrafting.recipeTinyCoal), new PageCrafting(2, ItemCrafting.recipeTinyChar), new PageCrafting(3, BlockCrafting.recipeBlockChar)); + new BookletChapter("lamps", entryMisc, new ItemStack(InitBlocks.blockColoredLampOn, 1, TheColoredLampColors.GREEN.ordinal()), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePowerer), new PageCrafting(3, BlockCrafting.recipesLamps[0]), new PageCrafting(4, BlockCrafting.recipesLamps[1]), new PageCrafting(5, BlockCrafting.recipesLamps[2]), new PageCrafting(6, BlockCrafting.recipesLamps[3]), new PageCrafting(7, BlockCrafting.recipesLamps[4]), new PageCrafting(8, BlockCrafting.recipesLamps[5]), new PageCrafting(9, BlockCrafting.recipesLamps[6]), new PageCrafting(10, BlockCrafting.recipesLamps[7]), new PageCrafting(11, BlockCrafting.recipesLamps[8]), new PageCrafting(12, BlockCrafting.recipesLamps[9]), new PageCrafting(13, BlockCrafting.recipesLamps[10]), new PageCrafting(14, BlockCrafting.recipesLamps[11]), new PageCrafting(15, BlockCrafting.recipesLamps[12]), new PageCrafting(16, BlockCrafting.recipesLamps[13]), new PageCrafting(17, BlockCrafting.recipesLamps[14]), new PageCrafting(18, BlockCrafting.recipesLamps[15])); + new BookletChapter("treasureChest", entryMisc, new ItemStack(InitBlocks.blockTreasureChest), new PageTextOnly(1).setStack(new ItemStack(InitBlocks.blockTreasureChest))); - new BookletChapter("breaker", entryFunctionalNonRF, new PageCrafting(1, BlockCrafting.recipeBreaker), new PageCrafting(2, BlockCrafting.recipePlacer), new PageCrafting(3, BlockCrafting.recipeLiquidPlacer), new PageCrafting(4, BlockCrafting.recipeLiquidCollector)); - new BookletChapter("phantomfaces", entryFunctionalNonRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipePhantomface), new PageCrafting(3, BlockCrafting.recipeLiquiface), new PageCrafting(4, BlockCrafting.recipeEnergyface), new PageCrafting(5, ItemCrafting.recipePhantomConnector), new PageCrafting(6, BlockCrafting.recipePhantomBooster)); - new BookletChapter("phantomBreaker", entryFunctionalNonRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipePhantomPlacer), new PageCrafting(3, BlockCrafting.recipePhantomBreaker)); - new BookletChapter("esd", entryFunctionalNonRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipeESD), new PageCrafting(3, BlockCrafting.recipeAdvancedESD)); - new BookletChapter("xpSolidifier", entryFunctionalNonRF, new PageText(1).setStack(new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal())), new PageCrafting(2, BlockCrafting.recipeSolidifier)); - new BookletChapter("greenhouseGlass", entryFunctionalNonRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipeGlass)); - new BookletChapter("fishingNet", entryFunctionalNonRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipeFisher)); - new BookletChapter("feeder", entryFunctionalNonRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipeFeeder)); - new BookletChapter("compost", entryFunctionalNonRF, new PageText(1).setStack(new ItemStack(InitItems.itemFertilizer)), new PageCrafting(2, BlockCrafting.recipeCompost), new PageCrafting(3, ItemCrafting.recipeMashedFood)); - new BookletChapter("crate", entryFunctionalNonRF, new PageCrafting(1, BlockCrafting.recipeCrate)); + ArrayList aiotPages = new ArrayList(); + aiotPages.add(new PageTextOnly(aiotPages.size()+1)); + for(IRecipe recipe : ToolCrafting.recipesPaxels){ + aiotPages.add(new PageCrafting(aiotPages.size()+1, recipe)); + } + new BookletChapter("aiots", entryMisc, new ItemStack(InitItems.emeraldPaxel), aiotPages.toArray(new BookletPage[aiotPages.size()])); - new BookletChapter("coffeeMachine", entryFunctionalRF, new PageText(1), new PageText(2), new PageText(3), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine), new PageCrafting(5, ItemCrafting.recipeCup)); - new BookletChapterCrusher("crusher", entryFunctionalRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipeCrusher), new PageCrafting(3, BlockCrafting.recipeDoubleCrusher)); - new BookletChapterFurnace("furnaceDouble", entryFunctionalRF, new PageCrafting(1, BlockCrafting.recipeFurnace)); - new BookletChapter("miner", entryFunctionalRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipeMiner), new PageCrafting(3, BlockCrafting.recipeCasing)); - new BookletChapter("lavaFactory", entryFunctionalRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipeLavaFactory)); - new BookletChapter("energizer", entryFunctionalRF, new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator)); - new BookletChapter("repairer", entryFunctionalRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipeRepairer)); + new BookletChapter("jams", entryMisc, new ItemStack(InitItems.itemJams), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemJams))); - new BookletChapter("coalGen", entryGeneratingRF, new PageCrafting(1, BlockCrafting.recipeCoalGen)); - new BookletChapter("solarPanel", entryGeneratingRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipeSolar)); - new BookletChapter("heatCollector", entryGeneratingRF, new PageText(1), new PageCrafting(2, BlockCrafting.recipeHeatCollector)); - new BookletChapter("canola", entryGeneratingRF, new PageText(1), new PageText(2).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())), new PageCrafting(3, BlockCrafting.recipeCanolaPress), new PageCrafting(4, BlockCrafting.recipeFermentingBarrel), new PageCrafting(5, BlockCrafting.recipeOilGen)); + ArrayList potionRingPages = new ArrayList(); + potionRingPages.add(new PageTextOnly(potionRingPages.size()+1)); + for(IRecipe recipe : ItemCrafting.recipesPotionRings){ + potionRingPages.add(new PageCrafting(potionRingPages.size()+1, recipe)); + } + new BookletChapter("potionRings", entryMisc, new ItemStack(InitItems.itemPotionRing), potionRingPages.toArray(new BookletPage[potionRingPages.size()])); - new BookletChapter("wings", entryItemsNonRF, new PageText(1).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal())), new PageCrafting(2, ItemCrafting.recipeWings)); - new BookletChapter("foods", entryItemsNonRF, new PageCrafting(1, FoodCrafting.recipePizza), new PageFurnace(2, new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE_BREAD.ordinal())), new PageCrafting(3, FoodCrafting.recipeHamburger), new PageCrafting(4, FoodCrafting.recipeBigCookie), new PageCrafting(5, FoodCrafting.recipeSubSandwich), new PageCrafting(6, FoodCrafting.recipeFrenchFry), new PageCrafting(7, FoodCrafting.recipeFrenchFries), new PageCrafting(8, FoodCrafting.recipeFishNChips), new PageCrafting(9, FoodCrafting.recipeCheese), new PageCrafting(10, FoodCrafting.recipePumpkinStew), new PageCrafting(11, FoodCrafting.recipeCarrotJuice), new PageCrafting(12, FoodCrafting.recipeSpaghetti), new PageCrafting(13, FoodCrafting.recipeNoodle), new PageCrafting(14, FoodCrafting.recipeChocolate), new PageCrafting(15, FoodCrafting.recipeChocolateCake), new PageCrafting(16, FoodCrafting.recipeToast), new PageFurnace(17, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()))); + new BookletChapter("breaker", entryFunctionalNonRF, new ItemStack(InitBlocks.blockBreaker), new PageCrafting(1, BlockCrafting.recipeBreaker), new PageCrafting(2, BlockCrafting.recipePlacer), new PageCrafting(3, BlockCrafting.recipeLiquidPlacer), new PageCrafting(4, BlockCrafting.recipeLiquidCollector)); + new BookletChapter("phantomfaces", entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomLiquiface), new PageTextOnly(1).addTextReplacement("", ConfigIntValues.PHANTOMFACE_RANGE.getValue()), new PageCrafting(2, BlockCrafting.recipePhantomface), new PageCrafting(3, BlockCrafting.recipeLiquiface), new PageCrafting(4, BlockCrafting.recipeEnergyface), new PageCrafting(5, ItemCrafting.recipePhantomConnector), new PageCrafting(6, BlockCrafting.recipePhantomBooster)); + new BookletChapter("phantomBreaker", entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomBreaker), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePhantomPlacer), new PageCrafting(3, BlockCrafting.recipePhantomBreaker)); + new BookletChapter("esd", entryFunctionalNonRF, new ItemStack(InitBlocks.blockInputterAdvanced), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD), new PageCrafting(3, BlockCrafting.recipeAdvancedESD)); + new BookletChapter("xpSolidifier", entryFunctionalNonRF, new ItemStack(InitBlocks.blockXPSolidifier), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal())), new PageCrafting(2, BlockCrafting.recipeSolidifier)); + new BookletChapter("greenhouseGlass", entryFunctionalNonRF, new ItemStack(InitBlocks.blockGreenhouseGlass), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass)); + new BookletChapter("fishingNet", entryFunctionalNonRF, new ItemStack(InitBlocks.blockFishingNet), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFisher)); + new BookletChapter("feeder", entryFunctionalNonRF, new ItemStack(InitBlocks.blockFeeder), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFeeder)); + new BookletChapter("compost", entryFunctionalNonRF, new ItemStack(InitBlocks.blockCompost), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemFertilizer)), new PageCrafting(2, BlockCrafting.recipeCompost), new PageCrafting(3, ItemCrafting.recipeMashedFood)); + new BookletChapter("crate", entryFunctionalNonRF, new ItemStack(InitBlocks.blockGiantChest), new PageCrafting(1, BlockCrafting.recipeCrate)); - new BookletChapter("drill", entryItemsRF, new PageText(1), new PageCrafting(2, ItemCrafting.recipeDrill), new PageCrafting(3, ItemCrafting.recipeDrillSpeedI), new PageCrafting(4, ItemCrafting.recipeDrillSpeedII), new PageCrafting(5, ItemCrafting.recipeDrillSpeedIII), new PageCrafting(6, ItemCrafting.recipeDrillFortuneI), new PageCrafting(7, ItemCrafting.recipeDrillFortuneII), new PageCrafting(8, ItemCrafting.recipeDrillSilk), new PageCrafting(9, ItemCrafting.recipeDrillThree), new PageCrafting(10, ItemCrafting.recipeDrillFive), new PageCrafting(11, ItemCrafting.recipeDrillPlacing)); - new BookletChapter("staff", entryItemsRF, new PageText(1), new PageCrafting(2, ItemCrafting.recipeStaff)); - new BookletChapter("magnetRing", entryItemsRF, new PageCrafting(1, ItemCrafting.recipeMagnetRing)); - new BookletChapter("growthRing", entryItemsRF, new PageCrafting(1, ItemCrafting.recipeGrowthRing)); - new BookletChapter("waterRemovalRing", entryItemsRF, new PageCrafting(1, ItemCrafting.recipeWaterRing)); - new BookletChapter("batteries", entryItemsRF, new PageText(1), new PageCrafting(2, ItemCrafting.recipeBattery), new PageCrafting(3, ItemCrafting.recipeBatteryDouble), new PageCrafting(4, ItemCrafting.recipeBatteryTriple), new PageCrafting(5, ItemCrafting.recipeBatteryQuadruple), new PageCrafting(6, ItemCrafting.recipeBatteryQuintuple)); + new BookletChapter("coffeeMachine", entryFunctionalRF, new ItemStack(InitBlocks.blockCoffeeMachine), new PageTextOnly(1), new PageTextOnly(2), new PageTextOnly(3), new PageCrafting(4, BlockCrafting.recipeCoffeeMachine), new PageCrafting(5, ItemCrafting.recipeCup)); + new BookletChapterCrusher("crusher", entryFunctionalRF, new ItemStack(InitBlocks.blockGrinderDouble), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeCrusher), new PageCrafting(3, BlockCrafting.recipeDoubleCrusher)); + new BookletChapterFurnace("furnaceDouble", entryFunctionalRF, new ItemStack(InitBlocks.blockFurnaceDouble), new PageCrafting(1, BlockCrafting.recipeFurnace)); + new BookletChapter("miner", entryFunctionalRF, new ItemStack(InitBlocks.blockOreMagnet), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeMiner), new PageCrafting(3, BlockCrafting.recipeCasing)); + new BookletChapter("lavaFactory", entryFunctionalRF, new ItemStack(InitBlocks.blockLavaFactoryController), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeLavaFactory)); + new BookletChapter("energizer", entryFunctionalRF, new ItemStack(InitBlocks.blockEnergizer), new PageCrafting(1, BlockCrafting.recipeEnergizer), new PageCrafting(2, BlockCrafting.recipeEnervator)); + new BookletChapter("repairer", entryFunctionalRF, new ItemStack(InitBlocks.blockItemRepairer), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeRepairer)); + + new BookletChapter("coalGen", entryGeneratingRF, new ItemStack(InitBlocks.blockCoalGenerator), new PageCrafting(1, BlockCrafting.recipeCoalGen)); + new BookletChapter("solarPanel", entryGeneratingRF, new ItemStack(InitBlocks.blockFurnaceSolar), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeSolar)); + new BookletChapter("heatCollector", entryGeneratingRF, new ItemStack(InitBlocks.blockHeatCollector), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeHeatCollector)); + new BookletChapter("canola", entryGeneratingRF, new ItemStack(InitBlocks.blockFermentingBarrel), new PageTextOnly(1), new PageTextOnly(2).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal())), new PageCrafting(3, BlockCrafting.recipeCanolaPress), new PageCrafting(4, BlockCrafting.recipeFermentingBarrel), new PageCrafting(5, BlockCrafting.recipeOilGen)); + + new BookletChapter("wings", entryItemsNonRF, new ItemStack(InitItems.itemWingsOfTheBats), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal())), new PageCrafting(2, ItemCrafting.recipeWings)); + new BookletChapter("foods", entryItemsNonRF, new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipePizza), new PageFurnace(2, new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE_BREAD.ordinal())), new PageCrafting(3, FoodCrafting.recipeHamburger), new PageCrafting(4, FoodCrafting.recipeBigCookie), new PageCrafting(5, FoodCrafting.recipeSubSandwich), new PageCrafting(6, FoodCrafting.recipeFrenchFry), new PageCrafting(7, FoodCrafting.recipeFrenchFries), new PageCrafting(8, FoodCrafting.recipeFishNChips), new PageCrafting(9, FoodCrafting.recipeCheese), new PageCrafting(10, FoodCrafting.recipePumpkinStew), new PageCrafting(11, FoodCrafting.recipeCarrotJuice), new PageCrafting(12, FoodCrafting.recipeSpaghetti), new PageCrafting(13, FoodCrafting.recipeNoodle), new PageCrafting(14, FoodCrafting.recipeChocolate), new PageCrafting(15, FoodCrafting.recipeChocolateCake), new PageCrafting(16, FoodCrafting.recipeToast), new PageFurnace(17, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()))); + new BookletChapter("leafBlower", entryItemsNonRF, new ItemStack(InitItems.itemLeafBlowerAdvanced), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLeafBlower), new PageCrafting(3, ItemCrafting.recipeLeafBlowerAdvanced)); + + new BookletChapter("drill", entryItemsRF, new ItemStack(InitItems.itemDrill), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeDrill), new PageCrafting(3, ItemCrafting.recipeDrillSpeedI), new PageCrafting(4, ItemCrafting.recipeDrillSpeedII), new PageCrafting(5, ItemCrafting.recipeDrillSpeedIII), new PageCrafting(6, ItemCrafting.recipeDrillFortuneI), new PageCrafting(7, ItemCrafting.recipeDrillFortuneII), new PageCrafting(8, ItemCrafting.recipeDrillSilk), new PageCrafting(9, ItemCrafting.recipeDrillThree), new PageCrafting(10, ItemCrafting.recipeDrillFive), new PageCrafting(11, ItemCrafting.recipeDrillPlacing)); + new BookletChapter("staff", entryItemsRF, new ItemStack(InitItems.itemTeleStaff), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeStaff)); + new BookletChapter("magnetRing", entryItemsRF, new ItemStack(InitItems.itemMagnetRing), new PageCrafting(1, ItemCrafting.recipeMagnetRing)); + new BookletChapter("growthRing", entryItemsRF, new ItemStack(InitItems.itemGrowthRing), new PageCrafting(1, ItemCrafting.recipeGrowthRing)); + 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), new PageCrafting(3, ItemCrafting.recipeBatteryDouble), new PageCrafting(4, ItemCrafting.recipeBatteryTriple), new PageCrafting(5, ItemCrafting.recipeBatteryQuadruple), new PageCrafting(6, ItemCrafting.recipeBatteryQuintuple)); } } diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java index 7204c3fff..1fcfcd5f8 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java @@ -25,9 +25,21 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; +import java.util.ArrayList; import java.util.List; -public class BookletPage implements IBookletPage{ +public class BookletPage{ + + private static class TextReplacement{ + public String text; + public String replacement; + + public TextReplacement(String text, String replacement){ + this.text = text; + this.replacement = replacement; + } + } + private ArrayList textReplacements = new ArrayList(); protected int id; protected BookletChapter chapter; @@ -36,37 +48,43 @@ public class BookletPage implements IBookletPage{ this.id = id; } - @Override public int getID(){ return this.id; } - @Override public void setChapter(BookletChapter chapter){ this.chapter = chapter; } - @Override public BookletChapter getChapter(){ return this.chapter; } - @Override - public String getText(){ - return StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".chapter."+this.chapter.getUnlocalizedName()+".text."+this.id).replaceAll("", EnumChatFormatting.DARK_GREEN+"").replaceAll("", EnumChatFormatting.BLUE+"").replaceAll("", EnumChatFormatting.BLACK+"").replaceAll("", "\n").replaceAll("", EnumChatFormatting.ITALIC+"").replaceAll("", EnumChatFormatting.RESET+""); + public final String getText(){ + String base = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".chapter."+this.chapter.getUnlocalizedName()+".text."+this.id).replaceAll("", EnumChatFormatting.DARK_GREEN+"").replaceAll("", EnumChatFormatting.BLUE+"").replaceAll("", EnumChatFormatting.BLACK+"").replaceAll("", "\n").replaceAll("", EnumChatFormatting.ITALIC+"").replaceAll("", EnumChatFormatting.RESET+""); + for(TextReplacement rep : this.textReplacements){ + base = base.replaceAll(rep.text, rep.replacement); + } + return base; + } + + public BookletPage addTextReplacement(String text, String replacement){ + textReplacements.add(new TextReplacement(text, replacement)); + return this; + } + + public BookletPage addTextReplacement(String text, int replacement){ + return this.addTextReplacement(text, Integer.toString(replacement)); } - @Override public void renderPre(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick){ } - @Override public void render(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick){ } - @Override public ItemStack getItemStackForPage(){ return null; } @@ -85,7 +103,7 @@ public class BookletPage implements IBookletPage{ } if(checkAndTransfer){ - for(IBookletPage page : InitBooklet.pagesWithItemStackData){ + for(BookletPage page : InitBooklet.pagesWithItemStackData){ if(page.getItemStackForPage() != null && page.getItemStackForPage().isItemEqual(stack)){ list.add(EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe")); @@ -103,7 +121,7 @@ public class BookletPage implements IBookletPage{ gui.drawHoveringText(list, x, y); } - protected void renderItem(GuiBooklet gui, ItemStack stack, int x, int y){ + public static void renderItem(GuiBooklet gui, ItemStack stack, int x, int y, float scale){ GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); @@ -112,6 +130,7 @@ public class BookletPage implements IBookletPage{ GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); GL11.glTranslated(x, y, 0); + GL11.glScalef(scale, scale, scale); RenderItem.getInstance().renderItemAndEffectIntoGUI(gui.unicodeRenderer, gui.mc.getTextureManager(), stack, 0, 0); RenderItem.getInstance().renderItemOverlayIntoGUI(gui.mc.fontRenderer, gui.mc.getTextureManager(), stack, 0, 0); GL11.glPopMatrix(); diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/IBookletPage.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/IBookletPage.java deleted file mode 100644 index 07d357c96..000000000 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/IBookletPage.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file ("IBookletPage.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.page; - -import ellpeck.actuallyadditions.booklet.BookletChapter; -import ellpeck.actuallyadditions.booklet.GuiBooklet; -import net.minecraft.item.ItemStack; - -public interface IBookletPage{ - - int getID(); - - void setChapter(BookletChapter chapter); - - BookletChapter getChapter(); - - String getText(); - - void renderPre(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick); - - void render(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick); - - ItemStack getItemStackForPage(); -} diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrafting.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrafting.java index edd21276a..f2dd0dbc7 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrafting.java @@ -103,7 +103,7 @@ public class PageCrafting extends BookletPage{ int xShowOutput = gui.guiLeft+27+82; int yShowOutput = gui.guiTop+20+22; - this.renderItem(gui, recipe.getRecipeOutput(), xShowOutput, yShowOutput); + renderItem(gui, recipe.getRecipeOutput(), xShowOutput, yShowOutput, 1.0F); for(int i = 0; i < 2; i++){ boolean tooltip = i == 1; for(int x = 0; x < width; x++){ @@ -114,7 +114,7 @@ public class PageCrafting extends BookletPage{ int xShow = gui.guiLeft+27+4+x*18; int yShow = gui.guiTop+20+4+y*18; if(!tooltip){ - this.renderItem(gui, stack, xShow, yShow); + renderItem(gui, stack, xShow, yShow, 1.0F); } else{ if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){ diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java index 8d79b9ecd..21ea27d6d 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java @@ -74,7 +74,7 @@ public class PageCrusherRecipe extends BookletPage{ int xShow = gui.guiLeft+37+(j == 0 ? 1 : (j == 1 ? 43 : (j == 2 ? 43 : 0))); int yShow = gui.guiTop+20+(j == 0 ? 21 : (j == 1 ? 11 : (j == 2 ? 29 : 0))); if(!tooltip){ - this.renderItem(gui, stack, xShow, yShow); + renderItem(gui, stack, xShow, yShow, 1.0F); } else{ if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){ diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageFurnace.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageFurnace.java index fb74048d8..d6cdd5621 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageFurnace.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageFurnace.java @@ -75,7 +75,7 @@ public class PageFurnace extends BookletPage{ int xShow = gui.guiLeft+37+1+x*42; int yShow = gui.guiTop+20+21; if(!tooltip){ - this.renderItem(gui, stack, xShow, yShow); + renderItem(gui, stack, xShow, yShow, 1.0F); } else{ if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){ diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageText.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageTextOnly.java similarity index 90% rename from src/main/java/ellpeck/actuallyadditions/booklet/page/PageText.java rename to src/main/java/ellpeck/actuallyadditions/booklet/page/PageTextOnly.java index 33ea06a6d..86fc39eab 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageText.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageTextOnly.java @@ -14,15 +14,15 @@ import ellpeck.actuallyadditions.booklet.GuiBooklet; import ellpeck.actuallyadditions.booklet.InitBooklet; import net.minecraft.item.ItemStack; -public class PageText extends BookletPage{ +public class PageTextOnly extends BookletPage{ private ItemStack stack; - public PageText(int id){ + public PageTextOnly(int id){ super(id); } - public PageText setStack(ItemStack stack){ + public PageTextOnly setStack(ItemStack stack){ if(!InitBooklet.pagesWithItemStackData.contains(this)){ InitBooklet.pagesWithItemStackData.add(this); } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index c8d3a864d..af1d37f40 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -30,6 +30,8 @@ import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; +import java.util.ArrayList; + public class ItemCrafting{ public static IRecipe recipePhantomConnector; @@ -66,6 +68,9 @@ public class ItemCrafting{ public static IRecipe recipeRing; public static IRecipe recipeDough; public static IRecipe recipeRiceDough; + public static IRecipe recipeLeafBlower; + public static IRecipe recipeLeafBlowerAdvanced; + public static ArrayList recipesPotionRings = new ArrayList(); public static void init(){ @@ -96,6 +101,7 @@ public class ItemCrafting{ 'I', "ingotIron", 'P', new ItemStack(Blocks.piston), 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); + recipeLeafBlower = Util.lastIRecipe(); } //Drill @@ -347,6 +353,7 @@ public class ItemCrafting{ 'D', "gemDiamond", 'P', new ItemStack(Blocks.piston), 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); + recipeLeafBlowerAdvanced = Util.lastIRecipe(); } //Phantom Connector @@ -459,7 +466,9 @@ public class ItemCrafting{ public static void addRingRecipeWithStack(ItemStack mainStack, int meta){ GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRing, 1, meta), mainStack, mainStack, mainStack, mainStack, new ItemStack(Blocks.diamond_block), new ItemStack(Items.nether_wart), new ItemStack(Items.potionitem), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal())); + recipesPotionRings.add(Util.lastIRecipe()); GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRingAdvanced, 1, meta), new ItemStack(InitItems.itemPotionRing, 1, meta), new ItemStack(Items.nether_star), new ItemStack(Items.nether_star)); + recipesPotionRings.add(Util.lastIRecipe()); } public static void initMashedFoodRecipes(){ diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java index 169c4243c..df2f741af 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java @@ -14,14 +14,20 @@ import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; +import ellpeck.actuallyadditions.util.Util; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; +import java.util.ArrayList; + public class ToolCrafting{ + public static ArrayList recipesPaxels = new ArrayList(); + public static void init(){ if(ConfigCrafting.TOOL_EMERALD.isEnabled()){ @@ -188,48 +194,56 @@ public class ToolCrafting{ new ItemStack(Items.wooden_shovel), new ItemStack(Items.wooden_sword), new ItemStack(Items.wooden_hoe))); + recipesPaxels.add(Util.lastIRecipe()); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.stonePaxel), new ItemStack(Items.stone_axe), new ItemStack(Items.stone_pickaxe), new ItemStack(Items.stone_shovel), new ItemStack(Items.stone_sword), new ItemStack(Items.stone_hoe))); + recipesPaxels.add(Util.lastIRecipe()); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.ironPaxel), new ItemStack(Items.iron_axe), new ItemStack(Items.iron_pickaxe), new ItemStack(Items.iron_shovel), new ItemStack(Items.iron_sword), new ItemStack(Items.iron_hoe))); + recipesPaxels.add(Util.lastIRecipe()); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.goldPaxel), new ItemStack(Items.golden_axe), new ItemStack(Items.golden_pickaxe), new ItemStack(Items.golden_shovel), new ItemStack(Items.golden_sword), new ItemStack(Items.golden_hoe))); + recipesPaxels.add(Util.lastIRecipe()); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.diamondPaxel), new ItemStack(Items.diamond_axe), new ItemStack(Items.diamond_pickaxe), new ItemStack(Items.diamond_shovel), new ItemStack(Items.diamond_sword), new ItemStack(Items.diamond_hoe))); + recipesPaxels.add(Util.lastIRecipe()); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.emeraldPaxel), new ItemStack(InitItems.itemAxeEmerald), new ItemStack(InitItems.itemPickaxeEmerald), new ItemStack(InitItems.itemSwordEmerald), new ItemStack(InitItems.itemShovelEmerald), new ItemStack(InitItems.itemHoeEmerald))); + recipesPaxels.add(Util.lastIRecipe()); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.obsidianPaxel), new ItemStack(InitItems.itemAxeObsidian), new ItemStack(InitItems.itemPickaxeObsidian), new ItemStack(InitItems.itemSwordObsidian), new ItemStack(InitItems.itemShovelObsidian), new ItemStack(InitItems.itemHoeObsidian))); + recipesPaxels.add(Util.lastIRecipe()); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.quartzPaxel), new ItemStack(InitItems.itemAxeQuartz), new ItemStack(InitItems.itemPickaxeQuartz), new ItemStack(InitItems.itemSwordQuartz), new ItemStack(InitItems.itemShovelQuartz), new ItemStack(InitItems.itemHoeQuartz))); + recipesPaxels.add(Util.lastIRecipe()); } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java b/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java index acd77f42d..58d35012d 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java @@ -14,10 +14,12 @@ import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.config.values.ConfigCrafting; +import ellpeck.actuallyadditions.crafting.ToolCrafting; import ellpeck.actuallyadditions.creative.CreativeTab; import ellpeck.actuallyadditions.items.tools.ItemAllToolAA; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.Util; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemTool; @@ -56,6 +58,7 @@ public class InitForeignPaxels{ if(ConfigCrafting.PAXELS.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(mtPaxels[i], axe, pickaxe, hoe, sword, shovel)); + ToolCrafting.recipesPaxels.add(Util.lastIRecipe()); } } } @@ -83,6 +86,7 @@ public class InitForeignPaxels{ if(ConfigCrafting.PAXELS.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(tfPaxels[i], axe, pickaxe, hoe, sword, shovel)); + ToolCrafting.recipesPaxels.add(Util.lastIRecipe()); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java index 9f7310e5e..c4d914a72 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java @@ -15,7 +15,7 @@ import org.apache.logging.log4j.Logger; public class ModUtil{ - public static final String VERSION = "1.7.10-0.0.8.1"; + public static final String VERSION = "1.7.10-0.0.8.0"; public static final String MOD_ID = "ActuallyAdditions"; public static final String NAME = "Actually Additions"; diff --git a/src/main/java/ellpeck/actuallyadditions/util/PersistantVariables.java b/src/main/java/ellpeck/actuallyadditions/util/PersistantVariables.java index 8ec8ba09c..7bed0b5c8 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/PersistantVariables.java +++ b/src/main/java/ellpeck/actuallyadditions/util/PersistantVariables.java @@ -16,7 +16,7 @@ import ellpeck.actuallyadditions.booklet.BookletChapter; import ellpeck.actuallyadditions.booklet.BookletIndexEntry; import ellpeck.actuallyadditions.booklet.GuiBooklet; import ellpeck.actuallyadditions.booklet.InitBooklet; -import ellpeck.actuallyadditions.booklet.page.IBookletPage; +import ellpeck.actuallyadditions.booklet.page.BookletPage; import net.minecraft.client.Minecraft; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; @@ -30,7 +30,7 @@ public class PersistantVariables{ private static File theFile; - public static void saveBookPage(BookletIndexEntry entry, BookletChapter chapter, IBookletPage page, int pageInIndex){ + public static void saveBookPage(BookletIndexEntry entry, BookletChapter chapter, BookletPage page, int pageInIndex){ NBTTagCompound compound = getCompound(); if(compound != null){ compound.setInteger(getName("Entry"), entry == null ? -1 : InitBooklet.entries.indexOf(entry)); @@ -51,7 +51,7 @@ public class PersistantVariables{ BookletIndexEntry currentIndexEntry = entry == -1 ? null : InitBooklet.entries.get(entry); BookletChapter currentChapter = chapter == -1 || entry == -1 ? null : currentIndexEntry.chapters.get(chapter); - IBookletPage currentPage = chapter == -1 ? null : currentChapter.pages[page-1]; + BookletPage currentPage = chapter == -1 ? null : currentChapter.pages[page-1]; int pageInIndex = compound.getInteger(getName("PageInIndex")); gui.openIndexEntry(currentIndexEntry, pageInIndex, true); diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index efba68909..c0282917e 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -384,7 +384,7 @@ booklet.actuallyadditions.chapter.cloud.text.1=A Smiley Cloud is a neat booklet.actuallyadditions.chapter.cloud.text.2=The Crafting Recipe is shown above. If you want to know what certain name changes do, try naming a cloud "Ellpeck", "Glenthor" or "AcidBlues". booklet.actuallyadditions.chapter.phantomfaces.name=Phantomfaces -booklet.actuallyadditions.chapter.phantomfaces.text.1=A Phantomface is a block that you can connect to any inventory by using a Phantom Connector. When connected, the Phantomface will act as if it was the corresponding inventory, accepting Items from pipes and hoppers and having items be able to get pulled out of the face (the same applies for energyfaces with RF and liquifaces with fluids.) a Phantomfaces has a default range of 15 blocks that can be enlarged with Phantom Boosters. +booklet.actuallyadditions.chapter.phantomfaces.text.1=A Phantomface is a block that you can connect to any inventory by using a Phantom Connector. When connected, the Phantomface will act as if it was the corresponding inventory, accepting Items from pipes and hoppers and having items be able to get pulled out of the face (the same applies for energyfaces with RF and liquifaces with fluids.) a Phantomfaces has a default range of blocks that can be enlarged with Phantom Boosters. booklet.actuallyadditions.chapter.phantomfaces.text.2=The normal Phantomface can connect to inventories like chests and furnaces, transfering Items into and out of them. booklet.actuallyadditions.chapter.phantomfaces.text.3=The Phantom Liquiface can connect to tanks and such, allowing all types of liquids to be pumped through. Giving it a Redstone Signal will cause it to auto-output. booklet.actuallyadditions.chapter.phantomfaces.text.4=The Phantom Energyface can connect to things like generators and crushers, allowing for RF to flow through them into and out of machines.