aboutsummaryrefslogtreecommitdiff
path: root/common/src/main/java/dev
diff options
context:
space:
mode:
authorisXander <xandersmith2008@gmail.com>2023-07-24 15:58:24 +0100
committerisXander <xandersmith2008@gmail.com>2023-07-24 16:10:44 +0100
commit11ab4e400a69e019bcdd00de449d44aa75b92099 (patch)
tree0db4acac02c0d06927a302b2a54bd3bd5e3f7b65 /common/src/main/java/dev
parent8211034ad491949b433b094b7d5c920f3ab7a378 (diff)
downloadYetAnotherConfigLib-11ab4e400a69e019bcdd00de449d44aa75b92099.tar.gz
YetAnotherConfigLib-11ab4e400a69e019bcdd00de449d44aa75b92099.tar.bz2
YetAnotherConfigLib-11ab4e400a69e019bcdd00de449d44aa75b92099.zip
Fix the name of the list being present on every entry
Diffstat (limited to 'common/src/main/java/dev')
-rw-r--r--common/src/main/java/dev/isxander/yacl3/impl/HiddenNameListOptionEntry.java109
-rw-r--r--common/src/main/java/dev/isxander/yacl3/impl/ListOptionEntryImpl.java4
2 files changed, 111 insertions, 2 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/impl/HiddenNameListOptionEntry.java b/common/src/main/java/dev/isxander/yacl3/impl/HiddenNameListOptionEntry.java
new file mode 100644
index 0000000..6ff2669
--- /dev/null
+++ b/common/src/main/java/dev/isxander/yacl3/impl/HiddenNameListOptionEntry.java
@@ -0,0 +1,109 @@
+package dev.isxander.yacl3.impl;
+
+import com.google.common.collect.ImmutableSet;
+import dev.isxander.yacl3.api.*;
+import net.minecraft.network.chat.Component;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.function.BiConsumer;
+
+public class HiddenNameListOptionEntry<T> implements ListOptionEntry<T> {
+ private final ListOptionEntry<T> option;
+
+ public HiddenNameListOptionEntry(ListOptionEntry<T> option) {
+ this.option = option;
+ }
+
+ @Override
+ public @NotNull Component name() {
+ return Component.empty();
+ }
+
+ @Override
+ public @NotNull OptionDescription description() {
+ return option.description();
+ }
+
+ @Override
+ @Deprecated
+ public @NotNull Component tooltip() {
+ return option.tooltip();
+ }
+
+ @Override
+ public @NotNull Controller<T> controller() {
+ return option.controller();
+ }
+
+ @Override
+ public @NotNull Binding<T> binding() {
+ return option.binding();
+ }
+
+ @Override
+ public boolean available() {
+ return option.available();
+ }
+
+ @Override
+ public void setAvailable(boolean available) {
+ option.setAvailable(available);
+ }
+
+ @Override
+ public ListOption<T> parentGroup() {
+ return option.parentGroup();
+ }
+
+ @Override
+ public @NotNull ImmutableSet<OptionFlag> flags() {
+ return option.flags();
+ }
+
+ @Override
+ public boolean changed() {
+ return option.changed();
+ }
+
+ @Override
+ public @NotNull T pendingValue() {
+ return option.pendingValue();
+ }
+
+ @Override
+ public void requestSet(T value) {
+ option.requestSet(value);
+ }
+
+ @Override
+ public boolean applyValue() {
+ return option.applyValue();
+ }
+
+ @Override
+ public void forgetPendingValue() {
+ option.forgetPendingValue();
+ }
+
+ @Override
+ public void requestSetDefault() {
+ option.requestSetDefault();
+ }
+
+ @Override
+ public boolean isPendingValueDefault() {
+ return option.isPendingValueDefault();
+ }
+
+ @Override
+ public boolean canResetToDefault() {
+ return option.canResetToDefault();
+ }
+
+ @Override
+ public void addListener(BiConsumer<Option<T>, T> changedListener) {
+ option.addListener(changedListener);
+ }
+
+
+}
diff --git a/common/src/main/java/dev/isxander/yacl3/impl/ListOptionEntryImpl.java b/common/src/main/java/dev/isxander/yacl3/impl/ListOptionEntryImpl.java
index d5a9218..bdb8de8 100644
--- a/common/src/main/java/dev/isxander/yacl3/impl/ListOptionEntryImpl.java
+++ b/common/src/main/java/dev/isxander/yacl3/impl/ListOptionEntryImpl.java
@@ -25,7 +25,7 @@ public final class ListOptionEntryImpl<T> implements ListOptionEntry<T> {
this.group = group;
this.value = initialValue;
this.binding = new EntryBinding();
- this.controller = new EntryController<>(controlGetter.apply(this), this);
+ this.controller = new EntryController<>(controlGetter.apply(new HiddenNameListOptionEntry<>(this)), this);
}
@Override
@@ -40,7 +40,7 @@ public final class ListOptionEntryImpl<T> implements ListOptionEntry<T> {
@Override
public @NotNull Component tooltip() {
- return Component.empty();
+ return group.tooltip();
}
@Override