1
0

Enchantments are now stored in Anvil world and in player inventory

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1541 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2013-06-02 21:21:32 +00:00
parent 098c237a39
commit 73f787feb3
5 changed files with 42 additions and 8 deletions

View File

@@ -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;
}