Changelog
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
Dependencies
Files
90% of ad revenue goes to creators
Support creators and Modrinth ad-free with Modrinth+Metadata
Release channel
ReleaseVersion number
2.1.0Loaders
Game versions
1.19.3Downloads
1272Publication date
December 11, 2022 at 7:49 PMPublisher
isxander
Owner