Skip to content

Commit

Permalink
Fix mod jars without manifest crashing in-dev.
Browse files Browse the repository at this point in the history
Fixes #999
  • Loading branch information
sfPlayer1 committed Nov 15, 2024
1 parent 083a4dc commit a1f9c1c
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ public static void remap(Collection<ModCandidateImpl> 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 {
Expand Down Expand Up @@ -245,8 +244,15 @@ private static List<Path> getRemapClasspath() throws IOException {
.collect(Collectors.toList());
}

/**
* Determine whether a jar requires Mixin remapping with tiny remapper.
*
* <p>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));
Expand Down

0 comments on commit a1f9c1c

Please # to comment.