mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
1.20.3: Update chat parser to parse new NBT format
This commit is contained in:
parent
975aab88e3
commit
a9f1ad4433
4 changed files with 157 additions and 57 deletions
|
|
@ -71,7 +71,7 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
44 => new ParserResource(dataTypes, packetData),
|
||||
_ => new ParserEmpty(dataTypes, packetData),
|
||||
};
|
||||
else // 1.19.4+
|
||||
else if (protocolVersion <= Protocol18Handler.MC_1_20_2_Version)// 1.19.4 - 1.20.2
|
||||
parser = parserId switch
|
||||
{
|
||||
1 => new ParserFloat(dataTypes, packetData),
|
||||
|
|
@ -94,11 +94,34 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
44 => new ParserResource(dataTypes, packetData),
|
||||
_ => new ParserEmpty(dataTypes, packetData),
|
||||
};
|
||||
else // 1.20.3+
|
||||
parser = parserId switch
|
||||
{
|
||||
1 => new ParserFloat(dataTypes, packetData),
|
||||
2 => new ParserDouble(dataTypes, packetData),
|
||||
3 => new ParserInteger(dataTypes, packetData),
|
||||
4 => new ParserLong(dataTypes, packetData),
|
||||
5 => new ParserString(dataTypes, packetData),
|
||||
6 => new ParserEntity(dataTypes, packetData),
|
||||
8 => new ParserBlockPos(dataTypes, packetData),
|
||||
9 => new ParserColumnPos(dataTypes, packetData),
|
||||
10 => new ParserVec3(dataTypes, packetData),
|
||||
11 => new ParserVec2(dataTypes, packetData),
|
||||
18 => new ParserMessage(dataTypes, packetData),
|
||||
27 => new ParserRotation(dataTypes, packetData),
|
||||
30 => new ParserScoreHolder(dataTypes, packetData),
|
||||
41 => new ParserTime(dataTypes, packetData),
|
||||
42 => new ParserResourceOrTag(dataTypes, packetData),
|
||||
43 => new ParserResourceOrTag(dataTypes, packetData),
|
||||
44 => new ParserResource(dataTypes, packetData),
|
||||
45 => new ParserResource(dataTypes, packetData),
|
||||
_ => new ParserEmpty(dataTypes, packetData),
|
||||
};
|
||||
}
|
||||
|
||||
string? suggestionsType = ((flags & 0x10) == 0x10) ? dataTypes.ReadNextString(packetData) : null;
|
||||
|
||||
Nodes[i] = new(flags, childs, redirectNode, name, parser, suggestionsType);
|
||||
Nodes[i] = new(flags, childs, redirectNode, name, parser, suggestionsType, parserId);
|
||||
}
|
||||
RootIdx = dataTypes.ReadNextVarInt(packetData);
|
||||
|
||||
|
|
@ -174,6 +197,7 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
public string? Name;
|
||||
public Parser? Paser;
|
||||
public string? SuggestionsType;
|
||||
public int ParserId; // Added for easy debug
|
||||
|
||||
|
||||
public CommandNode(byte Flags,
|
||||
|
|
@ -181,7 +205,8 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
int RedirectNode = -1,
|
||||
string? Name = null,
|
||||
Parser? Paser = null,
|
||||
string? SuggestionsType = null)
|
||||
string? SuggestionsType = null,
|
||||
int parserId = -1)
|
||||
{
|
||||
this.Flags = Flags;
|
||||
this.Clildren = Clildren;
|
||||
|
|
@ -189,6 +214,7 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
this.Name = Name;
|
||||
this.Paser = Paser;
|
||||
this.SuggestionsType = SuggestionsType;
|
||||
ParserId = parserId;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue