Wiki 9Minecraft Wiki 9Minecraft
Vanillaconfig Wiki › Guides › Create and Register Your First Configuration File

Create and Register Your First Configuration File

Setting Up Your Config Class

Start by creating a central configuration class in your mod. This class will hold all your configuration values and serve as the single source of truth for settings.

Building and Registering the Config

1. Use the VanillaConfig builder API to define your configuration file, specifying your mod's identifier as the file name.

2. Add categories to group related settings—for example, "gameplay", "performance", or "visuals".

3. Within each category, declare entries with a name, type (boolean, int, string, etc.), default value, and a description for players.

4. Call the build method to finalize the configuration structure.

5. Register this configuration during your mod's initialization phase, typically in your main mod class or setup event handler.

Once registered, VanillaConfig automatically loads existing values from disk or uses your defaults. The mod keeps the in-memory config synchronized with the file, so you don't need to manually handle file I/O. You can now access configuration values throughout your mod by referencing your config class.