From 4dc1d17c1891a99298442bfd38c436a510471901 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 3 Oct 2015 23:28:32 +0200 Subject: [PATCH] Fixed what I just did and crusher recipe handler for the booklet --- .../booklet/InitBooklet.java | 12 +-- .../booklet/page/BookletPage.java | 2 +- .../booklet/page/PageCrusherRecipe.java | 69 +++++++------- .../crafting/BlockCrafting.java | 92 +++++++++---------- .../crafting/CrusherCrafting.java | 4 + .../crafting/FoodCrafting.java | 30 +++--- .../crafting/ItemCrafting.java | 68 +++++++------- .../crafting/MiscCrafting.java | 8 +- .../crafting/ToolCrafting.java | 16 ++-- .../actuallyadditions/event/KeyStates.java | 10 +- .../actuallyadditions/event/TooltipEvent.java | 2 +- .../items/InitForeignPaxels.java | 4 +- .../ellpeck/actuallyadditions/util/Util.java | 22 +++-- 13 files changed, 176 insertions(+), 163 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java index e70d52d98..cd7ec7cd5 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/InitBooklet.java @@ -13,15 +13,9 @@ 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.BookletPage; -import ellpeck.actuallyadditions.booklet.page.PageCrafting; -import ellpeck.actuallyadditions.booklet.page.PageFurnace; -import ellpeck.actuallyadditions.booklet.page.PageTextOnly; +import ellpeck.actuallyadditions.booklet.page.*; 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.crafting.*; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.TheFoods; import ellpeck.actuallyadditions.items.metalists.TheMiscItems; @@ -95,7 +89,7 @@ public class InitBooklet{ //No RF Using Items 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).setNoText()); - new BookletChapter("foods", entryItemsNonRF, new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipePizza).setNoText(), new PageFurnace(2, new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE_BREAD.ordinal())).setNoText(), new PageCrafting(3, FoodCrafting.recipeHamburger).setNoText(), new PageCrafting(4, FoodCrafting.recipeBigCookie).setNoText(), new PageCrafting(5, FoodCrafting.recipeSubSandwich).setNoText(), new PageCrafting(6, FoodCrafting.recipeFrenchFry).setNoText(), new PageCrafting(7, FoodCrafting.recipeFrenchFries).setNoText(), new PageCrafting(8, FoodCrafting.recipeFishNChips).setNoText(), new PageCrafting(9, FoodCrafting.recipeCheese).setNoText(), new PageCrafting(10, FoodCrafting.recipePumpkinStew).setNoText(), new PageCrafting(11, FoodCrafting.recipeCarrotJuice).setNoText(), new PageCrafting(12, FoodCrafting.recipeSpaghetti).setNoText(), new PageCrafting(13, FoodCrafting.recipeNoodle).setNoText(), new PageCrafting(14, FoodCrafting.recipeChocolate).setNoText(), new PageCrafting(15, FoodCrafting.recipeChocolateCake).setNoText(), new PageCrafting(16, FoodCrafting.recipeToast).setNoText(), new PageFurnace(17, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal())).setNoText()); + new BookletChapter("foods", entryItemsNonRF, new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), new PageCrafting(1, FoodCrafting.recipePizza).setNoText(), new PageFurnace(2, new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE_BREAD.ordinal())).setNoText(), new PageCrafting(3, FoodCrafting.recipeHamburger).setNoText(), new PageCrafting(4, FoodCrafting.recipeBigCookie).setNoText(), new PageCrafting(5, FoodCrafting.recipeSubSandwich).setNoText(), new PageCrafting(6, FoodCrafting.recipeFrenchFry).setNoText(), new PageCrafting(7, FoodCrafting.recipeFrenchFries).setNoText(), new PageCrafting(8, FoodCrafting.recipeFishNChips).setNoText(), new PageCrafting(9, FoodCrafting.recipeCheese).setNoText(), new PageCrafting(10, FoodCrafting.recipePumpkinStew).setNoText(), new PageCrafting(11, FoodCrafting.recipeCarrotJuice).setNoText(), new PageCrafting(12, FoodCrafting.recipeSpaghetti).setNoText(), new PageCrafting(13, FoodCrafting.recipeNoodle).setNoText(), new PageCrafting(14, FoodCrafting.recipeChocolate).setNoText(), new PageCrafting(15, FoodCrafting.recipeChocolateCake).setNoText(), new PageCrafting(16, FoodCrafting.recipeToast).setNoText(), new PageFurnace(17, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal())).setNoText(), new PageCrusherRecipe(18, CrusherCrafting.recipeSugar).setNoText()); new BookletChapter("leafBlower", entryItemsNonRF, new ItemStack(InitItems.itemLeafBlowerAdvanced), new PageTextOnly(1), new PageCrafting(2, ItemCrafting.recipeLeafBlower).setNoText(), new PageCrafting(3, ItemCrafting.recipeLeafBlowerAdvanced).setNoText()); ArrayList aiotPages = new ArrayList(); aiotPages.add(new PageTextOnly(aiotPages.size()+1)); diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java index 6641069d1..54d5b92f2 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/BookletPage.java @@ -129,7 +129,7 @@ public class BookletPage{ if(ItemUtil.contains(page.getItemStacksForPage(), stack, true)){ list.add(EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe")); - if(KeyStates.mouseButtonState.isPressed()){ + if(KeyStates.mouseButtonState.checkPressed(true)){ gui.openIndexEntry(page.getChapter().entry, InitBooklet.entries.indexOf(page.getChapter().entry)/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true); gui.openChapter(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/booklet/page/PageCrusherRecipe.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java index 76b2ff578..fd7df82a0 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java @@ -19,6 +19,8 @@ import ellpeck.actuallyadditions.util.Util; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import java.util.ArrayList; + public class PageCrusherRecipe extends BookletPage{ @@ -58,41 +60,44 @@ public class PageCrusherRecipe extends BookletPage{ gui.mc.fontRenderer.drawSplitString(text, gui.guiLeft+14, gui.guiTop+100, 115, 0); } - if(recipe.outputTwoChance > 0){ - gui.mc.fontRenderer.drawString(recipe.outputTwoChance+"%", gui.guiLeft+37+62, gui.guiTop+20+33, 0); - } + if(recipe != null){ + if(recipe.outputTwoChance > 0){ + gui.mc.fontRenderer.drawString(recipe.outputTwoChance+"%", gui.guiLeft+37+62, gui.guiTop+20+33, 0); + } - if(recipe.getRecipeOutputOnes() != null){ - for(int i = 0; i < 2; i++){ - for(int j = 0; j < 3; j++){ - ItemStack stack; - switch(j){ - case 0: - stack = this.recipe.getRecipeInputs().get(this.inputPos); - break; - case 1: - stack = this.recipe.getRecipeOutputOnes().get(this.outOnePos); - break; - default: - stack = this.recipe.getRecipeOutputTwos().get(this.outTwoPos); - break; - } - - if(stack != null){ - if(stack.getItemDamage() == Util.WILDCARD){ - stack.setItemDamage(0); + if(recipe.getRecipeOutputOnes() != null){ + for(int i = 0; i < 2; i++){ + for(int j = 0; j < 3; j++){ + ItemStack stack; + switch(j){ + case 0: + stack = this.recipe.getRecipeInputs().get(this.inputPos); + break; + case 1: + stack = this.recipe.getRecipeOutputOnes().get(this.outOnePos); + break; + default: + ArrayList outputTwos = this.recipe.getRecipeOutputTwos(); + stack = outputTwos == null ? null : outputTwos.get(this.outTwoPos); + break; } - boolean tooltip = i == 1; + if(stack != null){ + if(stack.getItemDamage() == Util.WILDCARD){ + stack.setItemDamage(0); + } - 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){ - renderItem(gui, stack, xShow, yShow, 1.0F); - } - else{ - if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){ - this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, j == 0); + boolean tooltip = i == 1; + + 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){ + renderItem(gui, stack, xShow, yShow, 1.0F); + } + else{ + if(mouseX >= xShow && mouseX <= xShow+16 && mouseY >= yShow && mouseY <= yShow+16){ + this.renderTooltipAndTransfer(gui, stack, mouseX, mouseY, j == 0); + } } } } @@ -110,7 +115,7 @@ public class PageCrusherRecipe extends BookletPage{ else if(this.outOnePos+1 < this.recipe.getRecipeOutputOnes().size()){ this.outOnePos++; } - else if(this.outTwoPos+1 < this.recipe.getRecipeOutputTwos().size()){ + else if(this.recipe.getRecipeOutputTwos() != null && this.outTwoPos+1 < this.recipe.getRecipeOutputTwos().size()){ this.outTwoPos++; } else{ diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java index 77554dc71..8cd064ce3 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java @@ -83,7 +83,7 @@ public class BlockCrafting{ " W ", "WXW", " W ", 'W', new ItemStack(Blocks.wool, 1, Util.WILDCARD), 'X', new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()))); - recipeSmileyCloud = Util.lastIRecipe(); + recipeSmileyCloud = Util.GetRecipes.lastIRecipe(); } //Compost @@ -92,7 +92,7 @@ public class BlockCrafting{ "W W", "W W", "WCW", 'W', "plankWood", 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()))); - recipeCompost = Util.lastIRecipe(); + recipeCompost = Util.GetRecipes.lastIRecipe(); } //XP Solidifier @@ -102,14 +102,14 @@ public class BlockCrafting{ 'X', new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()), 'D', "blockDiamond", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); - recipeSolidifier = Util.lastIRecipe(); + recipeSolidifier = Util.GetRecipes.lastIRecipe(); } //Charcoal Block GameRegistry.addRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.CHARCOAL_BLOCK.ordinal()), "CCC", "CCC", "CCC", 'C', new ItemStack(Items.coal, 1, 1)); - recipeBlockChar = Util.lastIRecipe(); + recipeBlockChar = Util.GetRecipes.lastIRecipe(); GameRegistry.addShapelessRecipe(new ItemStack(Items.coal, 9, 1), new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.CHARCOAL_BLOCK.ordinal())); @@ -120,7 +120,7 @@ public class BlockCrafting{ 'W', "plankWood", 'R', "logWood", 'S', "stickWood")); - recipeCase = Util.lastIRecipe(); + recipeCase = Util.GetRecipes.lastIRecipe(); } //Ender Casing @@ -130,7 +130,7 @@ public class BlockCrafting{ 'W', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()), 'R', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal()), 'S', Blocks.obsidian)); - recipeEnderCase = Util.lastIRecipe(); + recipeEnderCase = Util.GetRecipes.lastIRecipe(); } //Phantom Booster @@ -140,7 +140,7 @@ public class BlockCrafting{ 'R', "dustRedstone", 'D', "gemDiamond", 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal()))); - recipePhantomBooster = Util.lastIRecipe(); + recipePhantomBooster = Util.GetRecipes.lastIRecipe(); } //Coffee Machine @@ -150,7 +150,7 @@ public class BlockCrafting{ 'C', InitItems.itemCoffeeBean, 'S', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), 'A', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()))); - recipeCoffeeMachine = Util.lastIRecipe(); + recipeCoffeeMachine = Util.GetRecipes.lastIRecipe(); } //Energizer @@ -160,7 +160,7 @@ public class BlockCrafting{ 'I', "ingotIron", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), 'A', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()))); - recipeEnergizer = Util.lastIRecipe(); + recipeEnergizer = Util.GetRecipes.lastIRecipe(); } //Enervator @@ -170,7 +170,7 @@ public class BlockCrafting{ 'I', "ingotIron", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), 'A', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()))); - recipeEnervator = Util.lastIRecipe(); + recipeEnervator = Util.GetRecipes.lastIRecipe(); } //Lava Factory @@ -181,7 +181,7 @@ public class BlockCrafting{ 'S', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), 'I', "blockIron", 'L', Items.lava_bucket)); - recipeLavaFactory = Util.lastIRecipe(); + recipeLavaFactory = Util.GetRecipes.lastIRecipe(); } //Casing @@ -190,7 +190,7 @@ public class BlockCrafting{ "ICI", 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), 'I', "blockIron")); - recipeCasing = Util.lastIRecipe(); + recipeCasing = Util.GetRecipes.lastIRecipe(); } //Canola Press @@ -201,7 +201,7 @@ public class BlockCrafting{ 'H', Blocks.hopper, 'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), 'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal()))); - recipeCanolaPress = Util.lastIRecipe(); + recipeCanolaPress = Util.GetRecipes.lastIRecipe(); } //Ore Magnet @@ -212,7 +212,7 @@ public class BlockCrafting{ 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), 'B', new ItemStack(InitItems.itemBatteryDouble), 'I', new ItemStack(Blocks.iron_block))); - recipeMiner = Util.lastIRecipe(); + recipeMiner = Util.GetRecipes.lastIRecipe(); } //Fermenting Barrel @@ -223,7 +223,7 @@ public class BlockCrafting{ 'H', Blocks.hopper, 'R', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()), 'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal()))); - recipeFermentingBarrel = Util.lastIRecipe(); + recipeFermentingBarrel = Util.GetRecipes.lastIRecipe(); } //Phantomface @@ -234,7 +234,7 @@ public class BlockCrafting{ 'C', Blocks.chest, 'S', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), 'B', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()))); - recipePhantomface = Util.lastIRecipe(); + recipePhantomface = Util.GetRecipes.lastIRecipe(); } //Phantom Placer @@ -242,7 +242,7 @@ public class BlockCrafting{ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockPhantomPlacer), InitBlocks.blockPlacer, InitBlocks.blockPhantomface)); - recipePhantomPlacer = Util.lastIRecipe(); + recipePhantomPlacer = Util.GetRecipes.lastIRecipe(); } //Phantom Breaker @@ -250,7 +250,7 @@ public class BlockCrafting{ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockPhantomBreaker), InitBlocks.blockBreaker, InitBlocks.blockPhantomface)); - recipePhantomBreaker = Util.lastIRecipe(); + recipePhantomBreaker = Util.GetRecipes.lastIRecipe(); } //Phantom Energyface @@ -259,7 +259,7 @@ public class BlockCrafting{ " R ", "RFR", " R ", 'R', "dustRedstone", 'F', InitBlocks.blockPhantomface)); - recipeEnergyface = Util.lastIRecipe(); + recipeEnergyface = Util.GetRecipes.lastIRecipe(); } //Phantom Liquiface @@ -268,7 +268,7 @@ public class BlockCrafting{ "RFR", 'R', Items.bucket, 'F', InitBlocks.blockPhantomface)); - recipeLiquiface = Util.lastIRecipe(); + recipeLiquiface = Util.GetRecipes.lastIRecipe(); } //Liquid Placer @@ -277,7 +277,7 @@ public class BlockCrafting{ "RFR", 'R', Items.bucket, 'F', InitBlocks.blockPlacer)); - recipeLiquidPlacer = Util.lastIRecipe(); + recipeLiquidPlacer = Util.GetRecipes.lastIRecipe(); } //Liquid Breaker @@ -286,7 +286,7 @@ public class BlockCrafting{ "RFR", 'R', Items.bucket, 'F', InitBlocks.blockBreaker)); - recipeLiquidCollector = Util.lastIRecipe(); + recipeLiquidCollector = Util.GetRecipes.lastIRecipe(); } //Oil Generator @@ -296,7 +296,7 @@ public class BlockCrafting{ 'C', "cobblestone", 'R', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), 'B', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal()))); - recipeOilGen = Util.lastIRecipe(); + recipeOilGen = Util.GetRecipes.lastIRecipe(); } //Coal Generator @@ -306,7 +306,7 @@ public class BlockCrafting{ 'C', "cobblestone", 'R', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), 'B', new ItemStack(Items.coal, 1, Util.WILDCARD))); - recipeCoalGen = Util.lastIRecipe(); + recipeCoalGen = Util.GetRecipes.lastIRecipe(); } //Leaf Generator @@ -318,14 +318,14 @@ public class BlockCrafting{ 'E', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), 'L', "treeLeaves", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); - recipeLeafGen = Util.lastIRecipe(); + recipeLeafGen = Util.GetRecipes.lastIRecipe(); } //Enderpearl Block GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()), "EE", "EE", 'E', Items.ender_pearl)); - recipeEnderPearlBlock = Util.lastIRecipe(); + recipeEnderPearlBlock = Util.GetRecipes.lastIRecipe(); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Items.ender_pearl, 4), new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()))); @@ -336,14 +336,14 @@ public class BlockCrafting{ 'W', "cobblestone", 'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), 'S', "stickWood")); - recipeStoneCase = Util.lastIRecipe(); + recipeStoneCase = Util.GetRecipes.lastIRecipe(); } //Quartz Block GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal()), "QQ", "QQ", 'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()))); - recipeQuartzBlock = Util.lastIRecipe(); + recipeQuartzBlock = Util.GetRecipes.lastIRecipe(); //Fishing Net if(ConfigCrafting.FISHING_NET.isEnabled()){ @@ -351,7 +351,7 @@ public class BlockCrafting{ "SSS", "SDS", "SSS", 'D', "gemDiamond", 'S', Items.string)); - recipeFisher = Util.lastIRecipe(); + recipeFisher = Util.GetRecipes.lastIRecipe(); } //Repairer @@ -362,7 +362,7 @@ public class BlockCrafting{ 'I', "ingotIron", 'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal()))); - recipeRepairer = Util.lastIRecipe(); + recipeRepairer = Util.GetRecipes.lastIRecipe(); } //Solar Panel @@ -374,7 +374,7 @@ public class BlockCrafting{ 'Q', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), 'B', new ItemStack(Blocks.iron_bars))); - recipeSolar = Util.lastIRecipe(); + recipeSolar = Util.GetRecipes.lastIRecipe(); } //Heat Collector @@ -387,20 +387,20 @@ public class BlockCrafting{ 'L', new ItemStack(Items.lava_bucket), 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), 'B', new ItemStack(Blocks.iron_bars))); - recipeHeatCollector = Util.lastIRecipe(); + recipeHeatCollector = Util.GetRecipes.lastIRecipe(); } //Quartz Pillar GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ_PILLAR.ordinal()), "Q", "Q", 'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()))); - recipeQuartzPillar = Util.lastIRecipe(); + recipeQuartzPillar = Util.GetRecipes.lastIRecipe(); //Chiseled Quartz GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 2, TheMiscBlocks.QUARTZ_CHISELED.ordinal()), "Q", "Q", 'Q', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal()))); - recipeQuartzChiseled = Util.lastIRecipe(); + recipeQuartzChiseled = Util.GetRecipes.lastIRecipe(); //Inputter if(ConfigCrafting.INPUTTER.isEnabled()){ @@ -409,14 +409,14 @@ public class BlockCrafting{ 'W', "plankWood", 'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()), 'H', new ItemStack(Blocks.hopper))); - recipeESD = Util.lastIRecipe(); + recipeESD = Util.GetRecipes.lastIRecipe(); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockInputterAdvanced), InitBlocks.blockInputter, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "dustRedstone")); - recipeAdvancedESD = Util.lastIRecipe(); + recipeAdvancedESD = Util.GetRecipes.lastIRecipe(); } //Crusher @@ -428,7 +428,7 @@ public class BlockCrafting{ 'Q', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), 'P', new ItemStack(Blocks.piston), 'F', new ItemStack(Items.flint))); - recipeCrusher = Util.lastIRecipe(); + recipeCrusher = Util.GetRecipes.lastIRecipe(); } //Double Crusher @@ -440,7 +440,7 @@ public class BlockCrafting{ 'R', InitBlocks.blockGrinder, 'F', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), 'P', new ItemStack(Blocks.piston))); - recipeDoubleCrusher = Util.lastIRecipe(); + recipeDoubleCrusher = Util.GetRecipes.lastIRecipe(); } //Double Furnace @@ -452,7 +452,7 @@ public class BlockCrafting{ 'R', new ItemStack(Blocks.furnace), 'F', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), 'P', "ingotBrick")); - recipeFurnace = Util.lastIRecipe(); + recipeFurnace = Util.GetRecipes.lastIRecipe(); } //Feeder @@ -463,7 +463,7 @@ public class BlockCrafting{ 'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), 'C', new ItemStack(Items.golden_carrot), 'H', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()))); - recipeFeeder = Util.lastIRecipe(); + recipeFeeder = Util.GetRecipes.lastIRecipe(); } //Giant Chest @@ -473,7 +473,7 @@ public class BlockCrafting{ 'C', new ItemStack(Blocks.chest), 'D', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()), 'W', "plankWood")); - recipeCrate = Util.lastIRecipe(); + recipeCrate = Util.GetRecipes.lastIRecipe(); } //Greenhouse Glass @@ -483,7 +483,7 @@ public class BlockCrafting{ 'G', "blockGlass", 'D', Blocks.obsidian, 'S', "treeSapling")); - recipeGlass = Util.lastIRecipe(); + recipeGlass = Util.GetRecipes.lastIRecipe(); } //Placer @@ -493,7 +493,7 @@ public class BlockCrafting{ 'C', "cobblestone", 'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), 'P', Blocks.piston)); - recipePlacer = Util.lastIRecipe(); + recipePlacer = Util.GetRecipes.lastIRecipe(); } //Breaker @@ -503,7 +503,7 @@ public class BlockCrafting{ 'C', "cobblestone", 'R', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), 'P', Items.iron_pickaxe)); - recipeBreaker = Util.lastIRecipe(); + recipeBreaker = Util.GetRecipes.lastIRecipe(); } //Dropper @@ -522,14 +522,14 @@ public class BlockCrafting{ 'G', "glowstone", 'D', "dye"+BlockColoredLamp.allLampTypes[i].name, 'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()))); - recipesLamps[i] = Util.lastIRecipe(); + recipesLamps[i] = Util.GetRecipes.lastIRecipe(); } GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockLampPowerer, 4), "XXX", "XLX", "XXX", 'X', "dustRedstone", 'L', new ItemStack(InitBlocks.blockColoredLamp, 1, Util.WILDCARD))); - recipePowerer = Util.lastIRecipe(); + recipePowerer = Util.GetRecipes.lastIRecipe(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/CrusherCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/CrusherCrafting.java index 3838b3a7c..7dddc2d1b 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/CrusherCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/CrusherCrafting.java @@ -13,9 +13,12 @@ package ellpeck.actuallyadditions.crafting; import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry; import ellpeck.actuallyadditions.util.ModUtil; +import ellpeck.actuallyadditions.util.Util; public class CrusherCrafting{ + public static CrusherRecipeRegistry.CrusherRecipe recipeSugar; + public static void init(){ ModUtil.LOGGER.info("Initializing Crusher Recipes..."); @@ -49,6 +52,7 @@ public class CrusherCrafting{ } if(ConfigCrafting.RICE_SUGAR.isEnabled()){ CrusherRecipeRegistry.addRecipe("cropRice", "sugar", 2); + recipeSugar = Util.GetRecipes.lastCrusherRecipe(); } if(ConfigCrafting.NICKEL.isEnabled()){ diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/FoodCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/FoodCrafting.java index 14a369673..65ca8faa7 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/FoodCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/FoodCrafting.java @@ -67,7 +67,7 @@ public class FoodCrafting{ 'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD), 'K', knifeStack, 'H', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()))); - recipePizza = Util.lastIRecipe(); + recipePizza = Util.GetRecipes.lastIRecipe(); } //Hamburger @@ -78,7 +78,7 @@ public class FoodCrafting{ 'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()), 'K', knifeStack, 'B', new ItemStack(Items.cooked_beef))); - recipeHamburger = Util.lastIRecipe(); + recipeHamburger = Util.GetRecipes.lastIRecipe(); } //Big Cookie @@ -87,7 +87,7 @@ public class FoodCrafting{ "DCD", "CDC", "DCD", 'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), 'C', new ItemStack(Items.dye, 1, 3))); - recipeBigCookie = Util.lastIRecipe(); + recipeBigCookie = Util.GetRecipes.lastIRecipe(); } //Sub Sandwich @@ -99,7 +99,7 @@ public class FoodCrafting{ 'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD), 'B', new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), 'K', knifeStack)); - recipeSubSandwich = Util.lastIRecipe(); + recipeSubSandwich = Util.GetRecipes.lastIRecipe(); } //French Fry @@ -107,7 +107,7 @@ public class FoodCrafting{ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.FRENCH_FRY.ordinal()), new ItemStack(Items.baked_potato), knifeStack)); - recipeFrenchFry = Util.lastIRecipe(); + recipeFrenchFry = Util.GetRecipes.lastIRecipe(); } //French Fries @@ -116,7 +116,7 @@ public class FoodCrafting{ "FFF", " P ", 'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()), 'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal()))); - recipeFrenchFries = Util.lastIRecipe(); + recipeFrenchFries = Util.GetRecipes.lastIRecipe(); } //Fish N Chips @@ -126,14 +126,14 @@ public class FoodCrafting{ 'I', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD), 'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()), 'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal()))); - recipeFishNChips = Util.lastIRecipe(); + recipeFishNChips = Util.GetRecipes.lastIRecipe(); } //Cheese if(ConfigCrafting.CHEESE.isEnabled()){ GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()), new ItemStack(Items.milk_bucket)); - recipeCheese = Util.lastIRecipe(); + recipeCheese = Util.GetRecipes.lastIRecipe(); } //Pumpkin Stew @@ -142,14 +142,14 @@ public class FoodCrafting{ "P", "B", 'P', new ItemStack(Blocks.pumpkin), 'B', new ItemStack(Items.bowl)); - recipePumpkinStew = Util.lastIRecipe(); + recipePumpkinStew = Util.GetRecipes.lastIRecipe(); } //Carrot Juice if(ConfigCrafting.CARROT_JUICE.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CARROT_JUICE.ordinal()), new ItemStack(Items.glass_bottle), "cropCarrot", knifeStack)); - recipeCarrotJuice = Util.lastIRecipe(); + recipeCarrotJuice = Util.GetRecipes.lastIRecipe(); } //Spaghetti @@ -158,14 +158,14 @@ public class FoodCrafting{ "NNN", " B ", 'N', new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()), 'B', new ItemStack(Items.bowl))); - recipeSpaghetti = Util.lastIRecipe(); + recipeSpaghetti = Util.GetRecipes.lastIRecipe(); } //Noodle if(ConfigCrafting.NOODLE.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()), "cropWheat", knifeStack)); - recipeNoodle = Util.lastIRecipe(); + recipeNoodle = Util.GetRecipes.lastIRecipe(); } //Chocolate @@ -174,7 +174,7 @@ public class FoodCrafting{ "C C", "CMC", "C C", 'C', new ItemStack(Items.dye, 1, 3), 'M', new ItemStack(Items.milk_bucket)); - recipeChocolate = Util.lastIRecipe(); + recipeChocolate = Util.GetRecipes.lastIRecipe(); } //Chocolate Cake @@ -186,14 +186,14 @@ public class FoodCrafting{ 'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), 'S', new ItemStack(Items.sugar), 'C', new ItemStack(Items.dye, 1, 3))); - recipeChocolateCake = Util.lastIRecipe(); + recipeChocolateCake = Util.GetRecipes.lastIRecipe(); } //Toast if(ConfigCrafting.TOAST.isEnabled()){ GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.TOAST.ordinal()), new ItemStack(Items.bread)); - recipeToast = Util.lastIRecipe(); + recipeToast = Util.GetRecipes.lastIRecipe(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index 7b41e24e6..e3c386e35 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -76,7 +76,7 @@ public class ItemCrafting{ //Booklet GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemLexicon), new ItemStack(InitItems.itemCanolaSeed), new ItemStack(Items.paper))); - recipeBook = Util.lastIRecipe(); + recipeBook = Util.GetRecipes.lastIRecipe(); //Rice Stuff if(ConfigCrafting.RICE_GADGETS.isEnabled()){ @@ -101,7 +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(); + recipeLeafBlower = Util.GetRecipes.lastIRecipe(); } //Drill @@ -112,7 +112,7 @@ public class ItemCrafting{ 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), 'R', "dustRedstone", 'I', "blockIron")); - recipeDrill = Util.lastIRecipe(); + recipeDrill = Util.GetRecipes.lastIRecipe(); } //Tele Staff @@ -122,7 +122,7 @@ public class ItemCrafting{ 'E', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()), 'S', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal()), 'B', new ItemStack(InitItems.itemBattery, 1, Util.WILDCARD))); - recipeStaff = Util.lastIRecipe(); + recipeStaff = Util.GetRecipes.lastIRecipe(); } //Drill Speed @@ -132,21 +132,21 @@ public class ItemCrafting{ 'I', "ingotIron", 'S', Items.sugar, 'R', "dustRedstone")); - recipeDrillSpeedI = Util.lastIRecipe(); + recipeDrillSpeedI = Util.GetRecipes.lastIRecipe(); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSpeedII), "ISI", "SCS", "ISI", 'I', "ingotIron", 'S', Items.sugar, 'C', Items.cake)); - recipeDrillSpeedII = Util.lastIRecipe(); + recipeDrillSpeedII = Util.GetRecipes.lastIRecipe(); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSpeedIII), "ISI", "SFS", "ISI", 'I', "ingotIron", 'S', Items.sugar, 'F', "gemDiamond")); - recipeDrillSpeedIII = Util.lastIRecipe(); + recipeDrillSpeedIII = Util.GetRecipes.lastIRecipe(); } //Drill Fortune @@ -156,14 +156,14 @@ public class ItemCrafting{ 'I', Blocks.glowstone, 'S', Items.redstone, 'R', Blocks.diamond_block)); - recipeDrillFortuneI = Util.lastIRecipe(); + recipeDrillFortuneI = Util.GetRecipes.lastIRecipe(); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeFortuneII), "ISI", "SRS", "ISI", 'I', Blocks.glowstone, 'S', Items.redstone, 'R', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal()))); - recipeDrillFortuneII = Util.lastIRecipe(); + recipeDrillFortuneII = Util.GetRecipes.lastIRecipe(); } //Drill Size @@ -173,14 +173,14 @@ public class ItemCrafting{ 'I', "ingotIron", 'D', "gemDiamond", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()))); - recipeDrillThree = Util.lastIRecipe(); + recipeDrillThree = Util.GetRecipes.lastIRecipe(); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeFiveByFive), "DID", "ICI", "DID", 'I', "ingotIron", 'D', "gemDiamond", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); - recipeDrillFive = Util.lastIRecipe(); + recipeDrillFive = Util.GetRecipes.lastIRecipe(); } //Drill Silk Touch @@ -190,7 +190,7 @@ public class ItemCrafting{ 'D', "gemEmerald", 'S', "gemDiamond", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); - recipeDrillSilk = Util.lastIRecipe(); + recipeDrillSilk = Util.GetRecipes.lastIRecipe(); } //Drill Placing @@ -201,7 +201,7 @@ public class ItemCrafting{ 'E', Items.ender_pearl, 'A', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), 'R', "ingotIron")); - recipeDrillPlacing = Util.lastIRecipe(); + recipeDrillPlacing = Util.GetRecipes.lastIRecipe(); } //Battery @@ -211,7 +211,7 @@ public class ItemCrafting{ 'R', "dustRedstone", 'I', "ingotIron", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); - recipeBattery = Util.lastIRecipe(); + recipeBattery = Util.GetRecipes.lastIRecipe(); } //Double Battery @@ -221,7 +221,7 @@ public class ItemCrafting{ 'R', new ItemStack(InitItems.itemBattery), 'I', "ingotIron", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); - recipeBatteryDouble = Util.lastIRecipe(); + recipeBatteryDouble = Util.GetRecipes.lastIRecipe(); } //Magnet Ring @@ -232,7 +232,7 @@ public class ItemCrafting{ 'I', "ingotIron", 'B', new ItemStack(Items.dye, 1, 4), 'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()))); - recipeMagnetRing = Util.lastIRecipe(); + recipeMagnetRing = Util.GetRecipes.lastIRecipe(); } //Growth Ring @@ -242,7 +242,7 @@ public class ItemCrafting{ 'S', new ItemStack(Items.wheat_seeds), 'I', "ingotIron", 'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()))); - recipeGrowthRing = Util.lastIRecipe(); + recipeGrowthRing = Util.GetRecipes.lastIRecipe(); } //Water Ring @@ -252,7 +252,7 @@ public class ItemCrafting{ 'B', new ItemStack(Items.water_bucket), 'I', "ingotIron", 'O', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()))); - recipeWaterRing = Util.lastIRecipe(); + recipeWaterRing = Util.GetRecipes.lastIRecipe(); } //Triple Battery @@ -262,7 +262,7 @@ public class ItemCrafting{ 'R', new ItemStack(InitItems.itemBatteryDouble), 'I', "ingotIron", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); - recipeBatteryTriple = Util.lastIRecipe(); + recipeBatteryTriple = Util.GetRecipes.lastIRecipe(); } //Quadruple Battery @@ -272,7 +272,7 @@ public class ItemCrafting{ 'R', new ItemStack(InitItems.itemBatteryTriple), 'I', "ingotIron", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); - recipeBatteryQuadruple = Util.lastIRecipe(); + recipeBatteryQuadruple = Util.GetRecipes.lastIRecipe(); } //Quintuple Battery @@ -282,7 +282,7 @@ public class ItemCrafting{ 'R', new ItemStack(InitItems.itemBatteryQuadruple), 'I', "ingotIron", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()))); - recipeBatteryQuintuple = Util.lastIRecipe(); + recipeBatteryQuintuple = Util.GetRecipes.lastIRecipe(); } //Bat Wings @@ -292,7 +292,7 @@ public class ItemCrafting{ 'W', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.BAT_WING.ordinal()), 'N', "blockDiamond", 'D', new ItemStack(Items.nether_star))); - recipeWings = Util.lastIRecipe(); + recipeWings = Util.GetRecipes.lastIRecipe(); } //Quartz @@ -308,7 +308,7 @@ public class ItemCrafting{ " R ", "RIR", " R ", 'I', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), 'R', "dustRedstone")); - recipeCoil = Util.lastIRecipe(); + recipeCoil = Util.GetRecipes.lastIRecipe(); } //Cup @@ -317,7 +317,7 @@ public class ItemCrafting{ "S S", "SCS", "SSS", 'S', "stone", 'C', InitItems.itemCoffeeBean)); - recipeCup = Util.lastIRecipe(); + recipeCup = Util.GetRecipes.lastIRecipe(); } //Resonant Rice @@ -332,7 +332,7 @@ public class ItemCrafting{ " G ", "GCG", " G ", 'C', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), 'G', "ingotGold")); - recipeCoilAdvanced = Util.lastIRecipe(); + recipeCoilAdvanced = Util.GetRecipes.lastIRecipe(); } //Ender Pearl @@ -353,7 +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(); + recipeLeafBlowerAdvanced = Util.GetRecipes.lastIRecipe(); } //Phantom Connector @@ -363,7 +363,7 @@ public class ItemCrafting{ 'Y', Items.ender_eye, 'E', Items.ender_pearl, 'S', "stickWood")); - recipePhantomConnector = Util.lastIRecipe(); + recipePhantomConnector = Util.GetRecipes.lastIRecipe(); } //Quartz @@ -375,7 +375,7 @@ public class ItemCrafting{ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemKnife), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal()))); - recipeKnife = Util.lastIRecipe(); + recipeKnife = Util.GetRecipes.lastIRecipe(); } //Crafter on a Stick @@ -388,10 +388,10 @@ public class ItemCrafting{ //Tiny Coal GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.TINY_COAL.ordinal()), new ItemStack(Items.coal)); - recipeTinyCoal = Util.lastIRecipe(); + recipeTinyCoal = Util.GetRecipes.lastIRecipe(); GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.TINY_CHAR.ordinal()), new ItemStack(Items.coal, 1, 1)); - recipeTinyChar = Util.lastIRecipe(); + recipeTinyChar = Util.GetRecipes.lastIRecipe(); //Rice Seeds GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemRiceSeed), @@ -430,7 +430,7 @@ public class ItemCrafting{ 'G', "ingotGold", 'I', "ingotIron", 'D', "dustGlowstone")); - recipeRing = Util.lastIRecipe(); + recipeRing = Util.GetRecipes.lastIRecipe(); if(ConfigCrafting.RING_SPEED.isEnabled()){ addRingRecipeWithStack(ThePotionRings.SPEED.craftingItem, ThePotionRings.SPEED.ordinal()); @@ -466,9 +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()); + recipesPotionRings.add(Util.GetRecipes.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()); + recipesPotionRings.add(Util.GetRecipes.lastIRecipe()); } public static void initMashedFoodRecipes(){ @@ -478,7 +478,7 @@ public class ItemCrafting{ if(!isBlacklisted(item)){ ItemStack ingredient = new ItemStack((Item)item, 1, Util.WILDCARD); GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD)); - recipesMashedFood.add(Util.lastIRecipe()); + recipesMashedFood.add(Util.GetRecipes.lastIRecipe()); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/MiscCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/MiscCrafting.java index a2a84caa6..1033da67f 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/MiscCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/MiscCrafting.java @@ -29,14 +29,14 @@ public class MiscCrafting{ if(ConfigCrafting.DOUGH.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.DOUGH.ordinal()), "cropWheat", "cropWheat")); - ItemCrafting.recipeDough = Util.lastIRecipe(); + ItemCrafting.recipeDough = Util.GetRecipes.lastIRecipe(); } //Rice Dough if(ConfigCrafting.RICE_DOUGH.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.RICE_DOUGH.ordinal()), new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()))); - ItemCrafting.recipeRiceDough = Util.lastIRecipe(); + ItemCrafting.recipeRiceDough = Util.GetRecipes.lastIRecipe(); } //Paper Cone @@ -51,7 +51,7 @@ public class MiscCrafting{ GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal()), "stickWood", new ItemStack(Items.leather))); - ItemCrafting.recipeKnifeHandle = Util.lastIRecipe(); + ItemCrafting.recipeKnifeHandle = Util.GetRecipes.lastIRecipe(); } //Knife Blade @@ -60,7 +60,7 @@ public class MiscCrafting{ "K", "K", "F", 'K', "ingotIron", 'F', new ItemStack(Items.flint))); - ItemCrafting.recipeKnifeBlade = Util.lastIRecipe(); + ItemCrafting.recipeKnifeBlade = Util.GetRecipes.lastIRecipe(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java index 5b93c0b91..63d1c538d 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ToolCrafting.java @@ -194,56 +194,56 @@ public class ToolCrafting{ new ItemStack(Items.wooden_shovel), new ItemStack(Items.wooden_sword), new ItemStack(Items.wooden_hoe))); - recipesPaxels.add(Util.lastIRecipe()); + recipesPaxels.add(Util.GetRecipes.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()); + recipesPaxels.add(Util.GetRecipes.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()); + recipesPaxels.add(Util.GetRecipes.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()); + recipesPaxels.add(Util.GetRecipes.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()); + recipesPaxels.add(Util.GetRecipes.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()); + recipesPaxels.add(Util.GetRecipes.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()); + recipesPaxels.add(Util.GetRecipes.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()); + recipesPaxels.add(Util.GetRecipes.lastIRecipe()); } } diff --git a/src/main/java/ellpeck/actuallyadditions/event/KeyStates.java b/src/main/java/ellpeck/actuallyadditions/event/KeyStates.java index b1817bb46..523977f36 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/KeyStates.java +++ b/src/main/java/ellpeck/actuallyadditions/event/KeyStates.java @@ -33,17 +33,17 @@ public class KeyStates{ private boolean pressed; private boolean pressedLastTime; - private boolean recentlyCheckedPress; public void tick(boolean pressed){ this.pressed = pressed && !this.pressedLastTime; this.pressedLastTime = pressed; - this.recentlyCheckedPress = false; } - public boolean isPressed(){ - boolean isPressed = this.pressed && !this.recentlyCheckedPress; - this.recentlyCheckedPress = true; + public boolean checkPressed(boolean shouldUnpress){ + boolean isPressed = this.pressed; + if(shouldUnpress){ + this.pressed = false; + } return isPressed; } } diff --git a/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java b/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java index 7c863e4e1..2c06c28a1 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java +++ b/src/main/java/ellpeck/actuallyadditions/event/TooltipEvent.java @@ -41,7 +41,7 @@ public class TooltipEvent{ int keyCode = KeyBinds.keybindOpenBooklet.getKeyCode(); event.toolTip.add(EnumChatFormatting.GOLD+StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".keyToSeeRecipe", keyCode > 0 && keyCode < Keyboard.KEYBOARD_SIZE ? "'"+Keyboard.getKeyName(keyCode)+"'" : "[NONE]")); } - if(KeyStates.infoButtonState.isPressed()){ + if(KeyStates.infoButtonState.checkPressed(true)){ GuiBooklet book = new GuiBooklet(Minecraft.getMinecraft().currentScreen); Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); Minecraft.getMinecraft().displayGuiScreen(book); diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java b/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java index b108f2818..f27d1aeca 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java @@ -56,7 +56,7 @@ public class InitForeignPaxels{ if(ConfigCrafting.PAXELS.isEnabled()){ GameRegistry.addRecipe(new ShapelessOreRecipe(mtPaxels[i], axe, pickaxe, hoe, sword, shovel)); - ToolCrafting.recipesPaxels.add(Util.lastIRecipe()); + ToolCrafting.recipesPaxels.add(Util.GetRecipes.lastIRecipe()); } } } @@ -86,7 +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()); + ToolCrafting.recipesPaxels.add(Util.GetRecipes.lastIRecipe()); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/Util.java b/src/main/java/ellpeck/actuallyadditions/util/Util.java index 95251a3d3..9d8c7ec97 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/Util.java +++ b/src/main/java/ellpeck/actuallyadditions/util/Util.java @@ -11,6 +11,7 @@ package ellpeck.actuallyadditions.util; import cpw.mods.fml.common.FMLCommonHandler; +import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry; import net.minecraft.block.BlockDispenser; import net.minecraft.dispenser.BehaviorDefaultDispenseItem; import net.minecraft.item.Item; @@ -19,6 +20,7 @@ import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.oredict.OreDictionary; +import java.util.ArrayList; import java.util.List; @SuppressWarnings("unused") @@ -35,12 +37,6 @@ public class Util{ BlockDispenser.dispenseBehaviorRegistry.putObject(item, handler); } - public static IRecipe lastIRecipe(){ - List list = CraftingManager.getInstance().getRecipeList(); - Object recipe = list.get(list.size()-1); - return recipe instanceof IRecipe ? (IRecipe)recipe : null; - } - public static int arrayContains(Object[] array, Object obj){ if(obj != null){ for(int i = 0; i < array.length; i++){ @@ -51,4 +47,18 @@ public class Util{ } return -1; } + + public static class GetRecipes{ + + public static CrusherRecipeRegistry.CrusherRecipe lastCrusherRecipe(){ + ArrayList list = CrusherRecipeRegistry.recipes; + return list.get(list.size()-1); + } + + public static IRecipe lastIRecipe(){ + List list = CraftingManager.getInstance().getRecipeList(); + Object recipe = list.get(list.size()-1); + return recipe instanceof IRecipe ? (IRecipe)recipe : null; + } + } } \ No newline at end of file