diff --git a/loader/src/main/java/net/neoforged/fml/loading/ModSorter.java b/loader/src/main/java/net/neoforged/fml/loading/ModSorter.java index b02e767a9..142cb47c1 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/ModSorter.java +++ b/loader/src/main/java/net/neoforged/fml/loading/ModSorter.java @@ -319,8 +319,10 @@ private static String formatIncompatibleDependencyError(IModInfo.ModVersion depe modVersions.get(dependency.getModId()).toString()); } - private boolean modVersionNotContained(final IModInfo.ModVersion mv, final Map modVersions) { - return !(VersionSupportMatrix.testVersionSupportMatrix(mv.getVersionRange(), mv.getModId(), "mod", (modId, range) -> modVersions.containsKey(modId) && - (range.containsVersion(modVersions.get(modId)) || modVersions.get(modId).toString().equals("0.0NONE")))); + private boolean modVersionNotContained(IModInfo.ModVersion mv, Map modVersions) { + return !(VersionSupportMatrix.testVersionSupportMatrix(mv.getVersionRange(), mv.getModId(), "mod", (modId, range) -> { + return modVersions.containsKey(modId) && + (range.containsVersion(modVersions.get(modId)) || modVersions.get(modId).toString().equals("0.0NONE")); + })); } } diff --git a/loader/src/main/java/net/neoforged/fml/loading/VersionSupportMatrix.java b/loader/src/main/java/net/neoforged/fml/loading/VersionSupportMatrix.java index 7d2050f90..99ea895a9 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/VersionSupportMatrix.java +++ b/loader/src/main/java/net/neoforged/fml/loading/VersionSupportMatrix.java @@ -18,11 +18,11 @@ public class VersionSupportMatrix { private static final HashMap> overrideVersions = new HashMap<>(); static { final ArtifactVersion version = new DefaultArtifactVersion(FMLLoader.versionInfo().mcVersion()); - if (MavenVersionAdapter.createFromVersionSpec("[1.19.2]").containsVersion(version)) { - // 1.19.2 is Compatible with 1.19.1 - add("languageloader.javafml", "42"); - add("mod.minecraft", "1.19.1"); - add("mod.forge", "42.0.9"); + // If the MC version is 1.21.1 and any default version constraint fails, + // we'll also pass the version check if the versions below match + if (MavenVersionAdapter.createFromVersionSpec("[1.21.1]").containsVersion(version)) { + add("mod.minecraft", "1.21"); + add("mod.neoforge", "21.0.166"); } } @@ -30,9 +30,11 @@ private static void add(String key, String value) { overrideVersions.computeIfAbsent(key, k -> new ArrayList<>()).add(new DefaultArtifactVersion(value)); } - public static boolean testVersionSupportMatrix(VersionRange declaredRange, String lookupId, String type, BiPredicate standardLookup) { - if (standardLookup.test(lookupId, declaredRange)) return true; - List custom = overrideVersions.get(type + "." + lookupId); - return custom == null ? false : custom.stream().anyMatch(declaredRange::containsVersion); + public static boolean testVersionSupportMatrix(VersionRange declaredRange, String lookupId, String type, BiPredicate standardLookup) { + if (standardLookup.test(lookupId, declaredRange)) { + return true; + } + var custom = overrideVersions.get(type + "." + lookupId); + return custom != null && custom.stream().anyMatch(declaredRange::containsVersion); } }