diff options
| author | xander <xander@isxander.dev> | 2022-09-01 11:58:49 +0100 |
|---|---|---|
| committer | xander <xander@isxander.dev> | 2022-09-01 11:58:49 +0100 |
| commit | 4d977cc9764ecf0073650f126700f6ff638fa06b (patch) | |
| tree | 883e68bbd80874c048b3e34db59bf0aa926b489b /src/main/java/dev/isxander/yacl/gui/controllers/ActionControl.java | |
| parent | e63a3c989e3a899bdc81558dd2e4c5cc2c659bde (diff) | |
| download | YetAnotherConfigLib-4d977cc9764ecf0073650f126700f6ff638fa06b.tar.gz YetAnotherConfigLib-4d977cc9764ecf0073650f126700f6ff638fa06b.tar.bz2 YetAnotherConfigLib-4d977cc9764ecf0073650f126700f6ff638fa06b.zip | |
javadoc!
added LongSliderController
renamed Control -> Controller
add minecraft simple option binding constructor
Diffstat (limited to 'src/main/java/dev/isxander/yacl/gui/controllers/ActionControl.java')
| -rw-r--r-- | src/main/java/dev/isxander/yacl/gui/controllers/ActionControl.java | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/main/java/dev/isxander/yacl/gui/controllers/ActionControl.java b/src/main/java/dev/isxander/yacl/gui/controllers/ActionControl.java deleted file mode 100644 index 66e8e35..0000000 --- a/src/main/java/dev/isxander/yacl/gui/controllers/ActionControl.java +++ /dev/null @@ -1,58 +0,0 @@ -package dev.isxander.yacl.gui.controllers; - -import dev.isxander.yacl.api.ButtonOption; -import dev.isxander.yacl.api.Control; -import dev.isxander.yacl.api.utils.Dimension; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.text.Text; - -public class ActionControl implements Control<Runnable> { - private final ButtonOption option; - private final Text executeText; - - public ActionControl(ButtonOption option) { - this(option, Text.translatable("yacl.control.action.execute")); - } - - public ActionControl(ButtonOption option, Text executeText) { - this.option = option; - this.executeText = executeText; - - } - - @Override - public ButtonOption option() { - return option; - } - - @Override - public Text formatValue() { - return executeText; - } - - @Override - public ControlWidget<ActionControl> provideWidget(Screen screen, Dimension<Integer> widgetDimension) { - return new ActionControlElement(this, screen, widgetDimension); - } - - public static class ActionControlElement extends ControlWidget<ActionControl> { - public ActionControlElement(ActionControl control, Screen screen, Dimension<Integer> dim) { - super(control, screen, dim); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (isMouseOver(mouseX, mouseY)) { - playDownSound(); - control.option().action().run(); - return true; - } - return false; - } - - @Override - protected int getHoveredControlWidth() { - return getUnhoveredControlWidth(); - } - } -} |
