diff --git a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModInfo.java b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModInfo.java index a369eec3c..f66ce7ff3 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModInfo.java +++ b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModInfo.java @@ -217,12 +217,16 @@ public ModVersion(final IModInfo owner, final IConfigurable config) { this.modId = config.getConfigElement("modId") .orElseThrow(()->new InvalidModFileException("Missing required field modid in dependency", getOwningFile())); this.type = config.getConfigElement("type") + // TODO - 1.21: remove the fallback to the mandatory field .map(str -> str.toUpperCase(Locale.ROOT)).map(DependencyType::valueOf).orElseGet(() -> { final var mandatory = config.getConfigElement("mandatory"); if (mandatory.isPresent()) { if (!FMLLoader.isProduction()) { LOGGER.error("Mod '{}' uses deprecated 'mandatory' field in the dependency declaration for '{}'. Use the 'type' field and 'required'/'optional' instead", owner.getModId(), modId); - throw new InvalidModFileException("Deprecated 'mandatory' field is used in dependency", getOwningFile()); + // only error the mod being "developed" (i.e. found through the MOD_CLASSES) to prevent dependencies from causing the crash + if (owner.getOwningFile().getFile().getProvider() instanceof MinecraftLocator) { + throw new InvalidModFileException("Deprecated 'mandatory' field is used in dependency", getOwningFile()); + } } return mandatory.get() ? DependencyType.REQUIRED : DependencyType.OPTIONAL;