mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
Map old wildcard recipe data to new 1.5 value. Fixes BUKKIT-3849
By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
parent
d347286b22
commit
0dc86a08f3
2 changed files with 11 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue