mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 04:55:47 +01:00
50 lines
1.7 KiB
Diff
50 lines
1.7 KiB
Diff
--- a/net/minecraft/server/ShapelessRecipes.java
|
|
+++ b/net/minecraft/server/ShapelessRecipes.java
|
|
@@ -6,12 +6,24 @@
|
|
import com.google.gson.JsonParseException;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
+import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
|
|
+// CraftBukkit end
|
|
|
|
public class ShapelessRecipes implements IRecipe {
|
|
|
|
private final ItemStack result;
|
|
private final NonNullList<RecipeItemStack> ingredients;
|
|
private final String c;
|
|
+ // CraftBukkit start
|
|
+ public MinecraftKey key;
|
|
+
|
|
+ @Override
|
|
+ public void setKey(MinecraftKey key) {
|
|
+ this.key = key;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
|
|
public ShapelessRecipes(String s, ItemStack itemstack, NonNullList<RecipeItemStack> nonnulllist) {
|
|
this.c = s;
|
|
@@ -19,6 +31,21 @@
|
|
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);
|
|
+ for (RecipeItemStack list : this.ingredients) {
|
|
+ if (list != null) {
|
|
+ net.minecraft.server.ItemStack stack = list.choices[0];
|
|
+ recipe.addIngredient(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), (list.choices.length) > 1 ? 32767 : stack.getData());
|
|
+ }
|
|
+ }
|
|
+ return recipe;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public ItemStack b() {
|
|
return this.result;
|
|
}
|