English translation: docs/en/Lifecycle.md
本文用于帮助定位“为什么某个注册/加载必须在某阶段做”。
src/main/kotlin/PrototypeMachinery.kt
-
PreInit:
StructureLoader.loadStructureData(event)- 读取
config/prototypemachinery/structures/*.json - 如为空,复制资源内示例到
config/.../structures/examples/
- 读取
-
PostInit:
StructureLoader.processStructures(event)- 解析 blockId/meta 到实际
BlockState - 转换并注册结构
- 解析 blockId/meta 到实际
- PreInit:
MachineTypeRegisterer.processQueue(event)- 将脚本/代码入队的 MachineType 写入
MachineTypeRegistryImpl
- 将脚本/代码入队的 MachineType 写入
之后在 Forge 的 Block 注册事件里,会基于已注册的 MachineType 创建 MachineBlock。
TaskSchedulerImpl.shutdown():停止调度器并清理资源