Warning: file_put_contents(/www/wwwroot/nmbt.106988770/cache/modrinth_versions_mSLJOMK2.json): Failed to open stream: Permission denied in /www/wwwroot/nmbt.106988770/resource_detail.php on line 53
a0fefd's ConfigLib - 墨喵 Minecraft 资源
a0fefd's ConfigLib 图标

a0fefd's ConfigLib

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 1.0.2
本资源为搬运资源,原资源地址: https://modrinth.com/mod/a0fefds-configlib
资源信息

Minecraft 版本: 26.1.2

平台: fabric

标签: library utility

资源介绍

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.

Features

  • In-game config screen: tabbed by category, with sub-category headings to group related options within a tab.
  • Seven option types: BOOL, NUM (int and float unified), STR, ENUM (any Java enum), LIST, TUPLE, and BUTTON.
    • LIST and TUPLE render as an expanding set of entry boxes rather than a single string field, and can be restricted to a specific element type. Min/max clamping applies per-entry (e.g. clamping each component of an RGB value to 0-255), not just to a single NUM.
    • BUTTON runs a callback instead of holding a value, for actions that don't belong in the saved config.
  • Auto-registered command: / opens the screen, no extra setup needed. ConfigCommand.registerWithAlternatives can register additional command aliases that open the same screen.
  • JSON persistence: options round-trip to /.json. A corrupted or outdated file falls back to defaults instead of crashing the game. BUTTON options are skipped since they hold no value.

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

  • Minecraft 26.1.2
  • Fabric Loader 0.19.3 or newer
  • Fabric API
  • Java 25 or newer
下载与版本
评论(0)
请 登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

赞助作者

请 登录 后赞助作者。

🔥 相关推荐
Toms3 Anarchy

价格:0 墨喵币
下载量:0

查看详情
Bingo

价格:0 墨喵币
下载量:0

查看详情
MoreMeats

价格:0 墨喵币
下载量:0

查看详情
Dripstone Decor

价格:0 墨喵币
下载量:0

查看详情