From 26aec79e10025ff3427ceb47602156ebd670b2ac Mon Sep 17 00:00:00 2001 From: isXander Date: Sun, 14 Apr 2024 21:11:32 +0100 Subject: Fix gifs not being preloaded + add testmod samples --- src/testmod/java/dev/isxander/yacl3/test/GuiTest.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/testmod/java/dev/isxander') diff --git a/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java b/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java index 34ae06a..3ddfce6 100644 --- a/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java +++ b/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java @@ -64,7 +64,7 @@ public class GuiTest { private static Screen getFullTestSuite(Screen parent) { AtomicReference> booleanOption = new AtomicReference<>(); - ConfigTest.GSON.serializer().load(); + ConfigTest.GSON.load(); return YetAnotherConfigLib.create(ConfigTest.GSON, (defaults, config, builder) -> builder .title(Component.literal("Test GUI")) .category(ConfigCategory.createBuilder() @@ -83,7 +83,7 @@ public class GuiTest { .append(Component.literal("e").withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("e"))))) .withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://isxander.dev"))) ) - .webpImage(new ResourceLocation("yacl3-test", "reach-around-placement.webp")) + .webpImage(imageSample("sample1.webp")) .build()) .binding( defaults.booleanToggle, @@ -113,7 +113,10 @@ public class GuiTest { .build()) .option(Option.createBuilder() .name(Component.literal("Tick Box")) - .description(OptionDescription.of(Component.literal("There are even alternate methods of displaying the same data type!"))) + .description(OptionDescription.createBuilder() + .text(Component.literal("There are even alternate methods of displaying the same data type!")) + .webpImage(imageSample("sample3.webp")) + .build()) .binding( defaults.tickbox, () -> config.tickbox, @@ -126,6 +129,9 @@ public class GuiTest { .name(Component.literal("Slider Controllers")) .option(Option.createBuilder() .name(Component.literal("Int Slider")) + .description(OptionDescription.createBuilder() + .gifImage(imageSample("sample4.gif")) + .build()) .binding( defaults.intSlider, () -> config.intSlider, @@ -489,6 +495,10 @@ public class GuiTest { .generateScreen(parent); } + private static ResourceLocation imageSample(String name) { + return new ResourceLocation("yacl_test", "textures/images/" + name); + } + private static boolean myBooleanOption = true; private static Screen getWikiGetStarted(Screen parent) { -- cgit