meta

package
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VersionManifestURL    = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json"
	JavaRuntimesURL       = "https://piston-meta.mojang.com/v1/products/java-runtime/2ec0cc96c44e5a76b9c8b7c39df7210883d12871/all.json"
	MinecraftResourcesURL = "https://resources.download.minecraft.net"
	MinecraftLibrariesURL = "https://libraries.minecraft.net"
)
View Source
const MavenRepoURL = "https://repo.maven.apache.org/maven2"

Variables

View Source
var ErrJavaBadSystem = errors.New("system is unsupported")
View Source
var ErrJavaNoVersion = errors.New("required version unavailable for this system")
View Source
var Fabric = fabricAPI{
	// contains filtered or unexported fields
}
View Source
var Forge = forge{
	// contains filtered or unexported fields
}
View Source
var Neoforge = forge{
	// contains filtered or unexported fields
}
View Source
var Quilt = fabricAPI{
	// contains filtered or unexported fields
}

Functions

func FetchForgePromotions added in v1.3.0

func FetchForgePromotions() (*orderedmap.OrderedMap, error)

FetchForgePromotions retrieves a map of Minecraft versions to their respective recommended Forge versions.

func FetchForgeVersion added in v1.1.0

func FetchForgeVersion(gameVersion string) (string, error)

FetchForgeVersion retrieves the best Forge loader version for the specified game version.

func FetchNeoforgeVersion added in v1.1.0

func FetchNeoforgeVersion(gameVersion string) (string, error)

FetchNeoforgeVersion retrieves the best NeoForge loader version for the specified game version.

Types

type Artifact

type Artifact struct {
	Path string `json:"path"`
	Sha1 string `json:"sha1"`
	Size int    `json:"size"`
	URL  string `json:"url"`
}

An Artifact represents a library JAR file that can be downloaded

func (Artifact) DownloadEntry added in v1.1.0

func (artifact Artifact) DownloadEntry() network.DownloadEntry

func (Artifact) IsDownloaded added in v1.1.0

func (artifact Artifact) IsDownloaded() bool

func (Artifact) RuntimePath added in v1.1.0

func (artifact Artifact) RuntimePath() string

type AssetIndex

type AssetIndex struct {
	Objects map[string]struct {
		Hash string `json:"hash"`
		Size int    `json:"size"`
	} `json:"objects"`
}

An AssetIndex contains a map of asset objects and their names.

func DownloadAssetIndex added in v1.1.0

func DownloadAssetIndex(versionMeta VersionMeta) (AssetIndex, error)

DownloadAssetIndex retrieves the asset index for the specified version.

func (AssetIndex) DownloadEntries added in v1.2.0

func (index AssetIndex) DownloadEntries() (entries []network.DownloadEntry)

DownloadEntries returns a list of download entries to any undownloaded assets in the index.

type FabricVersionList

type FabricVersionList []struct {
	Separator string `json:"separator"`
	Build     int    `json:"build"`
	Maven     string `json:"maven"`
	Version   string `json:"version"`
	Stable    bool   `json:"stable"`
}

A FabricVersionList is a list of all Fabric loader versions.

type ForgeInstallProfile added in v1.1.0

type ForgeInstallProfile struct {
	Spec        int    `json:"spec"`
	Profile     string `json:"profile"`
	Version     string `json:"version"`
	Minecraft   string `json:"minecraft"`
	JSON        string `json:"json"`
	Welcome     string `json:"welcome"`
	MirrorList  string `json:"mirrorList"`
	HideExtract bool   `json:"hideExtract"`
	Data        map[string]struct {
		Client string `json:"client"`
		Server string `json:"server"`
	} `json:"data"`
	Processors []processor `json:"processors"`
	Libraries  []Library   `json:"libraries"`
}

A ForgeInstallProfile contains install libraries and processors used to initialize Forge.

type ForgeProcessor added in v1.1.0

