此模组提供了新的方式来进一步自定义 yacl 配置菜单。它主要面向希望在自己的模组中使用这些增强功能的开发者。
1.20-26.3 版本的移植版本即将推出
功能概览
- 组件和选项组的图标(物品、3D 实体、状态效果、标识符路径)
- 通过滚动调整数值
- 居中选项值
- BooleanController 的新 tickCrossFormatter
- 新的 YaceStringSelectionDropdownController
它是如何工作的?
开始使用
将此模组的最新版本添加到你的 build.gradle 中。你可以点击 Modrinth 上的特定版本并向下滚动到开发者代码部分来了解具体操作。
迁移到新构建器
每个控制器都有一个新增类以添加这些新功能。要使用它们,只需将你的模组菜单集成中原有的 yacl 构建器类替换为此模组的构建器类即可。除了添加 Yace 前缀外,每个 Builder 的名称都与原来完全相同。以下是一个示例:
- .controller(opt -> DoubleFieldControllerBuilder.create(opt))
+ .controller(opt -> YaceDoubleFieldControllerBuilder.create(opt))
使用这些功能
你现在可以通过在构建器方法链中添加这些功能来简单地使用所有新功能,就像在 yacl 中一样。以下是一个示例:
.controller(opt -> YaceDoubleFieldControllerBuilder.create(opt)
.icon(Items.DIAMOND.getDefaultStack())
.adjustableByScrolling(0.01)
.min(0.0)
.max(Double.MAX_VALUE))
详细描述
以下是每个新功能的详细描述(附带图片)
.icon()
构造函数选项
.icon(Itemstack itemIcon)
.icon(Itemstack itemIcon, int pxWidth, int pxHeight)
.icon(Entitytype<? extends LivingEntity> entityIcon)
.icon(Entitytype<? extends LivingEntity> entityIcon, int pxScale)
.icon(Entitytype<? extends LivingEntity> entityIcon, boolean isBabyEntityIcon)
.icon(Entitytype<? extends LivingEntity> entityIcon, boolean isBabyEntityIcon, int pxScale)
.icon(RegistryEntry<StatusEffect> statusEffectIcon)
.icon(RegistryEntry<StatusEffect> statusEffectIcon, int pxWidth, in pxHeight)
.icon(Identifier identifierIcon)
.icon(Identifier identifierIcon, int pxWidth, int pxHeight, int textureOffsetX, int textureOffsetY)
它的作用是什么?
允许你在控制器组件/选项组名称的左侧添加视觉图标。你可以将图标纹理设置为物品、3D 实体模型、状态效果或使用 identifierIcon 的任何其他纹理。
当使用 3D 实体模型时,请注意它仅在处于世界中时才渲染 3D 实体模型。当在主菜单屏幕上打开菜单时,实体模型将被相应的刷怪蛋替换。
pxWidth 和 pxHeight 控制图标的渲染大小。如果未设置任何值,则默认使用 16x16 的大小。
注意,pxScale 同时影响 3D 实体模型和刷怪蛋图标回退。
textureOffSetX 和 textureOffsetY 在你想要获取精灵表中的特定纹理时非常有用。如果不是这种情况,请将这两个值都设为 0。

.adjustableByScrolling()
构造函数选项
.adjustableByScrolling()
.adjustableByScrolling(double stepSize)
它的作用是什么?
允许你通过滚动来调整数字字段和滑块的数值。Stepsize 控制每次滚动应增加/减少的量。
为了通过滚动调整字段的数值,你必须首先单击该选项组件。对于滑块,你可以直接将鼠标悬停在滑块本身上并调整数值,而无需先单击选项组件。
当未设置 stepsize 时,整数和长整型控制器将使用默认的 1,浮点数和双精度控制器将使用默认的 0.1。
.centeredWithoutName()
构造函数选项
.centeredWithoutName()
它的作用是什么?
允许你居中文本值并移除选项名称。
当通过 .icon() 添加图标时,图标也会被居中。
这仍然非常实验性,因为存在许多可能导致视觉破坏的不同情况。如果你发现任何问题,请报告给我以便修复。

