Features
OptionGroup.Builder
andConfigCategory.Builder
now extendOptionAddable
so you can abstractly add options to either of them.
API Changes
- Deprecated the varargs tooltip builder method in
Option.Builder
due to unsafe varargs. There is now an equivalent that is not varargs but a single function.
Backported YACL 2.2.0 to 1.19.2
Due to breaking JAR compatibility in an earlier version of YACL, mods that support YACL for 1.19.3 can no longer support 1.19.2. This is a backport of YACL 2.2.0 to 1.19.2 to allow mods to support it.
My stance on backporting
Personally, I hate to backport my mods. When breaking changes are made in Minecraft between versions, the code of the mod has to be changed to support the new version, making the older version of MC incompatible. If you want to support multiple versions of Minecraft, you have to maintain multiple branches of the mod, which is a lot of work for just one person, and I don't have the time to do that.
This is a one-off backport, and I will not be backporting any future versions of YACL to 1.19.2. If you want to support and use new features of YACL in your mod, you will have to drop support for 1.19.2.
User Changes
- New
List is empty
text when lists are empty - Fix category buttons sometimes not being clickable when you can scroll
- Fix the list add button not disabling when lists are disabled
- Fix the option list background not quite reaching the edge of the screen.
Developer Changes
- New
LabelOption
for shorthand to making labels! - Log when option bindings don't match up after using their save function
- Internally move YACLScreen button actions into separate methods for future features :o
- Fully publish sources jar & javadoc jar now that the loom plugin is fixed.
- Remove padding between list items
- No longer hide add and reset buttons when lists are collapsed, but automatically expand them when clicked
- Fix removing items from lists didn't update up and down buttons
- Fix lists not updating properly when removing the final item from a list
- Refactor some gui list code to abstract all list functionality from main gui classes
- Fix option entries sometimes overlapping due to the reset button
- Fix string elements cropping 1px off the top of the text
- Abstracted builders to restrict API usage
Lists
Implements mutable list options where you can create, remove and shift entries in a list.
API
Lists hack option groups with their own implementation for this, so each individual list takes form as a whole option group.
ListOption.createBuilder(String.class)
.name(Text.of("List Option"))
.binding(/* gets and sets a List, requires list field to be not final, does not manipulate the list */)
.controller(StringController::new) // usual controllers, passed to every entry
.initial("") // when adding a new entry to the list, this is the initial value it has
.build()
Implementation details
When implementing this, it was vital to me that all controllers work with lists, not ones specifically designed for list entries. This was achieved quite easily by having each entry being its own option with an empty name and tooltip with its own controller, that pairs with its list "parent" to actually modify the option.
Option groups were taken advantage of and hacked into its own option, only minor changes had to be made to get this to work with value application.
Applicable controllers have been modified to expand their inputs to near full width when no name is present.
Screenshots
String improvements
- Allow
StringControllerElement
to have unlimited text length - When pressing
Delete
in a text field whilst text is highlighted, it will act likeBackspace
like it should.
Other changes
- Slightly compacted elements
- Update to 1.19.3
- Colour field controllers
- Better carot positioning when clicking in text fields
- Better text selection for text fields
- Smooth scrolling for category list
- Fix category list scrollbar appearing under option list background in-game
- Fix tick box name text length limiting
End-user changes
- Smooth category scrolling
- Individual reset buttons for every option
- Fix bug where option lists that just went over into scrolling scrolled extremely slow.
Developer API changes
- Actual Config API to save and load fields in a class automatically (documentation)
- Separate
Dimension
intoDimension
andMutableDimension
- Make
dim
private inAbstractWidget
so mods can't change the dimension withoutsetDimension
- New Option API method
isPendingValueDefault
to check if pending value is equal to default value of binding - Fix
Option#requestSetDefault
andOption#forgetPendingValue
implementations weren't notifying listeners