0

world: skip zero-size region files

Minecraft 1.16.1 loves writing these in singleplayer, and they
cause a whole bunch of corruption warnings if we don't handle them
in a special way like this.
This commit is contained in:
Nicolas F
2020-06-25 23:15:48 +02:00
parent fd2c0a057a
commit a3e4812ca9

View File

@@ -288,7 +288,10 @@ class RegionSet(object):
for x, y, regionfile in self._iterate_regionfiles():
# regionfile is a pathname
self.regionfiles[(x,y)] = (regionfile, os.path.getmtime(regionfile))
if os.path.getsize(regionfile) != 0:
self.regionfiles[(x,y)] = (regionfile, os.path.getmtime(regionfile))
else:
logging.debug("Skipping zero-size region file {}".format(regionfile))
self.empty_chunk = [None,None]
logging.debug("Done scanning regions")