-
Notifications
You must be signed in to change notification settings - Fork 56
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.
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).
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'sModConfigSpecand 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.
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.
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.
Basics Platform Helpers Registration Networking Events Configs Config Screen
Resources Runtime Resource Packs Texture Manipulation Resource Helpers Block Set API
Client Custom Models Item Rendering Rendered Textures Post Shaders GUI Toolkit Colors
World Block and Item Interfaces Additional Item Placements Improved Entities Fake Levels World Data Dispenser Behaviors
Utilities Codec Utilities Misc Helpers Commands
Datapacks Villagers Soft Fluids Map Markers Spawn Boxes Global Datapack Folder