From c962a32585a3fde8c4918e43398cfea7b91cbee3 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Thu, 18 Nov 2010 22:18:44 -1000 Subject: [PATCH] Added isChunkAligned to BoundingBox --- box.py | 4 +++- mclevel.py | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) 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