神秘时代 aspects 集成
基本信息
| 属性 | 值 |
|---|---|
| 插件类 | mods.natura.plugins.thaumcraft.ThaumcraftPulse(295 行) |
@Pulse id |
"Natura Thaumcraft Compatibility" |
modsRequired |
"Thaumcraft"(ThaumcraftPulse.java:22) |
registerObjectTag 调用 |
68 处(grep -c 'registerObjectTag' ThaumcraftPulse.java) |
harvestClickableCrop 调用 |
9 处;另有 1 处 harvestStandardCrop |
| 异常处理 | postInit 整体 try/catch,失败仅 logger.warn("ThaumCraft integration failed.", e)(:290-292) |
功能
这个插件做两件事:把 Natura 的植物、树木与物品打上神秘时代 aspect 标签,以及把浆果丛与作物注册为神秘时代的可点击收获作物。
它有两个生命周期方法,分工明确:
| 方法 | 行号 | 做什么 |
|---|---|---|
@Handler init(FMLInitializationEvent) |
:23-47 |
只发 harvestClickableCrop / harvestStandardCrop 的 IMC 消息 |
@Handler postInit(FMLPostInitializationEvent) |
:49-294 |
先 Class.forName("thaumcraft.api.ThaumcraftApi")(:51),再打全部 68 条 aspect 标签 |
用 postInit 而非 init 是因为 aspect 标签需要对方(神秘时代)先完成自己的物品注册。
一、可点击收获作物(init)
FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", ...) 共 9 条,发的是收获用 meta(12 起的高位编号段,与下面 aspect 用的 meta 是两套编号):
| 目标方块 | 发出的 meta | 生效条件 |
|---|---|---|
berryBush |
12、13、14、15 | PHNatura.enableBerryBushes |
netherBerryBush |
12、13、14、15 | PHNatura.enableNetherBerryBushes |
crops |
8 | 无条件 |
另有一条 harvestStandardCrop:crops meta 3(ThaumcraftPulse.java:46)。
二、aspect 标签(postInit)
Natura 不新增 aspect,只使用神秘时代自带的 aspect,把物品打上 1–5 个标签与数量。
种子与植物产物
| 物品 | meta | aspect |
|---|---|---|
seeds |
0、1 | PLANT 1 + EXCHANGE 1(seedTags) |
plantItem |
0 | LIFE 2 + CROP 2 |
plantItem |
3 | CLOTH 1 |
plantItem |
4 | ENTROPY 1 + FIRE 1 |
plantItem |
5 | AIR 1 + FLIGHT 1 |
plantItem |
6 | BEAST 1 + FLESH 1 + CLOTH 1 + ARMOR 1 + FIRE 1 |
plantItem |
7 | BEAST 1 + CLOTH 1 + TRAP 1 + FIRE 1 |
原木
logTags 定义为 TREE 4(:81-82),复用于多处:
| 方块 | meta | aspect |
|---|---|---|
tree |
0、1、3 | logTags |
willow |
0、1 | logTags |
redwood |
1 | logTags |
rareTree |
0–3 | logTags(循环 :110-113) |
单独给标签的:
| 方块 | meta | aspect |
|---|---|---|
redwood |
0 | ARMOR 1 + TREE 3 |
redwood |
2 | EARTH 1 + TREE 3 |
下界原木另有独立标签:
| 方块 | meta | aspect |
|---|---|---|
tree |
2 | TREE 3 + SOUL 1 |
darkTree |
0 | TREE 4 |
darkTree |
1 | TREE 4 + ENTROPY 2 |
bloodwood |
0 | TREE 2 + ENERGY 2 + METAL 1 |
bloodwood |
15 | TREE 2 + ENERGY 2 + METAL 1 |
planks |
2 | TREE 1 |
planks |
4 | TREE 1 + METAL 1 |
[!NOTE]
bloodwood的 meta 15 与redwood的 meta 0/1/2 是源码原样给出的取值。这里如实记录,不作「订正」。
树叶
leafTags 定义为 PLANT 2(:99):
| 方块 | meta | aspect |
|---|---|---|
floraLeavesNoColor |
0、1 | leafTags |
floraLeavesNoColor |
2 | TREE 2 + METAL 1 |
floraLeaves |
0–3 | leafTags |
rareLeaves |
0–3 | leafTags(循环 :110-113) |
darkLeaves |
0、1 | leafTags |
darkLeaves |
2 | PLANT 2 + CROP 2 |
darkLeaves |
3 | PLANT 2 + ENTROPY 1 |
蘑菇
shroomTag = PLANT 4 + LIGHT 1 + SOUL 1,打在 glowshroom 的 meta 0–2(大型蘑菇)。
浆果与浆果丛(PHNatura.enableBerryBushes 包裹)
berryTag = LIFE 1 + CROP 1;berryBushTag = PLANT 1。分别打在 berryItem 与 berryBush 的 meta 0–3。
碗与炖菜
| 物品 | meta | aspect |
|---|---|---|
bowlEmpty |
0–12 | VOID 1(bowlEmptyTag) |
bowlStew |
0–12 | PLANT 6 + AIR 1 + LIFE 4(bowlStewTag) |
bowlStew |
13–25 | PLANT 8 + AIR 1 + LIFE 4 + LIGHT 4(glowStewTag) |
循环体是 for (int i = 0; i < 13; i++),第二段用 i + 13 取到 meta 13–25。
树苗
saplingTag = TREE 2 + PLANT 2,打在 rareSapling meta 4 与 floraSapling meta 0–3、rareSapling meta 0–3。
下界树苗另用独立标签:
| 物品 | meta | aspect |
|---|---|---|
floraSapling |
4 | SOUL 1 + PLANT 2 + TREE 2 |
floraSapling |
5、6 | TREE 2 + PLANT 2 |
floraSapling |
7 | TREE 2 + PLANT 2 + ENTROPY 2 |
[!NOTE]
floraSaplingmeta 4 先在通用saplingTag循环里被打一次,随后在「Nether saplings」段被SOUL版覆盖。按源码执行顺序,最终生效的是下界标签。
仙人掌与其他
| 物品 | aspect |
|---|---|
saguaro |
WATER 1 + PLANT 2 + WEAPON 1 + TREE 2 |
waterDrop |
WATER 1(仅当 PHNatura.enableCactusJuice) |
seedFood |
CROP 2 + PLANT 1 + WATER 1 |
potashApple |
CROP 2 + POISON 2 |
heatSand |
FIRE 2 + EARTH 1 |
taintedSoil |
EARTH 2 |
thornVines |
FIRE 1 + PLANT 1 |
云
| 方块 | meta | aspect |
|---|---|---|
cloud |
0 | AIR 1 + FLIGHT 1 + WATER 1 + WEATHER 1 |
cloud |
1 | AIR 1 + FLIGHT 1 + ELDRITCH 1 + WEATHER 1 |
cloud |
2 | AIR 1 + FLIGHT 1 + FIRE 1 + WEATHER 1 |
cloud |
3 | AIR 1 + FLIGHT 1 + POISON 1 + WEATHER 1 |
下界浆果(PHNatura.enableNetherBerryBushes 包裹)
| 物品 | meta | aspect |
|---|---|---|
netherBerryBush |
0 | ENTROPY 4 + POISON 4 + PLANT 1 |
netherBerryBush |
1 | ENTROPY 4 + DARKNESS 4 + PLANT 1 |
netherBerryBush |
2 | ENTROPY 4 + FLIGHT 4 + PLANT 1 |
netherBerryBush |
3 | ENTROPY 8 + PLANT 1 |
netherBerryItem |
0 | ENTROPY 4 + POISON 4 + LIFE 1 + CROP 1 |
netherBerryItem |
1 | ENTROPY 4 + DARKNESS 4 + LIFE 1 + CROP 1 |
netherBerryItem |
2 | ENTROPY 4 + FLIGHT 4 + LIFE 1 + CROP 1 |
netherBerryItem |
3 | ENTROPY 8 + LIFE 1 + CROP 1 |