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-07-03 13:10:23 +02:00
parent fd2c0a057a
commit a3e4812ca9
+3
View File
@@ -288,7 +288,10 @@ class RegionSet(object):
for x, y, regionfile in self._iterate_regionfiles(): for x, y, regionfile in self._iterate_regionfiles():
# regionfile is a pathname # regionfile is a pathname
if os.path.getsize(regionfile) != 0:
self.regionfiles[(x,y)] = (regionfile, os.path.getmtime(regionfile)) self.regionfiles[(x,y)] = (regionfile, os.path.getmtime(regionfile))
else:
logging.debug("Skipping zero-size region file {}".format(regionfile))
self.empty_chunk = [None,None] self.empty_chunk = [None,None]
logging.debug("Done scanning regions") logging.debug("Done scanning regions")