Wiki 9Minecraft VanillaConfig Mod Wiki
VanillaConfig Mod Wiki › Configuration

VanillaConfig Mod — Configuration

Creating a Config

The configuration process is divided into two main components: Categories and Options. Categories act as organizational headers or tabs within the UI, while Options represent the actual settings the user can modify.

Configuration Hierarchy

  1. Config Object: The root container for all settings.
  2. Categories: Created via [myConfig].addCategory("[category_name]"). These group related settings together.
  3. Options: Individual settings added to a category using type-specific methods (e.g., addBoolean, addInt).

Config Types

VanillaConfig supports a diverse range of data types, each mapped to a specific UI element in the configuration screen to ensure ease of use for the player.

Type UI Element Description
Boolean Toggle Button A simple ON/OFF switch for binary settings.
Integer Slider / Text Field Whole numbers, often used for scales or counts.
Double Slider / Text Field Decimal numbers for precise adjustments (e.g., opacity).
String Input Field Alphanumeric text for names, IDs, or custom labels.
Enum Cycle Button Cycles through a predefined list of constants or modes.
List Sub-menu A collection of values, allowing for complex multi-selection.
Color Color Picker Allows selection of colors via Hexadecimal or RGB values.

Option Migration & Version Management

To ensure that user settings are not lost during mod updates, VanillaConfig includes advanced systems for tracking file versions and migrating legacy keys.

Version Management

Configuration files can include a config_version integer. When a mod is updated and requires a new file format, VanillaConfig compares the version in the existing file to the current mod version. If they do not match, the mod can execute specific logic to update the file without resetting user preferences.

Option Migration

The OptionMigration class allows developers to map old configuration keys to new ones. If a setting is renamed in a newer version of the mod, VanillaConfig will automatically find the value under the old key and move it to the new one upon the first launch.

Config Screen

The Config Screen is the visual interface generated by the library. It is designed to match the native Minecraft 'Options' menu perfectly, providing a seamless user experience.

Key Features

  • Search Bar: Allows users to filter through dozens of options by typing keywords.
  • Reset to Default: Every individual option and every category has a reset button to quickly revert changes.
  • ModMenu Integration: VanillaConfig automatically integrates with the ModMenu mod, adding a 'Configure' button to the mod list for every mod that uses the library.
  • Dynamic Tooltips: Hovering over an option displays a descriptive tooltip, which can include multi-line explanations and default value indicators.