Skip to content

Fix LabyMod crash on Essential chat components - #42

Merged
Scherso merged 1 commit into
Scherso:masterfrom
luckycdev:chat-fix
Nov 10, 2026
Merged

Scherso merged 1 commit into
Scherso:masterfrom
luckycdev:chat-fix

Conversation

@luckycdev

Copy link
Copy Markdown
Contributor

Convert non-vanilla chat components to vanilla ones before they are serialized.
LabyMod serializes chat lines to JSON, and vanilla throws a "Don't know how to serialize ... as a Component" error for any chats that aren't a ChatComponentText component. Essential's UTextComponent isn't one, so it crashes the entire game when using LabyMod.
/essential, /essential config, and anything else using UTextComponent would crash the game when using LabyMod.

This fix patches IChatComponent$Serializer to pass it through ChatComponentSanitizer, which copies the unknown components into ChatComponentText components with the same text, style, and siblings.

The class is still obfuscated when the transformer runs, so the method is found through its descriptor.

This fix is likely only for 1.8.9 since 1.12.2 has a different name for the class.

Tested on 1.8.9 with LabyMod 3

Fixes #33

Convert non-vanilla chat components to vanilla ones before they are serialized.
@Scherso
Scherso merged commit 325c52d into Scherso:master Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash with LabyMod while parsing text components with LabyMod

2 participants