User Tools

Site Tools


mod_development:decompiling

Preface

Minecraft uses a programming language called Java. The advantages of this are that it works on many kinds of systems and that it is fairly easy to decompile and modify. All(?) the Minecraft code is stored inside a JAR file (Java ARchive) which contains class files (compiled JAVA files). These class files are obfuscated which means that the purpose of the code within has been concealed. This code must be decompiled and deobfuscated in order to be modified. 1)

Requirements

  • JDK (Java Development Kit). Version 8 is recommended.

One of:

  • LTS (MCP with Long Term Service). Recommended.
  • MCP (Minecraft Coder Pack) Use this if LTS doesn't support the version you are using or doesn't work for some other reason.

Instructions

After installing JDK, follow the instructions below depending on your choice of coder pack.

LTS

  1. Download LTS by following the link above and clicking the green button named 'Clone or download', then 'Download ZIP'.
  2. Export your LTS-master.zip to somewhere sensible (this will contain all your development files).
  3. In the newly exported folder, run setup.bat or setup.sh depending on your OS (Use .bat on Windows).
  4. Enter 'y' in the newly opened console to confirm the action.
  5. Choose the version you wish to compile by entering it's name.
  6. After it is finished you may need to refresh the folder to see the new files.
  7. (Optional) If decompiling a mod, apply it to the relevant jar in the jars folder.
  8. Run the decompile.bat/sh file that has generated.

MCP

  1. Download the appropriate version of MCP for your Minecraft version via the link above.
  2. Export the zip to somewhere sensible (this will contain all your development files).
  3. In the newly exported folder, insert minecraft_server.jar and the bin folder from your .minecraft into the folder named '/jars'. You'll need to provide your own bin folder with the jinput, lwjgl, lwjgl_util, and natives folder in it, as we cannot redistribute these. These files can be obtained by running the legacy Minecraft launcher with a jar for the correct version. If you only wish to decompile the client, the server jar is not required. Alternatively you can use setup.bat/sh in LTS to obtain these files and copy them over to your MCP folder.
  4. Open /runtime/decompile.py with a text editor of your choice and remove line 15: commands.checkupdates()
  5. (Optional) If decompiling a mod, apply it to the relevant jar in the /jars folder.
  6. Run the decompile.bat/sh file that has generated.
1)
You can edit class files directly with bytecode editing but this is a difficult alternative only useful in certain circumstances.
mod_development/decompiling.txt · Last modified: 2020/02/13 21:39 by rek