Merge duplicate getLoaders methods into single core method

This commit is contained in:
comp500
2022-06-08 22:34:50 +01:00
parent 72fbc68256
commit f533e677ca
4 changed files with 17 additions and 40 deletions

View File

@@ -171,7 +171,7 @@ func getLatestVersion(modID string, pack core.Pack) (Version, error) {
return Version{}, err
}
loadersEncoded, err := json.Marshal(getLoaders(pack))
loadersEncoded, err := json.Marshal(pack.GetLoaders())
if err != nil {
return Version{}, err
}
@@ -343,21 +343,3 @@ func (v VersionFile) getBestHash() (string, string) {
//No hashes were present
return "", ""
}
func getLoaders(pack core.Pack) []string {
dependencies := pack.Versions
var list []string
if _, hasQuilt := dependencies["quilt"]; hasQuilt {
list = append(list, "quilt")
list = append(list, "fabric") // Backwards-compatible; for now (could be configurable later)
} else if _, hasFabric := dependencies["fabric"]; hasFabric {
list = append(list, "fabric")
}
if _, hasForge := dependencies["forge"]; hasForge {
list = append(list, "forge")
}
return list
}