Reworked recipe system
This commit is contained in:
parent
4a2dd3eca1
commit
53d7db3c5a
1 changed files with 38 additions and 73 deletions
|
@ -79,7 +79,7 @@ public abstract class RecipeLoader
|
|||
|
||||
public static class RecipeGrid
|
||||
{
|
||||
Object A, B, C, D, E, F, G, H, I;
|
||||
Object[] rl = new Object[9];
|
||||
Object out;
|
||||
int width = 3;
|
||||
int hight = 3;
|
||||
|
@ -97,7 +97,7 @@ public abstract class RecipeLoader
|
|||
|
||||
/** 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 */
|
||||
|
@ -111,7 +111,7 @@ public abstract class RecipeLoader
|
|||
|
||||
/** 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)
|
||||
|
@ -142,14 +142,14 @@ public abstract class RecipeLoader
|
|||
{
|
||||
if (objects != null)
|
||||
{
|
||||
this.A = objects[0];
|
||||
this.rl[0] = objects[0];
|
||||
if (objects.length > 1)
|
||||
{
|
||||
this.B = objects[1];
|
||||
this.rl[1] = objects[1];
|
||||
}
|
||||
if (objects.length > 2)
|
||||
{
|
||||
this.C = objects[2];
|
||||
this.rl[2] = objects[2];
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
@ -159,14 +159,14 @@ public abstract class RecipeLoader
|
|||
{
|
||||
if (objects != null)
|
||||
{
|
||||
this.D = objects[0];
|
||||
this.rl[3] = objects[0];
|
||||
if (objects.length > 1)
|
||||
{
|
||||
this.E = objects[1];
|
||||
this.rl[4] = objects[1];
|
||||
}
|
||||
if (objects.length > 2)
|
||||
{
|
||||
this.F = objects[2];
|
||||
this.rl[5] = objects[2];
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
@ -176,14 +176,14 @@ public abstract class RecipeLoader
|
|||
{
|
||||
if (objects != null)
|
||||
{
|
||||
this.G = objects[0];
|
||||
this.rl[6] = objects[0];
|
||||
if (objects.length > 1)
|
||||
{
|
||||
this.H = objects[1];
|
||||
this.rl[7] = objects[1];
|
||||
}
|
||||
if (objects.length > 2)
|
||||
{
|
||||
this.I = objects[2];
|
||||
this.rl[8] = objects[2];
|
||||
}
|
||||
}
|
||||
return this;
|
||||
|
@ -209,98 +209,63 @@ public abstract class RecipeLoader
|
|||
|
||||
public ShapedOreRecipe getShapedRecipe()
|
||||
{
|
||||
//TODO convert items to their ore names
|
||||
ShapedOreRecipe re = null;
|
||||
Object[] recipe = null;
|
||||
String AA = "A";
|
||||
String BB = "B";
|
||||
String CC = "C";
|
||||
String DD = "D";
|
||||
String EE = "E";
|
||||
String FF = "F";
|
||||
String GG = "G";
|
||||
String HH = "H";
|
||||
String II = "I";
|
||||
if (A == null)
|
||||
String[] r = { "A", "B", "C", "D", "E", "F", "G", "H", "I" };
|
||||
|
||||
for (int i = 0; i < r.length; i++)
|
||||
{
|
||||
AA = " ";
|
||||
A = "";
|
||||
}
|
||||
if (B == null)
|
||||
{
|
||||
BB = " ";
|
||||
B = "";
|
||||
}
|
||||
if (C == null)
|
||||
{
|
||||
CC = " ";
|
||||
C = "";
|
||||
}
|
||||
if (D == null)
|
||||
{
|
||||
DD = " ";
|
||||
D = "";
|
||||
}
|
||||
if (E == null)
|
||||
{
|
||||
EE = " ";
|
||||
E = "";
|
||||
}
|
||||
if (F == null)
|
||||
{
|
||||
FF = " ";
|
||||
F = "";
|
||||
}
|
||||
if (G == null)
|
||||
{
|
||||
GG = " ";
|
||||
G = "";
|
||||
}
|
||||
if (H == null)
|
||||
{
|
||||
HH = " ";
|
||||
H = "";
|
||||
}
|
||||
if (I == null)
|
||||
{
|
||||
II = " ";
|
||||
I = "";
|
||||
if (this.rl[i] == null)
|
||||
{
|
||||
r[i] = " ";
|
||||
this.rl[i] = "";
|
||||
}
|
||||
else if (this.rl[i] instanceof ItemStack)
|
||||
{
|
||||
String s = OreDictionary.getOreName(OreDictionary.getOreID((ItemStack) this.rl[i]));
|
||||
if (s != null)
|
||||
{
|
||||
this.rl[i] = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (width == 3 && hight == 3)
|
||||
{
|
||||
recipe = new Object[] { AA + BB + CC, DD + EE + FF, GG + HH + II, 'A', A, 'B', B, 'C', C, 'D', D, 'E', E, 'F', F, 'G', G, 'H', H, 'I', I };
|
||||
recipe = new Object[] { r[0] + r[1] + r[2], r[3] + r[4] + r[5], r[6] + r[7] + r[8], 'A', rl[0], 'B', rl[1], 'C', rl[2], 'D', rl[3], 'E', rl[4], 'F', rl[5], 'G', rl[6], 'H', rl[7], 'I', rl[8] };
|
||||
}
|
||||
else if (width == 2 && hight == 3)
|
||||
{
|
||||
recipe = new Object[] { AA + BB, DD + EE, GG + HH, 'A', A, 'B', B, 'D', D, 'E', E, 'G', G, 'H', H };
|
||||
recipe = new Object[] { r[0] + r[1], r[3] + r[4], r[6] + r[7], 'A', rl[0], 'B', rl[1], 'D', rl[3], 'E', rl[4], 'G', rl[6], 'H', rl[7] };
|
||||
}
|
||||
else if (width == 3 && hight == 2)
|
||||
{
|
||||
recipe = new Object[] { AA + BB + CC, DD + EE + FF, 'A', A, 'B', B, 'C', C, 'D', D, 'E', E, 'F', F };
|
||||
recipe = new Object[] { r[0] + r[1] + r[2], r[3] + r[4] + r[5], 'A', rl[0], 'B', rl[1], 'C', rl[2], 'D', rl[3], 'E', rl[4], 'F', rl[5] };
|
||||
}
|
||||
else if (width == 1 && hight == 3)
|
||||
{
|
||||
recipe = new Object[] { AA, DD, GG, 'A', A, 'D', D, 'G', G };
|
||||
recipe = new Object[] { r[0], r[3], r[6], 'A', rl[0], 'D', rl[3], 'G', rl[6] };
|
||||
}
|
||||
else if (width == 3 && hight == 1)
|
||||
{
|
||||
recipe = new Object[] { AA + BB + CC, 'A', A, 'B', B, 'C', C };
|
||||
recipe = new Object[] { r[0] + r[1] + r[2], 'A', rl[0], 'B', rl[1], 'C', rl[2] };
|
||||
}
|
||||
else if (width == 2 && hight == 2)
|
||||
{
|
||||
recipe = new Object[] { AA + BB, DD + EE, 'A', A, 'B', B, 'D', D, 'E', E };
|
||||
recipe = new Object[] { r[0] + r[1], r[3] + r[4], 'A', rl[0], 'B', rl[1], 'D', rl[2], 'E', rl[4] };
|
||||
}
|
||||
else if (width == 1 && hight == 2)
|
||||
{
|
||||
recipe = new Object[] { AA, DD, 'A', A, 'D', D, };
|
||||
recipe = new Object[] { r[0], r[3], 'A', rl[0], 'D', rl[3], };
|
||||
}
|
||||
else if (width == 2 && hight == 1)
|
||||
{
|
||||
recipe = new Object[] { AA + BB, 'A', A, 'B', B, };
|
||||
recipe = new Object[] { r[0] + r[1], 'A', rl[0], 'B', rl[1], };
|
||||
}
|
||||
else if (width == 1 && hight == 1)
|
||||
{
|
||||
recipe = new Object[] { AA, 'A', A };
|
||||
recipe = new Object[] { r[0], 'A', rl[0] };
|
||||
}
|
||||
if (recipe != null)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue