From cb9103c4d9db41021245ab4b8ce8d3de946803aa Mon Sep 17 00:00:00 2001 From: piexel Date: Tue, 10 Nov 2026 15:35:26 +0100 Subject: [PATCH] Expose the platform's Gson to pack modules in the Bukkit jar The Bukkit jar relocates Iris's own Gson, and the relocation rewrote the package name in the exposed list, so modules were shown Iris's copy and every reference to com.google.gson failed the pack load. The name is now assembled at run time. --- .../art/arcane/iris/core/modules/IrisModuleHost.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/art/arcane/iris/core/modules/IrisModuleHost.java b/core/src/main/java/art/arcane/iris/core/modules/IrisModuleHost.java index b249be06a..a708747bd 100644 --- a/core/src/main/java/art/arcane/iris/core/modules/IrisModuleHost.java +++ b/core/src/main/java/art/arcane/iris/core/modules/IrisModuleHost.java @@ -50,12 +50,20 @@ public final class IrisModuleHost { * Libraries pack modules may call besides the IrisApi, each with its subpackages: VolmLib, which Iris shades unrelocated, * and Gson, which every platform Iris runs on provides. */ - public static final List SHARED_LIBRARY_PACKAGES = List.of("art.arcane.volmlib", "com.google.gson"); + public static final List SHARED_LIBRARY_PACKAGES = List.of("art.arcane.volmlib", platformGsonPackage()); /** * The structure file transactions Iris's datapack ingest and the jigsaw module's tools both run, which each would * otherwise see as a copy of its own; exposed with its subpackages. */ public static final String STRUCTURE_FILES_PACKAGE = "art.arcane.iris.core.structure.authoring"; + /** + * Assembled at run time: the Bukkit jar relocates Iris's own Gson, and that relocation rewrites every string constant + * naming the package, which would expose Iris's copy instead of the platform's. + */ + private static String platformGsonPackage() { + return String.join(".", "com", "google", "gson"); + } + /** Every package pack modules may use besides the IrisApi. {@code exposedHostPackages} in IrisModule's build lists the same. */ public static final List EXPOSED_PACKAGES = Stream.concat(Stream.of(BUILT_IN_API_PACKAGE, STRUCTURE_FILES_PACKAGE), SHARED_LIBRARY_PACKAGES.stream()).toList();