Skip to content

Commit

Permalink
Fix enchantments crashing/disconnecting
Browse files Browse the repository at this point in the history
  • Loading branch information
jwkerr committed Feb 18, 2025
1 parent 19af73a commit c51af79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ minecraft_version=1.21.4
yarn_mappings=1.21.4+build.8
loader_version=0.16.10
# Mod Properties
mod_version=0.1.2
mod_version=0.1.3
maven_group=au.lupine
archives_base_name=Chatty
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.116.1+1.21.4
fabric_version=0.117.0+1.21.4

# Mod Dependencies
# https://modrinth.com/mod/modmenu/versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ private boolean doesTextPassFilter(Text text) {
ChattyConfig config = ChattyConfig.getInstance();
if (!config.isEnabled) return true;

Component component = MinecraftClientAudiences.of().asAdventure(text);
Component component;
try {
component = MinecraftClientAudiences.of().asAdventure(text);
} catch (Exception e) {
return true; // Something went wrong, but we can just ignore it (enchantment fix)
}

String message = PlainTextComponentSerializer.plainText().serialize(component);

if (config.hideEmptyMessages && message.isEmpty()) return false;
Expand Down

0 comments on commit c51af79

Please sign in to comment.