多人游戏仅在 2.0.0+ 版本可用
Serpentine
Serpentine 是一个轻量级的配置库模组,可轻松用于其他项目中。
Serpentine 提供了一种为任意模组设置配置的简便方法,你只需要一个继承自 Serpentine 提供的 Config 类的类,然后在你的模组初始化器中注册它即可。
潜在的冗余功能
什么是冗余功能?
配置界面可能是这个模组中唯一的冗余功能,但即便如此,它也仅由三个类组成,用于自动化生成配置界面。
配置界面有什么作用?
配置界面会解析你配置中的期望值并检测其默认值的类型。如果是整数,它会创建一个范围从 0 到 100 的滑块组件(我将在后续版本中为此添加更多自定义选项);如果是布尔值,它会创建两个按钮分别代表 True 和 False,当前选中的项(尚未保存的值)旁边会有一个勾选标记。如果是浮点数或字符串,则会创建一个文本输入框,用户可以在其中输入所需的值。
如何配置 Serpentine?
查看 此处 了解如何将 Serpentine 作为依赖项安装。
然后,要设置配置,请查看 此示例。
Multiplayer only works on 2.0.0+
Serpentine
Serpentine is a lightweight configuration library mod that can easily be used in other projects.
Serpentine provides an easy way to setup configuration for any mod, all you need is a class that extends the Config class provided by Serpentine and to then register it in your modInitializer.
Potential Bloat
what bloat?
The config screen is probably the only bloat in this mod but even then its just three classes that automate making a config screen for you.
what does the config screen do?
The config screen parses your config's expects and detects their default value's type. If it is an integer it makes a SliderWidget that goes from 0-100 (I'll add more customisation for this in later versions), if it is a boolean it'll make two buttons for True and False, the currently selected one (not saved one) will have a checkmark next to it. If it is a float or string then a textField will be made where the user can type in their desired value.
How to setup serpentine?
Check this out for how to install serpentine as a dependency.
Then to setup a config, check out this example
评论 0
登录后参与评分
还没有评论,来抢沙发吧