Documentation
¶
Index ¶
- Constants
- Variables
- func FetchForgeVersion(gameVersion string) (string, error)
- func FetchNeoforgeVersion(gameVersion string) (string, error)
- type Artifact
- type AssetIndex
- type AssetObject
- type FabricVersionList
- type ForgeInstallProfile
- type ForgeProcessor
- type Library
- type LibrarySpecifier
- type VersionManifest
- type VersionMeta
Constants ¶
const ( VERSION_MANIFEST_URL = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json" MINECRAFT_RESOURCES_URL = "https://resources.download.minecraft.net/%s/%s" MINECRAFT_LIBRARIES_URL = "https://libraries.minecraft.net" )
const MAVEN_REPO_URL = "https://repo.maven.apache.org/maven2/%s"
Variables ¶
var Fabric = fabricAPI{ // contains filtered or unexported fields }
var Forge = forge{ // contains filtered or unexported fields }
var Neoforge = forge{ // contains filtered or unexported fields }
var Quilt = fabricAPI{ // contains filtered or unexported fields }
Functions ¶
func FetchForgeVersion ¶ added in v1.1.0
FetchForgeVersion retrieves the best Forge loader version for the specified game version.
func FetchNeoforgeVersion ¶ added in v1.1.0
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) RuntimePath ¶ added in v1.1.0
type AssetIndex ¶
type AssetIndex struct {
Objects map[string]AssetObject `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.
type AssetObject ¶
An AssetObject is a reference to an game asset which can be downloaded.
func (AssetObject) DownloadEntry ¶ added in v1.1.0
func (object AssetObject) DownloadEntry() network.DownloadEntry
DownloadEntry returns a DownloadEntry to fetch the asset.
func (AssetObject) IsDownloaded ¶ added in v1.1.0
func (object AssetObject) IsDownloaded() bool
IsDownloaded reports whether the asset exists and has a valid checksum.
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"`
Logo string `json:"logo"`
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"`
}
type ForgeProcessor ¶ added in v1.1.0
type ForgeProcessor struct {
JavaArgs []string
}
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
type LibrarySpecifier ¶ added in v1.1.0
A LibrarySpecifier represents the Maven specifier syntax.
group:artifact:version:classifier
func NewLibrarySpecifier ¶ added in v1.1.0
func NewLibrarySpecifier(s string) (LibrarySpecifier, error)
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
func (LibrarySpecifier) String ¶ added in v1.1.0
func (specifier LibrarySpecifier) String() string
func (*LibrarySpecifier) UnmarshalJSON ¶ added in v1.1.0
func (specifier *LibrarySpecifier) UnmarshalJSON(b []byte) error
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 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.