aboutsummaryrefslogtreecommitdiff
path: root/common/src/main/java/dev/isxander/yacl3/api/ButtonOption.java
diff options
context:
space:
mode:
authorisXander <xandersmith2008@gmail.com>2023-06-03 23:10:03 +0100
committerisXander <xandersmith2008@gmail.com>2023-06-04 16:25:09 +0100
commit3e36feeef60e56ef8cb7f737ac8eeab9fbcd6abb (patch)
treef9c3395b4da2235681b87a35ac5056a0724a181b /common/src/main/java/dev/isxander/yacl3/api/ButtonOption.java
parentd00a486d3bdf6105f8ca8af1034c384058b8c832 (diff)
downloadYetAnotherConfigLib-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/ButtonOption.java')
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/ButtonOption.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/api/ButtonOption.java b/common/src/main/java/dev/isxander/yacl3/api/ButtonOption.java
new file mode 100644
index 0000000..943f9ac
--- /dev/null
+++ b/common/src/main/java/dev/isxander/yacl3/api/ButtonOption.java
@@ -0,0 +1,50 @@
+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);
+
+ 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();
+ }
+}