From a1f9c1c610c958d2ddedefbaed74912b300d41b9 Mon Sep 17 00:00:00 2001 From: Player Date: Thu, 14 Nov 2024 22:26:21 -0500 Subject: [PATCH] Fix mod jars without manifest crashing in-dev. Fixes #999 --- .../loader/impl/discovery/RuntimeModRemapper.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/fabricmc/loader/impl/discovery/RuntimeModRemapper.java b/src/main/java/net/fabricmc/loader/impl/discovery/RuntimeModRemapper.java index 66e76cfac..2d294b016 100644 --- a/src/main/java/net/fabricmc/loader/impl/discovery/RuntimeModRemapper.java +++ b/src/main/java/net/fabricmc/loader/impl/discovery/RuntimeModRemapper.java @@ -125,8 +125,7 @@ public static void remap(Collection modCandidates, Path tmpDir .renameInvalidLocals(false) .extension(new MixinExtension(remapMixins::contains)) .extraAnalyzeVisitor((mrjVersion, className, next) -> - AccessWidenerClassVisitor.createClassVisitor(FabricLoaderImpl.ASM_VERSION, next, mergedAccessWidener) - ) + AccessWidenerClassVisitor.createClassVisitor(FabricLoaderImpl.ASM_VERSION, next, mergedAccessWidener)) .build(); try { @@ -245,8 +244,15 @@ private static List getRemapClasspath() throws IOException { .collect(Collectors.toList()); } + /** + * Determine whether a jar requires Mixin remapping with tiny remapper. + * + *

This is typically the case when a mod was built without the Mixin annotation processor generating refmaps. + */ private static boolean requiresMixinRemap(Path inputPath) throws IOException, URISyntaxException { final Manifest manifest = ManifestUtil.readManifest(inputPath); + if (manifest == null) return false; + final Attributes mainAttributes = manifest.getMainAttributes(); return REMAP_TYPE_STATIC.equalsIgnoreCase(mainAttributes.getValue(REMAP_TYPE_MANIFEST_KEY));