From e14ddff1c00919f1416bfa6da9568e2dff419559 Mon Sep 17 00:00:00 2001 From: Tycho Date: Sun, 19 Jan 2014 07:38:59 -0800 Subject: 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 --- src/WorldStorage/EnchantmentSerializer.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/WorldStorage/EnchantmentSerializer.h (limited to 'src/WorldStorage/EnchantmentSerializer.h') diff --git a/src/WorldStorage/EnchantmentSerializer.h b/src/WorldStorage/EnchantmentSerializer.h new file mode 100644 index 000000000..d616b0f62 --- /dev/null +++ b/src/WorldStorage/EnchantmentSerializer.h @@ -0,0 +1,17 @@ + +#pragma once + +#include "Enchantments.h" + +class cEnchantmentSerializer +{ + +public: + + /// Writes the enchantments into the specified NBT writer; begins with the LIST tag of the specified name ("ench" or "StoredEnchantments") + static void WriteToNBTCompound(cEnchantments const& a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName); + + /// Reads the enchantments from the specified NBT list tag (ench or StoredEnchantments) + static void ParseFromNBT(cEnchantments& a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx); + +}; -- cgit v1.2.3