From 801adda4bce19cbd0aaf1429d50029576ecf90ca Mon Sep 17 00:00:00 2001 From: LlamaLad7 Date: Wed, 23 Oct 2024 13:33:36 +0100 Subject: [PATCH] Fix: Disambiguate libraries by their module name. --- .../moddiscovery/locators/JarInJarDependencyLocator.java | 6 +++++- .../moddiscovery/readers/JarModsDotTomlModFileReader.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) 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..e70bd25c6 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,13 @@ 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()) { + return 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;