From 525b79b4b5bde8c12b36279773be7e2f67bdc1ad Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 1 Jun 2013 16:34:38 +1000 Subject: [PATCH] Recipe Deconstruction Some non API methods contributed by Asphodan to allow recipe deconstruction. diff --git a/src/main/java/net/minecraft/server/IRecipe.java b/src/main/java/net/minecraft/server/IRecipe.java index babf604..e7aba17 100644 --- a/src/main/java/net/minecraft/server/IRecipe.java +++ b/src/main/java/net/minecraft/server/IRecipe.java @@ -13,4 +13,6 @@ public interface IRecipe { ItemStack[] b(InventoryCrafting inventorycrafting); org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit + + java.util.List getIngredients(); // Spigot } diff --git a/src/main/java/net/minecraft/server/ShapedRecipes.java b/src/main/java/net/minecraft/server/ShapedRecipes.java index a387e2d..825b6d9 100644 --- a/src/main/java/net/minecraft/server/ShapedRecipes.java +++ b/src/main/java/net/minecraft/server/ShapedRecipes.java @@ -10,7 +10,7 @@ public class ShapedRecipes implements IRecipe { private final int width; private final int height; private final ItemStack[] items; - private final ItemStack result; + public ItemStack result; // Spigot private boolean e; public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) { @@ -165,4 +165,11 @@ public class ShapedRecipes implements IRecipe { public int a() { return this.width * this.height; } + + // Spigot start + public java.util.List getIngredients() + { + return java.util.Arrays.asList( items ); + } + // Spigot end } diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java index b13dcb7..aa0e9aa 100644 --- a/src/main/java/net/minecraft/server/ShapelessRecipes.java +++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java @@ -12,7 +12,7 @@ import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe; public class ShapelessRecipes implements IRecipe { - private final ItemStack result; + public final ItemStack result; // Spigot private final List ingredients; public ShapelessRecipes(ItemStack itemstack, List list) { @@ -90,4 +90,11 @@ public class ShapelessRecipes implements IRecipe { public int a() { return this.ingredients.size(); } + + // Spigot start + public java.util.List getIngredients() + { + return java.util.Collections.unmodifiableList( ingredients ); + } + // Spigot end } -- 2.1.4