Skip to content

Commit 87867bc

Browse files
committed
Render chunks below zero retrogen chunks again
Pre-1.18 chunks that are loaded in 1.18+ are often saved in a transitional proto-chunk status. Currently, the Overviewer will ignore these chunks altogether, resulting in only part of the terrain being rendered. If the world is optimized with --forceUpgrade, only chunks that have been visited in 1.18+ will be rendered. With this change, the Overviewer detects these chunks and renders them again.
1 parent 8c4184d commit 87867bc

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

overviewer_core/world.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ def get_chunk(self, x, z):
16781678
# starting with 1.16 snapshot 20w17a, block states are packed differently
16791679
longarray_unpacker = self._packed_longarray_to_shorts_v116
16801680

1681+
include_chunk = False
1682+
below_zero_retrogen_target_status = None
16811683
# From the interior of a map to the edge, a chunk's status may be one of:
16821684
# - postprocessed (interior, or next to fullchunk)
16831685
# - fullchunk (next to decorated)
@@ -1688,8 +1690,18 @@ def get_chunk(self, x, z):
16881690
# Empty is self-explanatory, and liquid_carved and carved seem to correspond
16891691
# to SkyLight not being calculated, which results in mostly-black chunks,
16901692
# so we'll just pretend they aren't there.
1691-
if chunk_data.get("Status", "") not in ("full", "postprocessed", "fullchunk",
1693+
if chunk_data.get("Status", "") in ("full", "postprocessed", "fullchunk",
16921694
"mobs_spawned", "spawn", ""):
1695+
include_chunk = True
1696+
1697+
else:
1698+
below_zero_retrogen_target_status = (
1699+
chunk_data.get("below_zero_retrogen", {}).get("target_status")
1700+
)
1701+
if below_zero_retrogen_target_status in ("heightmaps", "spawn"):
1702+
include_chunk = True
1703+
1704+
if not include_chunk:
16931705
raise ChunkDoesntExist("Chunk %s,%s doesn't exist" % (x,z))
16941706

16951707
# Turn the Biomes array into a 16x16 numpy array
@@ -1725,6 +1737,12 @@ def get_chunk(self, x, z):
17251737
if 'SkyLight' in section:
17261738
skylight = numpy.frombuffer(section['SkyLight'], dtype=numpy.uint8)
17271739
skylight = skylight.reshape((16,16,8))
1740+
elif below_zero_retrogen_target_status and section["Y"] < 0:
1741+
# nonexistent section of incomplete pre-1.18 chunk
1742+
# if we don't do this, the terrain below Y=0 next to it will be
1743+
# painted black, and since this terrain isn't a red door and we
1744+
# aren't the rolling stones, we don't want that
1745+
skylight = numpy.full((16,16, 8), 255, dtype=numpy.uint8)
17281746
else: # Special case introduced with 1.14
17291747
skylight = numpy.zeros((16,16,8), dtype=numpy.uint8)
17301748
skylight_expanded = numpy.empty((16,16,16), dtype=numpy.uint8)

0 commit comments

Comments
 (0)