diff options
author | isXander <xandersmith2008@gmail.com> | 2023-05-26 17:59:59 +0100 |
---|---|---|
committer | isXander <xandersmith2008@gmail.com> | 2023-05-26 17:59:59 +0100 |
commit | baf4828a710b218b2f51fd7418f01818dea38d92 (patch) | |
tree | ffcb852bf4ce837c47e5d85ffcb346810126f4c3 /common/src/main/java/dev/isxander/yacl/api | |
parent | c00071184f469664fe8c9cd2876c2818a80df2d9 (diff) | |
download | YetAnotherConfigLib-baf4828a710b218b2f51fd7418f01818dea38d92.tar.gz YetAnotherConfigLib-baf4828a710b218b2f51fd7418f01818dea38d92.tar.bz2 YetAnotherConfigLib-baf4828a710b218b2f51fd7418f01818dea38d92.zip |
API layer for built-in controllers
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl/api')
25 files changed, 205 insertions, 89 deletions
diff --git a/common/src/main/java/dev/isxander/yacl/api/ButtonOption.java b/common/src/main/java/dev/isxander/yacl/api/ButtonOption.java index 88e1c4b..4acbe0e 100644 --- a/common/src/main/java/dev/isxander/yacl/api/ButtonOption.java +++ b/common/src/main/java/dev/isxander/yacl/api/ButtonOption.java @@ -15,7 +15,7 @@ public interface ButtonOption extends Option<BiConsumer<YACLScreen, ButtonOption */ BiConsumer<YACLScreen, ButtonOption> action(); - static dev.isxander.yacl.api.ButtonOption.Builder createBuilder() { + static Builder createBuilder() { return new ButtonOptionImpl.BuilderImpl(); } @@ -25,18 +25,11 @@ public interface ButtonOption extends Option<BiConsumer<YACLScreen, ButtonOption * * @see Option#name() */ - dev.isxander.yacl.api.ButtonOption.Builder name(@NotNull Component name); + Builder name(@NotNull Component name); - /** - * Sets the tooltip to be used by the option. - * Can be invoked twice to append more lines. - * No need to wrap the text yourself, the gui does this itself. - * - * @param tooltips text lines - merged with a new-line on {@link Option.Builder#build()}. - */ - dev.isxander.yacl.api.ButtonOption.Builder tooltip(@NotNull Component... tooltips); + Builder description(@NotNull OptionDescription description); - dev.isxander.yacl.api.ButtonOption.Builder action(@NotNull BiConsumer<YACLScreen, ButtonOption> action); + Builder action(@NotNull BiConsumer<YACLScreen, ButtonOption> action); /** * Action to be executed upon button press @@ -44,22 +37,14 @@ public interface ButtonOption extends Option<BiConsumer<YACLScreen, ButtonOption * @see ButtonOption#action() */ @Deprecated - dev.isxander.yacl.api.ButtonOption.Builder action(@NotNull Consumer<YACLScreen> action); + Builder action(@NotNull Consumer<YACLScreen> action); /** * Sets if the option can be configured * * @see Option#available() */ - dev.isxander.yacl.api.ButtonOption.Builder available(boolean available); - - /** - * Sets the controller for the option. - * This is how you interact and change the options. - * - * @see dev.isxander.yacl.gui.controllers - */ - dev.isxander.yacl.api.ButtonOption.Builder controller(@NotNull Function<ButtonOption, Controller<BiConsumer<YACLScreen, ButtonOption>>> control); + Builder available(boolean available); ButtonOption build(); } diff --git a/common/src/main/java/dev/isxander/yacl/api/LabelOption.java b/common/src/main/java/dev/isxander/yacl/api/LabelOption.java index 05c7214..f646c55 100644 --- a/common/src/main/java/dev/isxander/yacl/api/LabelOption.java +++ b/common/src/main/java/dev/isxander/yacl/api/LabelOption.java @@ -21,7 +21,7 @@ public interface LabelOption extends Option<Component> { return new LabelOptionImpl(label); } - static dev.isxander.yacl.api.LabelOption.Builder createBuilder() { + static Builder createBuilder() { return new LabelOptionImpl.BuilderImpl(); } @@ -29,12 +29,12 @@ public interface LabelOption extends Option<Component> { /** * Appends a line to the label */ - dev.isxander.yacl.api.LabelOption.Builder line(@NotNull Component line); + Builder line(@NotNull Component line); /** * Appends multiple lines to the label */ - dev.isxander.yacl.api.LabelOption.Builder lines(@NotNull Collection<? extends Component> lines); + Builder lines(@NotNull Collection<? extends Component> lines); LabelOption build(); } diff --git a/common/src/main/java/dev/isxander/yacl/api/ListOption.java b/common/src/main/java/dev/isxander/yacl/api/ListOption.java index c30f359..19a365d 100644 --- a/common/src/main/java/dev/isxander/yacl/api/ListOption.java +++ b/common/src/main/java/dev/isxander/yacl/api/ListOption.java @@ -64,18 +64,6 @@ public interface ListOption<T> extends OptionGroup, Option<List<T>> { Builder<T> description(@NotNull OptionDescription description); /** - * Sets the tooltip to be used by the list. It is displayed like a normal - * group when you hover over the name. Entries do not allow a tooltip. - * <p> - * Can be invoked twice to append more lines. - * No need to wrap the text yourself, the gui does this itself. - * - * @param tooltips text lines - merged with a new-line on {@link dev.isxander.yacl.api.ListOption.Builder#build()}. - */ - @Deprecated - Builder<T> tooltip(@NotNull Component... tooltips); - - /** * Sets the value that is used when creating new entries */ Builder<T> initial(@NotNull T initialValue); diff --git a/common/src/main/java/dev/isxander/yacl/api/ListOptionEntry.java b/common/src/main/java/dev/isxander/yacl/api/ListOptionEntry.java index e0a3424..2679fa3 100644 --- a/common/src/main/java/dev/isxander/yacl/api/ListOptionEntry.java +++ b/common/src/main/java/dev/isxander/yacl/api/ListOptionEntry.java @@ -7,11 +7,6 @@ public interface ListOptionEntry<T> extends Option<T> { ListOption<T> parentGroup(); @Override - default @NotNull Class<T> typeClass() { - return parentGroup().elementTypeClass(); - } - - @Override default @NotNull ImmutableSet<OptionFlag> flags() { return parentGroup().flags(); } diff --git a/common/src/main/java/dev/isxander/yacl/api/Option.java b/common/src/main/java/dev/isxander/yacl/api/Option.java index f0b595d..df48a62 100644 --- a/common/src/main/java/dev/isxander/yacl/api/Option.java +++ b/common/src/main/java/dev/isxander/yacl/api/Option.java @@ -1,6 +1,7 @@ package dev.isxander.yacl.api; import com.google.common.collect.ImmutableSet; +import dev.isxander.yacl.api.controller.ControllerBuilder; import dev.isxander.yacl.impl.OptionImpl; import net.minecraft.network.chat.Component; import org.jetbrains.annotations.NotNull; @@ -54,12 +55,6 @@ public interface Option<T> { void setAvailable(boolean available); /** - * Class of the option type. - * Used by some controllers. - */ - @NotNull Class<T> typeClass(); - - /** * Tasks that needs to be executed upon applying changes. */ @NotNull ImmutableSet<OptionFlag> flags(); @@ -111,14 +106,19 @@ public interface Option<T> { */ void addListener(BiConsumer<Option<T>, T> changedListener); + static <T> Builder<T> createBuilder() { + return new OptionImpl.BuilderImpl<>(); + } + /** * Creates a builder to construct an {@link Option} * * @param <T> type of the option's value * @param typeClass used to capture the type */ + @Deprecated static <T> Builder<T> createBuilder(Class<T> typeClass) { - return new OptionImpl.BuilderImpl<>(typeClass); + return createBuilder(); } interface Builder<T> { @@ -146,33 +146,7 @@ public interface Option<T> { */ Builder<T> description(@NotNull Function<T, OptionDescription> descriptionFunction); - /** - * Sets the tooltip to be used by the option. - * No need to wrap the text yourself, the gui does this itself. - * - * @param tooltipGetter function to get tooltip depending on value {@link Builder#build()}. - */ - @Deprecated - Builder<T> tooltip(@NotNull Function<T, Component> tooltipGetter); - - /** - * Sets the tooltip to be used by the option. - * No need to wrap the text yourself, the gui does this itself. - * - * @param tooltipGetter function to get tooltip depending on value {@link Builder#build()}. - */ - @Deprecated - Builder<T> tooltip(@NotNull Function<T, Component>... tooltipGetter); - - /** - * Sets the tooltip to be used by the option. - * Can be invoked twice to append more lines. - * No need to wrap the text yourself, the gui does this itself. - * - * @param tooltips text lines - merged with a new-line on {@link Builder#build()}. - */ - @Deprecated - Builder<T> tooltip(@NotNull Component... tooltips); + Builder<T> controller(@NotNull Function<Option<T>, ControllerBuilder<T>> controllerBuilder); /** * Sets the controller for the option. @@ -180,7 +154,7 @@ public interface Option<T> { * * @see dev.isxander.yacl.gui.controllers */ - Builder<T> controller(@NotNull Function<Option<T>, Controller<T>> control); + Builder<T> customController(@NotNull Function<Option<T>, Controller<T>> control); /** * Sets the binding for the option. @@ -220,7 +194,7 @@ public interface Option<T> { * Upon applying changes, all flags are executed. * {@link Option#flags()} */ - Builder<T> flags(@NotNull Collection<OptionFlag> flags); + Builder<T> flags(@NotNull Collection<? extends OptionFlag> flags); /** * Instantly invokes the binder's setter when modified in the GUI. diff --git a/common/src/main/java/dev/isxander/yacl/api/OptionDescription.java b/common/src/main/java/dev/isxander/yacl/api/OptionDescription.java index 0b91d5a..c233309 100644 --- a/common/src/main/java/dev/isxander/yacl/api/OptionDescription.java +++ b/common/src/main/java/dev/isxander/yacl/api/OptionDescription.java @@ -40,10 +40,12 @@ public interface OptionDescription { return new OptionDescriptionImpl.BuilderImpl(); } - static OptionDescription empty() { - return new OptionDescriptionImpl(CommonComponents.EMPTY, CompletableFuture.completedFuture(Optional.empty())); + static OptionDescription of(Component... description) { + return createBuilder().description(description).build(); } + OptionDescription EMPTY = new OptionDescriptionImpl(CommonComponents.EMPTY, CompletableFuture.completedFuture(Optional.empty())); + interface Builder { /** * Appends lines to the main description of the option. This can be called multiple times. diff --git a/common/src/main/java/dev/isxander/yacl/api/OptionGroup.java b/common/src/main/java/dev/isxander/yacl/api/OptionGroup.java index f1b2b5a..e4a0eeb 100644 --- a/common/src/main/java/dev/isxander/yacl/api/OptionGroup.java +++ b/common/src/main/java/dev/isxander/yacl/api/OptionGroup.java @@ -61,16 +61,6 @@ public interface OptionGroup { 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)} * diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/BooleanControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/BooleanControllerBuilder.java new file mode 100644 index 0000000..3af91f0 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/BooleanControllerBuilder.java @@ -0,0 +1,16 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.BooleanControllerBuilderImpl; + +public interface BooleanControllerBuilder extends ValueFormattableController<Boolean, BooleanControllerBuilder> { + BooleanControllerBuilder coloured(boolean coloured); + + BooleanControllerBuilder onOffFormatter(); + BooleanControllerBuilder yesNoFormatter(); + BooleanControllerBuilder trueFalseFormatter(); + + static BooleanControllerBuilder create(Option<Boolean> option) { + return new BooleanControllerBuilderImpl(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/ColorControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/ColorControllerBuilder.java new file mode 100644 index 0000000..c4c8f9e --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/ColorControllerBuilder.java @@ -0,0 +1,14 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.ColorControllerBuilderImpl; + +import java.awt.Color; + +public interface ColorControllerBuilder extends ControllerBuilder<Color> { + ColorControllerBuilder allowAlpha(boolean allowAlpha); + + static ColorControllerBuilder create(Option<Color> option) { + return new ColorControllerBuilderImpl(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/ControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/ControllerBuilder.java new file mode 100644 index 0000000..378de08 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/ControllerBuilder.java @@ -0,0 +1,9 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Controller; +import org.jetbrains.annotations.ApiStatus; + +public interface ControllerBuilder<T> { + @ApiStatus.Internal + Controller<T> build(); +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/CyclingListControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/CyclingListControllerBuilder.java new file mode 100644 index 0000000..d6d6c83 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/CyclingListControllerBuilder.java @@ -0,0 +1,15 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.CyclingListControllerBuilderImpl; + +public interface CyclingListControllerBuilder<T> extends ValueFormattableController<T, CyclingListControllerBuilder<T>> { + @SuppressWarnings("unchecked") + CyclingListControllerBuilder<T> values(T... values); + + CyclingListControllerBuilder<T> values(Iterable<? extends T> values); + + static <T> CyclingListControllerBuilder<T> create(Option<T> option) { + return new CyclingListControllerBuilderImpl<>(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/DoubleFieldControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/DoubleFieldControllerBuilder.java new file mode 100644 index 0000000..23f6270 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/DoubleFieldControllerBuilder.java @@ -0,0 +1,10 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.DoubleFieldControllerBuilderImpl; + +public interface DoubleFieldControllerBuilder extends NumberFieldControllerBuilder<Double, DoubleFieldControllerBuilder> { + static DoubleFieldControllerBuilder create(Option<Double> option) { + return new DoubleFieldControllerBuilderImpl(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/DoubleSliderControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/DoubleSliderControllerBuilder.java new file mode 100644 index 0000000..2f08cfd --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/DoubleSliderControllerBuilder.java @@ -0,0 +1,4 @@ +package dev.isxander.yacl.api.controller; + +public interface DoubleSliderControllerBuilder extends SliderControllerBuilder<Double, DoubleSliderControllerBuilder> { +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/EnumControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/EnumControllerBuilder.java new file mode 100644 index 0000000..f545f9c --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/EnumControllerBuilder.java @@ -0,0 +1,12 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.EnumControllerBuilderImpl; + +public interface EnumControllerBuilder<T extends Enum<T>> extends ValueFormattableController<T, EnumControllerBuilder<T>> { + EnumControllerBuilder<T> enumClass(Class<T> enumClass); + + static <T extends Enum<T>> EnumControllerBuilder<T> create(Option<T> option) { + return new EnumControllerBuilderImpl<>(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/FloatFieldControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/FloatFieldControllerBuilder.java new file mode 100644 index 0000000..202da79 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/FloatFieldControllerBuilder.java @@ -0,0 +1,10 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.FloatFieldControllerBuilderImpl; + +public interface FloatFieldControllerBuilder extends NumberFieldControllerBuilder<Float, FloatFieldControllerBuilder> { + static FloatFieldControllerBuilder create(Option<Float> option) { + return new FloatFieldControllerBuilderImpl(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/FloatSliderControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/FloatSliderControllerBuilder.java new file mode 100644 index 0000000..e4600f6 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/FloatSliderControllerBuilder.java @@ -0,0 +1,10 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.FloatSliderControllerBuilderImpl; + +public interface FloatSliderControllerBuilder extends SliderControllerBuilder<Float, FloatSliderControllerBuilder> { + static FloatSliderControllerBuilder create(Option<Float> option) { + return new FloatSliderControllerBuilderImpl(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/IntegerFieldControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/IntegerFieldControllerBuilder.java new file mode 100644 index 0000000..d256cd2 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/IntegerFieldControllerBuilder.java @@ -0,0 +1,10 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.IntegerFieldControllerBuilderImpl; + +public interface IntegerFieldControllerBuilder extends NumberFieldControllerBuilder<Integer, IntegerFieldControllerBuilder> { + static IntegerFieldControllerBuilder create(Option<Integer> option) { + return new IntegerFieldControllerBuilderImpl(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/IntegerSliderControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/IntegerSliderControllerBuilder.java new file mode 100644 index 0000000..6733a6e --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/IntegerSliderControllerBuilder.java @@ -0,0 +1,10 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.IntegerSliderControllerBuilderImpl; + +public interface IntegerSliderControllerBuilder extends SliderControllerBuilder<Integer, IntegerSliderControllerBuilder> { + static IntegerSliderControllerBuilder create(Option<Integer> option) { + return new IntegerSliderControllerBuilderImpl(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/LongFieldControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/LongFieldControllerBuilder.java new file mode 100644 index 0000000..8e162ae --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/LongFieldControllerBuilder.java @@ -0,0 +1,10 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.LongFieldControllerBuilderImpl; + +public interface LongFieldControllerBuilder extends NumberFieldControllerBuilder<Long, LongFieldControllerBuilder> { + static LongFieldControllerBuilder create(Option<Long> option) { + return new LongFieldControllerBuilderImpl(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/LongSliderControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/LongSliderControllerBuilder.java new file mode 100644 index 0000000..9624cd2 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/LongSliderControllerBuilder.java @@ -0,0 +1,10 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.LongSliderControllerBuilderImpl; + +public interface LongSliderControllerBuilder extends SliderControllerBuilder<Long, LongSliderControllerBuilder> { + static LongSliderControllerBuilder create(Option<Long> option) { + return new LongSliderControllerBuilderImpl(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/NumberFieldControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/NumberFieldControllerBuilder.java new file mode 100644 index 0000000..a8e8f4d --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/NumberFieldControllerBuilder.java @@ -0,0 +1,7 @@ +package dev.isxander.yacl.api.controller; + +public interface NumberFieldControllerBuilder<T extends Number, B extends NumberFieldControllerBuilder<T, B>> extends ValueFormattableController<T, B> { + B min(T min); + B max(T max); + B range(T min, T max); +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/SliderControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/SliderControllerBuilder.java new file mode 100644 index 0000000..b175014 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/SliderControllerBuilder.java @@ -0,0 +1,6 @@ +package dev.isxander.yacl.api.controller; + +public interface SliderControllerBuilder<T extends Number, B extends SliderControllerBuilder<T, B>> extends ValueFormattableController<T, B> { + B range(T min, T max); + B step(T step); +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/StringControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/StringControllerBuilder.java new file mode 100644 index 0000000..fcb3001 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/StringControllerBuilder.java @@ -0,0 +1,10 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.StringControllerBuilderImpl; + +public interface StringControllerBuilder extends ControllerBuilder<String> { + static StringControllerBuilder create(Option<String> option) { + return new StringControllerBuilderImpl(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/TickBoxControllerBuilder.java b/common/src/main/java/dev/isxander/yacl/api/controller/TickBoxControllerBuilder.java new file mode 100644 index 0000000..6dd52b9 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/TickBoxControllerBuilder.java @@ -0,0 +1,10 @@ +package dev.isxander.yacl.api.controller; + +import dev.isxander.yacl.api.Option; +import dev.isxander.yacl.impl.controller.TickBoxControllerBuilderImpl; + +public interface TickBoxControllerBuilder extends ControllerBuilder<Boolean> { + static TickBoxControllerBuilder create(Option<Boolean> option) { + return new TickBoxControllerBuilderImpl(option); + } +} diff --git a/common/src/main/java/dev/isxander/yacl/api/controller/ValueFormattableController.java b/common/src/main/java/dev/isxander/yacl/api/controller/ValueFormattableController.java new file mode 100644 index 0000000..032b34e --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl/api/controller/ValueFormattableController.java @@ -0,0 +1,9 @@ +package dev.isxander.yacl.api.controller; + +import net.minecraft.network.chat.Component; + +import java.util.function.Function; + +public interface ValueFormattableController<T, B extends ValueFormattableController<T, B>> extends ControllerBuilder<T> { + B valueFormatter(Function<T, Component> formatter); +} |