From 5a5165e89f3ed518f954c7f07c0eed9015acec9b Mon Sep 17 00:00:00 2001 From: Anon Date: Tue, 7 Apr 2026 17:00:01 +0200 Subject: [PATCH] Fixed a non-existant configuration packet from crashing the client. --- MinecraftClient/Protocol/Handlers/Protocol18.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index f63d9f77..9edf18ab 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -467,7 +467,19 @@ namespace MinecraftClient.Protocol.Handlers // https://wiki.vg/Protocol#Configuration case CurrentState.Configuration: - switch (packetPalette.GetIncomingConfigurationTypeById(packetId)) + if (!packetPalette.GetMappingInConfiguration().TryGetValue(packetId, out var configurationPacketType)) + { + if (packetPalette.GetMappingIn().ContainsKey(packetId)) + { + currentState = CurrentState.Play; + return HandlePlayPackets(packetId, packetData); + } + + throw new KeyNotFoundException("Configuration Packet ID of 0x" + packetId.ToString("X2") + + " doesn't exist!"); + } + + switch (configurationPacketType) { case ConfigurationPacketTypesIn.CookieRequest: var cookieName = dataTypes.ReadNextString(packetData);