void cEnchantments::WriteToNBTCompound(cFastNBTWriter & a_Writer, const AString & a_ListTagName) const { // Write the enchantments into the specified NBT writer // begin with the LIST tag of the specified name ("ench" or "StoredEnchantments") a_Writer.BeginList(a_ListTagName, TAG_Compound); for (cMap::const_iterator itr = m_Enchantments.begin(), end = m_Enchantments.end(); itr != end; ++itr) { a_Writer.BeginCompound(""); a_Writer.AddShort("id", itr->first); a_Writer.AddShort("lvl", itr->second); a_Writer.EndCompound(); } // for itr - m_Enchantments[] a_Writer.EndList(); }
void cMapSerializer::SaveMapToNBT(cFastNBTWriter & a_Writer) { a_Writer.BeginCompound("data"); a_Writer.AddByte("scale", m_Map->GetScale()); a_Writer.AddByte("dimension", (int) m_Map->GetDimension()); a_Writer.AddShort("width", m_Map->GetWidth()); a_Writer.AddShort("height", m_Map->GetHeight()); a_Writer.AddInt("xCenter", m_Map->GetCenterX()); a_Writer.AddInt("zCenter", m_Map->GetCenterZ()); const cMap::cColorList & Data = m_Map->GetData(); a_Writer.AddByteArray("colors", (char *)Data.data(), Data.size()); a_Writer.EndCompound(); }