Add RecipeChoice.ExactChoice API for NBT matches on ingredients
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -1,20 +1,18 @@
|
||||
--- a/net/minecraft/server/ShapelessRecipes.java
|
||||
+++ b/net/minecraft/server/ShapelessRecipes.java
|
||||
@@ -5,6 +5,13 @@
|
||||
@@ -5,6 +5,11 @@
|
||||
import com.google.gson.JsonParseException;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import java.util.Iterator;
|
||||
+// CraftBukkit start
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
|
||||
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class ShapelessRecipes implements IRecipe {
|
||||
|
||||
@@ -20,6 +27,26 @@
|
||||
@@ -20,6 +25,20 @@
|
||||
this.ingredients = nonnulllist;
|
||||
}
|
||||
|
||||
@@ -26,13 +24,7 @@
|
||||
+ recipe.setGroup(this.group);
|
||||
+
|
||||
+ for (RecipeItemStack list : this.ingredients) {
|
||||
+ list.buildChoices();
|
||||
+
|
||||
+ List<org.bukkit.Material> choices = new ArrayList<>(list.choices.length);
|
||||
+ for (ItemStack i : list.choices) {
|
||||
+ choices.add(CraftMagicNumbers.getMaterial(i.getItem()));
|
||||
+ }
|
||||
+ recipe.addIngredient(new org.bukkit.inventory.RecipeChoice.MaterialChoice(choices));
|
||||
+ recipe.addIngredient(CraftRecipe.toBukkit(list));
|
||||
+ }
|
||||
+ return recipe;
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user