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);CONFIGis instance ofTritiumConfigcreateConfigScreenreturnsScreenthat can be pushed directly- On save, calls
config.save()to write back to disk
Widget Mapping
boolean→ Toggle switchint/long/double→ Numeric input (supports@Rangemin/max)String→ Single-line text boxenum→ 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"
@SubCategoryfields 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
@ClientOnlyand current environment is server side - Check if using unsupported type (only support boolean, numeric, string, enum,
List\<String\>)
- Check if marked
- UI value changes not persisted to disk?
- This screen calls
config.save()when saving; confirm save operation triggered
- This screen calls