diff options
author | xander <xander@isxander.dev> | 2022-09-02 22:04:35 +0100 |
---|---|---|
committer | xander <xander@isxander.dev> | 2022-09-02 22:04:35 +0100 |
commit | 7f88ddf36ba7804211e8aae6b3723bd8f37c82c5 (patch) | |
tree | 791e5cb050aa1ea17bd86d0bdd64fa441b2ab123 /src/main/java/dev/isxander/yacl/impl | |
parent | dd24e4f8e84ed02913196c8ad6093275acc92219 (diff) | |
download | YetAnotherConfigLib-7f88ddf36ba7804211e8aae6b3723bd8f37c82c5.tar.gz YetAnotherConfigLib-7f88ddf36ba7804211e8aae6b3723bd8f37c82c5.tar.bz2 YetAnotherConfigLib-7f88ddf36ba7804211e8aae6b3723bd8f37c82c5.zip |
implement keyboard-operation for all controllers
fix crash when focusing on option list with tab
add tooltip to groups
check that pending values actually applied on save, if not, error in log and the save button displays an error
when trying to escape with unsaved changes, save button text goes green and bold
YACLConstants file to change certain behaviours, could evolve into its own settings!
update icon
Diffstat (limited to 'src/main/java/dev/isxander/yacl/impl')
3 files changed, 28 insertions, 3 deletions
diff --git a/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java b/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java index 73bff07..1f2d4e2 100644 --- a/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java +++ b/src/main/java/dev/isxander/yacl/impl/OptionGroupImpl.java @@ -4,7 +4,7 @@ import com.google.common.collect.ImmutableList; import dev.isxander.yacl.api.Option; import dev.isxander.yacl.api.OptionGroup; import net.minecraft.text.Text; -import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; -public record OptionGroupImpl(@Nullable Text name, ImmutableList<Option<?>> options, boolean isRoot) implements OptionGroup { +public record OptionGroupImpl(@NotNull Text name, @NotNull Text tooltip, ImmutableList<Option<?>> options, boolean isRoot) implements OptionGroup { } diff --git a/src/main/java/dev/isxander/yacl/impl/OptionImpl.java b/src/main/java/dev/isxander/yacl/impl/OptionImpl.java index c61eaa1..176bf93 100644 --- a/src/main/java/dev/isxander/yacl/impl/OptionImpl.java +++ b/src/main/java/dev/isxander/yacl/impl/OptionImpl.java @@ -69,7 +69,9 @@ public class OptionImpl<T> implements Option<T> { @Override public void applyValue() { - binding().setValue(pendingValue); + if (changed()) { + binding().setValue(pendingValue); + } } @Override diff --git a/src/main/java/dev/isxander/yacl/impl/YACLConstants.java b/src/main/java/dev/isxander/yacl/impl/YACLConstants.java new file mode 100644 index 0000000..28d6a65 --- /dev/null +++ b/src/main/java/dev/isxander/yacl/impl/YACLConstants.java @@ -0,0 +1,23 @@ +package dev.isxander.yacl.impl; + +import org.jetbrains.annotations.ApiStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class YACLConstants { + /** + * Logger used by YACL + */ + @ApiStatus.Internal + public static final Logger LOGGER = LoggerFactory.getLogger("YetAnotherConfigLib"); + + /** + * Amount of ticks to hover before showing tooltips. + */ + public static final int HOVER_TICKS = 20; + + /** + * Reset hover ticks back to 0 when the mouse is moved. + */ + public static final boolean HOVER_MOUSE_RESET = true; +} |