Spilt Writing of Enchantments to seperate class
Created a new class cEnchantmentSerializer to serilize Enchantments to NBT. This breaks a dependecy chain between cChunkGenerator and cWorld. cEnchantmentSerializer is seperate from NBTWriter as it needs to access private members of cEnchantments so having it seperate reduces the spread of the frein modifier
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "Globals.h"
|
||||
#include "NBTChunkSerializer.h"
|
||||
#include "EnchantmentSerializer.h"
|
||||
#include "../BlockID.h"
|
||||
#include "../ItemGrid.h"
|
||||
#include "../StringCompression.h"
|
||||
@@ -91,7 +92,7 @@ void cNBTChunkSerializer::AddItem(const cItem & a_Item, int a_Slot, const AStrin
|
||||
{
|
||||
const char * TagName = (a_Item.m_ItemType == E_ITEM_BOOK) ? "StoredEnchantments" : "ench";
|
||||
m_Writer.BeginCompound("tag");
|
||||
a_Item.m_Enchantments.WriteToNBTCompound(m_Writer, TagName);
|
||||
cEnchantmentSerializer::WriteToNBTCompound(a_Item.m_Enchantments, m_Writer, TagName);
|
||||
m_Writer.EndCompound();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user