Add support for multiple palettes - #149
Conversation
Minecraft shipwrecks use multiple palettes, allowing a single structure file to contain various schemes depending on the location the structure is placed. All of the code supporting this exists, except for the actual loading of multiple palettes. Structure.setSeed() is called using the chunk coords, and Structure.getObject() as well, prior to rendering the final object into the world. Attempting to load an NBT file with multiple palettes causes a NullPointerException and provides no information about the error. Now, loading an NBT with multiple palettes is supported and works as expected.
|
Cool, my first pull request! 😊 I'll take a look. |
|
I've been working with some other code and discovered a major issue with this PR. Due to the way that My first idea is to add a catch clause to the loading function that detects this specific problem, and just loads the older version of the class and then updates it to the new version. I'd like to get your thoughts on this first before I try anything! |
|
@almic Yeah, good point. Shouldn't be too hard to fix I don't think. I have to deal with that issue all the time. Fortunately Java serialization allows you to evolve file formats in some moderately elegant ways. I'll keep the issue in mind when I look at this. |
|
Sorry I kinda vanished, coming back to this now! |
Fix issues when deserializing existing objects. Drop support for the "blocks" field in favor of the pallet ready field.
dont look at my spelling
|
Hello @Captain-Chaos , it's been a long time and I see you've been working quite a lot. Is this pull request still valid? |
bd6d96d to
ee498ad
Compare
Minecraft shipwrecks use multiple palettes, allowing a single structure file to contain various schemes depending on the location the structure is placed.
All of the code supporting this exists, except for the actual loading of multiple palettes.
Structure.setSeed()is called using the chunk coords, andStructure.getObject()as well, prior to rendering the final object into the world.Attempting to load an NBT file with multiple palettes causes a
NullPointerExceptionand provides no information about the error. Now, loading an NBT with multiple palettes is supported and works as expected.Unfortunately I was not able to test this as I couldn't build this myself. However, since the changes are so few and the code is clear, I'm confident this will work perfectly with all existing worlds, objects, etc.