From ee078dd988471db74d724f1afc5ea66cf7d99aca Mon Sep 17 00:00:00 2001 From: David Vierra Date: Sun, 20 Dec 2015 06:11:24 -1000 Subject: [PATCH] Handle dirty flag on unparented entities. Parenting the entity should automatically dirty the parent. --- src/mceditlib/anvil/entities.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mceditlib/anvil/entities.py b/src/mceditlib/anvil/entities.py index 9cf94e7..557f40d 100644 --- a/src/mceditlib/anvil/entities.py +++ b/src/mceditlib/anvil/entities.py @@ -217,11 +217,14 @@ class PCEntityRefBase(object): @property def dirty(self): - return self.chunk.dirty + if self.chunk: + return self.chunk.dirty + return True @dirty.setter def dirty(self, value): - self.chunk.dirty = value + if self.chunk: + self.chunk.dirty = value @property def blockTypes(self): @@ -312,11 +315,14 @@ class PCTileEntityRefBase(object): @property def dirty(self): - return self.chunk.dirty + if self.chunk: + return self.chunk.dirty + return True @dirty.setter def dirty(self, value): - self.chunk.dirty = value + if self.chunk: + self.chunk.dirty = value @property def blockTypes(self):