diff --git a/src/dark/api/ProcessorRecipes.java b/src/dark/api/ProcessorRecipes.java index 06712fd5..8c3ae3f9 100644 --- a/src/dark/api/ProcessorRecipes.java +++ b/src/dark/api/ProcessorRecipes.java @@ -1,12 +1,13 @@ package dark.api; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import dark.core.prefab.helpers.AutoCraftingManager; import dark.core.prefab.helpers.Pair; @@ -26,6 +27,7 @@ public class ProcessorRecipes public HashMap, Pair> recipesChance = new HashMap(); public HashMap, Float> recipesChanceSalvage = new HashMap(); public HashMap, ItemStack> damagedOutput = new HashMap(); + public List> canSalvage = new ArrayList(); } @@ -71,7 +73,7 @@ public class ProcessorRecipes if (input != null && output != null) { HashMap, ItemStack> map = type.recipes; - if (map != null && !map.containsKey(new Pair(input.itemID, input.getItemDamage()))) + if (map != null && !map.containsKey(new Pair(input.itemID, input.getItemDamage()))) { map.put(new Pair(input.itemID, input.getItemDamage()), output); } @@ -94,7 +96,7 @@ public class ProcessorRecipes if (input != null && output != null) { HashMap, Pair> map = type.recipesChance; - if (map != null && !map.containsKey(new Pair(input.itemID, input.getItemDamage()))) + if (map != null && !map.containsKey(new Pair(input.itemID, input.getItemDamage()))) { map.put(new Pair(input.itemID, input.getItemDamage()), new Pair(output, chance)); } @@ -112,7 +114,7 @@ public class ProcessorRecipes if (input != null && input != null) { HashMap, Float> map = type.recipesChanceSalvage; - if (map != null && !map.containsKey(new Pair(input.itemID, input.getItemDamage()))) + if (map != null && !map.containsKey(new Pair(input.itemID, input.getItemDamage()))) { map.put(new Pair(input.itemID, input.getItemDamage()), chance); } @@ -132,11 +134,11 @@ public class ProcessorRecipes HashMap, ItemStack> map = type.damagedOutput; if (map != null) { - if (!map.containsKey(new Pair(input.itemID, input.getItemDamage()))) + if (!map.containsKey(new Pair(input.itemID, input.getItemDamage()))) { map.put(new Pair(input.itemID, input.getItemDamage()), output); } - else if (map.get(new Pair(input.itemID, input.getItemDamage())) == null) + else if (map.get(new Pair(input.itemID, input.getItemDamage())) == null) { map.put(new Pair(input.itemID, input.getItemDamage()), output); } @@ -145,6 +147,26 @@ public class ProcessorRecipes } } + /** Marks an itemstack as unsalvagable by all processors */ + public static void markUnsalvagable(ItemStack stack) + { + if (stack != null) + { + for (ProcessorType type : ProcessorType.values()) + { + markUnsalvagable(type, stack); + } + } + } + /** Marks an itemstack as unsalvagable by processors */ + public static void markUnsalvagable(ProcessorType type, ItemStack stack) + { + if (type != null && stack != null) + { + type.canSalvage.add(new Pair(stack.itemID, stack.getItemDamage())); + } + } + /** Converts an object input into an itemstack for use */ private static ItemStack convert(Object object) {