1
0
forked from xjboss/KCauldronX
KCauldronX/patches/net/minecraft/item/crafting/ShapelessRecipes.java.patch
2015-03-22 20:38:04 +03:00

41 lines
1.3 KiB
Diff

--- ../src-base/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java
+++ ../src-work/minecraft/net/minecraft/item/crafting/ShapelessRecipes.java
@@ -7,6 +7,11 @@
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
+// CraftBukkit end
+
public class ShapelessRecipes implements IRecipe
{
private final ItemStack recipeOutput;
@@ -19,6 +24,25 @@
this.recipeItems = p_i1918_2_;
}
+ // CraftBukkit start
+ @SuppressWarnings("unchecked")
+ public org.bukkit.inventory.ShapelessRecipe toBukkitRecipe()
+ {
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.recipeOutput);
+ CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
+
+ for (ItemStack stack : (List<ItemStack>) this.recipeItems)
+ {
+ if (stack != null)
+ {
+ recipe.addIngredient(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(stack.getItem()), stack.getItemDamage());
+ }
+ }
+
+ return recipe;
+ }
+ // CraftBukkit end
+
public ItemStack getRecipeOutput()
{
return this.recipeOutput;