-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@xmcl/world - Chunk corruption fix for palette sizes >=16 #250
Conversation
Added a second minor commit to support the new Minecraft Chunk format (aliased Palette/BlockStates with block_states.palette and block_states.data respectively) Added a new exported function to directly export the section's block array directly for non-legacy section formats, otherwise returns a blank array. |
cd43a5a
to
fa99e35
Compare
Addition of new Minecraft chunk format Exported ability to get section block array directly Removal of all old functions
fa99e35
to
613bf11
Compare
const blockStates = section.BlockStates; | ||
const bitLen = computeBitLen(section.Palette, blockStates); | ||
return seek(blockStates, bitLen, index); | ||
if ("Blocks" in section) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry maybe I missed something,
Added a new exported function to directly export the section's block array directly for non-legacy section formats, otherwise returns a blank array.
Which function do you mean here?
I just want to make sure we still have legacy support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries I should have been more clear.
When it detects a new chunk format (not the legacy one) it uses getSectionBlockIdArray
to get the block id array (variable was previously called vector).
I have also marked this function as exported so you can choose to use this directly.
This should be a non-breaking change that both maintains backwards support with older versions, fixes the chunk corruption and adds the new exported function getSectionBlockIdArray
useable on sections with a non-legacy format.
Please let me know if this doesn't make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries I should have been more clear.
When it detects a new chunk format (not the legacy one) it uses
getSectionBlockIdArray
to get the block id array (variable was previously called vector).I have also marked this function as exported so you can choose to use this directly.
This should be a non-breaking change that both maintains backwards support with older versions, fixes the chunk corruption and adds the new exported function
getSectionBlockIdArray
useable on sections with a non-legacy format.Please let me know if this doesn't make sense.
Sure, let's update the branch with master and run tests for it. As long as the old tests for 1.12.2 and 1.14.4 don't fail, it will be totally ok for me.
Also, can you add new test files ( You just need a single chunk To generate the mock.txt (containing the dump data). You can run following script in MinecraftForge environment for your test level. https://gist.github.com/ci010/27415d55a3e72399924433b759924f2e |
Hu @ci010 I've merged the master branch with this and I've added in some test .mca files - but I have no idea how to generate the I've explicitly made sure the test regions have >16 types of block in at least 1 region so we can test the palette corruption fixes. Can you either generate the Thanks, |
Sure, let me add the mock.txt files then |
Fix for palette size >=16 by implementing code from here: https://github.com/spoutn1k/mcmap/blob/fec14647c600244bc7808b242b99331e7ee0ec38/src/chunk_format_versions/section_format.cpp#L6