Natsurainko.FluentCore
2.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Natsurainko.FluentCore --version 2.0.0
NuGet\Install-Package Natsurainko.FluentCore -Version 2.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Natsurainko.FluentCore" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Natsurainko.FluentCore --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Natsurainko.FluentCore, 2.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Natsurainko.FluentCore as a Cake Addin #addin nuget:?package=Natsurainko.FluentCore&version=2.0.0 // Install Natsurainko.FluentCore as a Cake Tool #tool nuget:?package=Natsurainko.FluentCore&version=2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Natsurainko.FluentCore
一个高效的模块化的 Minecraft 启动核心
简介
一个由C#编写的跨平台模块化 Minecraft 启动核心
- 支持桌面平台的跨平台调用 (Windows/Linux/Mac上的调试已通过)
- Minecraft游戏核心的查找
- Minecraft的参数生成、启动封装
- 对离线/微软/Yggdrasil验证的支持
- 支持多线程高速补全Assets、Libraries等游戏资源
- 支持从Bmclapi、Mcbbs下载源进行文件补全
- 在此感谢bangbang93提供镜像站服务 如果您支持我们 可以 赞助Bmclapi
本项目依赖框架: .NET Standard 2.1
声明
- BMCLAPI是@bangbang93开发的BMCL的一部分,用于解决国内线路对Forge和Minecraft官方使用的Amazon S3 速度缓慢的问题。BMCLAPI是对外开放的,所有需要Minecraft资源的启动器均可调用。
- 感谢开发过程中大佬laolarou726给出的建议和指导 不妨也看看它的启动核心项目Projbobcat
您发现了我们项目中的bug? 对我们的项目中有不满意的地方? <br/> 或是您愿意加入我们,与我们一同开发? <br/> 联系: a-275@qq.com (作者本人邮箱)
安装
- 在Visual Studio的Nuget包管理器中搜索 FluentLauncher.Core 并安装
- 直接下载本仓库Release中的.nupkg文件进行安装
- 直接下载本仓库Release中的.dll文件导入项目
用法
初始化启动核心并启动游戏
引用
using Natsurainko.FluentCore.Class.Model.Launch;
using Natsurainko.FluentCore.Module.Authenticator;
using Natsurainko.FluentCore.Module.Launcher;
using Natsurainko.FluentCore.Wrapper;
using System;
string javaPath = Console.ReadLine();
string gameFolder = Console.ReadLine();
string core = Console.ReadLine();
string userName = Console.ReadLine();
var settings = new LaunchSetting(new JvmSetting(javaPath)); // 初始化启动配置
var authenticator = new OfflineAuthenticator(userName); // 初始化离线账户验证器
var locator = new GameCoreLocator(gameFolder); // 初始化核心定位器
var launcher = new MinecraftLauncher(settings, authenticator, locator); // 初始化启动
using var response = launcher.LaunchMinecraft(core); // 启动游戏
if (response.State == LaunchState.Succeess) // 判断启动状态是否成功
response.WaitForExit(); // 若成功就等待游戏进程退出
if (response.Exception != null) // 判断启动过程中是否发生异常
Console.WriteLine(response.Exception); // 输出异常
详细的启动过程请翻阅 Demo
初始化微软账户验证器 并调用系统默认浏览器登录
引用
using Natsurainko.FluentCore.Extension.Windows.Module.Authenticator;
using Natsurainko.FluentCore.Module.Authenticator;
var microsoftAuthenticator = new MicrosoftAuthenticator(); // 初始化一个微软账户验证器
// 如果你拥有 Azure 创建的应用,你可以使用 new MicrosoftAuthenticator(string clientId, string redirectUri) 来替代官方的api
await microsoftAuthenticator.GetAccessCode(); // 调用系统默认浏览器取回验证令牌 需要 Natsurainko.FluentCore 的 Windows 扩展
var account = await microsoftAuthenticator.AuthenticateAsync(); // 验证账户
// 将验证得到的账户 添加到启动 方法 1
// var settings = new LaunchSetting(new JvmSetting(javaPath));
// settings.Account = account;
// var launcher = new MinecraftLauncher(settings, locator);
// 将验证得到的账户 添加到启动 方法 2
// 采用方法二则不需要在 await microsoftAuthenticator.GetAccessCode() 之后再添加 var account = await microsoftAuthenticator.AuthenticateAsync()
// var launcher = new MinecraftLauncher(settings, microsoftAuthenticator, locator);
初始化 Yggdrasil 账户验证器 并采用外置登录
引用
using Natsurainko.FluentCore.Class.Model.Auth;
using Natsurainko.FluentCore.Class.Model.Auth.Yggdrasil;
using Natsurainko.FluentCore.Service;
using Natsurainko.Toolkits.Text;
using System.Collections.Generic;
using System.Linq;
using System;
string email = Console.ReadLine(); // Yggdrasil 账户邮箱
string password = Console.ReadLine(); // Yggdrasil 账户密码
string yggdrasilServerUrl = Console.ReadLine(); // 外置登录 api 服务地址
string authlibPath = Console.ReadLine(); // authlib-injector-1.1.xx.jar 文件路径
var authenticator = new YggdrasilAuthenticator(
YggdrasilAuthenticatorMethod.Login,
email: email,
password: password,
yggdrasilServerUrl: $"{yggdrasilServerUrl}/authserver");
// 获取外置登录 api 服务密匙
string base64 = (await (await HttpWrapper.HttpGetAsync(yggdrasilServerUrl)).Content.ReadAsStringAsync()).ConvertToBase64(); // 需要 Natsurainko.Toolkits
var args = DefaultSettings.DefaultAdvancedArguments.ToList();
args.Add($"-javaagent:{authlibPath.ToPath()}={yggdrasilServerUrl}");
args.Add($"-Dauthlibinjector.yggdrasil.prefetched={base64}");
// launchSetting.JvmSetting.AdvancedArguments = args; 设置高级启动参数
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Natsurainko.Toolkits (>= 1.0.0)
- Newtonsoft.Json (>= 13.0.1)
- System.Threading.Tasks.Dataflow (>= 6.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Natsurainko.FluentCore:
Package | Downloads |
---|---|
Natsurainko.FluentCore.Extension.Windows
一个高效的模块化的 Minecraft 启动核心 Natsurainko.FluentCore 的 Windows 扩展 |
GitHub repositories
This package is not used by any popular GitHub repositories.