Try fix BadPackets

This commit is contained in:
BruceChen 2022-10-10 15:32:39 +08:00
parent 7fba4fb9ab
commit dee085686f
3 changed files with 7 additions and 10 deletions

View file

@ -938,7 +938,7 @@ namespace MinecraftClient.Protocol.Handlers
{ {
List<byte> bytes = new() List<byte> bytes = new()
{ {
(byte)Convert.ToByte(paramBool) Convert.ToByte(paramBool)
}; };
return bytes.ToArray(); return bytes.ToArray();
} }

View file

@ -353,8 +353,7 @@ namespace MinecraftClient.Protocol.Handlers
handler.OnServerKeepAlive(); handler.OnServerKeepAlive();
break; break;
case PacketTypesIn.Ping: case PacketTypesIn.Ping:
int ID = dataTypes.ReadNextInt(packetData); SendPacket(PacketTypesOut.Pong, packetData);
SendPacket(PacketTypesOut.Pong, dataTypes.GetInt(ID));
break; break;
case PacketTypesIn.JoinGame: case PacketTypesIn.JoinGame:
handler.OnGameJoined(); handler.OnGameJoined();
@ -1383,11 +1382,9 @@ namespace MinecraftClient.Protocol.Handlers
byte windowID = dataTypes.ReadNextByte(packetData); byte windowID = dataTypes.ReadNextByte(packetData);
short actionID = dataTypes.ReadNextShort(packetData); short actionID = dataTypes.ReadNextShort(packetData);
bool accepted = dataTypes.ReadNextBool(packetData); bool accepted = dataTypes.ReadNextBool(packetData);
if (!accepted) if (!accepted && actionID > 0)
{
SendWindowConfirmation(windowID, actionID, accepted); SendWindowConfirmation(windowID, actionID, accepted);
} }
}
break; break;
case PacketTypesIn.ResourcePackSend: case PacketTypesIn.ResourcePackSend:
string url = dataTypes.ReadNextString(packetData); string url = dataTypes.ReadNextString(packetData);

View file

@ -50,11 +50,11 @@ If you'd like to contribute to Minecraft Console Client, great, just fork the re
Check out: [How to update or add translations for MCC](https://mccteam.github.io/guide/contibuting.html#translations). Check out: [How to update or add translations for MCC](https://mccteam.github.io/guide/contibuting.html#translations).
MCC now supports the following languages (Alphabetical order) : MCC now supports the following languages (Alphabetical order) :
* `de.ini` (57.12% translated) : Deutsch - German * `de.ini` (54.64% translated) : Deutsch - German
* `en.ini` : English - English * `en.ini` : English - English
* `fr.ini` (57.12% translated) : Français (France) - French * `fr.ini` (54.64% translated) : Français (France) - French
* `ru.ini` (56.18% translated) : Русский (Russkiy) - Russian * `ru.ini` (53.74% translated) : Русский (Russkiy) - Russian
* `vi.ini` (56.18% translated) : Tiếng Việt (Việt Nam) - Vietnamese * `vi.ini` (53.74% translated) : Tiếng Việt (Việt Nam) - Vietnamese
* `zh-Hans.ini` (100.00% translated) : 简体中文 - Chinese Simplified * `zh-Hans.ini` (100.00% translated) : 简体中文 - Chinese Simplified
* `zh-Hant.ini` (100.00% translated) : 繁體中文 - Chinese Traditional * `zh-Hant.ini` (100.00% translated) : 繁體中文 - Chinese Traditional