Increase the maximum number of concurrent connections. This code would increase the download speed.
var path =newMinecraftPath();var launcher =newMinecraftLauncher(path);
Create Minecraft directory structure and initialize launcher instance. You can change the path and directory structure. See Minecraft Path and MinecraftLauncherParameters
awaitlauncher.InstallAsync("1.20.4");var process =awaitlauncher.BuildProcessAsync("1.20.4",newMLaunchOption{ Session =MSession.CreateOfflineSession("Gamer123"), MaximumRamMb =4096});process.Start();
Install the game and build the game process and return it. See Launch Options for more launch options.
More Methods
Get all files to launch the version
// by version nameIEnumerable<GameFile> files =awaitlauncher.ExtractFiles("1.20.4", cancellationToken);
// by IVersion IVersion version =awaitlauncher.GetVersionAsync("1.20.4", cancellationToken);IEnumerable<GameFile> files =awaitlauncher.ExtractFiles(version, cancellationToken);
Scan files and download any files that need to be downloaded
// report install progress to launcher.FileProgressChanged, launcher.ByteProgressChangedawaitlauncher.InstallAsync("1.20.4", cancellationToken); // by version nameawaitlauncher.InstallAsync(version, cancellationToken); // by IVersion // report install progress to fileProgress, byteProgressawaitlauncher.InstallAsync("1.20.4", fileProgress, byteProgress, cancellationToken); // by version name awaitlauncher.InstallAsync(version, fileProgress, byteProgress, cancellationToken); // by IVersion
Build game process
// by version nameProcess process =awaitlauncher.BuildProcessAsync("1.20.4",newMLaunchOption(), cancellationTokene);
// by IVersionIVersion version =awaitlauncher.GetVersionAsync("1.20.4", cancellationToken);Process process =launcher.BuildProcess(version,newMLaunchOption());
Get the Java path required to launch the version
IVersion version =awaitlauncher.GetVersionAsync("1.20.4", cancellationToken);string? javaPath =awaitlauncher.GetJavaPath(version);