SPIGOT-3337: Use special data value to indicate multiple recipe choices

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2017-06-15 07:23:08 +10:00
parent 3770ac47cf
commit eb7eb4ba47
2 changed files with 2 additions and 2 deletions

View File

@@ -79,7 +79,7 @@
+ for (RecipeItemStack list : this.items) { + for (RecipeItemStack list : this.items) {
+ if (list != null && list.choices.length > 0) { + if (list != null && list.choices.length > 0) {
+ net.minecraft.server.ItemStack stack = list.choices[0]; + net.minecraft.server.ItemStack stack = list.choices[0];
+ recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getData()); + recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), (list.choices.length) > 1 ? 32767 : stack.getData());
+ } + }
+ c++; + c++;
+ } + }

View File

@@ -37,7 +37,7 @@
+ for (RecipeItemStack list : this.ingredients) { + for (RecipeItemStack list : this.ingredients) {
+ if (list != null) { + if (list != null) {
+ net.minecraft.server.ItemStack stack = list.choices[0]; + net.minecraft.server.ItemStack stack = list.choices[0];
+ recipe.addIngredient(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getData()); + recipe.addIngredient(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), (list.choices.length) > 1 ? 32767 : stack.getData());
+ } + }
+ } + }
+ return recipe; + return recipe;