world: fix pre-21w43a workaround being applied when sections is missing

Sometimes, chunks don't have a sections key, but aren't pre-21w43a.
Fix this check to use DataVersion to determine whether it should be
applied.

Hopefully fixes #2010.
This commit is contained in:
Nicolas F 2022-06-07 22:58:46 +02:00
parent 2de7248cb9
commit 4e51b21652
1 changed files with 3 additions and 3 deletions

View File

@ -1707,13 +1707,13 @@ class RegionSet(object):
chunk_data = data[1]
if not 'sections' in chunk_data:
if chunk_data.get('DataVersion', 0) <= 2840 and 'Level' in chunk_data:
# This world was generated pre 21w43a and thus most chunk data is contained
# in the "Level" key
chunk_data = chunk_data['Level']
else:
# This world was generated post 21w43a
chunk_data['Sections'] = chunk_data['sections']
# This world was (probably) generated post 21w43a
chunk_data['Sections'] = chunk_data.get('sections', [])
longarray_unpacker = self._packed_longarray_to_shorts
if data[1].get('DataVersion', 0) >= 2529: