summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework/ModLoading')
-rw-r--r--src/SMAPI/Framework/ModLoading/ModResolver.cs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs
index 96975e05..cb62e16f 100644
--- a/src/SMAPI/Framework/ModLoading/ModResolver.cs
+++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs
@@ -174,14 +174,20 @@ namespace StardewModdingAPI.Framework.ModLoading
if (!modIdsToLoadEarly.Any() && !modIdsToLoadLate.Any())
return mods;
+ string[] earlyArray = modIdsToLoadEarly.ToArray();
+ string[] lateArray = modIdsToLoadLate.ToArray();
+
return mods
.OrderBy(mod =>
{
string id = mod.Manifest.UniqueID;
- if (modIdsToLoadEarly.Contains(id))
- return -1;
- if (modIdsToLoadLate.Contains(id))
- return 1;
+
+ if (modIdsToLoadEarly.TryGetValue(id, out string? actualId))
+ return -int.MaxValue + Array.IndexOf(earlyArray, actualId);
+
+ if (modIdsToLoadLate.TryGetValue(id, out actualId))
+ return int.MaxValue - Array.IndexOf(lateArray, actualId);
+
return 0;
})
.ToArray();