DEV Community 👩‍💻👨‍💻

Cover image for Diff Decompiled Minecraft Versions
Caleb Sacks
Caleb Sacks

Posted on • Originally published at Medium

Diff Decompiled Minecraft Versions

⚠️ You cannot publish any of Minecraft's source code!

In this tutorial, we'll be using shulkr to see all the code changes introduced in the Wild Update for Minecraft: Java Edition.


Installing Shulkr

Shulkr lets you decompile, manage and compare multiple versions of Minecraft: Java Edition. It can be installed with pip:

pip install -U shulkr
Enter fullscreen mode Exit fullscreen mode

You will need Git and Python 3 installed to use it. (You will also need JDK 17 or later if you wish to use yarn mappings.)

Decompiling Minecraft 1.18.2

To start, let's decompile the last patch of the Caves & Cliffs update:

mkdir minecraft
cd minecraft
shulkr --mappings mojang 1.18.2
Enter fullscreen mode Exit fullscreen mode

This creates a git repo in the current directory with three commits:

$ git log --oneline
49f1ec5 (HEAD -> main, tag: 1.18.2) version 1.18.2
87b4c68 add .gitignore
51f09e4 add .shulkr
Enter fullscreen mode Exit fullscreen mode

The most recent commit is the only one that we care about. It adds a src directory with the client and server sources.

Shulkr's current default is to decompile Minecraft using yarn mappings. To use the official ones published by Mojang, we include --mappings mojang. We only need to supply this once per repo.

Decompiling Minecraft 1.19

Now, we have two options for decompiling the Wild Update. We could tell shulkr to decompile and commit each of 1.19's snapshots separately, or we could tell it to just generate 1.19 as a single commit.

Generating Each Snapshot Individually:

shulkr ...1.19
Enter fullscreen mode Exit fullscreen mode

Here, we use the snapshot range syntax to include every snapshot up until (and including) 1.19.

If we look at the commit history, we now see:

$ git log --oneline
75c1db5 (HEAD -> main, tag: 1.19) version 1.19
db6f94c (tag: 1.19-rc2) version 1.19-rc2
920103c (tag: 1.19-rc1) version 1.19-rc1
9b22ccc (tag: 1.19-pre5) version 1.19-pre5
92ccdc0 (tag: 1.19-pre4) version 1.19-pre4
86eeac5 (tag: 1.19-pre3) version 1.19-pre3
4e6b60f (tag: 1.19-pre2) version 1.19-pre2
e2f126e (tag: 1.19-pre1) version 1.19-pre1
7b2ed57 (tag: 22w19a) version 22w19a
d77b8bc (tag: 22w18a) version 22w18a
8c26849 (tag: 22w17a) version 22w17a
473997f (tag: 22w16b) version 22w16b
c2abe5b (tag: 22w16a) version 22w16a
1f1d0e3 (tag: 22w15a) version 22w15a
c9d0fbd (tag: 22w14a) version 22w14a
2461716 (tag: 22w13oneblockatatime) version 22w13oneblockatatime
ada384b (tag: 22w13a) version 22w13a
f149097 (tag: 22w12a) version 22w12a
e2f0705 (tag: 22w11a) version 22w11a
49f1ec5 (tag: 1.18.2) version 1.18.2
87b4c68 add .gitignore
51f09e4 add .shulkr
Enter fullscreen mode Exit fullscreen mode

Generating 1.19 as a Single Commit:

shulkr 1.19
Enter fullscreen mode Exit fullscreen mode

This command will run much faster than the previous one, because we're only decompiling one version. If we look at the commit history here, we see:

$ git log --oneline
e23cdba (HEAD -> main, tag: 1.19) version 1.19
49f1ec5 (tag: 1.18.2) version 1.18.2
87b4c68 add .gitignore
51f09e4 add .shulkr
Enter fullscreen mode Exit fullscreen mode

Comparing Versions

Now, we can see all the code that was changed in 1.19:

git diff 1.18.2 1.19
Enter fullscreen mode Exit fullscreen mode

To simply list the modified files, we can run:

git diff --stat 1.18.2 1.19
Enter fullscreen mode Exit fullscreen mode

Thank you for checking out this tutorial 😄 If anything goes wrong, please open an issue.

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.