Skip to content

Commit

Permalink
Temporary Debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
milutinke committed Feb 26, 2024
1 parent ecc88fa commit 1db0792
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions MinecraftClient/Protocol/Message/ChatParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,20 @@ private static string NbtToString(Dictionary<string, object> nbt)
object[] extras = (object[])value;
for (int i = 0; i < extras.Length; i++)
{
var extraDict = extras[i] is string
? new Dictionary<string, object>() { { "text", (string)extras[i] } }
: (Dictionary<string, object>)extras[i];

extraBuilder.Append(NbtToString(extraDict) + "§r");
try
{
var extraDict = extras[i] is string
? new Dictionary<string, object>() { { "text", (string)extras[i] } }
: (Dictionary<string, object>)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;
Expand All @@ -471,11 +480,21 @@ private static string NbtToString(Dictionary<string, object> nbt)
var withs = (object[])withComponent;
for (int i = 0; i < withs.Length; i++)
{
var withDict = withs[i] is string
? new Dictionary<string, object>() { { "text", (string)withs[i] } }
: (Dictionary<string, object>)withs[i];
try
{
var withDict = withs[i] is string
? new Dictionary<string, object>() { { "text", (string)withs[i] } }
: (Dictionary<string, object>)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);
Expand Down

0 comments on commit 1db0792

Please sign in to comment.