zh_cn:tutorial:reading_mc_code
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
zh_cn:tutorial:reading_mc_code [2021/10/10 00:18] – created solidblock | zh_cn:tutorial:reading_mc_code [2023/08/29 10:28] (current) – [查找你想要看到的类] solidblock | ||
---|---|---|---|
Line 10: | Line 10: | ||
==== Intellij IDEA ==== | ==== Intellij IDEA ==== | ||
- | - 按 '' | + | - 按 {{https:// |
- 将搜索范围设为 '' | - 将搜索范围设为 '' | ||
- 在搜索框中输入类名称 | - 在搜索框中输入类名称 | ||
Line 21: | Line 21: | ||
===== 查找你想要看到的类 ==== | ===== 查找你想要看到的类 ==== | ||
- | Locating the part of code you want to see is a challenging task. Here are some tips. | + | 定位到你需要岔开的代码部分并不容易。这里是一些小技巧: |
- | + | ||
- | * 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 ('' | + | |
+ | * 充分利用 IDE 的查找相关代码的能力,如调用递归、方法递归、类型递归等。 | ||
+ | * 看看与你需要制作的模组类似地开源模组是怎么做的。 | ||
+ | * 如果你需要添加新内容,可以访问在 '' | ||
+ | * 记住一切都是从主类(客户端 '' | ||
+ | * 在 Minecraft 代码中查找翻译键。'' | ||
===== 阅读字节码 ===== | ===== 阅读字节码 ===== | ||
有时必须要阅读字节码,这是因为 | 有时必须要阅读字节码,这是因为 | ||
Line 33: | Line 33: | ||
* 反编译器(FernFlower)并不完美,有时会产生一些无效的 Java 代码,比如 '' | * 反编译器(FernFlower)并不完美,有时会产生一些无效的 Java 代码,比如 '' | ||
- | 如果你不熟悉 Java 字节码,请参考 [[https:// | + | 如果你不熟悉 Java 字节码,请参考 [[https:// |
查看字节码有以下步骤: | 查看字节码有以下步骤: | ||
Line 39: | Line 39: | ||
==== Intellij IDEA ==== | ==== Intellij IDEA ==== | ||
- 打开你需要查看字节码的类 | - 打开你需要查看字节码的类 | ||
- | - 从主菜单中选择 '' | + | - 从主菜单中选择 '' |
- | - 选择 '' | + | - 选择 '' |
==== 外部工具 ==== | ==== 外部工具 ==== |
zh_cn/tutorial/reading_mc_code.1633825125.txt.gz · Last modified: 2021/10/10 00:18 by solidblock