此模组为 yacl 配置菜单提供了更多自定义方式。它主要面向希望在自己的模组中使用这些增强功能的开发者。
1.20-26.3 版本的移植即将推出
功能概览
- Widget(控件)和选项组的图标(物品、3D 实体、状态效果、标识符路径)
- 通过滚轮调整数值
- 居中显示选项值
- 控制器下的搜索包含与排除功能
- 保持 OptionGroup(选项组)的折叠状态
- 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)
功能说明
允许你在控制器控件 / 选项组名称左侧添加视觉图标。你可以通过 identifierIcon 将图标纹理设置为物品、3D 实体模型、状态效果或任何其他纹理。
使用 3D 实体模型时请注意,它仅在游戏世界中渲染 3D 实体模型。如果在标题屏幕打开菜单,实体模型将被各自的刷怪蛋替代。
pxWidth 和 pxHeight 控制图标的渲染大小。如果不设置,默认将使用 16x16 的尺寸。
注意 pxScale 同时影响 3D 实体模型和刷怪蛋图标的回退显示。
textureOffSetX 和 textureOffsetY 适用于你想获取精灵表(sprite sheet)中特定纹理的情况。如果不是这种情况,请将这两个值都设为 0。

.adjustableByScrolling()
构造函数选项
.adjustableByScrolling()
.adjustableByScrolling(double stepSize)
功能说明
允许你通过滚轮调整数字字段和滑块的值。步长(stepsize)控制每次滚动增加或减少的量。
对于字段,你需要先点击选项控件才能通过滚轮调整值。对于滑块,你只需将鼠标悬停在滑块本身即可直接调整值,无需先点击选项控件。
如果不设置步长,整数和长整型控制器将默认为 1,浮点数和双精度控制器将默认为 0.1。
.centeredWithoutName()
构造函数选项
.centeredWithoutName()
功能说明
允许你居中显示值文本并移除选项名称。
如果通过 .icon() 添加了图标,图标也会随之居中。
该功能仍处于实验阶段,因为存在许多可能导致视觉错乱的不同情况。如果你发现任何问题,请报告以便我修复。

.tickCrossFormatter()
构造函数选项
.tickCrossFormatter()
功能说明
将 true 或 false 替换为 ✔ 和 ❌

YaceStringSelectionDropdownController
功能说明
此控制器与 DropdownStringController 非常相似。唯一的区别是你无法在其中输入文本。你必须直接从下拉列表中选择一个选项,而不能通过过滤或手动输入来选择。
.excludedFromSearch()
构造函数选项
.excludedFromSearch()
功能说明
即使你在搜索栏中输入了相关关键词,也能将该选项从搜索结果中排除。
.alwaysIncludedInSearch()
构造函数选项
.alwaysIncludedInSearch()
功能说明
无论你在搜索栏中输入什么,此选项都将始终可见。
.keepCollapseForSearch()
构造函数选项
.keepCollapseForSearch()
它有什么作用?
在搜索时,保持 OptionGroup 当前是否折叠的状态。启用此功能后,即使 OptionGroup 之前未被展开,它在搜索时也不会自动展开。
控制器 / OptionGroup 兼容性表
| Controller / OptionGroup |
.icon() |
.centeredWithoutName() |
.adjustableByScrolling() |
.excludeFromSearch() |
.includeInSearch() |
.keepCollapseForSearch() |
.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
- Search Inclusion and Exclusions for controller
- Keeping the collapse state of a OptionGroup
- 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.
.excludedFromSearch()
Constructor options
.excludedFromSearch()
What does it do?
Lets you exclude an option from the search even if you type it in.
.excludedFromSearch()
Constructor options
.alwaysIncludedInSearch()
What does it do?
This option will be visible no matter what you type into the search.
.keepCollapseForSearch()
Constructor options
.keepCollapseForSearch()
What does it do?
Keeps the current state of whether or not the OptionGroup is collapsed when searching for something. Activating this disables the OptionGroup to expand itself when searching even if it wasn't expanded before.
Controller / OptionGroup Compatibility Table
| Controller / OptionGroup |
.icon() |
.centeredWithoutName() |
.adjustableByScrolling() |
.excludeFromSearch() |
.includeInSearch() |
.keepCollapseForSearch() |
.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
登录后参与评分
还没有评论,来抢沙发吧