Difference between revisions of "Game files"

From wiki.vg
Jump to navigation Jump to search
m (→‎Game: typo)
(Clarifying the java version)
 
(40 intermediate revisions by 24 users not shown)
Line 1: Line 1:
 
== Game ==
 
== Game ==
All available version of the game itself are listed on
 
  http://s3.amazonaws.com/Minecraft.Download/versions/versions.json
 
  
The jar file for a specific version is located at
+
All available versions of the game itself are listed on
  http://s3.amazonaws.com/Minecraft.Download/versions/<version>/<version>.jar
 
  
Some information on how to properly run said jar is available at
+
https://piston-meta.mojang.com/mc/game/version_manifest_v2.json
  http://s3.amazonaws.com/Minecraft.Download/versions/<version>/<version>.json
+
 
 +
The location of the information JSON file for a specific version is included in the version manifest above, which includes requirements to run the client, ''minimumLauncherVersion'', and the download link for the server, client, and assets.
 +
 
 +
{{Warning2 | Do not use the old endpoint (<nowiki>https://s3.amazonaws.com/Minecraft.Download</nowiki>) as it has been disabled indefinitely.}}
  
 
== Libraries ==
 
== Libraries ==
The libraries which can be used for all minecraft versions and are downloaded by the launcher are located at
+
The libraries which can be used for all Minecraft versions and are downloaded by the launcher are located at
   http://s3.amazonaws.com/MinecraftDownload/
+
 
 +
https://libraries.minecraft.net/
 +
 
 +
The JSON file downloaded above is used in order to determine which libraries to download. Inside the file is a key, <code>libraries</code> which contains information about each library required.
 +
Example:
 +
<syntaxhighlight lang="javascript">
 +
{
 +
  "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1-nightly-20130708-debug3",
 +
  "natives": {
 +
    "linux": "natives-linux",
 +
    "windows": "natives-windows",
 +
    "osx": "natives-osx"
 +
  },
 +
  "extract": {
 +
    "exclude": [
 +
      "META-INF/"
 +
    ]
 +
  },
 +
  "rules": [
 +
    {
 +
      "action": "allow",
 +
      "os": {
 +
        "name": "osx",
 +
        "version": "^10\\.5\\.\\d$"
 +
      }
 +
    }
 +
   ]
 +
}
 +
</syntaxhighlight>
 +
 
 +
The <code>name</code> key is used to determine the url from which to download the library from. The format of this string is
 +
<package>:<name>:<version>
 +
The corresponding URL would look like this:
 +
https://libraries.minecraft.net/<package>/<name>/<version>/<name>-<version>.jar
 +
where <code>path</code> is the result of replacing all the periods in <code>package</code> with slashes.
 +
 
 +
It also download a hash, in sha1, the url is:
 +
https://libraries.minecraft.net/<package>/<name>/<version>/<name>-<version>.jar.sha1
 +
 
 +
{{Warning | http://libraries.minecraft.net/ will NOT work - you must use https}}
 +
 
 +
The <code>natives</code> key provides a string for each specific platform to be inserted between the .jar and the <version> of the filename, resulting in a filename with the format:
 +
<name>-<version>-<native-string>.jar
 +
This is applied to any file with the <code>natives</code> key.
 +
 
 +
The natives string may contain <code>${arch}</code>, which should be replaced with <code>32</code> or <code>64</code>.
 +
 
 +
The <code>extract</code> key provides rules for the extraction of the file.
 +
 
 +
The <code>rules</code> key is used to determine which platforms to download the file to. When the <code>action</code> is <code>allow</code>, the file will be downloaded to the platform stated in <code>os</code>. When the <code>action</code> is <code>disallow</code>, the file will not be downloaded to the platform stated in <code>os</code>. If there is no <code>os</code> key, the rule is default for non-specified platforms.
 +
 
 +
In the example above, on an OS X platform, the full download path would be
 +
https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.1-nightly-20130708-debug3/lwjgl-platform-2.9.1-nightly-20130708-debug3-natives-osx.jar
 +
The file would be extracted but the <code>META-INF</code> file would not be. Additionally, the file would only be downloaded if the computer was running OS X 10.5.
 +
 
 +
== Assets ==
 +
The game itself downloads (through the launcher) further resources from
 +
https://resources.download.minecraft.net/
 +
 
 +
{{Warning | http://resources.download.minecraft.net/ no longer works - you must use https}}
 +
 
 +
The asset index for each version is linked in the <version>.json. An example url to the asset index could look like this
 +
https://launchermeta.mojang.com/mc/assets/1.12/67e29e024e664064c1f04c728604f83c24cbc218/1.12.json
 +
 
 +
Each resource in the file has a name (the field name of the resource object), a SHA1 hash, and a file size.  The client currently downloads all resources in the index from
 +
https://resources.download.minecraft.net/<first 2 hex letters of hash>/<whole hash>
 +
and stores them in
 +
.minecraft/assets/objects/<first 2 hex letters of hash>/<whole hash>
 +
and a copy is stored in
 +
.minecraft/assets/virtual/legacy/
 +
in the old format for versions that don't support the new system (1.7 and below)
 +
 
 +
=== Utilities ===
 +
* [https://github.com/rmheuer/McAssetExtractor McAssetExtractor] (Java) A tool to download and extract assets from Mojang's API
 +
 
 +
== Java version ==
 +
 
 +
The electron launcher installs Java on your computer so that the player doesn't have anything to do, and so that they can compile the game for the version they want while it being seemless for the end user.
 +
 
 +
In the manifest for a given version, you can find the key javaVersion which tells you which component and major version you need. The launcher then goes to the main manifest URL for the JRE:
 +
  https://launchermeta.mojang.com/v1/products/java-runtime/2ec0cc96c44e5a76b9c8b7c39df7210883d12871/all.json
 +
 
 +
This can be found using the following command:
 +
<code>
 +
$ strings ~/.minecraft/launcher/liblauncher.so | grep java-runtime
 +
</code>
  
The following files are downloaded from this location:
+
The launcher selects the correct operating system, component and version from this file and downloads the related URL to have the list of files and additional info about them:
 +
<syntaxhighlight lang="javascript">
 +
"files": {
 +
    "COPYRIGHT": {
 +
      "downloads": {
 +
        "lzma": {
 +
          "sha1": "121e5d017acbfaed2649d57513df0a6b35dd48f3",
 +
          "size": 1431,
 +
          "url": "https://piston-data.mojang.com/v1/objects/121e5d017acbfaed2649d57513df0a6b35dd48f3/COPYRIGHT"
 +
        },
 +
        "raw": {
 +
          "sha1": "1909c04288dd294dd539723c0ca3289656ade95d",
 +
          "size": 3244,
 +
          "url": "https://piston-data.mojang.com/v1/objects/1909c04288dd294dd539723c0ca3289656ade95d/COPYRIGHT"
 +
        }
 +
      },
 +
      "executable": false,
 +
      "type": "file"
 +
    },
 +
    [...]
 +
}
 +
</syntaxhighlight>
  
* <code>lwjgl.jar</code>
+
It then creates a folder located at <code>$HOME/.minecraft/runtime/[COMPONENT]/[OS]/</code>.
* <code>jinput.jar</code>
 
* <code>lwjgl_util.jar</code>
 
* <code>minecraft.jar</code>
 
* <code><operating system>_natives.jar.lzma</code>
 
  
The latter is available for the following operating systems:
+
The component is a given fixed Java version used by Mojang. For example, on Linux, the <code>java-runtime-alpha</code> is the "Mojang name" for <code>16.0.1.9.1</code>.
* <code>windows</code>
 
* <code>linux</code>
 
* <code>macosx</code>
 
* <code>solaris</code>
 
  
== Resources ==
+
In this folder you can find a subfolder <code>[COMPONENT]</code> and a file <code>[COMPONENT].sha1</code>. The files downloaded from the JRE manifest are stored in the subfolder and the sha1 file contains the list of the file associated with their hash.
The game itself downloads further resources from
 
  http://s3.amazonaws.com/MinecraftResources/
 
  
A list of all available resources is available as an XML file at the address above.
+
The launcher then simply uses the correct executable when running an instance of the game.
  
  
 
[[Category:Minecraft Modern]]
 
[[Category:Minecraft Modern]]

Latest revision as of 01:30, 22 November 2023

Game

All available versions of the game itself are listed on

https://piston-meta.mojang.com/mc/game/version_manifest_v2.json

The location of the information JSON file for a specific version is included in the version manifest above, which includes requirements to run the client, minimumLauncherVersion, and the download link for the server, client, and assets.

Warning.png Do not use the old endpoint (https://s3.amazonaws.com/Minecraft.Download) as it has been disabled indefinitely.

Libraries

The libraries which can be used for all Minecraft versions and are downloaded by the launcher are located at

https://libraries.minecraft.net/

The JSON file downloaded above is used in order to determine which libraries to download. Inside the file is a key, libraries which contains information about each library required. Example:

{
  "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1-nightly-20130708-debug3",
  "natives": {
    "linux": "natives-linux",
    "windows": "natives-windows",
    "osx": "natives-osx"
  },
  "extract": {
    "exclude": [
      "META-INF/"
    ]
  },
  "rules": [
    {
      "action": "allow",
      "os": {
        "name": "osx",
        "version": "^10\\.5\\.\\d$"
      }
    }
  ]
}

The name key is used to determine the url from which to download the library from. The format of this string is

<package>:<name>:<version>

The corresponding URL would look like this:

https://libraries.minecraft.net/<package>/<name>/<version>/<name>-<version>.jar

where path is the result of replacing all the periods in package with slashes.

It also download a hash, in sha1, the url is:

https://libraries.minecraft.net/<package>/<name>/<version>/<name>-<version>.jar.sha1

Warning.png http://libraries.minecraft.net/ will NOT work - you must use https

The natives key provides a string for each specific platform to be inserted between the .jar and the <version> of the filename, resulting in a filename with the format:

<name>-<version>-<native-string>.jar

This is applied to any file with the natives key.

The natives string may contain ${arch}, which should be replaced with 32 or 64.

The extract key provides rules for the extraction of the file.

The rules key is used to determine which platforms to download the file to. When the action is allow, the file will be downloaded to the platform stated in os. When the action is disallow, the file will not be downloaded to the platform stated in os. If there is no os key, the rule is default for non-specified platforms.

In the example above, on an OS X platform, the full download path would be

https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.1-nightly-20130708-debug3/lwjgl-platform-2.9.1-nightly-20130708-debug3-natives-osx.jar

The file would be extracted but the META-INF file would not be. Additionally, the file would only be downloaded if the computer was running OS X 10.5.

Assets

The game itself downloads (through the launcher) further resources from

https://resources.download.minecraft.net/

Warning.png http://resources.download.minecraft.net/ no longer works - you must use https

The asset index for each version is linked in the <version>.json. An example url to the asset index could look like this

https://launchermeta.mojang.com/mc/assets/1.12/67e29e024e664064c1f04c728604f83c24cbc218/1.12.json

Each resource in the file has a name (the field name of the resource object), a SHA1 hash, and a file size. The client currently downloads all resources in the index from

https://resources.download.minecraft.net/<first 2 hex letters of hash>/<whole hash>

and stores them in

.minecraft/assets/objects/<first 2 hex letters of hash>/<whole hash>

and a copy is stored in

.minecraft/assets/virtual/legacy/ 

in the old format for versions that don't support the new system (1.7 and below)

Utilities

Java version

The electron launcher installs Java on your computer so that the player doesn't have anything to do, and so that they can compile the game for the version they want while it being seemless for the end user.

In the manifest for a given version, you can find the key javaVersion which tells you which component and major version you need. The launcher then goes to the main manifest URL for the JRE:

 https://launchermeta.mojang.com/v1/products/java-runtime/2ec0cc96c44e5a76b9c8b7c39df7210883d12871/all.json

This can be found using the following command: $ strings ~/.minecraft/launcher/liblauncher.so | grep java-runtime

The launcher selects the correct operating system, component and version from this file and downloads the related URL to have the list of files and additional info about them:

"files": {
    "COPYRIGHT": {
      "downloads": {
        "lzma": {
          "sha1": "121e5d017acbfaed2649d57513df0a6b35dd48f3",
          "size": 1431,
          "url": "https://piston-data.mojang.com/v1/objects/121e5d017acbfaed2649d57513df0a6b35dd48f3/COPYRIGHT"
        },
        "raw": {
          "sha1": "1909c04288dd294dd539723c0ca3289656ade95d",
          "size": 3244,
          "url": "https://piston-data.mojang.com/v1/objects/1909c04288dd294dd539723c0ca3289656ade95d/COPYRIGHT"
        }
      },
      "executable": false,
      "type": "file"
    },
    [...]
}

It then creates a folder located at $HOME/.minecraft/runtime/[COMPONENT]/[OS]/.

The component is a given fixed Java version used by Mojang. For example, on Linux, the java-runtime-alpha is the "Mojang name" for 16.0.1.9.1.

In this folder you can find a subfolder [COMPONENT] and a file [COMPONENT].sha1. The files downloaded from the JRE manifest are stored in the subfolder and the sha1 file contains the list of the file associated with their hash.

The launcher then simply uses the correct executable when running an instance of the game.