Merge pull request #434 from Xon/master
Permit overviewer to keep running even if the chunk the spawn is in is corrupt.
This commit is contained in:
@@ -209,25 +209,27 @@ class World(object):
|
|||||||
chunkX = spawnX/16
|
chunkX = spawnX/16
|
||||||
chunkY = spawnZ/16
|
chunkY = spawnZ/16
|
||||||
|
|
||||||
## The filename of this chunk
|
try:
|
||||||
chunkFile = self.get_region_path(chunkX, chunkY)
|
## The filename of this chunk
|
||||||
|
chunkFile = self.get_region_path(chunkX, chunkY)
|
||||||
if chunkFile is not None:
|
if chunkFile is not None:
|
||||||
data = nbt.load_from_region(chunkFile, chunkX, chunkY)[1]
|
data = nbt.load_from_region(chunkFile, chunkX, chunkY)[1]
|
||||||
if data is not None:
|
if data is not None:
|
||||||
level = data['Level']
|
level = data['Level']
|
||||||
blockArray = numpy.frombuffer(level['Blocks'], dtype=numpy.uint8).reshape((16,16,128))
|
blockArray = numpy.frombuffer(level['Blocks'], dtype=numpy.uint8).reshape((16,16,128))
|
||||||
|
|
||||||
## The block for spawn *within* the chunk
|
## The block for spawn *within* the chunk
|
||||||
inChunkX = spawnX - (chunkX*16)
|
inChunkX = spawnX - (chunkX*16)
|
||||||
inChunkZ = spawnZ - (chunkY*16)
|
inChunkZ = spawnZ - (chunkY*16)
|
||||||
|
|
||||||
## find the first air block
|
## find the first air block
|
||||||
while (blockArray[inChunkX, inChunkZ, spawnY] != 0):
|
while (blockArray[inChunkX, inChunkZ, spawnY] != 0):
|
||||||
spawnY += 1
|
spawnY += 1
|
||||||
if spawnY == 128:
|
if spawnY == 128:
|
||||||
break
|
break
|
||||||
|
except ChunkCorrupt:
|
||||||
|
#ignore corrupt spawn, and continue
|
||||||
|
pass
|
||||||
self.POI.append( dict(x=spawnX, y=spawnY, z=spawnZ,
|
self.POI.append( dict(x=spawnX, y=spawnY, z=spawnZ,
|
||||||
msg="Spawn", type="spawn", chunk=(chunkX, chunkY)))
|
msg="Spawn", type="spawn", chunk=(chunkX, chunkY)))
|
||||||
self.spawn = (spawnX, spawnY, spawnZ)
|
self.spawn = (spawnX, spawnY, spawnZ)
|
||||||
|
|||||||
Reference in New Issue
Block a user