跳到正文

Configory

作者:Indemnity83

Configory is a lightweight configuration library for Minecraft mods. Define each value once - with its type, default, and validation rules - then read and write it with full type safety, dot-notation paths, and JSON-backed, per-mod config files.

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

Configory

Convention-based configuration for Minecraft mods.

Configory is a small Java configuration library that makes mod config feel simple at the call site without giving up type safety where your code needs it. Define a value once — with its type, default, and constraints — and use it safely everywhere.

public static final ConfigKey<Float> SPEED_MULTIPLIER =
        config.defineFloat("core.speed_multiplier", 1.0f)
                .range(0.1f, 10.0f)
                .describe("Global speed multiplier.")
                .register();

float speed = getConfig(SPEED_MULTIPLIER);
setConfig(SPEED_MULTIPLIER, 3.0f).save();

Need dynamic access for debug tooling or scripts? Reach for the same config by string path:

float speed = getConfig("core.speed_multiplier").asFloat();
setConfig("core.speed_multiplier", 3.0f).save();

Features

  • Typed config keys — read and write values with compile-time type safety.
  • Dot-notation paths — nest values inside a config’s JSON file, or keep a simple mod to a single flat file.
  • Fluent validation — declare ranges and constraints once; invalid writes are rejected.
  • Generated command surface — expose your config through your mod’s own in-game command, with zero Brigadier boilerplate.
  • JSON-backed files — human-readable config, with explicit saving so you control when it’s written.
  • Per-mod isolation — each mod maps to its own config file, cleanly separated.
  • Lightweight bootstrap conventions — minimal setup to get going.

Notes

Configory is a loader-agnostic library mod (it depends only on Gson and targets Java 21). Compile against it as a normal dependency, but don’t bundle it — ship it as a required dependency and let players install the Configory jar separately, so several mods can share one copy. A single jar loads on Fabric, Forge and NeoForge and it works across a very wide range of Minecraft versions.

Links

  • Documentation: https://indemnity83.github.io/configory/
  • Source & issues: https://github.com/Indemnity83/configory

Icon: book_scroll_written by Malcolm Riley, CC BY 4.0, upscaled.

常见问题

Configory 支持哪些 Minecraft 版本?

Configory 支持 Minecraft Java 版 1.14–26.2,共 47 个版本,可用的加载器:Fabric / Forge / NeoForge。下载时注意选择和你游戏版本一致的文件。

Configory 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric / Forge / NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:客户端 / 服务端。

评论

登录后评论和评分

Indemnity83 的其他作品

查看全部 →