Smootheez配置库

Smootheez配置库

我的所有模组的配置文件库模组

基础库

📦 Smootheez 配置库 (SCL)

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


❓ 什么是 SCL?

Smootheez 配置库 (SCL) 提供了一种更简单、更简洁的方式来管理 Minecraft 模组的配置。
它移除了样板代码,并提供了一个简单的界面,用于:

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

🖼️ 游戏内预览

🔧 标准配置界面

配置预览

📝 带描述的配置界面

带描述

🗂️ 在 OptionList 中编辑值

编辑列表

➕ 向 OptionList 添加值

添加值

❗ 确认界面

确认


🚀 快速开始

🏗️ 步骤 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 许可证 发布

☕ 支持我

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

ko-fi paypal