Wiki 9Minecraft Wiki 9Minecraft
Improperui Wiki › Guides › Save and Load UI Configuration Values

Save and Load UI Configuration Values

Using Configuration Keys

ImproperUI supports saving UI state through modular config keys. This lets you persist user preferences like window position, toggle states, or text input values between game sessions.

Storing Values

1. Assign a unique config key to each element you want to save (e.g., config-key="player_name_input")

2. When the user changes the element (types in an input, moves a slider, clicks a toggle), capture that change in an event callback

3. Call the configuration save method with the key and new value

4. The mod automatically writes this to its config file

Retrieving Saved Values

When your UI initializes, query the config system for previously saved values using the same keys. Populate your UI elements with these values so users see their preferences restored.

For sliders and numeric inputs, convert the stored string value back to a number before applying it. For toggles and checkboxes, parse boolean values carefully. Test that values persist correctly across game restarts to ensure your configuration system works as intended.