I have some code that finds chests in a pre-generated map. To locate the chests, the program first creates a list of all the existing chunks by calling World#isChunkGenerated in a loop, and storing the coordinates of the chunk in an array if it returns true. Since the map size isn't known ahead of time, the loop iterates over a large chunk area (chunk coords -400, -400 to 400, 400).
However, it seems that this process generates empty region (.mca) files for chunks that don't already exist. Stepping through with the debugger, it's evident the creation of these files occurs when World#isChunkGenerated is called. This seems like unintended behaviour.
Attached is a minimal plugin to demonstrate this and a screenshot of the pertinent loop.
To reproduce:
- place the plugin in your /plugins directory,
- generate a new world,
- open the world/region folder so you can see it, then
- call the command /ischunkgeneratedbug.
In the region folder, hundreds of new 0kb or 8kb .mca files will be created. On stop, these files aren't removed.
If any more information is needed, please let me know. Thanks!