Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Ukulib Wiki › Guides › How to Add a Config Screen to Your Own Mod Using Ukulib

How to Add a Config Screen to Your Own Mod Using Ukulib

Setting Up the Config

Ukulib provides a config system that other mods can hook into so their options appear in a consistent, widget-based screen. Start by defining your config values through Ukulib's config API rather than reading raw files yourself. Register each option with a type (boolean toggle, numeric slider, text field, or enum/cycle button) so Ukulib knows which widget to render. Group related options into categories or sections so the generated screen stays readable instead of one long scroll.

Wiring the Screen

Once your values are registered, tell Ukulib to build a screen for them. You typically create a screen factory that Ukulib calls when the player opens your options, and you pass it your config holder. Ukulib then lays out the widgets, handles saving when the player confirms, and reverts changes if they cancel. If you want a custom entry, you can supply your own widget factory for that one option while letting Ukulib handle the rest.

Testing In-Game

Launch the game and open your mod's config from the mod list or your own button. Change a few values, save, and reopen the screen to confirm they persisted. Check that sliders clamp to your min/max and that toggles reflect the stored state. If a widget looks wrong, revisit the option's type registration — mismatches between the declared type and the stored value are the usual cause.