Giter VIP home page Giter VIP logo

modulelauncher.re's Introduction

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

modulelauncher.re's People

Contributors

sinoahpx avatar xiaoli8848 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

modulelauncher.re's Issues

增加一个方法

增加一个方法,使得用户可以在指定的.minecraft路径下寻找存在的Minecraft Version

(就跟隔壁projbobcat的GetAllGames()差不多)

关于迁移到新版本遇到的一些问题

首先,请不要随意更改命名空间或删除方法,更新到4.x之后命名空间完全改变了,这使得项目无法顺利的从3.x迁移到4.x,希望之后不要轻易更改命名空间,对于过时的方法请保留并标注已过时,然后在几个版本后再删除
同时请不要将.net目标版本设置的过于高,这将导致几乎没有项目可以引用这个库,建议使用TargetFrameworks,同时支持.netfx,.netstandard和.netcoreapp(.netstandard是一个标准,不存在过时或不过时,建议.netstandard设置为2.0

建议实现用户皮肤管理

对于Microsoft正版用户与离线用户,管理皮肤都是必要的功能。故建议实现用户皮肤管理的相关功能:

线上用户 离线用户
1.获取用户皮肤Url。
2.上传图片文件,更换用户皮肤。
1.判断用户属于Alex或Steve(并提供自定义设置)。
2.给定本地图片文件,替换默认皮肤。

MinecraftLocator's path caused som problems

When we use a locator with path ".minecraft"
ModuleLauncher.Re.Locators.Concretes.MinecraftLocator locator = new ModuleLauncher.Re.Locators.Concretes.MinecraftLocator( ".minecraft");
the version GetLocalMinecrafts() will find minecrafts under this dir's .minecraft directory.
but the game folder is not in this dir.

But when we choose Directory.GetCurrentDirectory()+ "\.minecraft" as locator's path, the game can run in a same environment.
ModuleLauncher.Re.Locators.Concretes.MinecraftLocator locator = new ModuleLauncher.Re.Locators.Concretes.MinecraftLocator(Directory.GetCurrentDirectory()+ "\\.minecraft");

A typo in MicrosoftAuthentication exception message

The exception message in file MicrosoftAuthenticator.cs for error code "2148916238" is missing a letter “T”.

case "2148916238":
    throw new FailedAuthenticationException("he account is a child (under 18) and cannot proceed unless the account is added to a Family by an adult. This only seems to occur when using a custom Microsoft Azure application. When using the Minecraft launchers client id, this doesn't trigger.");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.