diff options
author | Celtic Minstrel <celtic.minstrel.ca@some.place> | 2011-07-23 23:16:14 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-02-21 04:24:24 -0500 |
commit | 326091c130657294157d137895663ad2924c0b95 (patch) | |
tree | cffe921828633ddb7a2da5b0dc209740380cd32a /src/main/java/net/minecraft/server/ShapelessRecipes.java | |
parent | 84ecdb5439ef5633c44b1ea0581174bf581b4969 (diff) | |
download | craftbukkit-326091c130657294157d137895663ad2924c0b95.tar craftbukkit-326091c130657294157d137895663ad2924c0b95.tar.gz craftbukkit-326091c130657294157d137895663ad2924c0b95.tar.lz craftbukkit-326091c130657294157d137895663ad2924c0b95.tar.xz craftbukkit-326091c130657294157d137895663ad2924c0b95.zip |
[Bleeding] Recipe API improvements and fixes. Addresses BUKKIT-738 and BUKKIT-624
Add a recipe iterator to make it possible to retrieve and remove recipes (BUKKIT-738), and updated the recipe classes to not clip the data to 127 (BUKKIT-624)
Diffstat (limited to 'src/main/java/net/minecraft/server/ShapelessRecipes.java')
-rw-r--r-- | src/main/java/net/minecraft/server/ShapelessRecipes.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java index d38896a4..bea33ccf 100644 --- a/src/main/java/net/minecraft/server/ShapelessRecipes.java +++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java @@ -4,6 +4,12 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +// CraftBukkit start +import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe; +import org.bukkit.inventory.ShapelessRecipe; +// CraftBukkit end + public class ShapelessRecipes implements CraftingRecipe { private final ItemStack a; @@ -14,6 +20,20 @@ public class ShapelessRecipes implements CraftingRecipe { this.b = list; } + // CraftBukkit start + @SuppressWarnings("unchecked") + public ShapelessRecipe toBukkitRecipe() { + CraftItemStack result = new CraftItemStack(this.a); + CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this); + for (ItemStack stack : (List<ItemStack>) this.b) { + if (stack != null) { + recipe.addIngredient(org.bukkit.Material.getMaterial(stack.id), stack.getData()); + } + } + return recipe; + } + // CraftBukkit end + public ItemStack b() { return this.a; } |