Minecraft Wiki
Advertisement
Paper
The contents of this page are not supported by Mojang Studios or the Minecraft Wiki. 
Information icon
This tutorial is exclusive to Java Edition. 

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 decompiler, it is possible to reconstruct human-readable Java 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 version_manifest.json.

Once you have found the JSON file corresponding to the version you want to decompile, locate the  client_mappings or  server_mappings field (depending on which side you want to decompile) under the  downloads field and download the file from the URL inside the  url field.

Deobfuscating JAR[]

Paper
The contents of this section are not supported by Mojang Studios or the Minecraft Wiki.

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:

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:

  • <path to JAR file> is replaced by the path to a version's obfuscated JAR file;
  • <path to deobfuscated JAR file> is replaced by the path of the JAR file to output;
  • <path to mappings> 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 SpecialSource-1.10.0.jar;*;. inside double quotes.

Note[]

Obfuscation maps provided by Mojang do not include local variable names. The --kill-lvt ("kill local variable table") option tells SpecialSource not to try to remap local variable names.

Decompiling JAR[]

Paper
The contents of this section are not supported by Mojang Studios or the Minecraft Wiki.

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:

  • <path to JAR file> is replaced by the path to a version's deobfuscated JAR file;
  • <path to directory> is replaced by the path to the directory you want the source code to be in.


Useful tools[]

Paper
The contents of this section are not supported by Mojang Studios or the Minecraft Wiki.

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.

Advertisement