From cccca8a6ae8236aab46ba64be042f4ca9db266a9 Mon Sep 17 00:00:00 2001 From: marcus8448 <28928887+marcus8448@users.noreply.github.com> Date: Sun, 1 Mar 2020 22:40:34 -0800 Subject: [PATCH] Use "chestWood" Ore Dictionary values rather than hardcoding the item. Closes #3891 **BREAKING CHANGE** --- .../api/recipe/INasaWorkbenchRecipe.java | 3 +- .../client/jei/buggy/BuggyRecipeMaker.java | 5 +- .../tier1rocket/Tier1RocketRecipeMaker.java | 5 +- .../core/inventory/SlotBuggyBench.java | 2 +- .../core/inventory/SlotRocketBench.java | 2 +- .../core/recipe/NasaWorkbenchRecipe.java | 22 +-- .../core/recipe/RecipeManagerGC.java | 186 ++++++++---------- .../core/tile/TileEntityDeconstructor.java | 10 +- .../galacticraft/core/util/RecipeUtil.java | 5 +- .../inventory/SlotSchematicAstroMiner.java | 2 +- .../inventory/SlotSchematicTier3Rocket.java | 2 +- .../recipe/RecipeManagerAsteroids.java | 129 ++++++------ .../inventory/SlotSchematicCargoRocket.java | 2 +- .../inventory/SlotSchematicTier2Rocket.java | 2 +- .../mars/recipe/RecipeManagerMars.java | 183 +++++++++-------- .../planets/mars/util/MarsUtil.java | 5 +- 16 files changed, 271 insertions(+), 294 deletions(-) diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/recipe/INasaWorkbenchRecipe.java b/src/main/java/micdoodle8/mods/galacticraft/api/recipe/INasaWorkbenchRecipe.java index 873ea71178..f455133cf3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/recipe/INasaWorkbenchRecipe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/recipe/INasaWorkbenchRecipe.java @@ -2,6 +2,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; import javax.annotation.Nonnull; import java.util.HashMap; @@ -15,5 +16,5 @@ public interface INasaWorkbenchRecipe @Nonnull ItemStack getRecipeOutput(); - HashMap getRecipeInput(); + HashMap getRecipeInput(); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/jei/buggy/BuggyRecipeMaker.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/jei/buggy/BuggyRecipeMaker.java index 6feea40de5..3ce5d83f26 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/jei/buggy/BuggyRecipeMaker.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/jei/buggy/BuggyRecipeMaker.java @@ -4,6 +4,7 @@ import micdoodle8.mods.galacticraft.api.recipe.INasaWorkbenchRecipe; import micdoodle8.mods.galacticraft.core.GCItems; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; import java.util.ArrayList; import java.util.List; @@ -32,9 +33,9 @@ public static int countStorage(INasaWorkbenchRecipe recipe) { int count = 0; ItemStack storage = new ItemStack(GCItems.partBuggy, 1, 2); - for (Entry e : recipe.getRecipeInput().entrySet()) + for (Entry e : recipe.getRecipeInput().entrySet()) { - if (ItemStack.areItemsEqual(storage, e.getValue())) + if (e.getValue().apply(storage)) count++; } return count; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/jei/tier1rocket/Tier1RocketRecipeMaker.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/jei/tier1rocket/Tier1RocketRecipeMaker.java index d36352df33..822e540675 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/jei/tier1rocket/Tier1RocketRecipeMaker.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/jei/tier1rocket/Tier1RocketRecipeMaker.java @@ -4,6 +4,7 @@ import micdoodle8.mods.galacticraft.api.recipe.INasaWorkbenchRecipe; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; import java.util.ArrayList; import java.util.List; @@ -32,9 +33,9 @@ public static int countChests(INasaWorkbenchRecipe recipe) { int count = 0; ItemStack chest = new ItemStack(Blocks.CHEST); - for (Entry e : recipe.getRecipeInput().entrySet()) + for (Entry e : recipe.getRecipeInput().entrySet()) { - if (ItemStack.areItemsEqual(chest, e.getValue())) + if (e.getValue().apply(chest)) count++; } return count; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotBuggyBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotBuggyBench.java index 1eccd39f1d..92667122f3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotBuggyBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotBuggyBench.java @@ -47,7 +47,7 @@ public boolean isItemValid(ItemStack par1ItemStack) List recipes = GalacticraftRegistry.getBuggyBenchRecipes(); for (INasaWorkbenchRecipe recipe : recipes) { - if (ItemStack.areItemsEqual(par1ItemStack, recipe.getRecipeInput().get(this.index))) + if (recipe.getRecipeInput().get(this.index).apply(par1ItemStack)) return true; } return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotRocketBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotRocketBench.java index f1db1920b4..7235917412 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotRocketBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotRocketBench.java @@ -47,7 +47,7 @@ public boolean isItemValid(ItemStack par1ItemStack) List recipes = GalacticraftRegistry.getRocketT1Recipes(); for (INasaWorkbenchRecipe recipe : recipes) { - if (ItemStack.areItemsEqual(par1ItemStack, recipe.getRecipeInput().get(this.index))) + if (recipe.getRecipeInput().get(this.index).apply(par1ItemStack)) return true; } return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/recipe/NasaWorkbenchRecipe.java b/src/main/java/micdoodle8/mods/galacticraft/core/recipe/NasaWorkbenchRecipe.java index 7a964edda7..d292644128 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/recipe/NasaWorkbenchRecipe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/recipe/NasaWorkbenchRecipe.java @@ -3,6 +3,7 @@ import micdoodle8.mods.galacticraft.api.recipe.INasaWorkbenchRecipe; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; import net.minecraftforge.oredict.OreDictionary; import java.util.HashMap; @@ -11,14 +12,14 @@ public class NasaWorkbenchRecipe implements INasaWorkbenchRecipe { private ItemStack output; - private HashMap input; + private HashMap input; - public NasaWorkbenchRecipe(ItemStack output, HashMap input) + public NasaWorkbenchRecipe(ItemStack output, HashMap input) { this.output = output; this.input = input; - for (Entry entry : this.input.entrySet()) + for (Entry entry : this.input.entrySet()) { if (entry.getValue() == null) { @@ -30,11 +31,11 @@ public NasaWorkbenchRecipe(ItemStack output, HashMap input) @Override public boolean matches(IInventory inventory) { - for (Entry entry : this.input.entrySet()) + for (Entry entry : this.input.entrySet()) { ItemStack stackAt = inventory.getStackInSlot(entry.getKey()); - if (!this.checkItemEquals(stackAt, entry.getValue())) + if (!entry.getValue().apply(stackAt)) { return false; } @@ -43,15 +44,6 @@ public boolean matches(IInventory inventory) return true; } - private boolean checkItemEquals(ItemStack target, ItemStack input) - { - if (input.isEmpty() && !target.isEmpty() || !input.isEmpty() && target.isEmpty()) - { - return false; - } - return target.isEmpty() && input.isEmpty() || target.getItem() == input.getItem() && (target.getItemDamage() == OreDictionary.WILDCARD_VALUE || target.getItemDamage() == input.getItemDamage()); - } - @Override public int getRecipeSize() { @@ -65,7 +57,7 @@ public ItemStack getRecipeOutput() } @Override - public HashMap getRecipeInput() + public HashMap getRecipeInput() { return this.input; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java index 8503e8c057..5ba439b27d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java @@ -32,17 +32,14 @@ import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.Ingredient; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.RecipeSorter; import net.minecraftforge.oredict.RecipeSorter.Category; import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Optional; +import java.util.*; import appeng.api.AEApi; import appeng.api.features.IGrinderRegistry; @@ -106,132 +103,121 @@ public static void addUniversalRecipes() FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(GCItems.foodItem, 1, 6), new ItemStack(GCItems.foodItem, 1, 7), 1.0F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(GCBlocks.blockMoon, 1, 6), new ItemStack(GCItems.itemBasicMoon, 1, 2), 1.0F); - HashMap input = new HashMap<>(); - input.put(1, new ItemStack(GCItems.partNoseCone)); - input.put(2, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(3, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(4, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(5, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(6, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(7, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(8, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(9, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(10, new ItemStack(GCItems.partFins)); - input.put(11, new ItemStack(GCItems.partFins)); - input.put(12, new ItemStack(GCItems.rocketEngine)); - input.put(13, new ItemStack(GCItems.partFins)); - input.put(14, new ItemStack(GCItems.partFins)); - input.put(15, ItemStack.EMPTY); - input.put(16, ItemStack.EMPTY); - input.put(17, ItemStack.EMPTY); + HashMap input = new HashMap<>(); + input.put(1, Ingredient.fromStacks(new ItemStack(GCItems.partNoseCone))); + input.put(2, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(3, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(4, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(5, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(6, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(7, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(8, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(9, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(10, Ingredient.fromStacks(new ItemStack(GCItems.partFins))); + input.put(11, Ingredient.fromStacks(new ItemStack(GCItems.partFins))); + input.put(12, Ingredient.fromStacks(new ItemStack(GCItems.rocketEngine))); + input.put(13, Ingredient.fromStacks(new ItemStack(GCItems.partFins))); + input.put(14, Ingredient.fromStacks(new ItemStack(GCItems.partFins))); + input.put(15, Ingredient.fromStacks(ItemStack.EMPTY)); + input.put(16, Ingredient.fromStacks(ItemStack.EMPTY)); + input.put(17, Ingredient.fromStacks(ItemStack.EMPTY)); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 0), input); - HashMap input2 = new HashMap(input); - input2.put(15, new ItemStack(Blocks.CHEST)); - input2.put(16, ItemStack.EMPTY); - input2.put(17, ItemStack.EMPTY); - RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2); + ItemStack[] chests = new ItemStack[OreDictionary.getOres("chestWood").size()]; + for (int i = 0; i < chests.length; i++) { + chests[i] = OreDictionary.getOres("chestWood").get(i); + } + - input2 = new HashMap(input); - input2.put(15, ItemStack.EMPTY); - input2.put(16, new ItemStack(Blocks.CHEST)); - input2.put(17, ItemStack.EMPTY); + HashMap input2 = new HashMap<>(input); + input2.put(15, Ingredient.fromStacks(chests)); + RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2); + + input2 = new HashMap<>(input); + input2.put(16, Ingredient.fromStacks(chests)); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2); - input2 = new HashMap(input); - input2.put(15, ItemStack.EMPTY); - input2.put(16, ItemStack.EMPTY); - input2.put(17, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(17, Ingredient.fromStacks(chests)); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2); - input2 = new HashMap(input); - input2.put(15, new ItemStack(Blocks.CHEST)); - input2.put(16, new ItemStack(Blocks.CHEST)); - input2.put(17, ItemStack.EMPTY); + input2 = new HashMap<>(input); + input2.put(15, Ingredient.fromStacks(chests)); + input2.put(16, Ingredient.fromStacks(chests)); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 2), input2); - input2 = new HashMap(input); - input2.put(15, new ItemStack(Blocks.CHEST)); - input2.put(16, ItemStack.EMPTY); - input2.put(17, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(15, Ingredient.fromStacks(chests)); + input2.put(17, Ingredient.fromStacks(chests)); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 2), input2); - input2 = new HashMap(input); - input2.put(15, ItemStack.EMPTY); - input2.put(16, new ItemStack(Blocks.CHEST)); - input2.put(17, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(16, Ingredient.fromStacks(chests)); + input2.put(17, Ingredient.fromStacks(chests)); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 2), input2); - input2 = new HashMap(input); - input2.put(15, new ItemStack(Blocks.CHEST)); - input2.put(16, new ItemStack(Blocks.CHEST)); - input2.put(17, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(15, Ingredient.fromStacks(chests)); + input2.put(16, Ingredient.fromStacks(chests)); + input2.put(17, Ingredient.fromStacks(chests)); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 3), input2); // - input = new HashMap(); - input.put(1, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(2, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(3, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(4, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(5, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(6, new ItemStack(GCItems.partBuggy, 1, 1)); - input.put(7, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(8, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(9, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(10, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(11, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(12, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(13, new ItemStack(GCItems.partBuggy)); - input.put(14, new ItemStack(GCItems.partBuggy)); - input.put(15, new ItemStack(GCItems.partBuggy)); - input.put(16, new ItemStack(GCItems.partBuggy)); - input.put(17, ItemStack.EMPTY); - input.put(18, ItemStack.EMPTY); - input.put(19, ItemStack.EMPTY); + input = new HashMap<>(); + input.put(1, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(2, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(3, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(4, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(5, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(6, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 1))); + input.put(7, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(8, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(9, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(10, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(11, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(12, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(13, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy))); + input.put(14, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy))); + input.put(15, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy))); + input.put(16, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy))); + input.put(17, Ingredient.fromStacks(ItemStack.EMPTY)); + input.put(18, Ingredient.fromStacks(ItemStack.EMPTY)); + input.put(19, Ingredient.fromStacks(ItemStack.EMPTY)); RecipeUtil.addBuggyBenchRecipe(new ItemStack(GCItems.buggy, 1, 0), input); - input2 = new HashMap(input); - input2.put(17, new ItemStack(GCItems.partBuggy, 1, 2)); - input2.put(18, ItemStack.EMPTY); - input2.put(19, ItemStack.EMPTY); + input2 = new HashMap<>(input); + input2.put(17, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 2))); + RecipeUtil.addBuggyBenchRecipe(new ItemStack(GCItems.buggy, 1, 1), input2); - input2 = new HashMap(input); - input2.put(17, ItemStack.EMPTY); - input2.put(18, new ItemStack(GCItems.partBuggy, 1, 2)); - input2.put(19, ItemStack.EMPTY); + input2 = new HashMap<>(input); + input2.put(18, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 2))); RecipeUtil.addBuggyBenchRecipe(new ItemStack(GCItems.buggy, 1, 1), input2); - input2 = new HashMap(input); - input2.put(17, ItemStack.EMPTY); - input2.put(18, ItemStack.EMPTY); - input2.put(19, new ItemStack(GCItems.partBuggy, 1, 2)); + input2 = new HashMap<>(input); + input2.put(19, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 2))); RecipeUtil.addBuggyBenchRecipe(new ItemStack(GCItems.buggy, 1, 1), input2); - input2 = new HashMap(input); - input2.put(17, new ItemStack(GCItems.partBuggy, 1, 2)); - input2.put(18, new ItemStack(GCItems.partBuggy, 1, 2)); - input2.put(19, ItemStack.EMPTY); + input2 = new HashMap<>(input); + input2.put(17, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 2))); + input2.put(18, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 2))); RecipeUtil.addBuggyBenchRecipe(new ItemStack(GCItems.buggy, 1, 2), input2); - input2 = new HashMap(input); - input2.put(17, new ItemStack(GCItems.partBuggy, 1, 2)); - input2.put(18, ItemStack.EMPTY); - input2.put(19, new ItemStack(GCItems.partBuggy, 1, 2)); + input2 = new HashMap<>(input); + input2.put(17, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 2))); + input2.put(19, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 2))); RecipeUtil.addBuggyBenchRecipe(new ItemStack(GCItems.buggy, 1, 2), input2); - input2 = new HashMap(input); - input2.put(17, ItemStack.EMPTY); - input2.put(18, new ItemStack(GCItems.partBuggy, 1, 2)); - input2.put(19, new ItemStack(GCItems.partBuggy, 1, 2)); + input2 = new HashMap<>(input); + input2.put(18, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 2))); + input2.put(19, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 2))); RecipeUtil.addBuggyBenchRecipe(new ItemStack(GCItems.buggy, 1, 2), input2); - input2 = new HashMap(input); - input2.put(17, new ItemStack(GCItems.partBuggy, 1, 2)); - input2.put(18, new ItemStack(GCItems.partBuggy, 1, 2)); - input2.put(19, new ItemStack(GCItems.partBuggy, 1, 2)); + input2 = new HashMap<>(input); + input2.put(17, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 2))); + input2.put(18, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 2))); + input2.put(19, Ingredient.fromStacks(new ItemStack(GCItems.partBuggy, 1, 2))); RecipeUtil.addBuggyBenchRecipe(new ItemStack(GCItems.buggy, 1, 3), input2); aluminumIngots.addAll(OreDictionary.getOres("ingotAluminum")); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDeconstructor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDeconstructor.java index 541ee55928..486ab33bd3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDeconstructor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDeconstructor.java @@ -300,7 +300,7 @@ private List getIngredients(ItemStack stack) { for (INasaWorkbenchRecipe recipe : knownRecipes) { - ItemStack test = (ItemStack) recipe.getRecipeOutput(); + ItemStack test = recipe.getRecipeOutput(); if (ItemStack.areItemsEqual(test, stack) && test.getCount() == 1) { return toItemStackList(recipe.getRecipeInput().values()); @@ -402,14 +402,14 @@ else if (input instanceof Iterable) return null; } - private List toItemStackList(Collection inputs) + private List toItemStackList(Collection inputs) { List ret = new LinkedList<>(); - for (ItemStack o : inputs) + for (Ingredient o : inputs) { - if (o != null && !o.isEmpty()) + if (o != null && o.getMatchingStacks().length >= 1 && !o.getMatchingStacks()[0].isEmpty()) { - ret.add(o.copy()); + ret.add(o.getMatchingStacks()[0].copy()); } } return ret; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/RecipeUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/RecipeUtil.java index e4b3a53f38..4f336011b2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/RecipeUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/RecipeUtil.java @@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; @@ -73,12 +74,12 @@ public static void addCustomRecipe(IRecipe rec) GameData.register_impl(rec); } - public static void addRocketBenchRecipe(ItemStack result, HashMap input) + public static void addRocketBenchRecipe(ItemStack result, HashMap input) { GalacticraftRegistry.addT1RocketRecipe(new NasaWorkbenchRecipe(result, input)); } - public static void addBuggyBenchRecipe(ItemStack result, HashMap input) + public static void addBuggyBenchRecipe(ItemStack result, HashMap input) { GalacticraftRegistry.addMoonBuggyRecipe(new NasaWorkbenchRecipe(result, input)); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java index 114bc6dad6..3213d8a3d9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java @@ -47,7 +47,7 @@ public boolean isItemValid(ItemStack par1ItemStack) List recipes = GalacticraftRegistry.getAstroMinerRecipes(); for (INasaWorkbenchRecipe recipe : recipes) { - if (ItemStack.areItemsEqual(par1ItemStack, recipe.getRecipeInput().get(this.index))) + if (recipe.getRecipeInput().get(this.index).apply(par1ItemStack)) return true; } return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicTier3Rocket.java index c54927f40f..f6208712e1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicTier3Rocket.java @@ -47,7 +47,7 @@ public boolean isItemValid(ItemStack par1ItemStack) List recipes = GalacticraftRegistry.getRocketT3Recipes(); for (INasaWorkbenchRecipe recipe : recipes) { - if (ItemStack.areItemsEqual(par1ItemStack, recipe.getRecipeInput().get(this.index))) + if (recipe.getRecipeInput().get(this.index).apply(par1ItemStack)) return true; } return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/recipe/RecipeManagerAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/recipe/RecipeManagerAsteroids.java index b9ce9e000b..874e2f714c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/recipe/RecipeManagerAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/recipe/RecipeManagerAsteroids.java @@ -15,6 +15,7 @@ import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.NonNullList; +import net.minecraftforge.oredict.OreDictionary; import java.util.HashMap; @@ -47,90 +48,86 @@ public static void addUniversalRecipes() CompressorRecipes.addShapelessRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 6), titaniumIngot, titaniumIngot); CompressorRecipes.addShapelessRecipe(platingTier3, new ItemStack(MarsItems.marsItemBasic, 1, 3), new ItemStack(MarsItems.marsItemBasic, 1, 5)); - - HashMap input = new HashMap<>(); + + ItemStack[] chests = new ItemStack[OreDictionary.getOres("chestWood").size()]; + for (int i = 0; i < chests.length; i++) { + chests[i] = OreDictionary.getOres("chestWood").get(i); + } + + HashMap input = new HashMap<>(); ItemStack plateTier3 = new ItemStack(AsteroidsItems.basicItem, 1, 5); ItemStack rocketFinsTier2 = new ItemStack(AsteroidsItems.basicItem, 1, 2); - input.put(1, new ItemStack(AsteroidsItems.heavyNoseCone)); - input.put(2, plateTier3); - input.put(3, plateTier3); - input.put(4, plateTier3); - input.put(5, plateTier3); - input.put(6, plateTier3); - input.put(7, plateTier3); - input.put(8, plateTier3); - input.put(9, plateTier3); - input.put(10, plateTier3); - input.put(11, plateTier3); - input.put(12, new ItemStack(GCItems.rocketEngine, 1, 1)); - input.put(13, rocketFinsTier2); - input.put(14, rocketFinsTier2); - input.put(15, new ItemStack(AsteroidsItems.basicItem, 1, 1)); - input.put(16, new ItemStack(GCItems.rocketEngine, 1, 1)); - input.put(17, rocketFinsTier2); - input.put(18, rocketFinsTier2); - input.put(19, ItemStack.EMPTY); - input.put(20, ItemStack.EMPTY); - input.put(21, ItemStack.EMPTY); + input.put(1, Ingredient.fromStacks(new ItemStack(AsteroidsItems.heavyNoseCone))); + input.put(2, Ingredient.fromStacks(plateTier3)); + input.put(3, Ingredient.fromStacks(plateTier3)); + input.put(4, Ingredient.fromStacks(plateTier3)); + input.put(5, Ingredient.fromStacks(plateTier3)); + input.put(6, Ingredient.fromStacks(plateTier3)); + input.put(7, Ingredient.fromStacks(plateTier3)); + input.put(8, Ingredient.fromStacks(plateTier3)); + input.put(9, Ingredient.fromStacks(plateTier3)); + input.put(10, Ingredient.fromStacks(plateTier3)); + input.put(11, Ingredient.fromStacks(plateTier3)); + input.put(12, Ingredient.fromStacks(new ItemStack(GCItems.rocketEngine, 1, 1))); + input.put(13, Ingredient.fromStacks(rocketFinsTier2)); + input.put(14, Ingredient.fromStacks(rocketFinsTier2)); + input.put(15, Ingredient.fromStacks(new ItemStack(AsteroidsItems.basicItem, 1, 1))); + input.put(16, Ingredient.fromStacks(new ItemStack(GCItems.rocketEngine, 1, 1))); + input.put(17, Ingredient.fromStacks(rocketFinsTier2)); + input.put(18, Ingredient.fromStacks(rocketFinsTier2)); + input.put(19, Ingredient.fromStacks(ItemStack.EMPTY)); + input.put(20, Ingredient.fromStacks(ItemStack.EMPTY)); + input.put(21, Ingredient.fromStacks(ItemStack.EMPTY)); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 0), input)); - HashMap input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.CHEST)); - input2.put(20, ItemStack.EMPTY); - input2.put(21, ItemStack.EMPTY); + HashMap input2 = new HashMap<>(input); + input2.put(19, Ingredient.fromStacks(chests)); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), input2)); - input2 = new HashMap(input); - input2.put(19, ItemStack.EMPTY); - input2.put(20, new ItemStack(Blocks.CHEST)); - input2.put(21, ItemStack.EMPTY); + input2 = new HashMap<>(input); + input2.put(20, Ingredient.fromStacks(chests)); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), input2)); - input2 = new HashMap(input); - input2.put(19, ItemStack.EMPTY); - input2.put(20, ItemStack.EMPTY); - input2.put(21, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(21, Ingredient.fromStacks(chests)); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), input2)); - input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.CHEST)); - input2.put(20, new ItemStack(Blocks.CHEST)); - input2.put(21, ItemStack.EMPTY); + input2 = new HashMap<>(input); + input2.put(19, Ingredient.fromStacks(chests)); + input2.put(20, Ingredient.fromStacks(chests)); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), input2)); - input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.CHEST)); - input2.put(20, ItemStack.EMPTY); - input2.put(21, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(19, Ingredient.fromStacks(chests)); + input2.put(21, Ingredient.fromStacks(chests)); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), input2)); - input2 = new HashMap(input); - input2.put(19, ItemStack.EMPTY); - input2.put(20, new ItemStack(Blocks.CHEST)); - input2.put(21, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(20, Ingredient.fromStacks(chests)); + input2.put(21, Ingredient.fromStacks(chests)); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), input2)); - input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.CHEST)); - input2.put(20, new ItemStack(Blocks.CHEST)); - input2.put(21, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(19, Ingredient.fromStacks(chests)); + input2.put(20, Ingredient.fromStacks(chests)); + input2.put(21, Ingredient.fromStacks(chests)); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 3), input2)); - input = new HashMap(); - input.put(1, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(3, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(5, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(11, new ItemStack(GCItems.heavyPlatingTier1)); - input.put(2, new ItemStack(AsteroidsItems.orionDrive)); - input.put(4, new ItemStack(AsteroidsItems.orionDrive)); - input.put(9, new ItemStack(AsteroidsItems.orionDrive)); - input.put(10, new ItemStack(AsteroidsItems.orionDrive)); - input.put(12, new ItemStack(AsteroidsItems.orionDrive)); - input.put(6, new ItemStack(GCItems.basicItem, 1, 14)); - input.put(7, new ItemStack(Blocks.CHEST)); - input.put(8, new ItemStack(Blocks.CHEST)); - input.put(13, new ItemStack(AsteroidsItems.basicItem, 1, 8)); - input.put(14, new ItemStack(GCItems.flagPole)); + input = new HashMap<>(); + input.put(1, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(2, Ingredient.fromStacks(new ItemStack(AsteroidsItems.orionDrive))); + input.put(3, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(4, Ingredient.fromStacks(new ItemStack(AsteroidsItems.orionDrive))); + input.put(5, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(6, Ingredient.fromStacks(new ItemStack(GCItems.basicItem, 1, 14))); + input.put(7, Ingredient.fromStacks(chests)); + input.put(8, Ingredient.fromStacks(chests)); + input.put(9, Ingredient.fromStacks(new ItemStack(AsteroidsItems.orionDrive))); + input.put(10, Ingredient.fromStacks(new ItemStack(AsteroidsItems.orionDrive))); + input.put(11, Ingredient.fromStacks(new ItemStack(GCItems.heavyPlatingTier1))); + input.put(12, Ingredient.fromStacks(new ItemStack(AsteroidsItems.orionDrive))); + input.put(13, Ingredient.fromStacks(new ItemStack(AsteroidsItems.basicItem, 1, 8))); + input.put(14,Ingredient.fromStacks( new ItemStack(GCItems.flagPole))); GalacticraftRegistry.addAstroMinerRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.astroMiner, 1, 0), input)); //All this is for NEI's benefit diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicCargoRocket.java index 3397191087..b04485c043 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicCargoRocket.java @@ -47,7 +47,7 @@ public boolean isItemValid(ItemStack par1ItemStack) List recipes = GalacticraftRegistry.getCargoRocketRecipes(); for (INasaWorkbenchRecipe recipe : recipes) { - if (ItemStack.areItemsEqual(par1ItemStack, recipe.getRecipeInput().get(this.index))) + if (recipe.getRecipeInput().get(this.index).apply(par1ItemStack)) return true; } return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicTier2Rocket.java index 57120d9a3c..185adeff85 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicTier2Rocket.java @@ -47,7 +47,7 @@ public boolean isItemValid(ItemStack par1ItemStack) List recipes = GalacticraftRegistry.getRocketT2Recipes(); for (INasaWorkbenchRecipe recipe : recipes) { - if (ItemStack.areItemsEqual(par1ItemStack, recipe.getRecipeInput().get(this.index))) + if (recipe.getRecipeInput().get(this.index).apply(par1ItemStack)) return true; } return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/recipe/RecipeManagerMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/recipe/RecipeManagerMars.java index 3323f45794..b99ef9e0a4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/recipe/RecipeManagerMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/recipe/RecipeManagerMars.java @@ -9,6 +9,7 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.item.crafting.Ingredient; import net.minecraftforge.oredict.OreDictionary; import java.util.HashMap; @@ -36,130 +37,126 @@ public static void addUniversalRecipes() FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MarsBlocks.marsBlock, 1, 3), new ItemStack(Items.IRON_INGOT), 0.2F); FurnaceRecipes.instance().addSmeltingRecipeForBlock(Blocks.PLANKS, new ItemStack(MarsItems.carbonFragments), 0.0F); + ItemStack[] chests = new ItemStack[OreDictionary.getOres("chestWood").size()]; + for (int i = 0; i < chests.length; i++) { + chests[i] = OreDictionary.getOres("chestWood").get(i); + } + // Schematic - HashMap input = new HashMap(); - input.put(1, new ItemStack(GCItems.partNoseCone)); - input.put(2, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(3, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(4, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(5, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(6, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(7, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(8, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(9, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(10, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(11, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(12, new ItemStack(GCItems.rocketEngine, 1, 1)); - input.put(13, new ItemStack(GCItems.partFins)); - input.put(14, new ItemStack(GCItems.partFins)); - input.put(15, new ItemStack(GCItems.rocketEngine)); - input.put(16, new ItemStack(GCItems.rocketEngine, 1, 1)); - input.put(17, new ItemStack(GCItems.partFins)); - input.put(18, new ItemStack(GCItems.partFins)); - input.put(19, ItemStack.EMPTY); - input.put(20, ItemStack.EMPTY); - input.put(21, ItemStack.EMPTY); + HashMap input = new HashMap<>(); + input.put(1, Ingredient.fromStacks(new ItemStack(GCItems.partNoseCone))); + input.put(2, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(3, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(4, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(5, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(6, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(7, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(8, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(9, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(10, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(11, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(12, Ingredient.fromStacks(new ItemStack(GCItems.rocketEngine, 1, 1))); + input.put(13, Ingredient.fromStacks(new ItemStack(GCItems.partFins))); + input.put(14, Ingredient.fromStacks(new ItemStack(GCItems.partFins))); + input.put(15, Ingredient.fromStacks(new ItemStack(GCItems.rocketEngine))); + input.put(16, Ingredient.fromStacks(new ItemStack(GCItems.rocketEngine, 1, 1))); + input.put(17, Ingredient.fromStacks(new ItemStack(GCItems.partFins))); + input.put(18, Ingredient.fromStacks(new ItemStack(GCItems.partFins))); + input.put(19, Ingredient.fromStacks(ItemStack.EMPTY)); + input.put(20, Ingredient.fromStacks(ItemStack.EMPTY)); + input.put(21, Ingredient.fromStacks(ItemStack.EMPTY)); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 0), input); - HashMap input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.CHEST)); - input2.put(20, ItemStack.EMPTY); - input2.put(21, ItemStack.EMPTY); + HashMap input2 = new HashMap<>(input); + input2.put(19, Ingredient.fromStacks(chests)); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 1), input2); - input2 = new HashMap(input); - input2.put(19, ItemStack.EMPTY); - input2.put(20, new ItemStack(Blocks.CHEST)); - input2.put(21, ItemStack.EMPTY); + input2 = new HashMap<>(input); + input2.put(20, Ingredient.fromStacks(chests)); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 1), input2); - input2 = new HashMap(input); - input2.put(19, ItemStack.EMPTY); - input2.put(20, ItemStack.EMPTY); - input2.put(21, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(21, Ingredient.fromStacks(chests)); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 1), input2); - input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.CHEST)); - input2.put(20, new ItemStack(Blocks.CHEST)); - input2.put(21, ItemStack.EMPTY); + input2 = new HashMap<>(input); + input2.put(19, Ingredient.fromStacks(chests)); + input2.put(20, Ingredient.fromStacks(chests)); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 2), input2); - input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.CHEST)); - input2.put(20, ItemStack.EMPTY); - input2.put(21, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(19, Ingredient.fromStacks(chests)); + input2.put(21, Ingredient.fromStacks(chests)); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 2), input2); - input2 = new HashMap(input); - input2.put(19, ItemStack.EMPTY); - input2.put(20, new ItemStack(Blocks.CHEST)); - input2.put(21, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(20, Ingredient.fromStacks(chests)); + input2.put(21, Ingredient.fromStacks(chests)); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 2), input2); - input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.CHEST)); - input2.put(20, new ItemStack(Blocks.CHEST)); - input2.put(21, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(19, Ingredient.fromStacks(chests)); + input2.put(20, Ingredient.fromStacks(chests)); + input2.put(21, Ingredient.fromStacks(chests)); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 3), input2); // - input = new HashMap(); - input.put(1, new ItemStack(GCItems.partNoseCone)); - input.put(2, new ItemStack(GCItems.basicItem, 1, 14)); - input.put(3, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(4, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(5, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(6, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(7, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(8, new ItemStack(MarsItems.marsItemBasic, 1, 3)); - input.put(9, new ItemStack(GCItems.partFins)); - input.put(10, new ItemStack(GCItems.partFins)); - input.put(11, new ItemStack(GCItems.rocketEngine)); - input.put(12, new ItemStack(GCItems.partFins)); - input.put(13, new ItemStack(GCItems.partFins)); - - input2 = new HashMap(input); - input2.put(14, new ItemStack(Blocks.CHEST)); - input2.put(15, ItemStack.EMPTY); - input2.put(16, ItemStack.EMPTY); + input = new HashMap<>(); + input.put(1, Ingredient.fromStacks(new ItemStack(GCItems.partNoseCone))); + input.put(2, Ingredient.fromStacks(new ItemStack(GCItems.basicItem, 1, 14))); + input.put(3, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(4, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(5, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(6, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(7, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(8, Ingredient.fromStacks(new ItemStack(MarsItems.marsItemBasic, 1, 3))); + input.put(9, Ingredient.fromStacks(new ItemStack(GCItems.partFins))); + input.put(10, Ingredient.fromStacks(new ItemStack(GCItems.partFins))); + input.put(11, Ingredient.fromStacks(new ItemStack(GCItems.rocketEngine))); + input.put(12, Ingredient.fromStacks(new ItemStack(GCItems.partFins))); + input.put(13, Ingredient.fromStacks(new ItemStack(GCItems.partFins))); + + input2 = new HashMap<>(input); + input2.put(14, Ingredient.fromStacks(chests)); + input2.put(15, Ingredient.fromStacks(ItemStack.EMPTY)); + input2.put(16, Ingredient.fromStacks(ItemStack.EMPTY)); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 11), input2); - input2 = new HashMap(input); - input2.put(14, ItemStack.EMPTY); - input2.put(15, new ItemStack(Blocks.CHEST)); - input2.put(16, ItemStack.EMPTY); + input2 = new HashMap<>(input); + input2.put(14, Ingredient.fromStacks(ItemStack.EMPTY)); + input2.put(15, Ingredient.fromStacks(chests)); + input2.put(16, Ingredient.fromStacks(ItemStack.EMPTY)); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 11), input2); - input2 = new HashMap(input); - input2.put(14, ItemStack.EMPTY); - input2.put(15, ItemStack.EMPTY); - input2.put(16, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(14, Ingredient.fromStacks(ItemStack.EMPTY)); + input2.put(15, Ingredient.fromStacks(ItemStack.EMPTY)); + input2.put(16, Ingredient.fromStacks(chests)); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 11), input2); - input2 = new HashMap(input); - input2.put(14, new ItemStack(Blocks.CHEST)); - input2.put(15, new ItemStack(Blocks.CHEST)); - input2.put(16, ItemStack.EMPTY); + input2 = new HashMap<>(input); + input2.put(14, Ingredient.fromStacks(chests)); + input2.put(15, Ingredient.fromStacks(chests)); + input2.put(16, Ingredient.fromStacks(ItemStack.EMPTY)); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 12), input2); - input2 = new HashMap(input); - input2.put(14, new ItemStack(Blocks.CHEST)); - input2.put(15, ItemStack.EMPTY); - input2.put(16, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(14, Ingredient.fromStacks(chests)); + input2.put(15, Ingredient.fromStacks(ItemStack.EMPTY)); + input2.put(16, Ingredient.fromStacks(chests)); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 12), input2); - input2 = new HashMap(input); - input2.put(14, ItemStack.EMPTY); - input2.put(15, new ItemStack(Blocks.CHEST)); - input2.put(16, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(14, Ingredient.fromStacks(ItemStack.EMPTY)); + input2.put(15, Ingredient.fromStacks(chests)); + input2.put(16, Ingredient.fromStacks(chests)); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 12), input2); - input2 = new HashMap(input); - input2.put(14, new ItemStack(Blocks.CHEST)); - input2.put(15, new ItemStack(Blocks.CHEST)); - input2.put(16, new ItemStack(Blocks.CHEST)); + input2 = new HashMap<>(input); + input2.put(14, Ingredient.fromStacks(chests)); + input2.put(15, Ingredient.fromStacks(chests)); + input2.put(16, Ingredient.fromStacks(chests)); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 13), input2); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/util/MarsUtil.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/util/MarsUtil.java index 186871567b..be401585f5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/util/MarsUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/util/MarsUtil.java @@ -18,17 +18,18 @@ import micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityLaunchController; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; import java.util.HashMap; public class MarsUtil { - public static void addRocketBenchT2Recipe(ItemStack result, HashMap input) + public static void addRocketBenchT2Recipe(ItemStack result, HashMap input) { GalacticraftRegistry.addT2RocketRecipe(new NasaWorkbenchRecipe(result, input)); } - public static void adCargoRocketRecipe(ItemStack result, HashMap input) + public static void adCargoRocketRecipe(ItemStack result, HashMap input) { GalacticraftRegistry.addCargoRocketRecipe(new NasaWorkbenchRecipe(result, input)); }