2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/ShapelessRecipes.java
|
|
|
|
+++ b/net/minecraft/server/ShapelessRecipes.java
|
2017-05-30 13:25:59 +02:00
|
|
|
@@ -6,12 +6,24 @@
|
2017-05-19 13:00:13 +02:00
|
|
|
import com.google.gson.JsonParseException;
|
2017-05-14 04:00:00 +02:00
|
|
|
import java.util.ArrayList;
|
2016-11-17 02:41:03 +01:00
|
|
|
import java.util.Iterator;
|
2014-11-25 22:32:16 +01:00
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
|
|
|
+import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
|
|
|
|
+// CraftBukkit end
|
2017-05-14 04:00:00 +02:00
|
|
|
|
2017-05-30 13:25:59 +02:00
|
|
|
public class ShapelessRecipes implements IRecipe {
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2017-05-30 13:25:59 +02:00
|
|
|
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 @@
|
2017-05-14 04:00:00 +02:00
|
|
|
this.ingredients = nonnulllist;
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
|
+ public org.bukkit.inventory.ShapelessRecipe toBukkitRecipe() {
|
|
|
|
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
|
|
|
+ CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
|
2017-05-14 04:00:00 +02:00
|
|
|
+ for (RecipeItemStack list : this.ingredients) {
|
|
|
|
+ if (list != null) {
|
|
|
|
+ net.minecraft.server.ItemStack stack = list.choices[0];
|
2017-06-14 23:23:08 +02:00
|
|
|
+ recipe.addIngredient(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), (list.choices.length) > 1 ? 32767 : stack.getData());
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return recipe;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2015-02-26 23:41:06 +01:00
|
|
|
+
|
2014-11-25 22:32:16 +01:00
|
|
|
public ItemStack b() {
|
|
|
|
return this.result;
|
2016-11-17 02:41:03 +01:00
|
|
|
}
|