diff options
author | isXander <xandersmith2008@gmail.com> | 2023-06-03 23:10:03 +0100 |
---|---|---|
committer | isXander <xandersmith2008@gmail.com> | 2023-06-04 16:25:09 +0100 |
commit | 3e36feeef60e56ef8cb7f737ac8eeab9fbcd6abb (patch) | |
tree | f9c3395b4da2235681b87a35ac5056a0724a181b /common/src/main/java/dev/isxander/yacl3/api/LabelOption.java | |
parent | d00a486d3bdf6105f8ca8af1034c384058b8c832 (diff) | |
download | YetAnotherConfigLib-3e36feeef60e56ef8cb7f737ac8eeab9fbcd6abb.tar.gz YetAnotherConfigLib-3e36feeef60e56ef8cb7f737ac8eeab9fbcd6abb.tar.bz2 YetAnotherConfigLib-3e36feeef60e56ef8cb7f737ac8eeab9fbcd6abb.zip |
Change package and modid to yacl3 and yet_another_config_lib_3 respectively
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl3/api/LabelOption.java')
-rw-r--r-- | common/src/main/java/dev/isxander/yacl3/api/LabelOption.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/api/LabelOption.java b/common/src/main/java/dev/isxander/yacl3/api/LabelOption.java new file mode 100644 index 0000000..a5f015e --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl3/api/LabelOption.java @@ -0,0 +1,41 @@ +package dev.isxander.yacl3.api; + +import dev.isxander.yacl3.impl.LabelOptionImpl; +import net.minecraft.network.chat.Component; +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.yacl3.gui.controllers.LabelController}. + * This option is immutable and cannot be disabled. Tooltips are supported through + * {@link Component} styling. + */ +public interface LabelOption extends Option<Component> { + @NotNull Component label(); + + /** + * Creates a new label option with the given label, skipping a builder for ease. + */ + static LabelOption create(@NotNull Component label) { + return new LabelOptionImpl(label); + } + + static Builder createBuilder() { + return new LabelOptionImpl.BuilderImpl(); + } + + interface Builder { + /** + * Appends a line to the label + */ + Builder line(@NotNull Component line); + + /** + * Appends multiple lines to the label + */ + Builder lines(@NotNull Collection<? extends Component> lines); + + LabelOption build(); + } +} |