Prefer game versions according to acceptable versions list (fixes #181)

The acceptable versions list should now be specified in order of preference, where the last version is the most preferable Minecraft version
This commit is contained in:
comp500
2023-02-14 16:10:06 +00:00
parent d667447a88
commit d38d279d98
9 changed files with 123 additions and 145 deletions

View File

@@ -142,14 +142,14 @@ func installVersionById(versionId string, versionFilename string, pack core.Pack
}
func installViaSearch(query string, versionFilename string, autoAcceptFirst bool, pack core.Pack, index *core.Index) error {
mcVersion, err := pack.GetMCVersion()
mcVersions, err := pack.GetSupportedMCVersions()
if err != nil {
return err
}
fmt.Println("Searching Modrinth...")
results, err := getProjectIdsViaSearch(query, append([]string{mcVersion}, viper.GetStringSlice("acceptable-game-versions")...))
results, err := getProjectIdsViaSearch(query, mcVersions)
if err != nil {
return err
}