You've already forked AstralRinth
forked from didirus/AstralRinth
Fix dependency installation not respecting mod loader (#4751)
* Fix dependency installation not respecting mod loader * fix
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user