CmlLib.Core 3.3.0

Minecraft Launcher Library for .NET Core and .NET Framework
Support All versions, forge, optifine
see github to learn how to use

Install-Package CmlLib.Core -Version 3.3.0
dotnet add package CmlLib.Core --version 3.3.0
<PackageReference Include="CmlLib.Core" Version="3.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CmlLib.Core --version 3.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CmlLib.Core, 3.3.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install CmlLib.Core as a Cake Addin
#addin nuget:?package=CmlLib.Core&version=3.3.0

// Install CmlLib.Core as a Cake Tool
#tool nuget:?package=CmlLib.Core&version=3.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

CmlLib.Core

Minecraft Launcher Library

<img src='https://raw.githubusercontent.com/CmlLib/CmlLib.Core/master/icon.png' width=150>

Nuget Badge
GitHub license
Codacy Badge

Discord

CmlLib.Core is minecraft launcher library for .NET 5.0 / .NET Core 3.1 / .NET Framework 4.6.2
Support all version, with Forge

한국어 README

Features

  • Asynchronous APIs
  • Mojang Authentication
  • Microsoft Xbox Live Login
  • Download the game files from the Mojang file server
  • Launch any version (tested up to 1.16.5)
  • Launch Forge, Optifine, FabricMC, LiteLoader or any other custom version
  • Install Java runtime
  • Launch with options (direct server connecting, screen resolution)
  • Supports cross-platform (windows, ubuntu, macOS)

Install

Install the 'CmlLib.Core' Nuget package or download the dll files in Releases and add references to them in your project.

Write this at the top of your source code:

using CmlLib.Core;
using CmlLib.Core.Auth;

Documentation

Many features are available for custom launchers. See wiki to use all features!
Official documentation: wiki

QuickStart

Microsoft Xbox Login

Wiki

Mojang Login

Login Process

var login = new MLogin();
var response = login.TryAutoLogin();

if (!response.IsSuccess) // failed to automatically log in
{
    var email = Console.ReadLine();
    var pw = Console.ReadLine();
    response = login.Authenticate(email, pw);

    if (!response.IsSuccess)
         throw new Exception(response.Result.ToString()); // failed to log in
}

// This session variable is the result of logging in and is used in MLaunchOption, in the Launch part below.
var session = response.Session;

Offline Login

// This session variable is the result of logging in and is used in MLaunchOption, in the Launch part below.
var session = MSession.GetOfflineSession("USERNAME");

Launch

// increase connection limit to fast download
System.Net.ServicePointManager.DefaultConnectionLimit = 256;

//var path = new MinecraftPath("game_directory_path");
var path = new MinecraftPath(); // use default directory

var launcher = new CMLauncher(path);
launcher.FileChanged += (e) =>
{
    Console.WriteLine("[{0}] {1} - {2}/{3}", e.FileKind.ToString(), e.FileName, e.ProgressedFileCount, e.TotalFileCount);
};
launcher.ProgressChanged += (s, e) =>
{
    Console.WriteLine("{0}%", e.ProgressPercentage);
};

var versions = await launcher.GetAllVersionsAsync();
foreach (var item in versions)
{
    // show all version names
    // use this version name in CreateProcessAsync method.
    Console.WriteLine(item.Name);
}

var launchOption = new MLaunchOption
{
    MaximumRamMb = 1024,
    Session = MSession.GetOfflineSession("hello"), // Login Session. ex) Session = MSession.GetOfflineSession("hello")

    //ScreenWidth = 1600,
    //ScreenHeigth = 900,
    //ServerIp = "mc.hypixel.net"
};

//var process = await launcher.CreateProcessAsync("input version name here", launchOption);
var process = await launcher.CreateProcessAsync("1.15.2", launchOption); // vanilla
// var process = await launcher.CreateProcessAsync("1.12.2-forge1.12.2-14.23.5.2838", launchOption); // forge
// var process = await launcher.CreateProcessAsync("1.12.2-LiteLoader1.12.2"); // liteloader
// var process = await launcher.CreateProcessAsync("fabric-loader-0.11.3-1.16.5") // fabric-loader

process.Start();

Example

Sample Code

CmlLib.Core

Minecraft Launcher Library

