Reading the Minecraft source is an important skill in modding. This is mainly because
To read the Minecraft source, you need to generate sources first. See the “Generating Minecraft Sources” section in Setting up a mod development environment.
To search a Minecraft class, follow these steps.
Project and Libraries
or widerCtrl + P
#
Ctrl + Shift + T
In Visual Studio Code, you can also use Ctrl + T
to open the class search directly.
Locating the part of code you want to see is a challenging task. Here are some tips.
Call hierarchy
, Method hierarchy
or Type hierarchy
.net.minecraft.util.registry.Registries
.net.minecraft.client.main.Main
for client, net.minecraft.server.Main
for dedicated server).assets/assets/minecraft/lang/en_us.json
contains all keys used in vanilla.Reading the bytecode is occasionally required because
int i = true;
.If you are not familiar with the java bytecode, reference the JVM specification.
To see the bytecode, follow these steps.
View
from the main menuShow Bytecode
If your IDE doesn't support bytecode viewing, use external bytecode viewers such as https://github.com/Konloch/bytecode-viewer.
Where are the generated sources?
It's either in the user gradle cache (~/.gradle/caches/fabric-loom
) or in the project gradle cache (./.gradle/loom-cache
).
You can use the sources jar outside of your IDE.