From 3027527637373d7df682bf56368cf176ffcc19a8 Mon Sep 17 00:00:00 2001 From: xander Date: Sat, 3 Sep 2022 14:08:53 +0100 Subject: pass through type class to option for controllers to use --- .../java/dev/isxander/yacl/test/ModMenuIntegration.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/testmod/java/dev') diff --git a/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java b/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java index 57d809b..3ba2a73 100644 --- a/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java +++ b/src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java @@ -12,6 +12,7 @@ import dev.isxander.yacl.gui.controllers.slider.FloatSliderController; import dev.isxander.yacl.gui.controllers.slider.IntegerSliderController; import dev.isxander.yacl.gui.controllers.slider.LongSliderController; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.option.GraphicsMode; import net.minecraft.client.toast.SystemToast; import net.minecraft.text.Text; @@ -60,6 +61,12 @@ public class ModMenuIntegration implements ModMenuApi { ) .controller(TickBoxController::new) .build()) + .option(Option.createBuilder(boolean.class) + .name(Text.of("Minecraft AutoJump")) + .tooltip(Text.of("You can even bind minecraft options!")) + .binding(Binding.minecraft(MinecraftClient.getInstance().options.getAutoJump())) + .controller(TickBoxController::new) + .build()) .build()) .group(OptionGroup.createBuilder() .name(Text.of("Slider Controllers")) @@ -109,7 +116,12 @@ public class ModMenuIntegration implements ModMenuApi { () -> TestSettings.enumOption, (value) -> TestSettings.enumOption = value ) - .controller(opt -> new EnumController<>(opt, TestSettings.Alphabet.class)) + .controller(EnumController::new) + .build()) + .option(Option.createBuilder(GraphicsMode.class) + .name(Text.of("Minecraft Graphics Mode")) + .binding(Binding.minecraft(MinecraftClient.getInstance().options.getGraphicsMode())) + .controller(EnumController::new) .build()) .build()) .group(OptionGroup.createBuilder() @@ -243,6 +255,7 @@ public class ModMenuIntegration implements ModMenuApi { .controller(ActionController::new) .build()) .build()) + .save(() -> MinecraftClient.getInstance().options.write()) .build().generateScreen(parent); } -- cgit