diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/AbstractModProvider.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/AbstractModProvider.java index 9007eafc58..5ff89b3a94 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/AbstractModProvider.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/AbstractModProvider.java @@ -42,6 +42,11 @@ public abstract class AbstractModProvider implements IModProvider { @Nullable protected IModLocator.ModFileOrException createMod(Path path, boolean ignoreUnknown) { + return createMod(path, false, getDefaultJarModType()); + } + + @Nullable + protected IModLocator.ModFileOrException createMod(Path path, boolean ignoreUnknown, String defaultType) { var mjm = new ModJarMetadata(); var sj = SecureJar.from( jar -> jar.moduleDataProvider().findFile(MODS_TOML).isPresent() ? mjm : JarMetadata.from(jar, path), @@ -51,7 +56,7 @@ public abstract class AbstractModProvider implements IModProvider { IModFile mod; var type = sj.moduleDataProvider().getManifest().getMainAttributes().getValue(ModFile.TYPE); if (type == null) - type = getDefaultJarModType(); + type = defaultType; if (sj.moduleDataProvider().findFile(MODS_TOML).isPresent()) { LOGGER.debug(LogMarkers.SCAN, "Found {} mod of type {}: {}", MODS_TOML, type, path); diff --git a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/JarInJarDependencyLocator.java b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/JarInJarDependencyLocator.java index 38516007cd..fb73e9677e 100644 --- a/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/JarInJarDependencyLocator.java +++ b/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/JarInJarDependencyLocator.java @@ -83,7 +83,14 @@ public class JarInJarDependencyLocator extends AbstractModProvider implements ID final Map outerFsArgs = ImmutableMap.of("packagePath", pathInModFile); final FileSystem zipFS = FileSystems.newFileSystem(filePathUri, outerFsArgs); final Path pathInFS = zipFS.getPath("/"); - return Optional.of(createMod(pathInFS).file()); + final IModFile.Type parentType = file.getType(); + final String modType; + if (parentType == IModFile.Type.LIBRARY || parentType == IModFile.Type.LANGPROVIDER) { + modType = IModFile.Type.LIBRARY.name(); + } else { + modType = IModFile.Type.GAMELIBRARY.name(); + } + return Optional.of(createMod(pathInFS, false, modType).file()); } catch (Exception e) { LOGGER.error("Failed to load mod file {} from {}", path, file.getFileName()); final RuntimeException exception = new ModFileLoadingException("Failed to load mod file " + file.getFileName());