VanillaLauncher class

Implementation of the Vanilla Minecraft launcher that handles all aspects of launching the game, including downloading assets, libraries, and configuring Java arguments.

Implemented types

Constructors

VanillaLauncher.new({required String gameDir, required String javaDir, required LauncherProfiles profiles, required Profile activeProfile, MinecraftAccountProfile? minecraftAccountProfile, MicrosoftAccount? microsoftAccount, MinecraftAuth? minecraftAuth, DownloadProgressCallback? onDownloadProgress, OperationProgressCallback? onOperationProgress, int progressReportRate = 10, String launcherName = 'CraftLauncher', String launcherVersion = '1.0.0'})
Creates a new VanillaLauncher instance.

Properties

assetDownloader AssetDownloader
Downloader for game assets (textures, sounds, etc.).
final
classpathManager ClasspathManager
Get the classpath manager
no setter
gameDir String
A getter of gameDir;
no setter
hashCode int
The hash code for this object.
no setterinherited
onExit JavaExitCallback?
Callback triggered when the Java process exits.
getter/setter pair
onOperationProgress OperationProgressCallback?
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

afterBuildClasspath(VersionInfo versionInfo, String versionId, List<String> classpath) Future<void>
Hook called after building the classpath.
override
afterBuildJavaArguments(String versionId, String arguments) Future<String>
Hook called after building Java arguments
override
afterDownloadAssets(String versionId) Future<void>
Hook called after downloading assets.
override
afterDownloadClientJar(String versionId) Future<void>
Hook called after downloading client jar.
override
afterDownloadLibraries(String versionId) Future<void>
Hook called after downloading libraries.
override
afterExtractNativeLibraries(String versionId, String nativesPath) Future<void>
Hook called after extracting native libraries.
override
afterFetchVersionManifest<T extends VersionInfo>(String versionId, T? versionInfo) Future<T?>
Hook called after fetching the version manifest.
override
afterGetAssetIndex(String versionId, String assetIndex) Future<void>
Hook called after getting asset index
override
afterStartProcess(String versionId, MinecraftProcessInfo processInfo, MinecraftAuth? auth) Future<void>
Hook called after starting the Minecraft process.
override
beforeBuildClasspath(VersionInfo versionInfo, String versionId) Future<List<String>>
Hook called before building the classpath.
override
beforeBuildJavaArguments(String versionId, JavaArgumentsBuilder builder, VersionInfo versionInfo) Future<Arguments?>
Hook called before building Java arguments
override
beforeDownloadAssets(String versionId) Future<bool>
Hook called before downloading assets.
override
beforeDownloadClientJar(String versionId) Future<bool>
Hook called before downloading client jar.
override
beforeDownloadLibraries(String versionId) Future<bool>
Hook called before downloading libraries.
override
beforeExtractNativeLibraries(String versionId) Future<bool>
Hook called before extracting native libraries.
override
beforeFetchVersionManifest(String versionId) Future<void>
Hook called before fetching the version manifest.
override
beforeGetAssetIndex<T extends VersionInfo>(String versionId, T versionInfo) Future<bool>
Hook called before getting asset index Returns true if the asset index retrieval should be skipped
override
beforeStartProcess(String javaExe, List<String> javaArgs, String workingDirectory, Map<String, String> environment, String versionId, MinecraftAuth? auth) Future<void>
Hook called before starting the Minecraft process.
override
downloadAssets<T extends VersionInfo>(T versionInfo, {String? inheritsFrom}) Future<void>
Downloads game assets (textures, sounds, etc.).
override
downloadClientJar() Future<void>
Downloads the Minecraft client JAR file.
override
downloadLibraries() Future<void>
Downloads required libraries for Minecraft.
override
extractNativeLibraries() Future<String>
Extracts native libraries required for Minecraft.
override
fetchVersionManifest<T extends VersionInfo>(String versionId, {bool skipPatch = false}) Future<T?>
Fetches the version manifest for a specific Minecraft version.
getAccountProfile() → MinecraftAccountProfile?
Gets the Minecraft account profile.
override
getActiveProfile() Profile
Gets the active profile.
override
getAdditionalNativeLibraries(String versionId, String nativesPath) Future<List<String>>
Get additional native libraries to extract. These libraries will be added to the native libraries extracted from the version's libraries.
override
getAssetIndex(String versionId) Future<String>
Gets the asset index for a specific version.
override
getCustomAssetIndexPath(String versionId, String assetIndex) String?
Get custom asset index path to override default path Return null to use the default path
override
getCustomAssetsDirectory() String?
Get custom assets directory path to override default path Return null to use the default directory
override
getGameDir() String
Gets the game directory.
override
getJavaArgumentsBuilder() JavaArgumentsBuilder
Gets the Java arguments builder.
override
getJavaDir() String
Gets the Java directory.
override
getMicrosoftAccount() → MicrosoftAccount?
Gets the Microsoft account.
override
getProfiles() LauncherProfiles
Gets the launcher profiles.
override
getVersionInfo<T extends VersionInfo>(String versionId) Future<T?>
Retrieves basic version information for a Minecraft version.
override
isModded() bool
Get the launcher is modded
override
launch({JavaStderrCallback? onStderr, JavaStdoutCallback? onStdout, JavaExitCallback? onExit}) Future<void>
Launches Minecraft.
override
loadProfiles() Future<void>
Loads launcher profiles from disk.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setActiveProfile(Profile profile) → void
Sets the active profile.
override
setActiveProfileById(String profileId) → void
Sets the active profile by its ID.
override
setCustomAssetIndexPath(String? path) → void
Set custom asset index path to override default path
setCustomAssetsDirectory(String? directory) → void
Set custom assets directory path to override default path
setGameDir(String gameDir) → void
Sets the game directory.
override
setJavaDir(String javaDir) → void
Sets the Java directory.
override
terminate() → void
Terminates the running Minecraft process.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited