Skip to content

Settings, input, and localization ​

Settings ​

mod.Configuration.Define<T>(id, defaultValue, options) returns a Setting<T>. Supported types are bool, string, int, float, double, and enums. SettingOptions<T> supplies display text, category, scope, optional numeric range or text length, read-only state, and custom validation.

SettingScopeLocation and availability
ClientLocalLocal client.json. Available outside a world.
ServerHost installation's server.json. Access requires authority in a world.
WorldData in the active world's database. Access requires authority.
StartupLocal startup.json. Edits become active on process restart.

Installation files live under StellarWorks/Config/<mod-id>/ in the game's persistent data path. Read Value for the active value and PendingValue to display a pending startup change. Check IsAvailable and CanEdit for scope and editability. Changed emits a SettingChangedEvent with the setting and restart flag. Declare configuration schemas and migrations before reading installation files.

Input ​

mod.Input.RegisterAction(id, InputActionDefinition) returns a ModInputAction. Its definition supplies a display name, a KeyChord, and optional InputContext flags. Gameplay is the default context. Use Pressed, Released, and BindingChanged for callbacks, and IsHeld for current state. Actions can be enabled and disabled.

KeyChord.Parse accepts a key such as F8 or an exact combination such as Ctrl+Shift+F8. An empty chord unbinds the action. Rebind and ResetBinding persist local changes in bindings.json. FindConflict checks an exact chord against other bindings. Text entry suppresses actions unless AllowDuringTextEntry is enabled.

Localization and console ​

mod.Localization.Text(key, fallback) returns LocalizedText for APIs that accept translated labels. Get resolves text immediately and Format applies arguments. The framework tries the current locale and parent language, then the mod default (English unless set through SetDefaultLocale), then the supplied fallback. Listen to Changed when a cached label needs to follow the active language.

mod.Console.RegisterCommand(name, description, handler) registers a globally unique command on the game thread. The handler receives the trimmed arguments as one string and runs on the local game thread. WriteLine(text, color) writes to the local console from any thread. Settings, input, and console examples

StellarWorks documentation · Mods for StellarDrive