From c8ab29d1d6111ba581b0f0bcb0a6d0c852161edb Mon Sep 17 00:00:00 2001 From: isxander Date: Wed, 22 Nov 2023 17:00:22 +0000 Subject: Update to 1.20.3-pre2, temp disable forge projects --- build.gradle.kts | 2 +- .../isxander/yacl3/config/GsonConfigInstance.java | 9 +-- .../v2/impl/serializer/GsonConfigSerializer.java | 18 +++++- .../isxander/yacl3/gui/ElementListWidgetExt.java | 65 +++++----------------- .../dev/isxander/yacl3/gui/OptionListWidget.java | 4 +- .../isxander/yacl3/gui/TooltipButtonWidget.java | 8 ++- .../java/dev/isxander/yacl3/gui/YACLTooltip.java | 20 +++++++ .../isxander/yacl3/impl/ConfigCategoryImpl.java | 3 +- common/src/main/resources/yacl.accesswidener | 1 + gradle.properties | 2 +- gradle/libs.versions.toml | 8 +-- .../main/java/dev/isxander/yacl3/test/GuiTest.java | 2 +- 12 files changed, 71 insertions(+), 71 deletions(-) create mode 100644 common/src/main/java/dev/isxander/yacl3/gui/YACLTooltip.java diff --git a/build.gradle.kts b/build.gradle.kts index 9b54b7d..10626a0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ architectury { minecraft = libs.versions.minecraft.get() } -version = "3.3.0-beta.1+1.20.2" +version = "3.3.0+1.20.3" val isBeta = "beta" in version.toString() val changelogText = rootProject.file("changelogs/${project.version}.md").takeIf { it.exists() }?.readText() ?: "No changelog provided." 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 deff6d7..4e7c931 100644 --- a/common/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java +++ b/common/src/main/java/dev/isxander/yacl3/config/GsonConfigInstance.java @@ -1,6 +1,7 @@ package dev.isxander.yacl3.config; import com.google.gson.*; +import dev.isxander.yacl3.config.v2.impl.serializer.GsonConfigSerializer; import dev.isxander.yacl3.gui.utils.ItemRegistryHelper; import dev.isxander.yacl3.impl.utils.YACLConstants; import net.minecraft.core.registries.BuiltInRegistries; @@ -66,8 +67,8 @@ public class GsonConfigInstance extends ConfigInstance { this.path = path; this.gson = builder .setExclusionStrategies(new ConfigExclusionStrategy()) - .registerTypeHierarchyAdapter(Component.class, new Component.Serializer()) - .registerTypeHierarchyAdapter(Style.class, new Style.Serializer()) + .registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter()) + .registerTypeHierarchyAdapter(Style.class, new GsonConfigSerializer.StyleTypeAdapter()) .registerTypeHierarchyAdapter(Color.class, new ColorTypeAdapter()) .registerTypeHierarchyAdapter(Item.class, new ItemTypeAdapter()) .serializeNulls() @@ -161,8 +162,8 @@ public class GsonConfigInstance extends ConfigInstance { private UnaryOperator gsonBuilder = builder -> builder .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .serializeNulls() - .registerTypeHierarchyAdapter(Component.class, new Component.Serializer()) - .registerTypeHierarchyAdapter(Style.class, new Style.Serializer()) + .registerTypeHierarchyAdapter(Component.class, new Component.SerializerAdapter()) + .registerTypeHierarchyAdapter(Style.class, new GsonConfigSerializer.StyleTypeAdapter()) .registerTypeHierarchyAdapter(Color.class, new ColorTypeAdapter()) .registerTypeHierarchyAdapter(Item.class, new ItemTypeAdapter()); diff --git a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java index a60bcb1..1edd28a 100644 --- a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java +++ b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/serializer/GsonConfigSerializer.java @@ -1,12 +1,14 @@ package dev.isxander.yacl3.config.v2.impl.serializer; import com.google.gson.*; +import com.mojang.serialization.JsonOps; import dev.isxander.yacl3.config.GsonConfigInstance; import dev.isxander.yacl3.config.v2.api.*; import dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder; import dev.isxander.yacl3.gui.utils.ItemRegistryHelper; import dev.isxander.yacl3.impl.utils.YACLConstants; import dev.isxander.yacl3.platform.YACLPlatform; +import net.minecraft.commands.ParserUtils; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; @@ -173,6 +175,18 @@ public class GsonConfigSerializer extends ConfigSerializer { config.load(); } + public static class StyleTypeAdapter implements JsonSerializer