BeaconSDK 0.1.4
dotnet add package BeaconSDK --version 0.1.4
NuGet\Install-Package BeaconSDK -Version 0.1.4
<PackageReference Include="BeaconSDK" Version="0.1.4" />
<PackageVersion Include="BeaconSDK" Version="0.1.4" />
<PackageReference Include="BeaconSDK" />
paket add BeaconSDK --version 0.1.4
#r "nuget: BeaconSDK, 0.1.4"
#:package BeaconSDK@0.1.4
#addin nuget:?package=BeaconSDK&version=0.1.4
#tool nuget:?package=BeaconSDK&version=0.1.4
BeaconSDK
BeaconSDK is a .NET library for building Minecraft launchers. It handles the parts that are tedious to get right: Microsoft/Xbox authentication, downloading and verifying game files, installing mod loaders, managing Java runtimes and launching the game with a correct argument list.
It targets .NET 10, is trim/AOT friendly, and integrates with
Microsoft.Extensions.DependencyInjection and Microsoft.Extensions.Hosting.
- Full source and issue tracker: https://github.com/TavstalDev/BeaconSDK
- License: MIT
Features
- Microsoft authentication - OAuth2 device code flow and browser redirect flow, Xbox Live / XSTS token exchange, Minecraft access tokens, ownership checks, and profile retrieval.
- Account management -
Accountmodel with encrypted access/refresh tokens at rest and login refresh support. - Mojang skins & capes - change, upload, reset skins and show/hide capes.
- Minecraft version manifests - cached Mojang version manifest plus Fabric, Quilt, Forge and NeoForge loader manifests.
- Instance installation - downloads and verifies the client jar, libraries, assets, natives and logging config, with SHA-1 verification.
- Mod loader support - Fabric, Quilt, Forge (early → modern) and NeoForge, including the legacy Forge compatibility libraries.
- Java management - locates installed JVMs, inspects their version/architecture, and downloads the required JDK automatically.
- Launching - builds JVM and game arguments and starts the game process, with start/stop lifecycle and running-process tracking.
- Progress reporting - a single
IProgressReportersurfaces every stage to your UI. - Logging -
IBeaconLogger<T>writes to the console or to your host'sILogger<T>, andILogWriterpersists entries through a hosted background writer. - Resilient downloads - gzip/deflate and TLS handling, automatic retries on
throttling, parallel downloads and integrity checks, all through a shared named
defaultHttpClient(viaIHttpClientFactory).
Requirements
- The .NET 10 SDK or runtime
- A Microsoft Azure application registration (client ID) if you use Microsoft login
Installation
dotnet add package BeaconSDK
Or add the package reference directly:
<PackageReference Include="BeaconSDK" Version="0.1.4" />
Quickstart
Register the SDK services on a host:
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Tavstal.BeaconSDK;
using Tavstal.BeaconSDK.Models.Config;
var hostBuilder = Host.CreateDefaultBuilder(args);
var config = new BeaconConfiguration
{
Auth = new AuthConfiguration
{
MicrosoftClientId = "your-azure-client-id",
},
Logging = new LoggingConfig
{
LogLevel = LogLevel.Information,
DefaultLogFilePath = Path.Combine("logs", "latest.log") // optional, null keeps logging on the console
}
};
hostBuilder = hostBuilder.ConfigureServices(services =>
{
services.AddBeaconServices(config);
});
var host = hostBuilder.Build();
await host.RunAsync();
The log writer is registered as a hosted service, so starting the host begins flushing
entries to Logging.DefaultLogFilePath.
AddBeaconServices registers every service (HTTP, encryption, manifests, install,
launch, Java and authentication). Inject what you need, then install and launch an
instance:
using Tavstal.BeaconSDK.Enums;
using Tavstal.BeaconSDK.Helpers.Domain;
using Tavstal.BeaconSDK.Instances;
using Tavstal.BeaconSDK.Models.Config;
using Tavstal.BeaconSDK.Models.Instance;
using Tavstal.BeaconSDK.Models.Instance.Config;
using Tavstal.BeaconSDK.Models.Logging;
using Tavstal.BeaconSDK.Services.Abstractions;
public class Launcher(IManifestService manifests,
IInstanceInstallService installer, IInstanceLaunchService launcher,
IJavaService java, IBeaconLogger<Launcher> log, BeaconConfiguration config, IProgressReporter progress)
{
public async Task RunAsync(string username, string mcVersion, CancellationToken ct)
{
// 1. Fetch the Minecraft version manifest
var manifestPath = Path.Combine(Directory.GetCurrentDirectory(), "manifest.json");
if (!File.Exists(manifestPath))
{
await manifests.DownloadMinecraftManifestAsync(manifestPath, null, ct);
}
var manifest = await manifests.GetMinecraftManifestAsync(manifestPath, ct);
var version = manifest!.Versions.First(v => v.Id == mcVersion);
// 2. Describe the instance
var gameDir = Path.Combine(Directory.GetCurrentDirectory(), "game", "instances", mcVersion);
Directory.CreateDirectory(gameDir);
var game = new GameDetails(javaPath: "", 1024, 4096, "", mcVersion, EMinecraftKind.VANILLA,
customVersion: null, customGameDirectory: gameDir, preLaunchCommand: "",
wrapperCommands: [], postExitCommand: "", environmentVariables: [], serverAddressToJoin: null);
var paths = new PathDetails(assetsDir: "game/assets", cacheDir: "game/cache",
librariesDir: "game/libs", versionsDir: "game/versions", []);
var launcherDetails = new LauncherDetails("myLauncher", "1.0.0");
var uuid = GameHelper.GetOfflinePlayerUUID(username);
var client = new ClientDetails(null, username, uuid, isOffline: true);
var instanceConfig = new InstanceConfiguration
{
Version = version,
Game = game,
Path = paths,
Launcher = launcherDetails,
Client = client
};
var instance = new MinecraftInstance(mcVersion, config, instanceConfig,
new BeaconLogger<MinecraftInstance>(Microsoft.Extensions.Logging.LogLevel.Information), progress);
// 3. Install, ensure Java, then launch
if (!await installer.InstallAsync(instance, progress, ct)) return;
var major = instance.MinecraftVersionMeta.JavaVersionMeta?.MajorVersion ?? 8;
await java.LocateJavaInstallationsAsync(Path.Combine("game", "java"), cancellationToken: ct);
var javaPath = await java.GetJavaVersionAsync(major, ct)
?? await java.DownloadJavaVersionAsync(major, "game/java", "java-mirrors.json", null, ct);
instance.Config.Game.JavaPath = javaPath;
var process = await launcher.LaunchAsync(instance, progress, ct);
}
}
A complete, runnable sample lives in
BeaconSDK.Example.
It signs in with a Microsoft account or plays offline through ExampleLoginWorker,
and installs and launches vanilla, Fabric, Quilt, Forge and NeoForge instances
through the matching workers. For modded instances, construct a FabricInstance,
QuiltInstance, ForgeInstance.GetForgeInstance(...) or NeoForgeInstance and
pass it to the same services.
Core concepts
| Type | Purpose |
|---|---|
BeaconBootstrap.AddBeaconServices |
Registers all SDK services in DI, including the hosted log writer and the named default HttpClient |
MinecraftInstance |
Describes an instance (version, paths, memory, client) |
FabricInstance, QuiltInstance, NeoForgeInstance, ForgeInstance |
Mod loader installers |
GameDetails / PathDetails / LauncherDetails / ClientDetails |
Instance configuration |
IProgressReporter |
Receives progress/status updates |
IBeaconLogger<T> |
Structured logger used throughout the SDK |
ILogWriter |
Queues log lines for asynchronous file writing |
LoggingConfig |
Log level, console vs ILogger<T> routing, default log file |
| Service | Purpose |
|---|---|
IHttpService |
GET, streaming, downloads, parallel downloads (named default HttpClient) |
IManifestService |
Mojang + mod loader manifests (cached) |
ILibraryDownloadService |
Version JSON, assets, mappings, libraries, natives |
IInstanceInstallService |
Downloads and verifies all instance files |
IInstanceLaunchService |
Builds arguments and starts/stops the game |
IJavaService |
Discovers, inspects and downloads Java runtimes |
IMicrosoftAuthService |
Microsoft/Xbox/Minecraft authentication |
IMicrosoftDeviceAuthService |
Device code polling loop |
IMicrosoftHttpAuthService |
OAuth2 redirect callback listener |
IMojangSkinService |
Skin and cape management |
IEncryptionService |
Token encryption/decryption |
Documentation
Contributing
See docs/CONTRIBUTING.md for guidelines on how to help with this project.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Contact
For issues or feature requests, use the GitHub issue tracker.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.DataProtection (>= 10.0.14)
- Microsoft.Extensions.Http (>= 10.0.14)
- NbtLib (>= 1.0.1)
- SharpZipLib (>= 1.4.2)
- System.Security.Cryptography.ProtectedData (>= 10.0.14)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.