From 0a9644a8a06ed280c0f595bb6d91bb55eecf1305 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Wed, 26 Jul 2023 09:18:05 -0400 Subject: [PATCH] More documentation inside config file --- .../core/config/ModernFixEarlyConfig.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java b/common/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java index 6af200f5..601f71c9 100644 --- a/common/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java +++ b/common/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java @@ -373,9 +373,17 @@ public class ModernFixEarlyConfig { try (Writer writer = new FileWriter(configFile)) { writer.write("# This is the configuration file for ModernFix.\n"); + writer.write("# In general, prefer using the config screen to editing this file. It can be accessed\n"); + writer.write("# via the standard mod menu on your respective mod loader. Changes will, however,\n"); + writer.write("# require restarting the game to take effect.\n"); writer.write("#\n"); writer.write("# The following options can be enabled or disabled if there is a compatibility issue.\n"); - writer.write("# Add a line mixin.example_name=true/false without the # sign to enable/disable a rule.\n"); + writer.write("# Add a line with your option name and =true or =false at the bottom of the file to enable\n"); + writer.write("# or disable a rule. For example:\n"); + writer.write("# mixin.perf.dynamic_resources=true\n"); + writer.write("# Do not include the #. You may reset to defaults by deleting this file.\n"); + writer.write("#\n"); + writer.write("# Available options:\n"); List keys = this.options.keySet().stream() .filter(key -> !key.equals("mixin.core")) .sorted() @@ -385,17 +393,20 @@ public class ModernFixEarlyConfig { Option option = this.options.get(line); String extraContext = ""; if(option != null) { - if(option.isModDefined()) - extraContext = " # (overridden for mod compat)"; + if(!option.isUserDefined()) + extraContext = "=" + option.isEnabled() + " # " + (option.isModDefined() ? "(overridden for mod compat)" : "(default)"); else { boolean defaultEnabled = DEFAULT_SETTING_OVERRIDES.getOrDefault(line, true); - extraContext = " # (default: " + defaultEnabled + ")"; + extraContext = "=" + defaultEnabled + " # (default)"; } } - writer.write("# " + line + "\n"); + writer.write("# " + line + extraContext + "\n"); } } + writer.write("#\n"); + writer.write("# User overrides go here.\n"); + for (String key : keys) { Option option = this.options.get(key); if(option.isUserDefined())