diff --git a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/locators/JarInJarDependencyLocator.java b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/locators/JarInJarDependencyLocator.java index 8ad140cbf..c8ed394e8 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/locators/JarInJarDependencyLocator.java +++ b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/locators/JarInJarDependencyLocator.java @@ -109,9 +109,14 @@ private String formatError(final ModWithVersionRange modWithVersionRange) { } protected String identifyMod(final IModFile modFile) { - if (modFile.getModFileInfo() == null || modFile.getModInfos().isEmpty()) { + if (modFile.getModFileInfo() == null) { return modFile.getFileName(); } + // If this is a library, it won't have any mod IDs, so we use the module name instead. + if (modFile.getModInfos().isEmpty()) { + // Prefix to ensure this cannot collide with any true mod ID. + return "library:" + modFile.getModFileInfo().moduleName(); + } return modFile.getModInfos().stream().map(IModInfo::getModId).collect(Collectors.joining()); } diff --git a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/readers/JarModsDotTomlModFileReader.java b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/readers/JarModsDotTomlModFileReader.java index cc26d5af2..519b082e9 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/readers/JarModsDotTomlModFileReader.java +++ b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/readers/JarModsDotTomlModFileReader.java @@ -140,12 +140,12 @@ public IConfigurable getConfig() { return configurable; } - // These Should never be called as it's only called from ModJarMetadata.version and we bypass that @Override public String moduleName() { return mod.getSecureJar().name(); } + // These Should never be called as it's only called from ModJarMetadata.version and we bypass that @Override public String versionString() { return null;