Documentation
¶
Overview ¶
Package launcher provides the necessary functions to start the game.
Index ¶
- func IsInstanceExist(id string) bool
- func Launch(launchEnv launchEnvironment, runner Runner) error
- func Prepare(inst Instance, options EnvOptions, watcher EventWatcher) (launchEnvironment, error)
- func RemoveInstance(id string) error
- type AssetsResolvedEvent
- type ConsoleRunner
- type DownloadingEvent
- type EnvOptions
- type EventWatcher
- type Instance
- type InstanceConfig
- type InstanceOptions
- type LibrariesResolvedEvent
- type Loader
- type Runner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInstanceExist ¶
IsInstanceExist reports whether an instance with the specified ID exists.
func Launch ¶
Launch a launchEnvironment with the specified runner.
The Java executable is checked and the classpath and command arguments are finalized.
func Prepare ¶
func Prepare(inst Instance, options EnvOptions, watcher EventWatcher) (launchEnvironment, error)
Prepare prepares the specified instance to be launched with the provided options and sends events to watcher.
func RemoveInstance ¶
RemoveInstance removes the instance with the specified ID.
Types ¶
type AssetsResolvedEvent ¶
type AssetsResolvedEvent struct {
Assets int
}
AssetsResolvedEvent is called when all game assets have been identified and filtered.
type ConsoleRunner ¶
type ConsoleRunner struct{}
An ConsoleRunner is an implementation of Runner which logs game output to the console.
type DownloadingEvent ¶
DownloadingEvent is called when a download has progressed.
type EnvOptions ¶
type EventWatcher ¶
type EventWatcher interface {
Handle(event any)
}
An EventWatcher is a controller that handles game preparation events.
type Instance ¶
type Instance struct {
Dir string `json:"-"`
Name string `json:"-"`
GameVersion string `json:"game_version"`
Loader Loader `json:"mod_loader"`
LoaderVersion string `json:"mod_loader_version,omitempty"`
Config InstanceConfig `json:"config"`
}
An Instance represents a full installation of Minecraft and its information.
func CreateInstance ¶
func CreateInstance(options InstanceOptions) (Instance, error)
CreateInstance creates a new instance with the specified options.
func GetAllInstances ¶
GetAllInstances retrieves all valid instances within env.InstancesDir.
func GetInstance ¶
GetInstance retrieves the instance with the specified ID.
type InstanceConfig ¶
type InstanceConfig struct {
WindowResolution struct {
Width int `json:"width"`
Height int `json:"height"`
} `json:"resolution"`
Java string `json:"java"`
MinMemory int `json:"min_memory"`
MaxMemory int `json:"max_memory"`
}
InstanceConfig represents the configurable values of an Instance.
type InstanceOptions ¶
type LibrariesResolvedEvent ¶
type LibrariesResolvedEvent struct {
Libraries int
}
LibrariesResolvedEvent is created when all game libraries have been identified and filtered.