summaryrefslogtreecommitdiffstats
path: root/nms-patches/ShapedRecipes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/ShapedRecipes.patch')
-rw-r--r--nms-patches/ShapedRecipes.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/nms-patches/ShapedRecipes.patch b/nms-patches/ShapedRecipes.patch
new file mode 100644
index 00000000..5b3908ce
--- /dev/null
+++ b/nms-patches/ShapedRecipes.patch
@@ -0,0 +1,77 @@
+--- ../work/decompile-bb26c12b/net/minecraft/server/ShapedRecipes.java 2014-11-27 08:59:46.889421019 +1100
++++ src/main/java/net/minecraft/server/ShapedRecipes.java 2014-11-27 08:42:10.164850887 +1100
+@@ -1,5 +1,11 @@
+ package net.minecraft.server;
+
++// CraftBukkit start
++import org.bukkit.craftbukkit.inventory.CraftItemStack;
++import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
++// CraftBukkit end
++
++
+ public class ShapedRecipes implements IRecipe {
+
+ private final int width;
+@@ -14,6 +20,62 @@
+ this.items = aitemstack;
+ this.result = itemstack;
+ }
++
++ // CraftBukkit start
++ public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
++ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
++ CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
++ switch (this.height) {
++ case 1:
++ switch (this.width) {
++ case 1:
++ recipe.shape("a");
++ break;
++ case 2:
++ recipe.shape("ab");
++ break;
++ case 3:
++ recipe.shape("abc");
++ break;
++ }
++ break;
++ case 2:
++ switch (this.width) {
++ case 1:
++ recipe.shape("a","b");
++ break;
++ case 2:
++ recipe.shape("ab","cd");
++ break;
++ case 3:
++ recipe.shape("abc","def");
++ break;
++ }
++ break;
++ case 3:
++ switch (this.width) {
++ case 1:
++ recipe.shape("a","b","c");
++ break;
++ case 2:
++ recipe.shape("ab","cd","ef");
++ break;
++ case 3:
++ recipe.shape("abc","def","ghi");
++ break;
++ }
++ break;
++ }
++ char c = 'a';
++ for (ItemStack stack : this.items) {
++ if (stack != null) {
++ recipe.setIngredient(c, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getData());
++ }
++ c++;
++ }
++ return recipe;
++ }
++ // CraftBukkit end
+
+ public ItemStack b() {
+ return this.result;