tModLoader v2024.03
A mod to make and play Terraria mods
TagCompound Class Reference

Tag compounds contained named values, serialisable as per the NBT spec: NBT spec wiki page
All primitive data types are supported as well as byte[], int[] and Lists of other supported data types
Lists of Lists are internally stored as IList<IList>
Modification of lists stored in a TagCompound will only work if there were no type conversions involved and is not advised
bool is supported using TagConverter, serialised as a byte. IList<bool> will serialise as IList<byte> (quite inefficient)
Additional conversions can be added using TagConverter
More...

Inherits IEnumerable< KeyValuePair< string, object > >, and ICloneable.

Public Member Functions

void Add (KeyValuePair< string, object > entry)
 
void Add (string key, object value)
 
void Clear ()
 
object Clone ()
 
bool ContainsKey (string key)
 
Get< T > (string key)
 
double GetAsDouble (string key)
 
int GetAsInt (string key)
 
long GetAsLong (string key)
 
short GetAsShort (string key)
 
bool GetBool (string key)
 
byte GetByte (string key)
 
byte[] GetByteArray (string key)
 
TagCompound GetCompound (string key)
 
double GetDouble (string key)
 
IEnumerator< KeyValuePair< string, object > > GetEnumerator ()
 
float GetFloat (string key)
 
int GetInt (string key)
 
int[] GetIntArray (string key)
 
IList< T > GetList< T > (string key)
 
long GetLong (string key)
 
short GetShort (string key)
 
string GetString (string key)
 
bool Remove (string key)
 
void Set (string key, object value, bool replace=false)
 
override string ToString ()
 
bool TryGet< T > (string key, out T value)
 

Properties

int Count [get]
 
object this[string key] [get, set]
 

Detailed Description

Tag compounds contained named values, serialisable as per the NBT spec: NBT spec wiki page


All primitive data types are supported as well as byte[], int[] and Lists of other supported data types
Lists of Lists are internally stored as IList<IList>
Modification of lists stored in a TagCompound will only work if there were no type conversions involved and is not advised
bool is supported using TagConverter, serialised as a byte. IList<bool> will serialise as IList<byte> (quite inefficient)
Additional conversions can be added using TagConverter