tutorial:reading_mc_code
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:reading_mc_code [2021/10/01 15:19] – add how to open the bytecode siglong | tutorial:reading_mc_code [2024/08/02 05:39] (current) – is -> are skycatminepokie | ||
---|---|---|---|
Line 6: | Line 6: | ||
To read the Minecraft source, you need to generate sources first. See the " | To read the Minecraft source, you need to generate sources first. See the " | ||
- | ===== Searching for a Minecraft class ==== | + | ===== Searching for a Minecraft class ===== |
To search a Minecraft class, follow these steps. | To search a Minecraft class, follow these steps. | ||
- | ==== Intellij IDEA ==== | + | ===== Intellij IDEA ===== |
- | - Open the search pane with '' | + | - Open the search pane with {{https:// |
- Set the search scope to '' | - Set the search scope to '' | ||
- Type the class name in the search box | - Type the class name in the search box | ||
- | ==== Visual Studio Code ==== | + | ===== Visual Studio Code ===== |
- Open the search pane with '' | - Open the search pane with '' | ||
- Type the class name with prefix ''#'' | - Type the class name with prefix ''#'' | ||
+ | |||
+ | ===== Eclipse ===== | ||
+ | - Open the search pane with '' | ||
In Visual Studio Code, you can also use '' | In Visual Studio Code, you can also use '' | ||
- | ===== Tips ====== | + | ===== Finding the class you want to see ==== |
- | * If you don't know what class to read, take a look at open source mods which are similar to what you want to make. | + | Locating the part of code you want to see is a challenging task. Here are some 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. | + | |
- | * Generated sources is located at the user gradle cache (i.e. '' | + | |
+ | * Take full advantage of IDE's ability to find the relevant code such as '' | ||
+ | * Take a look at open source mods which are similar to what you want to make. | ||
+ | * If you are adding a new content, there is a good chance you need to access registries defined in '' | ||
+ | * Keep in mind that everything starts from one main class ('' | ||
+ | * Search Minecraft code for translation keys. '' | ||
- | ==== Reading the bytecode ==== | + | ===== Reading the bytecode |
Reading the bytecode is occasionally required because | Reading the bytecode is occasionally required because | ||
* Mixin operates on bytecode, not the source code. Understanding the bytecode is essential when you write a complex mixin. | * Mixin operates on bytecode, not the source code. Understanding the bytecode is essential when you write a complex mixin. | ||
- | * Decompiler (FernFlower) is not perfect. It sometimes | + | * Decompiler (FernFlower) is not perfect. It sometimes |
- | To open the bytecode, | + | If you are not familiar with the java bytecode, |
- | === Intellij IDEA === | + | To see the bytecode, follow these steps. |
+ | |||
+ | ==== Intellij IDEA ==== | ||
- Open the class of which you want to see the bytecode | - Open the class of which you want to see the bytecode | ||
- Select '' | - Select '' | ||
- Select '' | - Select '' | ||
- | === External Tools === | + | ==== External Tools ==== |
- | If your IDE or editor | + | If your IDE doesn' |
+ | |||
+ | ===== FAQ ===== | ||
+ | **Where are the generated sources? | ||
+ | |||
+ | It's either in the user gradle cache ('' | ||
+ | You can use the sources jar outside of your IDE. | ||
tutorial/reading_mc_code.1633101581.txt.gz · Last modified: 2021/10/01 15:19 by siglong