<img src='https://raw.githubusercontent.com/CmlLib/CmlLib.Core/master/icon.png' width=150>

Nuget Badge
GitHub license
Codacy Badge

Discord

CmlLib.Core is minecraft launcher library for .NET 5.0 / .NET Core 3.1 / .NET Framework 4.6.2
Support all version, with Forge

한국어 README

Features

  • Asynchronous APIs
  • Mojang Authentication
  • Microsoft Xbox Live Login
  • Download the game files from the Mojang file server
  • Launch any version (tested up to 1.16.5)
  • Launch Forge, Optifine, FabricMC, LiteLoader or any other custom version
  • Install Java runtime
  • Launch with options (direct server connecting, screen resolution)
  • Supports cross-platform (windows, ubuntu, macOS)

Install

Install the 'CmlLib.Core' Nuget package or download the dll files in Releases and add references to them in your project.

Write this at the top of your source code:

using CmlLib.Core;
using CmlLib.Core.Auth;

Documentation

Many features are available for custom launchers. See wiki to use all features!
Official documentation: wiki

QuickStart

Microsoft Xbox Login

Wiki

Mojang Login

Login Process

var login = new MLogin();
var response = login.TryAutoLogin();

if (!response.IsSuccess) // failed to automatically log in
{
    var email = Console.ReadLine();
    var pw = Console.ReadLine();
    response = login.Authenticate(email, pw);

    if (!response.IsSuccess)
         throw new Exception(response.Result.ToString()); // failed to log in
}

// This session variable is the result of logging in and is used in MLaunchOption, in the Launch part below.
var session = response.Session;

Offline Login

// This session variable is the result of logging in and is used in MLaunchOption, in the Launch part below.
var session = MSession.GetOfflineSession("USERNAME");

Launch

// increase connection limit to fast download
System.Net.ServicePointManager.DefaultConnectionLimit = 256;

//var path = new MinecraftPath("game_directory_path");
var path = new MinecraftPath(); // use default directory

var launcher = new CMLauncher(path);
launcher.FileChanged += (e) =>
{
    Console.WriteLine("[{0}] {1} - {2}/{3}", e.FileKind.ToString(), e.FileName, e.ProgressedFileCount, e.TotalFileCount);
};
launcher.ProgressChanged += (s, e) =>
{
    Console.WriteLine("{0}%", e.ProgressPercentage);
};

var versions = await launcher.GetAllVersionsAsync();
foreach (var item in versions)
{
    // show all version names
    // use this version name in CreateProcessAsync method.
    Console.WriteLine(item.Name);
}

var launchOption = new MLaunchOption
{
    MaximumRamMb = 1024,
    Session = MSession.GetOfflineSession("hello"), // Login Session. ex) Session = MSession.GetOfflineSession("hello")

    //ScreenWidth = 1600,
    //ScreenHeigth = 900,
    //ServerIp = "mc.hypixel.net"
};

//var process = await launcher.CreateProcessAsync("input version name here", launchOption);
var process = await launcher.CreateProcessAsync("1.15.2", launchOption); // vanilla
// var process = await launcher.CreateProcessAsync("1.12.2-forge1.12.2-14.23.5.2838", launchOption); // forge
// var process = await launcher.CreateProcessAsync("1.12.2-LiteLoader1.12.2"); // liteloader
// var process = await launcher.CreateProcessAsync("fabric-loader-0.11.3-1.16.5") // fabric-loader

process.Start();

Example

Sample Code

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CmlLib.Core:

Package Downloads
CmlLib.Core.Auth.Microsoft.UI
UI library for minecraft login with Microsoft Xbox account

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
3.3.0 27 6/14/2021
3.2.0 95 6/2/2021
3.2.0-pre3 62 5/25/2021
3.2.0-pre1 72 4/8/2021
3.1.1 268 2/11/2021
3.1.0 173 12/27/2020
3.0.0 274 8/25/2020
3.0.0-alpha3 168 8/24/2020
3.0.0-alpha 243 7/3/2020
2.0.2 268 5/31/2020
2.0.1 204 5/31/2020
2.0.0 268 5/17/2020
0.2.0 259 4/13/2020
0.1.0 227 4/6/2020