Back to mods
Config X project artwork

CurseForge · Minecraft mod

Config X

A fabric API library for plugins to load & save configurations

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which Config X release should I use?

Updated 1 year ago
Latest stable file configx-2.0.1.jar
Game version 1.21.5, 1.21.4
Loader Fabric

Config X configx-2.0.1.jar targets 1.21.5, 1.21.4 with Fabric. The project page does not say whether this file belongs on the client, dedicated server, or both. No extra mods listed for this file.

Where it goes

Is Config X required on the client, server, or both?

The project page does not say whether this file belongs on the client, dedicated server, or both.

Client Source doesn’t say
Dedicated server Source doesn’t say
Loader for this release Fabric
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

The source does not explicitly classify this release as client-only or server-only.

What else does Config X configx-2.0.1.jar need?

configx-2.0.1.jar. Change the file and its required mods may change too.

No extra mods listed for this file

This file does not list any required mods. Do not add a library just because a different file uses it.

This file does not list any required or optional mods.

Before you install it

Add Config X without breaking your instance.

Built for Config X configx-2.0.1.jar. Pick another file and the loader, install side or required mods may change.

  1. 01

    Stick to this file

    Use configx-2.0.1.jar. It targets 1.21.5, 1.21.4 with Fabric; another release may have different loader, side or dependency requirements.

  2. 02

    Bring the mods it needs

    This file does not list any required mods. Do not add a library just because a different file uses it.

  3. 03

    Put it on the correct side

    The project page does not say whether this file belongs on the client, dedicated server, or both.

  4. 04

    Pick the file you checked

    Use the “Get this file” button beside configx-2.0.1.jar. It opens that exact file at the source.

About this project

What does Config X add?

Config X

Author LICENSE Stars Github Workflow Status

Description

This is a fabric API library for plugins to load & save configurations.

Installation

Add the following to your build script:

repositories {
    maven {
        url = uri("https://repo.codemc.io/repository/tetoe-mc")
    }
}

dependencies {
    // Approach #1: Ensure Config X is always available by including it within your own jar
    include(modImplementation("space.nocp:configx:2.0.1"))

    // Approach #2: Depend on Config X, but require that users install it themselves
    modImplementation "space.nocp:configx:2.0.1"
}

Then refresh your project.

Usage

Remember to import the package before starting.

import space.nocp.configx.api.*;

Register a configuration

Before registering a configuration, you need to write a class describing the configuration object and prepare a default configuration. Here, let's call the class ConfigType.

// ...
Configuration config = ConfigManager.get().register("my-config", defaultConfig, ConfigType.class);

Get a configuration

After registering your configuration, you can use config() method to get the configuration at anywhere in your project.

Configuration config = ConfigManager.get().config("my-config");

Get & set the configuration object

Configuration config = ...;
ConfigType configObj = config.get();

configObj.myValue = "Hello World";
config.set(configObj);
config.save(); // Remember to save the config after setting it

Load the configuration from the file system manually

Usually, the configuration is always up-to-date with the one storing in the file system. But sometimes, you may want to refresh it manually.

Configuration config = ...;
config.load();

Get the info of the configuration

Configuration config = ...;

String id = config.id; // my-config
config.getFileName(); // my-config.json
config.getPath().toString(); // C:/path/to/config/my-config.json

Use custom Gson to parse JSON

Config X stores your configuration in the JSON format. When you stores objects that requires custom serializers and deserializers, you need to build your own Gson to achieve this.

Before registering your configuration, you need to prepare your Gson in advance. Here, let's assume we already have a custom Gson object called myGson.

Just simply add the Gson object as a parameter after all the parameters in register() method, and the parsing operations will be done with the provided Gson.

// ...
Configuration config = ConfigManager.get().register("my-config", defaultConfig, ConfigType.class, myGson);

For more information about custom serializer and deserializer in Gson, see the article: Building a Personalized Serializer and Deserializer using Java Gson Library

Build from source

git clone https://github.com/tetoe-mc/configx.git
cd configx
./gradlew build

Then you can get the jar file in the build folder.

LICENSE

CC0 1.0

Project description from CurseForge.

Pick your setup

Config X by Minecraft version and loader

Choose the version and loader you play, then open the matching release.

2 available setups

Check the dependencies, then try the file in a copied instance before changing a world you care about.

Recent files

Config X versions and loaders

1 of 1 releases match

Looking for an older file? The official CurseForge project page is in Resources.