diff options
Diffstat (limited to 'common/src/main/java')
-rw-r--r-- | common/src/main/java/dev/isxander/yacl3/impl/HiddenNameListOptionEntry.java | 109 | ||||
-rw-r--r-- | common/src/main/java/dev/isxander/yacl3/impl/ListOptionEntryImpl.java | 4 |
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 |