From 39bc5b5d8b8e6d4369ea71a7787907521e11ad34 Mon Sep 17 00:00:00 2001 From: isXander Date: Thu, 17 Aug 2023 14:19:32 +0100 Subject: Re-write image renderer handling to be threadsafe (relates to #101) --- .../java/dev/isxander/yacl3/config/GsonConfigInstance.java | 14 ++++++++++++++ .../yacl3/config/v2/api/autogen/OverrideImage.java | 2 +- .../config/v2/impl/autogen/EmptyCustomImageFactory.java | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) (limited to 'common/src/main/java/dev/isxander/yacl3/config') diff --git a/common/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java b/common/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java index 0d7b289..acbf338 100644 --- a/common/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java +++ b/common/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java @@ -22,6 +22,20 @@ import java.util.function.UnaryOperator; * * @param config data type * @deprecated upgrade to config v2 {@link dev.isxander.yacl3.config.v2.api.ConfigClassHandler} with {@link dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder} + *
+ * {@code
+ * public class MyConfig {
+ *     public static ConfigClassHandler HANDLER = ConfigClassHandler.createBuilder(MyConfig.class)
+ *             .id(new ResourceLocation("modid", "config"))
+ *             .serializer(config -> GsonConfigSerializerBuilder.create(config)
+ *                     .setPath(FabricLoader.getInstance().getConfigDir().resolve("my_mod.json")
+ *                     .build())
+ *             .build();
+ *
+ *     @SerialEntry public boolean myBoolean = true;
+ * }
+ * }
+ * 
*/ @Deprecated public class GsonConfigInstance extends ConfigInstance { diff --git a/common/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/OverrideImage.java b/common/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/OverrideImage.java index 649121a..5a33884 100644 --- a/common/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/OverrideImage.java +++ b/common/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/OverrideImage.java @@ -2,7 +2,7 @@ package dev.isxander.yacl3.config.v2.api.autogen; import dev.isxander.yacl3.config.v2.api.ConfigField; import dev.isxander.yacl3.config.v2.impl.autogen.EmptyCustomImageFactory; -import dev.isxander.yacl3.gui.ImageRenderer; +import dev.isxander.yacl3.gui.image.ImageRenderer; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/EmptyCustomImageFactory.java b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/EmptyCustomImageFactory.java index f6949e7..421de82 100644 --- a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/EmptyCustomImageFactory.java +++ b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/EmptyCustomImageFactory.java @@ -3,7 +3,7 @@ package dev.isxander.yacl3.config.v2.impl.autogen; import dev.isxander.yacl3.config.v2.api.ConfigField; import dev.isxander.yacl3.config.v2.api.autogen.OptionAccess; import dev.isxander.yacl3.config.v2.api.autogen.OverrideImage; -import dev.isxander.yacl3.gui.ImageRenderer; +import dev.isxander.yacl3.gui.image.ImageRenderer; import java.util.Optional; import java.util.concurrent.CompletableFuture; -- cgit