isXander / YetAnotherConfigLib

YetAnotherConfigLib (yacl) is just that. A builder-based configuration library for Minecraft.
GNU Lesser General Public License v3.0
98 stars 40 forks source link

Small improvements to ListOption #89

Closed Crendgrim closed 1 year ago

Crendgrim commented 1 year ago

This PR adds two small patches to ListOption<T>.

Patch 1: Allow to specify size limits for option lists.

This allows to set a "minimum" and a "maximum" length for the option list, beyond which it may not grow/shrink using the GUI. To facilitate that, the "add entry" and "remove entry" buttons are disabled whenever an operation would break these size constraints.

Patch 2: Allow "reversed" lists that add new options at their end.

ListOptions until now always grew at the top. I had the situation in my mod HaloHUD where I needed a list of entries to grow the opposite way. The workaround is quite ugly: https://github.com/Crendgrim/yaclx/blob/988aa3a7d7efbee935bb412c19681743abfa5a32/common/src/main/java/mod/crend/yaclx/auto/internal/BindingHelper.java#L98

This patch cleans that up by providing an option to the builder to manipulate this behaviour as the mod developer wishes.

isXander commented 1 year ago

Also, I'd like to see if you could PR the controllers you are working on for yaclx. Looks interesting, and could be used a lot! (only if you can get them stable enough)