diff --git a/.gitignore b/.gitignore index e7c2a6448..0681822f4 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,7 @@ !/proguard.conf !/minecraft -!/junit \ No newline at end of file +!/junit + +# MacOS junk files +.DS_Store diff --git a/minecraft/src/main/java/net/fabricmc/loader/impl/game/minecraft/patch/EntrypointPatchFML125.java b/minecraft/src/main/java/net/fabricmc/loader/impl/game/minecraft/patch/EntrypointPatchFML125.java index c0d62cc76..bed7cfeac 100644 --- a/minecraft/src/main/java/net/fabricmc/loader/impl/game/minecraft/patch/EntrypointPatchFML125.java +++ b/minecraft/src/main/java/net/fabricmc/loader/impl/game/minecraft/patch/EntrypointPatchFML125.java @@ -16,6 +16,8 @@ package net.fabricmc.loader.impl.game.minecraft.patch; +import java.io.IOException; +import java.io.InputStream; import java.util.function.Consumer; import java.util.function.Function; @@ -27,6 +29,7 @@ import net.fabricmc.loader.impl.game.patch.GamePatch; import net.fabricmc.loader.impl.launch.FabricLauncher; import net.fabricmc.loader.impl.launch.knot.Knot; +import net.fabricmc.loader.impl.util.LoaderUtil; import net.fabricmc.loader.impl.util.log.Log; import net.fabricmc.loader.impl.util.log.LogCategory; @@ -46,7 +49,20 @@ public void process(FabricLauncher launcher, Function class Log.debug(LogCategory.GAME_PATCH, "Detected 1.2.5 FML - Knotifying ModClassLoader..."); - ClassNode patchedClassLoader = readClass(classSource.apply(FROM)); + // ModClassLoader_125_FML isn't in the game's class path, so it's loaded from the launcher's class path instead + ClassNode patchedClassLoader = new ClassNode(); + + try (InputStream stream = launcher.getResourceAsStream(LoaderUtil.getClassFileName(FROM))) { + if (stream != null) { + ClassReader patchedClassLoaderReader = new ClassReader(stream); + patchedClassLoaderReader.accept(patchedClassLoader, 0); + } else { + throw new IOException("Could not find class " + FROM + " in the launcher classpath while transforming ModClassLoader"); + } + } catch (IOException e) { + throw new RuntimeException("An error occurred while reading class " + FROM + " while transforming ModClassLoader", e); + } + ClassNode remappedClassLoader = new ClassNode(); patchedClassLoader.accept(new ClassRemapper(remappedClassLoader, new Remapper() {