add an iterator version of fillBlocks

This commit is contained in:
David Vierra 2011-09-13 11:04:46 -10:00
parent e04d9d3ee9
commit 65a70f3bd5

View File

@ -2399,6 +2399,9 @@ class MCInfdevOldLevel(EntityLevel):
return count;
def fillBlocks(self, box, blockInfo, blocksToReplace=[]):
return exhaust(self.fillBlocksIter(box, blockInfo, blocksToReplace))
def fillBlocksIter(self, box, blockInfo, blocksToReplace=[]):
if box is None:
chunkIterator = self.getAllChunkSlices()
box = self.bounds
@ -2432,12 +2435,13 @@ class MCInfdevOldLevel(EntityLevel):
i = 0;
skipped = 0
replaced = 0;
for (chunk, slices, point) in chunkIterator:
i += 1;
if i % 100 == 0:
info(u"Chunk {0}...".format(i))
yield i, box.chunkCount
blocks = chunk.Blocks[slices]
data = chunk.Data[slices]
mask = slice(None)