From 65688cf2b113702a97539f9dafe6bae26eac2519 Mon Sep 17 00:00:00 2001 From: comp500 Date: Wed, 8 Jun 2022 22:39:15 +0100 Subject: [PATCH] Prefer Quilt mods to Fabric mods when using Quilt (Modrinth-only) --- modrinth/modrinth.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modrinth/modrinth.go b/modrinth/modrinth.go index f1a7712..6ac55d1 100644 --- a/modrinth/modrinth.go +++ b/modrinth/modrinth.go @@ -4,6 +4,7 @@ import ( "encoding/json" "errors" "github.com/spf13/viper" + "golang.org/x/exp/slices" "io/ioutil" "net/http" "net/url" @@ -223,6 +224,12 @@ func getLatestVersion(modID string, pack core.Pack) (Version, error) { } if semverCompare == 0 { + // Prefer Quilt over Fabric (Modrinth backend handles filtering) + if slices.Contains(v.Loaders, "quilt") && !slices.Contains(latestValidVersion.Loaders, "quilt") { + latestValidVersion = v + continue + } + //Semver is equal, compare date instead vDate, _ := time.Parse(time.RFC3339Nano, v.DatePublished) latestDate, _ := time.Parse(time.RFC3339Nano, latestValidVersion.DatePublished)