type ForgeProcessor struct {
	JavaArgs []string
}

A ForgeProcessor contains the finished JVM arguments to start a Forge post processor.

type JavaManifest added in v1.2.0

type JavaManifest struct {
	Files map[string]struct {
		Type       string `json:"type"`
		Executable bool   `json:"executable"`
		Target     string `json:"target"`
		Downloads  struct {
			LZMA struct {
				Sha1 string `json:"sha1"`
				Size int    `json:"size"`
				URL  string `json:"url"`
			} `json:"lzma"`
			Raw struct {
				Sha1 string `json:"sha1"`
				Size int    `json:"size"`
				URL  string `json:"url"`
			} `json:"raw"`
		} `json:"downloads"`
	} `json:"files"`
}

func FetchJavaManifest added in v1.2.0

func FetchJavaManifest(name string) (JavaManifest, error)

FetchJavaManifest retrieves the manifest for the specified Mojang-provided Java runtime.

It contains information, among other things, about what files to install for the runtime.

func (JavaManifest) DownloadEntries added in v1.2.0

func (manifest JavaManifest) DownloadEntries(runtimeName string) (entries []network.DownloadEntry, symlinks map[string]string)

type JavaManifestList added in v1.2.0

type JavaManifestList map[string]map[string][]struct {
	Availability struct {
		Group    int `json:"group"`
		Progress int `json:"progress"`
	} `json:"availability"`
	Manifest struct {
		Sha1 string `json:"sha1"`
		Size int    `json:"size"`
		URL  string `json:"url"`
	} `json:"manifest"`
	Version struct {
		Name     string    `json:"name"`
		Released time.Time `json:"released"`
	} `json:"version"`
}

func FetchJavaManifestList added in v1.2.0

func FetchJavaManifestList() (JavaManifestList, error)

FetchJavaManifestList retrieves the list of Mojang-provided Java runtimes.

type Library

type Library struct {
	Artifact        Artifact
	Natives         []Library
	Specifier       LibrarySpecifier
	ShouldInstall   bool
	SkipOnClasspath bool
}

A Library represents metadata of a game library and its artifact(s).

func FetchMavenLibrary added in v1.1.0

func FetchMavenLibrary(specifier LibrarySpecifier) (Library, error)

FetchMavenLibrary returns library metadata for the specified name and path in the Maven repository.

func (*Library) UnmarshalJSON added in v1.1.0

func (l *Library) UnmarshalJSON(b []byte) error

type LibrarySpecifier added in v1.1.0

type LibrarySpecifier struct {
	Group      string
	Artifact   string
	Version    string
	Classifier string
}

A LibrarySpecifier represents the Maven specifier syntax.

group:artifact:version:classifier

func NewLibrarySpecifier added in v1.1.0

func NewLibrarySpecifier(s string) (LibrarySpecifier, error)

NewLibrarySpecifier creates a new LibrarySpecifier from its string form.

func (LibrarySpecifier) MarshalJSON added in v1.1.0

func (specifier LibrarySpecifier) MarshalJSON() ([]byte, error)

func (LibrarySpecifier) Path added in v1.1.0

func (specifier LibrarySpecifier) Path() string

Path returns the relative path to the JAR file described by the specifier.

func (LibrarySpecifier) String added in v1.1.0

func (specifier LibrarySpecifier) String() string

String returns the string form of the specifier.

It is formatted as: group:artifact:version:classifier

func (*LibrarySpecifier) UnmarshalJSON added in v1.1.0

func (specifier *LibrarySpecifier) UnmarshalJSON(b []byte) error

type Loader added in v1.6.1

type Loader string

Loader represents a game mod loader.

const (
	LoaderVanilla  Loader = "vanilla"
	LoaderFabric   Loader = "fabric"
	LoaderQuilt    Loader = "quilt"
	LoaderNeoForge Loader = "neoforge"
	LoaderForge    Loader = "forge"
)

