fix the return values of getChunkSlices so when an extra tall box is requested, the offset point and slices line up properly

This commit is contained in:
David Vierra 2011-07-27 04:38:25 -10:00
parent bab9af4c6d
commit 19daf35a9e

View File

@ -204,6 +204,11 @@ class MCLevel(object):
minxoff, minzoff = box.minx - (box.mincx << 4), box.minz - (box.mincz << 4); minxoff, minzoff = box.minx - (box.mincx << 4), box.minz - (box.mincz << 4);
maxxoff, maxzoff = box.maxx - (box.maxcx << 4) + 16, box.maxz - (box.maxcz << 4) + 16; maxxoff, maxzoff = box.maxx - (box.maxcx << 4) + 16, box.maxz - (box.maxcz << 4) + 16;
newMinY = 0
if box.miny < 0:
newMinY = -box.miny
miny = max(0, box.miny)
maxy = min(self.Height, box.maxy)
for cx in range(box.mincx, box.maxcx): for cx in range(box.mincx, box.maxcx):
localMinX = 0 localMinX = 0
@ -232,8 +237,8 @@ class MCLevel(object):
continue; continue;
yield (ch, yield (ch,
(slice(localMinX, localMaxX), slice(localMinZ, localMaxZ), slice(box.miny, box.maxy)), (slice(localMinX, localMaxX), slice(localMinZ, localMaxZ), slice(miny, maxy)),
(newMinX, 0, newMinZ)) (newMinX, newMinY, newMinZ))
ch.compress() ch.compress()