Clean up code, filter version numbers for NeoForge as well as Forge

NeoForge doesn't seem to have an update checker JSON yet, so we can't determine
the recommended version
This commit is contained in:
comp500
2023-07-30 15:09:18 +01:00
parent 234f927be9
commit 4c23e264b0
7 changed files with 29 additions and 23 deletions

View File

@@ -24,17 +24,7 @@ var loaderCommand = &cobra.Command{
fmt.Printf("Error loading pack: %s\n", err)
os.Exit(1)
}
// Get our current loader, would use the modpack.GetLoaders function
// but, it supplements Quilt with Fabric, which isn't needed for this
var currentLoaders []string
// Add all the keys from modpack.Versions
for key := range modpack.Versions {
// If it ain't in core.ModLoaders, we don't want it
if _, ok := core.ModLoaders[key]; !ok {
continue
}
currentLoaders = append(currentLoaders, key)
}
var currentLoaders = modpack.GetLoaders()
// Do some sanity checks on the current loader slice
if len(currentLoaders) == 0 {
fmt.Println("No loader is currently set in your pack.toml!")
@@ -90,8 +80,8 @@ var loaderCommand = &cobra.Command{
fmt.Println("Updating to explicit loader version")
// This one is easy :D
versions, _, loader := getVersionsForLoader(currentLoaders[0], mcVersion)
// Check if the loader happens to be Forge, since there's two version formats
if loader.Name == "forge" {
// Check if the loader happens to be Forge/NeoForge, since there's two version formats
if loader.Name == "forge" || loader.Name == "neoforge" {
wantedVersion := cmdshared.GetRawForgeVersion(args[0])
validateVersion(versions, wantedVersion, loader)
_ = updatePackToVersion(wantedVersion, modpack, loader)