Mod
Millie's Config & Utils
No reviews yet
Small config and utils library for creating and managing .properties, .json, .json5 and .yaml/yml configs and saving on duplicate util classes between my projects
Provides a framework or library for other mods to use.
Fabric is a mod loader for versions 1.14+ of Minecraft, particularly popular for client side and optimization mods.
Community voices
Reviews
Click once to include, again to exclude, again to clear
No reviews yet. Be the first to review this project!
Get it on
Available Platforms
Compatibility
Supported Environments
About
Project Details
For authors
Embed Badge
If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.
Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.
Identifiers
Platform IDs
Resources
External Links
About
Description
Millie's Config & Utils
Easy to use :D
Why?
I really needed a config lib and utils for the stuff I often make.
Dev Noted
I'm currently working on the 1.1 version of the mod for Fabric 1.21.11, then version 1.2 for Fabric 1.21.11 and only then I'll start porting to older and newer versions of Minecraft as well as porting the entire mod over to Forge/NeoForge
Documentation
Config Library - Example Config
A lot of design inspiration came from SuperMartijn642's Config Lib (No code was directly copied from that project.)
How to Add to Gradle Project
In Kotlin (build.gradle.kts)
repositories {
maven("https://api.modrinth.com/maven")
}
dependencies {
// Replace [VERSION] with whatever latest version is available
// for the Minecraft version and loader you need
modImplementation("maven.modrinth:millies-config-n-utils:[VERSION]")
}
In Groovy (build.gradle)
I dunno
Config Files
package net.yourmod.mod;
import net.justmili.libs.config.FileType;
import net.justmili.libs.config.build.ConfigEntry;
import net.justmili.libs.config.build.ListConfigEntry;
import net.justmili.libs.config.build.MConfigBuilder;
import java.util.List;
public class ExampleConfig {
public static ConfigEntry<Integer> someInt;
public static ConfigEntry<Float> someFloat;
public static ConfigEntry<Double> someDouble;
public static ConfigEntry<Long> someLong;
public static ConfigEntry<Boolean> someBool;
public static ConfigEntry<String> someString;
public static ListConfigEntry someDoubleList; // ListConfigEntries will change to use the params
public static ListConfigEntry someStringList; // as ConfigEnties (ListConfigEntry -> ListConfigEntry<T>)
public static void register() {
MConfigBuilder builder = new MConfigBuilder(YourMod.MODID, "suffix-or-name", FileType.JSON5, false);
someInt = builder.comment("Integer entry comment")
.define("someInt", 10, 0, 100);
builder.openCat("DecimalNumbers");
someFloat = builder.comment("Float entry comment")
.define("someFloat", 1.0f, 0.1f, 5.0f);
someDouble = builder.comment("Double entry comment")
.define("someDouble", 2.5, 0.0, 20.0);
someLong = builder.comment("Long entry comment")
.define("someLong", 123456789L, Long.MIN_VALUE, Long.MAX_VALUE);
builder.closeCat();
someBool = builder.comment("Boolean entry comment")
.define("someBool", true);
builder.comment("A category comment").openCat("Strings");
someString = builder.comment("String entry comment")
.define("someString", "Awawawa");
someStringList = builder.comment("List entry comment - A string list")
.defineList("someStringList", List.of("minecraft:grass_block", "minecraft:dirt", "minecraft:stone"), String.class);
builder.closeCat();
someDoubleList = builder.comment("List entry comment - A double list")
.defineList("someDoubleList", List.of(4.2, 6.9, 6.7), Double.class);
builder.build(); // Will create, load and update the config file depending on the situation
}
}
TL;DR:
- Config creation logic is similar to SuperMartijn642's Config Lib, but isn't based on Suppliers making it editable through your own code instead of it being read-only
- MConfigBuilder takes:
- Mod ID,
- A file suffix/file name when subdirectory is made,
- Config file type,
- Boolean true/false do you want your config to be in a subfolder
- Config Entries can be Integers, Floats, Doubles, Longs, Booleans, Strings or Lists of those same
value = builder.define(key, ...)defines a config keyvalue = builder.defineList(key, ...)defines a config list keybuilder.openCat("CategoryName")opens a new category- Some config file types don't support categories (
.properties)
- Some config file types don't support categories (
builder.closeCat()closes last opened category- Categories can be put within eachother
.comment("example")can be used standalone with justbuilder.comment("An example");, or combined with entries or categories, e.g.value = builder.comment("A value").define(key, ...)- Some config file types don't support comments (
.json)
- Some config file types don't support comments (
Initializing The config
package net.yourmod.mod;
import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class YourMod implements ModInitializer {
@Override
public void onInitialize() {
ExampleConfig.register(); // That's literally it
}
}
Util Library
How to Use The Util Classes
Idk how to explain all that so good luck
How long will this be kept updated?
Very long
Planned version-loader support?
- 26.2.x - Fabric
- 26.1.x - Fabric, NeoForge
- 1.21.11 - Fabric/Quilt, NeoForge
- (1.21.6-)1.21.8 - Fabric/Quilt, NeoForge
- 1.21.4 - Fabric/Quilt, NeoForge
- 1.21.1 - Fabric/Quilt, NeoForge
- 1.20.1 - Fabric/Quilt, Forge
Planned config UI?
Yes I'm planning on it
Screenshots
Gallery
Versions
Files
Relations
Project Relations
More like this
Similar Mods
Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.
On ModDex
Community snapshot
By the numbers
Statistics
Want to reach Minecraft players?
We're looking for a server hosting partner to feature here and other parts of the site. Interested? Send us a message!
Get in touchGet it on
Available Platforms
On ModDex
Community snapshot
By the numbers
Statistics
Resources