--- a/net/minecraft/server/ShapedRecipes.java
+++ b/net/minecraft/server/ShapedRecipes.java
@@ -1,6 +1,10 @@
package net.minecraft.server;
import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
+// CraftBukkit end
public class ShapedRecipes implements IRecipe {
@@ -17,6 +21,62 @@
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) {
+ recipe.shape("a");
+ break;
+ case 2:
+ recipe.shape("ab");
+ case 3:
+ recipe.shape("abc");
+ }
+ recipe.shape("a","b");
+ recipe.shape("ab","cd");
+ recipe.shape("abc","def");
+ recipe.shape("a","b","c");
+ recipe.shape("ab","cd","ef");
+ recipe.shape("abc","def","ghi");
+ 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
+
@Nullable
public ItemStack b() {
return this.result;