aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl/impl
diff options
context:
space:
mode:
authorxander <xander@isxander.dev>2022-09-20 21:50:48 +0100
committerxander <xander@isxander.dev>2022-09-20 21:50:48 +0100
commit36891bb4f9e6aedacf8f79bc1b18b0402845f3a8 (patch)
tree2d1c71aa9cbadb693213531f3388877cc9a0f1fd /src/main/java/dev/isxander/yacl/impl
parent2ffdf3ecb7890adb796c81808655dbbd624b25bb (diff)
downloadYetAnotherConfigLib-36891bb4f9e6aedacf8f79bc1b18b0402845f3a8.tar.gz
YetAnotherConfigLib-36891bb4f9e6aedacf8f79bc1b18b0402845f3a8.tar.bz2
YetAnotherConfigLib-36891bb4f9e6aedacf8f79bc1b18b0402845f3a8.zip
1.4.2
Diffstat (limited to 'src/main/java/dev/isxander/yacl/impl')
-rw-r--r--src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java3
-rw-r--r--src/main/java/dev/isxander/yacl/impl/ConfigCategoryImpl.java2
-rw-r--r--src/main/java/dev/isxander/yacl/impl/GenericBindingImpl.java2
-rw-r--r--src/main/java/dev/isxander/yacl/impl/OptionImpl.java9
-rw-r--r--src/main/java/dev/isxander/yacl/impl/YetAnotherConfigLibImpl.java2
-rw-r--r--src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java2
6 files changed, 4 insertions, 16 deletions
diff --git a/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java b/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java
index f6c8b6d..7d856b0 100644
--- a/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java
+++ b/src/main/java/dev/isxander/yacl/impl/ButtonOptionImpl.java
@@ -4,15 +4,12 @@ import com.google.common.collect.ImmutableSet;
import dev.isxander.yacl.api.*;
import dev.isxander.yacl.gui.YACLScreen;
import net.minecraft.text.Text;
-import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.function.BiConsumer;
-import java.util.function.Consumer;
import java.util.function.Function;
-@ApiStatus.Internal
public class ButtonOptionImpl implements ButtonOption {
private final Text name;
private final Text tooltip;
diff --git a/src/main/java/dev/isxander/yacl/impl/ConfigCategoryImpl.java b/src/main/java/dev/isxander/yacl/impl/ConfigCategoryImpl.java
index 5a7c9b0..971fecf 100644
--- a/src/main/java/dev/isxander/yacl/impl/ConfigCategoryImpl.java
+++ b/src/main/java/dev/isxander/yacl/impl/ConfigCategoryImpl.java
@@ -4,9 +4,7 @@ import com.google.common.collect.ImmutableList;
import dev.isxander.yacl.api.ConfigCategory;
import dev.isxander.yacl.api.OptionGroup;
import net.minecraft.text.Text;
-import org.jetbrains.annotations.ApiStatus;
-@ApiStatus.Internal
public record ConfigCategoryImpl(Text name, ImmutableList<OptionGroup> groups, Text tooltip) implements ConfigCategory {
}
diff --git a/src/main/java/dev/isxander/yacl/impl/GenericBindingImpl.java b/src/main/java/dev/isxander/yacl/impl/GenericBindingImpl.java
index 9dfe2b0..1867bb6 100644
--- a/src/main/java/dev/isxander/yacl/impl/GenericBindingImpl.java
+++ b/src/main/java/dev/isxander/yacl/impl/GenericBindingImpl.java
@@ -1,12 +1,10 @@
package dev.isxander.yacl.impl;
import dev.isxander.yacl.api.Binding;
-import org.jetbrains.annotations.ApiStatus;
import java.util.function.Consumer;
import java.util.function.Supplier;
-@ApiStatus.Internal
public class GenericBindingImpl<T> implements Binding<T> {
private final T def;
private final Supplier<T> getter;
diff --git a/src/main/java/dev/isxander/yacl/impl/OptionImpl.java b/src/main/java/dev/isxander/yacl/impl/OptionImpl.java
index 36cb217..14cf6a8 100644
--- a/src/main/java/dev/isxander/yacl/impl/OptionImpl.java
+++ b/src/main/java/dev/isxander/yacl/impl/OptionImpl.java
@@ -11,15 +11,14 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Function;
-@ApiStatus.Internal
public class OptionImpl<T> implements Option<T> {
private final Text name;
private Text tooltip;
- private final Function<T, Text> tooltipGetter;
private final Controller<T> controller;
private final Binding<T> binding;
private boolean available;
@@ -39,16 +38,16 @@ public class OptionImpl<T> implements Option<T> {
@NotNull Binding<T> binding,
boolean available,
ImmutableSet<OptionFlag> flags,
- @NotNull Class<T> typeClass
+ @NotNull Class<T> typeClass,
+ @NotNull Collection<BiConsumer<Option<T>, T>> listeners
) {
this.name = name;
- this.tooltipGetter = tooltipGetter;
this.controller = controlGetter.apply(this);
this.binding = binding;
this.available = available;
this.flags = flags;
this.typeClass = typeClass;
- this.listeners = new ArrayList<>();
+ this.listeners = new ArrayList<>(listeners);
addListener((opt, pending) -> tooltip = tooltipGetter.apply(pending));
requestSet(binding().getValue());
diff --git a/src/main/java/dev/isxander/yacl/impl/YetAnotherConfigLibImpl.java b/src/main/java/dev/isxander/yacl/impl/YetAnotherConfigLibImpl.java
index 5938bad..7e2afdb 100644
--- a/src/main/java/dev/isxander/yacl/impl/YetAnotherConfigLibImpl.java
+++ b/src/main/java/dev/isxander/yacl/impl/YetAnotherConfigLibImpl.java
@@ -6,11 +6,9 @@ import dev.isxander.yacl.api.YetAnotherConfigLib;
import dev.isxander.yacl.gui.YACLScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.text.Text;
-import org.jetbrains.annotations.ApiStatus;
import java.util.function.Consumer;
-@ApiStatus.Internal
public record YetAnotherConfigLibImpl(Text title, ImmutableList<ConfigCategory> categories, Runnable saveFunction, Consumer<YACLScreen> initConsumer) implements YetAnotherConfigLib {
@Override
public Screen generateScreen(Screen parent) {
diff --git a/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java b/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java
index 4cb1c0e..76a5868 100644
--- a/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java
+++ b/src/main/java/dev/isxander/yacl/impl/utils/DimensionIntegerImpl.java
@@ -1,9 +1,7 @@
package dev.isxander.yacl.impl.utils;
import dev.isxander.yacl.api.utils.Dimension;
-import org.jetbrains.annotations.ApiStatus;
-@ApiStatus.Internal
public class DimensionIntegerImpl implements Dimension<Integer> {
private int x, y;
private int width, height;