1
0

Fix dependency installation not respecting mod loader (#4751)

* Fix dependency installation not respecting mod loader

* fix
This commit is contained in:
aecsocket
2025-11-10 08:48:11 -08:00
committed by GitHub
parent 98b4970680
commit 1dcb38cb57

View File

@@ -42,11 +42,24 @@ export const useInstall = defineStore('installStore', {
})
export const findPreferredVersion = (versions, project, instance) => {
// When `project` is passed in from this stack trace:
// - `installVersionDependencies`
// - `install.js/install` - `installVersionDependencies` call
//
// ..then `project` is actually a `Dependency` struct of a cached `Version`.
// `Dependency` does not have a `project_type` field,
// so we default it to `mod`.
//
// If we don't default here, then this `.find` will ignore version/instance
// loader mismatches, and you'll end up e.g. installing NeoForge mods for a
// Fabric instance.
const projectType = project.project_type ?? 'mod'
// If we can find a version using strictly the instance loader then prefer that
let version = versions.find(
(v) =>
v.game_versions.includes(instance.game_version) &&
(project.project_type === 'mod' ? v.loaders.includes(instance.loader) : true),
(projectType === 'mod' ? v.loaders.includes(instance.loader) : true),
)
if (!version) {