YetAnotherConfigLib

YetAnotherConfigLib

13M Downloads

Support for Lists of custom objects in GUI builder

TechPro424 opened this issue ยท 3 comments

commented

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.

commented

use the CyclingListController

commented

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

commented

@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?