Getting started

Learn the structure of YACL to understand how it works.
This wiki is currently a work-in-progress and is incomplete!
Before we begin, it's important to note the wiki code examples will be using Yarn mappings. You are also expected to have a basic knowledge of the Java programming language. If you don't, please learn Java first.
There is a simple structure: categories contains groups, groups contain options. You can also skip the groups and just add options to the category directly. They will always appear above any groups.
Before we start, lets go into detail about how to construct an Option, then we'll use that to make a GUI.
Option.createBuilder(boolean.class) // boolean is the type of option we'll be making
.name(Text.literal("Boolean Option"))
.tooltip(Text.literal("This text will appear as a tooltip when you hover over the option."))
true, // the default value
() -> this.myBooleanOption, // a field to get the current value from
newVal -> this.myBooleanOption = newVal
An important concept in YACL options are the controllers. Each option type does not have a hardcoded way of being displayed. The logic of displaying the option in the GUI is held in the Controller. To learn more about controllers, click here.
To start making a GUI with YACL, you will need to build an instance of YetAnotherConfigLib. We will plug in our Option code from above...
.title(Text.literal("Used for narration. Could be used to render a title in the future."))
.name(Text.literal("Name of the category"))
.tooltip(Text.literal("This text will appear as a tooltip when you hover or focus the button with Tab. There is no need to add \n to wrap as YACL will do it for you."))
.name(Text.literal("Name of the group"))
.tooltip(Text.literal("This text will appear when you hover over the name or focus on the collapse button with Tab."))
.name(Text.literal("Boolean Option"))
.tooltip(Text.literal("This text will appear as a tooltip when you hover over the option."))
.binding(true, () -> this.myBooleanOption, newVal -> this.myBooleanOption = newVal)
All you have to do then is tell YACL to generate a Screen instance from it.
.generateScreen(parentScreen) // the screen that opens up when you close YACL
You must generate a new instance of YetAnotherConfigLib every time you want a GUI Screen. You cannot just call generateScreen() again!
It's that simple! You have made your first GUI with YACL!