.tickCrossFormatter()
构造函数选项
.tickCrossFormatter()
它的作用是什么?
用 ✔ 和 ❌ 替换 true 或 false

YaceStringSelectionDropdownController
它的作用是什么?
此控制器与 DropdownStringController 非常相似。唯一的区别是你不能在其中输入内容。你需要直接从下拉列表中选择一个选项,而无法通过过滤或手动输入来选择。
控制器 / 选项组兼容性表
| 控制器 / 选项组 |
.icon() |
.centeredWithoutName() |
.adjustableByScrolling() |
.tickCrossFormatter() |
| IntegerFieldController |
✅ |
✅ |
✅ |
❌ |
| LongFieldController |
✅ |
✅ |
✅ |
❌ |
| FloatFieldController |
✅ |
✅ |
✅ |
❌ |
| DoubleFieldController |
✅ |
✅ |
✅ |
❌ |
| IntegerSliderController |
✅ |
❌ |
✅ |
❌ |
| LongSliderController |
✅ |
❌ |
✅ |
❌ |
| FloatSliderController |
✅ |
❌ |
✅ |
❌ |
| DoubleSliderController |
✅ |
❌ |
✅ |
❌ |
| StringController |
✅ |
✅ |
❌ |
❌ |
| BooleanController |
✅ |
❌ |
❌ |
✅ |
| TickBoxController |
✅ |
❌ |
❌ |
❌ |
| ColorController |
✅ |
❌ |
❌ |
❌ |
| CyclingListController |
✅ |
✅ |
❌ |
❌ |
| DropdownStringController |
✅ |
✅ |
❌ |
❌ |
| EnumController |
✅ |
✅ |
❌ |
❌ |
| EnumDropdownController |
✅ |
✅ |
❌ |
❌ |
| ItemController |
✅ |
✅ |
❌ |
❌ |
| YaceStringSelectionDropdownController |
✅ |
✅ |
❌ |
❌ |
| OptionGroup |
✅ |
❌ |
❌ |
❌ |
支持
如果您有问题、遇到问题、发现错误或有任何建议,您可以加入我的 Discord 服务器:
This mod adds new ways to further customize a yacl config menu. It is mainly thought for developers wanting to use these enhancements in their own mods.
Ports to versions 1.20-26.3 will be coming soon
Feature Overview
- Widget and option group icons (items, 3d entities, statuseffects, identifier paths)
- Adjusting values by scrolling
- Centering option values
- New tickCrossFormatter for BooleanController
- New YaceStringSelectionDropdownController
How does it work?
Getting started
Add the newest version of this mod to your build.gradle. You can find out how by clicking on the specific version on modrinth and scrolling down to the code section for developers.
Migrating to the new builder
Every controller got a new class that adds these new features. To use them simply replace the original yacl builder class from your mod menu integration with the one of this mod. Every Builder is exactly named the same in addition to the Yace prefix. Here's an example:
- .controller(opt -> DoubleFieldControllerBuilder.create(opt))
+ .controller(opt -> YaceDoubleFieldControllerBuilder.create(opt))
Use the features
You can now simply use all of the features by adding them to your builder method chain just like in yacl. Here's an example:
.controller(opt -> YaceDoubleFieldControllerBuilder.create(opt)
.icon(Items.DIAMOND.getDefaultStack())
.adjustableByScrolling(0.01)
.min(0.0)
.max(Double.MAX_VALUE))
Detailed Description
These are detailed descriptions of each new feature (with images)
.icon()
Constructor options
.icon(Itemstack itemIcon)
.icon(Itemstack itemIcon, int pxWidth, int pxHeight)
.icon(Entitytype<? extends LivingEntity> entityIcon)
.icon(Entitytype<? extends LivingEntity> entityIcon, int pxScale)
.icon(Entitytype<? extends LivingEntity> entityIcon, boolean isBabyEntityIcon)
.icon(Entitytype<? extends LivingEntity> entityIcon, boolean isBabyEntityIcon, int pxScale)
.icon(RegistryEntry<StatusEffect> statusEffectIcon)
.icon(RegistryEntry<StatusEffect> statusEffectIcon, int pxWidth, in pxHeight)
.icon(Identifier identifierIcon)
.icon(Identifier identifierIcon, int pxWidth, int pxHeight, int textureOffsetX, int textureOffsetY)
What does it do?
Lets you add an visual icon left to the name of the controller widget / option group. You can either set the icon texture to an item, a 3d entity model, an status effect or any other texture by using the identifierIcon.
When using the 3d entity model keep in mind that it only renders a 3d entity model while being in a world. When opening the menu on the title screen the entity models will get replaced with their respective spawn eggs.
pxWidth and pxHeight control how big the icon should be rendered. When don't setting it to anything the default of 16x16 will be used for everything.
Note that pxScale affects both the 3d entity model and the spawn egg icon fallback.
textureOffSetX and textureOffsetY are useful when you want to have a specific texture of a sprite sheet. If that isn't the case set both of these values to 0.

