launcher

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Launcher

type Launcher struct {
	// Instance is the minepkg instance to be launched
	Instance *instances.Instance

	// Patches is a list of patches to apply to the instance
	Patches []*patch.Patch

	// MinepkgVersion is the version number of minepkg
	MinepkgVersion string

	Cmd *exec.Cmd
	// ServerMode indicated if this instance should be started as a server
	ServerMode bool
	// OfflineMode indicates if this server should be started in offline mode
	OfflineMode bool

	// ForceUpdate will force a full dependency resolve if set to true
	ForceUpdate bool

	// LaunchManifest is a minecraft launcher manifest. it should be set after
	// calling `Prepare`
	LaunchManifest *minecraft.LaunchManifest

	// NonInteractive determines if fancy spinners or prompts should be displayed
	NonInteractive bool

	// UseSystemJava sets the instance to use the system java
	// instead of the internal installation. This skips downloading java
	UseSystemJava bool

	// JavaVersion is the version to use
	JavaVersion string
	// contains filtered or unexported fields
}

Launcher can launch minepkg instances with CLI output

func (*Launcher) ApplyOverWrites

func (l *Launcher) ApplyOverWrites(o *OverwriteFlags)

func (*Launcher) HandleCrash

func (c *Launcher) HandleCrash() error

HandleCrash handles a crash by submitting it to minepkg.io and outputting some debug info

func (*Launcher) Java

func (l *Launcher) Java(ctx context.Context) (*java.Java, error)

func (*Launcher) Prepare

func (l *Launcher) Prepare() error

Prepare ensures all requirements are met to launch the instance in the current directory

func (*Launcher) PrepareDependencies added in v0.1.8

func (l *Launcher) PrepareDependencies(ctx context.Context, force bool) error

PrepareDependencies downloads missing dependencies if needed passing true as the second parameter will make sure to check for available updates

func (*Launcher) PrepareJavaBg added in v0.1.8

func (l *Launcher) PrepareJavaBg(ctx context.Context) chan error

prepareJava downloads java if needed and returns an error channel

func (*Launcher) PrepareMinecraft added in v0.1.8

func (l *Launcher) PrepareMinecraft(ctx context.Context) error

func (Launcher) PrepareRequirements added in v0.1.8

func (l Launcher) PrepareRequirements() (bool, error)

PrepareRequirements will update the requirements section in the lockfile if needed

func (*Launcher) Run

func (c *Launcher) Run(opts *instances.LaunchOptions) error

Run will launch the instance with the provided launchOptions and will set some fallback values. It will block until the instance is stopped.

type MaybeSpinner

type MaybeSpinner struct {
	Spin    bool
	Spinner *spinner.Spinner
	Msg     string
}

MaybeSpinner is a spinner that can also just log text

func NewMaybeSpinner

func NewMaybeSpinner(spin bool) *MaybeSpinner

NewMaybeSpinner will return a new MaybeSpinner

func (*MaybeSpinner) Start

func (m *MaybeSpinner) Start()

Start might start the spinner

func (*MaybeSpinner) Stop

func (m *MaybeSpinner) Stop()

Stop will stop the spinner

func (*MaybeSpinner) Update

func (m *MaybeSpinner) Update(t string)

Update will update the spinner text

type OverwriteFlags

type OverwriteFlags struct {
	McVersion        string
	FabricVersion    string
	ForgeVersion     string
	MinepkgCompanion string
	Java             string
	Ram              int
}

OverwriteFlags are cli flags used to overwrite launch behavior

func CmdOverwriteFlags

func CmdOverwriteFlags(cmd *cobra.Command) *OverwriteFlags

Jump to

Keyboard shortcuts

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