🇬🇧 English
🇬🇧 English
Appearance
🇬🇧 English
🇬🇧 English
Appearance
This page is written for version:
1.21.8
It's important to learn how to traverse the generate sources so that you can debug and get an understanding of the inner workings of Minecraft. Here we outline some common IDE usages.
Once sources are generated. it should be possible for you to search or view Minecraft classes.
Quick Open (Ctrl+P): Type #
followed by the class name (e.g. #Identifier
).
Go to Definition (F12): From source code, navigate to a class definition by Ctrl + clicking on its name, or by right-clicking it and selecting "Go to Definition".
You can find all usages of a class by right-clicking on a class name and clicking Find All References.
INFO
If the functions above do not work as expected, it's likely that sources are not attached properly. This can generally be fixed by cleaning up the workspace cache.
Viewing bytecode is necessary when writing mixins. However, Visual Studio Code lacks native support for bytecode viewing, and the few extensions which add it might not work.
In such case, you can use Java's inbuilt javap
to view bytecode.
Locate the path to Minecraft JAR:
Open the Explorer view, expand the Java Projects section. Expand the Reference Libraries node in the project tree and locate a JAR with minecraft-
in its name. Right-click on the JAR and copy the full path.
It might look something like this:
C:/project/.gradle/loom-cache/minecraftMaven/net/minecraft/minecraft-merged-503b555a3d/1.21.8-net.fabricmc.yarn.1_21_8.1.21.8+build.1-v2/minecraft-merged-503b555a3d-1.21.8-net.fabricmc.yarn.1_21_8.1.21.8+build.1-v2.jar
Run javap
:
You can then run javap
by providing the above path as the cp
(class path) and the fully qualified class name as the final argument.
javap -cp C:/project/.gradle/loom-cache/minecraftMaven/net/minecraft/minecraft-merged-503b555a3d/1.21.8-net.fabricmc.yarn.1_21_8.1.21.8+build.1-v2/minecraft-merged-503b555a3d-1.21.8-net.fabricmc.yarn.1_21_8.1.21.8+build.1-v2.jar -c -private net.minecraft.util.Identifier
This will print the bytecode in your terminal output.