mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 22:14:40 +01:00
43 lines
1.5 KiB
Diff
43 lines
1.5 KiB
Diff
--- a/net/minecraft/server/ShapelessRecipes.java
|
|
+++ b/net/minecraft/server/ShapelessRecipes.java
|
|
@@ -5,6 +5,13 @@
|
|
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.CraftShapelessRecipe;
|
|
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
|
+// CraftBukkit end
|
|
|
|
public class ShapelessRecipes implements IRecipe {
|
|
|
|
@@ -20,6 +27,26 @@
|
|
this.ingredients = nonnulllist;
|
|
}
|
|
|
|
+ // CraftBukkit start
|
|
+ @SuppressWarnings("unchecked")
|
|
+ public org.bukkit.inventory.ShapelessRecipe toBukkitRecipe() {
|
|
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
|
+ CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
|
|
+ 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));
|
|
+ }
|
|
+ return recipe;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public MinecraftKey getKey() {
|
|
return this.key;
|
|
}
|