Fix signs displaying JSON text on Minecraft 1.21.5+ - #3605
Open
twme-ai wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates legacy SignBlock NBT serialization to account for Minecraft 1.21.5’s change where sign text NBT strings are treated as literal components (not JSON-in-string), preventing signs placed via commands like //set spruce_sign from showing JSON source on 1.21.5+.
Changes:
- Make
SignBlockwrite JSON-in-string text for < 1.21.5 and literal strings for >= 1.21.5, including version-appropriate empty defaults. - Add regression tests covering multiple data versions around the 1.21.5 boundary and newer versions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java | Switch sign text encoding/empties based on data version to match 1.21.5+ semantics. |
| worldedit-core/src/test/java/com/sk89q/worldedit/blocks/SignBlockTest.java | Add tests validating JSON vs literal sign message serialization across multiple versions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Overview
Fixes #3379
Description
Minecraft 1.21.5 changed the representation of text components in sign NBT. A string now represents a literal
text component instead of JSON-encoded text.
SignBlockcontinued wrapping each line in JSON inside the NBTstring, which caused commands such as
//set spruce_signto display the JSON source on the sign.This change preserves the JSON-in-string representation before Minecraft 1.21.5 and writes literal strings on
Minecraft 1.21.5 and newer. It also uses the version-appropriate empty value when constructing signs or loading
incomplete sign NBT.
Regression tests cover Minecraft 1.21.4, the 1.21.5 format boundary, 1.21.10, 1.21.11, and 26.1.2.
Testing
./gradlew :worldedit-core:check --no-configure-on-demandSubmitter Checklist
@since TODO.