Launching the game

From wiki.vg
Jump to navigation Jump to search

Once the launcher has authenticated the user and downloaded the game, its next task is to start it. For this, it requires some information found in the version manifest.

Java version

Until the Electron-based launcher, Minecraft stayed on the version of Java that had the most userbase, jumping from Java 6 in the early days to Java 7, then 8.

Once the Electron-based launcher released, the version manifest embedded a javaVersion key that let it downloads the correct JVM for any given Minecraft version. This has the advantage of not expecting anything about the user's computer. The game will run even if the player does not have Java installed.

The JVM is downloaded to $MINECRAFT_FOLDER/runtime/[javaVersion.component]/[OS]

Assets

The assets are expected to be downloaded according to the Assets section of the game files page, but also expects an $MINECRAFT_FOLDER/assets/indexes folder containing the JSON of the assets indexes available in the version manifest.

Arguments

Warning.png This section is a WIP as not all arguments explanation are available. If you know about them please contribute!

Running Minecraft requires several arguments.

On newer releases you can find them in the manifest under the arguments.jvm and arguments.game keys. Those are array of either a string corresponding to the argument or an object containing the value and the rules to check before appending the given argument. In case of an object, the value key can be either a string or an array of string.

The first version using this key is 1.12.2. For those before this one, you can check the minecraftArguments key. It's a string referencing all the arguments passed to the game. With the exception of the log4j config, no JVM arguments are passed to the game.

Here's a list of them with their corresponding description:

JVM Arguments

Argument Description Usage
-Djava.library.path=${natives_directory} The natives folder path Load the natives
-Dminecraft.launcher.brand=${launcher_name} The launcher name @TODO: find out
-Dminecraft.launcher.version=${launcher_version} The launcher version @TODO: find out
-cp ${classpath} List of all the absolute path for the jars to load (libraries + client.jar) separated by ; (on windows), : (on linux)
-Dos.name=Windows 10 -Dos.version=10.0 Rule to be added only on Windows 10 @TODO: find out
-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump According to this post, it forces laptops with Nvidia Optimus to use the GPU instead of iGPU.
-XstartOnFirstThread Rule to be added only on OSX Makes the JVM starts with thread 0, required on OSX
-Xss1M - Sets the JVM stack size to 1M

Game Arguments

Argument Description Usage
--clientId ${clientid} @TODO: find out @TODO: find out
--xuid ${auth_xuid} @TODO: find out @TODO: find out
--username ${auth_player_name} Sets the player username Used when logging in offline-mode, @TODO: find out if its useful in online-mode
--version ${version_name} Sets the version name of the game @TODO: find out
--gameDir ${game_directory} The instance directory The game will locate every runtime files there (e.g. options.txt, world saves, ...)
--assetsDir ${assets_root} Should contain {indexes/, objects/, virtual/} The asset directory used by the game
--assetsIndex ${assets_index_name} Should contain the asset indexes JSON file for any installed version Let the games locate the assets based on its internal name in the assets/objects
--uuid ${auth_uuid} The player UUID @TODO: find out
--accessToken ${auth_access_token} The Mojang Access Token or the final token in the Microsoft authentication scheme Authenticate with the game
--userType ${user_type} The authentication scheme to use for logging in msa for Microsoft Authentication Scheme, legacy for Legacy Minecraft Authentication and mojang for Legacy_Mojang_Authentication.
--versionType ${version_type} Only used to display on the main menu, some launcher sets it to "release" / "snapshot" (MultiMC), other sets it as their brand name (SKCraft)
--demo Not sure if it's still available Run the game in demo-mode (When the account does not own the game)
--server ${server_ip} Joins the server when the game is loaded Join the server
--width ${resolution_width} Rule adding it only for "feature: has_custom_resolution" Sets the game's width
--height ${resolution_height} Rule adding it only for "feature: has_custom_resolution" Sets the game's height
--disableMultiplayer Disable Multiplayer button Disable Multiplayer button
--disableChat Disable receiving and sending online chat Disable receiving and sending online chat

Legacy Arguments

Argument Description Usage
--tweakClass net.minecraft.launchwrapper.AlphaVanillaTweaker The class comes from net.minecraft.launchwrapper library Wrap the starting applet into a frame and setups up the params correctly
--session ${auth_session} No longer used ? Need to check how was implemented the newer auth in older versions The session ID used to authenticate with Mojang while connecting to servers
--userProperties ${user_properties} @TODO: find out @TODO: find out
--workDir ${game_directory} Only in a few versions between 13w16a and 13w23b (including release 1.5.2) Same as newer --gameDir
--gameDir ${game_directory} - Same as newer --gameDir
--versionType ${version_type} - Same as newer --versionType
--userType ${user_type} - Same as newer --userType
--assetIndex ${assets_index_name} - Same as newer --assetIndex
--version ${version_name} - Same as newer --version
--username ${auth_player_name} - Same as newer --username
--uuid ${uuid} - Same as newer --uuid
--accessToken ${accessToken} - Same as newer --accessToken
--assetIndex ${assets_index_name} - Same as newer --assetIndex
--assetsDir ${assets_root} - Same as newer --assetsDir
--assetsDir ${game_assets} Used until 13w48b (Last release = 1.7.2) Probably the /assets/virtual/legacy for pre-1.6 assetsNeed to check

Main class

The main class is also referenced in the version manifest.

Class Name Applet Class Name Description
net.minecraft.client.main.Main Used by most versions, all versions after 1.5.2, additionally including 13w16b.
net.minecraft.launchwrapper.Launch Used until 1.5.2, excluding 13w16b
net.minecraft.client.Minecraft net.minecraft.client.MinecraftApplet
com.mojang.minecraft.Minecraft com.mojang.minecraft.MinecraftApplet
com.mojang.minecraft.RubyDung Used for really early versions.
com.mojang.rubydung.RubyDung Used for really early versions.

NOTE: In early versions, the non-applet main class was obfuscated. For these versions, you can refer to the Prism Launcher meta repository.

It can be something else for custom instances, e.g. Forge instances.

Building the final command

Once we have everything ready we can build the final command to start the game.

%JAVA_PATH%/bin/java [JVM Args] [main_class] [Game / Legacy Args]

A frame with the game will popup, and the logs will be available on standard output as expected.