diff options
author | isxander <xander@isxander.dev> | 2024-04-11 18:43:06 +0100 |
---|---|---|
committer | isxander <xander@isxander.dev> | 2024-04-11 18:43:06 +0100 |
commit | 04fe933f4c24817100f3101f088accf55a621f8a (patch) | |
tree | feff94ca3ab4484160e69a24f4ee38522381950e /src/main/java/dev/isxander/yacl3/api/ButtonOption.java | |
parent | 831b894fdb7fe3e173d81387c8f6a2402b8ccfa9 (diff) | |
download | YetAnotherConfigLib-04fe933f4c24817100f3101f088accf55a621f8a.tar.gz YetAnotherConfigLib-04fe933f4c24817100f3101f088accf55a621f8a.tar.bz2 YetAnotherConfigLib-04fe933f4c24817100f3101f088accf55a621f8a.zip |
Extremely fragile and broken multiversion build with stonecutter
Diffstat (limited to 'src/main/java/dev/isxander/yacl3/api/ButtonOption.java')
-rw-r--r-- | src/main/java/dev/isxander/yacl3/api/ButtonOption.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/main/java/dev/isxander/yacl3/api/ButtonOption.java b/src/main/java/dev/isxander/yacl3/api/ButtonOption.java new file mode 100644 index 0000000..4f53dd4 --- /dev/null +++ b/src/main/java/dev/isxander/yacl3/api/ButtonOption.java @@ -0,0 +1,55 @@ +package dev.isxander.yacl3.api; + +import dev.isxander.yacl3.gui.YACLScreen; +import dev.isxander.yacl3.impl.ButtonOptionImpl; +import net.minecraft.network.chat.Component; +import org.jetbrains.annotations.NotNull; + +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +public interface ButtonOption extends Option<BiConsumer<YACLScreen, ButtonOption>> { + /** + * Action to be executed upon button press + */ + BiConsumer<YACLScreen, ButtonOption> action(); + + static Builder createBuilder() { + return new ButtonOptionImpl.BuilderImpl(); + } + + interface Builder { + /** + * Sets the name to be used by the option. + * + * @see Option#name() + */ + Builder name(@NotNull Component name); + + /** + * Sets the button text to be displayed next to the name. + */ + Builder text(@NotNull Component text); + + Builder description(@NotNull OptionDescription description); + + Builder action(@NotNull BiConsumer<YACLScreen, ButtonOption> action); + + /** + * Action to be executed upon button press + * + * @see ButtonOption#action() + */ + @Deprecated + Builder action(@NotNull Consumer<YACLScreen> action); + + /** + * Sets if the option can be configured + * + * @see Option#available() + */ + Builder available(boolean available); + + ButtonOption build(); + } +} |