Skip to content
/ mlcgo Public

A Easy Minecraft Launcher Core | 一个简单的我的世界启动器核心

License

Notifications You must be signed in to change notification settings

mcoo/mlcgo

Repository files navigation

Minecraft Launcher Core by Golang (MLCG)

English 简体中文

A Easy Minecraft Launcher Core

GitHub go.mod Go version GitHub Workflow Status GitHub release (latest SemVer including pre-releases)

Features ✈️

  • Offline Launcher
  • Auto Completion
  • Microsoft Oauth Launcher
  • Authlib-injector Launcher
  • Download Game
  • Cross platform support
  • Forge,Fabric Installer

Use 🚀

install

go get -u github.com/mcoo/mlcgo@latest
import "github.com/mcoo/mlcgo"

Launch Game

mlcgo.NewCore().
    OfflineLogin("enjoy").
    SetJavaPath(`C:\Program Files\Java\jdk-17.0.2\bin\java.exe`).
    SetMinecraftPath(`C:\Users\enjoy\AppData\Roaming\.minecraft`).
    SetRAM(2048).
    SetVersion("1.18").
    Launch(context.Background())

Get launch status

    ch := make(chan model.Step)
    go func() {
		for {
			v := <-ch
			switch v {
			case model.StopStep:
				log.Println("启动线程停止")
			case model.StartLaunchStep:
				log.Println("开始启动")
			case model.AuthAccountStep:
				log.Println("验证账号")
			case model.GenerateCmdStep:
				log.Println("生成启动命令")
			case model.CompleteFilesStep:
				log.Println("补全游戏文件")
			case model.ExecCmdStep:
				log.Println("执行启动命令")
			}
		}
	}()

Find Java Path

windows only

utils.FindJavaPath()

Get Local Versions

utils.GetLocalVersions()

Download Minecraft Game

versions, err := utils.GetAllMinecraftVersion()
	if err != nil {
		log.Errorln(err)
	}
	var c = NewCore().
		SetJavaPath(`C:\Program Files\Java\jdk-17.0.2\bin\java.exe`).
		SetMinecraftPath(`F:\mctest\.minecraft`).
		SetRAM(2048).
		OfflineLogin("enjoy").
		Debug()
	log.Println(c.DownloadGame(context.Background(), versions.Versions[4]))
	c.Launch(context.Background())

Auth

Microsoft Oauth

You should keep the 8809 port free.

AuthlibInjector Auth

AuthlibLogin(url,email,password)

Special Note 😀

you must mark the link of this repository in your software.

  • Use this project
  • Modify this project

Support Me ❤️

Reference 👍

Thanks

教程/编写启动器 [WIKI]

gomclauncher [MIT]

Microsoft Authentication Scheme [WIKI]

About

A Easy Minecraft Launcher Core | 一个简单的我的世界启动器核心

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages