aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl/gui/controllers/EnumController.java
diff options
context:
space:
mode:
authorxander <xander@isxander.dev>2022-09-03 16:47:18 +0100
committerxander <xander@isxander.dev>2022-09-03 16:47:18 +0100
commit37da897b9f7d8e195e46775f3fa859dcac1e10c8 (patch)
tree01eeeaca3dae167e9b8597bef55d9c3aace362ec /src/main/java/dev/isxander/yacl/gui/controllers/EnumController.java
parent8ab95b87a54037daff86e945625c4e2c3811fc1e (diff)
downloadYetAnotherConfigLib-37da897b9f7d8e195e46775f3fa859dcac1e10c8.tar.gz
YetAnotherConfigLib-37da897b9f7d8e195e46775f3fa859dcac1e10c8.tar.bz2
YetAnotherConfigLib-37da897b9f7d8e195e46775f3fa859dcac1e10c8.zip
enum controllers now search for TranslatableOption for Text
Diffstat (limited to 'src/main/java/dev/isxander/yacl/gui/controllers/EnumController.java')
-rw-r--r--src/main/java/dev/isxander/yacl/gui/controllers/EnumController.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/dev/isxander/yacl/gui/controllers/EnumController.java b/src/main/java/dev/isxander/yacl/gui/controllers/EnumController.java
index 75d2bca..cb25963 100644
--- a/src/main/java/dev/isxander/yacl/gui/controllers/EnumController.java
+++ b/src/main/java/dev/isxander/yacl/gui/controllers/EnumController.java
@@ -7,6 +7,7 @@ import dev.isxander.yacl.api.utils.Dimension;
import dev.isxander.yacl.gui.YACLScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.text.Text;
+import net.minecraft.util.TranslatableOption;
import org.jetbrains.annotations.ApiStatus;
import org.lwjgl.glfw.GLFW;
@@ -34,6 +35,8 @@ public class EnumController<T extends Enum<T>> implements Controller<T> {
this(option, value -> {
if (value instanceof NameableEnum nameableEnum)
return nameableEnum.getDisplayName();
+ if (value instanceof TranslatableOption translatableOption)
+ return translatableOption.getText();
return Text.of(value.name());
});
}