mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
fix: correct scoreboard packet parsing for UpdateScore and ScoreboardObjective
UpdateScore Display Name was read with ReadNextString instead of ReadNextChat. In 1.20.4+ Text Components are NBT-encoded, causing ReadNextString to misinterpret the tag type byte as a string length prefix, corrupting the read offset and exhausting the packet queue. Also fix incomplete Number Format consumption in both UpdateScore and ScoreboardObjective: the styled (Compound Tag) and fixed (Text Component) payloads after the VarInt enum were not being read, leaving stale bytes in the packet queue.
This commit is contained in:
parent
d96396f74d
commit
fbacc550e2
1 changed files with 23 additions and 2 deletions
|
|
@ -3034,7 +3034,18 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
if (protocolVersion >= MC_1_20_4_Version)
|
||||
{
|
||||
if (dataTypes.ReadNextBool(packetData)) // Has Number Format
|
||||
{
|
||||
numberFormat = dataTypes.ReadNextVarInt(packetData); // Number Format
|
||||
switch (numberFormat)
|
||||
{
|
||||
case 1: // styled
|
||||
dataTypes.ReadNextNbt(packetData); // Styling compound tag
|
||||
break;
|
||||
case 2: // fixed
|
||||
dataTypes.ReadNextChat(packetData); // Content text component
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3055,11 +3066,21 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
objectiveValue2 = dataTypes.ReadNextVarInt(packetData); // Value
|
||||
|
||||
if (dataTypes.ReadNextBool(packetData)) // Has Display Name
|
||||
objectiveDisplayName3 =
|
||||
ChatParser.ParseText(dataTypes.ReadNextString(packetData)); // Has Display Name
|
||||
objectiveDisplayName3 = dataTypes.ReadNextChat(packetData);
|
||||
|
||||
if (dataTypes.ReadNextBool(packetData)) // Has Number Format
|
||||
{
|
||||
numberFormat2 = dataTypes.ReadNextVarInt(packetData); // Number Format
|
||||
switch (numberFormat2)
|
||||
{
|
||||
case 1: // styled
|
||||
dataTypes.ReadNextNbt(packetData); // Styling compound tag
|
||||
break;
|
||||
case 2: // fixed
|
||||
dataTypes.ReadNextChat(packetData); // Content text component
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue