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/ControllerBuilder.java1
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java7
-rw-r--r--common/src/main/java/dev/isxander/yacl3/api/controller/ValueFormatter.java7
3 files changed, 14 insertions, 1 deletions
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
index 0cd3a55..bbd49a7 100644
--- a/common/src/main/java/dev/isxander/yacl3/api/controller/ControllerBuilder.java
+++ b/common/src/main/java/dev/isxander/yacl3/api/controller/ControllerBuilder.java
@@ -3,6 +3,7 @@ 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/common/src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java b/common/src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java
index af55e55..b886318 100644
--- a/common/src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java
+++ b/common/src/main/java/dev/isxander/yacl3/api/controller/ValueFormattableController.java
@@ -5,5 +5,10 @@ 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);
+ B formatValue(ValueFormatter<T> formatter);
+
+ @Deprecated
+ default B valueFormatter(Function<T, Component> formatter) {
+ return formatValue(formatter::apply);
+ }
}
diff --git a/common/src/main/java/dev/isxander/yacl3/api/controller/ValueFormatter.java b/common/src/main/java/dev/isxander/yacl3/api/controller/ValueFormatter.java
new file mode 100644
index 0000000..aecaf65
--- /dev/null
+++ b/common/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);
+}