项目作者: SinoAHpx

项目描述 :
Cross-platform Minecraft Launcher library
高级语言: C#
项目地址: git://github.com/SinoAHpx/ModuleLauncher.Re.git
创建时间: 2020-08-01T18:25:37Z
项目社区:https://github.com/SinoAHpx/ModuleLauncher.Re

开源协议:Do What The F*ck You Want To Public License

下载


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.

  1. // version you want to launch
  2. var version = "<version>";
  3. // initialize a MinecraftResolver instance by path of .minecraft
  4. var minecraftResolver = new MinecraftResolver(rootPath);
  5. // get MinecraftEntry by Minecraft id (version)
  6. // it's very IMPORTANT
  7. var minecraft = minecraftResolver.GetMinecraft(version);
  8. // launch in method-chain way
  9. // essentially only two value needed to launch Minecraft besides Minecraft version
  10. // player: username of an offline player
  11. // (notice that here string has been implicitly converted to AuthenticateResult)
  12. // java: path of java executable file
  13. var process = await minecraft.WithAuthentication("<player>")
  14. .WithJava(@"<java>")
  15. .LaunchAsync();

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

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

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