type VersionManifest

type VersionManifest struct {
	Latest struct {
		Release  string `json:"release"`
		Snapshot string `json:"snapshot"`
	} `json:"latest"`
	Versions []struct {
		ID              string    `json:"id"`
		Type            string    `json:"type"`
		URL             string    `json:"url"`
		Time            time.Time `json:"time"`
		ReleaseTime     time.Time `json:"releaseTime"`
		Sha1            string    `json:"sha1"`
		ComplianceLevel int       `json:"complianceLevel"`
	} `json:"versions"`
}

A VersionManifest is a list of all Minecraft versions.

func FetchVersionManifest added in v1.1.0

func FetchVersionManifest() (VersionManifest, error)

FetchVersionManifest retrieves the Mojang version manifest which lists all game versions.

type VersionMeta

type VersionMeta struct {
	Arguments struct {
		Game []any `json:"game"`
		Jvm  []any `json:"jvm"`
	} `json:"arguments"`
	AssetIndex struct {
		ID        string `json:"id"`
		Sha1      string `json:"sha1"`
		Size      int    `json:"size"`
		TotalSize int    `json:"totalSize"`
		URL       string `json:"url"`
	} `json:"assetIndex"`
	Assets          string `json:"assets"`
	ComplianceLevel int    `json:"complianceLevel"`
	Downloads       struct {
		Client struct {
			Sha1 string `json:"sha1"`
			Size int    `json:"size"`
			URL  string `json:"url"`
		} `json:"client"`
		ClientMappings struct {
			Sha1 string `json:"sha1"`
			Size int    `json:"size"`
			URL  string `json:"url"`
		} `json:"client_mappings"`
		Server struct {
			Sha1 string `json:"sha1"`
			Size int    `json:"size"`
			URL  string `json:"url"`
		} `json:"server"`
		ServerMappings struct {
			Sha1 string `json:"sha1"`
			Size int    `json:"size"`
			URL  string `json:"url"`
		} `json:"server_mappings"`
	} `json:"downloads"`
	ID          string `json:"id"`
	LoaderID    string `json:"-"`
	JavaVersion struct {
		Component    string `json:"component"`
		MajorVersion int    `json:"majorVersion"`
	} `json:"javaVersion"`
	Libraries []Library `json:"libraries"`
	Logging   struct {
		Client struct {
			Argument string `json:"argument"`
			File     struct {
				ID   string `json:"id"`
				Sha1 string `json:"sha1"`
				Size int    `json:"size"`
				URL  string `json:"url"`
			} `json:"file"`
			Type string `json:"type"`
		} `json:"client"`
	} `json:"logging"`
	MainClass              string `json:"mainClass"`
	MinimumLauncherVersion int    `json:"minimumLauncherVersion"`
	ReleaseTime            string `json:"releaseTime"`
	Time                   string `json:"time"`
	Type                   string `json:"type"`
}

A VersionMeta is metadata of the libraries, assets, and other data needed to start a Minecraft version.

func FetchAllVersionMeta added in v1.6.1

func FetchAllVersionMeta(loader Loader, gameVersion string, loaderVersion string) (VersionMeta, error)

FetchAllVersionMeta returns a VersionMeta containing both information for the base game, and specified mod loader.

func FetchVersionMeta added in v1.1.0

func FetchVersionMeta(id string) (VersionMeta, error)

FetchVersionMeta retrieves the version metadata for a specified version from the version manifest.

Besides normal version identifiers, "release" and "snapshot" are also accepted IDs.

func MergeVersionMeta added in v1.1.0

func MergeVersionMeta(v, w VersionMeta) VersionMeta

MergeVersionMeta takes two instances of VersionMeta and merges w into v

func (VersionMeta) Client added in v1.1.0

func (versionMeta VersionMeta) Client() Library

Client creates a library from the client JAR download of versionMeta.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL