🚀 入门指南#

本指南将引导你设置本地开发环境,用于构建、测试并为我们的模块做出贡献。


⚙️ 准备工作#

Before you start, make sure your system is ready by completing the following steps:

  1. Install UV, a Python package and project manager.

  2. Clone the repository, if you haven’t done this before, follow this step-by-step tutorial: First Contributions Guide. Once cloned, open the project folder in your preferred code editor.


🔨 构建模块#

modules 目录包含所有模块的源文件。使用以下命令高效管理和构建:

uv run modules build

构建所有模块

uv run modules watch

监控变更并自动重建模块

uv run modules <build|watch> <module1> ...

仅构建或监控指定模块

uv run link [world]

将生成的资源包和数据包链接到 Minecraft 世界

监控模块

Building modules can take some time. For a smoother experience, it’s recommended to only watch the module you’re currently working on: uv run modules watch <module>.

链接模块到 Minecraft#

link 命令可将生成的包直接集成到 Minecraft 世界。该命令可用选项如下:

world(可选)

要链接的 Minecraft 世界名称

--minecraft <目录>

.minecraft 目录路径(Minecraft 文件位置)

--data-pack <目录>

数据包存储目录路径

--resource-pack <目录>

资源包存储目录路径

以下工作流展示如何在 Minecraft 中直接链接并持续测试模块:

# Link modules to a specific world
uv run link <world> --minecraft </path/to/.minecraft>

# Monitor changes and rebuild a module for the linked world
uv run modules watch <module>

🧪 测试模块#

测试是软件开发的基本环节,有助于确保代码正确性并避免未来潜在错误。

学习如何为模块编写和运行测试,请参阅调试章节