diff options
author | isXander <xander@isxander.dev> | 2022-12-25 13:48:58 +0000 |
---|---|---|
committer | isXander <xander@isxander.dev> | 2022-12-25 13:50:41 +0000 |
commit | 7c78ba96a44854ee3733104b8b22bf5cbfc92c3b (patch) | |
tree | 2fd66665e008fa6fddd4db36c45f6e7ddbfe39f7 /src/client/java/dev/isxander/yacl/api/LabelOption.java | |
parent | d7e09fec2804dc893cabfbf3c136acce21d78e73 (diff) | |
download | YetAnotherConfigLib-7c78ba96a44854ee3733104b8b22bf5cbfc92c3b.tar.gz YetAnotherConfigLib-7c78ba96a44854ee3733104b8b22bf5cbfc92c3b.tar.bz2 YetAnotherConfigLib-7c78ba96a44854ee3733104b8b22bf5cbfc92c3b.zip |
LabelOption now has a builder
Diffstat (limited to 'src/client/java/dev/isxander/yacl/api/LabelOption.java')
-rw-r--r-- | src/client/java/dev/isxander/yacl/api/LabelOption.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/client/java/dev/isxander/yacl/api/LabelOption.java b/src/client/java/dev/isxander/yacl/api/LabelOption.java index a1bbe28..0e8202b 100644 --- a/src/client/java/dev/isxander/yacl/api/LabelOption.java +++ b/src/client/java/dev/isxander/yacl/api/LabelOption.java @@ -2,6 +2,9 @@ package dev.isxander.yacl.api; import dev.isxander.yacl.impl.LabelOptionImpl; import net.minecraft.text.Text; +import org.jetbrains.annotations.NotNull; + +import java.util.Collection; /** * A label option is an easier way of creating a label with a {@link dev.isxander.yacl.gui.controllers.LabelController}. @@ -9,12 +12,30 @@ import net.minecraft.text.Text; * {@link Text} styling. */ public interface LabelOption extends Option<Text> { - Text label(); + @NotNull Text label(); /** - * Creates a new label option with the given label. + * Creates a new label option with the given label, skipping a builder for ease. */ - static LabelOption create(Text label) { + static LabelOption create(@NotNull Text label) { return new LabelOptionImpl(label); } + + static Builder createBuilder() { + return new LabelOptionImpl.BuilderImpl(); + } + + interface Builder { + /** + * Appends a line to the label + */ + Builder line(@NotNull Text line); + + /** + * Appends multiple lines to the label + */ + Builder lines(@NotNull Collection<? extends Text> lines); + + LabelOption build(); + } } |