diff options
author | xander <xander@isxander.dev> | 2022-09-03 14:08:53 +0100 |
---|---|---|
committer | xander <xander@isxander.dev> | 2022-09-03 14:08:53 +0100 |
commit | 3027527637373d7df682bf56368cf176ffcc19a8 (patch) | |
tree | 7d06ac25b09b1944626e3007ef6831f455c36ec0 /src/testmod/java/dev/isxander/yacl/test | |
parent | be878535f0cd82fe3a0a7c7268e1e6fff5c76a2e (diff) | |
download | YetAnotherConfigLib-3027527637373d7df682bf56368cf176ffcc19a8.tar.gz YetAnotherConfigLib-3027527637373d7df682bf56368cf176ffcc19a8.tar.bz2 YetAnotherConfigLib-3027527637373d7df682bf56368cf176ffcc19a8.zip |
pass through type class to option for controllers to use
Diffstat (limited to 'src/testmod/java/dev/isxander/yacl/test')
-rw-r--r-- | src/testmod/java/dev/isxander/yacl/test/ModMenuIntegration.java | 15 |
1 files changed, 14 insertions, 1 deletions
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); } |