summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading
diff options
context:
space:
mode:
authorMichał Dolaś <me@shockah.pl>2022-11-09 20:26:50 +0100
committerMichał Dolaś <me@shockah.pl>2022-11-09 20:26:50 +0100
commit9fd8c35b462bc19efb520da21cda66f83559a66e (patch)
tree2afea790f6ce94df2e01cad9f73058c90128b3b8 /src/SMAPI/Framework/ModLoading
parent42b4b6b6a4ae1bb59182857b383539b24b063215 (diff)
downloadSMAPI-9fd8c35b462bc19efb520da21cda66f83559a66e.tar.gz
SMAPI-9fd8c35b462bc19efb520da21cda66f83559a66e.tar.bz2
SMAPI-9fd8c35b462bc19efb520da21cda66f83559a66e.zip
Actually taking order into consideration
Diffstat (limited to 'src/SMAPI/Framework/ModLoading')
-rw-r--r--src/SMAPI/Framework/ModLoading/ModResolver.cs14
1 files changed, 12 insertions, 2 deletions
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<IModMetadata> orderSortedMods = new();