diff --git a/box.py b/box.py index e66e189..be81ce5 100644 --- a/box.py +++ b/box.py @@ -100,7 +100,9 @@ class BoundingBox (object): return itertools.product(xrange(self.mincx,self.maxcx), xrange(self.mincz, self.maxcz)); - + @property + def isChunkAligned(self): + return (self.origin[0] & 0xf == 0) and (self.origin[2] & 0xf == 0) def __contains__(self, pos): x,y,z = pos; diff --git a/mclevel.py b/mclevel.py index 3e611b9..b234c25 100644 --- a/mclevel.py +++ b/mclevel.py @@ -1024,8 +1024,7 @@ class MCLevel(object): destBox = BoundingBox(destPoint, sourceBox.size); - if ((sourceBox.origin[0] & 0xf == 0) and - (sourceBox.origin[2] & 0xf == 0)): + if (sourceBox.isChunkAligned): #create chunks in the destination area corresponding only to chunks #present in the source chunks = sourceBox.chunkPositions