.adjustableByScrolling()
Constructor options
.adjustableByScrolling()
.adjustableByScrolling(double stepSize)
What does it do?
Lets you adjust values of number fields and sliders by scrolling. Stepsize controls how much each scroll should increase / decrease.
In order to adjust values by scrolling for fields you have to click on the option widget first. For sliders you can simply hover over the slider itself and adjust the value without clicking the option widget first.
When don't setting stepsize to anything the default of 1 for integer and long controller and the default of 0.1 for float and double controller will be used.
.centeredWithoutName()
Constructor options
.centeredWithoutName()
What does it do?
Lets you center the value text and remove the option name.
When adding an icon by utilising .icon() the icon will be centered as well.
This is still very experimental as there are a lot of different cases that could potentielly visually break things. If you find anything please report it so I can fix it.

.tickCrossFormatter()
Constructor options
.tickCrossFormatter()
What does it do?
Replaces true or false with ✔ and ❌

YaceStringSelectionDropdownController
What does it do?
This controller is really similiar to the DropdownStringController. The only difference being that you can't write into it. You need to directly select an option from the dropdown without being able to filter through them or type them in manually.
Controller / OptionGroup Compatibility Table
| Controller / OptionGroup |
.icon() |
.centeredWithoutName() |
.adjustableByScrolling() |
.tickCrossFormatter() |
| IntegerFieldController |
✅ |
✅ |
✅ |
❌ |
| LongFieldController |
✅ |
✅ |
✅ |
❌ |
| FloatFieldController |
✅ |
✅ |
✅ |
❌ |
| DoubleFieldController |
✅ |
✅ |
✅ |
❌ |
| IntegerSliderController |
✅ |
❌ |
✅ |
❌ |
| LongSliderController |
✅ |
❌ |
✅ |
❌ |
| FloatSliderController |
✅ |
❌ |
✅ |
❌ |
| DoubleSliderController |
✅ |
❌ |
✅ |
❌ |
| StringController |
✅ |
✅ |
❌ |
❌ |
| BooleanController |
✅ |
❌ |
❌ |
✅ |
| TickBoxController |
✅ |
❌ |
❌ |
❌ |
| ColorController |
✅ |
❌ |
❌ |
❌ |
| CyclingListController |
✅ |
✅ |
❌ |
❌ |
| DropdownStringController |
✅ |
✅ |
❌ |
❌ |
| EnumController |
✅ |
✅ |
❌ |
❌ |
| EnumDropdownController |
✅ |
✅ |
❌ |
❌ |
| ItemController |
✅ |
✅ |
❌ |
❌ |
| YaceStringSelectionDropdownController |
✅ |
✅ |
❌ |
❌ |
| OptionGroup |
✅ |
❌ |
❌ |
❌ |
Support
If you have questions, encounter problems, find bugs or have suggestions you can join my discord server:
评论 0
登录后参与评分
还没有评论,来抢沙发吧