Difference between revisions of "Launching the game"
Line 5: | Line 5: | ||
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. | 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, the version manifest embedded a <code>javaVersion</code> key that let it downloads the correct JVM for any given Minecraft version. This has the advantages that it does not expects anything about the user's computer (Even if the player does not have Java installed, the game will run). | + | Once the Electron-based launcher released, the version manifest embedded a <code>javaVersion</code> key that let it downloads the correct JVM for any given Minecraft version. This has the advantages that it does not expects anything about the user's computer (Even if the player does not have Java installed, the game will run). |
This JVM is downloaded to <code>$MINECRAFT_FOLDER/runtime/[javaVersion.component]/[OS]</code> | This JVM is downloaded to <code>$MINECRAFT_FOLDER/runtime/[javaVersion.component]/[OS]</code> |
Revision as of 19:00, 11 November 2022
Once the launcher has authenticated the user and downloaded the game, its next task is to start it. For this, it requires a few informations found in the version manifest.
Contents
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 advantages that it does not expects anything about the user's computer (Even if the player does not have Java installed, the game will run).
This 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
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}: 309 | The launcher name | @TODO: find outNeed to dig deeper |
-Dminecraft.launcher.version=${launcher_version}: 309 | The launcher version | @TODO: find outNeed to dig deeper |
-cp ${classpath} | List of all the absolute path for the jars to load (libraries + client.jar) separated by :
|
|
-Dos.name=Windows 10 -Dos.version=10.0 | Rule to be added only on Windows 10 | @TODO: find outNeed to dig deeper |
-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump | Apparently used to make the game run smoothly on Intel Graphics. No real information on thisNeed to dig deeper | |
-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 outNeed to dig deeper | @TODO: find outNeed to dig deeper |
--xuid ${auth_xuid} | @TODO: find outNeed to dig deeper | @TODO: find outNeed to dig deeper |
--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 outNeed to dig deeper |
--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 outNeed to dig deeper |
--accessToken ${auth_access_token} | The Mojang Access Token or the final token in the Microsoft authentication scheme | Authenticate with the game |
--userType ${user_type} | @TODO: find outNeed to dig deeper | @TODO: find outNeed to dig deeper |
--versionType ${version_type} | Not sure, 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) |
--width ${resolution_width} | Rule adding it only for "feature: has_custom_resolution"Need to dig deeper | Sets the game's width |
--height ${resolution_height} | Rule adding it only for "feature: has_custom_resolution"Need to dig deeper | Sets the game's height |
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 outNeed to dig deeper | @TODO: find outNeed to dig deeper |
--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.
Classname | Description |
---|---|
net.minecraft.client.main.Main | Used by most versions |
net.minecraft.launchwrapper.Launch | Used until 1.5.2, except 13w16b that for some reasons uses net.minecraft.client.main.Main |
com.mojang.minecraft.RubyDung | Used for really early versions |
com.mojang.rubydung.RubyDung | Used for really early versions |
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