Render Bedrock .mcstructure files in the 3D structure view#91
Open
Fabrimat wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bedrock .mcstructure files were already being parsed correctly (little endian, gzip/zlib detection is handled by deepslate), but the editor treated them as generic NBT, so they only showed up in the tree view. This adds proper support for viewing them in 3D.
Changes:
NbtDocument.isStructureData()now recogn with asizeint list and astructurecompound), so the structure panel is offered for these files.mcstructureToStructure()inSchematformat to a deepslateStructure: palette fromstructure.palette.default.block_palette(byte states become "true"/"false", everything else is passed through), blocks from layer 0 ofblock_indicesusing the Bedrock index order (x outermost, z innermost), -1 entries skipped, block entities attached fromblock_position_data`.dataVersionreturns undefined for Bedrock files so the latest release assets are used instead of the 1.18.2 fallback.readFile()now works in both directions instead of only when starting from big endKnown limitations, matching what the other schematic formats do: no mapping of Bedrock block states to Java ones (blocks with unrecognized states render with their default variant), and the waterlogging layer and entities are ignored.
Tested with structures exported from Bedrocked, plus a Java structure renamed to .mcstructure to check the endianness fallback.