From 7076ef9de64e303f97915ec3e10494adb34a803f Mon Sep 17 00:00:00 2001 From: Mushroom Hostage Date: Fri, 10 Feb 2012 18:13:24 -0800 Subject: [PATCH] Use createNMSItemStack on CraftingManager recipe registration. Fixes BUKKIT-602 --- .../bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java | 6 +----- .../org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java | 5 +---- .../bukkit/craftbukkit/inventory/CraftShapelessRecipe.java | 5 +---- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java index 5b5e02d193..5afab7d81a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftFurnaceRecipe.java @@ -24,11 +24,7 @@ public class CraftFurnaceRecipe extends FurnaceRecipe implements CraftRecipe { } public void addToCraftingManager() { - ItemStack result = this.getResult(); MaterialData input = this.getInput(); - int id = result.getTypeId(); - int amount = result.getAmount(); - int dmg = result.getDurability(); - FurnaceRecipes.getInstance().registerRecipe(input.getItemTypeId(), new net.minecraft.server.ItemStack(id, amount, dmg)); + FurnaceRecipes.getInstance().registerRecipe(input.getItemTypeId(), CraftItemStack.createNMSItemStack(this.getResult())); } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java index ea63b33da0..3af12516de 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java @@ -46,9 +46,6 @@ public class CraftShapedRecipe extends ShapedRecipe implements CraftRecipe { data[i] = new net.minecraft.server.ItemStack(id, 1, dmg); i++; } - int id = this.getResult().getTypeId(); - int amount = this.getResult().getAmount(); - short durability = this.getResult().getDurability(); - CraftingManager.getInstance().registerShapedRecipe(new net.minecraft.server.ItemStack(id, amount, durability), data); + CraftingManager.getInstance().registerShapedRecipe(CraftItemStack.createNMSItemStack(this.getResult()), data); } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java index d2f6d4cfd7..cef7187c92 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java @@ -34,9 +34,6 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe data[i] = new net.minecraft.server.ItemStack(id, 1, dmg); i++; } - int id = this.getResult().getTypeId(); - int amount = this.getResult().getAmount(); - short durability = this.getResult().getDurability(); - CraftingManager.getInstance().registerShapelessRecipe(new net.minecraft.server.ItemStack(id, amount, durability), data); + CraftingManager.getInstance().registerShapelessRecipe(CraftItemStack.createNMSItemStack(this.getResult()), data); } }