diff options
author | isXander <xander@isxander.dev> | 2023-08-16 12:56:15 +0100 |
---|---|---|
committer | isXander <xander@isxander.dev> | 2023-08-16 12:56:15 +0100 |
commit | 98f29ec5c30d23999fce37d7daf7aba8f10f25d3 (patch) | |
tree | 95cfa91eff48330072f8d50109b594bc16c4c9f0 /common/src/main/java/dev/isxander/yacl3/api/controller | |
parent | b3d5164010682cdf2d3f68be141792bf71a5dd49 (diff) | |
download | YetAnotherConfigLib-98f29ec5c30d23999fce37d7daf7aba8f10f25d3.tar.gz YetAnotherConfigLib-98f29ec5c30d23999fce37d7daf7aba8f10f25d3.tar.bz2 YetAnotherConfigLib-98f29ec5c30d23999fce37d7daf7aba8f10f25d3.zip |
Add @OverrideName and @OverrideFormat
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl3/api/controller')
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); +} |