mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fixed translations crash
This commit is contained in:
parent
620e8bf274
commit
bc0781cee9
2 changed files with 5706 additions and 4990 deletions
|
|
@ -450,13 +450,19 @@ namespace MinecraftClient.Protocol.Message
|
|||
case "extra":
|
||||
{
|
||||
object[] extras = (object[])value;
|
||||
for (int i = 0; i < extras.Length; i++)
|
||||
for (var i = 0; i < extras.Length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
var extraDict = extras[i] is string
|
||||
? new Dictionary<string, object>() { { "text", (string)extras[i] } }
|
||||
: (Dictionary<string, object>)extras[i];
|
||||
var extraDict = extras[i] switch
|
||||
{
|
||||
int => new Dictionary<string, object> { { "text", $"{extras[i]}" } },
|
||||
string => new Dictionary<string, object>
|
||||
{
|
||||
{ "text", (string)extras[i] }
|
||||
},
|
||||
_ => (Dictionary<string, object>)extras[i]
|
||||
};
|
||||
|
||||
extraBuilder.Append(NbtToString(extraDict) + "§r");
|
||||
}
|
||||
|
|
@ -480,13 +486,19 @@ namespace MinecraftClient.Protocol.Message
|
|||
if (nbt.TryGetValue("with", out object withComponent))
|
||||
{
|
||||
var withs = (object[])withComponent;
|
||||
for (int i = 0; i < withs.Length; i++)
|
||||
for (var i = 0; i < withs.Length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
var withDict = withs[i] is string
|
||||
? new Dictionary<string, object>() { { "text", (string)withs[i] } }
|
||||
: (Dictionary<string, object>)withs[i];
|
||||
var withDict = withs[i] switch
|
||||
{
|
||||
int => new Dictionary<string, object> { { "text", $"{withs[i]}" } },
|
||||
string => new Dictionary<string, object>
|
||||
{
|
||||
{ "text", (string)withs[i] }
|
||||
},
|
||||
_ => (Dictionary<string, object>)withs[i]
|
||||
};
|
||||
|
||||
translateString.Add(NbtToString(withDict));
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue