From d98be8dd86e02b7ed40419ae01db27ee58063b7e Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Fri, 12 Jun 2015 14:35:12 -0400 Subject: [PATCH] Massive recipe cleanup, everything should use oredict properly now --- src/main/java/crazypants/enderio/EnderIO.java | 12 +- .../enderio/conduit/ConduitRecipes.java | 78 +++--- .../enderio/enderface/EnderfaceRecipes.java | 8 +- .../crazypants/enderio/item/ItemRecipes.java | 63 +++-- .../enderio/machine/MachineRecipes.java | 222 ++++++++---------- .../crazypants/enderio/material/Alloy.java | 28 ++- .../enderio/material/MachinePart.java | 15 +- .../crazypants/enderio/material/Material.java | 10 + .../enderio/material/MaterialRecipes.java | 158 ++++++------- .../enderio/thaumcraft/ThaumcraftCompat.java | 26 +- src/main/java/crazypants/util/RecipeUtil.java | 35 +++ 11 files changed, 338 insertions(+), 317 deletions(-) create mode 100644 src/main/java/crazypants/util/RecipeUtil.java diff --git a/src/main/java/crazypants/enderio/EnderIO.java b/src/main/java/crazypants/enderio/EnderIO.java index d59cfc33..b0f10737 100644 --- a/src/main/java/crazypants/enderio/EnderIO.java +++ b/src/main/java/crazypants/enderio/EnderIO.java @@ -566,13 +566,15 @@ public class EnderIO { SkeletonHandler.registerSkeleton(this); } + MaterialRecipes.registerDependantOresInDictionary(); + EnderfaceRecipes.addRecipes(); MaterialRecipes.addRecipes(); ConduitRecipes.addRecipes(); MachineRecipes.addRecipes(); ItemRecipes.addRecipes(); TeleportRecipes.addRecipes(); - + proxy.load(); } @@ -583,16 +585,10 @@ public class EnderIO { //Regsiter the enchants Enchantments.getInstance(); - - MaterialRecipes.registerDependantOresInDictionary(); - + //This must be loaded before parsing the recipes so we get the preferred outputs OreDictionaryPreferences.loadConfig(); - MaterialRecipes.addOreDictionaryRecipes(); - MachineRecipes.addOreDictionaryRecipes(); - ItemRecipes.addOreDictionaryRecipes(); - CrusherRecipeManager.getInstance().loadRecipesFromConfig(); AlloyRecipeManager.getInstance().loadRecipesFromConfig(); SliceAndSpliceRecipeManager.getInstance().loadRecipesFromConfig(); diff --git a/src/main/java/crazypants/enderio/conduit/ConduitRecipes.java b/src/main/java/crazypants/enderio/conduit/ConduitRecipes.java index 375c9720..eea50252 100644 --- a/src/main/java/crazypants/enderio/conduit/ConduitRecipes.java +++ b/src/main/java/crazypants/enderio/conduit/ConduitRecipes.java @@ -16,11 +16,14 @@ import crazypants.enderio.conduit.item.filter.CopyFilterRecipe; import crazypants.enderio.conduit.me.MEUtil; import crazypants.enderio.config.Config; import crazypants.enderio.machine.MachineRecipeRegistry; -import crazypants.enderio.material.Alloy; import crazypants.enderio.material.BlockFusedQuartz; import crazypants.enderio.material.FrankenSkull; import crazypants.enderio.material.Material; -import static crazypants.enderio.ModObject.*; + +import static crazypants.enderio.ModObject.blockPainter; +import static crazypants.enderio.material.Alloy.*; +import static crazypants.enderio.material.Material.*; +import static crazypants.util.RecipeUtil.addShaped; public class ConduitRecipes { @@ -28,62 +31,61 @@ public class ConduitRecipes { //Crafting Components ItemStack redstoneConduit = new ItemStack(EnderIO.itemRedstoneConduit, 1, 0); - ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 1, Material.CONDUIT_BINDER.ordinal()); ItemStack fusedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 0); ItemStack fusedGlass = new ItemStack(EnderIO.blockFusedQuartz, 1, BlockFusedQuartz.Type.GLASS.ordinal()); - ItemStack conductiveIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.CONDUCTIVE_IRON.ordinal()); - ItemStack energeticGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal()); - ItemStack phasedGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()); - ItemStack phasedIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()); - ItemStack phasedIronNugget = new ItemStack(EnderIO.itemMaterial, 1, Material.PHASED_IRON_NUGGET.ordinal()); - ItemStack redstoneAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.REDSTONE_ALLOY.ordinal()); - ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()); + String electricalSteel = ELECTRICAL_STEEL.oreIngot; + String phasedGold = PHASED_GOLD.oreIngot; + String conductiveIron = CONDUCTIVE_IRON.oreIngot; + String energeticGold = ENERGETIC_ALLOY.oreIngot; + String phasedIronNugget = PHASED_IRON_NUGGET.oreDict; + String redstoneAlloy = REDSTONE_ALLOY.oreIngot; + + String binder = CONDUIT_BINDER.oreDict; + ItemStack zombieController = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_CONTROLLER.ordinal()); //Recipes - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.BASIC.ordinal()), "bbb", "b b", "bbb", 'b', conduitBinder); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.HARDENED.ordinal()), " o ", "oFo", " o ", 'F', EnderIO.itemConduitFacade, 'o', "dustObsidian")); + addShaped(new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.BASIC.ordinal()), "bbb", "b b", "bbb", 'b', binder); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.itemConduitFacade, 1, FacadeType.HARDENED.ordinal()), " o ", "oFo", " o ", 'F', + EnderIO.itemConduitFacade, 'o', "dustObsidian")); int numConduits = Config.numConduitsPerRecipe; - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 0), "bbb", "###", "bbb", 'b', conduitBinder, '#', fusedGlass); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 1), "bbb", "###", "bbb", 'b', conduitBinder, '#', fusedQuartz); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 2), "bbb", "#p#", "bbb", 'b', conduitBinder, '#', fusedQuartz, 'p', phasedGold); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemPowerConduit, numConduits, 0), "bbb", "###", "bbb", 'b', conduitBinder, '#', conductiveIron); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemPowerConduit, numConduits, 1), "bbb", "###", "bbb", 'b', conduitBinder, '#', energeticGold); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemPowerConduit, numConduits, 2), "bbb", "###", "bbb", 'b', conduitBinder, '#', phasedGold); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 0), "###", '#', redstoneAlloy); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemRedstoneConduit, 1, 1), "lbl", "bcb", "lbl", 'b', conduitBinder, 'c', redstoneConduit, 'l', - Blocks.lever); - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 2), "bbb", "###", "bbb", 'b', conduitBinder, '#', - redstoneAlloy); + addShaped(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 0), "bbb", "###", "bbb", 'b', binder, '#', fusedGlass); + addShaped(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 1), "bbb", "###", "bbb", 'b', binder, '#', fusedQuartz); + addShaped(new ItemStack(EnderIO.itemLiquidConduit, numConduits, 2), "bbb", "#p#", "bbb", 'b', binder, '#', fusedQuartz, 'p', phasedGold); + addShaped(new ItemStack(EnderIO.itemPowerConduit, numConduits, 0), "bbb", "###", "bbb", 'b', binder, '#', conductiveIron); + addShaped(new ItemStack(EnderIO.itemPowerConduit, numConduits, 1), "bbb", "###", "bbb", 'b', binder, '#', energeticGold); + addShaped(new ItemStack(EnderIO.itemPowerConduit, numConduits, 2), "bbb", "###", "bbb", 'b', binder, '#', phasedGold); + addShaped(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 0), "###", '#', redstoneAlloy); + addShaped(new ItemStack(EnderIO.itemRedstoneConduit, 1, 1), "lbl", "bcb", "lbl", 'b', binder, 'c', redstoneConduit, 'l', Blocks.lever); + addShaped(new ItemStack(EnderIO.itemRedstoneConduit, numConduits, 2), "bbb", "###", "bbb", 'b', binder, '#', redstoneAlloy); if (GasUtil.isGasConduitEnabled()) { - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemGasConduit, numConduits, 0), "bbb", "#g#", "bbb", 'b', conduitBinder, '#', electricalSteel, 'g', - fusedGlass); + addShaped(new ItemStack(EnderIO.itemGasConduit, numConduits, 0), "bbb", "#g#", "bbb", 'b', binder, '#', electricalSteel, 'g', fusedGlass); } ItemStack itemConduit = new ItemStack(EnderIO.itemItemConduit, numConduits, 0); - GameRegistry.addShapedRecipe(itemConduit, "bbb", "###", "bbb", 'b', conduitBinder, '#', phasedIronNugget); + addShaped(itemConduit, "bbb", "###", "bbb", 'b', binder, '#', phasedIronNugget); MachineRecipeRegistry.instance.registerRecipe(blockPainter.unlocalisedName, EnderIO.itemConduitFacade.new FacadePainterRecipe()); //Filter Recipes ItemStack basicFilter = new ItemStack(EnderIO.itemBasicFilterUpgrade, 1, 0); - GameRegistry.addShapedRecipe(basicFilter, " p ", "php", " p ", 'p', Items.paper, 'h', Blocks.hopper); + addShaped(basicFilter, " p ", "php", " p ", 'p', Items.paper, 'h', Blocks.hopper); ItemStack advFilter = new ItemStack(EnderIO.itemBasicFilterUpgrade, 1, 1); - GameRegistry.addRecipe(new ShapedOreRecipe(advFilter, "rpr", "pzp", "rpr", 'p', Items.paper, 'z', zombieController, 'r', Items.redstone)); + addShaped(advFilter, "rpr", "pzp", "rpr", 'p', Items.paper, 'z', zombieController, 'r', "dustRedstone"); ItemStack modFilter = new ItemStack(EnderIO.itemModItemFilter, 1, 0); - GameRegistry.addShapedRecipe(modFilter, " p ", "pwp", " p ", 'p', Items.paper, 'w', EnderIO.itemYetaWench); + addShaped(modFilter, " p ", "pwp", " p ", 'p', Items.paper, 'w', EnderIO.itemYetaWench); ItemStack exFilt = new ItemStack(EnderIO.itemExistingItemFilter); - GameRegistry.addShapedRecipe(exFilt, " r ", "rfr", " c ", 'c', new ItemStack(Items.comparator, 1, 0), 'r', Items.redstone, 'f', advFilter); + addShaped(exFilt, " r ", "rfr", " c ", 'c', new ItemStack(Items.comparator, 1, 0), 'r', "dustRedstone", 'f', advFilter); ItemStack powerFilt = new ItemStack(EnderIO.itemPowerItemFilter); - GameRegistry.addShapedRecipe(powerFilt, " p ", "pcp", " p ", 'p', Items.paper, 'c', EnderIO.itemConduitProbe); + addShaped(powerFilt, " p ", "pcp", " p ", 'p', Items.paper, 'c', EnderIO.itemConduitProbe); ClearFilterRecipe clearRec = new ClearFilterRecipe(); MinecraftForge.EVENT_BUS.register(clearRec); @@ -93,11 +95,11 @@ public class ConduitRecipes { GameRegistry.addRecipe(copyRec); ItemStack speedUpgrade = new ItemStack(EnderIO.itemExtractSpeedUpgrade, 1, 0); - GameRegistry.addShapedRecipe(speedUpgrade, "iii","epe","ere", 'p', Blocks.piston, 'e', electricalSteel, 'r', Blocks.redstone_torch, 'i', Items.iron_ingot); + addShaped(speedUpgrade, "iii", "epe", "ere", 'p', Blocks.piston, 'e', electricalSteel, 'r', Blocks.redstone_torch, 'i', "ingotIron"); ItemStack speedDowngrade = new ItemStack(EnderIO.itemExtractSpeedUpgrade, 1, 1); - GameRegistry.addRecipe(new ShapedOreRecipe(speedDowngrade, "iii","ese","ete", 's', "slimeball", 'e', electricalSteel, 't', "stickWood", 'i', Items.iron_ingot)); - GameRegistry.addRecipe(new ShapedOreRecipe(speedDowngrade, "iii","ese","ete", 's', "slimeball", 'e', electricalSteel, 't', "woodStick", 'i', Items.iron_ingot)); + addShaped(speedDowngrade, "iii", "ese", "ete", 's', "slimeball", 'e', electricalSteel, 't', "stickWood", 'i', "ingotIron"); + addShaped(speedDowngrade, "iii", "ese", "ete", 's', "slimeball", 'e', electricalSteel, 't', "woodStick", 'i', "ingotIron"); if (MEUtil.isMEEnabled()) { addAeRecipes(); @@ -108,15 +110,15 @@ public class ConduitRecipes { private static void addAeRecipes() { String fluix = "crystalFluix"; String pureFluix = "crystalPureFluix"; - + ItemStack quartzFiber = AEApi.instance().parts().partQuartzFiber.stack(1).copy(); ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 1, Material.CONDUIT_BINDER.ordinal()); ItemStack res = new ItemStack(EnderIO.itemMEConduit, Config.numConduitsPerRecipe / 2); - GameRegistry.addRecipe(new ShapedOreRecipe(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', fluix, 'q', quartzFiber)); - GameRegistry.addRecipe(new ShapedOreRecipe(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', pureFluix, 'q', quartzFiber)); + addShaped(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', fluix, 'q', quartzFiber); + addShaped(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', pureFluix, 'q', quartzFiber); res.stackSize = 1; - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.itemMEConduit, 1, 1), "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res)); + addShaped(new ItemStack(EnderIO.itemMEConduit, 1, 1), "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res); } } diff --git a/src/main/java/crazypants/enderio/enderface/EnderfaceRecipes.java b/src/main/java/crazypants/enderio/enderface/EnderfaceRecipes.java index 8033c457..14877eda 100644 --- a/src/main/java/crazypants/enderio/enderface/EnderfaceRecipes.java +++ b/src/main/java/crazypants/enderio/enderface/EnderfaceRecipes.java @@ -2,19 +2,17 @@ package crazypants.enderio.enderface; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; import crazypants.enderio.EnderIO; import crazypants.enderio.material.Alloy; +import crazypants.util.RecipeUtil; public class EnderfaceRecipes { public static void addRecipes() { - ItemStack phasedGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()); ItemStack fusedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 0); - ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()); - GameRegistry.addRecipe(new ItemStack(EnderIO.blockEnderIo), "sqs", "qeq", "sqs", 's', electricalSteel, 'q', fusedQuartz, 'e', new ItemStack( - Items.ender_eye)); + String electricalSteel = Alloy.ELECTRICAL_STEEL.oreIngot; + RecipeUtil.addShaped(new ItemStack(EnderIO.blockEnderIo), "sqs", "qeq", "sqs", 's', electricalSteel, 'q', fusedQuartz, 'e', new ItemStack(Items.ender_eye)); } } diff --git a/src/main/java/crazypants/enderio/item/ItemRecipes.java b/src/main/java/crazypants/enderio/item/ItemRecipes.java index 9b6e2d81..9e1a0bd6 100644 --- a/src/main/java/crazypants/enderio/item/ItemRecipes.java +++ b/src/main/java/crazypants/enderio/item/ItemRecipes.java @@ -7,64 +7,63 @@ import net.minecraftforge.oredict.ShapedOreRecipe; import cpw.mods.fml.common.registry.GameRegistry; import crazypants.enderio.EnderIO; import crazypants.enderio.item.darksteel.DarkSteelItems; -import crazypants.enderio.material.Alloy; import crazypants.enderio.material.MachinePart; -import crazypants.enderio.material.Material; + +import static crazypants.enderio.material.Alloy.*; +import static crazypants.enderio.material.Material.VIBRANT_CYSTAL; +import static crazypants.util.RecipeUtil.addShaped; public class ItemRecipes { public static void addRecipes() { ItemStack basicGear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal()); - ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()); - ItemStack conductiveIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.CONDUCTIVE_IRON.ordinal()); - ItemStack vibCry = new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_CYSTAL.ordinal()); - ItemStack vibAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()); - ItemStack enAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal()); - ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()); - ItemStack soularium = new ItemStack(EnderIO.itemAlloy, 1, Alloy.SOULARIUM.ordinal()); + String electricalSteel = ELECTRICAL_STEEL.oreIngot; + String conductiveIron = CONDUCTIVE_IRON.oreIngot; + String vibCry = VIBRANT_CYSTAL.oreDict; + String enAlloy = ENERGETIC_ALLOY.oreIngot; + String darkSteel = DARK_STEEL.oreIngot; + String soularium = SOULARIUM.oreIngot; // Wrench ItemStack wrench = new ItemStack(EnderIO.itemYetaWench, 1, 0); - GameRegistry.addShapedRecipe(wrench, "s s", " b ", " s ", 's', electricalSteel, 'b', basicGear); + addShaped(wrench, "s s", " b ", " s ", 's', electricalSteel, 'b', basicGear); //Magnet ItemStack magnet = new ItemStack(EnderIO.itemMagnet, 1, 0); EnderIO.itemMagnet.setEnergy(magnet, 0); - GameRegistry.addShapedRecipe(magnet, "scc", " v", "scc", 's', electricalSteel, 'c', conductiveIron, 'v', vibCry); + addShaped(magnet, "scc", " v", "scc", 's', electricalSteel, 'c', conductiveIron, 'v', vibCry); //Dark Steel - GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelHelmet.createItemStack(), "sss", "s s", 's', darkSteel); - GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelChestplate.createItemStack(), "s s", "sss", "sss", 's', darkSteel); - GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelLeggings.createItemStack(), "sss", "s s", "s s", 's', darkSteel); - GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelBoots.createItemStack(), "s s", "s s", 's', darkSteel); + addShaped(DarkSteelItems.itemDarkSteelHelmet.createItemStack(), "sss", "s s", 's', darkSteel); + addShaped(DarkSteelItems.itemDarkSteelChestplate.createItemStack(), "s s", "sss", "sss", 's', darkSteel); + addShaped(DarkSteelItems.itemDarkSteelLeggings.createItemStack(), "sss", "s s", "s s", 's', darkSteel); + addShaped(DarkSteelItems.itemDarkSteelBoots.createItemStack(), "s s", "s s", 's', darkSteel); - ItemStack wing = new ItemStack(DarkSteelItems.itemGliderWing,1,0); - GameRegistry.addShapedRecipe(wing, " s", " sl", "sll", 's', darkSteel, 'l', Items.leather); - GameRegistry.addShapedRecipe(new ItemStack(DarkSteelItems.itemGliderWing,1,1), " s ", "wsw", " ", 's', darkSteel, 'w', wing); + ItemStack wing = new ItemStack(DarkSteelItems.itemGliderWing, 1, 0); + addShaped(wing, " s", " sl", "sll", 's', darkSteel, 'l', Items.leather); + addShaped(new ItemStack(DarkSteelItems.itemGliderWing, 1, 1), " s ", "wsw", " ", 's', darkSteel, 'w', wing); - GameRegistry.addShapedRecipe(DarkSteelItems.itemDarkSteelShears.createItemStack(), " s", "s ", 's', darkSteel); + addShaped(DarkSteelItems.itemDarkSteelShears.createItemStack(), " s", "s ", 's', darkSteel); ItemStack dspp = new ItemStack(EnderIO.blockDarkSteelPressurePlate); - GameRegistry.addShapedRecipe(dspp, "ss", 's', darkSteel); + addShaped(dspp, "ss", 's', darkSteel); ItemStack dsppSilent = new ItemStack(EnderIO.blockDarkSteelPressurePlate, 1, 1); GameRegistry.addShapedRecipe(dsppSilent, "p", "w", 'p', dspp, 'w', Blocks.wool); //Soul Vessel - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemSoulVessel), " s ", "q q", " q ", 's', soularium, 'q', new ItemStack(EnderIO.blockFusedQuartz,1,0)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.itemSoulVessel), " s ", "q q", " q ", 's', soularium, 'q', new ItemStack( + EnderIO.blockFusedQuartz, 1, 0))); //XP Rod - GameRegistry.addShapedRecipe(new ItemStack(EnderIO.itemXpTransfer), " s", " v ", "s ", 's', soularium, 'v', enAlloy); + addShaped(new ItemStack(EnderIO.itemXpTransfer), " s", " v ", "s ", 's', soularium, 'v', enAlloy); - } - - public static void addOreDictionaryRecipes() { - ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()); - GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 'w', "stickWood")); - GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 'w', "woodStick")); - GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'w', "stickWood")); - GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'w', "woodStick")); - GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelAxe.createItemStack(), "ss ", "sw ", " w ", 's', darkSteel, 'w', "woodStick")); - GameRegistry.addRecipe(new ShapedOreRecipe(DarkSteelItems.itemDarkSteelAxe.createItemStack(), "ss ", "sw ", " w ", 's', darkSteel, 'w', "stickWood")); + // DS Tools + addShaped(DarkSteelItems.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 'w', "stickWood"); + addShaped(DarkSteelItems.itemDarkSteelSword.createItemStack(), " s ", " s ", " w ", 's', darkSteel, 'w', "woodStick"); + addShaped(DarkSteelItems.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'w', "stickWood"); + addShaped(DarkSteelItems.itemDarkSteelPickaxe.createItemStack(), "sss", " w ", " w ", 's', darkSteel, 'w', "woodStick"); + addShaped(DarkSteelItems.itemDarkSteelAxe.createItemStack(), "ss ", "sw ", " w ", 's', darkSteel, 'w', "woodStick"); + addShaped(DarkSteelItems.itemDarkSteelAxe.createItemStack(), "ss ", "sw ", " w ", 's', darkSteel, 'w', "stickWood"); } } diff --git a/src/main/java/crazypants/enderio/machine/MachineRecipes.java b/src/main/java/crazypants/enderio/machine/MachineRecipes.java index 1631dcfd..c0d3aeae 100644 --- a/src/main/java/crazypants/enderio/machine/MachineRecipes.java +++ b/src/main/java/crazypants/enderio/machine/MachineRecipes.java @@ -1,11 +1,9 @@ package crazypants.enderio.machine; -import static crazypants.enderio.EnderIO.itemBasicCapacitor; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import cpw.mods.fml.common.registry.GameRegistry; import crazypants.enderio.EnderIO; @@ -17,132 +15,131 @@ import crazypants.enderio.machine.capbank.BlockItemCapBank; import crazypants.enderio.machine.capbank.CapBankType; import crazypants.enderio.machine.capbank.ConvertOldRecipe; import crazypants.enderio.machine.light.BlockItemElectricLight; -import crazypants.enderio.material.Alloy; import crazypants.enderio.material.FrankenSkull; import crazypants.enderio.material.MachinePart; import crazypants.enderio.material.Material; import crazypants.enderio.power.Capacitors; +import static crazypants.enderio.EnderIO.itemBasicCapacitor; +import static crazypants.enderio.material.Alloy.*; +import static crazypants.enderio.material.Material.*; +import static crazypants.util.RecipeUtil.*; + public class MachineRecipes { public static void addRecipes() { //Common ingredients - ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 4, Material.CONDUIT_BINDER.ordinal()); ItemStack capacitor = new ItemStack(itemBasicCapacitor, 1, 0); ItemStack capacitor2 = new ItemStack(itemBasicCapacitor, 1, 1); ItemStack capacitor3 = new ItemStack(itemBasicCapacitor, 1, 2); ItemStack enderCapacitor = new ItemStack(itemBasicCapacitor, 1, Capacitors.ENDER_CAPACITOR.ordinal()); - ItemStack basicGear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal()); - ItemStack machineChassi = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal()); - ItemStack silicon = new ItemStack(EnderIO.itemMaterial, 1, Material.SILICON.ordinal()); - ItemStack pulCry = new ItemStack(EnderIO.itemMaterial, 1, Material.PULSATING_CYSTAL.ordinal()); - ItemStack vibCry = new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_CYSTAL.ordinal()); - ItemStack endCry = new ItemStack(EnderIO.itemMaterial, 1, Material.ENDER_CRYSTAL.ordinal()); - ItemStack electricSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()); - ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()); - ItemStack phasedGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()); - ItemStack phasedIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()); - ItemStack energeticAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal()); + String basicGear = MachinePart.BASIC_GEAR.oreDict; + String machineChassi = MachinePart.MACHINE_CHASSI.oreDict; ItemStack fusedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 0); - ItemStack clearGlass = new ItemStack(EnderIO.blockFusedQuartz, 1, 1); ItemStack enlightedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 2); - ItemStack fusedGlass = new ItemStack(EnderIO.blockFusedQuartz, 1, 1); - ItemStack soularium = new ItemStack(EnderIO.itemAlloy, 1, Alloy.SOULARIUM.ordinal()); ItemStack zombieController = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_CONTROLLER.ordinal()); ItemStack frankenZombie = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.FRANKEN_ZOMBIE.ordinal()); ItemStack enderRes = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ENDER_RESONATOR.ordinal()); ItemStack sentientEnder = new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.SENTIENT_ENDER.ordinal()); ItemStack obsidian = new ItemStack(Blocks.obsidian); + String electricalSteel = ELECTRICAL_STEEL.oreIngot; + String darkSteel = DARK_STEEL.oreIngot; + String energeticAlloy = ENERGETIC_ALLOY.oreIngot; + String phasedGold = PHASED_GOLD.oreIngot; + String phasedIron = PHASED_IRON.oreIngot; + String soularium = SOULARIUM.oreIngot; + + String vibCry = VIBRANT_CYSTAL.oreDict; + String pulCry = PULSATING_CYSTAL.oreDict; + String endCry = ENDER_CRYSTAL.oreDict; + String binder = CONDUIT_BINDER.oreDict; + String silicon = SILICON.oreDict; + //stirling gen ItemStack stirlingGen = new ItemStack(EnderIO.blockStirlingGenerator, 1, 0); - GameRegistry.addShapedRecipe(stirlingGen, "bbb", "bfb", "gpg", 'b', Blocks.stonebrick, 'f', Blocks.furnace, 'p', Blocks.piston, 'g', basicGear); + addShaped(stirlingGen, "bbb", "bfb", "gpg", 'b', Blocks.stonebrick, 'f', Blocks.furnace, 'p', Blocks.piston, 'g', basicGear); //Combustion Gen ItemStack res = new ItemStack(EnderIO.blockTank, 1, 0); ItemStack comGen = new ItemStack(EnderIO.blockCombustionGenerator, 1, 0); - GameRegistry.addShapedRecipe(comGen, "eee", "rmr", "gpg", 'e', electricSteel, 'r', res, 'm', machineChassi, 'g', basicGear, 'p', Blocks.piston); + addShaped(comGen, "eee", "rmr", "gpg", 'e', electricalSteel, 'r', res, 'm', machineChassi, 'g', basicGear, 'p', Blocks.piston); //ZombieGen ItemStack zg = new ItemStack(EnderIO.blockZombieGenerator, 1, 0); - GameRegistry.addShapedRecipe(zg, "eee", "qzq", "qqq", 'e', electricSteel, 'q', fusedQuartz, 'z', new ItemStack(EnderIO.itemFrankenSkull, 1, 0)); + addShaped(zg, "eee", "qzq", "qqq", 'e', electricalSteel, 'q', fusedQuartz, 'z', new ItemStack(EnderIO.itemFrankenSkull, 1, 0)); //KillerJoe ItemStack kj = new ItemStack(EnderIO.blockKillerJoe, 1, 0); - GameRegistry.addShapedRecipe(kj, "sss", "qzq", "qqq", 's', darkSteel, 'q', fusedQuartz, 'z', frankenZombie); + addShaped(kj, "sss", "qzq", "qqq", 's', darkSteel, 'q', fusedQuartz, 'z', frankenZombie); //Wireless charger ItemStack wirelessCharger = new ItemStack(EnderIO.blockWirelessCharger); - //GameRegistry.addShapedRecipe(wirelessCharger, "svs", "imi", "scs", 's', electricSteel, 'i', silicon, 'm', machineChassi, 'c', capacitor3, 'v', vibCry); - GameRegistry.addShapedRecipe(wirelessCharger, "sss", "ses", "scs", 's', electricSteel, 'c', capacitor3, 'e', enderRes); + //addShaped(wirelessCharger, "svs", "imi", "scs", 's', electricSteel, 'i', silicon, 'm', machineChassi, 'c', capacitor3, 'v', vibCry); + addShaped(wirelessCharger, "sss", "ses", "scs", 's', electricalSteel, 'c', capacitor3, 'e', enderRes); //Crafter ItemStack crafter = new ItemStack(EnderIO.blockCrafter, 1, 0); - GameRegistry.addShapedRecipe(crafter, "iti", "imi", "izi", 'i', Items.iron_ingot, 't', Blocks.crafting_table, 'm', machineChassi, 'z', zombieController); + addShaped(crafter, "iti", "imi", "izi", 'i', Items.iron_ingot, 't', Blocks.crafting_table, 'm', machineChassi, 'z', zombieController); //Powered Spawner ItemStack poweredSpawner = new ItemStack(EnderIO.blockPoweredSpawner); ItemStack zombieBit; - if(Config.useHardRecipes) { + if (Config.useHardRecipes) { zombieBit = frankenZombie; } else { zombieBit = zombieController; } - GameRegistry.addRecipe(new ShapedOreRecipe(poweredSpawner, "ese", "eme", "vzv", 'e', electricSteel, 's', "itemSkull", 'v', vibCry, 'm', machineChassi, 'z', - zombieBit)); + addShaped(poweredSpawner, "ese", "eme", "vzv", 'e', electricalSteel, 's', "itemSkull", 'v', vibCry, 'm', machineChassi, 'z', zombieBit); - if(Config.reservoirEnabled) { + if (Config.reservoirEnabled) { //reservoir ItemStack reservoir = new ItemStack(EnderIO.blockReservoir, 2, 0); Object glassSides; - if(Config.useHardRecipes) { + if (Config.useHardRecipes) { glassSides = "blockGlassHardened"; } else { glassSides = "glass"; } - GameRegistry.addRecipe(new ShapedOreRecipe(reservoir, "gfg", "gcg", "gfg", 'g', glassSides, 'c', Items.cauldron, 'f', fusedQuartz)); + addShaped(reservoir, "gfg", "gcg", "gfg", 'g', glassSides, 'c', Items.cauldron, 'f', fusedQuartz); } //Tanks ItemStack basicTank = new ItemStack(EnderIO.blockTank, 1, 0); - GameRegistry.addRecipe(new ShapedOreRecipe(basicTank, "ibi", "bgb", "ibi", 'g', "glass", 'i', Items.iron_ingot, 'b', Blocks.iron_bars)); + addShaped(basicTank, "ibi", "bgb", "ibi", 'g', "glass", 'i', Items.iron_ingot, 'b', Blocks.iron_bars); ItemStack advTank = new ItemStack(EnderIO.blockTank, 1, 1); - GameRegistry.addRecipe(new ShapedOreRecipe(advTank, "ibi", "bgb", "ibi", 'g', "blockGlassHardened", 'i', darkSteel, 'b', EnderIO.blockDarkIronBars)); + addShaped(advTank, "ibi", "bgb", "ibi", 'g', "blockGlassHardened", 'i', darkSteel, 'b', EnderIO.blockDarkIronBars); //mill ItemStack crusher = new ItemStack(EnderIO.blockCrusher, 1, 0); - if(Config.useHardRecipes) { - GameRegistry.addShapedRecipe(crusher, "ooo", "fmf", "pip", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'p', - Blocks.piston, - 'o', Blocks.obsidian); + if (Config.useHardRecipes) { + addShaped(crusher, "ooo", "fmf", "pip", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'p', Blocks.piston, 'o', Blocks.obsidian); } else { - GameRegistry.addShapedRecipe(crusher, "fff", "imi", "ipi", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'p', Blocks.piston); + addShaped(crusher, "fff", "imi", "ipi", 'f', Items.flint, 'm', machineChassi, 'i', Items.iron_ingot, 'p', Blocks.piston); } //alloy smelter ItemStack alloySmelter = new ItemStack(EnderIO.blockAlloySmelter, 1, 0); - if(Config.useHardRecipes) { - GameRegistry.addRecipe(new ShapedOreRecipe(alloySmelter, "bfb", "fmf", "bcb", 'c', Items.cauldron, 'm', machineChassi, 'b', Blocks.iron_block, 'f', - Blocks.furnace)); + if (Config.useHardRecipes) { + addShaped(alloySmelter, "bfb", "fmf", "bcb", 'c', Items.cauldron, 'm', machineChassi, 'b', Blocks.iron_block, 'f', Blocks.furnace); } else { - GameRegistry.addRecipe(new ShapedOreRecipe(alloySmelter, "bfb", "fmf", "bcb", 'c', Items.cauldron, 'm', machineChassi, 'b', Items.iron_ingot, 'f', - Blocks.furnace)); + addShaped(alloySmelter, "bfb", "fmf", "bcb", 'c', Items.cauldron, 'm', machineChassi, 'b', Items.iron_ingot, 'f', Blocks.furnace); } //Vat ItemStack still = new ItemStack(EnderIO.blockVat, 1, 0); - GameRegistry.addShapedRecipe(still, "eve", "tmt", "efe", 'v', Items.cauldron, 'm', machineChassi, 'e', electricSteel, 'f', Blocks.furnace, 't', basicTank); + addShaped(still, "eve", "tmt", "efe", 'v', Items.cauldron, 'm', machineChassi, 'e', electricalSteel, 'f', Blocks.furnace, 't', basicTank); //capacitor bank ItemStack capBank1 = BlockItemCapBank.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.SIMPLE), 0); - GameRegistry.addShapedRecipe(capBank1, "bcb", "cmc", "bcb", 'b', Items.iron_ingot, 'c', capacitor, 'm', Blocks.redstone_block); + addShaped(capBank1, "bcb", "cmc", "bcb", 'b', Items.iron_ingot, 'c', capacitor, 'm', Blocks.redstone_block); ItemStack capBank2 = BlockItemCapBank.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.ACTIVATED), 0); - GameRegistry.addShapedRecipe(capBank2, "bcb", "cmc", "bcb", 'b', electricSteel, 'c', capacitor2, 'm', Blocks.redstone_block); + addShaped(capBank2, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor2, 'm', Blocks.redstone_block); ItemStack capBank3 = BlockItemCapBank.createItemStackWithPower(CapBankType.getMetaFromType(CapBankType.VIBRANT), 0); - GameRegistry.addShapedRecipe(capBank3, "bcb", "cmc", "bcb", 'b', electricSteel, 'c', capacitor3, 'm', vibCry); + addShaped(capBank3, "bcb", "cmc", "bcb", 'b', electricalSteel, 'c', capacitor3, 'm', vibCry); ConvertOldRecipe convertRecipe = new ConvertOldRecipe(); GameRegistry.addRecipe(convertRecipe); @@ -152,54 +149,46 @@ public class MachineRecipes { //painter ItemStack painter = new ItemStack(EnderIO.blockPainter, 1, 0); - if(Config.useHardRecipes) { - GameRegistry.addRecipe(new ShapedOreRecipe(painter, "qqq", "mdm", "mMm", 'm', electricSteel, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond, - 'd', Items.diamond)); + if (Config.useHardRecipes) { + addShaped(painter, "qqq", "mdm", "mMm", 'm', electricalSteel, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond, 'd', Items.diamond); } else { - GameRegistry.addRecipe(new ShapedOreRecipe(painter, "qdq", "mMm", "mmm", 'm', electricSteel, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond, - 'd', Items.diamond)); + addShaped(painter, "qdq", "mMm", "mmm", 'm', electricalSteel, 'M', machineChassi, 'q', Items.quartz, 'd', Items.diamond, 'd', Items.diamond); } //Farm ItemStack farm = new ItemStack(EnderIO.blockFarmStation, 1, 0); - if(Config.useHardRecipes) { + if (Config.useHardRecipes) { zombieBit = frankenZombie; } else { zombieBit = zombieController; } - GameRegistry.addShapedRecipe(farm, "ehe", "eme", "pzp", 'h', Items.diamond_hoe, 'm', machineChassi, 'e', electricSteel, 'z', zombieController, 'p', pulCry); + addShaped(farm, "ehe", "eme", "pzp", 'h', Items.diamond_hoe, 'm', machineChassi, 'e', electricalSteel, 'z', zombieController, 'p', pulCry); - if(Config.transceiverEnabled) { + if (Config.transceiverEnabled) { //transceiver ItemStack transceiver = new ItemStack(EnderIO.blockTransceiver, 1, 0); - if(Config.transceiverUseEasyRecipe) { - GameRegistry - .addShapedRecipe(transceiver, "oeo", "pdp", "oco", 'o', obsidian, 'e', Items.ender_eye, 'c', enderCapacitor, 'p', phasedGold, 'd', Items.diamond); + if (Config.transceiverUseEasyRecipe) { + addShaped(transceiver, "oeo", "pdp", "oco", 'o', obsidian, 'e', Items.ender_eye, 'c', enderCapacitor, 'p', phasedGold, 'd', + Items.diamond); } else { - GameRegistry - .addShapedRecipe(transceiver, "oeo", "pdp", "oco", 'o', electricSteel, 'e', enderRes, 'c', enderCapacitor, 'p', fusedQuartz, 'd', endCry); - GameRegistry.addShapelessRecipe(transceiver, new ItemStack(EnderIO.blockHyperCube, 1, 0)); + addShaped(transceiver, "oeo", "pdp", "oco", 'o', electricalSteel, 'e', enderRes, 'c', enderCapacitor, 'p', fusedQuartz, 'd', endCry); + addShapeless(transceiver, new ItemStack(EnderIO.blockHyperCube, 1, 0)); } } //solar panel - if(Config.photovoltaicCellEnabled) { + if (Config.photovoltaicCellEnabled) { ItemStack solarPanel = new ItemStack(EnderIO.blockSolarPanel, 1, 0); ItemStack advSolarPanel = new ItemStack(EnderIO.blockSolarPanel, 1, 1); - if(Config.useHardRecipes) { - GameRegistry.addRecipe(new ShapedOreRecipe(solarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', "blockGlassHardened", 'c', capacitor, - 'e', - energeticAlloy, 'p', phasedGold)); - GameRegistry.addRecipe(new ShapedOreRecipe(advSolarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', enlightedQuartz, 'c', capacitor2, - 'e', - phasedIron, 'p', phasedGold)); + if (Config.useHardRecipes) { + addShaped(solarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', "blockGlassHardened", 'c', capacitor, 'e', energeticAlloy, 'p', + phasedGold); + addShaped(advSolarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', enlightedQuartz, 'c', capacitor2, 'e', phasedIron, 'p', phasedGold); } else { - GameRegistry.addRecipe(new ShapedOreRecipe(solarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', "blockGlassHardened", 'p', silicon, - 'e', - energeticAlloy, 'c', electricSteel)); - GameRegistry.addRecipe(new ShapedOreRecipe(advSolarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', enlightedQuartz, 'p', vibCry, 'e', - phasedGold, 'c', phasedIron)); + addShaped(solarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', "blockGlassHardened", 'p', silicon, 'e', energeticAlloy, 'c', + electricalSteel); + addShaped(advSolarPanel, "efe", "pfp", "cdc", 'd', Blocks.daylight_detector, 'f', enlightedQuartz, 'p', vibCry, 'e', phasedGold, 'c', phasedIron); } } @@ -208,20 +197,19 @@ public class MachineRecipes { ItemStack powerConduit = new ItemStack(EnderIO.itemPowerConduit, 1, 0); ItemStack redstoneConduit = new ItemStack(EnderIO.itemRedstoneConduit, 1, 2); ItemStack mJMonitor = new ItemStack(EnderIO.blockPowerMonitor, 1, 0); - GameRegistry.addShapedRecipe(mJMonitor, "sms", "sMs", "sps", 's', electricSteel, 'M', machineChassi, 'm', mJReader, 'p', powerConduit, - 'r', redstoneConduit); + addShaped(mJMonitor, "sms", "sMs", "sps", 's', electricalSteel, 'M', machineChassi, 'm', mJReader, 'p', powerConduit, 'r', redstoneConduit); //Enchanter ItemStack enchanter = new ItemStack(EnderIO.blockEnchanter); - GameRegistry.addShapedRecipe(enchanter, "dbd", "sss", " s ", 'd', Items.diamond, 'b', Items.book, 's', darkSteel); + addShaped(enchanter, "dbd", "sss", " s ", 'd', Items.diamond, 'b', Items.book, 's', darkSteel); //Vacuum Chest ItemStack vacuumChest = new ItemStack(EnderIO.blockVacuumChest); - GameRegistry.addShapedRecipe(vacuumChest, "iii", "ici", "ipi", 'i', Items.iron_ingot, 'c', Blocks.chest, 'p', pulCry); + addShaped(vacuumChest, "iii", "ici", "ipi", 'i', Items.iron_ingot, 'c', Blocks.chest, 'p', pulCry); //Soul Binder - ItemStack enderBit; - if(Config.soulBinderRequiresEndermanSkull) { + Object enderBit; + if (Config.soulBinderRequiresEndermanSkull) { enderBit = new ItemStack(EnderIO.blockEndermanSkull); } else { enderBit = pulCry; @@ -230,29 +218,28 @@ public class MachineRecipes { ItemStack zombieSkull = new ItemStack(Items.skull, 1, 4); ItemStack skeletonSkull = new ItemStack(Items.skull, 1, 0); ItemStack soulBinder = new ItemStack(EnderIO.blockSoulFuser); - GameRegistry.addShapedRecipe(soulBinder, "ses", "zmc", "sks", 's', soularium, 'm', machineChassi, 'e', enderBit, 'z', zombieSkull, 'c', creeperSkull, 'k', - skeletonSkull); + addShaped(soulBinder, "ses", "zmc", "sks", 's', soularium, 'm', machineChassi, 'e', enderBit, 'z', zombieSkull, 'c', creeperSkull, 'k', skeletonSkull); //Attractor ItemStack attractor = new ItemStack(EnderIO.blockAttractor); ItemStack attractorCrystal = new ItemStack(EnderIO.itemMaterial, 1, Material.ATTRACTOR_CRYSTAL.ordinal()); - GameRegistry.addShapedRecipe(attractor, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', attractorCrystal, 'e', energeticAlloy); + addShaped(attractor, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', attractorCrystal, 'e', energeticAlloy); //Aversion ItemStack aversion = new ItemStack(EnderIO.blockSpawnGuard); ItemStack tormentedEnderman = new ItemStack(EnderIO.blockEndermanSkull, 1, BlockEndermanSkull.SkullType.TORMENTED.ordinal()); - GameRegistry.addShapedRecipe(aversion, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', tormentedEnderman, 'e', energeticAlloy); + addShaped(aversion, " c ", "ese", "sms", 's', soularium, 'm', machineChassi, 'c', tormentedEnderman, 'e', energeticAlloy); //Experience ItemStack xp = new ItemStack(EnderIO.blockExperianceOblisk); ItemStack xpItem = new ItemStack(EnderIO.itemXpTransfer); - GameRegistry.addShapedRecipe(xp, " x ", " s ", "sms", 's', soularium, 'm', machineChassi, 'x', xpItem); + addShaped(xp, " x ", " s ", "sms", 's', soularium, 'm', machineChassi, 'x', xpItem); //Weather ItemStack weather = new ItemStack(EnderIO.blockWeatherObelisk); ItemStack weatherItem = new ItemStack(EnderIO.itemMaterial, 1, Material.WEATHER_CRYSTAL.ordinal()); - GameRegistry.addShapedRecipe(weather, " x ", "ese", "sbs", 'x', weatherItem, 'e', energeticAlloy, 's', soularium, 'b', new ItemStack(EnderIO.blockCapBank, - 1, CapBankType.getMetaFromType(CapBankType.SIMPLE))); + addShaped(weather, " x ", "ese", "sbs", 'x', weatherItem, 'e', energeticAlloy, 's', soularium, 'b', + new ItemStack(EnderIO.blockCapBank, 1, CapBankType.getMetaFromType(CapBankType.SIMPLE))); ClearConfigRecipe inst = new ClearConfigRecipe(); MinecraftForge.EVENT_BUS.register(inst); @@ -263,65 +250,52 @@ public class MachineRecipes { ItemStack poweredLampInv = new ItemStack(EnderIO.blockElectricLight, 1, BlockItemElectricLight.Type.ELECTRIC_INV.ordinal()); ItemStack wirelessLamp = new ItemStack(EnderIO.blockElectricLight, 1, BlockItemElectricLight.Type.WIRELESS.ordinal()); ItemStack wirelessLampInv = new ItemStack(EnderIO.blockElectricLight, 1, BlockItemElectricLight.Type.WIRELESS_INV.ordinal()); - GameRegistry.addShapelessRecipe(wirelessLamp, poweredLamp, enderRes); - GameRegistry.addShapelessRecipe(wirelessLamp, wirelessLampInv, Blocks.redstone_torch); - GameRegistry.addShapelessRecipe(wirelessLampInv, poweredLampInv, enderRes); - GameRegistry.addShapelessRecipe(wirelessLampInv, wirelessLamp, Blocks.redstone_torch); + addShapeless(wirelessLamp, poweredLamp, enderRes); + addShapeless(wirelessLamp, wirelessLampInv, Blocks.redstone_torch); + addShapeless(wirelessLampInv, poweredLampInv, enderRes); + addShapeless(wirelessLampInv, wirelessLamp, Blocks.redstone_torch); //inventory panel ItemStack awareness = new ItemStack(EnderIO.itemFunctionUpgrade, 1, FunctionUpgrade.INVENTORY_PANEL.ordinal()); - GameRegistry.addRecipe(new ShapedOreRecipe(awareness, "bsb", "ses", "bib", 'b', conduitBinder, 's', silicon, 'e', Items.ender_eye, 'i', electricSteel)); + addShaped(awareness, "bsb", "ses", "bib", 'b', binder, 's', silicon, 'e', Items.ender_eye, 'i', electricalSteel); ItemStack invPanel = new ItemStack(EnderIO.blockInventoryPanel); - GameRegistry.addShapedRecipe(invPanel, "dad", "psp", "dtd", 'd', darkSteel, 'a', awareness, 'p', pulCry, 's', sentientEnder, 't', basicTank); - } + addShaped(invPanel, "dad", "psp", "dtd", 'd', darkSteel, 'a', awareness, 'p', pulCry, 's', sentientEnder, 't', basicTank); - public static void addOreDictionaryRecipes() { - ItemStack capacitor = new ItemStack(itemBasicCapacitor, 1, 0); ItemStack machineChassis = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal()); - ItemStack fusedQuartz = new ItemStack(EnderIO.blockFusedQuartz, 1, 0); //powered light - ItemStack poweredLamp = new ItemStack(EnderIO.blockElectricLight, 1, 0); ItemStack glowstone = new ItemStack(Items.glowstone_dust); - if(Config.useHardRecipes) { - GameRegistry.addRecipe(new ShapedOreRecipe(poweredLamp, "ggg", "sds", "scs", 'g', fusedQuartz, 'd', glowstone, 's', "itemSilicon", 'c', capacitor)); + if (Config.useHardRecipes) { + addShaped(poweredLamp, "ggg", "sds", "scs", 'g', fusedQuartz, 'd', glowstone, 's', "itemSilicon", 'c', capacitor); } else { - GameRegistry.addRecipe(new ShapedOreRecipe(poweredLamp, "ggg", "sds", "scs", 'g', "glass", 'd', glowstone, 's', "itemSilicon", 'c', capacitor)); + addShaped(poweredLamp, "ggg", "sds", "scs", 'g', "glass", 'd', glowstone, 's', "itemSilicon", 'c', capacitor); } ItemStack invPoweredLamp = new ItemStack(EnderIO.blockElectricLight, 1, 1); - GameRegistry.addShapelessRecipe(invPoweredLamp, poweredLamp, Blocks.redstone_torch); - GameRegistry.addShapelessRecipe(poweredLamp, invPoweredLamp, Blocks.redstone_torch); + addShapeless(invPoweredLamp, poweredLamp, Blocks.redstone_torch); + addShapeless(poweredLamp, invPoweredLamp, Blocks.redstone_torch); //light ItemStack lamp = new ItemStack(EnderIO.blockElectricLight, 1, 2); - GameRegistry.addRecipe(new ShapedOreRecipe(lamp, " ", "ggg", "isi", 'g', "glass", 's', Blocks.glowstone, 'i', Items.iron_ingot)); + addShaped(lamp, " ", "ggg", "isi", 'g', "glass", 's', Blocks.glowstone, 'i', Items.iron_ingot); ItemStack invLamp = new ItemStack(EnderIO.blockElectricLight, 1, 3); - GameRegistry.addShapelessRecipe(invLamp, lamp, Blocks.redstone_torch); - GameRegistry.addShapelessRecipe(lamp, invLamp, Blocks.redstone_torch); + addShapeless(invLamp, lamp, Blocks.redstone_torch); + addShapeless(lamp, invLamp, Blocks.redstone_torch); //MJ Reader - ItemStack mJReader = new ItemStack(EnderIO.itemConduitProbe, 1, 0); - ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()); - ItemStack powerConduit = new ItemStack(EnderIO.itemPowerConduit, 1, 0); - ItemStack redstoneConduit = new ItemStack(EnderIO.itemRedstoneConduit, 1, 2); - GameRegistry.addRecipe(new ShapedOreRecipe(mJReader, "epe", "gcg", "srs", 'p', powerConduit, 'r', redstoneConduit, 'c', Items.comparator, 'g', - Blocks.glass_pane, 's', "itemSilicon", 'e', - electricalSteel)); + addShaped(mJReader, "epe", "gcg", "srs", 'p', powerConduit, 'r', redstoneConduit, 'c', Items.comparator, 'g', Blocks.glass_pane, 's', "itemSilicon", 'e', + electricalSteel); //Slice'N'Splice - ItemStack soularium = new ItemStack(EnderIO.itemAlloy, 1, Alloy.SOULARIUM.ordinal()); ItemStack sns = new ItemStack(EnderIO.blockSliceAndSplice); - GameRegistry.addRecipe(new ShapedOreRecipe(sns, "iki", "ams", "iii", 'i', soularium, 'm', machineChassis, 'k', "itemSkull", 'a', Items.iron_axe, 's', - Items.shears)); - - //Buffer - ItemStack itemBuffer = Type.getStack(Type.ITEM); - ItemStack powerBuffer = Type.getStack(Type.POWER); - ItemStack omniBuffer = Type.getStack(Type.OMNI); - GameRegistry.addRecipe(new ShapedOreRecipe(itemBuffer, "isi", "scs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'c', Blocks.chest)); - GameRegistry.addRecipe(new ShapedOreRecipe(powerBuffer, "isi", "sfs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'f', machineChassis)); - GameRegistry.addRecipe(new ShapelessOreRecipe(omniBuffer, itemBuffer, powerBuffer)); + addShaped(sns, "iki", "ams", "iii", 'i', soularium, 'm', machineChassis, 'k', "itemSkull", 'a', Items.iron_axe, 's', Items.shears); + //Buffer + ItemStack itemBuffer = Type.getStack(Type.ITEM); + ItemStack powerBuffer = Type.getStack(Type.POWER); + ItemStack omniBuffer = Type.getStack(Type.OMNI); + addShaped(itemBuffer, "isi", "scs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'c', Blocks.chest); + addShaped(powerBuffer, "isi", "sfs", "isi", 'i', "ingotIron", 's', "ingotElectricalSteel", 'f', machineChassis); + addShapeless(omniBuffer, itemBuffer, powerBuffer); } } \ No newline at end of file diff --git a/src/main/java/crazypants/enderio/material/Alloy.java b/src/main/java/crazypants/enderio/material/Alloy.java index e17d2f21..694419a2 100644 --- a/src/main/java/crazypants/enderio/material/Alloy.java +++ b/src/main/java/crazypants/enderio/material/Alloy.java @@ -1,7 +1,11 @@ package crazypants.enderio.material; +import net.minecraft.item.ItemStack; + import org.apache.commons.lang3.StringUtils; +import crazypants.enderio.EnderIO; + public enum Alloy { ELECTRICAL_STEEL("electricalSteel", 6.0f), @@ -15,19 +19,35 @@ public enum Alloy { public final String unlocalisedName; public final String iconKey; - public final String oredictIngotName; - public final String oredictBlockName; + public final String oreIngot; + public final String oreBlock; private final float hardness; private Alloy(String baseName, float hardness) { this.unlocalisedName = "enderio." + baseName; this.iconKey = "enderio:" + baseName; - this.oredictIngotName = "ingot" + StringUtils.capitalize(baseName); - this.oredictBlockName = "block" + StringUtils.capitalize(baseName); + this.oreIngot = "ingot" + StringUtils.capitalize(baseName); + this.oreBlock = "block" + StringUtils.capitalize(baseName); this.hardness = hardness; } public float getHardness() { return hardness; } + + public ItemStack getStackIngot() { + return getStackIngot(1); + } + + public ItemStack getStackIngot(int size) { + return new ItemStack(EnderIO.itemAlloy, size, ordinal()); + } + + public ItemStack getStackBlock() { + return getStackIngot(1); + } + + public ItemStack getStackBlock(int size) { + return new ItemStack(EnderIO.blockIngotStorage, size, ordinal()); + } } diff --git a/src/main/java/crazypants/enderio/material/MachinePart.java b/src/main/java/crazypants/enderio/material/MachinePart.java index 0c74cadc..005d407c 100644 --- a/src/main/java/crazypants/enderio/material/MachinePart.java +++ b/src/main/java/crazypants/enderio/material/MachinePart.java @@ -1,5 +1,11 @@ package crazypants.enderio.material; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +import org.apache.commons.lang3.StringUtils; + public enum MachinePart { MACHINE_CHASSI("machineChassi"), @@ -7,10 +13,17 @@ public enum MachinePart { public final String unlocalisedName; public final String iconKey; + public final String oreDict; private MachinePart(String unlocalisedName) { this.unlocalisedName = "enderio." + unlocalisedName; this.iconKey = "enderio:" + unlocalisedName; + this.oreDict = "item" + StringUtils.capitalize(unlocalisedName); + } + + public static void registerOres(Item item) { + for (MachinePart m : values()) { + OreDictionary.registerOre(m.oreDict, new ItemStack(item, 1, m.ordinal())); + } } - } diff --git a/src/main/java/crazypants/enderio/material/Material.java b/src/main/java/crazypants/enderio/material/Material.java index 86af833a..6db4e1c7 100644 --- a/src/main/java/crazypants/enderio/material/Material.java +++ b/src/main/java/crazypants/enderio/material/Material.java @@ -6,6 +6,8 @@ import net.minecraftforge.oredict.OreDictionary; import org.apache.commons.lang3.StringUtils; +import crazypants.enderio.EnderIO; + public enum Material { SILICON("silicon"), @@ -41,4 +43,12 @@ public enum Material { OreDictionary.registerOre(m.oreDict, new ItemStack(item, 1, m.ordinal())); } } + + public ItemStack getStack() { + return getStack(1); + } + + public ItemStack getStack(int size) { + return new ItemStack(EnderIO.itemMaterial, size, ordinal()); + } } diff --git a/src/main/java/crazypants/enderio/material/MaterialRecipes.java b/src/main/java/crazypants/enderio/material/MaterialRecipes.java index aa104f50..a51113a6 100644 --- a/src/main/java/crazypants/enderio/material/MaterialRecipes.java +++ b/src/main/java/crazypants/enderio/material/MaterialRecipes.java @@ -1,19 +1,11 @@ package crazypants.enderio.material; -import static crazypants.enderio.EnderIO.itemBasicCapacitor; -import static crazypants.util.OreDictionaryHelper.INGOT_TIN; -import static crazypants.util.OreDictionaryHelper.hasCopper; -import static crazypants.util.OreDictionaryHelper.hasEnderPearlDust; -import static crazypants.util.OreDictionaryHelper.hasTin; - import java.util.ArrayList; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import cpw.mods.fml.common.registry.GameRegistry; import crazypants.enderio.EnderIO; @@ -21,21 +13,26 @@ import crazypants.enderio.config.Config; import crazypants.enderio.machine.obelisk.weather.TileWeatherObelisk.WeatherTask; import crazypants.util.OreDictionaryHelper; +import static crazypants.enderio.EnderIO.itemBasicCapacitor; +import static crazypants.enderio.material.Alloy.*; +import static crazypants.enderio.material.Material.*; +import static crazypants.util.OreDictionaryHelper.*; +import static crazypants.util.RecipeUtil.*; public class MaterialRecipes { public static void registerDependantOresInDictionary() { - if(hasCopper()) { + if (hasCopper()) { OreDictionary.registerOre("dustCopper", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_COPPER.ordinal())); } - if(hasTin()) { + if (hasTin()) { OreDictionary.registerOre("dustTin", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_TIN.ordinal())); } - if(hasEnderPearlDust()) { + if (hasEnderPearlDust()) { OreDictionary.registerOre("dustEnderPearl", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_ENDER.ordinal())); } //Enderium Base - if(OreDictionaryHelper.hasEnderium()) { + if (OreDictionaryHelper.hasEnderium()) { OreDictionary.registerOre("ingotEnderiumBase", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.INGOT_ENDERIUM_BASE.ordinal())); } } @@ -46,13 +43,10 @@ public class MaterialRecipes { OreDictionary.registerOre("dustIron", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_IRON.ordinal())); OreDictionary.registerOre("dustGold", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_GOLD.ordinal())); OreDictionary.registerOre("dustObsidian", new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_OBSIDIAN.ordinal())); - - OreDictionary.registerOre("gearStone", new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal())); - OreDictionary.registerOre("itemSilicon", new ItemStack(EnderIO.itemMaterial, 1, Material.SILICON.ordinal())); for (Alloy alloy : Alloy.values()) { - OreDictionary.registerOre(alloy.oredictIngotName, new ItemStack(EnderIO.itemAlloy, 1, alloy.ordinal())); - OreDictionary.registerOre(alloy.oredictBlockName, new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal())); + OreDictionary.registerOre(alloy.oreIngot, new ItemStack(EnderIO.itemAlloy, 1, alloy.ordinal())); + OreDictionary.registerOre(alloy.oreBlock, new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal())); } OreDictionary.registerOre("nuggetPulsatingIron", new ItemStack(EnderIO.itemMaterial, 1, Material.PHASED_IRON_NUGGET.ordinal())); @@ -76,63 +70,60 @@ public class MaterialRecipes { OreDictionary.registerOre("itemSkull", new ItemStack(EnderIO.blockEndermanSkull)); //Glass stuff for compatability - GameRegistry.addShapedRecipe(new ItemStack(Blocks.glass_pane, 16, 0), " ", "eee", "eee", 'e', pureGlass); - GameRegistry.addShapelessRecipe(new ItemStack(Blocks.glass), pureGlass); - GameRegistry.addShapedRecipe(new ItemStack(Items.glass_bottle, 3, 0), " ", "g g", " g ", 'g', pureGlass); + addShaped(new ItemStack(Blocks.glass_pane, 16, 0), " ", "eee", "eee", 'e', pureGlass); + addShapeless(new ItemStack(Blocks.glass), pureGlass); + addShaped(new ItemStack(Items.glass_bottle, 3, 0), " ", "g g", " g ", 'g', pureGlass); Material.registerOres(EnderIO.itemMaterial); + MachinePart.registerOres(EnderIO.itemMachinePart); } public static void addRecipes() { //Common Ingredients - ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 4, Material.CONDUIT_BINDER.ordinal()); - ItemStack basicGear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal()); - ItemStack binderComposite = new ItemStack(EnderIO.itemMaterial, 1, Material.BINDER_COMPOSITE.ordinal()); + String conduitBinder = CONDUIT_BINDER.oreDict; ItemStack fusedQuartzFrame = new ItemStack(EnderIO.itemFusedQuartzFrame, 1, 0); - ItemStack machineChassi = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal()); - ItemStack phasedGold = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()); - ItemStack phasedIron = new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()); - ItemStack electricalSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()); - ItemStack darkSteel = new ItemStack(EnderIO.itemAlloy, 1, Alloy.DARK_STEEL.ordinal()); + String energeticAlloy = ENERGETIC_ALLOY.oreIngot; + String phasedGold = PHASED_GOLD.oreIngot; + String phasedIron = PHASED_IRON.oreIngot; + String darkSteel = DARK_STEEL.oreIngot; ItemStack capacitor = new ItemStack(itemBasicCapacitor, 1, 0); //Conduit Binder - ItemStack cbc = binderComposite.copy(); - cbc.stackSize = 8; - if(Config.useAlternateBinderRecipe) { - GameRegistry.addShapedRecipe(cbc, "gcg", "sgs", "gcg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball); + ItemStack cbc = CONDUIT_BINDER.getStack(8); + if (Config.useAlternateBinderRecipe) { + addShaped(cbc, "gcg", "sgs", "gcg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball); } else { - GameRegistry.addShapedRecipe(cbc, "ggg", "scs", "ggg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball); + addShaped(cbc, "ggg", "scs", "ggg", 'g', Blocks.gravel, 's', Blocks.sand, 'c', Items.clay_ball); } - GameRegistry.addSmelting(binderComposite, conduitBinder, 0); + GameRegistry.addSmelting(BINDER_COMPOSITE.getStack(), CONDUIT_BINDER.getStack(4), 0); //Nuggets ItemStack phasedIronNugget = new ItemStack(EnderIO.itemMaterial, 9, Material.PHASED_IRON_NUGGET.ordinal()); - GameRegistry.addShapelessRecipe(phasedIronNugget, phasedIron); + addShapeless(phasedIronNugget, phasedIron); phasedIronNugget = phasedIronNugget.copy(); phasedIronNugget.stackSize = 1; - GameRegistry.addShapedRecipe(phasedIron, "eee", "eee", "eee", 'e', phasedIronNugget); + addShaped(PHASED_IRON.getStackIngot(), "eee", "eee", "eee", 'e', phasedIronNugget); ItemStack vibrantNugget = new ItemStack(EnderIO.itemMaterial, 9, Material.VIBRANT_NUGGET.ordinal()); - GameRegistry.addShapelessRecipe(vibrantNugget, phasedGold); + addShapeless(vibrantNugget, phasedGold); vibrantNugget = vibrantNugget.copy(); vibrantNugget.stackSize = 1; - GameRegistry.addShapedRecipe(phasedGold, "eee", "eee", "eee", 'e', vibrantNugget); + addShaped(PHASED_GOLD.getStackIngot(), "eee", "eee", "eee", 'e', vibrantNugget); //Crystals ItemStack pulsCry = new ItemStack(EnderIO.itemMaterial, 1, Material.PULSATING_CYSTAL.ordinal()); - GameRegistry.addShapedRecipe(pulsCry, "nnn", "ngn", "nnn", 'n', phasedIronNugget, 'g', Items.diamond); + addShaped(pulsCry, "nnn", "ngn", "nnn", 'n', phasedIronNugget, 'g', Items.diamond); ItemStack vibCry = new ItemStack(EnderIO.itemMaterial, 1, Material.VIBRANT_CYSTAL.ordinal()); - GameRegistry.addShapedRecipe(vibCry, "nnn", "ngn", "nnn", 'n', vibrantNugget, 'g', Items.emerald); + addShaped(vibCry, "nnn", "ngn", "nnn", 'n', vibrantNugget, 'g', Items.emerald); //Balls ItemStack darkBall = new ItemStack(EnderIO.itemMaterial, 5, Material.DARK_GRINDING_BALL.ordinal()); - GameRegistry.addShapedRecipe(darkBall, " s ", "sss", " s ", 's', darkSteel); + addShaped(darkBall, " s ", "sss", " s ", 's', darkSteel); //Smelting ItemStack dustIron = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_IRON.ordinal()); @@ -145,37 +136,36 @@ public class MaterialRecipes { //Ender Dusts ItemStack enderDust = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_ENDER.ordinal()); - GameRegistry.addShapedRecipe(new ItemStack(Items.ender_pearl), "eee", "eee", "eee", 'e', enderDust); + addShaped(new ItemStack(Items.ender_pearl), "eee", "eee", "eee", 'e', enderDust); //Dark Iron Bars ItemStack diBars = new ItemStack(EnderIO.blockDarkIronBars, 16, 0); - GameRegistry.addShapedRecipe(diBars, "ddd", "ddd", 'd', darkSteel); + addShaped(diBars, "ddd", "ddd", 'd', darkSteel); // Fused Quartz Frame - GameRegistry.addRecipe(new ShapedOreRecipe(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "stickWood")); - GameRegistry.addRecipe(new ShapedOreRecipe(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "woodStick")); + addShaped(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "stickWood"); + addShaped(fusedQuartzFrame, "bsb", "s s", "bsb", 'b', conduitBinder, 's', "woodStick"); // Machine Chassi ArrayList steelIngots = OreDictionary.getOres("ingotSteel"); - if(Config.useSteelInChassi == true && steelIngots != null && !steelIngots.isEmpty()) { - GameRegistry.addRecipe(new ShapedOreRecipe(machineChassi, "fif", "ici", "fif", 'f', Blocks.iron_bars, 'i', "ingotSteel", 'c', capacitor)); - } else { - GameRegistry.addShapedRecipe(machineChassi, "fif", "ici", "fif", 'f', Blocks.iron_bars, 'i', Items.iron_ingot, 'c', capacitor); - } + ItemStack chassis = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.MACHINE_CHASSI.ordinal()); + String mat = Config.useSteelInChassi == true && steelIngots != null && !steelIngots.isEmpty() ? "ingotSteel" : "ingotIron"; + addShaped(chassis, "fif", "ici", "fif", 'f', Blocks.iron_bars, 'i', mat, 'c', capacitor); // Basic Gear - GameRegistry.addRecipe(new ShapedOreRecipe(basicGear, "scs", "c c", "scs", 's', "stickWood", 'c', Blocks.cobblestone)); - GameRegistry.addRecipe(new ShapedOreRecipe(basicGear, "scs", "c c", "scs", 's', "woodStick", 'c', Blocks.cobblestone)); + ItemStack gear = new ItemStack(EnderIO.itemMachinePart, 1, MachinePart.BASIC_GEAR.ordinal()); + addShaped(gear, "scs", "c c", "scs", 's', "stickWood", 'c', "cobblestone"); + addShaped(gear, "scs", "c c", "scs", 's', "woodStick", 'c', "cobblestone"); //Ender Capacitor ItemStack enderCapacitor = new ItemStack(EnderIO.itemBasicCapacitor, 1, 2); ItemStack activatedCapacitor = new ItemStack(EnderIO.itemBasicCapacitor, 1, 1); - if(Config.useHardRecipes) { - GameRegistry.addShapedRecipe(enderCapacitor, "eee", "cgc", "eee", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone); + if (Config.useHardRecipes) { + addShaped(enderCapacitor, "eee", "cgc", "eee", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone); } else { - GameRegistry.addShapedRecipe(enderCapacitor, " e ", "cgc", " e ", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone); + addShaped(enderCapacitor, " e ", "cgc", " e ", 'e', phasedGold, 'c', activatedCapacitor, 'g', Blocks.glowstone); } // Weather Crystal @@ -183,30 +173,22 @@ public class MaterialRecipes { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(EnderIO.itemMaterial, 1, Material.WEATHER_CRYSTAL.ordinal()), main, WeatherTask.CLEAR .requiredItem(), WeatherTask.RAIN.requiredItem(), WeatherTask.STORM.requiredItem())); - if(Config.reinforcedObsidianEnabled) { + if (Config.reinforcedObsidianEnabled) { ItemStack reinfObs = new ItemStack(EnderIO.blockReinforcedObsidian); - ItemStack corners = darkSteel; - if(Config.reinforcedObsidianUseDarkSteelBlocks) { - corners = new ItemStack(EnderIO.blockIngotStorage, 1, Alloy.DARK_STEEL.ordinal()); + String corners = darkSteel; + if (Config.reinforcedObsidianUseDarkSteelBlocks) { + corners = Alloy.DARK_STEEL.oreBlock; } - GameRegistry.addShapedRecipe(reinfObs, "dbd", "bob", "dbd", 'd', corners, 'b', EnderIO.blockDarkIronBars, 'o', Blocks.obsidian); + addShaped(reinfObs, "dbd", "bob", "dbd", 'd', corners, 'b', EnderIO.blockDarkIronBars, 'o', Blocks.obsidian); } - GameRegistry.addRecipe(new ShapedOreRecipe(EnderIO.blockDarkSteelAnvil, - "bbb", - " i ", - "iii", + addShaped(EnderIO.blockDarkSteelAnvil, "bbb", " i ", "iii", 'b', DARK_STEEL.oreBlock, 'i', darkSteel); - 'b', "blockDarkSteel", - 'i', "ingotDarkSteel" - )); - - GameRegistry.addRecipe(new ItemStack(EnderIO.blockDarkSteelLadder, 12), "b", "b", "b", 'b', EnderIO.blockDarkIronBars); + addShaped(new ItemStack(EnderIO.blockDarkSteelLadder, 12), "b", "b", "b", 'b', EnderIO.blockDarkIronBars); for (Alloy alloy : Alloy.values()) { - GameRegistry - .addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal()), "iii", "iii", "iii", 'i', alloy.oredictIngotName)); - GameRegistry.addShapelessRecipe(new ItemStack(EnderIO.itemAlloy, 9, alloy.ordinal()), new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal())); + addShaped(alloy.getStackBlock(), "iii", "iii", "iii", 'i', alloy.oreIngot); + addShapeless(alloy.getStackIngot(9), alloy.oreBlock); } //Food @@ -215,42 +197,34 @@ public class MaterialRecipes { GameRegistry.addSmelting(flour, bread, 0.35f); - } - - public static void addOreDictionaryRecipes() { - if(OreDictionaryHelper.hasCopper()) { + if (hasCopper()) { ItemStack dustCopper = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_COPPER.ordinal()); ItemStack ingotCopper = OreDictionaryPreferences.instance.getPreferred(OreDictionaryHelper.INGOT_COPPER); GameRegistry.addSmelting(dustCopper, ingotCopper, 0); } - if(hasTin()) { + if (hasTin()) { ItemStack dustTin = new ItemStack(EnderIO.itemPowderIngot, 1, PowderIngot.POWDER_TIN.ordinal()); ItemStack ingotTin = OreDictionaryPreferences.instance.getPreferred(OreDictionaryHelper.INGOT_TIN); GameRegistry.addSmelting(dustTin, ingotTin, 0); } - ItemStack capacitor = new ItemStack(EnderIO.itemBasicCapacitor, 1, 0); ArrayList copperIngots = OreDictionary.getOres("ingotCopper"); - Item gold; - if(Config.useHardRecipes) { - gold = Items.gold_ingot; + String gold; + if (Config.useHardRecipes) { + gold = "ingotGold"; } else { - gold = Items.gold_nugget; + gold = "nuggetGold"; } - if(copperIngots != null && !copperIngots.isEmpty() && Config.useModMetals) { - GameRegistry.addRecipe(new ShapedOreRecipe(capacitor, " gr", "gcg", "rg ", 'r', Items.redstone, 'g', gold, 'c', "ingotCopper")); + if (copperIngots != null && !copperIngots.isEmpty() && Config.useModMetals) { + addShaped(capacitor, " gr", "gcg", "rg ", 'r', Items.redstone, 'g', gold, 'c', "ingotCopper"); } else { - GameRegistry. - addShapedRecipe(capacitor, " gr", "gig", "rg ", 'r', Items.redstone, 'g', gold, 'i', Items.iron_ingot); + addShaped(capacitor, " gr", "gig", "rg ", 'r', "dustRedstone", 'g', gold, 'i', "ingotIron"); } - int dustCoal = OreDictionary.getOreID("dustCoal"); - ItemStack activatedCapacitor = new ItemStack(EnderIO.itemBasicCapacitor, 1, 1); - ItemStack energeticAlloy = new ItemStack(EnderIO.itemAlloy, 1, Alloy.ENERGETIC_ALLOY.ordinal()); - if(Config.useHardRecipes) { - GameRegistry.addRecipe(new ShapedOreRecipe(activatedCapacitor, "eee", "cCc", "eee", 'e', energeticAlloy, 'c', capacitor, 'C', "dustCoal")); + if (Config.useHardRecipes) { + addShaped(activatedCapacitor, "eee", "cCc", "eee", 'e', energeticAlloy, 'c', capacitor, 'C', "dustCoal"); } else { - GameRegistry.addRecipe(new ShapedOreRecipe(activatedCapacitor, " e ", "cCc", " e ", 'e', energeticAlloy, 'c', capacitor, 'C', "dustCoal")); + addShaped(activatedCapacitor, " e ", "cCc", " e ", 'e', energeticAlloy, 'c', capacitor, 'C', "dustCoal"); } } } \ No newline at end of file diff --git a/src/main/java/crazypants/enderio/thaumcraft/ThaumcraftCompat.java b/src/main/java/crazypants/enderio/thaumcraft/ThaumcraftCompat.java index 8e775fdf..f65bc4a3 100644 --- a/src/main/java/crazypants/enderio/thaumcraft/ThaumcraftCompat.java +++ b/src/main/java/crazypants/enderio/thaumcraft/ThaumcraftCompat.java @@ -36,38 +36,38 @@ public class ThaumcraftCompat { ThaumcraftApi.registerObjectTag("dustCoal", new AspectList().add(getAspects(Items.coal))); ThaumcraftApi.registerObjectTag("itemSilicon", new AspectList().add(Aspect.FIRE, 1).add(Aspect.ORDER, 1).add(Aspect.SENSES, 1)); - ThaumcraftApi.registerObjectTag(Alloy.ELECTRICAL_STEEL.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.ELECTRICAL_STEEL.oreIngot, new AspectList() .add(getAspects("dustCoal")) .add(getAspects(Items.iron_ingot)) .add(getAspects("itemSilicon"))); - ThaumcraftApi.registerObjectTag(Alloy.ENERGETIC_ALLOY.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.ENERGETIC_ALLOY.oreIngot, new AspectList() .add(getAspects(Items.glowstone_dust)) .add(getAspects(Items.redstone)) .add(getAspects(Items.gold_ingot))); - ThaumcraftApi.registerObjectTag(Alloy.PHASED_GOLD.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.PHASED_GOLD.oreIngot, new AspectList() .add(getAspects(Items.ender_pearl)) .add(getAspects("ingotEnergeticAlloy"))); - ThaumcraftApi.registerObjectTag(Alloy.REDSTONE_ALLOY.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.REDSTONE_ALLOY.oreIngot, new AspectList() .add(getAspects(Items.redstone)) .add(getAspects("itemSilicon"))); - ThaumcraftApi.registerObjectTag(Alloy.CONDUCTIVE_IRON.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.CONDUCTIVE_IRON.oreIngot, new AspectList() .add(getAspects(Items.redstone)) .add(getAspects(Items.iron_ingot))); - ThaumcraftApi.registerObjectTag(Alloy.PHASED_IRON.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.PHASED_IRON.oreIngot, new AspectList() .add(getAspects(Items.ender_pearl)) .add(getAspects(Items.iron_ingot))); - ThaumcraftApi.registerObjectTag(Alloy.DARK_STEEL.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.DARK_STEEL.oreIngot, new AspectList() .add(getAspects(Items.iron_ingot)) .add(getAspects("dustCoal")) .add(getAspects(Blocks.obsidian))); - ThaumcraftApi.registerObjectTag(Alloy.SOULARIUM.oredictIngotName, new AspectList() + ThaumcraftApi.registerObjectTag(Alloy.SOULARIUM.oreIngot, new AspectList() .add(getAspects(Blocks.soul_sand)) .add(getAspects(Items.gold_ingot))); @@ -80,19 +80,19 @@ public class ThaumcraftCompat { .add(getAspects(EnderIO.blockEndermanSkull)) .add(getAspects(Items.potionitem)).add(getAspects(Items.potionitem)) .add(getAspects(new ItemStack(EnderIO.itemBasicCapacitor, 1, Capacitors.BASIC_CAPACITOR.ordinal()))) - .add(getAspects(Alloy.SOULARIUM.oredictIngotName)).add(getAspects(Alloy.SOULARIUM.oredictIngotName))); + .add(getAspects(Alloy.SOULARIUM.oreIngot)).add(getAspects(Alloy.SOULARIUM.oreIngot))); ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_ELECTRODE.ordinal()), new AspectList() .add(getAspects(new ItemStack(Items.skull, 1, 2))) .add(getAspects("itemSilicon")).add(getAspects("itemSilicon")) .add(getAspects(new ItemStack(EnderIO.itemBasicCapacitor, 1, Capacitors.BASIC_CAPACITOR.ordinal()))) - .add(getAspects(Alloy.ENERGETIC_ALLOY.oredictIngotName)).add(getAspects(Alloy.ENERGETIC_ALLOY.oredictIngotName))); + .add(getAspects(Alloy.ENERGETIC_ALLOY.oreIngot)).add(getAspects(Alloy.ENERGETIC_ALLOY.oreIngot))); ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ZOMBIE_CONTROLLER.ordinal()), new AspectList() .add(getAspects(new ItemStack(Items.skull, 1, 2))) .add(getAspects("itemSilicon")).add(getAspects("itemSilicon")) .add(getAspects(new ItemStack(EnderIO.itemBasicCapacitor, 1, Capacitors.BASIC_CAPACITOR.ordinal()))) - .add(getAspects(Alloy.SOULARIUM.oredictIngotName)).add(getAspects(Alloy.SOULARIUM.oredictIngotName))); + .add(getAspects(Alloy.SOULARIUM.oreIngot)).add(getAspects(Alloy.SOULARIUM.oreIngot))); ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.FRANKEN_ZOMBIE.ordinal()), new AspectList() .add(Aspect.UNDEAD, 2) @@ -103,8 +103,8 @@ public class ThaumcraftCompat { ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemFrankenSkull, 1, FrankenSkull.ENDER_RESONATOR.ordinal()), new AspectList() .add(getAspects(EnderIO.blockEndermanSkull)) .add(getAspects("itemSilicon")).add(getAspects("itemSilicon")) - .add(getAspects(Alloy.PHASED_GOLD.oredictIngotName)) - .add(getAspects(Alloy.SOULARIUM.oredictIngotName)).add(getAspects(Alloy.SOULARIUM.oredictIngotName))); + .add(getAspects(Alloy.PHASED_GOLD.oreIngot)) + .add(getAspects(Alloy.SOULARIUM.oreIngot)).add(getAspects(Alloy.SOULARIUM.oreIngot))); ThaumcraftApi.registerObjectTag(new ItemStack(EnderIO.itemMaterial, 1, Material.ENDER_CRYSTAL.ordinal()), new AspectList() .add(Aspect.AIR, 2) diff --git a/src/main/java/crazypants/util/RecipeUtil.java b/src/main/java/crazypants/util/RecipeUtil.java new file mode 100644 index 00000000..ebece446 --- /dev/null +++ b/src/main/java/crazypants/util/RecipeUtil.java @@ -0,0 +1,35 @@ +package crazypants.util; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; +import cpw.mods.fml.common.registry.GameRegistry; + +public class RecipeUtil { + + public static void addShaped(Item res, Object... recipe) { + addShaped(new ItemStack(res), recipe); + } + + public static void addShaped(Block res, Object... recipe) { + addShaped(new ItemStack(res), recipe); + } + + public static void addShaped(ItemStack res, Object... recipe) { + GameRegistry.addRecipe(new ShapedOreRecipe(res, recipe)); + } + + public static void addShapeless(Item res, Object... recipe) { + addShaped(new ItemStack(res), recipe); + } + + public static void addShapeless(Block res, Object... recipe) { + addShaped(new ItemStack(res), recipe); + } + + public static void addShapeless(ItemStack res, Object... recipe) { + GameRegistry.addRecipe(new ShapelessOreRecipe(res, recipe)); + } +}