add property chunkCount because allChunks is now exposed as an iterator
This commit is contained in:
parent
25e4ec07c1
commit
4dbccca9dd
2
mce.py
2
mce.py
@ -438,7 +438,7 @@ class mce(object):
|
||||
blockCounts = zeros( (256,), 'uint64')
|
||||
sizeOnDisk = 0;
|
||||
|
||||
print "Analyzing {0} chunks...".format(len(self.level.allChunks))
|
||||
print "Analyzing {0} chunks...".format(self.level.chunkCount)
|
||||
|
||||
for i, cPos in enumerate(self.level.allChunks, 1):
|
||||
ch = self.level.getChunk(*cPos);
|
||||
|
10
mclevel.py
10
mclevel.py
@ -2127,7 +2127,7 @@ class MCInfdevOldLevel(MCLevel):
|
||||
return False
|
||||
|
||||
def getWorldBounds(self):
|
||||
if len(self._allChunks) == 0:
|
||||
if self.chunkCount == 0:
|
||||
return BoundingBox( (0,0,0), (0,0,0) )
|
||||
|
||||
allChunksArray = array(list(self.allChunks), dtype='int32')
|
||||
@ -2582,6 +2582,14 @@ class MCInfdevOldLevel(MCLevel):
|
||||
def loadedChunks(self):
|
||||
return self._loadedChunks.keys();
|
||||
|
||||
@property
|
||||
def chunkCount(self):
|
||||
"""Returns the number of chunks in the level. May initiate a costly
|
||||
chunk scan."""
|
||||
if self._allChunks is None:
|
||||
self.preloadChunkPaths()
|
||||
return len(self._allChunks)
|
||||
|
||||
@property
|
||||
def allChunks(self):
|
||||
"""Iterates over (xPos, zPos) tuples, one for each chunk in the level.
|
||||
|
Reference in New Issue
Block a user