Tutorials/See Minecraft's code

Since snapshot 19w36a, Mojang releases obfuscation maps for every version available in the launcher. Those maps can be used to deobfuscate a version's JAR file, that is to say, replace obfuscated class names and class member names with their original (deobfuscated) names. Using a , it is possible to reconstruct human-readable code.
== Disclaimer ==
According to the license, decompiling Minecraft is allowed, but it is recommended not to release decompiled code. Furthermore, a tweet from Dinnerbone suggests usage of the mappings inside of projects by the community, such as modding (using them to decompile Minecraft for usage with Forge, Fabric, Quilt and other modloaders) or for usage in server software with plugins (such as Spigot, Bukkit, Paper, and others) is okay, and an intended use. It should be noted however that this tweet is not legally withstanding, so while it is probably fine to use these mappings for such purposes, you do so at your own risk. This can be extended to decompiling and accessing Minecraft's code as a whole, the only things you cannot do under any circumstances are releasing the code or releasing something that contains an exact copy of the code.
==Downloading obfuscation map==
Every version's JSON file contains a link to the obfuscation maps for that version since 19w36a. The JSON file for a version can be found in the .
Once you have found the JSON file corresponding to the version you want to decompile, locate the or field (depending on which side you want to decompile) under the field and download the file from the URL inside the field.
==Deobfuscating JAR==
To deobfuscate a JAR file, you need a program that takes the JAR file and its corresponding obfuscation map as inputs, and returns a deobfuscated JAR file. A free and open source program you can use is SpecialSource. You can download the latest version on Maven.
You don't actually need to download every dependency to get SpecialSource to run. Here is the list of the dependencies required for version 1.10.0 to work:
* SpecialSource 1.10.0 (.jar), available under BSD 3-Clause License;
* Guava 20.0 (.jar), available under Apache License, Version 2.0;
* JOpt Simple 4.9 (.jar), available under MIT License;
* ASM Commons 9.1 (.jar), available under BSD 3-Clause License;
* ASM 9.1 (.jar), available under BSD 3-Clause License;
* ASM Tree 9.1 (.jar), available under BSD 3-Clause License;
* ASM Analysis 9.1 (.jar), available under BSD 3-Clause License.
To use SpecialSource to decompile a JAR file, download all the dependencies above in the same directory and run the following command inside this directory:
 java -cp SpecialSource-1.10.0.jar;*;. net.md_5.specialsource.SpecialSource --in-jar <path to JAR file> --out-jar <path to deobfuscated JAR file> --srg-in <path to mappings> --kill-lvt
Where:
* is replaced by the path to a version's obfuscated JAR file;
* is replaced by the path of the JAR file to output;
* is replaced by the path to the version's obfuscation map.
If running under Linux or macOS, replace the semicolons with colons before running it. If running in PowerShell, place inside double quotes.
===Note===
Obfuscation maps provided by Mojang do not include local variable names. The ("kill local variable table") option tells SpecialSource not to try to remap local variable names.
== Decompiling JAR==
Now that you have a deobfuscated JAR file, you can use a decompiler to reconstruct source code from this file. The produced source code should be valid Java code, but is not the original code of the game. A decompiler is unable to reconstruct the original code, it can only try to produce valid code that matches what the compiled file does.
There are many Java decompilers available. CFR is a free and open source option available under the MIT License. You can download CFR 0.152 on Maven (.jar). 0.152 is the version that seems to give the best results when decompiling recent versions of Minecraft. To decompile a JAR file with CFR, run the following command:
 java -jar cfr-0.152.jar <path to JAR file> --outputdir <path to directory>
Where:
* is replaced by the path to a version's deobfuscated JAR file;
* is replaced by the path to the directory you want the source code to be in.
==Useful tools==
The community has made some tools to simplify the process of deobfuscating and decompiling Minecraft. For example, you can use DecompilerMC to decompile any version automatically.