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