diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-02-27 00:29:14 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-02-27 00:33:52 +0100 |
commit | baf2d8892127cd6da9d2f6f2f8d991d617c87800 (patch) | |
tree | 2f3c2f8d3d9e2659f068e78017a934c195ba77f2 /src/WorldStorage/NBTChunkSerializer.cpp | |
parent | Fixed a gcc warning in FastNBT.h. (diff) | |
download | cuberite-baf2d8892127cd6da9d2f6f2f8d991d617c87800.tar cuberite-baf2d8892127cd6da9d2f6f2f8d991d617c87800.tar.gz cuberite-baf2d8892127cd6da9d2f6f2f8d991d617c87800.tar.bz2 cuberite-baf2d8892127cd6da9d2f6f2f8d991d617c87800.tar.lz cuberite-baf2d8892127cd6da9d2f6f2f8d991d617c87800.tar.xz cuberite-baf2d8892127cd6da9d2f6f2f8d991d617c87800.tar.zst cuberite-baf2d8892127cd6da9d2f6f2f8d991d617c87800.zip |
Diffstat (limited to 'src/WorldStorage/NBTChunkSerializer.cpp')
-rw-r--r-- | src/WorldStorage/NBTChunkSerializer.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp index c1c659b36..6d82cba86 100644 --- a/src/WorldStorage/NBTChunkSerializer.cpp +++ b/src/WorldStorage/NBTChunkSerializer.cpp @@ -90,11 +90,19 @@ void cNBTChunkSerializer::AddItem(const cItem & a_Item, int a_Slot, const AStrin } // Write the enchantments: - if (!a_Item.m_Enchantments.IsEmpty()) + if (!a_Item.m_Enchantments.IsEmpty() || ((a_Item.m_ItemType == E_ITEM_FIREWORK_ROCKET) || (a_Item.m_ItemType == E_ITEM_FIREWORK_STAR))) { - const char * TagName = (a_Item.m_ItemType == E_ITEM_BOOK) ? "StoredEnchantments" : "ench"; m_Writer.BeginCompound("tag"); - EnchantmentSerializer::WriteToNBTCompound(a_Item.m_Enchantments, m_Writer, TagName); + if ((a_Item.m_ItemType == E_ITEM_FIREWORK_ROCKET) || (a_Item.m_ItemType == E_ITEM_FIREWORK_STAR)) + { + cFireworkItem::WriteToNBTCompound(a_Item.m_FireworkItem, m_Writer, (ENUM_ITEM_ID)a_Item.m_ItemType); + } + + if (!a_Item.m_Enchantments.IsEmpty()) + { + const char * TagName = (a_Item.m_ItemType == E_ITEM_BOOK) ? "StoredEnchantments" : "ench"; + EnchantmentSerializer::WriteToNBTCompound(a_Item.m_Enchantments, m_Writer, TagName); + } m_Writer.EndCompound(); } |