diff --git a/MinecraftClient/Protocol/Message/ChatParser.cs b/MinecraftClient/Protocol/Message/ChatParser.cs index 3e47d726..3bdaf4be 100644 --- a/MinecraftClient/Protocol/Message/ChatParser.cs +++ b/MinecraftClient/Protocol/Message/ChatParser.cs @@ -452,11 +452,20 @@ namespace MinecraftClient.Protocol.Message object[] extras = (object[])value; for (int i = 0; i < extras.Length; i++) { - var extraDict = extras[i] is string - ? new Dictionary() { { "text", (string)extras[i] } } - : (Dictionary)extras[i]; - - extraBuilder.Append(NbtToString(extraDict) + "§r"); + try + { + var extraDict = extras[i] is string + ? new Dictionary() { { "text", (string)extras[i] } } + : (Dictionary)extras[i]; + + extraBuilder.Append(NbtToString(extraDict) + "§r"); + } + catch + { + ConsoleIO.WriteLine("[DEBUG] Full object:" + JsonSerializer.Serialize(extras)); + ConsoleIO.WriteLine("[DEBUG] Value in question:" + JsonSerializer.Serialize(extras[i])); + throw; + } } } break; @@ -471,11 +480,21 @@ namespace MinecraftClient.Protocol.Message var withs = (object[])withComponent; for (int i = 0; i < withs.Length; i++) { - var withDict = withs[i] is string - ? new Dictionary() { { "text", (string)withs[i] } } - : (Dictionary)withs[i]; + try + { + var withDict = withs[i] is string + ? new Dictionary() { { "text", (string)withs[i] } } + : (Dictionary)withs[i]; - translateString.Add(NbtToString(withDict)); + translateString.Add(NbtToString(withDict)); + } + catch + { + ConsoleIO.WriteLine("[DEBUG] Full object:" + JsonSerializer.Serialize(withs)); + ConsoleIO.WriteLine("[DEBUG] Value in question:" + JsonSerializer.Serialize(withs[i])); + + throw; + } } } message = TranslateString(translateKey, translateString);