blob: f1b2b5ab8bbc66414db82a7dffc3e67604ea8d49 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
package dev.isxander.yacl.api;
import com.google.common.collect.ImmutableList;
import dev.isxander.yacl.impl.OptionGroupImpl;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
/**
* Serves as a separator between multiple chunks of options
* that may be too similar or too few to be placed in a separate {@link ConfigCategory}.
* Or maybe you just want your config to feel less dense.
*/
public interface OptionGroup {
/**
* Name of the option group, displayed as a separator in the option lists.
* Can be empty.
*/
Component name();
OptionDescription description();
/**
* Tooltip displayed on hover.
*/
@Deprecated
Component tooltip();
/**
* List of all options in the group
*/
@NotNull ImmutableList<? extends Option<?>> options();
/**
* Dictates if the group should be collapsed by default.
*/
boolean collapsed();
/**
* Always false when using the {@link Builder}
* used to not render the separator if true
*/
boolean isRoot();
/**
* Creates a builder to construct a {@link OptionGroup}
*/
static Builder createBuilder() {
return new OptionGroupImpl.BuilderImpl();
}
interface Builder extends OptionAddable {
/**
* Sets name of the group, can be {@link Component#empty()} to just separate options, like sodium.
*
* @see OptionGroup#name()
*/
Builder name(@NotNull Component name);
Builder description(@NotNull OptionDescription description);
/**
* Sets the tooltip to be used by the option group.
* Can be invoked twice to append more lines.
* No need to wrap the Component yourself, the gui does this itself.
*
* @param tooltips Component lines - merged with a new-line on {@link Builder#build()}.
*/
@Deprecated
Builder tooltip(@NotNull Component... tooltips);
/**
* Adds an option to group.
* To construct an option, use {@link Option#createBuilder(Class)}
*
* @see OptionGroup#options()
*/
@Override
Builder option(@NotNull Option<?> option);
/**
* Adds multiple options to group.
* To construct an option, use {@link Option#createBuilder(Class)}
*
* @see OptionGroup#options()
*/
@Override
Builder options(@NotNull Collection<? extends Option<?>> options);
/**
* Dictates if the group should be collapsed by default
*
* @see OptionGroup#collapsed()
*/
Builder collapsed(boolean collapsible);
OptionGroup build();
}
}
|