From a8217ef28022caa090f59b14e61d8b260c2a2c1d Mon Sep 17 00:00:00 2001 From: makamys Date: Tue, 7 Feb 2023 22:17:36 +0100 Subject: [PATCH] Don't add classpath mods to FML reparseable coremod collection As proposed in https://github.com/SpongePowered/Mixin/issues/207 Fixes mods on the class path containing mixins not getting loaded as mods in a 1.7.10 development environment. Background information: Discovery of Forge mods roughly happens in the following 2 steps: 1. `findClassPathMods`: Discover Forge mods on the class path which are not in the coremod list or the reparseable coremod list. 2. `findModDirMods`: Discover Forge mods that are in the mod directory, or specified as *extra mods* using `--mods`. It appears that the purpose of the reparseable mod list is to prevent a mod from being discovered in both of the steps. This would happen with extra mods containing both a coremod and a Forge mod, since they get injected into the class path during coremod discovery (but since they get marked as reparseable, this is avoided.) Mixin needs to make sure the mod gets discovered in exactly one of the steps. We can achieve this by only adding it to the reparseable list if it's not on the boot class path. This causes only extra mods to get added. --- .../asm/launch/platform/MixinPlatformAgentFMLLegacy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/launchwrapper/java/org/spongepowered/asm/launch/platform/MixinPlatformAgentFMLLegacy.java b/src/launchwrapper/java/org/spongepowered/asm/launch/platform/MixinPlatformAgentFMLLegacy.java index 4244729b..6d82c290 100644 --- a/src/launchwrapper/java/org/spongepowered/asm/launch/platform/MixinPlatformAgentFMLLegacy.java +++ b/src/launchwrapper/java/org/spongepowered/asm/launch/platform/MixinPlatformAgentFMLLegacy.java @@ -195,7 +195,7 @@ public class MixinPlatformAgentFMLLegacy extends MixinPlatformAgentAbstract impl if (this.handle.getAttribute(MixinPlatformAgentFMLLegacy.MFATT_COREMODCONTAINSMOD) != null) { if (this.isIgnoredReparseable()) { MixinPlatformAgentAbstract.logger.debug( - "Ignoring request to add {} to reparseable coremod collection - it is a deobfuscated dependency", this.fileName); + "Ignoring request to add {} to reparseable coremod collection - it is on the class path", this.fileName); return; } this.addReparseableJar(); @@ -203,7 +203,7 @@ public class MixinPlatformAgentFMLLegacy extends MixinPlatformAgentAbstract impl } private boolean isIgnoredReparseable() { - return this.handle.toString().contains("deobfedDeps"); + return System.getProperty("java.class.path").contains(this.fileName); } /**