mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fixed a NBT crash < 1.20.2 and Fixed a crash with parsing 'extra' section in Chat
This commit is contained in:
parent
6d016332fb
commit
35cfd4a7db
2 changed files with 5 additions and 8 deletions
|
|
@ -565,12 +565,9 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
var nextId = cache.Dequeue();
|
var nextId = cache.Dequeue();
|
||||||
if (protocolversion < Protocol18Handler.MC_1_20_2_Version)
|
if (protocolversion < Protocol18Handler.MC_1_20_2_Version)
|
||||||
{
|
{
|
||||||
if (nextId is 10) // TAG_Compound
|
if (nextId is not 10) // TAG_Compound
|
||||||
throw new System.IO.InvalidDataException("Failed to decode NBT: Does not start with TAG_Compound");
|
throw new System.IO.InvalidDataException("Failed to decode NBT: Does not start with TAG_Compound");
|
||||||
|
|
||||||
// Read TAG_Compound
|
|
||||||
ReadNextByte(cache);
|
|
||||||
|
|
||||||
// NBT root name
|
// NBT root name
|
||||||
var rootName = Encoding.ASCII.GetString(ReadData(ReadNextUShort(cache), cache));
|
var rootName = Encoding.ASCII.GetString(ReadData(ReadNextUShort(cache), cache));
|
||||||
|
|
||||||
|
|
@ -595,9 +592,6 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
{ "", result }
|
{ "", result }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read TAG_Compound
|
|
||||||
//ReadNextByte(cache);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -452,7 +452,10 @@ namespace MinecraftClient.Protocol.Message
|
||||||
object[] extras = (object[])value;
|
object[] extras = (object[])value;
|
||||||
for (int i = 0; i < extras.Length; i++)
|
for (int i = 0; i < extras.Length; i++)
|
||||||
{
|
{
|
||||||
var extraDict = (Dictionary<string, object>)extras[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");
|
extraBuilder.Append(NbtToString(extraDict) + "§r");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue