diff --git a/src/dark/api/reciepes/AssemblyObjectManager.java b/src/dark/api/reciepes/AssemblyObjectManager.java new file mode 100644 index 000000000..8a8d847ea --- /dev/null +++ b/src/dark/api/reciepes/AssemblyObjectManager.java @@ -0,0 +1,45 @@ +package dark.api.reciepes; + +import java.util.HashMap; + +import net.minecraft.item.ItemStack; + +import com.builtbroken.common.Pair; + +public class AssemblyObjectManager +{ + /** Generic item or block based recipes. Entity recipes are handled by the entity */ + private HashMap, IAssemblyRecipe> itemRecipes = new HashMap(); + + private static AssemblyObjectManager instance; + + public static AssemblyObjectManager instance() + { + if (instance == null) + { + instance = new AssemblyObjectManager(); + } + return instance; + } + + public IAssemblyRecipe getRecipeFor(Object object) + { + IAssemblyRecipe re = null; + + if(re instanceof IAssemblyObject) + { + re = ((IAssemblyObject) object).getRecipe(object); + } + + if (re == null && object instanceof ItemStack) + { + re = itemRecipes.get(new Pair(((ItemStack) object).itemID, ((ItemStack) object).getItemDamage())); + if(re == null && ((ItemStack) object).getItem() instanceof IAssemblyObject) + { + re = ((IAssemblyObject) ((ItemStack) object).getItem()).getRecipe(object); + } + } + + return re; + } +} diff --git a/src/dark/api/reciepes/IAssemblier.java b/src/dark/api/reciepes/IAssemblier.java new file mode 100644 index 000000000..15d26ee3b --- /dev/null +++ b/src/dark/api/reciepes/IAssemblier.java @@ -0,0 +1,38 @@ +package dark.api.reciepes; + +/** Machine or entity that is creating a AssemblyObject. Avoid actually storing the recipe item if + * there is one. Instead do what a few other mods do an give the illusion of the recipe being + * imprinted into the machine while letting the player keep the item + * + * @author DarkGuardsman */ +public interface IAssemblier +{ + /** @param assembler - this, used in the case that an item is the assembler, or even a block + * without a tileEntiy. Eg a Workbench is an example of this as it has no tileEntiy but supports + * crafting + * @return current recipe */ + public IAssemblyRecipe getCurrentRecipe(Object object); + + /** @param assembler - this, used in the case that an item is the assembler, or even a block + * without a tileEntiy. Eg a Workbench is an example of this as it has no tileEntiy but supports + * crafting + * @return true if the recipe was set correctly */ + public boolean setCurrentRecipe(Object assembler, IAssemblyRecipe recipe); + + /** @param assembler - this, used in the case that an item is the assembler, or even a block + * without a tileEntiy. Eg a Workbench is an example of this as it has no tileEntiy but supports + * crafting + * @return current work in progress */ + public IAssemblyObject getCurrentWork(Object assembler); + + /** Checks if the recipe can be created by this assembler. Should be used in cases were an + * assembler is designed for one task type + * + * @param assembler - this, used in the case that an item is the assembler, or even a block + * without a tileEntiy. Eg a Workbench is an example of this as it has no tileEntiy but supports + * crafting + * @param recipe - recipe + * @return */ + public boolean canSupportRecipe(Object assembler, IAssemblyRecipe recipe); + +} diff --git a/src/dark/api/reciepes/IAssemblyObject.java b/src/dark/api/reciepes/IAssemblyObject.java index 7653b1a0c..ab42712ba 100644 --- a/src/dark/api/reciepes/IAssemblyObject.java +++ b/src/dark/api/reciepes/IAssemblyObject.java @@ -7,9 +7,13 @@ package dark.api.reciepes; public interface IAssemblyObject { /** Gets the recipe that this object is being build from */ - public IAssemblyRecipe getRecipe(); + public IAssemblyRecipe getRecipe(Object object); /** Called each time the assembler makes a change to the object. Use this to trigger render * updates of the object */ - public void onChanged(); + public void onChanged(Object object); + + public void setStep(Object object, int step); + + public int getStep(Object object); } diff --git a/src/dark/api/reciepes/IBlueprint.java b/src/dark/api/reciepes/IBlueprint.java new file mode 100644 index 000000000..dfed3dd9d --- /dev/null +++ b/src/dark/api/reciepes/IBlueprint.java @@ -0,0 +1,17 @@ +package dark.api.reciepes; + +/** Advanced version of the assemblyRecipe. This is also used to display the recipe like a blueprint + * + * @author DarkGuardsman */ +public interface IBlueprint extends IAssemblyRecipe +{ + /** Check if the blueprint can be used by the object + * + * @param object - player, assembler,drone, entity, block, tileEntity + * @return true if it can be used. This is mainly used for disabling recipes for players */ + public boolean canUseBlueprint(Object object); + + /** Should a blueprint item be created for this blueprint. */ + public boolean createItemFor(); + +} diff --git a/src/dark/api/reciepes/IInjectorMold.java b/src/dark/api/reciepes/IInjectorMold.java new file mode 100644 index 000000000..d92069a8c --- /dev/null +++ b/src/dark/api/reciepes/IInjectorMold.java @@ -0,0 +1,15 @@ +package dark.api.reciepes; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +/** Items that are used as molds by the mold-injector to create items from liquid materials. Eg iron + * armor from molten iron fluid + * + * @author Darkguardsman */ +public interface IInjectorMold +{ + public ItemStack getOutput(FluidStack fluid, ItemStack mold); + + public FluidStack getRequirement(ItemStack mold); +} diff --git a/src/dark/api/reciepes/MachineRecipeHandler.java b/src/dark/api/reciepes/MachineRecipeHandler.java new file mode 100644 index 000000000..769526ceb --- /dev/null +++ b/src/dark/api/reciepes/MachineRecipeHandler.java @@ -0,0 +1,382 @@ +package dark.api.reciepes; + +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.item.crafting.FurnaceRecipes; +import net.minecraftforge.common.Configuration; +import net.minecraftforge.oredict.OreDictionary; + +import com.builtbroken.common.Pair; + +import cpw.mods.fml.common.registry.GameRegistry; +import dark.api.ColorCode; +import dark.core.common.CoreRecipeLoader; +import dark.core.common.items.EnumMaterial; +import dark.core.common.items.EnumOrePart; +import dark.core.common.items.ItemOreDirv; +import dark.core.prefab.helpers.AutoCraftingManager; + +/** Recipes for ore processor machines + * + * @author DarkGuardsman */ +public class MachineRecipeHandler +{ + private static Random random = new Random(); + private static boolean loadedOres = false; + + static + { + newProcessorRecipe(ProcessorType.CRUSHER, Block.stone, Block.cobblestone); + newProcessorRecipe(ProcessorType.CRUSHER, Block.oreDiamond, Item.diamond); + newProcessorRecipe(ProcessorType.CRUSHER, Block.oreLapis, new ItemStack(Item.dyePowder.itemID, 4, ColorCode.BLUE.ordinal())); + newProcessorRecipe(ProcessorType.CRUSHER, Block.oreRedstone, new ItemStack(Item.redstone.itemID, 4, 0)); + newProcessorRecipe(ProcessorType.CRUSHER, Block.oreEmerald, new ItemStack(Item.redstone.itemID, 4, 0)); + + newProcessorRecipe(ProcessorType.GRINDER, new ItemStack(Block.cobblestone.blockID, 1, 0), new ItemStack(Block.sand.blockID, 1, 0)); + newProcessorRecipe(ProcessorType.GRINDER, Block.glass, Block.sand); + + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, Block.stone, Block.cobblestone); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, Block.cobblestoneMossy, Block.cobblestone); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, Block.glass, Block.sand); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Item.stick, null); + + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Block.stone, Block.cobblestone); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Block.cobblestoneMossy, Block.cobblestone); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Item.stick, null); + + //TODO replace these with ItemOreDirv + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Block.glass, Block.sand); + } + + /** Creates a new recipe for the type of processor machine + * + * @param type - machine type + * @param in - input item, stacksize is ignored + * @param out - output item */ + public static void newProcessorRecipe(ProcessorType type, Object in, Object out) + { + newProcessorRecipe(type, in, out, -1, -1); + } + + /** Creates a new recipe for the type of processor machine + * + * @param type - machine type + * @param in - input item, stacksize is ignored + * @param out - output item + * @param min - min stacksize to return as output + * @param max- max stacksize to return as output */ + public static void newProcessorRecipe(ProcessorType type, Object in, Object out, int min, int max) + { + newProcessorRecipe(type, in, out, min, max, false); + } + + /** Creates a new recipe for the type of processor machine + * + * @param type - machine type + * @param in - input item, stacksize is ignored + * @param out - output item + * @param min - min stacksize to return as output + * @param max- max stacksize to return as output + * @param ignoreNBT - only use this if your item's nbt doesn't play a factor in what items were + * used to craft it */ + public static void newProcessorRecipe(ProcessorType type, Object in, Object out, int min, int max, boolean ignoreNBT) + { + if (in != null && out != null && type != null) + { + ItemStack input = convertToItemStack(in); + ItemStack output = convertToItemStack(out); + if (input != null && output != null && type.recipes != null) + { + if (!ignoreNBT && (input.getTagCompound() != null || input.isItemEnchanted())) + { + System.out.println("[MachineRecipeHandler]Error: NBT or Enchanted Items must use the IProccesable interface to properlly handle recipe outputs."); + System.out.println("[MachineRecipeHandler]Item>> Data: " + input.toString() + " Name: " + input.getItem().getUnlocalizedName()); + return; + } + if (min == -1) + { + min = output.stackSize; + } + if (max == -1 || max < min) + { + max = output.stackSize; + } + type.recipes.put(new Pair(input.itemID, input.getItemDamage()), new ProcessorRecipe(output, min, max)); + } + } + } + + /** Used to track items that should be converted to different items during salvaging. */ + public static void newAltProcessorOutput(ProcessorType type, Object in, Object out) + { + if (in != null && out != null && type != null) + { + ItemStack input = convertToItemStack(in); + ItemStack output = convertToItemStack(out); + if (input != null && output != null && type.altOutput != null) + { + type.altOutput.put(new Pair(input.itemID, input.getItemDamage()), output); + } + } + } + + /** Marks an itemstack as unsalvagable by all processors */ + public static void banProcessingOfItem(ItemStack stack) + { + if (stack != null) + { + for (ProcessorType type : ProcessorType.values()) + { + banProcessingOfItem(type, stack); + } + } + } + + /** Marks an itemstack as unusable by processors. This will jam the processor if the item enters + * it */ + public static void banProcessingOfItem(ProcessorType type, ItemStack stack) + { + if (type != null && stack != null) + { + type.banList.add(new Pair(stack.itemID, stack.getItemDamage())); + } + } + + /** Converts an object input into an itemstack for use */ + private static ItemStack convertToItemStack(Object object) + { + if (object instanceof ItemStack) + { + ItemStack stack = (ItemStack) object; + if (stack.getItemDamage() < 0) + { + stack.setItemDamage(0); + } + return stack; + } + if (object instanceof Block) + { + return new ItemStack(((Block) object).blockID, 1, -1); + } + if (object instanceof Item) + { + return new ItemStack(((Item) object).itemID, 1, -1); + } + return null; + } + + /** Gets the lit of items that are created from the input item stack. General this will be an + * array of one item. However, in salavaging cases it can be up to 8 items. + * + * @param type - Processor type + * @param inputStack - item stack input ignores stacksize + * @return array of itemStacks */ + public static ItemStack[] getProcessorOutput(ProcessorType type, ItemStack inputStack) + { + if (inputStack != null && type != null) + { + ItemStack[] reList = null; + if (inputStack.getItem() instanceof IProcessable) + { + if (!((IProcessable) inputStack.getItem()).canProcess(type, inputStack)) + { + return null; + } + reList = ((IProcessable) inputStack.getItem()).getProcesserOutput(type, inputStack); + } + if (reList == null) + { + reList = getOuputNormal(type, inputStack); + } + if (reList == null) + { + reList = salvageItem(type, inputStack); + } + return reList; + } + return null; + } + + /** Salvages an itemStack for the items used to craft it + * + * @param type - processor type used to determine damage results + * @param stack - itemStack being salvaged + * @return Array of all items salvaged */ + public static ItemStack[] salvageItem(ProcessorType type, ItemStack stack) + { + return salvageItem(type, stack, true); + } + + /** Salvages an itemStack for the items used to craft it + * + * @param type - processor type used to determine damage results + * @param stack - itemStack being salvaged + * @param damage - damage the output items. Eg ironIngot becomes ironDust, or ironScraps + * @return Array of all items salvaged */ + public static ItemStack[] salvageItem(ProcessorType type, ItemStack stack, boolean damage) + { + float bar = 0.3f; + //Allow tools and armor to be salvaged but at a very low rate + if (stack.isItemDamaged()) + { + bar = (stack.getItemDamage() / stack.getMaxDamage()); + } + ItemStack[] reList = salvageItem(stack, bar); + if (damage && reList != null && type.altOutput != null) + { + for (int i = 0; i < reList.length; i++) + { + if (type.altOutput.containsKey(new Pair(reList[i].itemID, reList[i].getItemDamage()))) + { + reList[i] = convertToItemStack(type.altOutput.get(new Pair(reList[i].itemID, reList[i].getItemDamage()))); + } + } + } + return reList; + } + + /** Salvages an itemStack for the items used to craft it + * + * @param stack - itemStack being salvaged + * @param bar - chance per item that the random must be above inorder to salvage the output + * @return Array of all items salvaged */ + public static ItemStack[] salvageItem(ItemStack stack, float bar) + { + //TODO find a way around having to force recipe to be the same stack size of the salvage. Maybe percentage based salvaging or min stacksize from machine? + ItemStack[] recipeList = AutoCraftingManager.getReverseRecipe(stack.copy(), stack.stackSize); + ItemStack[] reList = new ItemStack[recipeList.length]; + for (int i = 0; i < recipeList.length; i++) + { + if (recipeList[i] != null && random.nextFloat() >= bar) + { + reList[i] = recipeList[i]; + if (recipeList[i].itemID < Block.blocksList.length && Block.blocksList[recipeList[i].itemID] != null && recipeList[i].getItemDamage() > 16) + { + reList[i].setItemDamage(0); + } + + } + } + return reList; + } + + public static ItemStack[] getOuputNormal(ProcessorType type, ItemStack stack) + { + if (type.recipes != null) + { + ProcessorRecipe re = type.recipes.get(new Pair(stack.itemID, -1)); + if (re == null || re.output == null) + { + re = type.recipes.get(new Pair(stack.itemID, stack.getItemDamage())); + } + if (type.altOutput != null && (re == null || re.output == null)) + { + return new ItemStack[] { type.altOutput.get(new Pair(stack.itemID, stack.getItemDamage())) }; + } + if (re != null && re.output != null) + { + ItemStack output = re.output.copy(); + output.stackSize = Math.min(re.maxItemsOut, re.minItemsOut + random.nextInt(re.minItemsOut)); + if (re.chancePerItem < 1.0f) + { + + } + return new ItemStack[] { output }; + } + } + + return null; + } + + public static void parseOreNames(Configuration config) + { + if (!loadedOres && CoreRecipeLoader.itemMetals instanceof ItemOreDirv) + { + for (EnumMaterial mat : EnumMaterial.values()) + { //Ingots + List ingots = OreDictionary.getOres("ingot" + mat.simpleName); + ingots.addAll(OreDictionary.getOres(mat.simpleName + "ingot")); + //plate + List plates = OreDictionary.getOres("plate" + mat.simpleName); + plates.addAll(OreDictionary.getOres(mat.simpleName + "plate")); + //ore + List ores = OreDictionary.getOres("ore" + mat.simpleName); + ores.addAll(OreDictionary.getOres(mat.simpleName + "ore")); + //dust + List dusts = OreDictionary.getOres("dust" + mat.simpleName); + dusts.addAll(OreDictionary.getOres(mat.simpleName + "dust")); + for (ItemStack du : dusts) + { + if (mat.shouldCreateItem(EnumOrePart.INGOTS) && config.get("OreParser", "OverrideDustSmelthing", true).getBoolean(true)) + { + FurnaceRecipes.smelting().addSmelting(du.itemID, du.getItemDamage(), mat.getStack(EnumOrePart.INGOTS, 1), 0.6f); + } + } + + for (ItemStack ing : ingots) + { + if (mat.shouldCreateItem(EnumOrePart.DUST)) + { + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, ing, mat.getStack(EnumOrePart.DUST, 1)); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, ing, mat.getStack(EnumOrePart.DUST, 1)); + } + if (mat.shouldCreateItem(EnumOrePart.SCRAPS)) + { + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, ing, mat.getStack(EnumOrePart.SCRAPS, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, ing, mat.getStack(EnumOrePart.SCRAPS, 1)); + } + if (mat.shouldCreateItem(EnumOrePart.INGOTS)) + { + GameRegistry.addShapelessRecipe(mat.getStack(EnumOrePart.INGOTS, 1), new Object[] { ing }); + } + } + for (ItemStack pla : plates) + { + if (mat.shouldCreateItem(EnumOrePart.DUST)) + { + + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, pla, mat.getStack(EnumOrePart.DUST, 1)); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, pla, mat.getStack(EnumOrePart.DUST, 1)); + + } + if (mat.shouldCreateItem(EnumOrePart.SCRAPS)) + { + + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, pla, mat.getStack(EnumOrePart.SCRAPS, 1)); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, pla, mat.getStack(EnumOrePart.SCRAPS, 1)); + + } + if (mat.shouldCreateItem(EnumOrePart.PLATES)) + { + GameRegistry.addShapelessRecipe(mat.getStack(EnumOrePart.PLATES, 1), new Object[] { pla }); + if (config.get("OreParser", "ForcePlateToIngotDM", true).getBoolean(true)) + { + GameRegistry.addShapelessRecipe(mat.getStack(EnumOrePart.INGOTS, 4), new Object[] { pla }); + } + } + } + for (ItemStack ore : ores) + { + if (mat.shouldCreateItem(EnumOrePart.RUBBLE)) + { + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, ore, mat.getStack(EnumOrePart.RUBBLE, 1), 1, 2); + } + if (mat.shouldCreateItem(EnumOrePart.DUST)) + { + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, ore, mat.getStack(EnumOrePart.DUST, 1), 1, 3); + } + if (mat.shouldCreateItem(EnumOrePart.INGOTS) && config.get("OreParser", "OverrideOreSmelthing", true).getBoolean(true)) + { + FurnaceRecipes.smelting().addSmelting(ore.itemID, ore.getItemDamage(), mat.getStack(EnumOrePart.INGOTS, 1), 0.6f); + } + } + + } + loadedOres = true; + } + } +} diff --git a/src/dark/api/reciepes/ProcessorRecipes.java b/src/dark/api/reciepes/ProcessorRecipes.java deleted file mode 100644 index 5a6599e32..000000000 --- a/src/dark/api/reciepes/ProcessorRecipes.java +++ /dev/null @@ -1,298 +0,0 @@ -package dark.api.reciepes; - -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.item.crafting.FurnaceRecipes; -import net.minecraftforge.common.Configuration; -import net.minecraftforge.oredict.OreDictionary; - -import com.builtbroken.common.Pair; - -import cpw.mods.fml.common.registry.GameRegistry; -import dark.api.ColorCode; -import dark.core.common.CoreRecipeLoader; -import dark.core.common.items.EnumMaterial; -import dark.core.common.items.EnumOrePart; -import dark.core.common.items.ItemOreDirv; -import dark.core.prefab.helpers.AutoCraftingManager; - -/** Recipes for ore processor machines - * - * @author DarkGuardsman */ -public class ProcessorRecipes -{ - private static Random random = new Random(); - private static boolean loadedOres = false; - - static - { - createRecipe(ProcessorType.CRUSHER, Block.stone, Block.cobblestone); - createRecipe(ProcessorType.CRUSHER, Block.oreDiamond, Item.diamond); - createRecipe(ProcessorType.CRUSHER, Block.oreLapis, new ItemStack(Item.dyePowder.itemID, 4, ColorCode.BLUE.ordinal())); - createRecipe(ProcessorType.CRUSHER, Block.oreRedstone, new ItemStack(Item.redstone.itemID, 4, 0)); - createRecipe(ProcessorType.CRUSHER, Block.oreEmerald, new ItemStack(Item.redstone.itemID, 4, 0)); - - createRecipe(ProcessorType.GRINDER, new ItemStack(Block.cobblestone.blockID, 1, 0), new ItemStack(Block.sand.blockID, 1, 0)); - createRecipe(ProcessorType.GRINDER, Block.glass, Block.sand); - - ProcessorRecipes.setAltOutput(ProcessorType.GRINDER, Block.stone, Block.cobblestone); - ProcessorRecipes.setAltOutput(ProcessorType.GRINDER, Block.cobblestoneMossy, Block.cobblestone); - ProcessorRecipes.setAltOutput(ProcessorType.GRINDER, Block.glass, Block.sand); - ProcessorRecipes.setAltOutput(ProcessorType.CRUSHER, Item.stick, null); - - ProcessorRecipes.setAltOutput(ProcessorType.CRUSHER, Block.stone, Block.cobblestone); - ProcessorRecipes.setAltOutput(ProcessorType.CRUSHER, Block.cobblestoneMossy, Block.cobblestone); - ProcessorRecipes.setAltOutput(ProcessorType.CRUSHER, Item.stick, null); - - //TODO replace these with ItemOreDirv - ProcessorRecipes.setAltOutput(ProcessorType.CRUSHER, Block.glass, Block.sand); - } - - /** Creates a simple one itemStack in one ItemStack out. Itemstack output can actual have a stack - * size larger than one - * - * @param type - processor type - * @param in - input item, stacksize is ignored - * @param out - ouput item */ - public static void createRecipe(ProcessorType type, Object in, Object out) - { - createRecipe(type, in, out, -1, -1); - } - - public static void createRecipe(ProcessorType type, Object in, Object out, int min, int max) - { - if (in != null && out != null && type != null) - { - ItemStack input = convert(in); - ItemStack output = convert(out); - if (input != null && output != null && type.recipes != null) - { - if (min == -1) - { - min = output.stackSize; - } - if (max == -1 || max < min) - { - max = output.stackSize; - } - type.recipes.put(new Pair(input.itemID, input.getItemDamage()), new ProcessorRecipe(output, min, max)); - } - } - } - - /** Used to track items that should be converted to different items during salvaging. */ - public static void setAltOutput(ProcessorType type, Object in, Object out) - { - if (in != null && out != null && type != null) - { - ItemStack input = convert(in); - ItemStack output = convert(out); - if (input != null && output != null && type.altOutput != null) - { - type.altOutput.put(new Pair(input.itemID, input.getItemDamage()), output); - } - } - } - - /** 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.banList.add(new Pair(stack.itemID, stack.getItemDamage())); - } - } - - /** Converts an object input into an itemstack for use */ - private static ItemStack convert(Object object) - { - if (object instanceof ItemStack) - { - return (ItemStack) object; - } - if (object instanceof Block) - { - return new ItemStack(((Block) object).blockID, 1, -1); - } - if (object instanceof Item) - { - return new ItemStack(((Item) object).itemID, 1, -1); - } - return null; - } - - /** Gets the lit of items that are created from the input item stack. General this will be an - * array of one item. However, in salavaging cases it can be up to 8 items. - * - * @param type - Processor type - * @param stack - item stack input ignores stacksize - * @return array of itemStacks */ - public static ItemStack[] getOuput(ProcessorType type, ItemStack stack, boolean damageSalvage) - { - if (stack != null && type != null) - { - ItemStack[] reList = getOuputNormal(type, stack); - if (reList == null) - { - reList = salvageItem(type, stack); - } - return reList; - } - return null; - } - - public static ItemStack[] salvageItem(ProcessorType type, ItemStack stack) - { - //TODO find a way around having to force single output size salvaging - ItemStack[] recipeList = AutoCraftingManager.getReverseRecipe(stack.copy(), 1); - ItemStack[] reList = new ItemStack[recipeList.length]; - for (int i = 0; i < recipeList.length; i++) - { - if (recipeList[i] != null && random.nextFloat() >= .3f) - { - reList[i] = recipeList[i]; - if (recipeList[i].itemID < Block.blocksList.length && Block.blocksList[recipeList[i].itemID] != null && recipeList[i].getItemDamage() > 16) - { - reList[i].setItemDamage(0); - } - if (type.altOutput != null && type.altOutput.containsKey(new Pair(reList[i].itemID, reList[i].getItemDamage()))) - { - reList[i] = convert(type.altOutput.get(new Pair(reList[i].itemID, reList[i].getItemDamage()))); - } - } - } - return reList; - } - - public static ItemStack[] getOuputNormal(ProcessorType type, ItemStack stack) - { - if (type.recipes != null) - { - ProcessorRecipe re = type.recipes.get(new Pair(stack.itemID, -1)); - if (re == null || re.output == null) - { - re = type.recipes.get(new Pair(stack.itemID, stack.getItemDamage())); - } - if (type.altOutput != null && (re == null || re.output == null)) - { - return new ItemStack[] { type.altOutput.get(new Pair(stack.itemID, stack.getItemDamage())) }; - } - if (re != null && re.output != null) - { - ItemStack output = re.output.copy(); - output.stackSize = Math.min(re.maxItemsOut, re.minItemsOut + random.nextInt(re.minItemsOut)); - if (re.chancePerItem < 1.0f) - { - - } - return new ItemStack[] { output }; - } - } - - return null; - } - - public static void parseOreNames(Configuration config) - { - if (!loadedOres && CoreRecipeLoader.itemMetals instanceof ItemOreDirv) - { - for (EnumMaterial mat : EnumMaterial.values()) - { //Ingots - List ingots = OreDictionary.getOres("ingot" + mat.simpleName); - ingots.addAll(OreDictionary.getOres(mat.simpleName + "ingot")); - //plate - List plates = OreDictionary.getOres("plate" + mat.simpleName); - plates.addAll(OreDictionary.getOres(mat.simpleName + "plate")); - //ore - List ores = OreDictionary.getOres("ore" + mat.simpleName); - ores.addAll(OreDictionary.getOres(mat.simpleName + "ore")); - //dust - List dusts = OreDictionary.getOres("dust" + mat.simpleName); - dusts.addAll(OreDictionary.getOres(mat.simpleName + "dust")); - for (ItemStack du : dusts) - { - if (mat.shouldCreateItem(EnumOrePart.INGOTS) && config.get("OreParser", "OverrideDustSmelthing", true).getBoolean(true)) - { - FurnaceRecipes.smelting().addSmelting(du.itemID, du.getItemDamage(), mat.getStack(EnumOrePart.INGOTS, 1), 0.6f); - } - } - - for (ItemStack ing : ingots) - { - if (mat.shouldCreateItem(EnumOrePart.DUST)) - { - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, ing, mat.getStack(EnumOrePart.DUST, 1)); - ProcessorRecipes.setAltOutput(ProcessorType.GRINDER, ing, mat.getStack(EnumOrePart.DUST, 1)); - } - if (mat.shouldCreateItem(EnumOrePart.SCRAPS)) - { - ProcessorRecipes.setAltOutput(ProcessorType.CRUSHER, ing, mat.getStack(EnumOrePart.SCRAPS, 1)); - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, ing, mat.getStack(EnumOrePart.SCRAPS, 1)); - } - if (mat.shouldCreateItem(EnumOrePart.INGOTS)) - { - GameRegistry.addShapelessRecipe(mat.getStack(EnumOrePart.INGOTS, 1), new Object[] { ing }); - } - } - for (ItemStack pla : plates) - { - if (mat.shouldCreateItem(EnumOrePart.DUST)) - { - - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, pla, mat.getStack(EnumOrePart.DUST, 1)); - ProcessorRecipes.setAltOutput(ProcessorType.GRINDER, pla, mat.getStack(EnumOrePart.DUST, 1)); - - } - if (mat.shouldCreateItem(EnumOrePart.SCRAPS)) - { - - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, pla, mat.getStack(EnumOrePart.SCRAPS, 1)); - ProcessorRecipes.setAltOutput(ProcessorType.CRUSHER, pla, mat.getStack(EnumOrePart.SCRAPS, 1)); - - } - if (mat.shouldCreateItem(EnumOrePart.PLATES)) - { - GameRegistry.addShapelessRecipe(mat.getStack(EnumOrePart.PLATES, 1), new Object[] { pla }); - if (config.get("OreParser", "ForcePlateToIngotDM", true).getBoolean(true)) - { - GameRegistry.addShapelessRecipe(mat.getStack(EnumOrePart.INGOTS, 4), new Object[] { pla }); - } - } - } - for (ItemStack ore : ores) - { - if (mat.shouldCreateItem(EnumOrePart.RUBBLE)) - { - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, ore, mat.getStack(EnumOrePart.RUBBLE, 1), 1, 2); - } - if (mat.shouldCreateItem(EnumOrePart.DUST)) - { - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, ore, mat.getStack(EnumOrePart.DUST, 1), 1, 3); - } - if (mat.shouldCreateItem(EnumOrePart.INGOTS) && config.get("OreParser", "OverrideOreSmelthing", true).getBoolean(true)) - { - FurnaceRecipes.smelting().addSmelting(ore.itemID, ore.getItemDamage(), mat.getStack(EnumOrePart.INGOTS, 1), 0.6f); - } - } - - } - loadedOres = true; - } - } -} diff --git a/src/dark/api/reciepes/ProcessorType.java b/src/dark/api/reciepes/ProcessorType.java index 56e583cb7..f9c84c47b 100644 --- a/src/dark/api/reciepes/ProcessorType.java +++ b/src/dark/api/reciepes/ProcessorType.java @@ -14,10 +14,14 @@ import com.builtbroken.common.Pair; * @author Darkguardsman */ public enum ProcessorType { + /** Pistons that smash the object */ CRUSHER(), + /** Several disks that shred the item up */ GRINDER(), - METAL_PRESS(), - SHARPENING_STONE(); + /** Grinds the edge or surface of the item sharpening it */ + SHARPENING_STONE(), + /** Breaks down an item carefully giving an almost complete output of item used to craft it */ + SALVAGER(); public HashMap, ProcessorRecipe> recipes = new HashMap(); public HashMap, ItemStack> altOutput = new HashMap(); public List> banList = new ArrayList(); diff --git a/src/dark/core/common/CoreRecipeLoader.java b/src/dark/core/common/CoreRecipeLoader.java index 900761d81..83b763c6b 100644 --- a/src/dark/core/common/CoreRecipeLoader.java +++ b/src/dark/core/common/CoreRecipeLoader.java @@ -8,7 +8,7 @@ import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraftforge.oredict.ShapedOreRecipe; import cpw.mods.fml.common.registry.GameRegistry; import dark.api.ColorCode; -import dark.api.reciepes.ProcessorRecipes; +import dark.api.reciepes.MachineRecipeHandler; import dark.api.reciepes.ProcessorType; import dark.core.common.blocks.BlockBasalt; import dark.core.common.blocks.BlockOre; @@ -114,27 +114,27 @@ public class CoreRecipeLoader extends RecipeLoader if (itemMetals instanceof ItemOreDirv) { //Alt salvaging item list - ProcessorRecipes.setAltOutput(ProcessorType.GRINDER, Block.wood, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.DUST, 3)); - ProcessorRecipes.setAltOutput(ProcessorType.GRINDER, Block.planks, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.DUST, 1)); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, Block.wood, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.DUST, 3)); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, Block.planks, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.DUST, 1)); - ProcessorRecipes.setAltOutput(ProcessorType.CRUSHER, Block.wood, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.SCRAPS, 3)); - ProcessorRecipes.setAltOutput(ProcessorType.CRUSHER, Block.planks, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.SCRAPS, 1)); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Block.wood, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.SCRAPS, 3)); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, Block.planks, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.SCRAPS, 1)); //Stone recipes - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, Block.stone, EnumMaterial.getStack(EnumMaterial.STONE, EnumOrePart.DUST, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, Block.stone, EnumMaterial.getStack(EnumMaterial.STONE, EnumOrePart.DUST, 1)); //Wood recipes - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, Block.wood, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.DUST, 3)); - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, Block.planks, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.DUST, 1)); - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, Block.wood, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.SCRAPS, 3)); - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, Block.planks, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.SCRAPS, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, Block.wood, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.DUST, 3)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, Block.planks, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.DUST, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.wood, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.SCRAPS, 3)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.planks, EnumMaterial.getStack(EnumMaterial.WOOD, EnumOrePart.SCRAPS, 1)); //Gold Recipes - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, Block.blockIron, EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.SCRAPS, 8)); - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, Block.oreIron, EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.RUBBLE, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.blockIron, EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.SCRAPS, 8)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.oreIron, EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.RUBBLE, 1)); //Iron Recipes - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, Block.blockGold, EnumMaterial.getStack(EnumMaterial.GOLD, EnumOrePart.SCRAPS, 8)); - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, Block.oreGold, EnumMaterial.getStack(EnumMaterial.GOLD, EnumOrePart.RUBBLE, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.blockGold, EnumMaterial.getStack(EnumMaterial.GOLD, EnumOrePart.SCRAPS, 8)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, Block.oreGold, EnumMaterial.getStack(EnumMaterial.GOLD, EnumOrePart.RUBBLE, 1)); //Dust recipes GameRegistry.addShapelessRecipe(EnumMaterial.getStack(EnumMaterial.STEEL, EnumOrePart.DUST, 1), new Object[] { EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.DUST, 1), new ItemStack(Item.coal, 1, 0), new ItemStack(Item.coal, 1, 0) }); GameRegistry.addShapelessRecipe(EnumMaterial.getStack(EnumMaterial.STEEL, EnumOrePart.DUST, 1), new Object[] { EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.DUST, 1), new ItemStack(Item.coal, 1, 1), new ItemStack(Item.coal, 1, 1) }); @@ -164,14 +164,14 @@ public class CoreRecipeLoader extends RecipeLoader if (mat.shouldCreateItem(EnumOrePart.DUST)) { FurnaceRecipes.smelting().addSmelting(mat.getStack(EnumOrePart.DUST, 1).itemID, mat.getStack(EnumOrePart.DUST, 1).getItemDamage(), mat.getStack(EnumOrePart.INGOTS, 1), 0.6f); - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.RUBBLE, 1), mat.getStack(EnumOrePart.DUST, 1), 1, 4); - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.SCRAPS, 1), mat.getStack(EnumOrePart.DUST, 1)); - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.DUST, 1)); - ProcessorRecipes.setAltOutput(ProcessorType.GRINDER, mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.DUST, 1)); - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.PLATES, 1), mat.getStack(EnumOrePart.DUST, 1), 2, 4); - ProcessorRecipes.setAltOutput(ProcessorType.GRINDER, mat.getStack(EnumOrePart.PLATES, 1), mat.getStack(EnumOrePart.DUST, 3)); - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.ROD, 1), mat.getStack(EnumOrePart.DUST, 1)); - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.TUBE, 1), mat.getStack(EnumOrePart.DUST, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.RUBBLE, 1), mat.getStack(EnumOrePart.DUST, 1), 1, 4); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.SCRAPS, 1), mat.getStack(EnumOrePart.DUST, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.DUST, 1)); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.DUST, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.PLATES, 1), mat.getStack(EnumOrePart.DUST, 1), 2, 4); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.GRINDER, mat.getStack(EnumOrePart.PLATES, 1), mat.getStack(EnumOrePart.DUST, 3)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.ROD, 1), mat.getStack(EnumOrePart.DUST, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, mat.getStack(EnumOrePart.TUBE, 1), mat.getStack(EnumOrePart.DUST, 1)); } // Salvaging recipe @@ -179,12 +179,12 @@ public class CoreRecipeLoader extends RecipeLoader if (mat.shouldCreateItem(EnumOrePart.SCRAPS)) { FurnaceRecipes.smelting().addSmelting(mat.getStack(EnumOrePart.SCRAPS, 1).itemID, mat.getStack(EnumOrePart.SCRAPS, 1).getItemDamage(), mat.getStack(EnumOrePart.INGOTS, 1), 0.6f); - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.PLATES, 1), mat.getStack(EnumOrePart.SCRAPS, 3)); - ProcessorRecipes.setAltOutput(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.PLATES, 1), mat.getStack(EnumOrePart.SCRAPS, 3)); - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.RUBBLE, 1), mat.getStack(EnumOrePart.SCRAPS, 1), 1, 5); - ProcessorRecipes.setAltOutput(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.SCRAPS, 1)); - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.ROD, 1), mat.getStack(EnumOrePart.SCRAPS, 1)); - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.TUBE, 1), mat.getStack(EnumOrePart.SCRAPS, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.PLATES, 1), mat.getStack(EnumOrePart.SCRAPS, 3)); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.PLATES, 1), mat.getStack(EnumOrePart.SCRAPS, 3)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.RUBBLE, 1), mat.getStack(EnumOrePart.SCRAPS, 1), 1, 5); + MachineRecipeHandler.newAltProcessorOutput(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.SCRAPS, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.ROD, 1), mat.getStack(EnumOrePart.SCRAPS, 1)); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, mat.getStack(EnumOrePart.TUBE, 1), mat.getStack(EnumOrePart.SCRAPS, 1)); } if (mat.shouldCreateItem(EnumOrePart.TUBE)) { @@ -218,8 +218,8 @@ public class CoreRecipeLoader extends RecipeLoader if (CoreRecipeLoader.itemMetals instanceof ItemOreDirv) { FurnaceRecipes.smelting().addSmelting(blockOre.blockID, data.ordinal(), EnumMaterial.getStack(data.mat, EnumOrePart.INGOTS, 1), 0.6f); - ProcessorRecipes.createRecipe(ProcessorType.CRUSHER, new ItemStack(blockOre.blockID, 1, data.ordinal()), EnumMaterial.getStack(data.mat, EnumOrePart.RUBBLE, 1), 1, 2); - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, new ItemStack(blockOre.blockID, 1, data.ordinal()), EnumMaterial.getStack(data.mat, EnumOrePart.DUST, 1), 1, 3); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.CRUSHER, new ItemStack(blockOre.blockID, 1, data.ordinal()), EnumMaterial.getStack(data.mat, EnumOrePart.RUBBLE, 1), 1, 2); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, new ItemStack(blockOre.blockID, 1, data.ordinal()), EnumMaterial.getStack(data.mat, EnumOrePart.DUST, 1), 1, 3); } } @@ -238,10 +238,10 @@ public class CoreRecipeLoader extends RecipeLoader if (blockStainGlass != null) { FurnaceRecipes.smelting().addSmelting(blockColorSand.blockID, code.ordinal(), new ItemStack(blockStainGlass, 1, code.ordinal()), 10F); - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, new ItemStack(blockStainGlass, 1, code.ordinal()), new ItemStack(blockColorSand.blockID, 1, code.ordinal())); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, new ItemStack(blockStainGlass, 1, code.ordinal()), new ItemStack(blockColorSand.blockID, 1, code.ordinal())); } GameRegistry.addShapelessRecipe(new ItemStack(blockColorSand.blockID, 1, code.ordinal()), new Object[] { new ItemStack(blockColorSand, 1, code.ordinal()) }); - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, new ItemStack(blockColorSand, 1, code.ordinal()), new ItemStack(itemGlowingSand, 1, code.ordinal())); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, new ItemStack(blockColorSand, 1, code.ordinal()), new ItemStack(itemGlowingSand, 1, code.ordinal())); } @@ -251,13 +251,13 @@ public class CoreRecipeLoader extends RecipeLoader if (blockGlowGlass != null) { FurnaceRecipes.smelting().addSmelting(itemGlowingSand.itemID, code.ordinal(), new ItemStack(blockGlowGlass, 1, code.ordinal()), 10F); - ProcessorRecipes.createRecipe(ProcessorType.GRINDER, new ItemStack(blockGlowGlass, 1, code.ordinal()), new ItemStack(itemGlowingSand, 1, code.ordinal())); + MachineRecipeHandler.newProcessorRecipe(ProcessorType.GRINDER, new ItemStack(blockGlowGlass, 1, code.ordinal()), new ItemStack(itemGlowingSand, 1, code.ordinal())); } if (blockColorSand != null) { GameRegistry.addShapelessRecipe(new ItemStack(itemGlowingSand, 1, code.ordinal()), new Object[] { new ItemStack(blockColorSand.blockID, 1, code.ordinal()), Item.redstone }); GameRegistry.addShapelessRecipe(new ItemStack(itemGlowingSand, 1, code.ordinal()), new Object[] { new ItemStack(blockColorSand.blockID, 1, code.ordinal()), Item.glowstone }); - ProcessorRecipes.markUnsalvagable(new ItemStack(itemGlowingSand, 1, code.ordinal())); + MachineRecipeHandler.banProcessingOfItem(new ItemStack(itemGlowingSand, 1, code.ordinal())); } } diff --git a/src/dark/core/common/DarkMain.java b/src/dark/core/common/DarkMain.java index bdfc80c53..6a0ea5459 100644 --- a/src/dark/core/common/DarkMain.java +++ b/src/dark/core/common/DarkMain.java @@ -30,7 +30,7 @@ import cpw.mods.fml.common.event.FMLServerStoppingEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; -import dark.api.reciepes.ProcessorRecipes; +import dark.api.reciepes.MachineRecipeHandler; import dark.core.common.blocks.BlockBasalt; import dark.core.common.blocks.BlockColorGlass; import dark.core.common.blocks.BlockColorGlowGlass; @@ -216,7 +216,7 @@ public class DarkMain extends ModPrefab { DMCreativeTab.tabIndustrial.itemStack = EnumMaterial.getStack(EnumMaterial.IRON, EnumOrePart.GEARS, 1); } - ProcessorRecipes.parseOreNames(CONFIGURATION); + MachineRecipeHandler.parseOreNames(CONFIGURATION); } @Override