Fix chunk loading for region files with unpadded sectors#389
Fix chunk loading for region files with unpadded sectors#389mrkite merged 2 commits intomrkite:masterfrom
Conversation
Check actual chunk data length instead of full sector allocation when validating chunk boundaries. Some exporters like WorldTools don't pad sectors to 4096-byte boundaries, causing valid chunks at the end of region files to be rejected.
Worlds with thousands of in-game maps (map_<id>.dat) were slow to load because loadStructures() parsed every .dat file in data/, even though map files never contain structure data.
|
Added a fix to skip map_*.dat files when loading structures - worlds with thousands of in-game maps (I have some with 20k map-art .dat files) were slow to load because these files were being parsed even though they never contain structure data. |
|
Sorry for late reaction, I'm quite busy at the moment. Your explanation also sounds reasonable. |
|
Hey Etlam, thanks for your reply. There is absolutely no urgency. I am using the fix locally and it's working for me <3 |
|
I finally found time to look into this (but still struggle to get my Qt build environment running again after Windows 11 update). I'm fine with all these changes. Comments:
|
EtlamGit
left a comment
There was a problem hiding this comment.
It is not necessary to map a header of 5 bytes, as you only use the first 4.
But leave it like it is. This year Mojang introduced a new compression mode and this might be a good place to switch code for support of multiple compression algorithms. But we might also move the detection into NBT()
You mixed 2 topics in one PR. If have seen that, the changes are fine and reasonable, so everything is ok.
But next time, try to use 2 PRs for 2 topics as then it is easier to distinguish what belongs to what topic.
Fixes #388
Check actual chunk data length instead of full sector allocation when validating chunk boundaries. Some exporters like WorldTools don't pad sectors to 4096-byte boundaries, causing valid chunks at the end of region files to be rejected.
Changes
Testing
Tested with WorldTools 1.2.4 exports, Minecraft 1.20+ (DataVersion 3700).