From 1030e566b78c8e57a458a3f475ceeb2e88d156b6 Mon Sep 17 00:00:00 2001 From: tildejustin Date: Mon, 15 Jan 2024 04:32:47 -0500 Subject: [PATCH] Fix inputGameJars ObjectShare mutating after being set (#876) * fix inputGameJars ObjectShare mutating after being set * make defensive copy unmodifiable * document behavior --- .../loader/impl/game/minecraft/MinecraftGameProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minecraft/src/main/java/net/fabricmc/loader/impl/game/minecraft/MinecraftGameProvider.java b/minecraft/src/main/java/net/fabricmc/loader/impl/game/minecraft/MinecraftGameProvider.java index 5891498ac..2410cbd90 100644 --- a/minecraft/src/main/java/net/fabricmc/loader/impl/game/minecraft/MinecraftGameProvider.java +++ b/minecraft/src/main/java/net/fabricmc/loader/impl/game/minecraft/MinecraftGameProvider.java @@ -243,7 +243,7 @@ public boolean locateGame(FabricLauncher launcher, String[] args) { // expose obfuscated jar locations for mods to more easily remap code from obfuscated to intermediary ObjectShare share = FabricLoaderImpl.INSTANCE.getObjectShare(); share.put("fabric-loader:inputGameJar", gameJars.get(0)); // deprecated - share.put("fabric-loader:inputGameJars", gameJars); + share.put("fabric-loader:inputGameJars", Collections.unmodifiableList(new ArrayList<>(gameJars))); // need to make copy as gameJars is later mutated to hold the remapped jars if (realmsJar != null) share.put("fabric-loader:inputRealmsJar", realmsJar); String version = arguments.remove(Arguments.GAME_VERSION);