For a long time, I have been a fan of the popular block game Minecraft and I always was wondering how does it work?

I have been trying to find a way to see the code of Minecraft but I couldn’t find a way to do it.

Then I found a video by LiveOverflow where he reversed engineered Minecraft code and explains how it works.

I was very interested in this and I wanted to try it out myself.

So I Used something called Yarn which is a set of open Minecraft mappings, free for everyone to use. The intention is to let everyone mod Minecraft freely and openly, while also being able to innovate and process the mappings as they see fit.

Yarn has also something called mapNamedJar which is a command you can use with Gradle to generate a named jar file so you can decompile the jar file and have all of Minecraft’s code.


What is Gradle?

Gradle is a build automation tool known for its flexibility to build software. A build automation tool is used to automate the creation of applications. The building process includes compiling, linking, and packaging the code. The process becomes more consistent with the help of build automation tools. Gradle is widely used for mod/plugin development in Minecraft.

What are mappings?

Mappings define the names of classes, fields and methods. So instead of having random letters you can have readable classes.

So I used the command ./gradlew mapNamedJar and it generated a jar file called named.jar which I decompiled using vscode-decompiler.

This can be very useful in the long term as I can use this to make my own mods for Minecraft and also try to understand how Minecraft works!

Another thing I found was something called Mixins which is a library that allows you to modify the code of Minecraft without having to recompile it.

Mixin is a feature made by SpongePowered which is a Minecraft modding API.

Here is another Video by LiveOverflow where he explains how Mixins works. Its a very good video and I recommend you to watch it!

I think learning things from something you enjoy for example Minecraft is a amazing way to learn.

By reading Minecraft code and using Mixins I understood how Multiplayer works and how Minecraft handles network packets which is pretty fascinating.

Well, I hope you enjoyed this post sorry that it was a bit short.

Thank you for reading :D