vanilla

package
v0.0.0-...-bfe662d Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MANIFEST_URL = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json"
)

Variables

This section is empty.

Functions

func FetchAsset

func FetchAsset(ctx context.Context, hc *http.Client, asset Asset) (io.ReadCloser, error)

Types

type Asset

type Asset struct {
	Hash string `json:"hash"`
	Size int    `json:"size"`
}

type Assets

type Assets struct {
	Objects map[string]Asset `json:"objects"`
}

func FetchAssets

func FetchAssets(ctx context.Context, hc *http.Client, url string, sha1 string) (*Assets, error)

func (*Assets) Merge

func (assets *Assets) Merge(launch *metadata.Launch)

type Manifest

type Manifest struct {
	Latest   ManifestLatest    `json:"latest"`
	Versions []ManifestVersion `json:"versions"`
}

func FetchManifest

func FetchManifest(ctx context.Context, hc *http.Client) (*Manifest, error)

func (*Manifest) GetLatestRelease

func (m *Manifest) GetLatestRelease() (*ManifestVersion, bool)

func (*Manifest) GetVersion

func (manifest *Manifest) GetVersion(id string) (*ManifestVersion, bool)

type ManifestLatest

type ManifestLatest struct {
	Release  string `json:"release"`
	Snapshot string `json:"snapshot"`
}

type ManifestVersion

type ManifestVersion 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"`
}

type Version

type Version struct {
	Arguments              *VersionArguments          `json:"arguments"`
	AssetIndex             VersionAssetIndex          `json:"assetIndex"`
	Assets                 string                     `json:"assets"`
	ComplianceLevel        int                        `json:"complianceLevel"`
	Downloads              map[string]VersionDownload `json:"downloads"`
	Id                     string                     `json:"id"`
	JavaVersion            *VersionJavaVersion        `json:"javaVersion"`
	Libraries              []VersionLibrary           `json:"libraries"`
	Logging                map[string]VersionLogging  `json:"logging"`
	MainClass              string                     `json:"mainClass"`
	MinecraftArguments     *string                    `json:"minecraftArguments"` // legacy
	MinimumLauncherVersion int                        `json:"minimumLauncherVersion"`
	ReleaseTime            time.Time                  `json:"releaseTime"`
	Time                   time.Time                  `json:"time"`
	Type                   string                     `json:"type"`
}

func FetchVersion

func FetchVersion(ctx context.Context, hc *http.Client, url string) (*Version, error)

func (*Version) Merge

func (v *Version) Merge(launch *metadata.Launch)

type VersionArgument

type VersionArgument struct {
	Rules []VersionRule        `json:"rules"`
	Value VersionArgumentValue `json:"value"`
}

func (*VersionArgument) IsEnabled

func (arg *VersionArgument) IsEnabled(goos string, features []string) bool

func (*VersionArgument) UnmarshalJSON

func (arg *VersionArgument) UnmarshalJSON(data []byte) error

type VersionArgumentValue

type VersionArgumentValue []string

func (*VersionArgumentValue) UnmarshalJSON

func (value *VersionArgumentValue) UnmarshalJSON(data []byte) error

type VersionArguments

type VersionArguments struct {
	Game []VersionArgument `json:"game"`
	Jvm  []VersionArgument `json:"jvm"`
}

type VersionAssetIndex

type VersionAssetIndex struct {
	Id        string `json:"id"`
	Sha1      string `json:"sha1"`
	Size      int    `json:"size"`
	TotalSize int    `json:"totalSize"`
	Url       string `json:"url"`
}

type VersionDownload

type VersionDownload struct {
	Sha1 string `json:"sha1"`
	Size int    `json:"size"`
	Url  string `json:"url"`
}

type VersionJavaVersion

type VersionJavaVersion struct {
	Component    string `json:"component"`
	MajorVersion int    `json:"majorVersion"`
}

type VersionLibrary

type VersionLibrary struct {
	Downloads VersionLibraryDownloads `json:"downloads"`
	Extract   *VersionLibraryExtract  `json:"extract"` // legacy
	Name      string                  `json:"name"`
	Natives   map[string]string       `json:"natives"` // legacy
	Rules     []VersionRule           `json:"rules"`
}

func (*VersionLibrary) IsEnabled

func (library *VersionLibrary) IsEnabled(goos string, features []string) bool

type VersionLibraryDownload

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

type VersionLibraryDownloads

type VersionLibraryDownloads struct {
	Artifact    *VersionLibraryDownload           `json:"artifact"`
	Classifiers map[string]VersionLibraryDownload `json:"classifiers"`
}

type VersionLibraryExtract

type VersionLibraryExtract struct {
	Exclude []string `json:"exclude"`
}

type VersionLogging

type VersionLogging struct {
	Argument string             `json:"argument"`
	File     VersionLoggingFile `json:"file"`
	Type     string             `json:"type"`
}

type VersionLoggingFile

type VersionLoggingFile struct {
	Id   string `json:"id"`
	Sha1 string `json:"sha1"`
	Size int    `json:"size"`
	Url  string `json:"url"`
}

type VersionRule

type VersionRule struct {
	Action   string          `json:"action"`
	OS       *VersionRuleOS  `json:"os"`
	Features map[string]bool `json:"features"`
}

func (*VersionRule) MatchesRuntime

func (rule *VersionRule) MatchesRuntime(goos string, features []string) bool

type VersionRuleOS

type VersionRuleOS struct {
	Name    string `json:"name"`
	Arch    string `json:"arch"`
	Version string `json:"version"` // regex
}

func (*VersionRuleOS) MatchesRuntime

func (os *VersionRuleOS) MatchesRuntime(goos string) bool

Jump to

Keyboard shortcuts

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