Documentation ¶
Overview ¶
Package mc implements facilities for detecting and working with Minecraft instances.
Index ¶
- Constants
- type Instance
- func (i *Instance) Click() error
- func (i *Instance) Focus()
- func (i *Instance) FocusAndUnpause(timestamp xproto.Timestamp, idle bool)
- func (i *Instance) PressEsc(timestamp xproto.Timestamp)
- func (i *Instance) PressF3(timestamp xproto.Timestamp)
- func (i *Instance) PressF3Esc(timestamp xproto.Timestamp)
- func (i *Instance) Reset(timestamp xproto.Timestamp)
- func (i *Instance) Stretch(conf cfg.Profile) error
- func (i *Instance) Unstretch(conf cfg.Profile) error
- type InstanceInfo
- type InstanceState
Constants ¶
const ( StMenu int = iota // Main menu StDirt // Dirt world generation screen StPreview // World preview StIdle // World generation finished StIngame // Currently being played )
The set of possible states an instance can be in.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance struct { InstanceInfo // contains filtered or unexported fields }
Instance represents a single Minecraft instance and takes care of reading its log file and performing actions on it.
func NewInstance ¶ added in v0.4.0
NewInstance creates a new Instance from the given instance information.
func (*Instance) Focus ¶ added in v0.4.0
func (i *Instance) Focus()
Focus focuses the instance's window. If an error occurs, it will be logged.
func (*Instance) FocusAndUnpause ¶ added in v0.4.0
FocusAndUnpause focuses the instance's window and then unpauses if the user has set `unpause_on_focus` in their config. If an error occurs, it will be logged.
func (*Instance) PressEsc ¶ added in v0.4.0
PressEsc presses escape to [un]pause the instance. If an error occurs, it will be logged.
func (*Instance) PressF3Esc ¶ added in v0.4.0
PressF3Esc presses F3+Escape to pause the instance without the pause menu. If an error occurs, it will be logged.
func (*Instance) Reset ¶
Reset presses the instance's reset key. If an error occurs, it will be logged.
type InstanceInfo ¶ added in v0.4.0
type InstanceInfo struct { Id int // Instance number Pid uint32 // Process ID Wid xproto.Window // Window ID Dir string // .minecraft directory Version int // Minecraft version ResetKey x11.Key // Atum reset key }
InstanceInfo contains information about how to interact with a Minecraft instance, such as its game directory and window ID.
func FindInstances ¶ added in v0.4.0
func FindInstances(x *x11.Client) ([]InstanceInfo, error)
FindInstances returns a list of all running Minecraft instances.
type InstanceState ¶
type InstanceState struct { State int // Current state of the instance Progress int // World generation progress (0 to 100) }
InstanceState contains information about the current state of the instance.