tutorial:reading_mc_code
This is an old revision of the document!
Table of Contents
Reading the Minecraft source
Reading the Minecraft source is an important skill in modding. This is mainly because
- Most of the Minecraft things are not documented
- Documentations/tutorials get outdated fairly quickly
To read the Minecraft source, you need to generate sources first. See the “Generating Minecraft Sources” section in Setting up a mod development environment.
Searching for a Minecraft class
To search a Minecraft class, follow these steps.
Intellij IDEA
- Open the search pane with
Ctrl + N
- Set the search scope to
Project and Libraries
or wider - Type the class name in the search box
Visual Studio Code
- Open the search pane with
Ctrl + P
- Type the class name with prefix
#
Or:
- You can also use
Ctrl + T
to open the class search directly.
Tips
- When you find a method or class but don't understand what they are doing, check the usages or subclasses of them. You might need to check the usages of the usages and such.
- You may find an invalid java code such as
int i = true;
. This is because the decompiler we use is not perfect. Check the corresponding part of bytecodes if needed. - Generated sources is located at the user gradle cache (i.e.
~/.gradle/caches/fabric-loom
). If you want to use external tools to mess around with Minecraft source, you can use the sources jar.
tutorial/reading_mc_code.1631983616.txt.gz · Last modified: 2021/09/18 16:46 by jummit