Table of Contents

Reading the Minecraft source

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.

Searching for a Minecraft class

To search a Minecraft class, follow these steps.

Intellij IDEA

  1. Open the search pane with or on mac
  2. Set the search scope to Project and Libraries or wider
  3. Type the class name in the search box

Visual Studio Code

  1. Open the search pane with Ctrl + P
  2. Type the class name with prefix #

Eclipse

  1. Open the search pane with Ctrl + Shift + T

In Visual Studio Code, you can also use Ctrl + T to open the class search directly.

Finding the class you want to see

Locating the part of code you want to see is a challenging task. Here are some tips.

Reading the bytecode

Reading the bytecode is occasionally required because

If you are not familiar with the java bytecode, reference the JVM specification.

To see the bytecode, follow these steps.

Intellij IDEA

  1. Open the class of which you want to see the bytecode
  2. Select View from the main menu
  3. Select Show Bytecode

External Tools

If your IDE doesn't support bytecode viewing, use external bytecode viewers such as https://github.com/Konloch/bytecode-viewer.

FAQ

Where is 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.