0

genpoi: fix uncaught KeyErrors on some MC data

Apparently TileEntities can just not even exist now, and the same
goes for the player Dimension key. For the latter, I'm not sure
whether the fallback is correct, but it's a guess I suppose.

Hopefully addresses #1480.
This commit is contained in:
Nicolas F
2018-11-18 09:29:48 +01:00
parent 1428bf150c
commit cf53208989

View File

@@ -165,7 +165,7 @@ def handleEntities(rset, config, config_path, filters, markers):
for (x, z, mtime) in rset.iterate_chunks():
try:
data = rset.get_chunk(x, z)
for poi in itertools.chain(data['TileEntities'], data['Entities']):
for poi in itertools.chain(data.get('TileEntities', []), data.get('Entities', [])):
if poi['id'] == 'Sign' or poi['id'] == 'minecraft:sign': # kill me
poi = signWrangler(poi)
for name, __, filter_function, __, __, __ in filters:
@@ -346,7 +346,7 @@ def handlePlayers(worldpath, filters, markers):
else:
dimension = 0
if data['Dimension'] == dimension:
if data.get('Dimension', 0) == dimension:
result = filter_function(data)
if result:
d = create_marker_from_filter_result(data, result)