prioritize fabric/quilt.mod.json
This commit is contained in:
parent
f8a0e267b0
commit
5c2cfc7275
1 changed files with 14 additions and 3 deletions
17
main.go
17
main.go
|
@ -56,6 +56,12 @@ func main() {
|
||||||
|
|
||||||
// for modjars,
|
// for modjars,
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
|
// filter out non-jars
|
||||||
|
if !strings.HasSuffix(file.Name(), ".jar") {
|
||||||
|
log.Println("[SKIP]", file.Name())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// read the mod.json file and return the name, version, and filename
|
// read the mod.json file and return the name, version, and filename
|
||||||
name, version, loader := readMod("./mods/" + file.Name())
|
name, version, loader := readMod("./mods/" + file.Name())
|
||||||
name = cleanPattern.ReplaceAllString(name, "")
|
name = cleanPattern.ReplaceAllString(name, "")
|
||||||
|
@ -136,7 +142,9 @@ func readMod(filename string) (string, string, string) {
|
||||||
log.Println("[DECODE ERROR]", filename)
|
log.Println("[DECODE ERROR]", filename)
|
||||||
log.Fatalln("[DECODE FORGE MOD]", forgeTomlErr)
|
log.Fatalln("[DECODE FORGE MOD]", forgeTomlErr)
|
||||||
}
|
}
|
||||||
break
|
// NOTICE: We don't break here because we want to check if there is a fabric/quilt mod.json,
|
||||||
|
// if there is, then we will use that instead of the forge mod.toml due to inconsistencies
|
||||||
|
// between the forge mod.tomls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,8 +157,11 @@ func readMod(filename string) (string, string, string) {
|
||||||
return quiltJson.QuiltLoader.Metadata.Name, quiltJson.QuiltLoader.Version, loader
|
return quiltJson.QuiltLoader.Metadata.Name, quiltJson.QuiltLoader.Version, loader
|
||||||
}
|
}
|
||||||
if loader == "forge" {
|
if loader == "forge" {
|
||||||
forgeMods = append(forgeMods, forgeMod)
|
if len(forgeMod.Mods) != 0 {
|
||||||
return forgeMod.Mods[0].DisplayName, forgeMod.Mods[0].Version, loader
|
forgeMods = append(forgeMods, forgeMod)
|
||||||
|
log.Println("Forge Mod", filename)
|
||||||
|
return forgeMod.Mods[0].DisplayName, forgeMod.Mods[0].Version, loader
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return "", "", ""
|
return "", "", ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue