isXander / YetAnotherConfigLib

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

Support for Lists of custom objects in GUI builder #54

Closed TechPro424 closed 1 year ago

TechPro424 commented 1 year ago

Currently, there does not seem to be a way to build GUIs for configs with Lists of custom objects, please add a way to do this

For example, if I have a custom class such as

public class CustomObject {
  String a = "abcd"
  ArrayList<String> b = new ArrayList<String>()
}

And the following config entry

@ConfigEntry public ArrayList<CustomObject> customObjects = new ArrayList<CustomObject>();

There does not seem to be a way to build a GUI for it. Please add a way to do so.

isXander commented 1 year ago

use the CyclingListController

TechPro424 commented 1 year ago

@isXander I don't really understand how it works, could you please explain?

Jack-Works commented 1 year ago

@isXander No, CyclingListController is used to "where once clicked, cycles through in the provided list." (in the JavaDoc). I think it is used to cycle through something like an enum, not for custom objects.

image

I wrote my own Controller and Widget to render this GUI, but it cannot save the config in the custom object. I wonder is there an example of this?