diff options
author | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-11-27 02:45:34 +0000 |
---|---|---|
committer | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-11-27 02:45:34 +0000 |
commit | 894ab9f949190ab912d75d4b88a8e5ccc7213def (patch) | |
tree | 16c8849527978a43298aab2d9580f4a7864fb667 /src | |
parent | 139ad8c34aada3da55a16b6dd8058b02fcbb42c4 (diff) | |
download | craftbukkit-894ab9f949190ab912d75d4b88a8e5ccc7213def.tar craftbukkit-894ab9f949190ab912d75d4b88a8e5ccc7213def.tar.gz craftbukkit-894ab9f949190ab912d75d4b88a8e5ccc7213def.tar.lz craftbukkit-894ab9f949190ab912d75d4b88a8e5ccc7213def.tar.xz craftbukkit-894ab9f949190ab912d75d4b88a8e5ccc7213def.zip |
Fixed issue with enchantments reseting under certain conditions
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 9 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java | 5 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 86e0e25c..50454eb0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -37,6 +37,7 @@ import org.bukkit.block.Biome; import org.bukkit.generator.BlockPopulator; import org.bukkit.Difficulty; import org.bukkit.craftbukkit.block.CraftBlock; +import org.bukkit.craftbukkit.inventory.CraftItemStack; public class CraftWorld implements World { private final WorldServer world; @@ -290,12 +291,8 @@ public class CraftWorld implements World { } public org.bukkit.entity.Item dropItem(Location loc, ItemStack item) { - net.minecraft.server.ItemStack stack = new net.minecraft.server.ItemStack( - item.getTypeId(), - item.getAmount(), - item.getDurability() - ); - EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), stack); + CraftItemStack clone = new CraftItemStack(item); + EntityItem entity = new EntityItem(world, loc.getX(), loc.getY(), loc.getZ(), clone.getHandle()); entity.pickupDelay = 10; world.addEntity(entity); // TODO this is inconsistent with how Entity.getBukkitEntity() works. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 1f22ea48..caf9007a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -26,6 +26,7 @@ public class CraftItemStack extends ItemStack { public CraftItemStack(ItemStack item) { this(item.getTypeId(), item.getAmount(), item.getDurability()); + addEnchantments(item.getEnchantments()); } /* 'Overwritten' constructors from ItemStack, yay for Java sucking */ @@ -202,4 +203,8 @@ public class CraftItemStack extends ItemStack { tag.a("ench", (NBTBase)list); } + + public net.minecraft.server.ItemStack getHandle() { + return item; + } } |