From 83f14a64f879246ef94a1b3175e2c3759a45c949 Mon Sep 17 00:00:00 2001 From: BruceChen Date: Sun, 29 Mar 2026 01:31:31 +0800 Subject: [PATCH 1/2] Add tryout command for TUI onboarding Add a new /tryout command as an extensible entry point for recommended feature trials, with /tryout tui as the first action. The command updates [Console.General] ConsoleMode to "tui", writes the config back immediately, and explains both how to revert the change and that a restart is required. Also show a startup recommendation in classic console mode when stdin is interactive, so users can discover the TUI experience without manually editing MinecraftClient.ini. All user-facing text is routed through the translation resources. --- MinecraftClient/Commands/Tryout.cs | 63 +++++++++++++++++++ MinecraftClient/Program.cs | 14 +++++ .../Translations/Translations.Designer.cs | 54 ++++++++++++++++ .../Resources/Translations/Translations.resx | 20 +++++- 4 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 MinecraftClient/Commands/Tryout.cs diff --git a/MinecraftClient/Commands/Tryout.cs b/MinecraftClient/Commands/Tryout.cs new file mode 100644 index 00000000..8ae0829b --- /dev/null +++ b/MinecraftClient/Commands/Tryout.cs @@ -0,0 +1,63 @@ +using Brigadier.NET; +using Brigadier.NET.Builder; +using MinecraftClient.CommandHandler; +using static MinecraftClient.Settings.ConsoleConfigHealper.ConsoleConfig; + +namespace MinecraftClient.Commands +{ + public class Tryout : Command + { + public override string CmdName => "tryout"; + public override string CmdUsage => "tryout [list|tui]"; + public override string CmdDesc => Translations.cmd_tryout_desc; + + public override void RegisterCommand(CommandDispatcher dispatcher) + { + dispatcher.Register(l => l.Literal("help") + .Then(l => l.Literal(CmdName) + .Executes(r => GetUsage(r.Source)) + ) + ); + + dispatcher.Register(l => l.Literal(CmdName) + .Executes(r => ListTryouts(r.Source)) + .Then(l => l.Literal("list") + .Executes(r => ListTryouts(r.Source))) + .Then(l => l.Literal("tui") + .Executes(r => EnableTuiMode(r.Source))) + .Then(l => l.Literal("_help") + .Executes(r => GetUsage(r.Source)) + .Redirect(dispatcher.GetRoot().GetChild("help").GetChild(CmdName))) + ); + } + + private int GetUsage(CmdResult r) + { + return r.SetAndReturn(GetCmdDescTranslated()); + } + + private int ListTryouts(CmdResult r) + { + return r.SetAndReturn(string.Join('\n', + GetCmdDescTranslated(), + string.Empty, + Translations.cmd_tryout_list_header, + $" - {Translations.cmd_tryout_list_tui}")); + } + + private int EnableTuiMode(CmdResult r) + { + var previousMode = Settings.Config.Console.General.ConsoleMode; + if (previousMode == ConsoleModeType.tui) + { + return r.SetAndReturn(CmdResult.Status.Done, Translations.cmd_tryout_tui_already_enabled); + } + + Settings.Config.Console.General.ConsoleMode = ConsoleModeType.tui; + Program.WriteBackSettings(); + + return r.SetAndReturn(CmdResult.Status.Done, + string.Format(Translations.cmd_tryout_tui_enabled, previousMode, ConsoleModeType.tui)); + } + } +} diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs index c0e7710d..18d8ce88 100644 --- a/MinecraftClient/Program.cs +++ b/MinecraftClient/Program.cs @@ -193,6 +193,7 @@ namespace MinecraftClient if (!ProcessStartupState(startupState)) return; + MaybePrintClassicModeTuiRecommendation(); RunStartupSequence(args); } @@ -247,6 +248,19 @@ namespace MinecraftClient return true; } + private static void MaybePrintClassicModeTuiRecommendation() + { + if (ConsoleIO.BasicIO + || Config.Console.General.ConsoleMode != ConsoleModeType.classic + || Console.IsInputRedirected) + { + return; + } + + char cmdChar = Config.Main.Advanced.InternalCmdChar.ToChar(); + ConsoleIO.WriteLineFormatted("§8" + string.Format(Translations.mcc_console_mode_tui_recommendation, cmdChar)); + } + /// /// Handles a failed config load by prompting the user to fix or regenerate the config file. /// diff --git a/MinecraftClient/Resources/Translations/Translations.Designer.cs b/MinecraftClient/Resources/Translations/Translations.Designer.cs index 3a2c4bc9..242752e6 100644 --- a/MinecraftClient/Resources/Translations/Translations.Designer.cs +++ b/MinecraftClient/Resources/Translations/Translations.Designer.cs @@ -3558,6 +3558,51 @@ namespace MinecraftClient { } } + /// + /// Looks up a localized string similar to quickly enable recommended features.. + /// + internal static string cmd_tryout_desc { + get { + return ResourceManager.GetString("cmd.tryout.desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Available quick actions:. + /// + internal static string cmd_tryout_list_header { + get { + return ResourceManager.GetString("cmd.tryout.list.header", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to tui: set [Console.General] ConsoleMode = "tui" for the next restart.. + /// + internal static string cmd_tryout_list_tui { + get { + return ResourceManager.GetString("cmd.tryout.list.tui", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [Console.General] ConsoleMode is already "tui" in the config. To switch back, set [Console.General] ConsoleMode = "classic". Restart MCC after changing it for the new mode to take effect.. + /// + internal static string cmd_tryout_tui_already_enabled { + get { + return ResourceManager.GetString("cmd.tryout.tui.already_enabled", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Updated [Console.General] ConsoleMode from "{0}" to "{1}" in the config. To switch back, set [Console.General] ConsoleMode = "classic". Restart MCC to apply the change.. + /// + internal static string cmd_tryout_tui_enabled { + get { + return ResourceManager.GetString("cmd.tryout.tui.enabled", resourceCulture); + } + } + /// /// Looks up a localized string similar to Display Health and Food saturation.. /// @@ -5534,6 +5579,15 @@ namespace MinecraftClient { } } + /// + /// Looks up a localized string similar to Tip: try TUI mode for a cleaner interface, mouse-friendly container actions, and a nicer layout. Run {0}feature tui§8 to switch [Console.General] ConsoleMode to "tui" for the next restart.. + /// + internal static string mcc_console_mode_tui_recommendation { + get { + return ResourceManager.GetString("mcc.console_mode_tui_recommendation", resourceCulture); + } + } + /// /// Looks up a localized string similar to To sign in, open {0} in your browser and enter the code: {1}. /// diff --git a/MinecraftClient/Resources/Translations/Translations.resx b/MinecraftClient/Resources/Translations/Translations.resx index 68202894..b028064d 100644 --- a/MinecraftClient/Resources/Translations/Translations.resx +++ b/MinecraftClient/Resources/Translations/Translations.resx @@ -1249,6 +1249,21 @@ Change EnableEmoji=false in the settings if the display is confusing. No active effects. + + try a recommended feature. + + + Available tryouts: + + + tui: set [Console.General] ConsoleMode = "tui" for the next restart. + + + [Console.General] ConsoleMode is already "tui" in the config. To switch back, set [Console.General] ConsoleMode = "classic". Restart MCC after changing it for the new mode to take effect. + + + Updated [Console.General] ConsoleMode from "{0}" to "{1}" in the config. To switch back, set [Console.General] ConsoleMode = "classic". Restart MCC to apply the change. + Display Health and Food saturation. @@ -1863,6 +1878,9 @@ You can use "/chunk status {0:0.0} {1:0.0} {2:0.0}" to check the chunk loading s Connecting to {0}... + + Tip: try TUI mode for a cleaner interface, mouse-friendly inventory actions, and a nicer layout. Run {0}tryout tui§8 to switch [Console.General] ConsoleMode to "tui" for the next restart. + To sign in, open {0} in your browser and enter the code: §e{1} @@ -2392,4 +2410,4 @@ see item details. Crafting - \ No newline at end of file + From b757215dbb2146b3948a9484c6837b95789560d5 Mon Sep 17 00:00:00 2001 From: BruceChen Date: Sun, 29 Mar 2026 01:33:59 +0800 Subject: [PATCH 2/2] Temporarily disable classic mode TUI recommendation Commented out the MaybePrintClassicModeTuiRecommendation function call to prevent its execution until the related issue is resolved. Reference to the issue is included for tracking purposes. --- MinecraftClient/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MinecraftClient/Program.cs b/MinecraftClient/Program.cs index 18d8ce88..946a4d85 100644 --- a/MinecraftClient/Program.cs +++ b/MinecraftClient/Program.cs @@ -193,7 +193,9 @@ namespace MinecraftClient if (!ProcessStartupState(startupState)) return; - MaybePrintClassicModeTuiRecommendation(); + // Wait for this issue to be fixed before enabling it: https://github.com/Consolonia/Consolonia/issues/602 + // MaybePrintClassicModeTuiRecommendation(); + RunStartupSequence(args); }