From 745678e869baa476487d9f1a91602a42bb3e63cb Mon Sep 17 00:00:00 2001 From: Somersault <130008175+Somersault41@users.noreply.github.com> Date: Mon, 29 Jun 2026 00:46:52 +0300 Subject: [PATCH] AutoRelog McClient.cs --- MinecraftClient/McClient.cs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/MinecraftClient/McClient.cs b/MinecraftClient/McClient.cs index 753de486..3aa23c40 100644 --- a/MinecraftClient/McClient.cs +++ b/MinecraftClient/McClient.cs @@ -551,8 +551,33 @@ namespace MinecraftClient if (!consoleReadThreadOwned) { - ConsoleIO.Backend.BeginReadThread(); - consoleReadThreadOwned = true; + try + { + ConsoleIO.Backend.BeginReadThread(); + consoleReadThreadOwned = true; + } + catch (Exception ex) + { + try + { + ConsoleIO.Backend.StopReadThread(); + } + catch (Exception stopEx) + { + ConsoleIO.WriteLineFormatted($"§c[MCC] Failed to stop stale console input thread during reconnect: {stopEx.Message}"); + } + + try + { + ConsoleIO.Backend.BeginReadThread(); + consoleReadThreadOwned = true; + } + catch (Exception retryEx) + { + ConsoleIO.WriteLineFormatted($"§c[MCC] Failed to start console input thread after reconnect retry: {retryEx.Message}"); + consoleReadThreadOwned = false; + } + } } if (!consoleHandlersAttached)