Skip to content

Auto Configuration UI (Cloth Config)

TritiumAutoConfig can auto-generate Cloth Config v15 configuration screen based on your configuration class.

Quick Usage

java
import me.zcraft.tc.config.TritiumAutoConfig;
import net.minecraft.client.gui.screens.Screen;

Screen screen = new TritiumAutoConfig(CONFIG).createConfigScreen(parent);
  • CONFIG is instance of TritiumConfig
  • createConfigScreen returns Screen that can be pushed directly
  • On save, calls config.save() to write back to disk

Widget Mapping

  • boolean → Toggle switch
  • int/long/double → Numeric input (supports @Range min/max)
  • String → Single-line text box
  • enum → Dropdown selection (shows enum constant names)
  • List\<String\> → String list editor

Default values, tooltips, and titles all use localization keys; see "Internationalization" for details.

Categories and Subcategories

  • Each top-level field (if contains configurable inner fields) generates a "category"
  • @SubCategory fields appear as "collapsible subcategory" and can nest recursively

Empty Category Placeholder

Cloth Config v15 requires at least one category. If scan doesn't generate any categories, library automatically adds placeholder category named general to ensure UI builds correctly.

Common Issues

  • Can't see entries I added?
    • Check if marked @ClientOnly and current environment is server side
    • Check if using unsupported type (only support boolean, numeric, string, enum, List\<String\>)
  • UI value changes not persisted to disk?
    • This screen calls config.save() when saving; confirm save operation triggered