mirror of
https://github.com/packwiz/packwiz.git
synced 2025-10-14 15:04:32 +02:00
Mod metadata retrieval
This commit is contained in:
10
core/pack.go
10
core/pack.go
@@ -2,6 +2,7 @@ package core
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -89,3 +90,12 @@ func (pack Pack) Write() error {
|
||||
return enc.Encode(pack)
|
||||
}
|
||||
|
||||
// GetMCVersion gets the version of Minecraft this pack uses, if it has been correctly specified
|
||||
func (pack Pack) GetMCVersion() (string, error) {
|
||||
mcVersion, ok := pack.Versions["minecraft"]
|
||||
if !ok {
|
||||
return "", errors.New("No Minecraft version specified in modpack!")
|
||||
}
|
||||
return mcVersion, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user