aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl3/api/controller
diff options
context:
space:
mode:
authorisxander <xander@isxander.dev>2024-04-11 18:43:06 +0100
committerisxander <xander@isxander.dev>2024-04-11 18:43:06 +0100
commit04fe933f4c24817100f3101f088accf55a621f8a (patch)
treefeff94ca3ab4484160e69a24f4ee38522381950e /src/main/java/dev/isxander/yacl3/api/controller
parent831b894fdb7fe3e173d81387c8f6a2402b8ccfa9 (diff)
downloadYetAnotherConfigLib-04fe933f4c24817100f3101f088accf55a621f8a.tar.gz
YetAnotherConfigLib-04fe933f4c24817100f3101f088accf55a621f8a.tar.bz2
YetAnotherConfigLib-04fe933f4c24817100f3101f088accf55a621f8a.zip
Extremely fragile and broken multiversion build with stonecutter
Diffstat (limited to 'src/main/java/dev/isxander/yacl3/api/controller')
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/BooleanControllerBuilder.java16
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/ColorControllerBuilder.java14
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/ControllerBuilder.java10
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/CyclingListControllerBuilder.java15
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/DoubleFieldControllerBuilder.java10
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/DoubleSliderControllerBuilder.java10
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/DropdownStringControllerBuilder.java18
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/EnumControllerBuilder.java12
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/EnumDropdownControllerBuilder.java10
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/FloatFieldControllerBuilder.java10
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/FloatSliderControllerBuilder.java10
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/IntegerFieldControllerBuilder.java10
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/IntegerSliderControllerBuilder.java10
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/ItemControllerBuilder.java11
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/LongFieldControllerBuilder.java10
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/LongSliderControllerBuilder.java10
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/NumberFieldControllerBuilder.java7
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/SliderControllerBuilder.java6
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/StringControllerBuilder.java10
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/TickBoxControllerBuilder.java10
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java14
-rw-r--r--src/main/java/dev/isxander/yacl3/api/controller/ValueFormatter.java7
22 files changed, 240 insertions, 0 deletions
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/BooleanControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/BooleanControllerBuilder.java
new file mode 100644
index 0000000..88f9a77
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/BooleanControllerBuilder.java
@@ -0,0 +1,16 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.BooleanControllerBuilderImpl;
+
+public interface BooleanControllerBuilder extends ValueFormattableController<Boolean, BooleanControllerBuilder> {
+ BooleanControllerBuilder coloured(boolean coloured);
+
+ BooleanControllerBuilder onOffFormatter();
+ BooleanControllerBuilder yesNoFormatter();
+ BooleanControllerBuilder trueFalseFormatter();
+
+ static BooleanControllerBuilder create(Option<Boolean> option) {
+ return new BooleanControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/ColorControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/ColorControllerBuilder.java
new file mode 100644
index 0000000..8e442ff
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/ColorControllerBuilder.java
@@ -0,0 +1,14 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.ColorControllerBuilderImpl;
+
+import java.awt.Color;
+
+public interface ColorControllerBuilder extends ControllerBuilder<Color> {
+ ColorControllerBuilder allowAlpha(boolean allowAlpha);
+
+ static ColorControllerBuilder create(Option<Color> option) {
+ return new ColorControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/ControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/ControllerBuilder.java
new file mode 100644
index 0000000..bbd49a7
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/ControllerBuilder.java
@@ -0,0 +1,10 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Controller;
+import org.jetbrains.annotations.ApiStatus;
+
+@FunctionalInterface
+public interface ControllerBuilder<T> {
+ @ApiStatus.Internal
+ Controller<T> build();
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/CyclingListControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/CyclingListControllerBuilder.java
new file mode 100644
index 0000000..8c9ea91
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/CyclingListControllerBuilder.java
@@ -0,0 +1,15 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.CyclingListControllerBuilderImpl;
+
+public interface CyclingListControllerBuilder<T> extends ValueFormattableController<T, CyclingListControllerBuilder<T>> {
+ @SuppressWarnings("unchecked")
+ CyclingListControllerBuilder<T> values(T... values);
+
+ CyclingListControllerBuilder<T> values(Iterable<? extends T> values);
+
+ static <T> CyclingListControllerBuilder<T> create(Option<T> option) {
+ return new CyclingListControllerBuilderImpl<>(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/DoubleFieldControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/DoubleFieldControllerBuilder.java
new file mode 100644
index 0000000..db4af94
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/DoubleFieldControllerBuilder.java
@@ -0,0 +1,10 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.DoubleFieldControllerBuilderImpl;
+
+public interface DoubleFieldControllerBuilder extends NumberFieldControllerBuilder<Double, DoubleFieldControllerBuilder> {
+ static DoubleFieldControllerBuilder create(Option<Double> option) {
+ return new DoubleFieldControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/DoubleSliderControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/DoubleSliderControllerBuilder.java
new file mode 100644
index 0000000..7e4b6f9
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/DoubleSliderControllerBuilder.java
@@ -0,0 +1,10 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.DoubleSliderControllerBuilderImpl;
+
+public interface DoubleSliderControllerBuilder extends SliderControllerBuilder<Double, DoubleSliderControllerBuilder> {
+ static DoubleSliderControllerBuilder create(Option<Double> option) {
+ return new DoubleSliderControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/DropdownStringControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/DropdownStringControllerBuilder.java
new file mode 100644
index 0000000..3f5fb33
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/DropdownStringControllerBuilder.java
@@ -0,0 +1,18 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.DropdownStringControllerBuilderImpl;
+
+import java.util.List;
+
+public interface DropdownStringControllerBuilder extends StringControllerBuilder {
+ DropdownStringControllerBuilder values(List<String> values);
+ DropdownStringControllerBuilder values(String... values);
+ DropdownStringControllerBuilder allowEmptyValue(boolean allowEmptyValue);
+ DropdownStringControllerBuilder allowAnyValue(boolean allowAnyValue);
+
+
+ static DropdownStringControllerBuilder create(Option<String> option) {
+ return new DropdownStringControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/EnumControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/EnumControllerBuilder.java
new file mode 100644
index 0000000..decb8f9
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/EnumControllerBuilder.java
@@ -0,0 +1,12 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.EnumControllerBuilderImpl;
+
+public interface EnumControllerBuilder<T extends Enum<T>> extends ValueFormattableController<T, EnumControllerBuilder<T>> {
+ EnumControllerBuilder<T> enumClass(Class<T> enumClass);
+
+ static <T extends Enum<T>> EnumControllerBuilder<T> create(Option<T> option) {
+ return new EnumControllerBuilderImpl<>(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/EnumDropdownControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/EnumDropdownControllerBuilder.java
new file mode 100644
index 0000000..0814cc6
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/EnumDropdownControllerBuilder.java
@@ -0,0 +1,10 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.EnumDropdownControllerBuilderImpl;
+
+public interface EnumDropdownControllerBuilder<E extends Enum<E>> extends ValueFormattableController<E, EnumDropdownControllerBuilder<E>> {
+ static <E extends Enum<E>> EnumDropdownControllerBuilder<E> create(Option<E> option) {
+ return new EnumDropdownControllerBuilderImpl<>(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/FloatFieldControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/FloatFieldControllerBuilder.java
new file mode 100644
index 0000000..de81837
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/FloatFieldControllerBuilder.java
@@ -0,0 +1,10 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.FloatFieldControllerBuilderImpl;
+
+public interface FloatFieldControllerBuilder extends NumberFieldControllerBuilder<Float, FloatFieldControllerBuilder> {
+ static FloatFieldControllerBuilder create(Option<Float> option) {
+ return new FloatFieldControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/FloatSliderControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/FloatSliderControllerBuilder.java
new file mode 100644
index 0000000..2a04dde
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/FloatSliderControllerBuilder.java
@@ -0,0 +1,10 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.FloatSliderControllerBuilderImpl;
+
+public interface FloatSliderControllerBuilder extends SliderControllerBuilder<Float, FloatSliderControllerBuilder> {
+ static FloatSliderControllerBuilder create(Option<Float> option) {
+ return new FloatSliderControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/IntegerFieldControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/IntegerFieldControllerBuilder.java
new file mode 100644
index 0000000..1e31fac
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/IntegerFieldControllerBuilder.java
@@ -0,0 +1,10 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.IntegerFieldControllerBuilderImpl;
+
+public interface IntegerFieldControllerBuilder extends NumberFieldControllerBuilder<Integer, IntegerFieldControllerBuilder> {
+ static IntegerFieldControllerBuilder create(Option<Integer> option) {
+ return new IntegerFieldControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/IntegerSliderControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/IntegerSliderControllerBuilder.java
new file mode 100644
index 0000000..11e089a
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/IntegerSliderControllerBuilder.java
@@ -0,0 +1,10 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.IntegerSliderControllerBuilderImpl;
+
+public interface IntegerSliderControllerBuilder extends SliderControllerBuilder<Integer, IntegerSliderControllerBuilder> {
+ static IntegerSliderControllerBuilder create(Option<Integer> option) {
+ return new IntegerSliderControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/ItemControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/ItemControllerBuilder.java
new file mode 100644
index 0000000..5a1f5fa
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/ItemControllerBuilder.java
@@ -0,0 +1,11 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.ItemControllerBuilderImpl;
+import net.minecraft.world.item.Item;
+
+public interface ItemControllerBuilder extends ControllerBuilder<Item> {
+ static ItemControllerBuilder create(Option<Item> option) {
+ return new ItemControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/LongFieldControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/LongFieldControllerBuilder.java
new file mode 100644
index 0000000..c53b464
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/LongFieldControllerBuilder.java
@@ -0,0 +1,10 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.LongFieldControllerBuilderImpl;
+
+public interface LongFieldControllerBuilder extends NumberFieldControllerBuilder<Long, LongFieldControllerBuilder> {
+ static LongFieldControllerBuilder create(Option<Long> option) {
+ return new LongFieldControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/LongSliderControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/LongSliderControllerBuilder.java
new file mode 100644
index 0000000..fc09423
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/LongSliderControllerBuilder.java
@@ -0,0 +1,10 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.LongSliderControllerBuilderImpl;
+
+public interface LongSliderControllerBuilder extends SliderControllerBuilder<Long, LongSliderControllerBuilder> {
+ static LongSliderControllerBuilder create(Option<Long> option) {
+ return new LongSliderControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/NumberFieldControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/NumberFieldControllerBuilder.java
new file mode 100644
index 0000000..b5cfa1f
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/NumberFieldControllerBuilder.java
@@ -0,0 +1,7 @@
+package dev.isxander.yacl3.api.controller;
+
+public interface NumberFieldControllerBuilder<T extends Number, B extends NumberFieldControllerBuilder<T, B>> extends ValueFormattableController<T, B> {
+ B min(T min);
+ B max(T max);
+ B range(T min, T max);
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/SliderControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/SliderControllerBuilder.java
new file mode 100644
index 0000000..2fb3fec
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/SliderControllerBuilder.java
@@ -0,0 +1,6 @@
+package dev.isxander.yacl3.api.controller;
+
+public interface SliderControllerBuilder<T extends Number, B extends SliderControllerBuilder<T, B>> extends ValueFormattableController<T, B> {
+ B range(T min, T max);
+ B step(T step);
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/StringControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/StringControllerBuilder.java
new file mode 100644
index 0000000..5e2f8c6
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/StringControllerBuilder.java
@@ -0,0 +1,10 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.StringControllerBuilderImpl;
+
+public interface StringControllerBuilder extends ControllerBuilder<String> {
+ static StringControllerBuilder create(Option<String> option) {
+ return new StringControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/TickBoxControllerBuilder.java b/src/main/java/dev/isxander/yacl3/api/controller/TickBoxControllerBuilder.java
new file mode 100644
index 0000000..71a2762
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/TickBoxControllerBuilder.java
@@ -0,0 +1,10 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Option;
+import dev.isxander.yacl3.impl.controller.TickBoxControllerBuilderImpl;
+
+public interface TickBoxControllerBuilder extends ControllerBuilder<Boolean> {
+ static TickBoxControllerBuilder create(Option<Boolean> option) {
+ return new TickBoxControllerBuilderImpl(option);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java b/src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java
new file mode 100644
index 0000000..b886318
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java
@@ -0,0 +1,14 @@
+package dev.isxander.yacl3.api.controller;
+
+import net.minecraft.network.chat.Component;
+
+import java.util.function.Function;
+
+public interface ValueFormattableController<T, B extends ValueFormattableController<T, B>> extends ControllerBuilder<T> {
+ B formatValue(ValueFormatter<T> formatter);
+
+ @Deprecated
+ default B valueFormatter(Function<T, Component> formatter) {
+ return formatValue(formatter::apply);
+ }
+}
diff --git a/src/main/java/dev/isxander/yacl3/api/controller/ValueFormatter.java b/src/main/java/dev/isxander/yacl3/api/controller/ValueFormatter.java
new file mode 100644
index 0000000..aecaf65
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/api/controller/ValueFormatter.java
@@ -0,0 +1,7 @@
+package dev.isxander.yacl3.api.controller;
+
+import net.minecraft.network.chat.Component;
+
+public interface ValueFormatter<T> {
+ Component format(T value);
+}