aboutsummaryrefslogtreecommitdiff
path: root/common/src/main/java/dev/isxander/yacl3/api/controller
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl3/api/controller')
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/BooleanControllerBuilder.java16
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/ColorControllerBuilder.java14
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/ControllerBuilder.java9
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/CyclingListControllerBuilder.java15
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/DoubleFieldControllerBuilder.java10
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/DoubleSliderControllerBuilder.java10
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/EnumControllerBuilder.java12
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/FloatFieldControllerBuilder.java10
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/FloatSliderControllerBuilder.java10
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/IntegerFieldControllerBuilder.java10
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/IntegerSliderControllerBuilder.java10
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/LongFieldControllerBuilder.java10
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/LongSliderControllerBuilder.java10
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/NumberFieldControllerBuilder.java7
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/SliderControllerBuilder.java6
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/StringControllerBuilder.java10
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/TickBoxControllerBuilder.java10
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java9
18 files changed, 188 insertions, 0 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/api/controller/BooleanControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/BooleanControllerBuilder.java
new file mode 100644
index 0000000..88f9a77
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/ColorControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/ColorControllerBuilder.java
new file mode 100644
index 0000000..8e442ff
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/ControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/ControllerBuilder.java
new file mode 100644
index 0000000..0cd3a55
--- /dev/null
+++ b/common/src/main/java/dev/isxander/yacl3/api/controller/ControllerBuilder.java
@@ -0,0 +1,9 @@
+package dev.isxander.yacl3.api.controller;
+
+import dev.isxander.yacl3.api.Controller;
+import org.jetbrains.annotations.ApiStatus;
+
+public interface ControllerBuilder<T> {
+ @ApiStatus.Internal
+ Controller<T> build();
+}
diff --git a/common/src/main/java/dev/isxander/yacl3/api/controller/CyclingListControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/CyclingListControllerBuilder.java
new file mode 100644
index 0000000..8c9ea91
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/DoubleFieldControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/DoubleFieldControllerBuilder.java
new file mode 100644
index 0000000..db4af94
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/DoubleSliderControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/DoubleSliderControllerBuilder.java
new file mode 100644
index 0000000..7e4b6f9
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/EnumControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/EnumControllerBuilder.java
new file mode 100644
index 0000000..decb8f9
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/FloatFieldControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/FloatFieldControllerBuilder.java
new file mode 100644
index 0000000..de81837
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/FloatSliderControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/FloatSliderControllerBuilder.java
new file mode 100644
index 0000000..2a04dde
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/IntegerFieldControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/IntegerFieldControllerBuilder.java
new file mode 100644
index 0000000..1e31fac
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/IntegerSliderControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/IntegerSliderControllerBuilder.java
new file mode 100644
index 0000000..11e089a
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/LongFieldControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/LongFieldControllerBuilder.java
new file mode 100644
index 0000000..c53b464
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/LongSliderControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/LongSliderControllerBuilder.java
new file mode 100644
index 0000000..fc09423
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/NumberFieldControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/NumberFieldControllerBuilder.java
new file mode 100644
index 0000000..b5cfa1f
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/SliderControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/SliderControllerBuilder.java
new file mode 100644
index 0000000..2fb3fec
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/StringControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/StringControllerBuilder.java
new file mode 100644
index 0000000..5e2f8c6
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/TickBoxControllerBuilder.java b/common/src/main/java/dev/isxander/yacl3/api/controller/TickBoxControllerBuilder.java
new file mode 100644
index 0000000..71a2762
--- /dev/null
+++ b/common/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/common/src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java b/common/src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java
new file mode 100644
index 0000000..af55e55
--- /dev/null
+++ b/common/src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java
@@ -0,0 +1,9 @@
+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 valueFormatter(Function<T, Component> formatter);
+}