Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-158988

Minecraft will remove up to several hundred chunks per region if region file isn't exact multiple of 4096 bytes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 1.14.4
    • Fix Version/s: 19w34a
    • Labels:
      None
    • Confirmation Status:
      Confirmed
    • Category:
      Chunk loading

      Description

      This is not a big issue and only affects authors of external tools that manipulate Minecraft region files.

      It actually never avvects MC itself as it's always writing extact multiples of 4096 bytes. But if an external tool has a different implementation, that doesn't always pad the file with enough zeros to be an exact multiple of 4096 bytes (I don't think any such tools exists right now, probably because of this issue, I was trying to write one myself and discovered this), Minecraft will attempt to do that when loading the file. But due to a missing file.seek(), it's not writing them at the end, but overwriting data at the beginning, effectively erasing a lot of chunks. And doesn't actually change the file size in the end, so it will keep doing that every time this region file is loaded. This issue exists since Minecraft beta 1.3.

       

      An easy way to reproduce the issue looks a lot like intentionally corrupting the world file, but all it really does is append some extra data at the end of region files. It's possible to use windows cmd (also works on linux, and should work on mac) to do that, first create a file with about 1000-3000 characters in it and then run this command in directory containing:

      echo file.txt >> r.0.0.mca

      And load the world. 1/4th of the chunks in that region file will get regenerated. And, crucially, the same part of the world will get regenerated each time the world is loaded. This should not be possible if it's just a region file with some of the chunks deleted.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Barteks2x Bartosz Skrzypczak
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                CHK: