diff options
author | xander <xander@isxander.dev> | 2022-09-02 11:16:48 +0100 |
---|---|---|
committer | xander <xander@isxander.dev> | 2022-09-02 11:16:48 +0100 |
commit | dd24e4f8e84ed02913196c8ad6093275acc92219 (patch) | |
tree | a9b846f6efad8f122c8364c499b098d95a23034d /src/main/java/dev/isxander/yacl/api/ButtonOption.java | |
parent | 7c58fdd5aa54e88c1526c49adacaf97cf3810eba (diff) | |
download | YetAnotherConfigLib-dd24e4f8e84ed02913196c8ad6093275acc92219.tar.gz YetAnotherConfigLib-dd24e4f8e84ed02913196c8ad6093275acc92219.tar.bz2 YetAnotherConfigLib-dd24e4f8e84ed02913196c8ad6093275acc92219.zip |
button options now consume YACLScreen
Diffstat (limited to 'src/main/java/dev/isxander/yacl/api/ButtonOption.java')
-rw-r--r-- | src/main/java/dev/isxander/yacl/api/ButtonOption.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/dev/isxander/yacl/api/ButtonOption.java b/src/main/java/dev/isxander/yacl/api/ButtonOption.java index 346bfa4..f3d1e6b 100644 --- a/src/main/java/dev/isxander/yacl/api/ButtonOption.java +++ b/src/main/java/dev/isxander/yacl/api/ButtonOption.java @@ -1,5 +1,6 @@ package dev.isxander.yacl.api; +import dev.isxander.yacl.gui.YACLScreen; import dev.isxander.yacl.impl.ButtonOptionImpl; import net.minecraft.text.MutableText; import net.minecraft.text.Text; @@ -8,10 +9,11 @@ import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; import java.util.function.Function; -public interface ButtonOption extends Option<Runnable> { - Runnable action(); +public interface ButtonOption extends Option<Consumer<YACLScreen>> { + Consumer<YACLScreen> action(); static Builder createBuilder() { return new Builder(); @@ -20,8 +22,8 @@ public interface ButtonOption extends Option<Runnable> { class Builder { private Text name; private final List<Text> tooltipLines = new ArrayList<>(); - private Function<ButtonOption, Controller<Runnable>> controlGetter; - private Runnable action; + private Function<ButtonOption, Controller<Consumer<YACLScreen>>> controlGetter; + private Consumer<YACLScreen> action; private Builder() { @@ -41,14 +43,14 @@ public interface ButtonOption extends Option<Runnable> { return this; } - public Builder action(@NotNull Runnable action) { + public Builder action(@NotNull Consumer<YACLScreen> action) { Validate.notNull(action, "`action` cannot be null"); this.action = action; return this; } - public Builder controller(@NotNull Function<ButtonOption, Controller<Runnable>> control) { + public Builder controller(@NotNull Function<ButtonOption, Controller<Consumer<YACLScreen>>> control) { Validate.notNull(control, "`control` cannot be null"); this.controlGetter = control; |