Smootheez Config Lib

模组

· 作者 Smootheez

所有模组的配置库模组

0 本站下载 0 关注 更新于 1 年前

最新 0.2.2-1.20.2 · 1.20.2 · Fabric

一键开服(送7天)

? Smootheez Config Lib (SCL)

一个旨在简化 Minecraft 模组开发的配置处理的实用工具模组。
主要为我自己的模组开发,但也公开供公众免费使用。


❓ SCL 是什么?

Smootheez Config Lib (SCL) 提供了一种更简单、更清晰的方式来管理 Minecraft 模组的配置。
它消除了样板代码,并为以下功能提供了简单的接口:

  • ✅ 配置文件管理
  • ?️ 自动生成配置界面
  • ⚙️ 自动生成配置文件

?️ 游戏内预览

? 标准配置界面

Config Preview

? 带有描述的 Config 界面

With Description

?️ 在 OptionList 中编辑值

Edit List

➕ 向 OptionList 添加值

Add Value

❗ 确认界面

Confirmation


? 快速开始

?️ 步骤 1 – 添加仓库

在你的 build.gradle 中:

repositories {
    maven {
        url "https://jitpack.io"
    }
}

? 步骤 2 – 添加依赖

使用 gradle.properties 中的版本:

dependencies {
    modImplementation "com.github.smootheez:scl:${project.scl_version}"
}

或者直接指定版本:

dependencies {
    modImplementation "com.github.smootheez:scl:[version]"
}

? 示例用法

? 步骤 1 – 创建配置类

@Config(name = "example_config", gui = true)
public class ExampleConfig {
    public static final ConfigOption<Integer> INT_TEXT = ConfigOption.create("intText", 0, -5, 100);
    public static final ConfigOption<Double> DOUBLE_TEXT = ConfigOption.create("doubleText", 0.0, 0.0, 2.0);
    public static final ConfigOption<Integer> INT_SLIDER = ConfigOption.create("intSlider", 0, -5, 100).asSlider();
    public static final ConfigOption<Double> DOUBLE_SLIDER = ConfigOption.create("doubleSlider", 0.0, 0.0, 2.0).asSlider();
    public static final ConfigOption<Double> DOUBLE_SLIDER_PERCENTAGE = ConfigOption.create("doubleSliderPercentage", 0.0, 0.0, 2.0).asSliderPercentage();
    public static final ConfigOption<Boolean> BOOLEAN = ConfigOption.create("boolean", false);
    public static final ConfigOption<OptionList> LIST = ConfigOption.create("list", "example_value_1", "example_value_2", "example_value_3");
    public static final ConfigOption<ExampleEnum> ENUM = ConfigOption.create("enum", ExampleEnum.EXAMPLE_VALUE_1);
}

? 步骤 2 – 注册配置

在你的 fabric.mod.json 中:

"entrypoints": {
    // ...existing entrypoints
    "scl": [
        "dev.smootheez.scl.example.ExampleConfig"
    ]
}

✅ 就这样! SCL 将自动生成:

  • 配置文件
  • 配置界面(需要 ModMenu)

? 注意: 仅当满足以下条件时才会生成配置界面:

  • 设置了 gui = true
  • 配置的 name 与你的模组 ID 匹配

? 下载


? 问题追踪

发现了 Bug 或有功能建议?
在此提交问题:GitHub Issues


⚠️ 重要说明

  • ✅ 兼容 Minecraft 1.20.1+
  • ? 采用 MIT 许可证

☕ 支持我

如果你觉得这个项目有用并想支持我的工作,请考虑捐赠:

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源