Fix problem where the absence of forge and MC in later loading triggered a weird crash.

Signed-off-by: cpw <>
This commit is contained in:
cpw 2020-11-15 11:08:34 -05:00
parent 0c5ced1bbf
commit 49b596dda3
No known key found for this signature in database
GPG Key ID: 8EB3DF749553B1B7
1 changed files with 8 additions and 2 deletions

View File

@ -50,6 +50,7 @@ public class ModSorter
private List<ModFile> modFiles;
private List<ModInfo> sortedList;
private Map<String, ModInfo> modIdNameLookup;
private List<ModFile> forgeAndMC;
private ModSorter(final List<ModFile> modFiles)
@ -63,7 +64,7 @@ public class ModSorter
} catch (EarlyLoadingException e) {
// We cannot build any list with duped mods. We have to abort immediately and report it
return LoadingModList.of(Collections.emptyList(), Collections.emptyList(), e);
return LoadingModList.of(ms.forgeAndMC,>(ModInfo)mf.getModInfos().get(0)).collect(Collectors.toList()), e);
// try and locate languages and validate dependencies
List<EarlyLoadingException.ExceptionData> missingLangs = ms.findLanguages();
@ -71,7 +72,7 @@ public class ModSorter
final List<ExceptionData> failedList = Stream.concat(,;
// if we miss one or the other, we abort now
if (!failedList.isEmpty()) {
return LoadingModList.of(Collections.emptyList(), Collections.emptyList(), new EarlyLoadingException("failure to validate mod list", null, failedList));
return LoadingModList.of(ms.forgeAndMC,>(ModInfo)mf.getModInfos().get(0)).collect(Collectors.toList()), new EarlyLoadingException("failure to validate mod list", null, failedList));
} else {
// Otherwise, lets try and sort the modlist and proceed
EarlyLoadingException earlyLoadingException = null;
@ -181,6 +182,11 @@ public class ModSorter
.collect(Collectors.groupingBy(mf -> mf.getModInfos().get(0).getModId()));
// Capture forge and MC here, so we can keep them for later
forgeAndMC = new ArrayList<>();
// Select the newest by artifact version sorting of non-unique files thus identified
this.modFiles = modFilesByFirstId.entrySet().stream()