diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-02 23:21:32 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-02 23:21:32 +0200 |
commit | 73f787feb328ffe349d803ca01363ba57178760b (patch) | |
tree | f3be3b285756e5d56aa602924dd4eee0db14735d /source/WorldStorage | |
parent | Shift + click doesn't "destroy" item enchantment (diff) | |
download | cuberite-73f787feb328ffe349d803ca01363ba57178760b.tar cuberite-73f787feb328ffe349d803ca01363ba57178760b.tar.gz cuberite-73f787feb328ffe349d803ca01363ba57178760b.tar.bz2 cuberite-73f787feb328ffe349d803ca01363ba57178760b.tar.lz cuberite-73f787feb328ffe349d803ca01363ba57178760b.tar.xz cuberite-73f787feb328ffe349d803ca01363ba57178760b.tar.zst cuberite-73f787feb328ffe349d803ca01363ba57178760b.zip |
Diffstat (limited to 'source/WorldStorage')
-rw-r--r-- | source/WorldStorage/WSSAnvil.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/WorldStorage/WSSAnvil.cpp b/source/WorldStorage/WSSAnvil.cpp index 14b87670d..1b70083c2 100644 --- a/source/WorldStorage/WSSAnvil.cpp +++ b/source/WorldStorage/WSSAnvil.cpp @@ -615,7 +615,22 @@ bool cWSSAnvil::LoadItemFromNBT(cItem & a_Item, const cParsedNBT & a_NBT, int a_ } a_Item.m_ItemCount = a_NBT.GetByte(Count); - // TODO: enchantments and other item properties + // Find the "tag" tag, used for enchantments and other extra data + int TagTag = a_NBT.FindChildByName(a_TagIdx, "tag"); + if (TagTag <= 0) + { + // No extra data + return true; + } + + // Load enchantments: + const char * EnchName = (a_Item.m_ItemType == E_ITEM_BOOK) ? "StoredEnchantments" : "ench"; + int EnchTag = a_NBT.FindChildByName(TagTag, EnchName); + if (EnchTag > 0) + { + a_Item.m_Enchantments.ParseFromNBT(a_NBT, EnchTag); + } + return true; } |