Simple Config Lib
Simple Config Lib 是专为 Minecraft 模组设计的配置库,用于处理设置项。它允许开发者通过普通的 Java 类来描述配置,随后该库会自动构建游戏内的设置界面,并负责数据的保存与加载。
本项目的主要目标是让开发者从繁琐的设置系统实现中解放出来,并在所有支持的平台间提供统一且可预期的结果。
该库支持 Fabric、Forge 和 NeoForge 加载器。
详细文档请参阅 Wiki:Simple Config Lib Wiki
用途
该库提供了一种统一的模组设置处理方式,涵盖配置描述、存储和显示。
Simple Config Lib 采用单一方法解决此任务:
- 配置仅作为一个类进行描述;
- 设置界面自动生成;
- 数据无需额外代码即可保存和加载;
- 在 Fabric、Forge 和 NeoForge 上的行为保持一致。
这种方法使开发者能够专注于模组的功能性,而非其设置背后的基础设施。
适用对象
- 模组开发者 — 旨在帮助那些希望为用户提供便捷设置界面,而不愿花费时间自行实现界面和文件处理的开发者。
- 玩家 — 该库作为依赖项存在,通常因其他模组需要而安装。它无需单独配置,只需确保其他模组的使用正常即可。
特性
- 在类级别描述配置,并自动生成设置界面。
- 提供现成的设置界面,只需在描述配置后调用一次即可获取——由库负责构建界面。
- 自动保存和加载数值,无需手动处理文件。
- 在所有支持的加载器上行为一致。
- 基于配置结构实现自动本地化。
- 丰富的界面元素集合,用于表示各种数据类型。
- 一组客户端辅助工具,简化屏幕创建过程。与配置本身一样,这些工具可独立于游戏版本使用。
- 跨网络同步的服务器端配置:标记为服务器端的配置存储在服务器上,在玩家加入时发送给每位玩家,并对客户端只读显示(除非拥有操作员权限)。
- 独立于加载器和版本的网络层:将数据包描述为普通的 Java record 并注册一次——库会构建编解码器,在所有加载器上注册它,并处理双向发送。
安装
在 Fabric 加载器上,需额外安装 Fabric API 才能使该库正常工作。在 Forge 和 NeoForge 上,无需其他依赖项。
常见问题
玩家需要安装该库吗? 仅在另一个模组需要时才需要。Simple Config Lib 是一个依赖项,无需单独配置——它只是让使用该库的模组的设置正常工作。
可以将该库添加到整合包中吗? 可以。只要提供其原始页面的链接,该库就可以包含在整合包中。
该库与其他模组冲突吗? 不会。Simple Config Lib 不会干扰其他模组,也不会与之冲突。
我需要为不同的版本和加载器编写不同的代码吗? 不需要。配置和辅助工具均设计为独立于游戏版本和加载器使用——同一套代码可在任何地方运行。
我在哪里报告 bug 和建议? 可以在 GitHub 上报告 bug 和建议。
项目状态
Simple Config Lib 最初是为我的个人项目创建的。由于许多现有库停止在新版 Minecraft 中对 Forge 提供支持,我不得不接手该项目。
该项目处于开放状态并持续发展:功能集将不断扩展,发现的任何 bug 都将得到修复。
Simple Config Lib
Simple Config Lib is a library for Minecraft mods designed to handle settings. It lets a developer describe a configuration with an ordinary Java class, after which the library automatically builds an in-game settings screen and takes care of saving and loading the data.
The main goal of the project is to free developers from routinely implementing a settings system and to provide a single, predictable result across all supported platforms.
The library supports the Fabric, Forge, and NeoForge loaders.
Detailed documentation is available in the wiki: Simple Config Lib Wiki
Purpose
The library provides a unified way to work with mod settings, covering configuration description, storage, and display.
Simple Config Lib offers a single approach to solving this task:
- the configuration is described once as a class;
- the settings screen is generated automatically;
- data is saved and loaded without any additional code;
- behavior stays identical on Fabric, Forge, and NeoForge.
This approach lets developers focus on the mod's functionality rather than on the infrastructure behind its settings.
Who It's For
- Mod developers — it is intended for those who want to give users a convenient settings screen without spending time implementing the interface and file handling themselves.
- Players — the library is a dependency and is usually installed because another mod requires it. It needs no separate configuration and simply ensures that the settings of other mods work correctly.
Features
- Configuration described at the class level with automatic generation of the settings screen.
- A ready-made settings screen that can be obtained with a single call right after describing the configuration — the library handles building the interface.
- Automatic saving and loading of values without any manual file handling.
- Consistent behavior across all supported loaders.
- Automatic localization based on the configuration structure.
- A rich set of interface elements for representing various data types.
- A set of client-side helper utilities that simplify creating screens. Like the configuration itself, these utilities can be used independently of the game version.
- Server-side configurations synchronized across the network: a config marked as server-side is stored on the server, sent to every player on join, and shown to clients as read-only unless they have operator permissions.
- A loader- and version-independent networking layer: describe a packet as a plain Java record and register it once — the library builds the codec, registers it on every loader, and handles sending in both directions.
Installation
On the Fabric loader, Fabric API must be installed additionally for the library to work. On Forge and NeoForge, no additional dependencies are required.
FAQ
Do players need to install the library? Only if another mod requires it. Simple Config Lib is a dependency and needs no separate configuration — it simply makes the settings of the mods that use it work.
Can the library be added to modpacks? Yes. The library can be included in modpacks as long as a link to its original page is provided.
Does the library conflict with other mods? No. Simple Config Lib does not interfere with other mods and does not conflict with them.
Do I need to write different code for different versions and loaders? No. Both the configuration and the helper utilities are designed to be used independently of the game version and loader — the same code works everywhere.
Where do I report bugs and suggestions? Bugs and suggestions can be reported on GitHub.
Project Status
Simple Config Lib was originally created for my own projects. I had to take it on because many existing libraries stopped supporting Forge on the newest versions of Minecraft.
The project is open and continues to develop: the feature set will expand, and any bugs found will be fixed.
下载 Simple Config Lib
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Simple Config Lib
下载 Simple Config Lib
下载 Simple Config Lib
下载 Simple Config Lib
下载 Simple Config Lib
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Simple Config Lib
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Simple Config Lib
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Simple Config Lib
下载 Simple Config Lib
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
更新内容
- 新增物品和方块注册工具类
- 新增 Id.parse 方法
修复内容
- 修复在 Forge 1.20.2 下的崩溃问题
- 当数字字段值发生变化时激活“完成”按钮
- 修复颜色选择器组件中堆叠点击声音的问题
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
适用于 MC 1.18+ 的 Effekseer 加载器
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
评论 0
登录后参与评分
还没有评论,来抢沙发吧