Skip to content

Latest commit

 

History

History
102 lines (72 loc) · 4.14 KB

README.md

File metadata and controls

102 lines (72 loc) · 4.14 KB

brand-logo

Your on-the-fly Minecraft launcher core.

NuGet latest version GitHub license GitHub stars Telegram

English / 简体中文

Glance

  • Based on .NET 6.
  • Multi-platform supported.
  • Launch every version of Minecraft, from very old to very new, plus Forge, OptiFine, Liteload and Fabric.
  • Flexible, lightweight and extensible.
  • Customizable OAuth client id & redirect url for Microsoft authorization shceme.
  • Multiple resources download source (especially for Chinese users).
  • Fully documented (almost).
  • Waiting for you to explore more.
But you should know
  • MoudleLauncher don't and won't support automatically install Forge, OptiFine, Liteload, Fabric or other loaders.
  • It's not hard to implement an in-built downloader, but we didn't do it, because it will literally against the flexibility and extensiblity we promised.

Getting started

We don't talk about very basic facts here, if you have got confused, go to documentation.

Install

  • Install ModuleLauncher.Re via Nuget:
    • IDE interface
    • Nuget Package Manger: Install-Package ModuleLauncher.Re
    • .NET CLI: dotnet add package ModuleLauncher.Re
  • Or clone the repo and compile it to dynamic link library

Launch

Assuming you must have an existing .minecraft. By the way, don't be afraid of these lines of codes, actually real codes are within 10 lines.

// version you want to launch
var version = "<version>";

// initialize a MinecraftResolver instance by path of .minecraft
var minecraftResolver = new MinecraftResolver(rootPath);

// get MinecraftEntry by Minecraft id (version)
// it's very IMPORTANT
var minecraft = minecraftResolver.GetMinecraft(version);

// launch in method-chain way
// essentially only two value needed to launch Minecraft besides Minecraft version
// player: username of an offline player 
// (notice that here string has been implicitly converted to AuthenticateResult)
// java: path of java executable file
var process = await minecraft.WithAuthentication("<player>")
    .WithJava(@"<java>")
    .LaunchAsync();

The launch method LaunchAsync returns an instance of Process, you can manipulate it as you wish.

// read and write Minecraft output
// ReadOutputLine and IsNullOrEmpty here is extension methods provided by library Manganese
while (!process.ReadOutputLine().IsNullOrEmpty())
{
    Console.WriteLine(process.ReadOutputLine());
}

Contribute

Code contribution

  • You can fork this repo and open a pull request to new branch. Noticibly you can't open a pull request directly to the main branch.
  • Open an issue.

Documentation contribution

If you didn't satified with the current document, you can:

Credits