From 90b467847394fe547540100ea1307176dabb17bb Mon Sep 17 00:00:00 2001 From: David Vierra Date: Sat, 11 Jul 2015 11:28:17 -1000 Subject: [PATCH] SetNBTDefaults now recurses through NBTCompoundAttrs --- src/mceditlib/nbtattr.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mceditlib/nbtattr.py b/src/mceditlib/nbtattr.py index 68af5c5..b36d9ae 100644 --- a/src/mceditlib/nbtattr.py +++ b/src/mceditlib/nbtattr.py @@ -313,5 +313,9 @@ def SetNBTDefaults(ref): """ cls = ref.__class__ for k, v in cls.__dict__.iteritems(): - if isinstance(v, (NBTAttr, NBTListAttr)): - setattr(ref, k, v.default) + if isinstance(v, NBTCompoundAttr): + ref.rootTag[k] = nbt.TAG_Compound() + SetNBTDefaults(getattr(ref, k)) + elif isinstance(v, (NBTAttr, NBTListAttr)): + if v.default is not None: + setattr(ref, k, v.default)