mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
refactor(DeclareCommands.cs): Move forge to switch version block
This commit is contained in:
parent
e569ffe0cc
commit
576575ff65
1 changed files with 13 additions and 13 deletions
|
|
@ -29,19 +29,7 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
Parser? parser = null;
|
||||
if ((flags & 0x03) == 2)
|
||||
{
|
||||
if (protocolVersion switch
|
||||
{
|
||||
Protocol18Handler.MC_1_19_Version => parserId == 50,
|
||||
Protocol18Handler.MC_1_19_2_Version => parserId == 50,
|
||||
Protocol18Handler.MC_1_19_3_Version => parserId == 50,
|
||||
Protocol18Handler.MC_1_19_4_Version => parserId == 50,
|
||||
Protocol18Handler.MC_1_20_Version => parserId == 51,
|
||||
Protocol18Handler.MC_1_20_2_Version => parserId == 51,
|
||||
_ => false
|
||||
})
|
||||
parser = new ParserForgeEnum(dataTypes, packetData);
|
||||
|
||||
else if (protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
if (protocolVersion <= Protocol18Handler.MC_1_19_2_Version)
|
||||
parser = parserId switch
|
||||
{
|
||||
1 => new ParserFloat(dataTypes, packetData),
|
||||
|
|
@ -59,6 +47,7 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
29 => new ParserScoreHolder(dataTypes, packetData),
|
||||
43 => new ParserResourceOrTag(dataTypes, packetData),
|
||||
44 => new ParserResource(dataTypes, packetData),
|
||||
50 => new ParserForgeEnum(dataTypes, packetData),
|
||||
_ => new ParserEmpty(dataTypes, packetData),
|
||||
};
|
||||
else if (protocolVersion <= Protocol18Handler.MC_1_19_3_Version) // 1.19.3
|
||||
|
|
@ -81,6 +70,7 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
42 => new ParserResourceOrTag(dataTypes, packetData),
|
||||
43 => new ParserResource(dataTypes, packetData),
|
||||
44 => new ParserResource(dataTypes, packetData),
|
||||
50 => new ParserForgeEnum(dataTypes, packetData),
|
||||
_ => new ParserEmpty(dataTypes, packetData),
|
||||
};
|
||||
else // 1.19.4+
|
||||
|
|
@ -104,6 +94,16 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
42 => new ParserResourceOrTag(dataTypes, packetData),
|
||||
43 => new ParserResource(dataTypes, packetData),
|
||||
44 => new ParserResource(dataTypes, packetData),
|
||||
50 => protocolVersion == Protocol18Handler.MC_1_19_4_Version ?
|
||||
new ParserForgeEnum(dataTypes, packetData) :
|
||||
new ParserEmpty(dataTypes, packetData),
|
||||
51 => (protocolVersion >= Protocol18Handler.MC_1_20_Version &&
|
||||
protocolVersion <= Protocol18Handler.MC_1_20_2_Version) ? // 1.20 - 1.20.2
|
||||
new ParserForgeEnum(dataTypes, packetData) :
|
||||
new ParserEmpty(dataTypes, packetData),
|
||||
52 => protocolVersion > Protocol18Handler.MC_1_20_2_Version ? // 1.20.2 +
|
||||
new ParserForgeEnum(dataTypes, packetData) :
|
||||
new ParserEmpty(dataTypes, packetData),
|
||||
_ => new ParserEmpty(dataTypes, packetData),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue