npm package: @occultus/tutorial-api
Description: Star Tenon tutorial api
Author: CTN Studios
Latest version: 0.24.0

# Star Tenon Tutorial API

这是一个教程 API，用于在游戏中实现教程系统，可以帮助你轻松地创建和管理教程。

#### 功能特性

- 监听游戏事件并触发相应的教程解锁；
- 支持多种教程类型：物品、方块、实体、维度和标签；
- 提供统一的教程管理接口。

## TutorialServer

`TutorialServer` 是教程系统的核心组件，负责管理和处理游戏中的教程解锁逻辑：

```typescript
// 创建教程服务端实例
const tutorialServer = new TutorialServer();

// 创建不同类型的教程
const swordTutorial = new Tutorial({
  id: "minecraft:diamond_sword",
  config: {
    type: "item",
    title: "钻石剑",
    description: "一把强大的武器，可以造成大量伤害。"
  }
});

const craftingTableTutorial = new Tutorial({
  id: "minecraft:crafting_table",
  config: {
    type: "block",
    title: "工作台",
    description: "用于制作更复杂的物品和工具。"
  }
});

// 添加教程到教程服务端
tutorialServer.addTutorial([swordTutorial, craftingTableTutorial]);
```

## Tutorial

`Tutorial` 类表示单个教程，包含教程的基本信息和配置：

```typescript
const tutorialStick = new Tutorial(
  "minecraft:stick",
  "木棍", // 该教程的标题
  "木棍是一种合成中的常见物品", // 该教程的描述
  {
    type: "item",
    iconPath: "textures/items/stick"
  }
);

const tutorialFood = new Tutorial(
  "<tag>minecraft:is_food",
  "食物",
  "食物是使用后可以给玩家补充饥饿值和饱和度、有时还会产生额外效果的物品",
  {
    type: "item",
    iconPath: "textures/items/apple"
  }
);

const tutorialStone = new Tutorial(
  "minecraft:stone",
  "石头",
  "石头是一种常见的建筑材料，可以用来制作各种工具和家具",
  {
    type: "block"
  }
);

const tutorialEntity = new Tutorial(
  "minecraft:cow",
  "牛",
  "牛是一种常见的动物，可以用来制作食物和皮革",
  {
    type: "entity"
  }
);

const tutorialNether = new Tutorial(
  "minecraft:nether",
  "下界",
  "下界是一个特殊维度，有着独特的生物和地形",
  {
    type: "dimension"
  }
);

const tutorialAlways = new Tutorial(
  "example:always",
  "教程",
  "这是一个总是显示的教程",
  {
    type: "alwaysAvailable" // 总是可用
  }
);
```

## TutorialCenter

`TutorialCenter` 类作为教程系统的中心管理器，负责协调各个教程组件，并为玩家提供教程面板：

```typescript
const center = new TutorialCenter(
  "example:center",
  "教程中心",
  "这是教程中心的默认简介，如果你看到了它说明该模组的开发者很懒awa",
  tutorials
);

center.addTrigger("example:tutorial_center", {
  name: "example:tutorial",
  description: "教程中心",
  permissionLevel: CommandPermissionLevel.Any,
  cheatsRequired: false
});
```

## TutorialGroup

`TutorialGroup` 类用于组织相关的教程，形成教程组。

## 支持版本

本 API 支持任意可以运行 Script API v2.0.0+ 的游戏版本，包括：

- 1.21.90；
- 1.21.100；
- 1.21.110；
- 以及更多……

注意：本包理论上可以在部分更旧的版本上运作，但未经过严格的测试。

## 协议

本项目使用 MIT License 授权：

```text
The MIT License (MIT)

Copyright © 2025 CTN Studios

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```