反混淆名与 Javadocs
反混淆名是什么?
反混淆名是解释经混淆后的代码中各个名字(类、字段、方法、……)的含义的对照表合集。在这里,这个「混淆后的代码」指的自然是 Minecraft。
为什么?
计算机程序的本质是一系列指令。运行程序的本质是给计算机下命令:先做这个,再做这个,然后做这个,……
指令以(二进制)数字的形式表达。 在 20 世纪 50 年代时,程序员还需要手动写数字,比如打孔卡就是在卡片上打孔来表示数字,进而表示指令。
为了让代码不至于成为天书,人们发明了汇编。以「计算 1 + 1,并把结果存储起来」为例:
; 这是以数字形式呈现的指令
0000 0100
0000 0100
0110 0000
0011 0110 0001; 这是以数字形式呈现的指令
0000 0100
0000 0100
0110 0000
0011 0110 0001; 这是汇编语言写的上述指令(实际上只是 JVM 字节码。)
ICONST_1 ; 加号左边的 1
ICONST_1 ; 加号右边的 1
IADD ; 计算 1 + 1
ISTORE 1 ; 存储到「1 号格子」; 这是汇编语言写的上述指令(实际上只是 JVM 字节码。)
ICONST_1 ; 加号左边的 1
ICONST_1 ; 加号右边的 1
IADD ; 计算 1 + 1
ISTORE 1 ; 存储到「1 号格子」所以如果你不希望别人看懂你的代码,你可以考虑直接写数字。
后来人们发明了 BASIC、C 等语言,于是我们可以直接这样写:
int computationResult = 1 + 1; // 计算一加一,并把计算结果存储在名为「计算结果」的「格子」里。int computationResult = 1 + 1; // 计算一加一,并把计算结果存储在名为「计算结果」的「格子」里。然后把剩下的工作交给「翻译」(即编译器)处理就行了。
这个时候,如果你还希望不让别人看懂你写了什么,你就需要:
- 不要把源码给别人
- 搅乱「翻译」出来的结果
第二条就是所谓的「混淆」。混淆保证了其他人一开始只能复原出
int aaaaa = 1 + 1; // 这个 aaaaa 是啥?不知道啊?int aaaaa = 1 + 1; // 这个 aaaaa 是啥?不知道啊?然而其他人也可以大胆猜测:这个 aaaaa 代表了某种计算结果。 这个「猜测」的过程就是所谓的「反混淆」。反混淆让我们得以理解「代码在干什么」。
List
| Project Name | Initiator | Open to contribution? | License | Classes? | Methods? | Fields? | Parameters? | Local Var.? | Javadocs? | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| "MCP" (1) | MCP Team | Yes (via MCPBot) | N/A (2) | No (3) | Yes | Yes | Yes | No | Yes | Dead (4) |
| "BuildData" (5) | Spigot Team | ? (6) | ? (6) | Yes? | No? | No? | No | No | No | Unknown (6) |
| Yarn | FabricMC | Yes (via PR) | CC0-1.0 | Yes | Yes | Yes | Yes | No (7) | Yes | Active |
| Official Mapping | Mojang | No (Proprietary) | ARR | Yes | Yes | Yes | No | No | No | Active |
| Crane | Architectory | Yes (via PR) | ARR | No (8) | No (8) | No (8) | Yes | No | Yes | Active |
| Quilt Mapping | QuiltMC | Yes (via PR) | CC0-1.0 | Yes | Yes | Yes | Yes | No | Yes | Active |
| Parchment | ParchmentMC | Yes (via PR) | CC0-1.0 | No (8) | No (8) | No (8) | Yes | No | Yes | Active |
| Plasma (9) | M.C.L (10) | Yes (via PR) | CC0-1.0 | Yes? | Yes? | Yes | Yes? | No | Yes? | Stable? |
| Yarrn (11) | PhoenixVX | Yes (via PR) | CC0-1.0 | Yes? | Yes? | Yes | Yes? | No | Yes? | Stable? |
Special remarks:
- The name "MCP Mapping" is technically errorous: MCP Team has never given this crowdsourcing project (i.e. the MCPBot and its successor MCPBot Reborn) a specific name. Lex, leader of the Forge team who was also once a member of MCP team, personally uses "crowdsourced mapping" to refer to it when necessary. Nevertheless, it is a wildly accepted name used by several mapping look-up bots to denote the exports from MCPBot Reborn project.
- Exports of MCPBot has never been given a specific license, unlike the original MCP kit which includes a clearly written license.txt. Some consider this to be all-rights-reserved by default, while there are also community members who believe that these individual contributions are too small and too generic to be copyrightable.
- MCPBot does not crowdsource class names; they are from MCPConfig (also discussed above).
- Contrary to common belief, the so-called "MCP mapping" is not maintained by Forge team, but by the remnant of MCP team (specifically bspkrs; kashike also have access to its database; it is also said that cpw also have access, but it has never been verified). Therefore Forge team has no control over the crowdsourcing project. MCPBot_Reborn has never switched its target to 1.16 or onwards, despites kashike's claim of "I'm going to try and update MCPBot to 1.16 this weekend, fyi" made on Jun 25th, 2020. It fells into stagnation/hiatus until bspkrs announced its decomission on Nov 8th, 2021
- Neither Bukkit nor Spigot team has given this project a specific name. The name "BuildData" here refers to a project that contains data related to the name of a repository that contains mapping information related to Spigot building. In Bukkit/Spigot-based modders, this mapping is implied when using the term "NMS" (acronym of the
net.minecraft.serverpackage). - Little to no information has been disclosed about the generation and usage terms about this mapping.
- See FabricMC/Yarn#2362. However, it is technically possible to include local variable names (powered by TinyV2 format).
- Both Crane and Parchment are not standalone mapping systems. They are complementary to the "Official mapping" by its design. In Fabric Loom's terminology, they are cases of "layered mapping".
- Formerly "Minecraft Cursed POMF", a parody on both POMF ("Public Open Mapping Filed", old name used by Yarn until Dec. 2018) and MCP (sharing the same acronym). Only targets beta-1.7.3 for now.
- Full name "Minecraft Cursed Legacy". This is a project aiming at providing modding toolchains on "legacy versions", currently beta-1.7.3 only.
- Also known as "Yarn-Indev". It is a set of mapping files targeting Minecraft Indev. https://github.com/PhoenixVX/Indev-Yarn