-
Notifications
You must be signed in to change notification settings - Fork 1
Config Files
While editing config files manually is fully supported, you may find it easier to use config menus and commands. Be sure you read about those first.
Config files of mods which use the Simple Config API are written in YAML format, and have translated documentation comments.
Documentation comments use a double hash symbol (##), so they can be differentiated from user comments (#). User comments and blank lines are preserved when files are saved (since Simple Config overwrites all files when Minecraft is loaded to correct invalid values), but documentation comments are reset every time to the comments the mod you're editing provides.
This has the advantage of being able to translate documentation comments, since Minecraft loads mod translations after it creates configuration files (even English translations). This allows modders to write the documentation for their config files in a single place, translations.
It also forces mods to have translatable config files, which doesn't necessarily force them to translate them, but enables their communities to do so. Whether entries are translated or not, they will all have at least a type descriptor, hinting at which values it can accept. Some entries even display suggestions in their type descriptors, as they would in the menu.

There is a limit you can configure to how many suggestions can appear in config comments, since some entries could have thousands of suggestions (suggesting all items in the game), but in general you may want to enable line wrapping in your editor to read long type descriptors.
Sometimes it can happen that Minecraft crashes before it has time to load its translations. In this case, it is possible that the config files will be saved without any translated documentation, only with type descriptors. To fix this problem, fix your crash and launch Minecraft successfully again.
If the crash is precisely caused by a config file, you may find some .bak backup files Forge sometimes creates in the same folder. Otherwise, a desperate solution can be deleting the file (or temporarily renaming it) so it gets regenerated with the default values (which should fix the crash, if it was really caused by the config file).
If you edit the config files manually, be sure you write correct YAML. Invalid YAML will likely result in a crash, or your config being reset to its default. Use a text editor with support for YAML files, such as Notepad++, Visual Studio Code or an actual IDE, such as IntelliJ IDEA.
If you're an advanced YAML user, you may be aware that YAML supports many useful features, such as alias nodes and node tags. Since Simple Config overwrites config files every time they are modified to correct invalid values (and also when edited with config menus and commands), any aliases you could have declared will be lost.
Additionally, you shouldn't need to use any node tags within config files, as Simple Config already loads them in knowledge of the expected type for each entry. This also means that you can't declare undefined entries in the file. They would be deleted when overwritten.
For the technically inclined, Simple Config makes use of SnakeYAML to both read and write YAML files.
If you have any doubts, feel free to drop by the official Discord Server.