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')
|
blockCounts = zeros( (256,), 'uint64')
|
||||||
sizeOnDisk = 0;
|
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):
|
for i, cPos in enumerate(self.level.allChunks, 1):
|
||||||
ch = self.level.getChunk(*cPos);
|
ch = self.level.getChunk(*cPos);
|
||||||
|
14
mclevel.py
14
mclevel.py
@ -2125,9 +2125,9 @@ class MCInfdevOldLevel(MCLevel):
|
|||||||
return True;
|
return True;
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def getWorldBounds(self):
|
def getWorldBounds(self):
|
||||||
if len(self._allChunks) == 0:
|
if self.chunkCount == 0:
|
||||||
return BoundingBox( (0,0,0), (0,0,0) )
|
return BoundingBox( (0,0,0), (0,0,0) )
|
||||||
|
|
||||||
allChunksArray = array(list(self.allChunks), dtype='int32')
|
allChunksArray = array(list(self.allChunks), dtype='int32')
|
||||||
@ -2581,7 +2581,15 @@ class MCInfdevOldLevel(MCLevel):
|
|||||||
@property
|
@property
|
||||||
def loadedChunks(self):
|
def loadedChunks(self):
|
||||||
return self._loadedChunks.keys();
|
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
|
@property
|
||||||
def allChunks(self):
|
def allChunks(self):
|
||||||
"""Iterates over (xPos, zPos) tuples, one for each chunk in the level.
|
"""Iterates over (xPos, zPos) tuples, one for each chunk in the level.
|
||||||
|
Reference in New Issue
Block a user