-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
…ssue 210
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,22 +21,30 @@ public class ShapedOreRecipe implements IRecipe | |
private Object[] input = null; | ||
private int width = 0; | ||
private int height = 0; | ||
private boolean mirriored = true; | ||
private boolean mirrored = true; | ||
|
||
public ShapedOreRecipe(Block result, Object... recipe){ this(result, true, recipe);} | ||
public ShapedOreRecipe(Item result, Object... recipe){ this(result, true, recipe); } | ||
public ShapedOreRecipe(ItemStack result, Object... recipe){ this(result, true, recipe); } | ||
public ShapedOreRecipe(Block result, boolean mirrior, Object... recipe){ this(new ItemStack(result), mirrior, recipe);} | ||
public ShapedOreRecipe(Item result, boolean mirrior, Object... recipe){ this(new ItemStack(result), mirrior, recipe); } | ||
|
||
public ShapedOreRecipe(ItemStack result, boolean mirrior, Object... recipe) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
LexManos
Author
Member
|
||
public ShapedOreRecipe(Block result, Object... recipe){ this(new ItemStack(result), recipe); } | ||
public ShapedOreRecipe(Item result, Object... recipe){ this(new ItemStack(result), recipe); } | ||
public ShapedOreRecipe(ItemStack result, Object... recipe) | ||
{ | ||
output = result.copy(); | ||
mirriored = mirrior; | ||
|
||
|
||
String shape = ""; | ||
int idx = 0; | ||
|
||
if (recipe[idx] instanceof Boolean) | ||
{ | ||
mirrored = (Boolean)recipe[idx]; | ||
if (recipe[idx+1] instanceof Object[]) | ||
{ | ||
recipe = (Object[])recipe[idx+1]; | ||
} | ||
else | ||
{ | ||
idx = 1; | ||
} | ||
} | ||
|
||
if (recipe[idx] instanceof String[]) | ||
{ | ||
String[] parts = ((String[])recipe[idx++]); | ||
|
@@ -59,7 +67,7 @@ public ShapedOreRecipe(ItemStack result, boolean mirrior, Object... recipe) | |
height++; | ||
} | ||
} | ||
|
||
if (width * height != shape.length()) | ||
{ | ||
String ret = "Invalid shaped ore recipe: "; | ||
|
@@ -136,7 +144,7 @@ public boolean matches(InventoryCrafting inv, World world) | |
return true; | ||
} | ||
|
||
if (mirriored && checkMatch(inv, x, y, false)) | ||
if (mirrored && checkMatch(inv, x, y, false)) | ||
{ | ||
return true; | ||
} | ||
|
@@ -146,7 +154,7 @@ public boolean matches(InventoryCrafting inv, World world) | |
return false; | ||
} | ||
|
||
private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirrior) | ||
private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror) | ||
{ | ||
for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) | ||
{ | ||
|
@@ -158,7 +166,7 @@ private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolea | |
|
||
if (subX >= 0 && subY >= 0 && subX < width && subY < height) | ||
{ | ||
if (mirrior) | ||
if (mirror) | ||
{ | ||
target = input[width - subX - 1 + subY * width]; | ||
} | ||
|
@@ -210,8 +218,9 @@ private boolean checkItemEquals(ItemStack target, ItemStack input) | |
return (target.itemID == input.itemID && (target.getItemDamage() == -1 || target.getItemDamage() == input.getItemDamage())); | ||
} | ||
|
||
public void setMirriored(boolean mirrior) | ||
public ShapedOreRecipe setMirrored(boolean mirror) | ||
This comment has been minimized.
Sorry, something went wrong.
celestefox
|
||
{ | ||
mirriored = mirrior; | ||
mirrored = mirror; | ||
return this; | ||
} | ||
} |
Should some comments, now the fact that you can mirror the recipe in the constructor has been obfuscated.