Removed Recipe creator from recipe loader

In most instances it was not working so it is now removed
This commit is contained in:
Robert 2013-11-11 12:22:36 -05:00
parent 5178f52cf4
commit 519d794308
4 changed files with 22 additions and 247 deletions

View file

@ -3,15 +3,14 @@ package dark.core.common;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
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.IToolReadOut.EnumTools;
import dark.api.reciepes.MachineRecipeHandler;
import dark.api.reciepes.ProcessorType;
import dark.core.common.blocks.BlockBasalt;
import dark.core.common.blocks.BlockGasOre;
import dark.core.common.blocks.BlockOre;
import dark.core.common.blocks.BlockOre.OreData;
import dark.core.common.items.EnumMaterial;
@ -21,6 +20,7 @@ import dark.core.common.items.ItemCommonTool;
import dark.core.common.items.ItemOreDirv;
import dark.core.common.items.ItemParts;
import dark.core.common.items.ItemParts.Parts;
import dark.core.common.items.ItemReadoutTools;
import dark.core.common.items.ItemWrench;
import dark.core.common.machines.BlockSolarPanel;
import dark.core.common.transmit.BlockWire;
@ -53,21 +53,22 @@ public class CoreRecipeLoader extends RecipeLoader
public void loadRecipes()
{
super.loadRecipes();
if (itemTool instanceof ItemTool)
if (itemTool instanceof ItemReadoutTools)
{
new RecipeGrid(new ItemStack(itemTool, 1, 0), 3, 2).setRowOne("ironTube", "valvePart", "ironTube").setRowTwo(null, "ironTube", null).RegisterRecipe();
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemTool, 1, EnumTools.PIPE_GUAGE.ordinal()), "TVT", " T ", 'T', "ironTube", 'V', "valvePart"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemTool, 1, EnumTools.MULTI_METER.ordinal()), "PGP", "WCW", "PRP", 'P', Block.planks, 'G', Block.glass, 'C', circuit, 'W', "copperWire", 'R', "CopperCoil"));
}
if (wrench instanceof ItemWrench)
{
new RecipeGrid(new ItemStack(wrench, 1, 0), 3, 3).setRowOne(steel, null, steel).setRowTwo(null, steel, null).setRowThree(null, steel, null).RegisterRecipe();
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(wrench, 1), "S S", " S ", " S ", 'S', steel));
}
if (blockSolar instanceof BlockSolarPanel)
{
new RecipeGrid(new ItemStack(blockSolar, 1, 0), 3, 3).setRowOne(Block.glass, Block.glass, Block.glass).setRowTwo(RecipeLoader.steel, RecipeLoader.circuit, RecipeLoader.steel).setRowThree(RecipeLoader.steel, "copperWire", RecipeLoader.steel).RegisterRecipe();
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockSolar, 1), "GGG", "SCS", "SWS", 'G', Block.glass, 'W', "copperWire", 'C', circuit, 'S', steel));
}
if (blockWire instanceof BlockWire)
{
new RecipeGrid(new ItemStack(blockWire, 16, 1), 3, 3).setRowOne(Block.cloth, Block.cloth, Block.cloth).setRowTwo(copper, copper, copper).setRowThree(Block.cloth, Block.cloth, Block.cloth).RegisterRecipe();
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockWire, 16, 1), "III", "WWW", "III", 'I', Block.cloth, 'W', copper));
}
if (itemDiggingTool instanceof ItemCommonTool)
{
@ -75,10 +76,11 @@ public class CoreRecipeLoader extends RecipeLoader
{
if (mat.shouldCreateTool())
{
new RecipeGrid(mat.getTool(EnumTool.PICKAX)).setRowOne(mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.INGOTS, 1)).setRowTwo(null, Item.stick, null).setRowThree(null, Item.stick, null).RegisterRecipe();
new RecipeGrid(mat.getTool(EnumTool.AX)).setRowOne(mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.INGOTS, 1), null).setRowTwo(mat.getStack(EnumOrePart.INGOTS, 1), Item.stick, null).setRowThree(null, Item.stick, null).RegisterRecipe();
new RecipeGrid(mat.getTool(EnumTool.HOE)).setRowOne(mat.getStack(EnumOrePart.INGOTS, 1), mat.getStack(EnumOrePart.INGOTS, 1), null).setRowTwo(null, Item.stick, null).setRowThree(null, Item.stick, null).RegisterRecipe();
new RecipeGrid(mat.getTool(EnumTool.SPADE)).setRowOne(null, mat.getStack(EnumOrePart.INGOTS, 1), null).setRowTwo(null, Item.stick, null).setRowThree(null, Item.stick, null).RegisterRecipe();
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getTool(EnumTool.PICKAX), "III", " S ", " S ", 'I', mat.getStack(EnumOrePart.INGOTS, 1), 'S', Item.stick));
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getTool(EnumTool.HOE), "II ", " S ", " S ", 'I', mat.getStack(EnumOrePart.INGOTS, 1), 'S', Item.stick));
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getTool(EnumTool.SPADE), " I ", " S ", " S ", 'I', mat.getStack(EnumOrePart.INGOTS, 1), 'S', Item.stick));
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getTool(EnumTool.AX), "II ", "IS ", " S ", 'I', mat.getStack(EnumOrePart.INGOTS, 1), 'S', Item.stick));
//GameRegistry.addRecipe(new ShapedOreRecipe(mat.getTool(EnumTool.SHEAR), "III", " S ", 'I', mat.getStack(EnumOrePart.INGOTS, 1)));
}
}
}
@ -213,7 +215,7 @@ public class CoreRecipeLoader extends RecipeLoader
}
if (mat.shouldCreateItem(EnumOrePart.GEARS))
{
new RecipeGrid(mat.getStack(EnumOrePart.GEARS, 4), 3, 3).setRowOne(null, mat.getStack(EnumOrePart.INGOTS, 1), null).setRowTwo(mat.getStack(EnumOrePart.INGOTS, 1), (mat.shouldCreateItem(EnumOrePart.ROD) ? mat.getStack(EnumOrePart.ROD, 1) : Item.stick), mat.getStack(EnumOrePart.INGOTS, 1)).setRowThree(null, mat.getStack(EnumOrePart.INGOTS, 1), null).RegisterRecipe();
GameRegistry.addRecipe(new ShapedOreRecipe(mat.getStack(EnumOrePart.GEARS, 4), new Object[] { " I", "IRI", " I ", 'I', "ingot" + mat.simpleName, 'R', mat.shouldCreateItem(EnumOrePart.ROD) ? mat.getStack(EnumOrePart.ROD) : Item.stick }));
}
}

