Closed John-Dean closed 1 year ago
Have done some digging into this, it appears to happen frequently when the palette for a section gets too large.
After testing it happens when the palette length >16
I did some googling, found this forum post here: https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-tools/3020703-changes-to-the-chunk-format
Which lead me to here: https://github.com/spoutn1k/mcmap
Which lead me to: https://github.com/spoutn1k/mcmap/blob/fec14647c600244bc7808b242b99331e7ee0ec38/src/chunk_format_versions/section_format.cpp#L6
I'm unsure how to modify the existing JS code in this repo here: https://github.com/Voxelum/minecraft-launcher-core-node/blob/master/packages/world/index.ts to correct for this
Nevermind, I didn't realise a bunch of helper functions were already implemented. PR to fix this here: https://github.com/Voxelum/minecraft-launcher-core-node/pull/250
Hello,
When loading certain chunks there is corruption present on the output data:![image](https://user-images.githubusercontent.com/13804523/211150641-2fcb3eb5-2a44-4b5b-b2e1-ff4cd351924e.png)
If you expand it out to a larger scale you can see quite a few chunks are corrupted:![image](https://user-images.githubusercontent.com/13804523/211150807-d5921d7d-30f7-4839-aafb-5059d8dcfcf0.png)
This is taken from a world on Minecraft 1.18.1 and in game this corruption is not present:![image](https://user-images.githubusercontent.com/13804523/211150927-0b95773c-5a97-475b-b090-effb67bf6f41.png)
Tested also on 1.17.1:![image](https://user-images.githubusercontent.com/13804523/211151735-c6b70310-80c1-4cfb-afbd-a6dbdaeda0a7.png)
And 1.16.5:![image](https://user-images.githubusercontent.com/13804523/211151926-5abebbe9-341e-457d-842c-ff38f3257d49.png)
I've created a code example here: https://github.com/John-Dean/MCGame/tree/e218a1fe5cd5cd3867db810f3b9b4b888ed8e948 that just needs to be hosted as a webserver and index.html opened. Corruption is happening at this stage: https://github.com/John-Dean/MCGame/blob/e218a1fe5cd5cd3867db810f3b9b4b888ed8e948/modules/chunk-data/main.js#L75 and I've added some console logs to show the outputs.
Impacted 1.18.1 .mca file: https://github.com/John-Dean/MCGame/blob/master/assets/Sample%20World/region/r.-1.-1.mca (Chunk X: -1, Z: -1) Impacted 1.17.1 .mca file: https://github.com/John-Dean/MCGame/blob/master/assets/Sample%20World%202/region/r.0.0.mca (Chunk X: 0, Z: 0)
If I had to speculate, valid chunks are showing as a 256 element Array of Longs, whereas invalid chunks are showing as >256 (342 in my testing). Forcibly cutting the array at 256 elements does not solve the issue