How do I dump a minecraft server jar?

Discussion in 'Programming' started by N0TKingminer7, Sep 12, 2021.

  1. Hey, I want to dump a minecraft server jar, but I can't figure out how. It always ends up just dumping .class files, and I need .java files, as I want to modify some parts of the server. Anyone know how to dump it? I don't care if it's a link to a tutorial or something else, I just want to know how.

  2. Strahan


    • Like Like x 1
  3. While the Spigot API & Implementation are open source, the code written by Mojang is not open source and gets obfuscated to make it harder to reverse engineer. There are official mappings provided to recover the original names of methods and fields (take a look at, but you will need to use a decompiler to recover legible code.

    Outside of specific use cases though, (assuming for creating plugins) you shouldn't need to modify the server itself
    • Like Like x 1
  4. Java compiles to bytecode in the form of class files. The JVM transforms this at runtime to native code, but that's besides the point here.

    You cannot get the official Minecraft server source code as it was written by Mojang. And to make modifications to the server decompiling and recompiling is a long and tedious process. I would hardly reccomend it. However if you insist, the best bet you have is to use the official mappings and apply them to the server jar, then decompile the mapped classes. My tool is capable of mapping Java applications, editing the jar in its binary format (Meaning you don't technically have to even decompile everything), and even doing batch-decompiles with the help of a plugin:

    Basically the steps for full decompile-recompile are:
    1. Drop the server jar into Recaf
    2. Download the server mappings file from Mojang (you can find the link to the mappings in your minecraft version jsons, its called server_mappings)
    3. Use the mapping menu in Recaf and select Proguard (because this is the format Mojang's mappings are released in) and select the mappings file
    4. Wait for them to be applied
    5. Use the batch decompile plugin to decompile everything.
    This will decompile every class file in the jar with the official Mojang mappings applied. Now remember, decompiling Java does result in human legible code most of the time, but it is rarely perfect. There may be some odd quirks in the decompiled code that may not even be immediately obvious. This approach is generally a really bad idea.
    • Like Like x 1