diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index f9ba73c4..8ef5e4a8 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -263,8 +263,18 @@ namespace StardewModdingAPI.Framework.ModLoading // sort mods IModMetadata[] allMods = mods.ToArray(); - IModMetadata[] modsToLoadEarly = allMods.Where(m => modIdsToLoadEarly.Contains(m.Manifest.UniqueID) && !modIdsToLoadLate.Contains(m.Manifest.UniqueID)).ToArray(); - IModMetadata[] modsToLoadLate = allMods.Where(m => modIdsToLoadLate.Contains(m.Manifest.UniqueID) && !modIdsToLoadEarly.Contains(m.Manifest.UniqueID)).ToArray(); + IModMetadata[] modsToLoadEarly = modIdsToLoadEarly + .Where(modId => !modIdsToLoadLate.Contains(modId)) + .Select(modId => allMods.FirstOrDefault(m => m.Manifest.UniqueID == modId)) + .Where(m => m != null) + .Select(m => m!) + .ToArray(); + IModMetadata[] modsToLoadLate = modIdsToLoadLate + .Where(modId => !modIdsToLoadEarly.Contains(modId)) + .Select(modId => allMods.FirstOrDefault(m => m.Manifest.UniqueID == modId)) + .Where(m => m != null) + .Select(m => m!) + .ToArray(); IModMetadata[] modsToLoadAsUsual = allMods.Where(m => !modsToLoadEarly.Contains(m) && !modsToLoadLate.Contains(m)).ToArray(); List orderSortedMods = new(); diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index 9e91924e..4d1eb959 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -426,10 +426,10 @@ namespace StardewModdingAPI.Framework // warn about mods that should load early or late which are not found at all, or both foreach (string modId in this.Settings.ModsToLoadEarly) if (!mods.Any(m => m.Manifest.UniqueID == modId)) - this.Monitor.Log($" SMAPI configuration specifies a mod {modId} that should load early, but it could not be found.", LogLevel.Warn); + this.Monitor.Log($" SMAPI configuration specifies a mod {modId} that should load early, but it could not be found or was skipped.", LogLevel.Warn); foreach (string modId in this.Settings.ModsToLoadLate) if (!mods.Any(m => m.Manifest.UniqueID == modId)) - this.Monitor.Log($" SMAPI configuration specifies a mod {modId} that should load late, but it could not be found.", LogLevel.Warn); + this.Monitor.Log($" SMAPI configuration specifies a mod {modId} that should load late, but it could not be found or was skipped.", LogLevel.Warn); foreach (string modId in this.Settings.ModsToLoadEarly) if (this.Settings.ModsToLoadLate.Contains(modId)) this.Monitor.Log($" SMAPI configuration specifies a mod {modId} that should load both early and late - this will be ignored.", LogLevel.Warn);