summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/bukkit/inventory/ShapedRecipe.java6
-rw-r--r--src/main/java/org/bukkit/inventory/ShapelessRecipe.java5
2 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/inventory/ShapedRecipe.java b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
index 4d057ae0..9156621f 100644
--- a/src/main/java/org/bukkit/inventory/ShapedRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapedRecipe.java
@@ -96,6 +96,12 @@ public class ShapedRecipe implements Recipe {
*/
public ShapedRecipe setIngredient(char key, Material ingredient, int raw) {
Validate.isTrue(ingredients.containsKey(key), "Symbol does not appear in the shape:", key);
+
+ // -1 is the old wildcard, map to Short.MAX_VALUE as the new one
+ if (raw == -1) {
+ raw = Short.MAX_VALUE;
+ }
+
ingredients.put(key, new ItemStack(ingredient, 1, (short) raw));
return this;
}
diff --git a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
index 2263043f..c296e3a2 100644
--- a/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
+++ b/src/main/java/org/bukkit/inventory/ShapelessRecipe.java
@@ -97,6 +97,11 @@ public class ShapelessRecipe implements Recipe {
public ShapelessRecipe addIngredient(int count, Material ingredient, int rawdata) {
Validate.isTrue(ingredients.size() + count <= 9, "Shapeless recipes cannot have more than 9 ingredients");
+ // -1 is the old wildcard, map to Short.MAX_VALUE as the new one
+ if (rawdata == -1) {
+ rawdata = Short.MAX_VALUE;
+ }
+
while (count-- > 0) {
ingredients.add(new ItemStack(ingredient, 1, (short) rawdata));
}