Added isChunkAligned to BoundingBox

This commit is contained in:
David Vierra 2010-11-18 22:18:44 -10:00
parent 0d2e715fb3
commit c962a32585
2 changed files with 4 additions and 3 deletions

4
box.py
View File

@ -100,7 +100,9 @@ class BoundingBox (object):
return itertools.product(xrange(self.mincx,self.maxcx), xrange(self.mincz, self.maxcz)); 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): def __contains__(self, pos):
x,y,z = pos; x,y,z = pos;

View File

@ -1024,8 +1024,7 @@ class MCLevel(object):
destBox = BoundingBox(destPoint, sourceBox.size); destBox = BoundingBox(destPoint, sourceBox.size);
if ((sourceBox.origin[0] & 0xf == 0) and if (sourceBox.isChunkAligned):
(sourceBox.origin[2] & 0xf == 0)):
#create chunks in the destination area corresponding only to chunks #create chunks in the destination area corresponding only to chunks
#present in the source #present in the source
chunks = sourceBox.chunkPositions chunks = sourceBox.chunkPositions