mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
fix: IndexOutOfRange on packet reading (Forge)
fix: IndexOutOfRange on packet reading (Forge)
This commit is contained in:
commit
ac9a70c159
1 changed files with 33 additions and 0 deletions
|
|
@ -47,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
|
||||
|
|
@ -69,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 if (protocolVersion <= Protocol18Handler.MC_1_20_2_Version)// 1.19.4 - 1.20.2
|
||||
|
|
@ -92,6 +94,13 @@ 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),
|
||||
_ => new ParserEmpty(dataTypes, packetData),
|
||||
};
|
||||
else // 1.20.3+
|
||||
|
|
@ -115,6 +124,7 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
43 => new ParserResourceOrTag(dataTypes, packetData),
|
||||
44 => new ParserResource(dataTypes, packetData),
|
||||
45 => new ParserResource(dataTypes, packetData),
|
||||
52 => new ParserForgeEnum(dataTypes, packetData),
|
||||
_ => new ParserEmpty(dataTypes, packetData),
|
||||
};
|
||||
}
|
||||
|
|
@ -670,5 +680,28 @@ namespace MinecraftClient.Protocol.Handlers.packet.s2c
|
|||
return "minecraft:time";
|
||||
}
|
||||
}
|
||||
|
||||
internal class ParserForgeEnum : Parser
|
||||
{
|
||||
public ParserForgeEnum(DataTypes dataTypes, Queue<byte> packetData)
|
||||
{
|
||||
dataTypes.ReadNextString(packetData);
|
||||
}
|
||||
|
||||
public override bool Check(string text)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetArgCnt()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public override string GetName()
|
||||
{
|
||||
return "forge:enum";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue