diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs index 16c35cca3b..2d5ff0e3bc 100644 --- a/MinecraftClient/McClient.cs +++ b/MinecraftClient/McClient.cs @@ -442,6 +442,9 @@ public void Transfer(string newHost, int newPort) ResetStateForTransfer(); + // Snapshot cookies before Dispose clears them + Dictionary savedCookies = new Dictionary(Cookies); + // Retire the old handler so its updater exits without reporting a stale disconnect. oldHandler.Dispose(); oldClient.Close(); @@ -457,6 +460,7 @@ public void Transfer(string newHost, int newPort) // Reinitialize the protocol handler handler = Protocol.ProtocolHandler.GetProtocolHandler(client, protocolversion, null, this); + Cookies = savedCookies; // Restore cookies for the new connection before login Log.Info($"Connected to {resolvedHost}:{resolvedPort}"); // Retry login process