MineStudio / KMCCC

An OpenSource Minecraft Launcher for .Net Developers
GNU Lesser General Public License v3.0
126 stars 34 forks source link
c-sharp minecraft-launcher

KMCCC

Join the chat at https://gitter.im/MineStudio/KMCCC Build status

如果你需要中文的介绍信息,请打开README_CN.md

An OpenSource Minecraft Launcher for .Net Developers

KMCCC.Shared

Shared Code Between KMCCC.Basic & KMCCC.Pro

Included:

KMCCC.Basic

Basic Version of KMCCC

Included:

KMCCC.Pro

Professional Version of KMCCC

Included:

Plan

We plan to delay some parameter settings, (such as versionLocator) and make more features available in KMCCC.Pro

Sample

How to initialize a LauncherCore


LauncherCore core = LauncherCore.Create(
    new LauncherCoreCreationOption(
        javaPath: Config.Instance.JavaPath, // by default it will be the first version finded
        gameRootPath: null, // by defualt it will be ./.minecraft/
        versionLocator: the Version Locator // by default it will be new JVersionLocator()
    ));

How to find Versions


var versions = core.GetVersions();

var version = core.GetVersion("1.8");

unlaunchable Version will be ignored

How to launch Minecraft

var result = core.Launch(new LaunchOptions
{
    Version = App.LauncherCore.GetVersion(server.VersionId)
    Authenticator = new OfflineAuthenticator("Steve"), // offline
    //Authenticator = new YggdrasilLogin("*@*.*", "***", true), // online
    MaxMemory = Config.Instance.MaxMemory, // optional
    MinMemory = Config.Instance.MaxMemory, // optional
    Mode = LaunchMode.MCLauncher, // optional
    Server = new ServerInfo {Address = "mc.hypixel.net"}, //optional
    Size = new WindowSize {Height = 768, Width = 1280} //optional
}, (Action<MinecraftLaunchArguments>) (x => { })); // optional ( modify arguments before launching

Using anonymous report

Reporter.SetClientName("Your launcher's name"); // set name
Reporter.SetReportLevel(ReportLevel.Full); // full report
//Reporter.SetReportLevel(ReportLevel.Basic); // basic report
//Reporter.SetReportLevel(ReportLevel.Min); // simplified report
//Reporter.SetReportLevel(ReportLevel.None); // turn off

Enjoy!