Skip to content

Configuration File Format

Tritium Configuration reads and writes TOML-like "section + key-value" format, but the parser is custom-implemented (ConfigParser).

File Location

  • Default: config/<modId>/<filename>.toml
  • Customize filename via TritiumConfig#filename(String) (without extension)

Basic Structure

  • Comments: Lines starting with # are ignored
  • Section: [section], typically corresponds to top-level fields of config class
  • Key-value: key = value
  • Strings: Must be wrapped in double quotes
  • Lists: Only support string lists, e.g., ["a", "b"]

Example:

toml
# your_mod Configuration
# Generated by TritiumConfig
# Environment: client
# Client-only sections will not be generated on server side

[general]
## Enabled
enabled = true

## Max Entities
maxEntities = 64

## Mode
mode = "SIMPLE"

#-------------------------
# Client
#-------------------------

## whitelist
whitelist = ["minecraft:player", "minecraft:villager"]

Type Parsing Details

  • boolean: true/false, also compatible (case-insensitive) with t/1/yes/y
  • int/long/double: Parse as corresponding numeric type after stripping spaces; parse failure reverts to default and logs warning
  • enum: Parse from string, case-insensitive (matches Enum.name())
  • List\<String\>: Supports [...] or single value (auto-wrapped as single-element list)

Flattened Keys and Subcategories

Subcategories expand to "dot-separated path" keys: \<section\>.\<sub\>.\<field\>. On save, library groups by section and inserts comments, horizontal lines.

config_version Notes

  • Generated file by default doesn't include config_version
  • When migration exists, migrator writes config_version = \<new version\>
  • Note: file written by default migration is "pure key-value list", won't preserve original section structure.
    • To restore pretty section format after migration, call save() once (e.g., open UI and save)