0

Forward compatibility

This commit is contained in:
gmcnew
2018-08-11 14:23:42 +00:00
parent 9293fc8751
commit ca02558206

View File

@@ -820,11 +820,15 @@ class RegionSet(object):
if chunk_data.get("Status", "") in ("empty", "carved", "liquid_carved", "decorated"): if chunk_data.get("Status", "") in ("empty", "carved", "liquid_carved", "decorated"):
raise ChunkDoesntExist("Chunk %s,%s doesn't exist" % (x,z)) raise ChunkDoesntExist("Chunk %s,%s doesn't exist" % (x,z))
# Turn the Biomes array into a 16x16 numpy array # Turn the Biomes array into a 16x16 numpy arra
try: if 'Biomes' in chunk_data:
biomes = numpy.frombuffer(chunk_data['Biomes'], dtype=numpy.uint8) biomes = chunk_data['Biomes']
if isinstance(biomes, str):
biomes = numpy.frombuffer(biomes, dtype=numpy.uint8)
else:
biomes = numpy.asarray(biomes)
biomes = biomes.reshape((16,16)) biomes = biomes.reshape((16,16))
except KeyError: else:
# worlds converted by Jeb's program may be missing the Biomes key # worlds converted by Jeb's program may be missing the Biomes key
biomes = numpy.zeros((16, 16), dtype=numpy.uint8) biomes = numpy.zeros((16, 16), dtype=numpy.uint8)
chunk_data['Biomes'] = biomes chunk_data['Biomes'] = biomes