Skip to content

Config Screen

MehVahdJukaar edited this page Jul 25, 2026 · 1 revision

Config Screen

Every config defined with Moonlight gets an in game screen. You write no UI code for it.

This is the Cloth Config / Configured slot, except it's already there and identical on every loader. Each option picks its own control: sliders for ranges, a swatch and picker for colors, dropdowns for enums, item pickers for registry values, a dedicated editor for lists, a generated form for schema objects, a highlighted JSON editor for everything else.

It also has search across categories, breadcrumbs, reload warnings on values that need one, and it can push a COMMON_SYNCED config to the server when you edit it in game.

Getting Started

Nothing to do. Define a config with ConfigBuilder and the screen exists. Open it with /mnl config, or /mnl config <modid> for one mod, or from the loader's mod list.

To open it from code: CONFIG.makeScreen(parentScreen).

Other mods' configs

Two client options, both off by default:

  • show_all_mod_configs: show a tile for every installed mod that has a config screen at all. Clicking one opens whatever screen that mod registered.
  • convert_foreign_configs: NeoForge only. Read another mod's ModConfigSpec and render it inside Moonlight's screen. Best effort, anything that can't be represented falls back to the mod's own screen.

Set custom_config_screen = false to turn the whole thing off and go back to the loader's screen.

Discover Mods

There's also a "more mods by this author" page, listing the author's other mods with their icons, marking which you already have. It fetches its data only when opened.

Extending it

Two hooks, both keyed by mod id, both called once from client setup.

// draw over your own mod's config screen: a banner, a link, whatever
ConfigScreenExtensions.registerOverlay(MyMod.MOD_ID, (graphics, panel, mouseX, mouseY, partialTick) ->
        graphics.blit(BANNER, panel.left(), panel.top(), 0, 0, panel.right() - panel.left(), 32));

// bind a config icon(...) id to a stack the default item/block lookup can't produce
ConfigScreenExtensions.registerIcon(MyMod.res("fancy_thing"), () -> makeStackWithComponents());

Overlay can also consume clicks, so you can put your own widget in there.

Clone this wiki locally