MCEdit-Unified
MCEdit-Unified copied to clipboard
KeyError: 'name' when trying to save PE World
Description of Issue: KeyError: 'name'
MCEdit Version: 87801ca
Minecraft Version the world was last opened in: PE 1.10.2
Operating System: Arch Linux
I get the following errors when loading a bedrock edition world:
Game Version: PE
Traceback (most recent call last):
File "/path/to/MCEdit-Unified/renderer.py", line 3900, in workOnChunk
for _ in faceInfoCalculator:
File "/path/to/MCEdit-Unified/renderer.py", line 3882, in calcFacesForChunkRenderer
for _ in calc:
File "/path/to/MCEdit-Unified/renderer.py", line 388, in calcFaces
for _ in self.renderer.chunkCalculator.calcFacesForChunkRenderer(self):
File "/path/to/MCEdit-Unified/renderer.py", line 849, in calcFacesForChunkRenderer
for _ in br.makeChunkVertices(chunk):
File "/path/to/MCEdit-Unified/renderer.py", line 1447, in makeChunkVertices
neighbors = self.chunkCalculator.getNeighboringChunks(chunk)
File "/path/to/MCEdit-Unified/renderer.py", line 883, in getNeighboringChunks
neighboringChunks[dir] = level.getChunk(cx + dx, cz + dz)
File "/path/to/MCEdit-Unified/pymclevel/leveldbpocket.py", line 958, in getChunk
c = self.worldFile.loadChunk(cx, cz, self)
File "/path/to/MCEdit-Unified/pymclevel/leveldbpocket.py", line 590, in loadChunk
chunk = self._readChunk(cx, cz, world)
File "/path/to/MCEdit-Unified/pymclevel/leveldbpocket.py", line 454, in _readChunk
chunk.add_data(terrain=tr, tile_entities=te, entities=en, subchunk=i)
File "/path/to/MCEdit-Unified/pymclevel/leveldbpocket.py", line 1964, in add_data
)['name']
KeyError: 'name'
Traceback (most recent call last):
File "/path/to/MCEdit-Unified/renderer.py", line 3900, in workOnChunk
for _ in faceInfoCalculator:
File "/path/to/MCEdit-Unified/renderer.py", line 3882, in calcFacesForChunkRenderer
for _ in calc:
File "/path/to/MCEdit-Unified/renderer.py", line 388, in calcFaces
for _ in self.renderer.chunkCalculator.calcFacesForChunkRenderer(self):
File "/path/to/MCEdit-Unified/renderer.py", line 849, in calcFacesForChunkRenderer
for _ in br.makeChunkVertices(chunk):
File "/path/to/MCEdit-Unified/renderer.py", line 1447, in makeChunkVertices
neighbors = self.chunkCalculator.getNeighboringChunks(chunk)
File "/path/to/MCEdit-Unified/renderer.py", line 883, in getNeighboringChunks
neighboringChunks[dir] = level.getChunk(cx + dx, cz + dz)
File "/path/to/MCEdit-Unified/pymclevel/leveldbpocket.py", line 958, in getChunk
c = self.worldFile.loadChunk(cx, cz, self)
File "/path/to/MCEdit-Unified/pymclevel/leveldbpocket.py", line 590, in loadChunk
chunk = self._readChunk(cx, cz, world)
File "/path/to/MCEdit-Unified/pymclevel/leveldbpocket.py", line 454, in _readChunk
chunk.add_data(terrain=tr, tile_entities=te, entities=en, subchunk=i)
File "/path/to/MCEdit-Unified/pymclevel/leveldbpocket.py", line 1964, in add_data
)['name']
KeyError: 'name'
[ WARNING][ root.py:816]:Error reading chunk: 'name'
And when trying to save I get:
[ ERROR][ root.py:59]:Exception:
Traceback (most recent call last):
File "/path/to/MCEdit-Unified/mceutils.py", line 53, in _alertException
return func(*args, **kw)
File "/path/to/MCEdit-Unified/leveleditor.py", line 1458, in saveFile
if "Canceled" == showProgress("Lighting chunks", level.generateLightsIter(), cancel=True):
File "/path/to/MCEdit-Unified/albow/extended_widgets.py", line 359, in showProgress
if widget.present():
File "/path/to/MCEdit-Unified/albow/widget.py", line 525, in present
self.root.run_modal(self)
File "/path/to/MCEdit-Unified/albow/root.py", line 233, in run_modal
self.gl_draw_all(self, (0, 0))
File "/path/to/MCEdit-Unified/albow/widget.py", line 766, in gl_draw_all
subwidget.gl_draw_all(root, suboffset)
File "/path/to/MCEdit-Unified/albow/widget.py", line 773, in gl_draw_all
self.draw_all(surface)
File "/path/to/MCEdit-Unified/albow/widget.py", line 334, in draw_all
self.draw(surface)
File "/path/to/MCEdit-Unified/albow/extended_widgets.py", line 275, in draw
amount = progressIterator.next()
File "/path/to/MCEdit-Unified/pymclevel/infiniteworld.py", line 656, in generateLightsIter
for c, t, p in self._generateLightsIter(dc):
File "/path/to/MCEdit-Unified/pymclevel/infiniteworld.py", line 773, in _generateLightsIter
neighboringChunks[dir] = self.getChunk(cx + dx, cz + dz)
File "/path/to/MCEdit-Unified/pymclevel/leveldbpocket.py", line 958, in getChunk
c = self.worldFile.loadChunk(cx, cz, self)
File "/path/to/MCEdit-Unified/pymclevel/leveldbpocket.py", line 590, in loadChunk
chunk = self._readChunk(cx, cz, world)
File "/path/to/MCEdit-Unified/pymclevel/leveldbpocket.py", line 454, in _readChunk
chunk.add_data(terrain=tr, tile_entities=te, entities=en, subchunk=i)
File "/path/to/MCEdit-Unified/pymclevel/leveldbpocket.py", line 1964, in add_data
)['name']
KeyError: 'name'
So I'm able to open bedrock edition worlds, but unable to save.
I found a quick fix by replacing:
id = defs_get(ids_get(v, 'Unknown'),
{'name': 'Unknown Entity %s' % v,
'idStr': 'Unknown Entity %s' % v,
'id': -1,
'type': 'Unknown'}
)['name']
With this:
invertEntities = {v: k for k, v in entity.PocketEntity.entityList.items()}
id = invertEntities.get(v, "Entity %s"%v)
#Add the built one to the entities
if id not in entity.PocketEntity.entityList.keys():
logger.warning("Found unknown entity '%s'"%v)
entity.PocketEntity.entityList[id] = v
In the following file: https://github.com/Podshot/MCEdit-Unified/blob/430a47934bb1c6f530eac60fc07dca246e90c9d8/pymclevel/leveldbpocket.py#L1959
I added the following code for debugging purposes:
try:
defs_get(ids_get(v, 'Unknown'),
{'name': 'Unknown Entity %s' % v,
'idStr': 'Unknown Entity %s' % v,
'id': -1,
'type': 'Unknown'}
)['name']
except KeyError, e:
defs = defs_get(ids_get(v, 'Unknown'),
{'name': 'Unknown Entity %s' % v,
'idStr': 'Unknown Entity %s' % v,
'id': -1,
'type': 'Unknown'}
)
for x in defs:
print x + " : " + str(defs[x])
print "\n"
And I get the following output.
Game Version: PE
data : {u'11': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Top)'}, u'10': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Top)'}, u'13': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Top)'}, u'12': {u'tex': [7, 0], u'name': u'Brick Slab (Top)'}, u'15': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Top)'}, u'14': {u'tex': [9, 13], u'name': u'Quartz Slab (Top)'}, u'1': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Bottom)'}, u'0': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Bottom)'}, u'3': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Bottom)'}, u'2': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Bottom)'}, u'5': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Bottom)'}, u'4': {u'tex': [7, 0], u'name': u'Brick Slab (Bottom)'}, u'7': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Bottom)'}, u'6': {u'tex': [9, 13], u'name': u'Quartz Slab (Bottom)'}, u'9': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Top)'}, u'8': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Top)'}}
idStr : stone_slab
tex : [6, 0]
mapcolor : [200, 200, 200]
type : HALFHEIGHT
id : 44
data : {u'11': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Top)'}, u'10': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Top)'}, u'13': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Top)'}, u'12': {u'tex': [7, 0], u'name': u'Brick Slab (Top)'}, u'15': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Top)'}, u'14': {u'tex': [9, 13], u'name': u'Quartz Slab (Top)'}, u'1': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Bottom)'}, u'0': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Bottom)'}, u'3': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Bottom)'}, u'2': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Bottom)'}, u'5': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Bottom)'}, u'4': {u'tex': [7, 0], u'name': u'Brick Slab (Bottom)'}, u'7': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Bottom)'}, u'6': {u'tex': [9, 13], u'name': u'Quartz Slab (Bottom)'}, u'9': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Top)'}, u'8': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Top)'}}
idStr : stone_slab
tex : [6, 0]
mapcolor : [200, 200, 200]
type : HALFHEIGHT
id : 44
data : {u'11': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Top)'}, u'10': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Top)'}, u'13': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Top)'}, u'12': {u'tex': [7, 0], u'name': u'Brick Slab (Top)'}, u'15': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Top)'}, u'14': {u'tex': [9, 13], u'name': u'Quartz Slab (Top)'}, u'1': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Bottom)'}, u'0': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Bottom)'}, u'3': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Bottom)'}, u'2': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Bottom)'}, u'5': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Bottom)'}, u'4': {u'tex': [7, 0], u'name': u'Brick Slab (Bottom)'}, u'7': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Bottom)'}, u'6': {u'tex': [9, 13], u'name': u'Quartz Slab (Bottom)'}, u'9': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Top)'}, u'8': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Top)'}}
idStr : stone_slab
tex : [6, 0]
mapcolor : [200, 200, 200]
type : HALFHEIGHT
id : 44
data : {u'11': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Top)'}, u'10': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Top)'}, u'13': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Top)'}, u'12': {u'tex': [7, 0], u'name': u'Brick Slab (Top)'}, u'15': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Top)'}, u'14': {u'tex': [9, 13], u'name': u'Quartz Slab (Top)'}, u'1': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Bottom)'}, u'0': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Bottom)'}, u'3': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Bottom)'}, u'2': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Bottom)'}, u'5': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Bottom)'}, u'4': {u'tex': [7, 0], u'name': u'Brick Slab (Bottom)'}, u'7': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Bottom)'}, u'6': {u'tex': [9, 13], u'name': u'Quartz Slab (Bottom)'}, u'9': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Top)'}, u'8': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Top)'}}
idStr : stone_slab
tex : [6, 0]
mapcolor : [200, 200, 200]
type : HALFHEIGHT
id : 44
data : {u'11': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Top)'}, u'10': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Top)'}, u'13': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Top)'}, u'12': {u'tex': [7, 0], u'name': u'Brick Slab (Top)'}, u'15': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Top)'}, u'14': {u'tex': [9, 13], u'name': u'Quartz Slab (Top)'}, u'1': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Bottom)'}, u'0': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Bottom)'}, u'3': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Bottom)'}, u'2': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Bottom)'}, u'5': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Bottom)'}, u'4': {u'tex': [7, 0], u'name': u'Brick Slab (Bottom)'}, u'7': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Bottom)'}, u'6': {u'tex': [9, 13], u'name': u'Quartz Slab (Bottom)'}, u'9': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Top)'}, u'8': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Top)'}}
idStr : stone_slab
tex : [6, 0]
mapcolor : [200, 200, 200]
type : HALFHEIGHT
id : 44
data : {u'11': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Top)'}, u'10': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Top)'}, u'13': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Top)'}, u'12': {u'tex': [7, 0], u'name': u'Brick Slab (Top)'}, u'15': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Top)'}, u'14': {u'tex': [9, 13], u'name': u'Quartz Slab (Top)'}, u'1': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Bottom)'}, u'0': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Bottom)'}, u'3': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Bottom)'}, u'2': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Bottom)'}, u'5': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Bottom)'}, u'4': {u'tex': [7, 0], u'name': u'Brick Slab (Bottom)'}, u'7': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Bottom)'}, u'6': {u'tex': [9, 13], u'name': u'Quartz Slab (Bottom)'}, u'9': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Top)'}, u'8': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Top)'}}
idStr : stone_slab
tex : [6, 0]
mapcolor : [200, 200, 200]
type : HALFHEIGHT
id : 44
data : {u'11': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Top)'}, u'10': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Top)'}, u'13': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Top)'}, u'12': {u'tex': [7, 0], u'name': u'Brick Slab (Top)'}, u'15': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Top)'}, u'14': {u'tex': [9, 13], u'name': u'Quartz Slab (Top)'}, u'1': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Bottom)'}, u'0': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Bottom)'}, u'3': {u'tex': [0, 1], u'name': u'Cobblestone Slab (Bottom)'}, u'2': {u'tex': [4, 0], u'aka': u'Old Wood', u'name': u'Wooden Slab (Bottom)'}, u'5': {u'tex': [6, 3], u'name': u'Stone Brick Slab (Bottom)'}, u'4': {u'tex': [7, 0], u'name': u'Brick Slab (Bottom)'}, u'7': {u'tex': [0, 14], u'name': u'Nether Brick Slab (Bottom)'}, u'6': {u'tex': [9, 13], u'name': u'Quartz Slab (Bottom)'}, u'9': {u'tex': [0, 12], u'tex_direction': {u'TOP': [0, 11], u'BOTTOM': [0, 13]}, u'name': u'Sandstone Slab (Top)'}, u'8': {u'tex': [5, 0], u'tex_direction': {u'TOP': [6, 0], u'BOTTOM': [6, 0]}, u'name': u'Stone Slab (Top)'}}
idStr : stone_slab
tex : [6, 0]
mapcolor : [200, 200, 200]
type : HALFHEIGHT
id : 44
And looking in the following file I see that stone_slab does indeed not have a name: https://github.com/Podshot/MCEdit-Unified/blob/87801cacde49cd7f2246d24d84473c41d9ef1b14/mcver/PE/blocks.json
And I'm not sure it should have a name or the code in pymclevel/leveldbpocket.py
just needs to be fixed.
Edit: If stone_slab should have a name then the fix is to just change:
"id": 44,
"idStr": "stone_slab",
"mapcolor": [
200,
200,
200
],
"tex": [
6,
0
],
"type": "HALFHEIGHT"
},
To this:
"id": 44,
"idStr": "stone_slab",
"mapcolor": [
200,
200,
200
],
"name": "Stone Slab",
"tex": [
6,
0
],
"type": "HALFHEIGHT"
},
In https://github.com/Podshot/MCEdit-Unified/blob/87801cacde49cd7f2246d24d84473c41d9ef1b14/mcver/PE/blocks.json#L2825
Also red_flower
doesn't have a name. There might be more. I haven't checked. That's just what my code has come across so far.
Sorry for the delay answering but it seems weird to me... This only happens for entities so assuming the problem is that we're missing a name for a block doesn't make sense to me... Seems like id 44 for entities is zombie villager and when I use this id number, I get the zombie villager with the name tag... Can you try printing the "v" value in your debugging lines? Thanks!