diff options
author | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-11-28 05:17:05 +0000 |
---|---|---|
committer | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-11-28 05:17:05 +0000 |
commit | fe3756f7a016b6d4013f024ba1eb7d8e70f42e3b (patch) | |
tree | 7de6b7ae0074f879754cc4f5bc5ab315a2f70ae5 /src | |
parent | 99771b7b7296553374d3f60f0b3e3c6d0ea22ae6 (diff) | |
download | craftbukkit-fe3756f7a016b6d4013f024ba1eb7d8e70f42e3b.tar craftbukkit-fe3756f7a016b6d4013f024ba1eb7d8e70f42e3b.tar.gz craftbukkit-fe3756f7a016b6d4013f024ba1eb7d8e70f42e3b.tar.lz craftbukkit-fe3756f7a016b6d4013f024ba1eb7d8e70f42e3b.tar.xz craftbukkit-fe3756f7a016b6d4013f024ba1eb7d8e70f42e3b.zip |
Fixed Enchantments being lost on inventory.setItem
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java | 4 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index ae0c1f53..f1d21afa 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -53,13 +53,13 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { if (item == null || item.getTypeId() <= 0) { mcItems[i] = null; } else { - mcItems[i] = new net.minecraft.server.ItemStack(item.getTypeId(), item.getAmount(), item.getDurability()); + mcItems[i] = CraftItemStack.createNMSItemStack(item); } } } public void setItem(int index, ItemStack item) { - getInventory().setItem(index, (item == null ? null : new net.minecraft.server.ItemStack(item.getTypeId(), item.getAmount(), item.getDurability()))); + getInventory().setItem(index, (item == null ? null : CraftItemStack.createNMSItemStack(item))); } public boolean contains(int materialId) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index e94bf891..9ee0a3fe 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -207,4 +207,8 @@ public class CraftItemStack extends ItemStack { public net.minecraft.server.ItemStack getHandle() { return item; } + + public static net.minecraft.server.ItemStack createNMSItemStack(ItemStack original) { + return new CraftItemStack(original).getHandle(); + } } |