HomeJavaModsa0fefd's ConfigLib
a0fefd's ConfigLib
ModsJava

a0fefd's ConfigLib

A configuration library for mods. Adds an interface to add config options and a gui to interface with them.

⬇ Download on Modrinth
a0fefd's ConfigLib — screenshot 1

ConfigLib

A lightweight config library for Fabric mods. Describe your options as plain Java objects and get a working in-game config screen, a / command to open it, and JSON persistence, all without hand-rolling a GUI.

Why

Most mods end up writing the same boilerplate: a data class for settings, a screen to edit them, and load/save logic to keep a JSON file in sync. ConfigLib handles all three in one small dependency, so you can focus on the options themselves instead of the plumbing around them.

Features

How to install

Add these to each section of file build.gradle

repositories {
	mavenCentral()
	maven { url = "https://raw.githubusercontent.com/a0fefd/ConfigLib/mvn-repo/" }
}
dependencies {
	implementation "com.a0fefd:configlib:<version>"
}

Replace <version> with your target version.

Usage

Config config = new Config("mymod", null);

config.builder.add(new ConfigOption<>(
        "example_toggle",
        "General",
        true,
        Boolean.class,
        ConfigOptionType.BOOL
));

config.load();
ConfigCommand.register(config);

That is enough to get a working /mymod command opening a config screen with one toggle in it. Add more ConfigOptions for more settings, and use the category and subCategory fields to organize a larger config into tabs and sections.

Requirements

Verified by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more