View file

@ -95,238 +95,5 @@ public abstract class RecipeLoader
return itemStack;
}
return stack;
}
/** An easier to read recipe system for the basic minecraft recipes
*
* @author DarkGaurdsman */
@Deprecated
public static class RecipeGrid
{
Object[] items = new Object[9];
Object output;
int width = 3;
int hight = 3;
/** @param stack - output item */
public RecipeGrid(Object stack)
{
output = stack;
}
/** @param stack - output item
* @param w - width of grid
* @param h - height of grid */
public RecipeGrid(Object stack, int w, int h)
{
this(stack);
this.setSize(w, h);
}
/** 3x3 Crafting grid. Each Triple is a row. Input for the triples should be any of { Item,
* Block, ItemStack, String}
*
* @param one - top row
* @param two - middle row
* @param three - bottom row */
public RecipeGrid(Object stack, Triple one, Triple two, Triple three)
{
this(stack);
this.setRowOne(one.getA(), one.getB(), one.getC());
this.setRowTwo(two.getA(), two.getB(), two.getC());
this.setRowThree(three.getA(), three.getB(), three.getC());
}
/** 2x2 Crafting grid. Each Pair is a row. Input for the pairs should be any of { Item,
* Block, ItemStack, String}
*
* @param one - top row
* @param two - middle row */
public RecipeGrid(Object stack, Pair one, Pair two)
{
this(stack);
this.setRowOne(one.left(), one.right());
this.setRowTwo(two.left(), two.right());
this.hight = 2;
this.width = 2;
}
/** Sets the grid size */
public RecipeGrid setSize(int w, int h)
{
this.width = Math.max(Math.min(w, 3), 1);
this.hight = Math.max(Math.min(h, 3), 1);
return this;
}
/** Sets the grid recipe output */
public RecipeGrid setOutput(Object stack)
{
output = stack;
return this;
}
public RecipeGrid setRowOne(Object... objects)
{
if (objects != null)
{
this.items[0] = objects[0];
if (objects.length > 1)
{
this.items[1] = objects[1];
}
if (objects.length > 2)
{
this.items[2] = objects[2];
}
}
return this;
}
public RecipeGrid setRowTwo(Object... objects)
{
if (objects != null)
{
this.items[3] = objects[0];
if (objects.length > 1)
{
this.items[4] = objects[1];
}
if (objects.length > 2)
{
this.items[5] = objects[2];
}
}
return this;
}
public RecipeGrid setRowThree(Object... objects)
{
if (objects != null)
{
this.items[6] = objects[0];
if (objects.length > 1)
{
this.items[7] = objects[1];
}
if (objects.length > 2)
{
this.items[8] = objects[2];
}
}
return this;
}
public String getOreName(ItemStack stack)
{
if (stack != null)
{
return OreDictionary.getOreName(OreDictionary.getOreID(stack));
}
return null;
}
public void RegisterRecipe()
{
ShapedOreRecipe shapedOreRecipe = null;
Object[] recipe = null;
String[] slots = { "A", "B", "C", "D", "E", "F", "G", "H", "I" };
for (int i = 0; i < slots.length; i++)
{
if (this.items[i] == null || this.items[i] instanceof String && ((String) this.items[i]).isEmpty())
{
slots[i] = " ";
this.items[i] = "";
}//TODO include normal items and blocks
else if (this.items[i] instanceof ItemStack)
{
//Automatically converts an itemstack to its orename so that recipes are more mod compatible
String s = OreDictionary.getOreName(OreDictionary.getOreID((ItemStack) this.items[i]));
if (s != null && !s.equals("Unknown"))
{
this.items[i] = s;
}
}
}
if (width == 3 && hight == 3)
{
recipe = new Object[] { slots[0] + slots[1] + slots[2], slots[3] + slots[4] + slots[5], slots[6] + slots[7] + slots[8], 'A', items[0], 'B', items[1], 'C', items[2], 'D', items[3], 'E', items[4], 'F', items[5], 'G', items[6], 'H', items[7], 'I', items[8] };
}
else if (width == 2 && hight == 3)
{
recipe = new Object[] { slots[0] + slots[1], slots[3] + slots[4], slots[6] + slots[7], 'A', items[0], 'B', items[1], 'D', items[3], 'E', items[4], 'G', items[6], 'H', items[7] };
}
else if (width == 3 && hight == 2)
{
recipe = new Object[] { slots[0] + slots[1] + slots[2], slots[3] + slots[4] + slots[5], 'A', items[0], 'B', items[1], 'C', items[2], 'D', items[3], 'E', items[4], 'F', items[5] };
}
else if (width == 1 && hight == 3)
{
recipe = new Object[] { slots[0], slots[3], slots[6], 'A', items[0], 'D', items[3], 'G', items[6] };
}
else if (width == 3 && hight == 1)
{
recipe = new Object[] { slots[0] + slots[1] + slots[2], 'A', items[0], 'B', items[1], 'C', items[2] };
}
else if (width == 2 && hight == 2)
{
recipe = new Object[] { slots[0] + slots[1], slots[3] + slots[4], 'A', items[0], 'B', items[1], 'D', items[2], 'E', items[4] };
}
else if (width == 1 && hight == 2)
{
recipe = new Object[] { slots[0], slots[3], 'A', items[0], 'D', items[3], };
}
else if (width == 2 && hight == 1)
{
recipe = new Object[] { slots[0] + slots[1], 'A', items[0], 'B', items[1], };
}
else if (width == 1 && hight == 1)
{
recipe = new Object[] { slots[0], 'A', items[0] };
}
else
{
System.out.println("Recipe was created with an out of bounds size");
System.out.println(this.toString());
}
if (recipe != null)
{
if (output instanceof Block)
{
shapedOreRecipe = new ShapedOreRecipe(((Block) output), recipe);
}
else if (output instanceof Item)
{
shapedOreRecipe = new ShapedOreRecipe(((Item) output), recipe);
}
else if (output instanceof ItemStack)
{
shapedOreRecipe = new ShapedOreRecipe(((ItemStack) output), recipe);
}
else
{
System.out.println("Recipe was created with a null output");
System.out.println(this.toString());
}
}
if (CoreRecipeLoader.debugOreItems)
{
System.out.println("\nRecipe created");
System.out.println(this.toString());
AutoCraftingManager.printRecipes(shapedOreRecipe.getRecipeOutput());
}
if (shapedOreRecipe != null)
{
GameRegistry.addRecipe(shapedOreRecipe);
}
}
@Override
public String toString()
{
return "RecipeGrid[Out: " + (output != null ? output.toString() : "null") + "\n In: " + " " + items[0] + "| " + items[1] + "| " + items[2] + "\n " + items[3] + "| " + items[4] + "| " + items[5] + "\n " + items[6] + "| " + items[7] + "| " + items[8];
}
}
}
}

View file

@ -102,6 +102,11 @@ public enum EnumMaterial
return reStack;
}
public ItemStack getStack(EnumOrePart part)
{
return this.getStack(part, 1);
}
public ItemStack getStack(EnumOrePart part, int ammount)
{
return getStack(this, part, ammount);
@ -173,4 +178,5 @@ public enum EnumMaterial
{
return EnumMaterial.values()[meta / EnumMaterial.toolCountPerMaterial];
}
}

View file

@ -92,7 +92,7 @@ public class ItemParts extends ItemBasic implements IExtraItemInfo
CircuitElite("circuitElite"),
Motor("motor"),
IC("IC_Chip"),
COIL("Coil"),
COIL("copperCoil"),
LASER("LaserDiode");
public String name;