diff --git a/.gitignore b/.gitignore index 5173a93..dba7df0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ package-lock.json package.json .DS_Store +.idea diff --git a/mcguide/10-新内容/1-开发工作台/933-1.1.44.md b/mcguide/10-新内容/1-开发工作台/933-1.1.44.md new file mode 100644 index 0000000..7a24788 --- /dev/null +++ b/mcguide/10-新内容/1-开发工作台/933-1.1.44.md @@ -0,0 +1,34 @@ +--- +front: https://nie.res.netease.com/r/pic/20250709/095c3bb4-eb58-4444-811f-76be2b94eedf.jpg +hard: 入门 +time: 2分钟 +selection: 23 +--- + +# 2025.7.08 版本1.1.44 + +## 地图编辑器 + +替换和填充界面增加方块收藏功能 + +- 点击所有方块列表中的方块后,会出现收藏按钮,点击按钮即可将方块放入收藏列表 + +![图片](./images/250708/0_0.png) + +- 点击在收藏方块列表中的方块后,会出现取消收藏按钮,点击按钮即可将方块移出收藏列表 + +![图片](./images/250708/0_1.png) + +## 配置编辑器 + +- 对新建文件中"生成规则"描述文字优化为"实体生成规则",避免和特征规则造成混淆 + +## 问题修复 + +- 修复多结构生成规则字段"is multi sub editor"检测会删除文件问题 + +- 修复原版模型转fbx工具0帧处理问题 + +- 修复文本输入框控件调整输入文本颜色属性后,再改属性在编辑器内消失问题 + +- 修复地图编辑器替换、填充弹出界面位置UI会遮挡的问题 \ No newline at end of file diff --git a/mcguide/10-新内容/1-开发工作台/934-1.1.43.md b/mcguide/10-新内容/1-开发工作台/934-1.1.43.md new file mode 100644 index 0000000..105221d --- /dev/null +++ b/mcguide/10-新内容/1-开发工作台/934-1.1.43.md @@ -0,0 +1,34 @@ +--- +front: https://nie.res.netease.com/r/pic/20250625/93d00c93-a3de-43e2-86d2-8128f8c467aa.jpg +hard: 入门 +time: 2分钟 +selection: 23 +--- + +# 2025.6.25 版本1.1.43 + +## 编辑器 + +### 编辑器升级3.4 + +新增支持1.21.0的新物品、方块、实体等 + +### 贴图压缩工具 + +工具箱新增资源包贴图压缩工具,可根据JSON配置自动压缩资源包贴图并生成报告,帮助开发者减少包体体积 + +详细使用链接请前往官方Github仓库[https://github.com/MCNeteaseDevs/Image-AutoCompress](https://github.com/MCNeteaseDevs/Image-AutoCompress) + +![图片](./images/250625/0_0.png) + +### Java版组件-本地导入-适用版本,新增支持Java1.21 + +![图片](./images/250625/0_1.png) + +## 配置编辑器 + +- 新建页签优化 + +现在新建配置会根据当前所在页面打开对应的配置选择界面。如在**界面编辑器界面**,新建文件向导会默认**选择界面选项**(见下图) + +![图片](./images/250625/0_2.png) \ No newline at end of file diff --git a/mcguide/10-新内容/1-开发工作台/935-1.1.42.md b/mcguide/10-新内容/1-开发工作台/935-1.1.42.md new file mode 100644 index 0000000..562112c --- /dev/null +++ b/mcguide/10-新内容/1-开发工作台/935-1.1.42.md @@ -0,0 +1,26 @@ +--- +front: https://nie.res.netease.com/r/pic/20250609/61c838c0-4e9e-49a0-8555-403f760039ad.jpg +hard: 入门 +time: 2分钟 +selection: 23 +--- + +# 2025.6.10 版本1.1.42 + +## 编辑器 + +- 组件名称发布适配特殊字符 + +现在支持特殊字符的作品名,并一键发布到开发者内容管理平台 + +![图片](./images/250610/0_0.png) + +## 地图编辑器 + +- **按住Ctrl键**点击可以多选所需要替换/填充的方块行,再次点击右侧方块即可全部**预选**该方块进行替换/填充 + +![图片](./images/250610/0_1.png) + +## 问题修复 + +- 修复界面编辑器使用原版贴图会复制问题 \ No newline at end of file diff --git a/mcguide/10-新内容/1-开发工作台/936-1.1.41.md b/mcguide/10-新内容/1-开发工作台/936-1.1.41.md new file mode 100644 index 0000000..10dd761 --- /dev/null +++ b/mcguide/10-新内容/1-开发工作台/936-1.1.41.md @@ -0,0 +1,22 @@ +--- +front: https://nie.res.netease.com/r/pic/20250528/cb9ff22d-2b87-4c3a-9114-4f2e947d9f1e.jpg +hard: 入门 +time: 2分钟 +selection: 23 +--- + +# 2025.5.27 版本1.1.41 + +## 编辑器 + +- 版本升级优化 + +点击版本升级后,也会升级modules字段的version + +![图片](./images/250527/0_0.png) + +![图片](./images/250527/0_1.png) + +## 问题修复 + +- 修复方块易测获取测试端游戏进程失败问题 \ No newline at end of file diff --git a/mcguide/10-新内容/1-开发工作台/937-1.1.40.md b/mcguide/10-新内容/1-开发工作台/937-1.1.40.md new file mode 100644 index 0000000..d5c8de3 --- /dev/null +++ b/mcguide/10-新内容/1-开发工作台/937-1.1.40.md @@ -0,0 +1,38 @@ +--- +front: https://nie.res.netease.com/r/pic/20250513/d83d9999-e1e2-4f29-870d-a50582e47cfc.jpg +hard: 入门 +time: 2分钟 +selection: 23 +--- + +# 2025.5.13 版本1.1.40 + +## 配置编辑器 + +- 新增自定义锻造转换配方选项 + +## 界面编辑器 + +- 界面编辑器生成控件键值对源码排序,方便开发者进行阅读 + +排序规则如下 +```bash +控件类:type、renderer +变量(按字母顺序):$变量1: xxx +变量初始化:variables +尺寸和位置相关:offset、size等 +可见性和状态视觉相关:layer、alpha等 +动画相关: anims、animation_reset_name等 +数据绑定相关:modifications、property_bag、bindings +最后为controls +``` + +## UI调试工具 + +- UI调试工具仅顶部分割线才可拖动 变为 右侧分割线均可拖动 + +## 问题修复 + +- 方块易测连接失败问题修复 + +- 修复贴图资源复制问题 \ No newline at end of file diff --git a/mcguide/10-新内容/1-开发工作台/938-1.1.39.md b/mcguide/10-新内容/1-开发工作台/938-1.1.39.md new file mode 100644 index 0000000..df14b6d --- /dev/null +++ b/mcguide/10-新内容/1-开发工作台/938-1.1.39.md @@ -0,0 +1,26 @@ +--- +front: https://nie.res.netease.com/r/pic/20250422/45cbbcc5-1c8e-43de-b011-cf822f273031.jpg +hard: 入门 +time: 2分钟 +selection: 23 +--- + +# 2025.4.22 版本1.1.39 + +## 启动器 + +- 性能诊断工具优化,优化采集服务的CPU消耗、优化获取进程列表的效率等 +- 组件编辑界面优化,编辑界面排布与配置界面一致 +- 日志与调试工具,保存窗口位置和大小以及字号大小为配置,下次打开工具使用保存配置 + +## 编辑器 + +- 自定义指令支持参数变体配置 + +![图片](./images/250422/0_0.png) + +- 支持批量导入原版方块模型,点击导入-原版方块模型后打开模型所在文件夹,可以选择多个文件导入 + +## 问题修复 + +- 编辑功能对橡木方块进行旋转操作后变为白桦木方块 \ No newline at end of file diff --git a/mcguide/10-新内容/1-开发工作台/939-1.1.33.md b/mcguide/10-新内容/1-开发工作台/939-1.1.33.md new file mode 100644 index 0000000..8c6498a --- /dev/null +++ b/mcguide/10-新内容/1-开发工作台/939-1.1.33.md @@ -0,0 +1,22 @@ +--- +front: https://nie.res.netease.com/r/pic/20250310/dd8f038a-fd2a-497f-861a-5b36dd238bf0.jpg +hard: 入门 +time: 2分钟 +selection: 23 +--- + +# 2025.3.11 版本1.1.33 + +## 启动器 + +新增性能诊断模块,具体教程见[性能监测与调试工具](../../30-测试/5-性能监测与调试工具.md)。 + +## 编辑器 + +自定义配方支持锻造转换配方。 + +## 问题修复 + +- 修复地图附带mod在第二次开发测试后无法热重载 +- 修复山羊实体配置模板为空问题 +- Java版作品测试支持1.19.2 \ No newline at end of file diff --git a/mcguide/10-新内容/1-开发工作台/940-1.1.31.md b/mcguide/10-新内容/1-开发工作台/940-1.1.31.md new file mode 100644 index 0000000..e4aabe4 --- /dev/null +++ b/mcguide/10-新内容/1-开发工作台/940-1.1.31.md @@ -0,0 +1,37 @@ +--- +front: https://nie.res.netease.com/r/pic/20250220/984b86ef-d9a4-4cb4-bf3b-c89d86a96b7c.jpg +hard: 入门 +time: 2分钟 +selection: 23 +--- + +# 2025.2.20 版本1.1.31 + +## 启动器 + +组件导入功能优化,支持选择文件类型。 + +![图片](./images/250220/1.png) + +## 界面编辑器 + +界面编辑器支持预览新触控界面。 + +![图片](./images/250220/2.png) + +界面编辑器补充字段。 + +- 文本控件:补充锁定颜色、锁定透明度、隐藏连字符、启用本地化 +- 图片控件:补充平铺类型、平铺缩放比例、双线性缩放 +- 按钮控件:补充按钮声音、声音音量、声音音调 + +## 配置编辑器 + +- 自定义配方:支持配方解锁配置 +- 自定义盔甲:补充盔甲韧性、击退抗性配置 +- 掉落表:支持战利品表配置和空配置 + +## 问题修复 + +- 修复打开含雕纹书架的结构体后编辑器崩溃 +- 修复netease:weapon、netease:render_layer部分字段与实际配置不符 \ No newline at end of file diff --git a/mcguide/10-新内容/1-开发工作台/941-1.1.30.md b/mcguide/10-新内容/1-开发工作台/941-1.1.30.md new file mode 100644 index 0000000..997683b --- /dev/null +++ b/mcguide/10-新内容/1-开发工作台/941-1.1.30.md @@ -0,0 +1,33 @@ +--- +front: https://nie.res.netease.com/r/pic/20250122/8dfbddfe-aa1f-4d82-a802-68fcdac73c78.jpg +hard: 入门 +time: 2分钟 +selection: 23 +--- + +# 2025.1.23 版本1.1.30 + +## 启动器 + +新建作品时支持配置命名空间。 + +![图片](./images/250123/1.png) + +## 编辑器 + +自定义物品新增自定义盾牌模板和相关属性。 + +![图片](./images/250123/2.png) + +编辑器属性面板排版优化,部分控件支持自适应宽度,分割线改为白色,并支持更大范围拖动。 + +![图片](./images/250123/3.png) + +## 其他 + +- 修复地形功能放置结构池属性点击无反应 +- 修复编辑器内的村庄结构无法正常生成 +- 修复fbx/obj导入地图编辑器后方块颜色错误 +- 修复放置带有箱子的结构体时内嵌游戏崩溃 +- 修复配方配置的结果选择自定义物品后属性栏不显示 +- 修复物品选择器部分物品贴图错误问题 \ No newline at end of file diff --git a/mcguide/10-新内容/1-开发工作台/942-1.1.29.md b/mcguide/10-新内容/1-开发工作台/942-1.1.29.md new file mode 100644 index 0000000..3e2b048 --- /dev/null +++ b/mcguide/10-新内容/1-开发工作台/942-1.1.29.md @@ -0,0 +1,35 @@ +--- +front: https://nie.res.netease.com/r/pic/20250108/9c1b2703-8a0d-4126-9ffd-3c55e17e0a9a.jpg +hard: 入门 +time: 2分钟 +selection: 23 +--- + +# 2025.1.9 版本1.1.29 + +## 编辑器 + +新增自定义指令配置,开发者可以更方便地为作品添加自定义指令。 + +![图片](./images/250109/3.png) + +支持新版物品和方块注册逻辑,不仅支持配置两种新的获取方式,并且能够指定自定义分页。 + +![图片](./images/250109/2.png) + +编辑器目录生成优化,减少了大量不必要的文件夹和文件。 + +![图片](./images/250109/4.png) + +## 启动器 + +配置界面重新排布,现在右侧搜索框更大更容易操作。 + +![图片](./images/250109/1.png) + +## 其他 + +- 修复界面编辑器快速切换自定义控件导致Json数据丢失问题 +- 修复导出功能会删除二级目录同名非空文件夹的问题 +- 云端列表增加对无主包的demo模组标记 +- 编辑器升级基岩版1.20.50和Java版1.20.6 \ No newline at end of file diff --git a/mcguide/10-新内容/1-开发工作台/943-1.1.28.md b/mcguide/10-新内容/1-开发工作台/943-1.1.28.md new file mode 100644 index 0000000..3fab260 --- /dev/null +++ b/mcguide/10-新内容/1-开发工作台/943-1.1.28.md @@ -0,0 +1,58 @@ +--- +front: https://nie.res.netease.com/r/pic/20241219/5a620c8c-c7c7-4d80-8f36-137e1edc2db2.jpg +hard: 入门 +time: 2分钟 +selection: 23 +--- + +# 2024.12.19 版本1.1.28 + +## 导出功能 + +作品导出的zip中会移除无用的空文件夹和文件。 + +导出前: + +![导出前](./images/241219/1.png) + +导出后: + +![导出后](./images/241219/2.png) + +## 界面编辑器 + +- 缩进调整为4个空格 +- 保留键值对顺序,新键插入末尾 +- 移除无用文件和键值对 + +```json +在生成image控件时,不生成: +"clip_direction": "left", +"clip_ratio": 0.0, +"controls": [], +``` +- 不再生成netease_editor_template_namespace.json +- 浮点数生成优化 + +```json +原本:"color": [0.2352941176470588, 0.3176470588235294, 0.9764705882352941], +修改后:"color": [0.2353, 0.3176, 0.9765], + +原本:"offset": [20.0, 0.0], +修改后:"offset": [20, 0], + +原本:"font_scale_factor": 2.000000000000001, +修改后:"font_scale_factor": 2, +``` + +## 测试配置 + +开发测试的配置界面支持搜索作品,方便测试同时加载多个作品的情况。 + +![图片](./images/241219/3.png) + +## 新建作品 + +新建空白地图和空白附加包支持仅创建。 + +![图片](./images/241219/4.png) \ No newline at end of file diff --git a/mcguide/10-新内容/1-开发工作台/images/241219/1.png b/mcguide/10-新内容/1-开发工作台/images/241219/1.png new file mode 100644 index 0000000..8070dcb Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/241219/1.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/241219/2.png b/mcguide/10-新内容/1-开发工作台/images/241219/2.png new file mode 100644 index 0000000..72e6a22 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/241219/2.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/241219/3.png b/mcguide/10-新内容/1-开发工作台/images/241219/3.png new file mode 100644 index 0000000..3aec4e8 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/241219/3.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/241219/4.png b/mcguide/10-新内容/1-开发工作台/images/241219/4.png new file mode 100644 index 0000000..ba17c20 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/241219/4.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250109/1.png b/mcguide/10-新内容/1-开发工作台/images/250109/1.png new file mode 100644 index 0000000..a1e2009 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250109/1.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250109/2.png b/mcguide/10-新内容/1-开发工作台/images/250109/2.png new file mode 100644 index 0000000..c162a36 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250109/2.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250109/3.png b/mcguide/10-新内容/1-开发工作台/images/250109/3.png new file mode 100644 index 0000000..a8c624e Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250109/3.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250109/4.png b/mcguide/10-新内容/1-开发工作台/images/250109/4.png new file mode 100644 index 0000000..ec346f3 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250109/4.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250123/1.png b/mcguide/10-新内容/1-开发工作台/images/250123/1.png new file mode 100644 index 0000000..62a00db Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250123/1.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250123/2.png b/mcguide/10-新内容/1-开发工作台/images/250123/2.png new file mode 100644 index 0000000..e297660 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250123/2.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250123/3.png b/mcguide/10-新内容/1-开发工作台/images/250123/3.png new file mode 100644 index 0000000..ddd6331 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250123/3.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250220/1.png b/mcguide/10-新内容/1-开发工作台/images/250220/1.png new file mode 100644 index 0000000..a48351f Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250220/1.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250220/2.png b/mcguide/10-新内容/1-开发工作台/images/250220/2.png new file mode 100644 index 0000000..c119c32 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250220/2.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250422/0_0.png b/mcguide/10-新内容/1-开发工作台/images/250422/0_0.png new file mode 100644 index 0000000..9bc8eb4 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250422/0_0.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250527/0_0.png b/mcguide/10-新内容/1-开发工作台/images/250527/0_0.png new file mode 100644 index 0000000..ced42a6 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250527/0_0.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250527/0_1.png b/mcguide/10-新内容/1-开发工作台/images/250527/0_1.png new file mode 100644 index 0000000..e02ab8d Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250527/0_1.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250610/0_0.png b/mcguide/10-新内容/1-开发工作台/images/250610/0_0.png new file mode 100644 index 0000000..d1f543d Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250610/0_0.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250610/0_1.png b/mcguide/10-新内容/1-开发工作台/images/250610/0_1.png new file mode 100644 index 0000000..e86be52 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250610/0_1.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250625/0_0.png b/mcguide/10-新内容/1-开发工作台/images/250625/0_0.png new file mode 100644 index 0000000..85b503f Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250625/0_0.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250625/0_1.png b/mcguide/10-新内容/1-开发工作台/images/250625/0_1.png new file mode 100644 index 0000000..0e9ae73 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250625/0_1.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250625/0_2.png b/mcguide/10-新内容/1-开发工作台/images/250625/0_2.png new file mode 100644 index 0000000..d981eee Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250625/0_2.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250708/0_0.png b/mcguide/10-新内容/1-开发工作台/images/250708/0_0.png new file mode 100644 index 0000000..8bfd8f7 Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250708/0_0.png differ diff --git a/mcguide/10-新内容/1-开发工作台/images/250708/0_1.png b/mcguide/10-新内容/1-开发工作台/images/250708/0_1.png new file mode 100644 index 0000000..3b7399f Binary files /dev/null and b/mcguide/10-新内容/1-开发工作台/images/250708/0_1.png differ diff --git a/mcguide/16-美术/6-模型和动作/12-动作优化规范.md b/mcguide/16-美术/6-模型和动作/12-动作优化规范.md new file mode 100644 index 0000000..3636f2e --- /dev/null +++ b/mcguide/16-美术/6-模型和动作/12-动作优化规范.md @@ -0,0 +1,143 @@ +--- +front: 进阶 +time: 15分钟 +---[2-地图编辑器使用说明.md](../../14-%E5%9C%B0%E5%9B%BE%E5%88%B6%E4%BD%9C/2-%E5%9C%B0%E5%9B%BE%E7%BC%96%E8%BE%91%E5%99%A8%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.md) + +# 模型规范指南 +## 前言 +在当前模组开发实践中,部分开发者所采用的 Blockbench. + +模型与官方标准模型存在差异,因此换了BlockBench模型的Mod,会导致官方皮肤时出现贴图错位、模型消失等兼容性问题,影响了玩家的视觉体验. +因此,我们现已开放官方模型规范,开发者们请参考并遵循。新作品通过规范指南进行UV、动画等的制作,已有作品则可以通过API判断是否需要修改Blockbench +模型,确保模组能够与官方皮肤良好配合,为玩家带来更加一致、流畅的游戏体验。 + +## 兼容分类 + +根据模组与官方皮肤的兼容程度,分为: +1. **完全兼容**:未更换bb模型。表现为:皮肤模型贴图,以及穿戴外观,模组动画等表现都正常。 +2. **部分兼容**:更换了bb模型,但按照官方规范制作。表现为:皮肤挂件以及穿戴外观正常,但是模型样式改变及贴图错乱。 +3. **不兼容**:更换了bb模型,且未按照官方规范制作。表现为:模型样式改变,皮肤挂件错乱,穿戴外观错乱,以及动作异常。 + +## 规范概要 + +1. 玩法模组:非必要不改bb模型 +2. 动作优化类模组:`人形角色,非必要不修改bb结构,即无需使用AddPlayerGeometry的Api` +* 未增加关节:仅增加和优化动画的 ,不替换bb模型(属于“完全兼容”) +* 增加关节: + - 中高级别多关节官方皮肤:不替换模型与贴图,动画按照官方骨骼层级制作进而保证皮肤表现正常(属于“完全兼容”) + - 其他官方皮肤:可根据各模组对动画的修改程度选择是否替换bb模型。如果选择替换bb模型,则需按官方规范制作(属于“部分兼容”) +3. 人形角色,涉及“动作优化”等必须修改bb模型的,遵守以下规范即可(可参考 官方人物模型.json 模板) +4. 不建议直接修改 player.entity.json 和 player.render_controllers.json,如果改了请务必在官方的规范下进行拓展 + +## 美术制作规范 + +### 必要骨骼 + +1. 常规骨骼:常作为挂件的挂点 +> root, waist, body, leftArm, leftArmDown, rightArm, rightArmDown, head, bodyDown, leftLeg, leftLegDown, rightLeg, rightLegDown, rightLeg, cape +2. 会员盔甲挂点: +> hat, jacket, jacketDown, leftSleeve, leftSleeveDown, rightSleeve, rightSleeveDown, leftPants, leftPantsDown, rightPants, rightPantsDown + +**【注意】** + +共计26个骨骼,开发者请不要随意删除 +必要骨骼中,红色字体的骨骼为相比原版Steve新增的关节 + + +### 骨骼层级一览 + +| 节点名称 | 枢纽点 | 备注 | +|---------------------------|----------------| --- | +| root | (0,0,0) | | +| —waist | (0, 12, 0) | | +| ——body | (0, 24, 0) | | +| ———head | (0, 24, 0) | | +| —————hat | (0, 24, 0) | | +| ———cape | (0, 24, 3) | | +| ———leftArm | (-5, 22, 0) | | +| **—————leftArmDown** | (-5, 18, 0) | 新增必要骨骼 | +| **———————leftSleeveDown** | (-5, 18.25, 0) | 新增盔甲骨骼 | +| ———————leftItem | (-6, 15, 0) | | +| —————leftSleeve | (-5, 22, 0) | | +| ———rightArm | (5, 22, 0) | | +| **—————rightArmDown** | (5, 18, 0) | 新增必要骨骼 | +| **———————rightSleeveDown** | (5, 18.25, 0) | 新增盔甲骨骼 | +| ———————rightItem | (6, 15, 0) | | +| —————rightSleeve | (5, 22, 0) | | +| ———jacket | (0, 24, 0) | | +| **——bodyDown** | (0, 16, 0) | 新增必要骨骼 | +| **———jacketDown** | (0, 16.25, 0) | 新增盔甲骨骼 | +| —leftLeg | (-1.9, 12, 0) | | +| ——leftPants | (-1.9, 12, 0) | | +| **——leftLegDown** | (-1.9, 6, 0) | 新增必要骨骼 | +| **————leftPantsDown** | (-1.9, 6.25, 0) | 新增盔甲骨骼 | +| —rightLeg | (1.9, 12, 0) | | +| ——rightPants | (1.9, 12, 0) | | +| **——rightLegDown** | (1.9, 6, 0) | 新增必要骨骼 | +| **————rightPantsDown** | (1.9, 6.25, 0) | 新增盔甲骨骼 | + +**【注意】** +* 骨骼层级:影响官方动画兼容 +* 骨骼命名:影响官方挂件兼容 + +### 骨骼层级说明 +* body 和 bodyDown 层级并列 +* 新增的切分关节 + - 5个骨骼节点:`leftArmDown, rightArmDown, bodyDown, leftLegDown, rightLegDown ` + - 5个骨骼节点:`jacketDown, leftSleeveDown, rightSleeveDown, leftPantsDown, [12-动作优化规范.md](12-%E5%8A%A8%E4%BD%9C%E4%BC%98%E5%8C%96%E8%A7%84%E8%8C%83.md)rightPantsDown` + +### UV贴图制作 +如下图所示,需要按照Steve规范进行制作 + +![](./resources/0_1.png) +### 其余注意事项 + +1. 除盔甲骨骼以外,其他骨骼下必须有同名cube。例如: + +![](./resources/0_2.jpg) + +## 新增支持 + +### MOD SDK + +为了方便开发者们在脚本中判断当前玩家皮肤状态,新增了三个接口和一个事件。 +开发者可在事件当中判定**当前皮肤是否是官方,从而决定是否修改模型。** + +也请开发者注意[**规范概要**](#规范概要),**非必要情况不修改模型。如需修改,也遵循照官方模型规范** + +**【接口和事件】** +1. IsOfficialSkin 是否为官方皮肤 +2. IsHighLevelOfficialSkin 是否为官方史诗级以上皮肤 +3. IsHighLevelMultiJointOfficialSkin 是否为官方史诗级以上的多关节皮肤 +4. UpdatePlayerSkinClient 更新模型皮肤事件 + +**【注意】** + +上述三个接口在收到 Minecraft:EngineScripts:UpdatePlayerSkinClient 事件后进行调用。更多详细说明,见官网文档 + +使用示例 +```python +# 这里以IsHighLevelMultiJointOfficialSkin为例 + +self.ListenForEvent('Minecraft', "EngineScripts", "UpdatePlayerSkinClient', self, self onUpdatePlayerSkinClient) +def onUpdatePlayerSkinClient(self,args): + import mod.client.extraClientApi as clientApi + comp = clientApi.GetEngineCompFactory().CreateGame(levelId) + comp.IsHighLevelMultiJointOfficialSkin(args['playerId']) # 返回bool:为官方史诗级以上的多关节皮肤 +``` + +### 模型模板下载 +当前官方提供的“多关节”结构已经能满足大部分的模组开发者,请开发者下载官方规范模型文件 + +[standard_steve.geo.json](./resources/standard_steve.geo.json) + +[standard_steve.png](./resources/standard_steve.png) + + + +### 测试服测试 +为方便开发者测试4D皮肤与模组本身的兼容性,官方在开发者测试服提供了测试用4D皮肤,可通过邮件领取 + + + + diff --git a/mcguide/16-美术/6-模型和动作/resources/0_1.png b/mcguide/16-美术/6-模型和动作/resources/0_1.png new file mode 100644 index 0000000..5fc04fe Binary files /dev/null and b/mcguide/16-美术/6-模型和动作/resources/0_1.png differ diff --git a/mcguide/16-美术/6-模型和动作/resources/0_2.jpg b/mcguide/16-美术/6-模型和动作/resources/0_2.jpg new file mode 100644 index 0000000..8cd0564 Binary files /dev/null and b/mcguide/16-美术/6-模型和动作/resources/0_2.jpg differ diff --git a/mcguide/16-美术/6-模型和动作/resources/standard_steve.geo.json b/mcguide/16-美术/6-模型和动作/resources/standard_steve.geo.json new file mode 100644 index 0000000..044139d --- /dev/null +++ b/mcguide/16-美术/6-模型和动作/resources/standard_steve.geo.json @@ -0,0 +1,473 @@ +{ + "format_version": "1.12.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.standard_steve", + "texture_width": 64, + "texture_height": 64, + "visible_bounds_width": 3, + "visible_bounds_height": 4, + "visible_bounds_offset": [0, 1, 0] + }, + "bones": [ + { + "name": "root", + "pivot": [0, 0, 0] + }, + { + "name": "waist", + "parent": "root", + "pivot": [0, 12, 0] + }, + { + "name": "body", + "parent": "waist", + "pivot": [0, 24, 0], + "cubes": [ + { + "origin": [-4, 16, -2], + "size": [8, 8, 4], + "uv": { + "north": {"uv": [20, 20], "uv_size": [8, 8]}, + "east": {"uv": [16, 20], "uv_size": [4, 8]}, + "south": {"uv": [32, 20], "uv_size": [8, 8]}, + "west": {"uv": [28, 20], "uv_size": [4, 8]}, + "up": {"uv": [20, 16], "uv_size": [8, 4]}, + "down": {"uv": [28, 20], "uv_size": [8, -4]} + } + } + ] + }, + { + "name": "head", + "parent": "body", + "pivot": [0, 24, 0], + "cubes": [ + { + "origin": [-4, 24, -4], + "size": [8, 8, 8], + "uv": { + "north": {"uv": [8, 8], "uv_size": [8, 8]}, + "east": {"uv": [0, 8], "uv_size": [8, 8]}, + "south": {"uv": [24, 8], "uv_size": [8, 8]}, + "west": {"uv": [16, 8], "uv_size": [8, 8]}, + "up": {"uv": [8, 0], "uv_size": [8, 8]}, + "down": {"uv": [16, 8], "uv_size": [8, -8]} + } + } + ] + }, + { + "name": "hat", + "parent": "head", + "pivot": [0, 24, 0], + "cubes": [ + { + "origin": [-4, 24, -4], + "size": [8, 8, 8], + "inflate": 0.25, + "uv": { + "north": {"uv": [40, 8], "uv_size": [8, 8]}, + "east": {"uv": [32, 8], "uv_size": [8, 8]}, + "south": {"uv": [56, 8], "uv_size": [8, 8]}, + "west": {"uv": [48, 8], "uv_size": [8, 8]}, + "up": {"uv": [40, 0], "uv_size": [8, 8]}, + "down": {"uv": [48, 8], "uv_size": [8, -8]} + } + } + ] + }, + { + "name": "cape", + "parent": "body", + "pivot": [0, 24, 3] + }, + { + "name": "leftArm", + "parent": "body", + "pivot": [5, 22, 0], + "cubes": [ + { + "origin": [4, 18, -2], + "size": [4, 6, 4], + "uv": { + "north": {"uv": [36, 52], "uv_size": [4, 6]}, + "east": {"uv": [32, 52], "uv_size": [4, 6]}, + "south": {"uv": [44, 52], "uv_size": [4, 6]}, + "west": {"uv": [40, 52], "uv_size": [4, 6]}, + "up": {"uv": [36, 48], "uv_size": [4, 4]}, + "down": {"uv": [40, 52], "uv_size": [4, -4]} + } + } + ] + }, + { + "name": "leftArmDown", + "parent": "leftArm", + "pivot": [5, 18, 0], + "cubes": [ + { + "origin": [4, 12, -2], + "size": [4, 6, 4], + "uv": { + "north": {"uv": [36, 58], "uv_size": [4, 6]}, + "east": {"uv": [32, 58], "uv_size": [4, 6]}, + "south": {"uv": [44, 58], "uv_size": [4, 6]}, + "west": {"uv": [40, 58], "uv_size": [4, 6]}, + "up": {"uv": [40, 48], "uv_size": [4, 4]}, + "down": {"uv": [40, 52], "uv_size": [4, -4]} + } + } + ] + }, + { + "name": "leftSleeveDown", + "parent": "leftArmDown", + "pivot": [5, 18.25, 0], + "cubes": [ + { + "origin": [4, 12, -2], + "size": [4, 6, 4], + "inflate": 0.25, + "uv": { + "north": {"uv": [52, 58], "uv_size": [4, 6]}, + "east": {"uv": [48, 58], "uv_size": [4, 6]}, + "south": {"uv": [60, 58], "uv_size": [4, 6]}, + "west": {"uv": [56, 58], "uv_size": [4, 6]}, + "up": {"uv": [56, 48], "uv_size": [4, 4]}, + "down": {"uv": [56, 52], "uv_size": [4, -4]} + } + } + ] + }, + { + "name": "leftItem", + "parent": "leftArmDown", + "pivot": [6, 15, 1] + }, + { + "name": "leftSleeve", + "parent": "leftArm", + "pivot": [5, 22, 0], + "cubes": [ + { + "origin": [4, 18, -2], + "size": [4, 6, 4], + "inflate": 0.25, + "uv": { + "north": {"uv": [52, 52], "uv_size": [4, 6]}, + "east": {"uv": [48, 52], "uv_size": [4, 6]}, + "south": {"uv": [60, 52], "uv_size": [4, 6]}, + "west": {"uv": [56, 52], "uv_size": [4, 6]}, + "up": {"uv": [52, 48], "uv_size": [4, 4]}, + "down": {"uv": [56, 52], "uv_size": [4, -4]} + } + } + ] + }, + { + "name": "rightArm", + "parent": "body", + "pivot": [-5, 22, 0], + "cubes": [ + { + "origin": [-8, 18, -2], + "size": [4, 6, 4], + "uv": { + "north": {"uv": [40, 52], "uv_size": [-4, 6]}, + "east": {"uv": [44, 52], "uv_size": [-4, 6]}, + "south": {"uv": [48, 52], "uv_size": [-4, 6]}, + "west": {"uv": [36, 52], "uv_size": [-4, 6]}, + "up": {"uv": [40, 48], "uv_size": [-4, 4]}, + "down": {"uv": [44, 52], "uv_size": [-4, -4]} + } + } + ] + }, + { + "name": "rightArmDown", + "parent": "rightArm", + "pivot": [-5, 18, 0], + "cubes": [ + { + "origin": [-8, 12, -2], + "size": [4, 6, 4], + "uv": { + "north": {"uv": [40, 58], "uv_size": [-4, 6]}, + "east": {"uv": [44, 58], "uv_size": [-4, 6]}, + "south": {"uv": [48, 58], "uv_size": [-4, 6]}, + "west": {"uv": [36, 58], "uv_size": [-4, 6]}, + "up": {"uv": [44, 48], "uv_size": [-4, 4]}, + "down": {"uv": [44, 52], "uv_size": [-4, -4]} + } + } + ] + }, + { + "name": "rightISleeveDown", + "parent": "rightArmDown", + "pivot": [-5, 18.25, 0], + "cubes": [ + { + "origin": [-8, 12, -2], + "size": [4, 6, 4], + "inflate": 0.25, + "uv": { + "north": {"uv": [48, 42], "uv_size": [-4, 6]}, + "east": {"uv": [52, 42], "uv_size": [-4, 6]}, + "south": {"uv": [56, 42], "uv_size": [-4, 6]}, + "west": {"uv": [44, 42], "uv_size": [-4, 6]}, + "up": {"uv": [52, 32], "uv_size": [-4, 4]}, + "down": {"uv": [52, 36], "uv_size": [-4, -4]} + } + } + ] + }, + { + "name": "rightItem", + "parent": "rightArmDown", + "pivot": [-6, 15, 1], + "locators": { + "lead_hold": [-6, 15, 1] + } + }, + { + "name": "rightSleeve", + "parent": "rightArm", + "pivot": [-5, 22, 0], + "cubes": [ + { + "origin": [-8, 18, -2], + "size": [4, 6, 4], + "inflate": 0.25, + "uv": { + "north": {"uv": [48, 36], "uv_size": [-4, 6]}, + "east": {"uv": [52, 36], "uv_size": [-4, 6]}, + "south": {"uv": [56, 36], "uv_size": [-4, 6]}, + "west": {"uv": [44, 36], "uv_size": [-4, 6]}, + "up": {"uv": [48, 32], "uv_size": [-4, 4]}, + "down": {"uv": [52, 36], "uv_size": [-4, -4]} + } + } + ] + }, + { + "name": "jacket", + "parent": "body", + "pivot": [0, 24, 0], + "cubes": [ + { + "origin": [-4, 16, -2], + "size": [8, 8, 4], + "inflate": 0.25, + "uv": { + "north": {"uv": [20, 36], "uv_size": [8, 8]}, + "east": {"uv": [16, 36], "uv_size": [4, 8]}, + "south": {"uv": [32, 36], "uv_size": [8, 8]}, + "west": {"uv": [28, 36], "uv_size": [4, 8]}, + "up": {"uv": [20, 32], "uv_size": [8, 4]}, + "down": {"uv": [28, 36], "uv_size": [8, -4]} + } + } + ] + }, + { + "name": "bodyDown", + "parent": "waist", + "pivot": [0, 16, 0], + "cubes": [ + { + "origin": [-4, 12, -2], + "size": [8, 4, 4], + "uv": { + "north": {"uv": [20, 28], "uv_size": [8, 4]}, + "east": {"uv": [16, 28], "uv_size": [4, 4]}, + "south": {"uv": [32, 28], "uv_size": [8, 4]}, + "west": {"uv": [28, 28], "uv_size": [4, 4]}, + "up": {"uv": [28, 16], "uv_size": [8, 4]}, + "down": {"uv": [28, 20], "uv_size": [8, -4]} + } + } + ] + }, + { + "name": "jacketDown", + "parent": "bodyDown", + "pivot": [0, 16.25, 0], + "cubes": [ + { + "origin": [-4, 12, -2], + "size": [8, 4, 4], + "inflate": 0.25, + "uv": { + "north": {"uv": [20, 44], "uv_size": [8, 4]}, + "east": {"uv": [16, 44], "uv_size": [4, 4]}, + "south": {"uv": [32, 44], "uv_size": [8, 4]}, + "west": {"uv": [28, 44], "uv_size": [4, 4]}, + "up": {"uv": [0, 4], "uv_size": [8, 4]}, + "down": {"uv": [0, 4], "uv_size": [8, -4]} + } + } + ] + }, + { + "name": "leftLeg", + "parent": "root", + "pivot": [1.9, 12, 0], + "cubes": [ + { + "origin": [-0.1, 6, -2], + "size": [4, 6, 4], + "uv": { + "north": {"uv": [20, 52], "uv_size": [4, 6]}, + "east": {"uv": [16, 52], "uv_size": [4, 6]}, + "south": {"uv": [28, 52], "uv_size": [4, 6]}, + "west": {"uv": [24, 52], "uv_size": [4, 6]}, + "up": {"uv": [20, 48], "uv_size": [4, 4]}, + "down": {"uv": [24, 52], "uv_size": [4, -4]} + } + } + ] + }, + { + "name": "leftPants", + "parent": "leftLeg", + "pivot": [1.9, 12, 0], + "cubes": [ + { + "origin": [-0.1, 6, -2], + "size": [4, 6, 4], + "inflate": 0.25, + "uv": { + "north": {"uv": [4, 52], "uv_size": [4, 6]}, + "east": {"uv": [0, 52], "uv_size": [4, 6]}, + "south": {"uv": [12, 52], "uv_size": [4, 6]}, + "west": {"uv": [8, 52], "uv_size": [4, 6]}, + "up": {"uv": [4, 48], "uv_size": [4, 4]}, + "down": {"uv": [8, 52], "uv_size": [4, -4]} + } + } + ] + }, + { + "name": "leftLegDown", + "parent": "leftLeg", + "pivot": [1.9, 6, 0], + "cubes": [ + { + "origin": [-0.1, 0, -2], + "size": [4, 6, 4], + "uv": { + "north": {"uv": [20, 58], "uv_size": [4, 6]}, + "east": {"uv": [16, 58], "uv_size": [4, 6]}, + "south": {"uv": [28, 58], "uv_size": [4, 6]}, + "west": {"uv": [24, 58], "uv_size": [4, 6]}, + "up": {"uv": [24, 48], "uv_size": [4, 4]}, + "down": {"uv": [24, 52], "uv_size": [4, -4]} + } + } + ] + }, + { + "name": "leftPantsDown", + "parent": "leftLegDown", + "pivot": [1.9, 6.25, 0], + "cubes": [ + { + "origin": [-0.1, 0, -2], + "size": [4, 6, 4], + "inflate": 0.25, + "uv": { + "north": {"uv": [4, 58], "uv_size": [4, 6]}, + "east": {"uv": [0, 58], "uv_size": [4, 6]}, + "south": {"uv": [12, 58], "uv_size": [4, 6]}, + "west": {"uv": [8, 58], "uv_size": [4, 6]}, + "up": {"uv": [8, 48], "uv_size": [4, 4]}, + "down": {"uv": [8, 52], "uv_size": [4, -4]} + } + } + ] + }, + { + "name": "rightLeg", + "parent": "root", + "pivot": [-1.9, 12, 0], + "cubes": [ + { + "origin": [-3.9, 6, -2], + "size": [4, 6, 4], + "uv": { + "north": {"uv": [24, 52], "uv_size": [-4, 6]}, + "east": {"uv": [28, 52], "uv_size": [-4, 6]}, + "south": {"uv": [32, 52], "uv_size": [-4, 6]}, + "west": {"uv": [20, 52], "uv_size": [-4, 6]}, + "up": {"uv": [24, 48], "uv_size": [-4, 4]}, + "down": {"uv": [28, 52], "uv_size": [-4, -4]} + } + } + ] + }, + { + "name": "rightPants", + "parent": "rightLeg", + "pivot": [-1.9, 12, 0], + "cubes": [ + { + "origin": [-3.9, 6, -2], + "size": [4, 6, 4], + "inflate": 0.25, + "uv": { + "north": {"uv": [8, 36], "uv_size": [-4, 6]}, + "east": {"uv": [12, 36], "uv_size": [-4, 6]}, + "south": {"uv": [16, 36], "uv_size": [-4, 6]}, + "west": {"uv": [4, 36], "uv_size": [-4, 6]}, + "up": {"uv": [8, 32], "uv_size": [-4, 4]}, + "down": {"uv": [12, 36], "uv_size": [-4, -4]} + } + } + ] + }, + { + "name": "rightLegDown", + "parent": "rightLeg", + "pivot": [-1.9, 6, 0], + "cubes": [ + { + "origin": [-3.9, 0, -2], + "size": [4, 6, 4], + "uv": { + "north": {"uv": [24, 58], "uv_size": [-4, 6]}, + "east": {"uv": [28, 58], "uv_size": [-4, 6]}, + "south": {"uv": [32, 58], "uv_size": [-4, 6]}, + "west": {"uv": [20, 58], "uv_size": [-4, 6]}, + "up": {"uv": [28, 48], "uv_size": [-4, 4]}, + "down": {"uv": [28, 52], "uv_size": [-4, -4]} + } + } + ] + }, + { + "name": "rightPantsDown", + "parent": "rightLegDown", + "pivot": [-1.9, 6.25, 0], + "cubes": [ + { + "origin": [-3.9, 0, -2], + "size": [4, 6, 4], + "inflate": 0.25, + "uv": { + "north": {"uv": [8, 42], "uv_size": [-4, 6]}, + "east": {"uv": [12, 42], "uv_size": [-4, 6]}, + "south": {"uv": [16, 42], "uv_size": [-4, 6]}, + "west": {"uv": [4, 42], "uv_size": [-4, 6]}, + "up": {"uv": [12, 32], "uv_size": [-4, 4]}, + "down": {"uv": [12, 36], "uv_size": [-4, -4]} + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/mcguide/16-美术/6-模型和动作/resources/standard_steve.png b/mcguide/16-美术/6-模型和动作/resources/standard_steve.png new file mode 100644 index 0000000..fefd1bd Binary files /dev/null and b/mcguide/16-美术/6-模型和动作/resources/standard_steve.png differ diff --git a/mcguide/16-美术/7-材质与着色器/images/netease_outline.png b/mcguide/16-美术/7-材质与着色器/images/netease_outline.png new file mode 100644 index 0000000..76ad24e Binary files /dev/null and b/mcguide/16-美术/7-材质与着色器/images/netease_outline.png differ diff --git a/mcguide/16-美术/7-材质与着色器/images/netease_outline2.png b/mcguide/16-美术/7-材质与着色器/images/netease_outline2.png new file mode 100644 index 0000000..482526b Binary files /dev/null and b/mcguide/16-美术/7-材质与着色器/images/netease_outline2.png differ diff --git a/mcguide/18-界面与交互/19-控件属性动画.md b/mcguide/18-界面与交互/19-控件属性动画.md index 256ad7d..7e9996d 100644 --- a/mcguide/18-界面与交互/19-控件属性动画.md +++ b/mcguide/18-界面与交互/19-控件属性动画.md @@ -187,12 +187,12 @@ uv动画和序列帧动画都是uv起点属性的动画,不同于其他属性 要表现一个属性动画,需要先写一个Json数据块,透明度动画举例如下(相关参数会在下文详细描述): ```json - { - "anim_type" : "alpha", - "duration" : 1.0, - "from" : 0.0, - "to" : 1.0 - } +{ + "anim_type" : "alpha", + "duration" : 1.0, + "from" : 0.0, + "to" : 1.0 +} ``` 这段代码块代表一个控件在1秒钟内alpha值从0线性变化到1的属性动画,为了将这个动画绑定到控件上,一共有两种写法。 @@ -200,38 +200,38 @@ uv动画和序列帧动画都是uv起点属性的动画,不同于其他属性 一种是将Json数据块直接赋给alpha属性: ```json - { - "alphaImg" : { - "alpha" : { - "anim_type" : "alpha", - "duration" : 0.30, - "from" : 0.0, - "to" : 1.0 - }, - "texture" : "textures/netease/common/image/default", - "type" : "image", - "visible" : true - } - } -``` - -另一种则是将属性动画写成自定义控件的形式写在UIjson文件的最外层,在alpha属性值以 “@”+动画名 的形式进行赋值: - -```json - { - "alphaImg" : { - "alpha" : "@show_alpha_ani", - "texture" : "textures/netease/common/image/default", - "type" : "image", - "visible" : true - }, - "show_alpha_ani": { +{ + "alphaImg" : { + "alpha" : { "anim_type" : "alpha", "duration" : 0.30, "from" : 0.0, "to" : 1.0 }, - } + "texture" : "textures/netease/common/image/default", + "type" : "image", + "visible" : true + } +} +``` + +另一种则是将属性动画写成自定义控件的形式写在UIjson文件的最外层,在alpha属性值以 “@”+动画名 的形式进行赋值: + +```json +{ + "alphaImg" : { + "alpha" : "@show_alpha_ani", + "texture" : "textures/netease/common/image/default", + "type" : "image", + "visible" : true + }, + "show_alpha_ani": { + "anim_type" : "alpha", + "duration" : 0.30, + "from" : 0.0, + "to" : 1.0 + } +} ``` 两种写法都能达成相同的效果,不同的是第二种写法能够被复用。 @@ -259,33 +259,34 @@ uv动画和序列帧动画都是uv起点属性的动画,不同于其他属性 * 注2 ```json - "alphaImg" : { - "alpha" : "@show_alpha_ani", - "texture" : "textures/netease/common/image/default", - "type" : "image", - "visible" : true - }, - "show_alpha_ani": { - "anim_type" : "alpha", - "duration" : 0.30, - "from" : 0.0, - "next" : "@hold_alpha_ani", - "to" : 1.0 - }, - "hold_alpha_ani" : { - "anim_type" : "alpha", - "duration" : 1, - "from" : 1.0, - "next" : "@hide_alpha_ani", - "to" : 1.0 - }, - "hide_alpha_ani" : { - "anim_type" : "alpha", - "duration" : 0.30, - "from" : 1.0, - "to" : 0.0 - }, - +{ + "alphaImg" : { + "alpha" : "@show_alpha_ani", + "texture" : "textures/netease/common/image/default", + "type" : "image", + "visible" : true + }, + "show_alpha_ani": { + "anim_type" : "alpha", + "duration" : 0.30, + "from" : 0.0, + "next" : "@hold_alpha_ani", + "to" : 1.0 + }, + "hold_alpha_ani" : { + "anim_type" : "alpha", + "duration" : 1, + "from" : 1.0, + "next" : "@hide_alpha_ani", + "to" : 1.0 + }, + "hide_alpha_ani" : { + "anim_type" : "alpha", + "duration" : 0.30, + "from" : 1.0, + "to" : 0.0 + } +} ``` ### 透明度动画 @@ -301,33 +302,34 @@ uv动画和序列帧动画都是uv起点属性的动画,不同于其他属性 ![alpha动画](./picture/UIAnimation/alpha.gif) ```json - "alphaImg" : { - "alpha" : "@show_alpha_ani", - "texture" : "textures/netease/common/image/default", - "type" : "image", - "visible" : true - }, - "show_alpha_ani": { - "anim_type" : "alpha", - "duration" : 0.30, - "from" : 0.0, - "next" : "@hold_alpha_ani", - "to" : 1.0 - }, - "hold_alpha_ani" : { - "anim_type" : "alpha", - "duration" : 1, - "from" : 1.0, - "next" : "@hide_alpha_ani", - "to" : 1.0 - }, - "hide_alpha_ani" : { - "anim_type" : "alpha", - "duration" : 0.30, - "from" : 1.0, - "to" : 0.0 - }, - +{ + "alphaImg" : { + "alpha" : "@show_alpha_ani", + "texture" : "textures/netease/common/image/default", + "type" : "image", + "visible" : true + }, + "show_alpha_ani": { + "anim_type" : "alpha", + "duration" : 0.30, + "from" : 0.0, + "next" : "@hold_alpha_ani", + "to" : 1.0 + }, + "hold_alpha_ani" : { + "anim_type" : "alpha", + "duration" : 1, + "from" : 1.0, + "next" : "@hide_alpha_ani", + "to" : 1.0 + }, + "hide_alpha_ani" : { + "anim_type" : "alpha", + "duration" : 0.30, + "from" : 1.0, + "to" : 0.0 + } +} ``` ### 裁剪动画 @@ -343,18 +345,19 @@ uv动画和序列帧动画都是uv起点属性的动画,不同于其他属性 ![clip动画](./picture/UIAnimation/clip.gif) ```json - "clipImg" : { - "clip_ratio" : { - "anim_type" : "clip", - "duration" : 1.0, - "from" : 0.0, - "to" : 1.0 - }, - "texture" : "textures/netease/common/image/default", - "type" : "image", - "visible" : true - }, - +{ + "clipImg" : { + "clip_ratio" : { + "anim_type" : "clip", + "duration" : 1.0, + "from" : 0.0, + "to" : 1.0 + }, + "texture" : "textures/netease/common/image/default", + "type" : "image", + "visible" : true + } +} ``` ### 颜色动画 @@ -370,19 +373,20 @@ uv动画和序列帧动画都是uv起点属性的动画,不同于其他属性 ![color动画](./picture/UIAnimation/color.gif) ```json - "colorImg" : { - "color": "@color_ani", - "texture" : "textures/netease/common/image/default", - "type" : "image", - "visible" : true - }, - "color_ani": { - "anim_type" : "color", - "duration" : 1.0, - "from" : [1,0,0], - "to" : [0,0,1] - }, - +{ + "colorImg" : { + "color": "@color_ani", + "texture" : "textures/netease/common/image/default", + "type" : "image", + "visible" : true + }, + "color_ani": { + "anim_type" : "color", + "duration" : 1.0, + "from" : [1,0,0], + "to" : [0,0,1] + } +} ``` ### 序列帧动画 @@ -402,20 +406,22 @@ uv动画和序列帧动画都是uv起点属性的动画,不同于其他属性 ![flipbook动画](./picture/UIAnimation/flipbook.gif) ```json - "flipbookImg" : { - "texture" : "textures/ui/my_eating_apple", - "type" : "image", - "uv" : "@flipbook_ani", - "uv_size" : [ 64.0, 64.0 ], - "visible" : true - }, - "flipbook_ani": { - "anim_type": "flip_book", - "initial_frame": 10, - "frame_count": 36, - "fps": 10, - "reversible": false - }, +{ + "flipbookImg" : { + "texture" : "textures/ui/my_eating_apple", + "type" : "image", + "uv" : "@flipbook_ani", + "uv_size" : [ 64.0, 64.0 ], + "visible" : true + }, + "flipbook_ani": { + "anim_type": "flip_book", + "initial_frame": 10, + "frame_count": 36, + "fps": 10, + "reversible": false + } +} ``` 当一个图片控件被用作序列帧的载体时,该控件的属性配置有以下规则需要遵守: @@ -441,19 +447,20 @@ uv动画和序列帧动画都是uv起点属性的动画,不同于其他属性 ![offset动画](./picture/UIAnimation/offset.gif) ```json - "offsetImg" : { - "offset" : "@offset_ani", - "texture" : "textures/netease/common/image/default", - "type" : "image", - "visible" : true - }, - "offset_ani": { - "anim_type" : "offset", - "duration" : 1.0, - "from" : [0, 0], - "to" : [0, 50] - }, - +{ + "offsetImg" : { + "offset" : "@offset_ani", + "texture" : "textures/netease/common/image/default", + "type" : "image", + "visible" : true + }, + "offset_ani": { + "anim_type" : "offset", + "duration" : 1.0, + "from" : [0, 0], + "to" : [0, 50] + } +} ``` **注** @@ -477,19 +484,20 @@ uv动画和序列帧动画都是uv起点属性的动画,不同于其他属性 ![size动画](./picture/UIAnimation/size.gif) ```json - "sizeImg" : { - "size" : "@size_ani", - "texture" : "textures/netease/common/image/default", - "type" : "image", - "visible" : true - }, - "size_ani": { - "anim_type" : "size", - "duration" : 1.0, - "from" : [100, 100], - "to" : [150, 150] - }, - +{ + "sizeImg" : { + "size" : "@size_ani", + "texture" : "textures/netease/common/image/default", + "type" : "image", + "visible" : true + }, + "size_ani": { + "anim_type" : "size", + "duration" : 1.0, + "from" : [100, 100], + "to" : [150, 150] + } +} ``` **注** @@ -513,19 +521,20 @@ uv动画和序列帧动画都是uv起点属性的动画,不同于其他属性 ![uv动画](./picture/UIAnimation/uv.gif) ```json - "sizeImg" : { - "uv" : "@uv_ani", - "texture" : "textures/netease/common/image/default", - "type" : "image", - "visible" : true - }, - "uv_ani": { - "anim_type" : "uv", - "duration" : 5, - "from" : [0, 0], - "to" : [2240, 0] - }, - +{ + "sizeImg" : { + "uv" : "@uv_ani", + "texture" : "textures/netease/common/image/default", + "type" : "image", + "visible" : true + }, + "uv_ani": { + "anim_type" : "uv", + "duration" : 5, + "from" : [0, 0], + "to" : [2240, 0] + } +} ``` diff --git a/mcguide/18-界面与交互/2-从零开始创建UI.md b/mcguide/18-界面与交互/2-从零开始创建UI.md index 582892f..ee13072 100644 --- a/mcguide/18-界面与交互/2-从零开始创建UI.md +++ b/mcguide/18-界面与交互/2-从零开始创建UI.md @@ -248,20 +248,20 @@ shootButton的锚点,位移XY,尺寸XY的参考属性如下。按照这种 3. 然后激活(显示)对应的界面预设 ```python - def InitClient(self): - import mod.client.extraClientApi as clientApi - self.ListenForEngineEvent(UiInitFinishedEvent, self, self.OnUIInitFinished) +def InitClient(self): + import mod.client.extraClientApi as clientApi + self.ListenForEngineEvent(UiInitFinishedEvent, self, self.OnUIInitFinished) ``` ```python - def OnUIInitFinished(self, args): - import mod.client.extraClientApi as clientApi - if clientApi.GetPlatform() == 0: - uiNodePreset = self.GetParent().GetChildPresetsByName("PC版UI界面")[0] - else: - uiNodePreset = self.GetParent().GetChildPresetsByName("PE版UI界面")[0] - if uiNodePreset: - uiNodePreset.SetUiActive(True) +def OnUIInitFinished(self, args): + import mod.client.extraClientApi as clientApi + if clientApi.GetPlatform() == 0: + uiNodePreset = self.GetParent().GetChildPresetsByName("PC版UI界面")[0] + else: + uiNodePreset = self.GetParent().GetChildPresetsByName("PE版UI界面")[0] + if uiNodePreset: + uiNodePreset.SetUiActive(True) ``` 我们利用[UI API文档](40-UIAPI文档.html)中对各个控件的接口和游戏原生支持的格式化,可以在python代码中动态的改变界面的表现,具体可以参考[样式代码](https://minecraft-zh.gamepedia.com/index.php?title=%E6%A0%B7%E5%BC%8F%E4%BB%A3%E7%A0%81&variant=zh) diff --git a/mcguide/18-界面与交互/30-UI说明文档.md b/mcguide/18-界面与交互/30-UI说明文档.md index 2144611..3cd3002 100644 --- a/mcguide/18-界面与交互/30-UI说明文档.md +++ b/mcguide/18-界面与交互/30-UI说明文档.md @@ -12,13 +12,12 @@ time: 分钟 * 示例中为"myUIName" -```json - myUIName.json +```html +myUIName.json - "namespace" : "myUIName" - - myUIName.py +"namespace": "myUIName" +myUIName.py ``` ## JSON编写说明 @@ -32,7 +31,9 @@ Json是UI界面的显示内容和绑定的集合,UI是一种树状的组织结 命名空间是这个界面的名称,我们规定json文件名和namespace一致。 ```json - "namespace" : "myUIName" +{ + "namespace" : "myUIName" +} ``` ### Main Screen @@ -42,10 +43,12 @@ main是这个界面名称,我们规定使用main,即一个json文件是一 controls中的内容是该界面下的树状节点,即子节点。 ```json - "main@common.base_screen" : { +{ + "main@common.base_screen" : { "controls" : [ ] } +} ``` | 变量 | 解释 | @@ -87,7 +90,8 @@ path = "/panel0/text0" 为了适配异形屏,我们可以展示screen中的内容通过引用的形式写在screen的$screen_content属性中。 ```json - "main@common.base_screen" : { +{ + "main@common.base_screen" : { "$screen_content":"myUIName.panel0" }, "panel0":{ @@ -99,10 +103,11 @@ path = "/panel0/text0" "type" : "panel" }, "text0" : { - "text" : "Hello World!", - "type" : "label", - "visible" : true + "text" : "Hello World!", + "type" : "label", + "visible" : true } +} ``` 被$screen_content引用的内容,其显示内容的范围不会被异形屏遮挡。此时text0的路径为 @@ -121,45 +126,47 @@ path = base_path + "/text0" screen,即画布控件,是游戏中一个UI界面的根节点,所有其他控件只有挂在画布下才能被正确显示出来。 ```json -"main1" : { - "absorbs_input" : true, - "always_accepts_input" : false, - "controls" : [ - { - "label0@test.label0" : {} - } - ], - "force_render_below" : false, - "is_showing_menu" : true, - "render_game_behind" : true, - "render_only_when_topmost" : true, - "should_steal_mouse" : false, - "type" : "screen" +{ + "main1" : { + "absorbs_input" : true, + "always_accepts_input" : false, + "controls" : [ + { + "label0@test.label0" : {} + } + ], + "force_render_below" : false, + "is_showing_menu" : true, + "render_game_behind" : true, + "render_only_when_topmost" : true, + "should_steal_mouse" : false, + "type" : "screen" }, "main2@common.base_screen" : { - "$screen_content" : "test.netease_editor_root_panel_base_screen0", - "absorbs_input" : true, - "always_accepts_input" : false, - "force_render_below" : false, - "is_showing_menu" : true, - "render_game_behind" : true, - "render_only_when_topmost" : true, - "should_steal_mouse" : false + "$screen_content" : "test.netease_editor_root_panel_base_screen0", + "absorbs_input" : true, + "always_accepts_input" : false, + "force_render_below" : false, + "is_showing_menu" : true, + "render_game_behind" : true, + "render_only_when_topmost" : true, + "should_steal_mouse" : false }, "netease_editor_root_panel_base_screen0" : { - "anchor_from" : "top_left", - "anchor_to" : "top_left", - "controls" : [ - { - "label1@test.label1" : {} - } - ], - "layer" : 1, - "offset" : [ 0, 0 ], - "size" : [ "100%", "100%" ], - "type" : "panel", - "visible" : true + "anchor_from" : "top_left", + "anchor_to" : "top_left", + "controls" : [ + { + "label1@test.label1" : {} + } + ], + "layer" : 1, + "offset" : [ 0, 0 ], + "size" : [ "100%", "100%" ], + "type" : "panel", + "visible" : true } +} ``` |
变量
| 解释 | @@ -196,21 +203,21 @@ absorbs_input暂时无法生效,等待后续修复。 ### 通用属性 通用属性是每个控件都支持编辑的属性,对每个控件的位置、大小等基本属性进行设置。 -|
变量
| 解释 | -| :------------: | ----------------------------------------------------------- | -| anchor_from | 挂接在父节点锚点的位置,取值范围["top_left", "top_middle", "top_right", "left_middle", "center", "right_middle", "bottom_left", "bottom_middle", "bottom_right"] | -| anchor_to | 自身挂接锚点的位置,取值同anchor_from | -| layer | 当前控件相对父节点的层级,最终显示层级取决于父节点到该节点的layer之和 | -| offset | 自身相对父节点的偏移,值为百分比+像素(1个像素等于屏幕上3个像素) | -| size | 相对父节点的大小,取值同offset | -| max_size | 最大尺寸,取值同offset。当该控件尺寸可变时,最大不能超过该属性配置的尺寸 | -| min_size | 最小尺寸,取值同offset。当该控件尺寸可变时,最小不能小于该属性配置的尺寸 | -| clips_children | 裁剪子控件,取值bool值,开启后该控件范围外的子控件将不会被渲染 | -| clip_offset | 裁剪偏移,取值[x,y]。当开启裁剪子控件后,用来调整裁剪范围的偏移 | -| alpha | 透明度,取值0-1.0。调整控件的透明度 | +|
变量
| 解释 | +| :------------: | ----------------------------------------------------------- | +| anchor_from | 挂接在父节点锚点的位置,取值范围["top_left", "top_middle", "top_right", "left_middle", "center", "right_middle", "bottom_left", "bottom_middle", "bottom_right"] | +| anchor_to | 自身挂接锚点的位置,取值同anchor_from | +| layer | 当前控件相对父节点的层级,最终显示层级取决于父节点到该节点的layer之和 | +| offset | 自身相对父节点的偏移,值为百分比+像素(1个像素等于屏幕上3个像素) | +| size | 相对父节点的大小,取值同offset | +| max_size | 最大尺寸,取值同offset。当该控件尺寸可变时,最大不能超过该属性配置的尺寸 | +| min_size | 最小尺寸,取值同offset。当该控件尺寸可变时,最小不能小于该属性配置的尺寸 | +| clips_children | 裁剪子控件,取值bool值,开启后该控件范围外的子控件将不会被渲染 | +| clip_offset | 裁剪偏移,取值[x,y]。当开启裁剪子控件后,用来调整裁剪范围的偏移 | +| alpha | 透明度,取值0-1.0。调整控件的透明度 | | propagate_alpha | 透明度传递,取值bool。该控件的透明度是否会影响子控件 | -| enable | 是否可交互,取值bool。关闭该属性后按钮等控件变得不可交互 | -| type | 当前控件类型 | +| enable | 是否可交互,取值bool。关闭该属性后按钮等控件变得不可交互 | +| type | 当前控件类型 | | visible | 默认是否显示,true为显示,false为不显示 | 下图为UI编辑器中控件的通用属性编辑面板 @@ -250,24 +257,26 @@ absorbs_input暂时无法生效,等待后续修复。 ### Label Label 是文本框控件,用来显示文本信息,默认的字体是MC字体,如果有中文会变成中文字体格式,暂时不支持换字体,可以通过接口统一设置字体,如果需要设置后续有介绍。 -```json - "label0" : { - "anchor_from" : "center", - "anchor_to" : "center", - "color" : [ 1, 1, 1 ], - "font_scale_factor" : 1.0, - "font_size" : "normal", - "font_type" : "smooth", - "layer" : 1, - "offset" : [ 0, 0 ], - "shadow" : false, - "size" : [ 100, 100 ], - "text" : "Hello World!", - "text_alignment" : "center", - "line_padding" : 0.0, - "type" : "label", - "visible" : true - }, +```json +{ + "label0" : { + "anchor_from" : "center", + "anchor_to" : "center", + "color" : [ 1, 1, 1 ], + "font_scale_factor" : 1.0, + "font_size" : "normal", + "font_type" : "smooth", + "layer" : 1, + "offset" : [ 0, 0 ], + "shadow" : false, + "size" : [ 100, 100 ], + "text" : "Hello World!", + "text_alignment" : "center", + "line_padding" : 0.0, + "type" : "label", + "visible" : true + } +} ``` |
变量
| 解释 | | :------------: | ----------------------------------------------------------- | @@ -315,30 +324,32 @@ Label 是文本框控件,用来显示文本信息,默认的字体是MC字体 Image是指图片控件,具有图片裁剪,图片九宫格,颜色叠加,uv偏移,旋转显示的额外属性。 ```json - "image0" : { - "anchor_from" : "center", - "anchor_to" : "center", - "is_new_nine_slice" : false, - "layer" : 2, - "nine_slice_buttom" : 0, - "nine_slice_left" : 0, - "nine_slice_right" : 0, - "nine_slice_top" : 0, - "offset" : [ 0, 0 ], - "size" : [ 100, 100 ], - "texture" : "textures/netease/common/image/default", - "nineslice_size" : [ 0, 0, 0, 0 ], - "grayscale" : false, - "keep_ratio" : true, - "clip_direction" : "left", - "clip_ratio" : 0.0, - "type" : "image", - "uv" : [ 0, 0 ], - "uv_size" : [ 107, 107 ], - "rotate_pivot": [0.5, 0.5], - "rotate_angle": 0, - "visible" : true - }, +{ + "image0" : { + "anchor_from" : "center", + "anchor_to" : "center", + "is_new_nine_slice" : false, + "layer" : 2, + "nine_slice_buttom" : 0, + "nine_slice_left" : 0, + "nine_slice_right" : 0, + "nine_slice_top" : 0, + "offset" : [ 0, 0 ], + "size" : [ 100, 100 ], + "texture" : "textures/netease/common/image/default", + "nineslice_size" : [ 0, 0, 0, 0 ], + "grayscale" : false, + "keep_ratio" : true, + "clip_direction" : "left", + "clip_ratio" : 0.0, + "type" : "image", + "uv" : [ 0, 0 ], + "uv_size" : [ 107, 107 ], + "rotate_pivot": [0.5, 0.5], + "rotate_angle": 0, + "visible" : true + } +} ``` |
变量
| 解释 | @@ -397,33 +408,33 @@ json如下: "type" : "screen" }, "image" : { - "layer": 3, - "size": [ 100, 100 ], - "offset": "@UIDemo.animation_in", - "texture": "textures/netease/common/image/default", - "is_new_nine_slice": false, - "nine_slice_buttom" : 0, - "nine_slice_left" : 0, - "nine_slice_right" : 0, - "nine_slice_top" : 0, - "nineslice_size" : [0, 0, 0, 0], - "type": "image" + "layer": 3, + "size": [ 100, 100 ], + "offset": "@UIDemo.animation_in", + "texture": "textures/netease/common/image/default", + "is_new_nine_slice": false, + "nine_slice_buttom" : 0, + "nine_slice_left" : 0, + "nine_slice_right" : 0, + "nine_slice_top" : 0, + "nineslice_size" : [0, 0, 0, 0], + "type": "image" }, "animation_in": { - "anim_type": "offset", - "duration": 1.5, - "from": [ -100, 0 ], - "to": [ 100, 0 ], - "next": "@UIDemo.animation_out" + "anim_type": "offset", + "duration": 1.5, + "from": [ -100, 0 ], + "to": [ 100, 0 ], + "next": "@UIDemo.animation_out" }, "animation_out": { - "anim_type": "offset", - "duration": 1.5, - "from": [ 100, 0 ], - "to": [ -100, 0 ], - "next": "@UIDemo.animation_in" + "anim_type": "offset", + "duration": 1.5, + "from": [ 100, 0 ], + "to": [ -100, 0 ], + "next": "@UIDemo.animation_in" }, - "namespace" : "UIDemo" + "namespace" : "UIDemo" } ``` @@ -456,101 +467,103 @@ Button 是按钮控件,同时含有Image和Label。按钮有三种状态,分 * controls表示控制的子节点, ```json - "button0@common.button" : { - "$default_texture" : "textures/netease/common/button/default", - "$hover_texture" : "textures/netease/common/button/hover", - "$is_new_nine_slice" : false, - "$label_color" : [ 1, 1, 1 ], - "$label_font_scale_factor" : 1.0, - "$label_font_size" : "large", - "$label_layer" : 3, - "$label_offset" : [ 0, 0 ], - "$label_text" : "Button", - "$nine_slice_buttom" : 0, - "$nine_slice_left" : 0, - "$nine_slice_right" : 0, - "$nine_slice_top" : 0, - "$nineslice_size" : [ 0, 0, 0, 0 ], - "$pressed_button_name" : "%fpsBattle.click", - "$pressed_texture" : "textures/netease/common/button/pressed", - "$texture_layer" : 2, - "anchor_from" : "center", - "anchor_to" : "center", - "is_handle_button_move_event" : true, - "button_mappings" : [], - "bindings" : [ - { - "binding_collection_name" : "", - "binding_condition" : "always_when_visible", - "binding_type" : "collection_details" - } - ], - "controls" : [ - { - "default@fpsBattle.default" : {} - }, - { - "hover@fpsBattle.hover" : {} - }, - { - "pressed@fpsBattle.pressed" : {} - }, - { - "button_label@fpsBattle.button_label" : {} - } - ], - "default_control" : "default", - "hover_control" : "hover", - "layer" : 3, - "offset" : [ 0, 0 ], - "pressed_control" : "pressed", - "size" : [ 100, 50 ], - "type" : "button", - "visible" : true +{ + "button0@common.button" : { + "$default_texture" : "textures/netease/common/button/default", + "$hover_texture" : "textures/netease/common/button/hover", + "$is_new_nine_slice" : false, + "$label_color" : [ 1, 1, 1 ], + "$label_font_scale_factor" : 1.0, + "$label_font_size" : "large", + "$label_layer" : 3, + "$label_offset" : [ 0, 0 ], + "$label_text" : "Button", + "$nine_slice_buttom" : 0, + "$nine_slice_left" : 0, + "$nine_slice_right" : 0, + "$nine_slice_top" : 0, + "$nineslice_size" : [ 0, 0, 0, 0 ], + "$pressed_button_name" : "%fpsBattle.click", + "$pressed_texture" : "textures/netease/common/button/pressed", + "$texture_layer" : 2, + "anchor_from" : "center", + "anchor_to" : "center", + "is_handle_button_move_event" : true, + "button_mappings" : [], + "bindings" : [ + { + "binding_collection_name" : "", + "binding_condition" : "always_when_visible", + "binding_type" : "collection_details" + } + ], + "controls" : [ + { + "default@fpsBattle.default" : {} + }, + { + "hover@fpsBattle.hover" : {} + }, + { + "pressed@fpsBattle.pressed" : {} + }, + { + "button_label@fpsBattle.button_label" : {} + } + ], + "default_control" : "default", + "hover_control" : "hover", + "layer" : 3, + "offset" : [ 0, 0 ], + "pressed_control" : "pressed", + "size" : [ 100, 50 ], + "type" : "button", + "visible" : true }, "button_label" : { - "color" : "$label_color", - "font_scale_factor" : "$label_font_scale_factor", - "font_size" : "$label_font_size", - "font_type" : "smooth", - "layer" : "$label_layer", - "max_size" : [ "100%", "100%" ], - "offset" : [ 0, 0 ], - "shadow" : false, - "text" : "$label_text", - "text_alignment" : "center", - "type" : "label" + "color" : "$label_color", + "font_scale_factor" : "$label_font_scale_factor", + "font_size" : "$label_font_size", + "font_type" : "smooth", + "layer" : "$label_layer", + "max_size" : [ "100%", "100%" ], + "offset" : [ 0, 0 ], + "shadow" : false, + "text" : "$label_text", + "text_alignment" : "center", + "type" : "label" }, "default" : { - "is_new_nine_slice" : "$is_new_nine_slice", - "layer" : "$texture_layer", - "nine_slice_buttom" : "$nine_slice_buttom", - "nine_slice_left" : "$nine_slice_left", - "nine_slice_right" : "$nine_slice_right", - "nine_slice_top" : "$nine_slice_top", - "texture" : "$default_texture", - "type" : "image" + "is_new_nine_slice" : "$is_new_nine_slice", + "layer" : "$texture_layer", + "nine_slice_buttom" : "$nine_slice_buttom", + "nine_slice_left" : "$nine_slice_left", + "nine_slice_right" : "$nine_slice_right", + "nine_slice_top" : "$nine_slice_top", + "texture" : "$default_texture", + "type" : "image" }, "hover" : { - "is_new_nine_slice" : "$is_new_nine_slice", - "layer" : "$texture_layer", - "nine_slice_buttom" : "$nine_slice_buttom", - "nine_slice_left" : "$nine_slice_left", - "nine_slice_right" : "$nine_slice_right", - "nine_slice_top" : "$nine_slice_top", - "texture" : "$hover_texture", - "type" : "image" + "is_new_nine_slice" : "$is_new_nine_slice", + "layer" : "$texture_layer", + "nine_slice_buttom" : "$nine_slice_buttom", + "nine_slice_left" : "$nine_slice_left", + "nine_slice_right" : "$nine_slice_right", + "nine_slice_top" : "$nine_slice_top", + "texture" : "$hover_texture", + "type" : "image" }, "pressed" : { - "is_new_nine_slice" : "$is_new_nine_slice", - "layer" : "$texture_layer", - "nine_slice_buttom" : "$nine_slice_buttom", - "nine_slice_left" : "$nine_slice_left", - "nine_slice_right" : "$nine_slice_right", - "nine_slice_top" : "$nine_slice_top", - "texture" : "$pressed_texture", - "type" : "image" - }, + "is_new_nine_slice" : "$is_new_nine_slice", + "layer" : "$texture_layer", + "nine_slice_buttom" : "$nine_slice_buttom", + "nine_slice_left" : "$nine_slice_left", + "nine_slice_right" : "$nine_slice_right", + "nine_slice_top" : "$nine_slice_top", + "texture" : "$pressed_texture", + "type" : "image" + } +} ``` |
变量
| 解释 | @@ -587,15 +600,17 @@ Button 是按钮控件,同时含有Image和Label。按钮有三种状态,分 panel为面板控件,主要是用来将控件进行分类和管理,类似文件夹。 ```json - "panel" : { - "anchor_from" : "center", - "anchor_to" : "center", - "layer" : 0, - "offset" : [ 0, 0 ], - "size" : [ "50.000000%+0 px", "50.000000%+0px" ], - "type" : "panel", - "visible" : true +{ + "panel" : { + "anchor_from" : "center", + "anchor_to" : "center", + "layer" : 0, + "offset" : [ 0, 0 ], + "size" : [ "50.000000%+0 px", "50.000000%+0px" ], + "type" : "panel", + "visible" : true } +} ``` | 变量 | 解释 | @@ -609,25 +624,27 @@ panel为面板控件,主要是用来将控件进行分类和管理,类似文 input_panel与panel类似,可以用来放置其他控件,但除此之外还可以用来拖动,或实现“模态框”功能。 ```json -"InputPanel" : { - "anchor_from" : "top_left", - "anchor_to" : "top_left", - "button_mappings": [ - { - "from_button_id": "button.menu_select", - "to_button_id": "#netease_to_button_id", - "mapping_type": "pressed" - } - ], - "layer" : 10, - "modal" : true, - "is_swallow": true, - "contained": true, - "draggable": "both", - "offset" : [ 0.0, 0.0 ], - "size" : [ 198.0, 137.0 ], - "type" : "input_panel", - "visible" : true +{ + "InputPanel" : { + "anchor_from" : "top_left", + "anchor_to" : "top_left", + "button_mappings": [ + { + "from_button_id": "button.menu_select", + "to_button_id": "#netease_to_button_id", + "mapping_type": "pressed" + } + ], + "layer" : 10, + "modal" : true, + "is_swallow": true, + "contained": true, + "draggable": "both", + "offset" : [ 0.0, 0.0 ], + "size" : [ 198.0, 137.0 ], + "type" : "input_panel", + "visible" : true + } } ``` @@ -681,23 +698,28 @@ InputPanel维护着一个拖拽偏移量,它代表着在整个拖拽过程中 布局面板,用于自动布局该控件的子控件 ```json -"stack_panel0": { - "layer": 1, - "orientation": "horizontal", - "size": [100, 100], - "type": "stack_panel", - "controls": [{ - "panel_0": { - "type": "panel", - "size": [2, 2] - } - }, { - "fill_0": { - "type": "panel", - "size": ["fill", 1] - } - }] -}, +{ + "stack_panel0": { + "layer": 1, + "orientation": "horizontal", + "size": [100, 100], + "type": "stack_panel", + "controls": [ + { + "panel_0": { + "type": "panel", + "size": [2, 2] + } + }, + { + "fill_0": { + "type": "panel", + "size": ["fill", 1] + } + } + ] + } +} ``` | 变量 | 解释 | @@ -725,51 +747,53 @@ InputPanel维护着一个拖拽偏移量,它代表着在整个拖拽过程中 TextEditBox是输入框控件,用来输入文字信息,可以获取输入内容,设置输入框内容,触发输入中和输入完成事件,设置最大输入值等。下面的示例展示了一个搜索框的信息。 ```json - "text_edit_box0@common.text_edit_box" : { - "$edit_box_default_texture" : "textures/ui/edit_box_indent", - "$edit_box_hover_texture" : "textures/ui/edit_box_indent_hover", - "$font_size" : "normal", - "$is_new_nine_slice" : false, - "$nine_slice_buttom" : 0, - "$nine_slice_left" : 0, - "$nine_slice_right" : 0, - "$nine_slice_top" : 0, - "$nineslice_size" : [ 0, 0, 0, 0 ], - "$place_holder_text" : "请输入内容", - "$place_holder_text_color" : [ 0.50, 0.50, 0.50 ], - "$text_background_default" : "fpsBattle.edit_box_background_default", - "$text_background_hover" : "fpsBattle.edit_box_background_hover", - "$text_box_name" : "%fpsBattle.message_text_box", - "$text_box_text_color" : [ 1, 1, 1 ], - "$text_edit_box_content_binding_name" : "#fpsBattle.message_text_box_content", - "anchor_from" : "center", - "anchor_to" : "center", - "enabled_newline" : false, - "layer" : 5, - "max_length" : 512, - "offset" : [ 0, 0 ], - "size" : [ 300, 27 ], - "type" : "edit_box", - "visible" : true +{ + "text_edit_box0@common.text_edit_box" : { + "$edit_box_default_texture" : "textures/ui/edit_box_indent", + "$edit_box_hover_texture" : "textures/ui/edit_box_indent_hover", + "$font_size" : "normal", + "$is_new_nine_slice" : false, + "$nine_slice_buttom" : 0, + "$nine_slice_left" : 0, + "$nine_slice_right" : 0, + "$nine_slice_top" : 0, + "$nineslice_size" : [ 0, 0, 0, 0 ], + "$place_holder_text" : "请输入内容", + "$place_holder_text_color" : [ 0.50, 0.50, 0.50 ], + "$text_background_default" : "fpsBattle.edit_box_background_default", + "$text_background_hover" : "fpsBattle.edit_box_background_hover", + "$text_box_name" : "%fpsBattle.message_text_box", + "$text_box_text_color" : [ 1, 1, 1 ], + "$text_edit_box_content_binding_name" : "#fpsBattle.message_text_box_content", + "anchor_from" : "center", + "anchor_to" : "center", + "enabled_newline" : false, + "layer" : 5, + "max_length" : 512, + "offset" : [ 0, 0 ], + "size" : [ 300, 27 ], + "type" : "edit_box", + "visible" : true }, "edit_box_background_default" : { - "is_new_nine_slice" : "$is_new_nine_slice", - "nine_slice_buttom" : "$nine_slice_buttom", - "nine_slice_left" : "$nine_slice_left", - "nine_slice_right" : "$nine_slice_right", - "nine_slice_top" : "$nine_slice_top", - "texture" : "$edit_box_default_texture", - "type" : "image" + "is_new_nine_slice" : "$is_new_nine_slice", + "nine_slice_buttom" : "$nine_slice_buttom", + "nine_slice_left" : "$nine_slice_left", + "nine_slice_right" : "$nine_slice_right", + "nine_slice_top" : "$nine_slice_top", + "texture" : "$edit_box_default_texture", + "type" : "image" }, "edit_box_background_hover" : { - "is_new_nine_slice" : "$is_new_nine_slice", - "nine_slice_buttom" : "$nine_slice_buttom", - "nine_slice_left" : "$nine_slice_left", - "nine_slice_right" : "$nine_slice_right", - "nine_slice_top" : "$nine_slice_top", - "texture" : "$edit_box_hover_texture", - "type" : "image" - }, + "is_new_nine_slice" : "$is_new_nine_slice", + "nine_slice_buttom" : "$nine_slice_buttom", + "nine_slice_left" : "$nine_slice_left", + "nine_slice_right" : "$nine_slice_right", + "nine_slice_top" : "$nine_slice_top", + "texture" : "$edit_box_hover_texture", + "type" : "image" + } +} ``` |
变量
| 解释 | @@ -788,22 +812,26 @@ TextEditBox是输入框控件,用来输入文字信息,可以获取输入内 * 注1 ```python +import mod.client.extraClientApi as clientApi +ViewBinder = clientApi.GetViewBinderCls() +ViewRequest = clientApi.GetViewViewRequestCls() +ScreenNode = clientApi.GetScreenNodeCls() + class TestScreen(ScreenNode): - def __init__(self, namespace, name, param): - ScreenNode.__init__(self, namespace, name, param) + def __init__(self, namespace, name, param): + ScreenNode.__init__(self, namespace, name, param) self.text = "" self.holder = str("请输入姓名") - + @ViewBinder.binding(ViewBinder.BF_EditChanged | ViewBinder.BF_EditFinished) - def TextBox(self, args): - print "SearchTextBox ", args - self.text = args["Text"] - return ViewRequest.Refresh - - @ViewBinder.binding(ViewBinder.BF_BindString) - def ReturnTextString(self): - return self.text + def TextBox(self, args): + print "SearchTextBox ", args + self.text = args["Text"] + return ViewRequest.Refresh + @ViewBinder.binding(ViewBinder.BF_BindString) + def ReturnTextString(self): + return self.text ``` * 注2 @@ -843,21 +871,23 @@ PC和IOS平台没有这个问题 该控件可以用于在ui上显示骨骼模型 ```json -"paper_doll0" : { - "anchor_from" : "center", - "anchor_to" : "center", - "animation" : "", - "animation_looped": true, - "layer" : 7, - "modelname" : "", - "modelsize" : 1.0, - "offset" : [ 0, 0 ], - "renderer" : "paper_doll_renderer", - "size" : [ 100, 100 ], - "type" : "custom", - "visible" : true, - "enable_scissor_test" : false, - }, +{ + "paper_doll0" : { + "anchor_from" : "center", + "anchor_to" : "center", + "animation" : "", + "animation_looped": true, + "layer" : 7, + "modelname" : "", + "modelsize" : 1.0, + "offset" : [ 0, 0 ], + "renderer" : "paper_doll_renderer", + "size" : [ 100, 100 ], + "type" : "custom", + "visible" : true, + "enable_scissor_test" : false, + } +} ``` |
变量
| 解释 | | :----------: | ----------------------------------------------------------- | @@ -891,19 +921,21 @@ PC和IOS平台没有这个问题 3)生物类型原版模型展示。 ```json -"paper_doll0" : { - "anchor_from" : "center", - "anchor_to" : "center", - "layer" : 22, - "offset" : [ 0.0, 0.0 ], - "renderer" : "netease_paper_doll_renderer", - "init_rot_y": 60.0, - "rotation": "gesture_x", - "screen_scale": 1.0, - "size" : [ 100, 100 ], - "type" : "custom", - "visible" : true, - "enable_scissor_test" : false, +{ + "paper_doll0" : { + "anchor_from" : "center", + "anchor_to" : "center", + "layer" : 22, + "offset" : [ 0.0, 0.0 ], + "renderer" : "netease_paper_doll_renderer", + "init_rot_y": 60.0, + "rotation": "gesture_x", + "screen_scale": 1.0, + "size" : [ 100, 100 ], + "type" : "custom", + "visible" : true, + "enable_scissor_test" : false + } } ``` @@ -934,7 +966,7 @@ param = { "init_rot_y": 60, # 初始朝向 "molang_dict": {"variable.liedownamount": 1} # molang变量dict,其中key为字符串,value为float类型 } -uiNode.RenderPaperDoll(path, param) +self.GetBaseUIControl(path).asNeteasePaperDoll().RenderEntity(param) ``` 2)渲染骨骼模型 @@ -947,7 +979,7 @@ param = { "animation": "fengxi", # 动画名称 "animation_looped": False, # 是否循环播放 } -uiNode.RenderPaperDoll(path, param) +self.GetBaseUIControl(path).asNeteasePaperDoll().RenderSkeletonModel(param) ``` 3)渲染原版生物模型(不需要生物实例) @@ -960,7 +992,7 @@ param = { "init_rot_y": 60, "molang_dict": {"variable.state": 2, "variable.liedownamount": 1} # 通过molang变量来调整渲染效果(坐下的猫) } -uiNode.RenderPaperDoll(path, param) +self.GetBaseUIControl(path).asNeteasePaperDoll().RenderEntity(param) ``` 使用注意事项: @@ -981,19 +1013,21 @@ uiNode.RenderPaperDoll(path, param) 该控件可以用于在ui上显示物品 ```json -"item_renderer0" : { - "anchor_from" : "center", - "anchor_to" : "center", - "layer" : 1, - "offset" : [ 0, 0 ], - "property_bag" : { - "#item_id_aux" : 131072 - }, - "renderer" : "inventory_item_renderer", - "size" : [ 100, 100 ], - "type" : "custom", - "visible" : true - }, +{ + "item_renderer0" : { + "anchor_from" : "center", + "anchor_to" : "center", + "layer" : 1, + "offset" : [ 0, 0 ], + "property_bag" : { + "#item_id_aux" : 131072 + }, + "renderer" : "inventory_item_renderer", + "size" : [ 100, 100 ], + "type" : "custom", + "visible" : true + } +} ``` |
变量
| 解释 | | :----------: | ----------------------------------------------------------- | @@ -1026,42 +1060,44 @@ uiNode.RenderPaperDoll(path, param) 该控件是可以滑动的窗口,需要有其他控件附属。 ```json - "scroll_view0@common.scrolling_panel" : { - "$background_nine_slice_buttom" : 0, - "$background_nine_slice_left" : 0, - "$background_nine_slice_right" : 0, - "$background_nine_slice_top" : 0, - "$background_nineslice_size" : [ 0, 0, 0, 0 ], - "$box_nine_slice_buttom" : 0, - "$box_nine_slice_left" : 0, - "$box_nine_slice_right" : 0, - "$box_nine_slice_top" : 0, - "$box_nineslice_size" : [ 0, 0, 0, 0 ], - "$is_background_nine_slice" : false, - "$is_box_nine_slice" : false, - "$is_track_nine_slice" : false, - "$scroll_background_image_control" : "fpsBattle.scroll_background_image", - "$scroll_background_texture" : "textures/ui/ScrollRail", - "$scroll_box_mouse_image_control" : "fpsBattle.scroll_box_image", - "$scroll_box_texture" : "textures/ui/newTouchScrollBox", - "$scroll_box_touch_image_control" : "fpsBattle.scroll_box_image", - "$scroll_track_image_control" : "fpsBattle.scroll_track_image", - "$scroll_track_texture" : "textures/ui/ScrollRail", - "$scrolling_content" : "fpsBattle.image", - "$show_background" : true, - "$track_nine_slice_buttom" : 0, - "$track_nine_slice_left" : 0, - "$track_nine_slice_right" : 0, - "$track_nine_slice_top" : 0, - "$track_nineslice_size" : [ 0, 0, 0, 0 ], - "anchor_from" : "center", - "anchor_to" : "center", - "layer" : 9, - "offset" : [ 0, 0 ], - "size" : [ 100, 80 ], - "type" : "scroll_view", - "visible" : true - }, +{ + "scroll_view0@common.scrolling_panel" : { + "$background_nine_slice_buttom" : 0, + "$background_nine_slice_left" : 0, + "$background_nine_slice_right" : 0, + "$background_nine_slice_top" : 0, + "$background_nineslice_size" : [ 0, 0, 0, 0 ], + "$box_nine_slice_buttom" : 0, + "$box_nine_slice_left" : 0, + "$box_nine_slice_right" : 0, + "$box_nine_slice_top" : 0, + "$box_nineslice_size" : [ 0, 0, 0, 0 ], + "$is_background_nine_slice" : false, + "$is_box_nine_slice" : false, + "$is_track_nine_slice" : false, + "$scroll_background_image_control" : "fpsBattle.scroll_background_image", + "$scroll_background_texture" : "textures/ui/ScrollRail", + "$scroll_box_mouse_image_control" : "fpsBattle.scroll_box_image", + "$scroll_box_texture" : "textures/ui/newTouchScrollBox", + "$scroll_box_touch_image_control" : "fpsBattle.scroll_box_image", + "$scroll_track_image_control" : "fpsBattle.scroll_track_image", + "$scroll_track_texture" : "textures/ui/ScrollRail", + "$scrolling_content" : "fpsBattle.image", + "$show_background" : true, + "$track_nine_slice_buttom" : 0, + "$track_nine_slice_left" : 0, + "$track_nine_slice_right" : 0, + "$track_nine_slice_top" : 0, + "$track_nineslice_size" : [ 0, 0, 0, 0 ], + "anchor_from" : "center", + "anchor_to" : "center", + "layer" : 9, + "offset" : [ 0, 0 ], + "size" : [ 100, 80 ], + "type" : "scroll_view", + "visible" : true + } +} ``` |
变量
| 解释 | @@ -1126,32 +1162,34 @@ mouse_path = scroll_view_path + "/scroll_mouse/scroll_view/stack_panel/backgroun Grid组件属于网格型的排列,可以依附在滚动条中,用来实现背包等功能。 ```json - "grid0" : { - "anchor_from" : "center", - "anchor_to" : "center", - "collection_name" : "test_grid", - "grid_dimensions" : [ 2, 2 ], - "grid_item_template" : "fpsBattle.netease_editor_template_image", - "grid_rescaling_type" : "none", - "maximum_grid_items" : 0, - "layer" : 1, - "offset" : [ 0, 0 ], - "size" : [ 200, 200 ], - "type" : "grid", - "visible" : true +{ + "grid0" : { + "anchor_from" : "center", + "anchor_to" : "center", + "collection_name" : "test_grid", + "grid_dimensions" : [ 2, 2 ], + "grid_item_template" : "fpsBattle.netease_editor_template_image", + "grid_rescaling_type" : "none", + "maximum_grid_items" : 0, + "layer" : 1, + "offset" : [ 0, 0 ], + "size" : [ 200, 200 ], + "type" : "grid", + "visible" : true }, "netease_editor_template_image" : { - "anchor_from" : "center", - "anchor_to" : "center", - "layer" : 1, - "offset" : [ 0, 0 ], - "size" : [ "50%", "50%" ], - "texture" : "textures/netease/common/image/default", - "type" : "image", - "uv" : [ 0, 0 ], - "uv_size" : [ 107, 107 ], - "visible" : true - }, + "anchor_from" : "center", + "anchor_to" : "center", + "layer" : 1, + "offset" : [ 0, 0 ], + "size" : [ "50%", "50%" ], + "texture" : "textures/netease/common/image/default", + "type" : "image", + "uv" : [ 0, 0 ], + "uv_size" : [ 107, 107 ], + "visible" : true + } +} ``` |
变量
| 解释 | @@ -1186,43 +1224,49 @@ Grid组件属于网格型的排列,可以依附在滚动条中,用来实现 3. grid控件不建议使用其子控件路径对其动态生成的格子控件直接进行SetVisible等操作,因为在每次界面刷新时grid控件会对所有的格子做一次数据更新,更新的过程中会强制将格子可见性置True。如果有需要对格子进行操作,可以使用数据绑定的方式,如下代码和json。需要注意的是在数据绑定的回调函数中需要明确grid本身是否可见,否则会造成grid子节点控件的可见性数据异常,从而影响界面操作逻辑。 ```json - "grid1" : { - "anchor_from" : "center", - "anchor_to" : "center", - "collection_name" : "gridDemo", - "grid_dimensions" : [ 2, 2 ], - "grid_item_template" : "UIDemo.scrollviewBtn0", - "layer" : 39, - "offset" : [ 0, 0 ], - "size" : [ 200, 200 ], - "type" : "grid", - "visible" : true +{ + "grid1" : { + "anchor_from" : "center", + "anchor_to" : "center", + "collection_name" : "gridDemo", + "grid_dimensions" : [ 2, 2 ], + "grid_item_template" : "UIDemo.scrollviewBtn0", + "layer" : 39, + "offset" : [ 0, 0 ], + "size" : [ 200, 200 ], + "type" : "grid", + "visible" : true }, "scrollviewBtn0@UIDemo.scrollviewBtn": { - "bindings" : [ - { - "binding_collection_name" : "gridDemo", - "binding_condition" : "always", - "binding_name" : "#UIDemo.visible", - "binding_name_override" : "#visible", - "binding_type" : "collection" - } - ], - "visible" : "#UIDemo.visible" - }, + "bindings" : [ + { + "binding_collection_name" : "gridDemo", + "binding_condition" : "always", + "binding_name" : "#UIDemo.visible", + "binding_name_override" : "#visible", + "binding_type" : "collection" + } + ], + "visible" : "#UIDemo.visible" + } +} ``` ```python +import mod.client.extraClientApi as clientApi +ViewBinder = clientApi.GetViewBinderCls() +ViewRequest = clientApi.GetViewViewRequestCls() +ScreenNode = clientApi.GetScreenNodeCls() + class UIDemoScreen(ScreenNode): def __init__(self, namespace, name, param): - self.demoGridControl = None - ...... + ScreenNode.__init__(self, namespace, name, param) + self.demoGridControl = None + + def Create(self): + self.demoGridControl = self.GetBaseUIControl("/grid1") - def Create(self): - self.demoGridControl = self.GetBaseUIControl("/grid1") - ...... - - @ViewBinder.binding_collection(ViewBinder.BF_BindBool, "gridDemo", "#UIDemo.visible") + @ViewBinder.binding_collection(ViewBinder.BF_BindBool, "gridDemo", "#UIDemo.visible") def GridItemVisible(self, index): return index < self.showNum and self.demoGridControl.GetVisible() ``` @@ -1233,55 +1277,57 @@ class UIDemoScreen(ScreenNode): ProgressBar进度条控件,用于百分比显示进度 ```json - "progress_bar0" : { - "$clip_direction" : "left", - "$clip_ratio" : 0.0, - "$is_new_nine_slice" : false, - "$nine_slice_buttom" : 0, - "$nine_slice_left" : 0, - "$nine_slice_right" : 0, - "$nine_slice_top" : 0, - "$nineslice_size" : [ 0, 0, 0, 0 ], - "$progress_bar_empty_texture" : "textures/ui/empty_progress_bar", - "$progress_bar_filled_texture" : "textures/ui/filled_progress_bar", - "anchor_from" : "center", - "anchor_to" : "center", - "controls" : [ - { - "empty_progress_bar@fpsBattle.empty_progress_bar" : {} - }, - { - "filled_progress_bar@fpsBattle.filled_progress_bar" : {} - } - ], - "layer" : 8, - "offset" : [ 0, 0 ], - "size" : [ 100, 10 ], - "type" : "panel", - "visible" : true - }, - "empty_progress_bar" : { - "is_new_nine_slice" : "$is_new_nine_slice", - "layer" : 1, - "nine_slice_buttom" : "$nine_slice_buttom", - "nine_slice_left" : "$nine_slice_left", - "nine_slice_right" : "$nine_slice_right", - "nine_slice_top" : "$nine_slice_top", - "texture" : "$progress_bar_empty_texture", - "type" : "image" - }, - "filled_progress_bar" : { - "clip_direction" : "$clip_direction", - "clip_ratio" : "$clip_ratio", - "is_new_nine_slice" : "$is_new_nine_slice", - "layer" : 2, - "nine_slice_buttom" : "$nine_slice_buttom", - "nine_slice_left" : "$nine_slice_left", - "nine_slice_right" : "$nine_slice_right", - "nine_slice_top" : "$nine_slice_top", - "texture" : "$progress_bar_filled_texture", - "type" : "image" - }, +{ + "progress_bar0" : { + "$clip_direction" : "left", + "$clip_ratio" : 0.0, + "$is_new_nine_slice" : false, + "$nine_slice_buttom" : 0, + "$nine_slice_left" : 0, + "$nine_slice_right" : 0, + "$nine_slice_top" : 0, + "$nineslice_size" : [ 0, 0, 0, 0 ], + "$progress_bar_empty_texture" : "textures/ui/empty_progress_bar", + "$progress_bar_filled_texture" : "textures/ui/filled_progress_bar", + "anchor_from" : "center", + "anchor_to" : "center", + "controls" : [ + { + "empty_progress_bar@fpsBattle.empty_progress_bar" : {} + }, + { + "filled_progress_bar@fpsBattle.filled_progress_bar" : {} + } + ], + "layer" : 8, + "offset" : [ 0, 0 ], + "size" : [ 100, 10 ], + "type" : "panel", + "visible" : true + }, + "empty_progress_bar" : { + "is_new_nine_slice" : "$is_new_nine_slice", + "layer" : 1, + "nine_slice_buttom" : "$nine_slice_buttom", + "nine_slice_left" : "$nine_slice_left", + "nine_slice_right" : "$nine_slice_right", + "nine_slice_top" : "$nine_slice_top", + "texture" : "$progress_bar_empty_texture", + "type" : "image" + }, + "filled_progress_bar" : { + "clip_direction" : "$clip_direction", + "clip_ratio" : "$clip_ratio", + "is_new_nine_slice" : "$is_new_nine_slice", + "layer" : 2, + "nine_slice_buttom" : "$nine_slice_buttom", + "nine_slice_left" : "$nine_slice_left", + "nine_slice_right" : "$nine_slice_right", + "nine_slice_top" : "$nine_slice_top", + "texture" : "$progress_bar_filled_texture", + "type" : "image" + } +} ``` |
变量
| 解释 | @@ -1312,28 +1358,30 @@ ProgressBar进度条控件,用于百分比显示进度 开关控件,用于两个状态之间的切换 ```json -"switch_toggle0@common_toggles.switch_toggle_collection" : { - "$default_texture" : "textures/ui/toggle_off", - "$hover_texture" : "textures/ui/toggle_on", - "$pressed_no_hover_texture" : "textures/ui/toggle_on_hover", - "$pressed_texture" : "textures/ui/toggle_off_hover", - "$toggle_name" : "#fpsBattle.toggle_name", - "$toggle_state_binding_name" : "#fpsBattle.toggle_state", - "anchor_from" : "center", - "anchor_to" : "center", - "bindings" : [ - { - "binding_collection_name" : "", - "binding_condition" : "always_when_visible", - "binding_type" : "collection_details" - } - ], - "layer" : 6, - "offset" : [ 0, 0 ], - "size" : [ 100, 100 ], - "type" : "panel", - "visible" : true - }, +{ + "switch_toggle0@common_toggles.switch_toggle_collection" : { + "$default_texture" : "textures/ui/toggle_off", + "$hover_texture" : "textures/ui/toggle_on", + "$pressed_no_hover_texture" : "textures/ui/toggle_on_hover", + "$pressed_texture" : "textures/ui/toggle_off_hover", + "$toggle_name" : "#fpsBattle.toggle_name", + "$toggle_state_binding_name" : "#fpsBattle.toggle_state", + "anchor_from" : "center", + "anchor_to" : "center", + "bindings" : [ + { + "binding_collection_name" : "", + "binding_condition" : "always_when_visible", + "binding_type" : "collection_details" + } + ], + "layer" : 6, + "offset" : [ 0, 0 ], + "size" : [ 100, 100 ], + "type" : "panel", + "visible" : true + } +} ``` |
变量
| 解释 | @@ -1348,9 +1396,14 @@ ProgressBar进度条控件,用于百分比显示进度 * 注1 ```python +import mod.client.extraClientApi as clientApi +ViewBinder = clientApi.GetViewBinderCls() +ViewRequest = clientApi.GetViewViewRequestCls() +ScreenNode = clientApi.GetScreenNodeCls() + class TestScreen(ScreenNode): - def __init__(self, namespace, name, param): - ScreenNode.__init__(self, namespace, name, param) + def __init__(self, namespace, name, param): + ScreenNode.__init__(self, namespace, name, param) self.currentToggleShow = True @ViewBinder.binding(ViewBinder.BF_ToggleChanged) @@ -1358,7 +1411,7 @@ class TestScreen(ScreenNode): self.currentToggleShow = args["state"] return ViewRequest.Refresh - @ViewBinder.binding(ViewBinder.BF_BindBool) + @ViewBinder.binding(ViewBinder.BF_BindBool) def ReturnToggleState(self): return self.currentToggleShow @@ -1381,32 +1434,34 @@ class TestScreen(ScreenNode): 滑动条控件,用于拖动设置进度或百分比。 ```json -"slider0@common.slider": { - "$slider_tts_text_value": "#netease_tts_text_value", - "$slider_name": "#UIDemoScreen.OnDemoSliderChange", - "$slider_value_binding_name":"#UIDemoScreen.ReturnSliderValue", - "$slider_steps_binding_name": "#UIDemoScreen.ReturnSliderStep", - "$background_default_control": "common.slider_background", - "$progress_default_control": "common.slider_progress", - "$progress_default_clip_direction": "left", - "$background_hover_control": "common.slider_background_hover", - "$progress_hover_control": "common.slider_progress_hover", - "$progress_hover_clip_direction": "left", - "$slider_direction": "horizontal", - "$slider_box_layout": "common.slider_button_layout", - "$slider_box_hover_layout": "common.slider_button_hover_layout", - "$slider_box_locked_layout": "common.slider_button_locked_layout", - "$slider_box_indent_layout": "common.slider_button_indent_layout", - "$slider_box_size": [ 10, 16 ], - "size": [ 100, 10 ], - "offset": [ 0, 0 ], - "$slider_step_factory_control_ids": { - "slider_step": "@common.slider_step", - "slider_step_hover": "@common.slider_step_hover", - "slider_step_progress": "@common.slider_step_progress", - "slider_step_progress_hover": "@common.slider_step_progress_hover" - }, - } +{ + "slider0@common.slider": { + "$slider_tts_text_value": "#netease_tts_text_value", + "$slider_name": "#UIDemoScreen.OnDemoSliderChange", + "$slider_value_binding_name": "#UIDemoScreen.ReturnSliderValue", + "$slider_steps_binding_name": "#UIDemoScreen.ReturnSliderStep", + "$background_default_control": "common.slider_background", + "$progress_default_control": "common.slider_progress", + "$progress_default_clip_direction": "left", + "$background_hover_control": "common.slider_background_hover", + "$progress_hover_control": "common.slider_progress_hover", + "$progress_hover_clip_direction": "left", + "$slider_direction": "horizontal", + "$slider_box_layout": "common.slider_button_layout", + "$slider_box_hover_layout": "common.slider_button_hover_layout", + "$slider_box_locked_layout": "common.slider_button_locked_layout", + "$slider_box_indent_layout": "common.slider_button_indent_layout", + "$slider_box_size": [10, 16], + "size": [100, 10], + "offset": [0, 0], + "$slider_step_factory_control_ids": { + "slider_step": "@common.slider_step", + "slider_step_hover": "@common.slider_step_hover", + "slider_step_progress": "@common.slider_step_progress", + "slider_step_progress_hover": "@common.slider_step_progress_hover" + } + } +} ``` |
变量
| 解释 | @@ -1436,27 +1491,32 @@ class TestScreen(ScreenNode): * 注1 ```python +import mod.client.extraClientApi as clientApi +ViewBinder = clientApi.GetViewBinderCls() +ViewRequest = clientApi.GetViewViewRequestCls() +ScreenNode = clientApi.GetScreenNodeCls() + class UIDemoScreen(ScreenNode): - def __init__(self, namespace, name, param): - ScreenNode.__init__(self, namespace, name, param) + def __init__(self, namespace, name, param): + ScreenNode.__init__(self, namespace, name, param) self.sliderPercentValue = 0.5 # 百分比值 # self.sliderAbsValue = 5.0 # 固定值 @ViewBinder.binding(ViewBinder.BF_SliderChanged | ViewBinder.BF_SliderFinished) - def OnDemoSliderChange(self, value, isFinish, _unused): - self.sliderPercentValue = value # 百分比类型滑动条保存值 - # self.sliderAbsValue = value # 固定格类型滑动条保存值 - return ViewRequest.Refresh + def OnDemoSliderChange(self, value, isFinish, _unused): + self.sliderPercentValue = value # 百分比类型滑动条保存值 + # self.sliderAbsValue = value # 固定格类型滑动条保存值 + return ViewRequest.Refresh - @ViewBinder.binding(ViewBinder.BF_BindFloat) - def ReturnSliderValue(self): - return self.sliderPercentValue # 百分比类型滑动条返回值 - # return self.sliderAbsValue # 固定格类型滑动条返回值 + @ViewBinder.binding(ViewBinder.BF_BindFloat) + def ReturnSliderValue(self): + return self.sliderPercentValue # 百分比类型滑动条返回值 + # return self.sliderAbsValue # 固定格类型滑动条返回值 @ViewBinder.binding(ViewBinder.BF_BindInt) - def ReturnSliderStep(self): - return 1 # 百分比类型滑动条 - # return 10 # 固定格类型滑动条 + def ReturnSliderStep(self): + return 1 # 百分比类型滑动条 + # return 10 # 固定格类型滑动条 ``` 下图为Slider在游戏中的控件表现 @@ -1527,37 +1587,37 @@ def getFirstItemRange(itemNum): "controls": [ { "state_default@custom_wheel_namespace.wheel_state": { - "texture" : "textures/ui/circle/custom_wheel_selection_default" + "texture" : "textures/ui/circle/custom_wheel_selection_default" } }, { "state_0@custom_wheel_namespace.wheel_state": { - "texture" : "textures/ui/circle/custom_wheel_selection_0" + "texture" : "textures/ui/circle/custom_wheel_selection_0" } }, { "state_1@custom_wheel_namespace.wheel_state": { - "texture" : "textures/ui/circle/custom_wheel_selection_1" + "texture" : "textures/ui/circle/custom_wheel_selection_1" } }, { "state_2@custom_wheel_namespace.wheel_state": { - "texture" : "textures/ui/circle/custom_wheel_selection_2" + "texture" : "textures/ui/circle/custom_wheel_selection_2" } }, { "state_3@custom_wheel_namespace.wheel_state": { - "texture" : "textures/ui/circle/custom_wheel_selection_3" + "texture" : "textures/ui/circle/custom_wheel_selection_3" } }, { "state_4@custom_wheel_namespace.wheel_state": { - "texture" : "textures/ui/circle/custom_wheel_selection_4" + "texture" : "textures/ui/circle/custom_wheel_selection_4" } }, { "state_5@custom_wheel_namespace.wheel_state": { - "texture" : "textures/ui/circle/custom_wheel_selection_5" + "texture" : "textures/ui/circle/custom_wheel_selection_5" } } ] @@ -1630,11 +1690,13 @@ hover事件的触发本质上是与鼠标悬浮相关,在PC模式中,当鼠 ```json - "main" : { - "controls" : [], - "type" : "screen", - "gamepad_cursor_deflection_mode": true - }, +{ + "main" : { + "controls" : [], + "type" : "screen", + "gamepad_cursor_deflection_mode": true + } +} ``` @@ -1644,38 +1706,40 @@ hover事件的触发本质上是与鼠标悬浮相关,在PC模式中,当鼠 网易版单选下拉框,可以在给定的选项中进行选择。 ```json -"comboBoxPanel@combo_box.comboBoxPanel" : { - "$content_size":[ "100.0%+0.0px", 100 ], - "$item_size":[ "100.0%+0.0px", "10.0%x+0.0px" ], - "$title_label":"combo_box.titleLabel", - "$content_label":"combo_box.label", - "$title_down_image":"combo_box.dropdownImage", - "$title_up_image":"combo_box.dropupImage", - "$default_title_texture" : "textures/ui/button_borderless_light", - "$hover_title_texture" : "textures/ui/button_borderless_lighthover", - "$pressed_title_texture" : "textures/ui/button_borderless_lightpressed", - "$title_nineslice_size|default" : [ 0.0, 0.0, 0.0, 0.0 ], - "$default_item_texture" : "textures/ui/button_borderless_light", - "$hover_item_texture" : "textures/ui/button_borderless_lighthover", - "$pressed_item_texture" : "textures/ui/button_borderless_lightpressed", - "$item_nineslice_size|default" : [ 0.0, 0.0, 0.0, 0.0 ], - "$scroll_background_texture" : "textures/ui/ScrollRail", - "alpha" : 1.0, - "anchor_from" : "center", - "anchor_to" : "center", - "clip_offset" : [ 0, 0 ], - "clips_children" : false, - "enabled" : true, - "layer" : 0, - "max_size" : [ 0, 0 ], - "min_size" : [ 0, 0 ], - "offset" : [ 0.0, 0.0 ], - "priority" : 0, - "propagate_alpha" : false, - "size" : [ 120, 20 ], - "type" : "panel", - "visible" : true - } +{ + "comboBoxPanel@combo_box.comboBoxPanel" : { + "$content_size":[ "100.0%+0.0px", 100 ], + "$item_size":[ "100.0%+0.0px", "10.0%x+0.0px" ], + "$title_label":"combo_box.titleLabel", + "$content_label":"combo_box.label", + "$title_down_image":"combo_box.dropdownImage", + "$title_up_image":"combo_box.dropupImage", + "$default_title_texture" : "textures/ui/button_borderless_light", + "$hover_title_texture" : "textures/ui/button_borderless_lighthover", + "$pressed_title_texture" : "textures/ui/button_borderless_lightpressed", + "$title_nineslice_size|default" : [ 0.0, 0.0, 0.0, 0.0 ], + "$default_item_texture" : "textures/ui/button_borderless_light", + "$hover_item_texture" : "textures/ui/button_borderless_lighthover", + "$pressed_item_texture" : "textures/ui/button_borderless_lightpressed", + "$item_nineslice_size|default" : [ 0.0, 0.0, 0.0, 0.0 ], + "$scroll_background_texture" : "textures/ui/ScrollRail", + "alpha" : 1.0, + "anchor_from" : "center", + "anchor_to" : "center", + "clip_offset" : [ 0, 0 ], + "clips_children" : false, + "enabled" : true, + "layer" : 0, + "max_size" : [ 0, 0 ], + "min_size" : [ 0, 0 ], + "offset" : [ 0.0, 0.0 ], + "priority" : 0, + "propagate_alpha" : false, + "size" : [ 120, 20 ], + "type" : "panel", + "visible" : true + } +} ``` @@ -1712,38 +1776,40 @@ UI编辑器暂时不支持编辑 其中官方封装了地图界面基类 MiniMapBaseScreen 供开发者扩展。 ```json -"mainPanel@mini_map.mini_map_wrapper" : { - "anchor_from" : "top_right", - "anchor_to" : "top_right", - "layer" : 1, - "offset" : [ -10.0, 10.0 ], - "$enable_live_update": false, - "$live_update_interval": 5, - "$use_default_face_icon": true, - "$face_icon_size": [4,4], - "$face_icon_bg_color": "white", - "$highest_y": 0 - // 如果希望小地图能够被裁剪,请继承后修改controls如下: - "controls":[ - { - "mini_map_bg@mini_map.mini_map_bg": {} - }, - { - "netease_mini_map@mini_map.netease_mini_map": { - "allow_clipping":true, - "enable_scissor_test" : true - } - }, - { - "icon@mini_map.icon": {} - }, - { - "head_lbl@mini_map.head_label": {} - }, - { - "text_lbl@mini_map.text_label": {} - } - ] +{ + "mainPanel@mini_map.mini_map_wrapper" : { + "anchor_from" : "top_right", + "anchor_to" : "top_right", + "layer" : 1, + "offset" : [ -10.0, 10.0 ], + "$enable_live_update": false, + "$live_update_interval": 5, + "$use_default_face_icon": true, + "$face_icon_size": [4,4], + "$face_icon_bg_color": "white", + "$highest_y": 0, + // 如果希望小地图能够被裁剪,请继承后修改controls如下: + "controls":[ + { + "mini_map_bg@mini_map.mini_map_bg": {} + }, + { + "netease_mini_map@mini_map.netease_mini_map": { + "allow_clipping":true, + "enable_scissor_test" : true + } + }, + { + "icon@mini_map.icon": {} + }, + { + "head_lbl@mini_map.head_label": {} + }, + { + "text_lbl@mini_map.text_label": {} + } + ] + } } ``` @@ -1764,12 +1830,14 @@ UI编辑器暂时不支持编辑 该控件可以用于在ui上绘制渐变颜色 ```json -"gradient": { - "color1": [1, 0, 1, 1], - "color2": [0, 0, 1, 1], - "gradient_direction": "vertical", - "renderer": "gradient_renderer", - "type": "custom" +{ + "gradient": { + "color1": [1, 0, 1, 1], + "color2": [0, 0, 1, 1], + "gradient_direction": "vertical", + "renderer": "gradient_renderer", + "type": "custom" + } } ``` @@ -1874,6 +1942,10 @@ ScreenNode = clientApi.GetScreenNodeCls() ### UI界面初始化 ```python +import mod.client.extraClientApi as clientApi + +ScreenNode = clientApi.GetScreenNodeCls() + class TestScreen(ScreenNode): def __init__(self, namespace, name, param): ScreenNode.__init__(self, namespace, name, param) @@ -1884,32 +1956,32 @@ ScreenNode是我们的UI节点基类,必须继承。 ```python # Bind Type class ViewBinder(object): - ButtonFilter = 0x10000000 - BF_ButtonClickUp = 0 | ButtonFilter - BF_ButtonClickDown = 1 | ButtonFilter - BF_ButtonClick = 2 | ButtonFilter - BF_ButtonClickCancel= 3 - BF_InteractButtonClick = 4 - BindFilter = 0x01000000 - BF_BindBool = 5 | BindFilter - BF_BindInt = 6 | BindFilter - BF_BindFloat = 7 | BindFilter - BF_BindString = 8 | BindFilter - BF_BindGridSize = 9 | BindFilter - BF_BindColor = 10 | BindFilter - EditFilter = 0x00100000 - BF_EditChanged = 11 | EditFilter - BF_EditFinished = 12 | EditFilter + ButtonFilter = 0x10000000 + BF_ButtonClickUp = 0 | ButtonFilter + BF_ButtonClickDown = 1 | ButtonFilter + BF_ButtonClick = 2 | ButtonFilter + BF_ButtonClickCancel = 3 + BF_InteractButtonClick = 4 + BindFilter = 0x01000000 + BF_BindBool = 5 | BindFilter + BF_BindInt = 6 | BindFilter + BF_BindFloat = 7 | BindFilter + BF_BindString = 8 | BindFilter + BF_BindGridSize = 9 | BindFilter + BF_BindColor = 10 | BindFilter + EditFilter = 0x00100000 + BF_EditChanged = 11 | EditFilter + BF_EditFinished = 12 | EditFilter ToggleFilter = 0x00010000 - BF_ToggleChanged = 13 | ToggleFilter + BF_ToggleChanged = 13 | ToggleFilter + # Return Type class ViewRequest(object): - Nothing = 0 - Refresh = 1 << 0 - PointerHeldEventsRequest = 1 << 1 - PointerHeldEventsCancel = 1 << 2 - Exit = 1 << 3 - + Nothing = 0 + Refresh = 1 << 0 + PointerHeldEventsRequest = 1 << 1 + PointerHeldEventsCancel = 1 << 2 + Exit = 1 << 3 ``` ### UI绑定和返回 @@ -1940,19 +2012,25 @@ bind_flag为上文中绑定类型,binding_name为绑定名称。 binding_name为脚本绑定变量,binding_name_override为引擎变量,json格式如下 ```json - "bindings" : [ - { +{ + "bindings": [ + { "binding_condition" : "always", "binding_name" : "#scoreboard_grid.item_count", "binding_name_override" : "#StackGridItemsCount" - } - ] + } + ] +} ``` 对应的Python代码如下 ```python - @ViewBinder.binding(ViewBinder.BF_BindInt, "#scoreboard_grid.item_count") - def OnStarkGridResize(self): - return len(self.scoreBoardList) +import mod.client.extraClientApi as clientApi + +ViewBinder = clientApi.GetViewBinderCls() + +@ViewBinder.binding(ViewBinder.BF_BindInt, "#scoreboard_grid.item_count") +def OnStarkGridResize(self): + return len(self.scoreBoardList) ``` **binding_collection(bind_flag, collection_name, binding_name = None)** @@ -1962,38 +2040,46 @@ bind_flag为上文中的绑定类型,collection_name为集合名称,binding_ 集合的json如下: ```json -"collection_name" : "scoreboard_stackgrid" +{ + "collection_name" : "scoreboard_stackgrid" +} ``` 在集合的子控件中,binding_collection_name为集合名,binding_condition为绑定条件,binding_name为绑定名称,binding_type为collection绑定,property_bag设置他的初始值,text为它的绑定值。 ```json - "label_score_board" : { - "bindings" : [ - { - "binding_collection_name" : "scoreboard_stackgrid", - "binding_condition" : "always", - "binding_name" : "#label_score_board.text", - "binding_type" : "collection" - } - ], - "offset" : [ "0%+0 px", "0%+0px" ], - "property_bag" : { - "#label_score_board.text" : "666666666666" - }, - "text" : "#label_score_board.text", - "text_alignment" : "left", - "type" : "label", - "visible" : true - }, +{ + "label_score_board" : { + "bindings" : [ + { + "binding_collection_name" : "scoreboard_stackgrid", + "binding_condition" : "always", + "binding_name" : "#label_score_board.text", + "binding_type" : "collection" + } + ], + "offset" : [ "0%+0 px", "0%+0px" ], + "property_bag" : { + "#label_score_board.text" : "666666666666" + }, + "text" : "#label_score_board.text", + "text_alignment" : "left", + "type" : "label", + "visible" : true + } +} ``` 对应的Python代码如下,其中index表示在集合中的哪一元素。 ```python - @ViewBinder.binding_collection(ViewBinder.BF_BindString, "scoreboard_stackgrid", "#label_score_board.text") - def OnRefreshScoreBoardLabel(self, index): - return self.scoreBoardList[index] if len(self.scoreBoardList) > index else "" +import mod.client.extraClientApi as clientApi + +ViewBinder = clientApi.GetViewBinderCls() + +@ViewBinder.binding_collection(ViewBinder.BF_BindString, "scoreboard_stackgrid", "#label_score_board.text") +def OnRefreshScoreBoardLabel(self, index): + return self.scoreBoardList[index] if len(self.scoreBoardList) > index else "" ``` ## 接口调用说明 @@ -2009,10 +2095,11 @@ bind_flag为上文中的绑定类型,collection_name为集合名称,binding_ 假设设置Mod名称为"myModName",示例: ```python - @Mod.Binding(name = "myModName", version = "0.1") - class MyModClass(object): - def __init__(self): - pass +from mod.common.mod import Mod +@Mod.Binding(name = "myModName", version = "0.1") +class MyModClass(object): + def __init__(self): + pass ``` ### 界面创建流程及生命周期 @@ -2089,7 +2176,7 @@ bind_flag为上文中的绑定类型,collection_name为集合名称,binding_ 使用方法如下所示 -```json +```html // 定制化文本控件 ``` -```json +```html // 在非标签的内容 Dear player,
welcome to Minecraft,
where you can build your own world ``` -```json +```html // 按钮控件 // 注意:如果按钮控件空间不足以显示该字符串,多余部分将以"..."显示 :恭喜!
击杀了{"text" : "末影人", "format_code":"§2"} ``` @@ -2125,69 +2212,79 @@ Dear player,
welcome to Minecraft,
where you can build your own world #### 定制化文本控件 -在字符串中嵌入``样式文本会被解析成定制文本,与常规文本不同的是定制化文本可以独立设置文字的字体、大小、颜色等,丰富富文本的文本样式。label_data为特殊化数据,以下所列属性为必须属性,text为文本,font为字体,默认值为unicode,scale为字体缩放倍率,默认值为1.0,color为字体颜色,默认值为[1,1,1,1]。需要注意的是如果文本中存在中文字符则字体会被强制设置为unicode,此外如果字体缩放倍率过大该段文本将不会被显示。 +在字符串中嵌入``样式文本会被解析成定制文本,与常规文本不同的是定制化文本可以独立设置文字的字体、大小、颜色等,丰富富文本的文本样式。label_data为特殊化数据,以下所列属性为必须属性,text为文本,font为字体,默认值为unicode,scale为字体缩放倍率,默认值为1.0,color为字体颜色,默认值为[1,1,1,1]。需要注意的是如果文本中存在中文字符则字体会被强制设置为unicode,此外如果字体缩放倍率过大该段文本将不会被显示。 ```json - label_data:{ - "text" : "玩家一", - "font" : "smooth", - "scale": 3, - "color": [1,0,0,1] - } +{ + "label_data": { + "text" : "玩家一", + "font" : "smooth", + "scale": 3, + "color": [1,0,0,1] + } +} ``` #### 图片控件 -在字符串中嵌入`image_data`样式文本会被解析成图片,image_data为特殊化数据,以下所列属性为必须属性,texture为资源路径,x为图片宽度,y为图片高度 +在字符串中嵌入`"image_data"`样式文本会被解析成图片,image_data为特殊化数据,以下所列属性为必须属性,texture为资源路径,x为图片宽度,y为图片高度 ```json - image_data:{ - "texture":"texture/ui/laugh", - "x":30, - "y":30 +{ + "image_data": { + "texture":"texture/ui/laugh", + "x":30, + "y":30 } +} ``` #### 按钮 -在字符串中嵌入``样式会被解析成按钮,button_data为特殊化数据,开发者可以在其中添加符合json格式的自定义数据,在点击富文本中对应按钮时会将button_data通过回调函数整个返回,以下属性为必须属性,press_texture为按钮按下贴图,hover_texture为按钮鼠标悬浮贴图,default_texture为默认状态下按钮贴图,button_label为按钮上的问题,x为按钮宽度,y为按钮高度 +在字符串中嵌入``样式会被解析成按钮,button_data为特殊化数据,开发者可以在其中添加符合json格式的自定义数据,在点击富文本中对应按钮时会将button_data通过回调函数整个返回,以下属性为必须属性,press_texture为按钮按下贴图,hover_texture为按钮鼠标悬浮贴图,default_texture为默认状态下按钮贴图,button_label为按钮上的问题,x为按钮宽度,y为按钮高度 ```json - button_data:{ - "press_texture": "", - "hover_texture": "", - "default_texture": "", - "button_label": "", - "x":20, - "y":20 +{ + "button_data":{ + "press_texture": "", + "hover_texture": "", + "default_texture": "", + "button_label": "", + "x":20, + "y":20 } +} ``` #### 超链接 -在字符串中嵌入`link_data`样式会被解析成超链接,外观和普通文本无异但可以被点击,link_data为特殊化数据,开发者可以在其中添加符合json格式的自定义数据,在点击富文本中对应超链接时会将link_data通过回调函数整个返回,以下属性为必须属性,text表示显示文本,format_code表示该段显示文本的样式代码,注意,基岩版的文本控件不支持下划线和删除线。 +在字符串中嵌入`"link_data"`样式会被解析成超链接,外观和普通文本无异但可以被点击,link_data为特殊化数据,开发者可以在其中添加符合json格式的自定义数据,在点击富文本中对应超链接时会将link_data通过回调函数整个返回,以下属性为必须属性,text表示显示文本,format_code表示该段显示文本的样式代码,注意,基岩版的文本控件不支持下划线和删除线。 ```json - link_data:{ - "text":"末影人", - "format_code":"§2" - } +{ + "link_data":{ + "text":"末影人", + "format_code":"§2" + } +} ``` #### 序列帧动画 -在字符串中嵌入`sfx_data`样式文本会被解析成图片,sfx_data为特殊化数据,以下所列属性为必须属性,texture为资源路径,x为显示图片宽度,y为显示图片高度,uv_x为截取图片宽度,uv_y为截取图片高度,frame_count表示该序列帧的总帧数,fps为每秒执行帧数。 +在字符串中嵌入`"sfx_data"`样式文本会被解析成图片,sfx_data为特殊化数据,以下所列属性为必须属性,texture为资源路径,x为显示图片宽度,y为显示图片高度,uv_x为截取图片宽度,uv_y为截取图片高度,frame_count表示该序列帧的总帧数,fps为每秒执行帧数。 ```json - sfx_data:{ - "texture": "textures/ui/eating_apple", - "x":30, - "y":30, - "uv_x": 64, - "uv_y": 64, - "frame_count": 36, - "fps": 10 +{ + "sfx_data":{ + "texture": "textures/ui/eating_apple", + "x":30, + "y":30, + "uv_x": 64, + "uv_y": 64, + "frame_count": 36, + "fps": 10 } +} ``` ### 富文本成品范例 @@ -2229,28 +2326,30 @@ Dear player,
welcome to Minecraft,
where you can build your own world 开发者可以设置富文本的文本字体颜色,默认值为[1,1,1],白色 ```json - "main" : { - "absorbs_input" : true, - "always_accepts_input" : false, - "controls" : [ - { - "RichTextPanel@RichText.RichTextPanel" : {} - } - ], - "force_render_below" : false, - "is_showing_menu" : true, - "render_game_behind" : true, - "render_only_when_topmost" : true, - "should_steal_mouse" : false, - "type" : "screen" +{ + "main" : { + "absorbs_input" : true, + "always_accepts_input" : false, + "controls" : [ + { + "RichTextPanel@RichText.RichTextPanel" : {} + } + ], + "force_render_below" : false, + "is_showing_menu" : true, + "render_game_behind" : true, + "render_only_when_topmost" : true, + "should_steal_mouse" : false, + "type" : "screen" }, "RichTextPanel@rich_text.RichTextPanel" : { - "$rich_panel_bg": "textures/ui/effect_background", - "$rich_panel_nineslice_size": 0.01, - "$rich_panel_font_size" : "large", - "$rich_panel_font_scale_factor" : 2.0, - "$rich_panel_color" : [1,1,1] - }, + "$rich_panel_bg": "textures/ui/effect_background", + "$rich_panel_nineslice_size": 0.01, + "$rich_panel_font_size" : "large", + "$rich_panel_font_scale_factor" : 2.0, + "$rich_panel_color" : [1,1,1] + } +} ``` #### python脚本编写 @@ -2278,22 +2377,22 @@ Dear player,
welcome to Minecraft,
where you can build your own world 以下是示例 ```python - def CreateRichText(self): - self.richTextPath = "/RichTextPanel" - self.richTextItem = self.GetRichTextItem(self.richTextPath) - self.richTextItem.registerLinkItemClickCallback(self.OnLinkItemClickCallback) - self.richTextItem.registerButtonItemClickCallback(self.OnButtonItemClickCallback) - self.richTextItem.registerRichTextFinishCallback(self.OnRichTextCreateFinishCallback) - self.richTextItem.readRichText('[玩家]:恭喜!{"texture":"textures/ui/skin/ty_yuanshenghuli_0_0", "x":30, "y":30}击杀了{"text" : "末影人", "format_code":"§2"}{"texture": "textures/ui/eating_apple","x":30, "y":30,"uv_x": 64,"uv_y": 64,"frame_count": 36,"fps": 10}') +def CreateRichText(self): + self.richTextPath = "/RichTextPanel" + self.richTextItem = self.GetRichTextItem(self.richTextPath) + self.richTextItem.registerLinkItemClickCallback(self.OnLinkItemClickCallback) + self.richTextItem.registerButtonItemClickCallback(self.OnButtonItemClickCallback) + self.richTextItem.registerRichTextFinishCallback(self.OnRichTextCreateFinishCallback) + self.richTextItem.readRichText('[玩家]:恭喜!{"texture":"textures/ui/skin/ty_yuanshenghuli_0_0", "x":30, "y":30}击杀了{"text" : "末影人", "format_code":"§2"}{"texture": "textures/ui/eating_apple","x":30, "y":30,"uv_x": 64,"uv_y": 64,"frame_count": 36,"fps": 10}') - def OnButtonItemClickCallback(self, data, touchX, touchY): - print("---OnButtonItemClickCallback---", data, touchX, touchY) +def OnButtonItemClickCallback(self, data, touchX, touchY): + print("---OnButtonItemClickCallback---", data, touchX, touchY) - def OnLinkItemClickCallback(self, data, touchX, touchY): - print("---OnLinkItemClickCallback---", data, touchX, touchY) +def OnLinkItemClickCallback(self, data, touchX, touchY): + print("---OnLinkItemClickCallback---", data, touchX, touchY) - def OnRichTextCreateFinishCallback(self): - print("---OnRichTextCreateFinishCallback---") +def OnRichTextCreateFinishCallback(self): + print("---OnRichTextCreateFinishCallback---") ``` ##### 使用事项 diff --git a/mcguide/18-界面与交互/40-UIAPI文档.md b/mcguide/18-界面与交互/40-UIAPI文档.md index 02371ba..c1e41c8 100644 --- a/mcguide/18-界面与交互/40-UIAPI文档.md +++ b/mcguide/18-界面与交互/40-UIAPI文档.md @@ -23,8 +23,8 @@ sidebarDepth: 1 ScreenNode的一些有用的函数,界面Node节点的获取方式在[UI使用文档](30-UI说明文档.html)中有详细说明。 ```python - import mod.client.extraClientApi as clientApi - uiNode = clientApi.GetUI("myModName", "myUIName") +import mod.client.extraClientApi as clientApi +uiNode = clientApi.GetUI("myModName", "myUIName") ``` 假设下文中的函数,uiNode为获取到的ScreenNode继承类,调用的UI界面是按下面的节点树组织结构的 diff --git a/mcguide/18-界面与交互/61-原生界面修改文档.md b/mcguide/18-界面与交互/61-原生界面修改文档.md index cbb3b72..2306028 100644 --- a/mcguide/18-界面与交互/61-原生界面修改文档.md +++ b/mcguide/18-界面与交互/61-原生界面修改文档.md @@ -116,8 +116,10 @@ CustomUIScreenProxy是原生界面的代理类,可通过extraClientApi.GetUISc - 示例 ```python +# coding=utf-8 import client.extraClientApi as clientApi CustomUIScreenProxy = clientApi.GetUIScreenProxyCls() +ViewBinder = clientApi.GetViewBinderCls() class PauseScreenProxy(CustomUIScreenProxy): @@ -135,10 +137,10 @@ class PauseScreenProxy(CustomUIScreenProxy): @ViewBinder.binding(ViewBinder.BF_ToggleChanged, "#myMod.myToggle") def onToggleChanged(self, args): - """ - proxy也支持binding,这里展示的是绑定一类toggle(这类toggle甚至可以不存在),这类toggle满足"toggle_name"属性是"#myMod.myToggle"这一要求,当他们发生状态改变的时候就会调用该函数。 - """ - print("myToggle onToggleChanged: {}".format(args)) + """ + proxy也支持binding,这里展示的是绑定一类toggle(这类toggle甚至可以不存在),这类toggle满足"toggle_name"属性是"#myMod.myToggle"这一要求,当他们发生状态改变的时候就会调用该函数。 + """ + print("myToggle onToggleChanged: {}".format(args)) ``` diff --git a/mcguide/18-界面与交互/70-UI数据绑定.md b/mcguide/18-界面与交互/70-UI数据绑定.md index 0d6767b..10f7776 100644 --- a/mcguide/18-界面与交互/70-UI数据绑定.md +++ b/mcguide/18-界面与交互/70-UI数据绑定.md @@ -387,9 +387,9 @@ def OnItemToggleChecked(self, args): toggleIndex = 0 self.mCurItemIndex = toggleIndex itemDict = self.mItemData[self.mCurItemTab][toggleIndex] - self.SetSprite(self.mItemIcon, itemDict["icon"]) - self.SetText(self.mItemName, itemDict["name"]) - self.SetText(self.mItemDesc, itemDict["desc"]) + self.GetBaseUIControl(self.mItemIcon).asImage().SetSprite(itemDict["icon"]) + self.GetBaseUIControl(self.mItemName).asLabel().SetText(itemDict["name"]) + self.GetBaseUIControl(self.mItemDesc).asLabel().SetText(itemDict["desc"]) self.set_control_visible(self.mItemInfoWrap, True) ``` diff --git a/mcguide/18-界面与交互/picture/IntroduceUI/ui_image_clip.png b/mcguide/18-界面与交互/picture/IntroduceUI/ui_image_clip.png new file mode 100644 index 0000000..ff7d2ac Binary files /dev/null and b/mcguide/18-界面与交互/picture/IntroduceUI/ui_image_clip.png differ diff --git a/mcguide/18-界面与交互/picture/IntroduceUI/ui_image_keep_ratio.png b/mcguide/18-界面与交互/picture/IntroduceUI/ui_image_keep_ratio.png new file mode 100644 index 0000000..c4d95ca Binary files /dev/null and b/mcguide/18-界面与交互/picture/IntroduceUI/ui_image_keep_ratio.png differ diff --git a/mcguide/18-界面与交互/picture/IntroduceUI/ui_image_tiled1.png b/mcguide/18-界面与交互/picture/IntroduceUI/ui_image_tiled1.png new file mode 100644 index 0000000..816f3ce Binary files /dev/null and b/mcguide/18-界面与交互/picture/IntroduceUI/ui_image_tiled1.png differ diff --git a/mcguide/18-界面与交互/picture/IntroduceUI/ui_image_tiled2.png b/mcguide/18-界面与交互/picture/IntroduceUI/ui_image_tiled2.png new file mode 100644 index 0000000..4583a7d Binary files /dev/null and b/mcguide/18-界面与交互/picture/IntroduceUI/ui_image_tiled2.png differ diff --git a/mcguide/18-界面与交互/picture/IntroduceUI/ui_modifications.png b/mcguide/18-界面与交互/picture/IntroduceUI/ui_modifications.png new file mode 100644 index 0000000..3ec6fbb Binary files /dev/null and b/mcguide/18-界面与交互/picture/IntroduceUI/ui_modifications.png differ diff --git a/mcguide/20-玩法开发/10-基本概念/10-Vector3.md b/mcguide/20-玩法开发/10-基本概念/10-Vector3.md index c0329d0..210d16d 100644 --- a/mcguide/20-玩法开发/10-基本概念/10-Vector3.md +++ b/mcguide/20-玩法开发/10-基本概念/10-Vector3.md @@ -296,6 +296,72 @@ c = Vector3.Cross(a, b) ## 成员方法 +### x + +- 描述 + + 返回该向量的x坐标值。 + +- 返回值 + + | 数据类型 | 说明 | + | :------- | :-------------- | + | float | 该向量x的坐标值 | + +- 示例 + +```python +from common.utils.mcmath import Vector3 +a = Vector3(3.0, 4.0, 0.0) +print a.x # 打印 3.0 +``` + + + +### y + +- 描述 + + 返回该向量的y坐标值。 + +- 返回值 + + | 数据类型 | 说明 | + | :------- | :-------------- | + | float | 该向量y的坐标值 | + +- 示例 + +```python +from common.utils.mcmath import Vector3 +a = Vector3(3.0, 4.0, 0.0) +print a.y # 打印 4.0 +``` + + + +### z + +- 描述 + + 返回该向量的z坐标值。 + +- 返回值 + + | 数据类型 | 说明 | + | :------- | :-------------- | + | float | 该向量z的坐标值 | + +- 示例 + +```python +from common.utils.mcmath import Vector3 +a = Vector3(3.0, 4.0, 0.0) +print a.z # 打印 0.0 +``` + + + ### Length - 描述 diff --git a/mcguide/20-玩法开发/13-模组SDK编程/2-Python脚本开发/101-3.2版本物品id变更.md b/mcguide/20-玩法开发/13-模组SDK编程/2-Python脚本开发/101-3.2版本物品id变更.md new file mode 100644 index 0000000..75f8495 --- /dev/null +++ b/mcguide/20-玩法开发/13-模组SDK编程/2-Python脚本开发/101-3.2版本物品id变更.md @@ -0,0 +1,203 @@ +# 3.2版本物品id变更 + +## 简介 + +微软在1.20.50继续修改了部分方块ID,取消了附加值,相关链接请参阅[基岩版扁平化](https://zh.minecraft.wiki/w/%E5%AE%98%E6%96%B9%E9%A1%B5%E9%9D%A2/%E5%9F%BA%E5%B2%A9%E7%89%88%E6%89%81%E5%B9%B3%E5%8C%96),请开发者注意适配。 + +## 处理方法 + +在ModSDK的接口与事件中,我们针对上述情况做了以下处理: + +1. 对于返回物品信息字典的接口与事件: + + newItemName及newAuxValue返回新版名称与附加值。 + + 原字段itemName及auxValue返回旧版名称与附加值。 + +2. 对于接受物品信息字典的接口与事件: + + 当字典存在newItemName及newAuxValue时,使用这两个字段。 + + 不存在时,使用旧字段itemName及auxValue。 + +## 注意事项 + +* 通过附加值获取获取方块状态接口没有做兼容,例如GetBlockAuxValueFromStates、GetBlockStatesFromAuxValue、GetBlockStates、SetBlockStates,如果您的组件对此有依赖,则需要对这次的改动自行做兼容处理。 + +* **开发完成或正在开发的组件,建议统一采用newItemName及newAuxValue字段,也不要新旧字段混用。** + +* 某些写法可能会失效,例如 + + ```python + # 获取itemDict,然后在他基础上修改itemName或auxValue后再用来生成 + itemdict = GetPlayerItem() + itemdict['itemName'] = 'xxx' + itemdict['auxValue'] = itemdict['auxValue']+1 + SpawnItemToPlayerInv(itemdict) + ``` + + 因为GetPlayerItem返回的itemDict含有新字段,再传入SpawnItemToPlayerInv时,会读取新字段生成物品,因此对原字段的修改无效。 + +## 物品名称变更表 + +以下为3.2版本变更了名称的物品列表,表格内的名称省略了minecraft命名空间。 + +| 中文名称 | 旧命名 | 旧附加值 | 新命名 | +| :------- | ------ | -------- | ------ | +| 花岗岩 | stone | 1 | granite | +| 磨制花岗岩 | stone | 2 | polished_granite | +| 闪长岩 | stone | 3 | diorite | +| 磨制闪长岩 | stone | 4 | polished_diorite | +| 安山岩 | stone | 5 | andesite | +| 磨制安山岩 | stone | 6 | polished_andesite | +| 云杉树木板 | planks | 1 | spruce_planks | +| 白桦木板 | planks | 2 | birch_planks | +| 丛林树木板 | planks | 3 | jungle_planks | +| 金合欢木板 | planks | 4 | acacia_planks | +| 深色橡木板 | planks | 5 | dark_oak_planks | +| 橙色玻璃 | stained_glass | 1 | orange_stained_glass | +| 品红色玻璃 | stained_glass | 2 | magenta_stained_glass | +| 淡蓝色玻璃 | stained_glass | 3 | light_blue_stained_glass | +| 黄色玻璃 | stained_glass | 4 | yellow_stained_glass | +| 黄绿色玻璃 | stained_glass | 5 | lime_stained_glass | +| 粉红色玻璃 | stained_glass | 6 | pink_stained_glass | +| 灰色玻璃 | stained_glass | 7 | gray_stained_glass | +| 淡灰色玻璃 | stained_glass | 8 | light_gray_stained_glass | +| 青色玻璃 | stained_glass | 9 | cyan_stained_glass | +| 紫色玻璃 | stained_glass | 10 | purple_stained_glass | +| 蓝色玻璃 | stained_glass | 11 | blue_stained_glass | +| 棕色玻璃 | stained_glass | 12 | brown_stained_glass | +| 绿色玻璃 | stained_glass | 13 | green_stained_glass | +| 红色玻璃 | stained_glass | 14 | red_stained_glass | +| 黑色玻璃 | stained_glass | 15 | black_stained_glass | +| 橙色玻璃板 | stained_glass_pane | 1 | orange_stained_glass_pane | +| 品红色玻璃板 | stained_glass_pane | 2 | magenta_stained_glass_pane | +| 淡蓝色玻璃板 | stained_glass_pane | 3 | light_blue_stained_glass_pane | +| 黄色玻璃板 | stained_glass_pane | 4 | yellow_stained_glass_pane | +| 黄绿色玻璃板 | stained_glass_pane | 5 | lime_stained_glass_pane | +| 粉红色玻璃板 | stained_glass_pane | 6 | pink_stained_glass_pane | +| 灰色玻璃板 | stained_glass_pane | 7 | gray_stained_glass_pane | +| 淡灰色玻璃板 | stained_glass_pane | 8 | light_gray_stained_glass_pane | +| 青色玻璃板 | stained_glass_pane | 9 | cyan_stained_glass_pane | +| 紫色玻璃板 | stained_glass_pane | 10 | purple_stained_glass_pane | +| 蓝色玻璃板 | stained_glass_pane | 11 | blue_stained_glass_pane | +| 棕色玻璃板 | stained_glass_pane | 12 | brown_stained_glass_pane | +| 绿色玻璃板 | stained_glass_pane | 13 | green_stained_glass_pane | +| 红色玻璃板 | stained_glass_pane | 14 | red_stained_glass_pane | +| 黑色玻璃板 | stained_glass_pane | 15 | black_stained_glass_pane | +| 橙色陶瓦 | stained_hardened_clay | 1 | orange_terracotta | +| 品红色陶瓦 | stained_hardened_clay | 2 | magenta_terracotta | +| 淡蓝色陶瓦 | stained_hardened_clay | 3 | light_blue_terracotta | +| 黄色陶瓦 | stained_hardened_clay | 4 | yellow_terracotta | +| 黄绿色陶瓦 | stained_hardened_clay | 5 | lime_terracotta | +| 粉红色陶瓦 | stained_hardened_clay | 6 | pink_terracotta | +| 灰色陶瓦 | stained_hardened_clay | 7 | gray_terracotta | +| 淡灰色陶瓦 | stained_hardened_clay | 8 | light_gray_terracotta | +| 青色陶瓦 | stained_hardened_clay | 9 | cyan_terracotta | +| 紫色陶瓦 | stained_hardened_clay | 10 | purple_terracotta | +| 蓝色陶瓦 | stained_hardened_clay | 11 | blue_terracotta | +| 棕色陶瓦 | stained_hardened_clay | 12 | brown_terracotta | +| 绿色陶瓦 | stained_hardened_clay | 13 | green_terracotta | +| 红色陶瓦 | stained_hardened_clay | 14 | red_terracotta | +| 黑色陶瓦 | stained_hardened_clay | 15 | black_terracotta | +| 橙色混凝土粉末 | concretepowder | 1 | orange_concrete_powder | +| 品红色混凝土粉末 | concretepowder | 2 | magenta_concrete_powder | +| 淡蓝色混凝土粉末 | concretepowder | 3 | light_blue_concrete_powder | +| 黄色混凝土粉末 | concretepowder | 4 | yellow_concrete_powder | +| 黄绿色混凝土粉末 | concretepowder | 5 | lime_concrete_powder | +| 粉红色混凝土粉末 | concretepowder | 6 | pink_concrete_powder | +| 灰色混凝土粉末 | concretepowder | 7 | gray_concrete_powder | +| 淡灰色混凝土粉末 | concretepowder | 8 | light_gray_concrete_powder | +| 青色混凝土粉末 | concretepowder | 9 | cyan_concrete_powder | +| 紫色混凝土粉末 | concretepowder | 10 | purple_concrete_powder | +| 蓝色混凝土粉末 | concretepowder | 11 | blue_concrete_powder | +| 棕色混凝土粉末 | concretepowder | 12 | brown_concrete_powder | +| 绿色混凝土粉末 | concretepowder | 13 | green_concrete_powder | +| 红色混凝土粉末 | concretepowder | 14 | red_concrete_powder | +| 黑色混凝土粉末 | concretepowder | 15 | black_concrete_powder | + +为方便开发者转换数据,下面提供了一个Python函数,该函数根据旧命名和旧附加值返回新命名。将以下代码保存在一个py文件中,导入后调用其中的get_new_name函数即可: + +```python +# -*- coding: utf-8 -*- +# 定义旧命名和新命名的映射关系 +mapping = { + ('stone', 1): 'granite', + ('stone', 2): 'polished_granite', + ('stone', 3): 'diorite', + ('stone', 4): 'polished_diorite', + ('stone', 5): 'andesite', + ('stone', 6): 'polished_andesite', + ('planks', 1): 'spruce_planks', + ('planks', 2): 'birch_planks', + ('planks', 3): 'jungle_planks', + ('planks', 4): 'acacia_planks', + ('planks', 5): 'dark_oak_planks', + ('stained_glass', 1): 'orange_stained_glass', + ('stained_glass', 2): 'magenta_stained_glass', + ('stained_glass', 3): 'light_blue_stained_glass', + ('stained_glass', 4): 'yellow_stained_glass', + ('stained_glass', 5): 'lime_stained_glass', + ('stained_glass', 6): 'pink_stained_glass', + ('stained_glass', 7): 'gray_stained_glass', + ('stained_glass', 8): 'light_gray_stained_glass', + ('stained_glass', 9): 'cyan_stained_glass', + ('stained_glass', 10): 'purple_stained_glass', + ('stained_glass', 11): 'blue_stained_glass', + ('stained_glass', 12): 'brown_stained_glass', + ('stained_glass', 13): 'green_stained_glass', + ('stained_glass', 14): 'red_stained_glass', + ('stained_glass', 15): 'black_stained_glass', + ('stained_glass_pane', 1): 'orange_stained_glass_pane', + ('stained_glass_pane', 2): 'magenta_stained_glass_pane', + ('stained_glass_pane', 3): 'light_blue_stained_glass_pane', + ('stained_glass_pane', 4): 'yellow_stained_glass_pane', + ('stained_glass_pane', 5): 'lime_stained_glass_pane', + ('stained_glass_pane', 6): 'pink_stained_glass_pane', + ('stained_glass_pane', 7): 'gray_stained_glass_pane', + ('stained_glass_pane', 8): 'light_gray_stained_glass_pane', + ('stained_glass_pane', 9): 'cyan_stained_glass_pane', + ('stained_glass_pane', 10): 'purple_stained_glass_pane', + ('stained_glass_pane', 11): 'blue_stained_glass_pane', + ('stained_glass_pane', 12): 'brown_stained_glass_pane', + ('stained_glass_pane', 13): 'green_stained_glass_pane', + ('stained_glass_pane', 14): 'red_stained_glass_pane', + ('stained_glass_pane', 15): 'black_stained_glass_pane', + ('stained_hardened_clay', 1): 'orange_terracotta', + ('stained_hardened_clay', 2): 'magenta_terracotta', + ('stained_hardened_clay', 3): 'light_blue_terracotta', + ('stained_hardened_clay', 4): 'yellow_terracotta', + ('stained_hardened_clay', 5): 'lime_terracotta', + ('stained_hardened_clay', 6): 'pink_terracotta', + ('stained_hardened_clay', 7): 'gray_terracotta', + ('stained_hardened_clay', 8): 'light_gray_terracotta', + ('stained_hardened_clay', 9): 'cyan_terracotta', + ('stained_hardened_clay', 10): 'purple_terracotta', + ('stained_hardened_clay', 11): 'blue_terracotta', + ('stained_hardened_clay', 12): 'brown_terracotta', + ('stained_hardened_clay', 13): 'green_terracotta', + ('stained_hardened_clay', 14): 'red_terracotta', + ('stained_hardened_clay', 15): 'black_terracotta', + ('concretepowder', 1): 'orange_concrete_powder', + ('concretepowder', 2): 'magenta_concrete_powder', + ('concretepowder', 3): 'light_blue_concrete_powder', + ('concretepowder', 4): 'yellow_concrete_powder', + ('concretepowder', 5): 'lime_concrete_powder', + ('concretepowder', 6): 'pink_concrete_powder', + ('concretepowder', 7): 'gray_concrete_powder', + ('concretepowder', 8): 'light_gray_concrete_powder', + ('concretepowder', 9): 'cyan_concrete_powder', + ('concretepowder', 10): 'purple_concrete_powder', + ('concretepowder', 11): 'blue_concrete_powder', + ('concretepowder', 12): 'brown_concrete_powder', + ('concretepowder', 13): 'green_concrete_powder', + ('concretepowder', 14): 'red_concrete_powder', + ('concretepowder', 15): 'black_concrete_powder' +} + +def get_new_name(old_name, old_aux): + # 根据旧命名和旧附加值返回新命名 + return mapping.get((old_name, old_aux), old_name) +``` + +这个函数 `get_new_name` 接受两个参数:`old_name` 和 `old_aux`,并返回对应的新命名。如果输入的旧命名和旧附加值在映射表中找不到,会返回 `old_name`。 \ No newline at end of file diff --git a/mcguide/20-玩法开发/13-模组SDK编程/2-Python脚本开发/102-3.4版本物品id变更.md b/mcguide/20-玩法开发/13-模组SDK编程/2-Python脚本开发/102-3.4版本物品id变更.md new file mode 100644 index 0000000..52da0bd --- /dev/null +++ b/mcguide/20-玩法开发/13-模组SDK编程/2-Python脚本开发/102-3.4版本物品id变更.md @@ -0,0 +1,130 @@ +# 3.4版本物品id变更 + +## 简介 + +微软在1.21.00继续修改了部分方块ID,取消了附加值,相关链接请参阅[基岩版扁平化](https://zh.minecraft.wiki/w/%E5%AE%98%E6%96%B9%E9%A1%B5%E9%9D%A2/%E5%9F%BA%E5%B2%A9%E7%89%88%E6%89%81%E5%B9%B3%E5%8C%96),请开发者注意适配。 + +## 处理方法 + +在ModSDK的接口与事件中,我们针对上述情况做了以下处理: + +1. 对于返回物品信息字典的接口与事件: + + newItemName及newAuxValue返回新版名称与附加值。 + + 原字段itemName及auxValue返回旧版名称与附加值。 + +2. 对于接受物品信息字典的接口与事件: + + 当字典存在newItemName及newAuxValue时,使用这两个字段。 + + 不存在时,使用旧字段itemName及auxValue。 + +## 注意事项 + +* 通过附加值获取获取方块状态接口没有做兼容,例如GetBlockAuxValueFromStates、GetBlockStatesFromAuxValue、GetBlockStates、SetBlockStates,如果您的组件对此有依赖,则需要对这次的改动自行做兼容处理。 + +* **开发完成或正在开发的组件,建议统一采用newItemName及newAuxValue字段,也不要新旧字段混用。** + +* 某些写法可能会失效,例如 + + ```python + # 获取itemDict,然后在他基础上修改itemName或auxValue后再用来生成 + itemdict = GetPlayerItem() + itemdict['itemName'] = 'xxx' + itemdict['auxValue'] = itemdict['auxValue']+1 + SpawnItemToPlayerInv(itemdict) + ``` + + 因为GetPlayerItem返回的itemDict含有新字段,再传入SpawnItemToPlayerInv时,会读取新字段生成物品,因此对原字段的修改无效。 + +## 物品名称变更表 + +以下为3.4版本变更了名称的物品列表,表格内的名称省略了minecraft命名空间。 + +| 中文名称 | 旧命名 | 旧附加值 | 新命名 | +| :------- | ------ | -------- | ------ | +| 草方块 | grass | 0 | grass_block | +| 橡树树苗 | sapling | 0 | oak_sapling | +| 云杉树苗 | sapling | 1 | spruce_sapling | +| 白桦树苗 | sapling | 2 | birch_sapling | +| 丛林树苗 | sapling | 3 | jungle_sapling | +| 金合欢树苗 | sapling | 4 | acacia_sapling | +| 深色橡树苗 | sapling | 5 | dark_oak_sapling | +| 橡树树叶 | leaves | 0 | oak_leaves | +| 云杉树叶 | leaves | 1 | spruce_leaves | +| 白桦树叶 | leaves | 2 | birch_leaves | +| 丛林树叶 | leaves | 3 | jungle_leaves | +| 金合欢树叶 | leaves2 | 0 | acacia_leaves | +| 深色橡树叶 | leaves2 | 1 | dark_oak_leaves | +| 矮草丛 | 0 | tallgrass | short_grass | +| 蕨 | 2 | tallgrass | fern | +| 虞美人 | 0 | red_flower | poppy | +| 兰花 | 1 | red_flower | blue_orchid | +| 绒球葱 | 2 | red_flower | allium | +| 蓝花美耳草 | 3 | red_flower | azure_bluet | +| 红色郁金香 | 4 | red_flower | red_tulip | +| 橙色郁金香 | 5 | red_flower | orange_tulip | +| 白色郁金香 | 6 | red_flower | white_tulip | +| 粉红色郁金香 | 7 | red_flower | pink_tulip | +| 滨菊 | 8 | red_flower | oxeye_daisy | +| 矢车菊 | 9 | red_flower | cornflower | +| 铃兰 | 10 | red_flower | lily_of_the_valley | +| 平滑石台阶 | 0 | stone_block_slab | smooth_stone_slab | +| 砂岩台阶 | 1 | stone_block_slab | sandstone_slab | +| 石化橡木台阶 | 2 | stone_block_slab | petrified_oak_slab | +| 圆石台阶 | 3 | stone_block_slab | cobblestone_slab | +| 红砖台阶 | 4 | stone_block_slab | brick_slab | +| 石砖台阶 | 5 | stone_block_slab | stone_brick_slab | +| 石英台阶 | 6 | stone_block_slab | quartz_slab | +| 下界砖台阶 | 7 | stone_block_slab | nether_brick_slab | +| 双橡木台阶 | 0 | double_wooden_slab | oak_double_slab | +| 双云杉木台阶 | 1 | double_wooden_slab | spruce_double_slab | +| 双白桦木台阶 | 2 | double_wooden_slab | birch_double_slab | +| 双丛林木台阶 | 3 | double_wooden_slab | jungle_double_slab | +| 双金合欢木台阶 | 4 | double_wooden_slab | acacia_double_slab | +| 双深色橡木台阶 | 5 | double_wooden_slab | dark_oak_double_slab | +| 橡木台阶 | 0 | wooden_slab | oak_slab | +| 云杉木台阶 | 1 | wooden_slab | spruce_slab | +| 白桦木台阶 | 2 | wooden_slab | birch_slab | +| 丛林木台阶 | 3 | wooden_slab | jungle_slab | +| 金合欢木台阶 | 4 | wooden_slab | acacia_slab | +| 深色橡木台阶 | 5 | wooden_slab | dark_oak_slab | +| 向日葵 | 0 | double_plant | sunflower | +| 丁香 | 1 | double_plant | lilac | +| 高草丛 | 2 | double_plant | tall_grass | +| 大型蕨 | 3 | double_plant | large_fern | +| 玫瑰丛 | 4 | double_plant | rose_bush | +| 牡丹 | 5 | double_plant | peony | +| 管珊瑚块 | 0 | coral_block | tube_coral_block | +| 脑纹珊瑚块 | 1 | coral_block | brain_coral_block | +| 气泡珊瑚块 | 2 | coral_block | bubble_coral_block | +| 火珊瑚块 | 3 | coral_block | fire_coral_block | +| 鹿角珊瑚块 | 4 | coral_block | horn_coral_block | +| 失活的管珊瑚块 | 5 | coral_block | dead_tube_coral_block | +| 失活的脑纹珊瑚块 | 6 | coral_block | dead_brain_coral_block | +| 失活的气泡珊瑚块 | 7 | coral_block | dead_bubble_coral_block | +| 失活的火珊瑚块 | 8 | coral_block | dead_fire_coral_block | +| 失活的鹿角珊瑚块 | 9 | coral_block | dead_horn_coral_block | +| 管珊瑚扇 | 0 | coral_fan | tube_coral_fan | +| 脑纹珊瑚扇 | 1 | coral_fan | brain_coral_fan | +| 气泡珊瑚扇 | 2 | coral_fan | bubble_coral_fan | +| 火珊瑚扇 | 3 | coral_fan | fire_coral_fan | +| 鹿角珊瑚扇 | 4 | coral_fan | horn_coral_fan | +| 失活的管珊瑚扇 | 0 | coral_fan_dead | dead_tube_coral_fan | +| 失活的脑纹珊瑚扇 | 1 | coral_fan_dead | dead_brain_coral_fan | +| 失活的气泡珊瑚扇 | 2 | coral_fan_dead | dead_bubble_coral_fan | +| 失活的火珊瑚扇 | 3 | coral_fan_dead | dead_fire_coral_fan | +| 失活的鹿角珊瑚扇 | 4 | coral_fan_dead | dead_horn_coral_fan | +| 橡木 | 0 | wood | oak_wood | +| 云杉木 | 1 | wood | spruce_wood | +| 白桦木 | 2 | wood | birch_wood | +| 丛林木 | 3 | wood | jungle_wood | +| 金合欢木 | 4 | wood | acacia_wood | +| 深色橡木 | 5 | wood | dark_oak_wood | +| 去皮橡木 | 8 | wood | stripped_oak_wood | +| 去皮云杉木 | 9 | wood | stripped_spruce_wood | +| 去皮桦木 | 10 | wood | stripped_birch_wood | +| 去皮丛林木 | 11 | wood | stripped_jungle_wood | +| 去皮金合欢木 | 12 | wood | stripped_acacia_wood | +| 去皮深色橡木 | 13 | wood | stripped_dark_oak_wood | \ No newline at end of file diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/config.json b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/config.json new file mode 100644 index 0000000..cb6276c --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/config.json @@ -0,0 +1,73 @@ +{ + "children": [ + { + "children": [ + "/mcdocs/3-PresetAPI/预设管理/PresetApi" + ], + "title": "预设管理" + }, + { + "children": [ + { + "children": [ + "/mcdocs/3-PresetAPI/预设对象/通用/游戏对象GameObject", + "/mcdocs/3-PresetAPI/预设对象/通用/坐标变换Transform", + "/mcdocs/3-PresetAPI/预设对象/通用/变换对象TransformObject", + "/mcdocs/3-PresetAPI/预设对象/通用/素材数据BoxData", + "/mcdocs/3-PresetAPI/预设对象/通用/SDK接口封装SdkInterface" + ], + "title": "通用" + }, + { + "children": [ + "/mcdocs/3-PresetAPI/预设对象/预设/预设基类PresetBase", + "/mcdocs/3-PresetAPI/预设对象/预设/实体对象EntityObject", + "/mcdocs/3-PresetAPI/预设对象/预设/实体预设EntityPreset", + "/mcdocs/3-PresetAPI/预设对象/预设/特效对象EffectObject", + "/mcdocs/3-PresetAPI/预设对象/预设/特效预设EffectPreset", + "/mcdocs/3-PresetAPI/预设对象/预设/玩家对象PlayerObject", + "/mcdocs/3-PresetAPI/预设对象/预设/玩家预设PlayerPreset", + "/mcdocs/3-PresetAPI/预设对象/预设/方块预设BlockPreset", + "/mcdocs/3-PresetAPI/预设对象/预设/界面预设UIPreset", + "/mcdocs/3-PresetAPI/预设对象/预设/文字面板对象TextboardObject", + "/mcdocs/3-PresetAPI/预设对象/预设/文字面板预设TextboardPreset" + ], + "title": "预设" + }, + { + "children": [ + "/mcdocs/3-PresetAPI/预设对象/零件/零件PartBase", + "/mcdocs/3-PresetAPI/预设对象/零件/零件事件PartEvent", + "/mcdocs/3-PresetAPI/预设对象/零件/触发器零件TriggerPart", + "/mcdocs/3-PresetAPI/预设对象/零件/世界属性零件WorldPart", + "/mcdocs/3-PresetAPI/预设对象/零件/玩家基础属性零件PlayerBasicPart", + "/mcdocs/3-PresetAPI/预设对象/零件/实体零件EntityBasePart", + "/mcdocs/3-PresetAPI/预设对象/零件/相机轨迹CameraTrackPart", + "/mcdocs/3-PresetAPI/预设对象/零件/导航路径零件NavPointsPart" + ], + "title": "零件" + } + ], + "title": "预设对象" + }, + { + "children": [ + "/mcdocs/3-PresetAPI/更新信息/1.23.0", + "/mcdocs/3-PresetAPI/更新信息/1.23.1", + "/mcdocs/3-PresetAPI/更新信息/1.23.2", + "/mcdocs/3-PresetAPI/更新信息/1.23.3", + "/mcdocs/3-PresetAPI/更新信息/1.23.4", + "/mcdocs/3-PresetAPI/更新信息/1.24.0", + "/mcdocs/3-PresetAPI/更新信息/1.24.1", + "/mcdocs/3-PresetAPI/更新信息/1.25.0", + "/mcdocs/3-PresetAPI/更新信息/2.0.1", + "/mcdocs/3-PresetAPI/更新信息/2.0.2", + "/mcdocs/3-PresetAPI/更新信息/2.0.3", + "/mcdocs/3-PresetAPI/更新信息/2.2.0", + "/mcdocs/3-PresetAPI/更新信息/2.4.0" + ], + "title": "更新信息" + } + ], + "title": "PresetAPI" +} \ No newline at end of file diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.0.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.0.md new file mode 100644 index 0000000..7b9c3c6 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.0.md @@ -0,0 +1,256 @@ +# 1.23.0 + +- 新增 + +1. 新增[Preset.Model.GameObject.GameObject](../预设对象/通用/游戏对象GameObject.md#__init__),游戏对象 + +1. 新增[Preset.Model.GameObject.GameObject.LoadFile](../预设对象/通用/游戏对象GameObject.md#loadfile),加载指定路径的非python脚本文件内容 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset](../预设对象/预设/实体预设EntityPreset.md#__init__),实体预设 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetHealth](../预设对象/预设/实体预设EntityPreset.md#gethealth),获取实体预设的生命值 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetHealth](../预设对象/预设/实体预设EntityPreset.md#sethealth),设置实体预设的生命值 + +1. 新增[Preset.Model.Effect.EffectPreset.EffectPreset](../预设对象/预设/特效预设EffectPreset.md#__init__),特效预设 + +1. 新增[Preset.Model.Effect.EffectPreset.EffectPreset.Play](../预设对象/预设/特效预设EffectPreset.md#play),播放特效 + +1. 新增[Preset.Model.Effect.EffectPreset.EffectPreset.Stop](../预设对象/预设/特效预设EffectPreset.md#stop),停止播放特效 + +1. 新增[Preset.Model.Effect.EffectPreset.EffectPreset.GetResource](../预设对象/预设/特效预设EffectPreset.md#getresource),获取绑定的json资源 + +1. 新增[Preset.Model.Effect.EffectPreset.EffectPreset.SetResource](../预设对象/预设/特效预设EffectPreset.md#setresource),设置绑定的json资源 + +1. 新增[Preset.Model.Transform.Transform](../预设对象/通用/坐标变换Transform.md#__init__),坐标变换Transform + +1. 新增[Preset.Model.Transform.Transform.AddOffset](../预设对象/通用/坐标变换Transform.md#addoffset),给坐标变换位置增加偏移量 + +1. 新增[Preset.Model.Transform.Transform.AddRotation](../预设对象/通用/坐标变换Transform.md#addrotation),给坐标变换旋转增加偏移量 + +1. 新增[Preset.Model.Transform.Transform.AddScale](../预设对象/通用/坐标变换Transform.md#addscale),给坐标变换缩放增加偏移量 + +1. 新增[Preset.Model.Transform.Transform.AddTransform](../预设对象/通用/坐标变换Transform.md#addtransform),给坐标变换增加偏移量 + +1. 新增[Preset.Model.Transform.Transform.GetMatrix](../预设对象/通用/坐标变换Transform.md#getmatrix),获取坐标变换矩阵 + +1. 新增[Preset.Model.PartBase.PartBase](../预设对象/零件/零件PartBase.md#__init__),零件基类 + +1. 新增[Preset.Model.PartBase.PartBase.InitClient](../预设对象/零件/零件PartBase.md#initclient),客户端的零件对象初始化入口 + +1. 新增[Preset.Model.PartBase.PartBase.InitServer](../预设对象/零件/零件PartBase.md#initserver),服务端的零件对象初始化入口 + +1. 新增[Preset.Model.PartBase.PartBase.TickClient](../预设对象/零件/零件PartBase.md#tickclient),客户端的零件对象逻辑驱动入口 + +1. 新增[Preset.Model.PartBase.PartBase.TickServer](../预设对象/零件/零件PartBase.md#tickserver),服务端的零件对象逻辑驱动入口 + +1. 新增[Preset.Model.PartBase.PartBase.UnloadClient](../预设对象/零件/零件PartBase.md#unloadclient),客户端的零件对象卸载逻辑入口 + +1. 新增[Preset.Model.PartBase.PartBase.UnloadServer](../预设对象/零件/零件PartBase.md#unloadserver),服务端的零件对象卸载逻辑入口 + +1. 新增[Preset.Model.PartBase.PartBase.DestroyClient](../预设对象/零件/零件PartBase.md#destroyclient),客户端的零件对象销毁逻辑入口 + +1. 新增[Preset.Model.PartBase.PartBase.DestroyServer](../预设对象/零件/零件PartBase.md#destroyserver),服务端的零件对象销毁逻辑入口 + +1. 新增[Preset.Model.PartBase.PartBase.CanAdd](../预设对象/零件/零件PartBase.md#canadd),判断零件是否可以挂接到指定的父节点上 + +1. 新增[Preset.Model.PartBase.PartBase.GetTickCount](../预设对象/零件/零件PartBase.md#gettickcount),获取当前帧数 + +1. 新增[Preset.Model.PartBase.PartBase.ListenForEvent](../预设对象/零件/零件PartBase.md#listenforevent),监听指定的事件 + +1. 新增[Preset.Model.PartBase.PartBase.UnListenForEvent](../预设对象/零件/零件PartBase.md#unlistenforevent),反监听指定的事件 + +1. 新增[Preset.Model.PartBase.PartBase.DefineEvent](../预设对象/零件/零件PartBase.md#defineevent),定义事件 + +1. 新增[Preset.Model.PartBase.PartBase.UnDefineEvent](../预设对象/零件/零件PartBase.md#undefineevent),反定义事件 + +1. 新增[Preset.Model.PartBase.PartBase.BroadcastEvent](../预设对象/零件/零件PartBase.md#broadcastevent),广播事件 + +1. 新增[Preset.Model.PartBase.PartBase.BroadcastClientEvent](../预设对象/零件/零件PartBase.md#broadcastclientevent),广播给所有客户端 + +1. 新增[Preset.Model.PartBase.PartBase.BroadcastServerEvent](../预设对象/零件/零件PartBase.md#broadcastserverevent),广播给所有服务端 + +1. 新增[Preset.Model.PartBase.PartBase.NotifyToServer](../预设对象/零件/零件PartBase.md#notifytoserver),通知服务端触发事件 + +1. 新增[Preset.Model.PartBase.PartBase.NotifyToClient](../预设对象/零件/零件PartBase.md#notifytoclient),通知指定客户端触发事件 + +1. 新增[Preset.Model.PartBase.PartBase.BroadcastToAllClient](../预设对象/零件/零件PartBase.md#broadcasttoallclient),通知指所有客户端触发事件 + +1. 新增[Preset.Model.PartBase.PartBase.ListenSelfEvent](../预设对象/零件/零件PartBase.md#listenselfevent),监听来自自己的事件 + +1. 新增[Preset.Model.PartBase.PartBase.UnListenSelfEvent](../预设对象/零件/零件PartBase.md#unlistenselfevent),反监听来自自己的事件 + +1. 新增[Preset.Model.PartBase.PartBase.ListenPartEvent](../预设对象/零件/零件PartBase.md#listenpartevent),监听来自指定零件的事件 + +1. 新增[Preset.Model.PartBase.PartBase.UnListenPartEvent](../预设对象/零件/零件PartBase.md#unlistenpartevent),反监听来自指定零件的事件 + +1. 新增[Preset.Model.PartBase.PartBase.CreateComponent](../预设对象/零件/零件PartBase.md#createcomponent),给实体创建组件 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset](../预设对象/预设/玩家预设PlayerPreset.md#__init__),玩家预设 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.GetPlayerId](../预设对象/预设/玩家预设PlayerPreset.md#getplayerid),获取玩家预设的玩家ID + +1. 新增[Preset.Model.Block.BlockPreset.BlockPreset](../预设对象/预设/方块预设BlockPreset.md#__init__),方块预设 + +1. 新增[Preset.Model.Block.BlockPreset.BlockPreset.GetEngineTypeStr](../预设对象/预设/方块预设BlockPreset.md#getenginetypestr),获取方块预设的方块类型ID + +1. 新增[Preset.Model.BoxData.BoxData](../预设对象/通用/素材数据BoxData.md#__init__),素材数据 + +1. 新增[Preset.Model.PresetBase.PresetBase](../预设对象/预设/预设基类PresetBase.md#__init__),预设基类 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetIsAlive](../预设对象/预设/预设基类PresetBase.md#getisalive),获取预设的存活状态 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetGameObjectById](../预设对象/预设/预设基类PresetBase.md#getgameobjectbyid),获取当前预设节点底下指定ID的游戏对象 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetGameObjectByEntityId](../预设对象/预设/预设基类PresetBase.md#getgameobjectbyentityid),获取当前预设节点底下指定实体ID的游戏对象 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetChildPresets](../预设对象/预设/预设基类PresetBase.md#getchildpresets),获取当前预设的所有子预设 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetChildPresetsByName](../预设对象/预设/预设基类PresetBase.md#getchildpresetsbyname),获取指定名称的所有子预设 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetChildPresetsByType](../预设对象/预设/预设基类PresetBase.md#getchildpresetsbytype),获取指定类型的所有子预设 + +1. 新增[Preset.Model.PresetBase.PresetBase.Replicate](../预设对象/预设/预设基类PresetBase.md#replicate),在指定位置坐标下复制当前预设 + +1. 新增[Preset.Model.PresetBase.PresetBase.RemoveChild](../预设对象/预设/预设基类PresetBase.md#removechild),移除指定的子节点对象 + +1. 新增[Preset.Model.PresetBase.PresetBase.AddBoxData](../预设对象/预设/预设基类PresetBase.md#addboxdata),添加指定的素材数据 + +1. 新增[Preset.Model.PresetBase.PresetBase.RemoveBoxData](../预设对象/预设/预设基类PresetBase.md#removeboxdata),移除指定的素材数据 + +1. 新增[Preset.Model.PresetBase.PresetBase.AddPreset](../预设对象/预设/预设基类PresetBase.md#addpreset),添加指定预设作为子预设 + +1. 新增[Preset.Model.PresetBase.PresetBase.RemovePreset](../预设对象/预设/预设基类PresetBase.md#removepreset),移除指定的子预设 + +1. 新增[Preset.Model.PresetBase.PresetBase.AddPart](../预设对象/预设/预设基类PresetBase.md#addpart),添加指定零件作为子零件 + +1. 新增[Preset.Model.PresetBase.PresetBase.RemovePart](../预设对象/预设/预设基类PresetBase.md#removepart),移除指定的子零件 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetPartsByName](../预设对象/预设/预设基类PresetBase.md#getpartsbyname),获取指定名称的所有零件 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetPartByName](../预设对象/预设/预设基类PresetBase.md#getpartbyname),获取指定名称的第一个零件 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetPartsByType](../预设对象/预设/预设基类PresetBase.md#getpartsbytype),获取指定类型的所有零件 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetPartByType](../预设对象/预设/预设基类PresetBase.md#getpartbytype),获取指定类型的第一个零件 + +1. 新增[Preset.Model.PresetBase.PresetBase.RemovePartsByType](../预设对象/预设/预设基类PresetBase.md#removepartsbytype),移除指定类型的所有零件 + +1. 新增[Preset.Model.TransformObject.TransformObject](../预设对象/通用/变换对象TransformObject.md#__init__),变换对象 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetDependencyChunks](../预设对象/通用/变换对象TransformObject.md#getdependencychunks),获取所有依赖的chunkPos + +1. 新增[Preset.Model.TransformObject.TransformObject.GetChildTransformObjects](../预设对象/通用/变换对象TransformObject.md#getchildtransformobjects),获取子TransformObject列表 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetTransformObjects](../预设对象/通用/变换对象TransformObject.md#gettransformobjects),获取TransformObject列表 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetChildGameObjects](../预设对象/通用/变换对象TransformObject.md#getchildgameobjects),获取GameObject列表 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetGameObjects](../预设对象/通用/变换对象TransformObject.md#getgameobjects),获取GameObject列表 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetGameObjectById](../预设对象/通用/变换对象TransformObject.md#getgameobjectbyid),根据ID获取GameObject + +1. 新增[Preset.Model.TransformObject.TransformObject.GetGameObjectByEntityId](../预设对象/通用/变换对象TransformObject.md#getgameobjectbyentityid),根据实体ID获取GameObject + +1. 新增[Preset.Model.TransformObject.TransformObject.GetLevelId](../预设对象/通用/变换对象TransformObject.md#getlevelid),获取当前对象所在的level_id + +1. 新增[Preset.Model.TransformObject.TransformObject.GetDisplayName](../预设对象/通用/变换对象TransformObject.md#getdisplayname),获取当前预设的显示名称 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetDisplayPath](../预设对象/通用/变换对象TransformObject.md#getdisplaypath),获取当前预设到根节点的显示路径 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetLocalTransform](../预设对象/通用/变换对象TransformObject.md#getlocaltransform),获取当前预设的局部坐标变换 + +1. 新增[Preset.Model.TransformObject.TransformObject.SetLocalTransform](../预设对象/通用/变换对象TransformObject.md#setlocaltransform),设置当前预设的局部坐标变换 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetLocalPosition](../预设对象/通用/变换对象TransformObject.md#getlocalposition),获取当前预设的局部坐标位置 + +1. 新增[Preset.Model.TransformObject.TransformObject.SetLocalPosition](../预设对象/通用/变换对象TransformObject.md#setlocalposition),设置当前预设的局部坐标位置 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetLocalRotation](../预设对象/通用/变换对象TransformObject.md#getlocalrotation),获取当前预设的局部坐标旋转 + +1. 新增[Preset.Model.TransformObject.TransformObject.SetLocalRotation](../预设对象/通用/变换对象TransformObject.md#setlocalrotation),设置当前预设的局部坐标旋转 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetLocalScale](../预设对象/通用/变换对象TransformObject.md#getlocalscale),获取当前预设的局部坐标缩放 + +1. 新增[Preset.Model.TransformObject.TransformObject.SetLocalScale](../预设对象/通用/变换对象TransformObject.md#setlocalscale),设置当前预设的局部坐标缩放 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetWorldTransform](../预设对象/通用/变换对象TransformObject.md#getworldtransform),获取当前预设的世界坐标变换 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetWorldMatrix](../预设对象/通用/变换对象TransformObject.md#getworldmatrix),获取世界坐标变换矩阵 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetLocalMatrix](../预设对象/通用/变换对象TransformObject.md#getlocalmatrix),获取局部坐标变换矩阵 + +1. 新增[Preset.Model.TransformObject.TransformObject.SetWorldTransform](../预设对象/通用/变换对象TransformObject.md#setworldtransform),设置当前预设的世界坐标变换 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetWorldPosition](../预设对象/通用/变换对象TransformObject.md#getworldposition),获取当前预设的世界坐标位置 + +1. 新增[Preset.Model.TransformObject.TransformObject.SetWorldPosition](../预设对象/通用/变换对象TransformObject.md#setworldposition),设置当前预设的世界坐标位置 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetWorldRotation](../预设对象/通用/变换对象TransformObject.md#getworldrotation),获取当前预设的世界坐标旋转 + +1. 新增[Preset.Model.TransformObject.TransformObject.SetWorldRotation](../预设对象/通用/变换对象TransformObject.md#setworldrotation),设置当前预设的世界坐标旋转 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetWorldScale](../预设对象/通用/变换对象TransformObject.md#getworldscale),获取当前预设的世界坐标缩放 + +1. 新增[Preset.Model.TransformObject.TransformObject.SetWorldScale](../预设对象/通用/变换对象TransformObject.md#setworldscale),设置当前预设的世界坐标缩放 + +1. 新增[Preset.Model.TransformObject.TransformObject.AddLocalOffset](../预设对象/通用/变换对象TransformObject.md#addlocaloffset),给局部坐标变换位置增加偏移量 + +1. 新增[Preset.Model.TransformObject.TransformObject.AddWorldOffset](../预设对象/通用/变换对象TransformObject.md#addworldoffset),给世界坐标变换位置增加偏移量 + +1. 新增[Preset.Model.TransformObject.TransformObject.AddLocalRotation](../预设对象/通用/变换对象TransformObject.md#addlocalrotation),给局部坐标变换旋转增加偏移量 + +1. 新增[Preset.Model.TransformObject.TransformObject.AddWorldRotation](../预设对象/通用/变换对象TransformObject.md#addworldrotation),给世界坐标变换旋转增加偏移量 + +1. 新增[Preset.Model.TransformObject.TransformObject.AddLocalScale](../预设对象/通用/变换对象TransformObject.md#addlocalscale),给局部坐标变换缩放增加偏移量 + +1. 新增[Preset.Model.TransformObject.TransformObject.AddWorldScale](../预设对象/通用/变换对象TransformObject.md#addworldscale),给世界坐标变换缩放增加偏移量 + +1. 新增[Preset.Model.TransformObject.TransformObject.AddLocalTransform](../预设对象/通用/变换对象TransformObject.md#addlocaltransform),给局部坐标变换增加偏移量 + +1. 新增[Preset.Model.TransformObject.TransformObject.AddWorldTransform](../预设对象/通用/变换对象TransformObject.md#addworldtransform),给世界坐标变换增加偏移量 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetRootParent](../预设对象/通用/变换对象TransformObject.md#getrootparent),获取当前预设所在的根预设 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetParent](../预设对象/通用/变换对象TransformObject.md#getparent),获取当前预设的父预设 + +1. 新增[Preset.Model.TransformObject.TransformObject.SetParent](../预设对象/通用/变换对象TransformObject.md#setparent),设置当前预设的父预设 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetManager](../预设对象/通用/变换对象TransformObject.md#getmanager),获取当前预设所在的预设管理器 + +1. 新增[Preset.Model.TransformObject.TransformObject.Unload](../预设对象/通用/变换对象TransformObject.md#unload),卸载当前预设 + +1. 新增[Preset.Model.TransformObject.TransformObject.Destroy](../预设对象/通用/变换对象TransformObject.md#destroy),销毁当前预设 + +1. 新增[Preset.Controller.PresetApi.GetAllPresets](../预设管理/PresetApi.md#getallpresets),获取所有预设 + +1. 新增[Preset.Controller.PresetApi.GetBlockPresetByPosition](../预设管理/PresetApi.md#getblockpresetbyposition),获取指定位置的第一个方块预设 + +1. 新增[Preset.Controller.PresetApi.GetGameObjectByEntityId](../预设管理/PresetApi.md#getgameobjectbyentityid),获取指定实体ID的游戏对象 + +1. 新增[Preset.Controller.PresetApi.GetGameObjectById](../预设管理/PresetApi.md#getgameobjectbyid),获取指定ID的游戏对象 + +1. 新增[Preset.Controller.PresetApi.GetManager](../预设管理/PresetApi.md#getmanager),获取预设管理器 + +1. 新增[Preset.Controller.PresetApi.GetPresetByName](../预设管理/PresetApi.md#getpresetbyname),获取指定名称的第一个预设 + +1. 新增[Preset.Controller.PresetApi.GetPresetByType](../预设管理/PresetApi.md#getpresetbytype),获取指定类型的第一个预设 + +1. 新增[Preset.Controller.PresetApi.GetPresetsByName](../预设管理/PresetApi.md#getpresetsbyname),获取指定名称的所有预设 + +1. 新增[Preset.Controller.PresetApi.GetPresetsByType](../预设管理/PresetApi.md#getpresetsbytype),获取指定类型的所有预设 + +1. 新增[Preset.Controller.PresetApi.GetTickCount](../预设管理/PresetApi.md#gettickcount),获取当前帧数 + +1. 新增[Preset.Controller.PresetApi.LoadPartByModulePath](../预设管理/PresetApi.md#loadpartbymodulepath),通过模块相对路径加载零件并实例化 + +1. 新增[Preset.Controller.PresetApi.LoadPartByType](../预设管理/PresetApi.md#loadpartbytype),通过类名加载零件并实例化 + +1. 新增[Preset.Controller.PresetApi.SpawnPreset](../预设管理/PresetApi.md#spawnpreset),在指定坐标变换处生成指定预设 + +1. 新增[Preset.Parts.PartEvent.OnTriggerEntityEnter](../预设对象/零件/零件事件PartEvent.md#ontriggerentityenter),触发器范围有实体进入时触发 + +1. 新增[Preset.Parts.PartEvent.OnTriggerEntityExit](../预设对象/零件/零件事件PartEvent.md#ontriggerentityexit),触发器范围有实体离开时触发 + +1. 新增[Preset.Parts.PartEvent.OnTriggerEntityStay](../预设对象/零件/零件事件PartEvent.md#ontriggerentitystay),触发器范围有实体停留时触发 + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.1.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.1.md new file mode 100644 index 0000000..d3d5953 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.1.md @@ -0,0 +1,770 @@ +# 1.23.1 + +* 注:该版本功能仅在modpc开发包生效,移动端生效请期待1.24大版本更新。 + +- 新增 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetMaxHealth](../预设对象/预设/实体预设EntityPreset.md#getmaxhealth),获取实体预设的最大生命值 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetMaxHealth](../预设对象/预设/实体预设EntityPreset.md#setmaxhealth),设置实体预设的最大生命值 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetSpeed](../预设对象/预设/实体预设EntityPreset.md#getspeed),获取实体预设的速度 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetSpeed](../预设对象/预设/实体预设EntityPreset.md#setspeed),设置实体预设的速度 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetMaxSpeed](../预设对象/预设/实体预设EntityPreset.md#getmaxspeed),获取实体预设的最大速度 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetMaxSpeed](../预设对象/预设/实体预设EntityPreset.md#setmaxspeed),设置实体预设的最大速度 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetDamage](../预设对象/预设/实体预设EntityPreset.md#getdamage),获取实体预设的伤害 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetDamage](../预设对象/预设/实体预设EntityPreset.md#setdamage),设置实体预设的伤害 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetMaxDamage](../预设对象/预设/实体预设EntityPreset.md#getmaxdamage),获取实体预设的最大伤害 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetMaxDamage](../预设对象/预设/实体预设EntityPreset.md#setmaxdamage),设置实体预设的最大伤害 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.ShowHealth](../预设对象/预设/实体预设EntityPreset.md#showhealth),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetAttackTarget](../预设对象/预设/实体预设EntityPreset.md#setattacktarget),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.ResetAttackTarget](../预设对象/预设/实体预设EntityPreset.md#resetattacktarget),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetAttackTarget](../预设对象/预设/实体预设EntityPreset.md#getattacktarget),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetKnockback](../预设对象/预设/实体预设EntityPreset.md#setknockback),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetOwner](../预设对象/预设/实体预设EntityPreset.md#setowner),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetOwner](../预设对象/预设/实体预设EntityPreset.md#getowner),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.IsOnFire](../预设对象/预设/实体预设EntityPreset.md#isonfire),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetOnFire](../预设对象/预设/实体预设EntityPreset.md#setonfire),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetAttrValue](../预设对象/预设/实体预设EntityPreset.md#getattrvalue),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetAttrMaxValue](../预设对象/预设/实体预设EntityPreset.md#getattrmaxvalue),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetAttrValue](../预设对象/预设/实体预设EntityPreset.md#setattrvalue),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetAttrMaxValue](../预设对象/预设/实体预设EntityPreset.md#setattrmaxvalue),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.IsInLava](../预设对象/预设/实体预设EntityPreset.md#isinlava),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.IsOnGround](../预设对象/预设/实体预设EntityPreset.md#isonground),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetAuxValue](../预设对象/预设/实体预设EntityPreset.md#getauxvalue),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetCurrentAirSupply](../预设对象/预设/实体预设EntityPreset.md#getcurrentairsupply),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetMaxAirSupply](../预设对象/预设/实体预设EntityPreset.md#getmaxairsupply),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetCurrentAirSupply](../预设对象/预设/实体预设EntityPreset.md#setcurrentairsupply),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetMaxAirSupply](../预设对象/预设/实体预设EntityPreset.md#setmaxairsupply),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.IsConsumingAirSupply](../预设对象/预设/实体预设EntityPreset.md#isconsumingairsupply),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetRecoverTotalAirSupplyTime](../预设对象/预设/实体预设EntityPreset.md#setrecovertotalairsupplytime),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetSourceId](../预设对象/预设/实体预设EntityPreset.md#getsourceid),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetCollisionBoxSize](../预设对象/预设/实体预设EntityPreset.md#setcollisionboxsize),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetCollisionBoxSize](../预设对象/预设/实体预设EntityPreset.md#getcollisionboxsize),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetBlockControlAi](../预设对象/预设/实体预设EntityPreset.md#setblockcontrolai),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetDimensionId](../预设对象/预设/实体预设EntityPreset.md#getdimensionid),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.ChangeDimension](../预设对象/预设/实体预设EntityPreset.md#changedimension),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.RemoveEffect](../预设对象/预设/实体预设EntityPreset.md#removeeffect),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.AddEffect](../预设对象/预设/实体预设EntityPreset.md#addeffect),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetEffects](../预设对象/预设/实体预设EntityPreset.md#geteffects),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.TriggerCustomEvent](../预设对象/预设/实体预设EntityPreset.md#triggercustomevent),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.IsAlive](../预设对象/预设/实体预设EntityPreset.md#isalive),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetGravity](../预设对象/预设/实体预设EntityPreset.md#getgravity),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetGravity](../预设对象/预设/实体预设EntityPreset.md#setgravity),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetHurt](../预设对象/预设/实体预设EntityPreset.md#sethurt),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetImmuneDamage](../预设对象/预设/实体预设EntityPreset.md#setimmunedamage),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetModAttr](../预设对象/预设/实体预设EntityPreset.md#setmodattr),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetModAttr](../预设对象/预设/实体预设EntityPreset.md#getmodattr),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.RegisterModAttrUpdateFunc](../预设对象/预设/实体预设EntityPreset.md#registermodattrupdatefunc),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.UnRegisterModAttrUpdateFunc](../预设对象/预设/实体预设EntityPreset.md#unregistermodattrupdatefunc),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.GetName](../预设对象/预设/实体预设EntityPreset.md#getname),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetName](../预设对象/预设/实体预设EntityPreset.md#setname),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetShowName](../预设对象/预设/实体预设EntityPreset.md#setshowname),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetAlwaysShowName](../预设对象/预设/实体预设EntityPreset.md#setalwaysshowname),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityPreset.EntityPreset.SetPersistence](../预设对象/预设/实体预设EntityPreset.md#setpersistence),组件工厂化 + +1. 新增[Preset.Model.PartBase.PartBase.GetGameObjectById](../预设对象/零件/零件PartBase.md#getgameobjectbyid),获取指定ID的游戏对象 + +1. 新增[Preset.Model.PartBase.PartBase.GetGameObjectByEntityId](../预设对象/零件/零件PartBase.md#getgameobjectbyentityid),获取指定实体ID的游戏对象 + +1. 新增[Preset.Model.PartBase.PartBase.CreateGameObjectByEntityId](../预设对象/零件/零件PartBase.md#creategameobjectbyentityid),根据指定实体ID创建游戏对象,已存在则直接返回 + +1. 新增[Preset.Model.PartBase.PartBase.CreateEventData](../预设对象/零件/零件PartBase.md#createeventdata),反定义事件 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.IsSneaking](../预设对象/预设/玩家预设PlayerPreset.md#issneaking),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.GetHunger](../预设对象/预设/玩家预设PlayerPreset.md#gethunger),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.SetHunger](../预设对象/预设/玩家预设PlayerPreset.md#sethunger),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.SetMotion](../预设对象/预设/玩家预设PlayerPreset.md#setmotion),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.GetMotion](../预设对象/预设/玩家预设PlayerPreset.md#getmotion),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.SetStepHeight](../预设对象/预设/玩家预设PlayerPreset.md#setstepheight),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.GetStepHeight](../预设对象/预设/玩家预设PlayerPreset.md#getstepheight),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.ResetStepHeight](../预设对象/预设/玩家预设PlayerPreset.md#resetstepheight),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.GetExp](../预设对象/预设/玩家预设PlayerPreset.md#getexp),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.AddExp](../预设对象/预设/玩家预设PlayerPreset.md#addexp),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.GetTotalExp](../预设对象/预设/玩家预设PlayerPreset.md#gettotalexp),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.SetTotalExp](../预设对象/预设/玩家预设PlayerPreset.md#settotalexp),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.IsFlying](../预设对象/预设/玩家预设PlayerPreset.md#isflying),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.ChangeFlyState](../预设对象/预设/玩家预设PlayerPreset.md#changeflystate),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.GetLevel](../预设对象/预设/玩家预设PlayerPreset.md#getlevel),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.AddLevel](../预设对象/预设/玩家预设PlayerPreset.md#addlevel),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerPreset.PlayerPreset.SetPrefixAndSuffixName](../预设对象/预设/玩家预设PlayerPreset.md#setprefixandsuffixname),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createcomponent),给实体创建组件 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateActionComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createactioncomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityAttackTarget](../预设对象/通用/SDK接口封装SdkInterface.md#setentityattacktarget),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ResetEntityAttackTarget](../预设对象/通用/SDK接口封装SdkInterface.md#resetentityattacktarget),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityAttackTarget](../预设对象/通用/SDK接口封装SdkInterface.md#getentityattacktarget),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetMobKnockback](../预设对象/通用/SDK接口封装SdkInterface.md#setmobknockback),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateActorLootComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createactorlootcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SpawnLootTable](../预设对象/通用/SDK接口封装SdkInterface.md#spawnloottable),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SpawnLootTableWithActor](../预设对象/通用/SDK接口封装SdkInterface.md#spawnloottablewithactor),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateActorMotionComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createactormotioncomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetDirFromRot](../预设对象/通用/SDK接口封装SdkInterface.md#getdirfromrot),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityMotion](../预设对象/通用/SDK接口封装SdkInterface.md#setentitymotion),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityMotion](../预设对象/通用/SDK接口封装SdkInterface.md#getentitymotion),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetInputVector](../预设对象/通用/SDK接口封装SdkInterface.md#getinputvector),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.LockInputVector](../预设对象/通用/SDK接口封装SdkInterface.md#lockinputvector),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.UnlockInputVector](../预设对象/通用/SDK接口封装SdkInterface.md#unlockinputvector),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateActorOwnerComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createactorownercomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityOwner](../预设对象/通用/SDK接口封装SdkInterface.md#setentityowner),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityOwner](../预设对象/通用/SDK接口封装SdkInterface.md#getentityowner),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateActorPushableComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createactorpushablecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetActorPushable](../预设对象/通用/SDK接口封装SdkInterface.md#setactorpushable),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateAttrComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createattrcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.IsEntityOnFire](../预设对象/通用/SDK接口封装SdkInterface.md#isentityonfire),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityOnFire](../预设对象/通用/SDK接口封装SdkInterface.md#setentityonfire),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityAttrValue](../预设对象/通用/SDK接口封装SdkInterface.md#getentityattrvalue),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityAttrMaxValue](../预设对象/通用/SDK接口封装SdkInterface.md#getentityattrmaxvalue),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityAttrValue](../预设对象/通用/SDK接口封装SdkInterface.md#setentityattrvalue),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityAttrMaxValue](../预设对象/通用/SDK接口封装SdkInterface.md#setentityattrmaxvalue),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetPlayerStepHeight](../预设对象/通用/SDK接口封装SdkInterface.md#setplayerstepheight),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetPlayerStepHeight](../预设对象/通用/SDK接口封装SdkInterface.md#getplayerstepheight),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ResetPlayerStepHeight](../预设对象/通用/SDK接口封装SdkInterface.md#resetplayerstepheight),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.IsEntityInLava](../预设对象/通用/SDK接口封装SdkInterface.md#isentityinlava),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.IsEntityOnGround](../预设对象/通用/SDK接口封装SdkInterface.md#isentityonground),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateAuxValueComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createauxvaluecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityAuxValue](../预设对象/通用/SDK接口封装SdkInterface.md#getentityauxvalue),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateBiomeComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createbiomecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetBiomeName](../预设对象/通用/SDK接口封装SdkInterface.md#getbiomename),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateBlockComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createblockcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.RegisterBlockPatterns](../预设对象/通用/SDK接口封装SdkInterface.md#registerblockpatterns),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateMicroBlockResStr](../预设对象/通用/SDK接口封装SdkInterface.md#createmicroblockresstr),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateBlockEntityData](../预设对象/通用/SDK接口封装SdkInterface.md#createblockentitydata),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetCustomBlockEntityData](../预设对象/通用/SDK接口封装SdkInterface.md#getcustomblockentitydata),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateBlockInfoComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createblockinfocomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetBlock](../预设对象/通用/SDK接口封装SdkInterface.md#getblock),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetBlock](../预设对象/通用/SDK接口封装SdkInterface.md#setblock),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetTopBlockHeight](../预设对象/通用/SDK接口封装SdkInterface.md#gettopblockheight),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetBlockDestroyTime](../预设对象/通用/SDK接口封装SdkInterface.md#getblockdestroytime),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetBlockEntityData](../预设对象/通用/SDK接口封装SdkInterface.md#getblockentitydata),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateBlockStateComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createblockstatecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetBlockStates](../预设对象/通用/SDK接口封装SdkInterface.md#getblockstates),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetBlockStates](../预设对象/通用/SDK接口封装SdkInterface.md#setblockstates),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetBlockAuxValueFromStates](../预设对象/通用/SDK接口封装SdkInterface.md#getblockauxvaluefromstates),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetBlockStatesFromAuxValue](../预设对象/通用/SDK接口封装SdkInterface.md#getblockstatesfromauxvalue),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateBlockUseEventWhiteList](../预设对象/通用/SDK接口封装SdkInterface.md#createblockuseeventwhitelist),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.AddBlockItemListenForUseEvent](../预设对象/通用/SDK接口封装SdkInterface.md#addblockitemlistenforuseevent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.RemoveBlockItemListenForUseEvent](../预设对象/通用/SDK接口封装SdkInterface.md#removeblockitemlistenforuseevent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ClearAllListenForBlockUseEventItems](../预设对象/通用/SDK接口封装SdkInterface.md#clearalllistenforblockuseeventitems),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateBreathComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createbreathcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetUnitBubbleAirSupply](../预设对象/通用/SDK接口封装SdkInterface.md#getunitbubbleairsupply),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityCurrentAirSupply](../预设对象/通用/SDK接口封装SdkInterface.md#getentitycurrentairsupply),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityMaxAirSupply](../预设对象/通用/SDK接口封装SdkInterface.md#getentitymaxairsupply),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityCurrentAirSupply](../预设对象/通用/SDK接口封装SdkInterface.md#setentitycurrentairsupply),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityMaxAirSupply](../预设对象/通用/SDK接口封装SdkInterface.md#setentitymaxairsupply),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.IsEntityConsumingAirSupply](../预设对象/通用/SDK接口封装SdkInterface.md#isentityconsumingairsupply),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityRecoverTotalAirSupplyTime](../预设对象/通用/SDK接口封装SdkInterface.md#setentityrecovertotalairsupplytime),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateBulletAttributesComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createbulletattributescomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntitySourceId](../预设对象/通用/SDK接口封装SdkInterface.md#getentitysourceid),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateChestBlockComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createchestblockcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetChestBoxSize](../预设对象/通用/SDK接口封装SdkInterface.md#getchestboxsize),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetChestBoxItemNum](../预设对象/通用/SDK接口封装SdkInterface.md#setchestboxitemnum),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetChestBoxItemExchange](../预设对象/通用/SDK接口封装SdkInterface.md#setchestboxitemexchange),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateChunkSourceComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createchunksourcecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetAddArea](../预设对象/通用/SDK接口封装SdkInterface.md#setaddarea),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.DeleteArea](../预设对象/通用/SDK接口封装SdkInterface.md#deletearea),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.DeleteAllArea](../预设对象/通用/SDK接口封装SdkInterface.md#deleteallarea),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetAllAreaKeys](../预设对象/通用/SDK接口封装SdkInterface.md#getallareakeys),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CheckChunkState](../预设对象/通用/SDK接口封装SdkInterface.md#checkchunkstate),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetLoadedChunks](../预设对象/通用/SDK接口封装SdkInterface.md#getloadedchunks),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetChunkEntities](../预设对象/通用/SDK接口封装SdkInterface.md#getchunkentities),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetChunkMobNum](../预设对象/通用/SDK接口封装SdkInterface.md#getchunkmobnum),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.IsChunkGenerated](../预设对象/通用/SDK接口封装SdkInterface.md#ischunkgenerated),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateCollisionBoxComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createcollisionboxcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityCollisionBoxSize](../预设对象/通用/SDK接口封装SdkInterface.md#setentitycollisionboxsize),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityCollisionBoxSize](../预设对象/通用/SDK接口封装SdkInterface.md#getentitycollisionboxsize),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateCommandComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createcommandcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetCommand](../预设对象/通用/SDK接口封装SdkInterface.md#setcommand),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetCommandPermissionLevel](../预设对象/通用/SDK接口封装SdkInterface.md#getcommandpermissionlevel),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetCommandPermissionLevel](../预设对象/通用/SDK接口封装SdkInterface.md#setcommandpermissionlevel),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetDefaultPlayerPermissionLevel](../预设对象/通用/SDK接口封装SdkInterface.md#getdefaultplayerpermissionlevel),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetDefaultPlayerPermissionLevel](../预设对象/通用/SDK接口封装SdkInterface.md#setdefaultplayerpermissionlevel),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateControlAiComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createcontrolaicomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityBlockControlAi](../预设对象/通用/SDK接口封装SdkInterface.md#setentityblockcontrolai),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateDimensionComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createdimensioncomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityDimensionId](../预设对象/通用/SDK接口封装SdkInterface.md#getentitydimensionid),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ChangeEntityDimension](../预设对象/通用/SDK接口封装SdkInterface.md#changeentitydimension),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ChangePlayerDimension](../预设对象/通用/SDK接口封装SdkInterface.md#changeplayerdimension),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.MirrorDimension](../预设对象/通用/SDK接口封装SdkInterface.md#mirrordimension),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateDimension](../预设对象/通用/SDK接口封装SdkInterface.md#createdimension),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.RegisterEntityAOIEvent](../预设对象/通用/SDK接口封装SdkInterface.md#registerentityaoievent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.UnRegisterEntityAOIEvent](../预设对象/通用/SDK接口封装SdkInterface.md#unregisterentityaoievent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetUseLocalTime](../预设对象/通用/SDK接口封装SdkInterface.md#setuselocaltime),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetUseLocalTime](../预设对象/通用/SDK接口封装SdkInterface.md#getuselocaltime),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetLocalTime](../预设对象/通用/SDK接口封装SdkInterface.md#setlocaltime),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetLocalTimeOfDay](../预设对象/通用/SDK接口封装SdkInterface.md#setlocaltimeofday),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetLocalTime](../预设对象/通用/SDK接口封装SdkInterface.md#getlocaltime),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetLocalDoDayNightCycle](../预设对象/通用/SDK接口封装SdkInterface.md#setlocaldodaynightcycle),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetLocalDoDayNightCycle](../预设对象/通用/SDK接口封装SdkInterface.md#getlocaldodaynightcycle),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateEffectComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createeffectcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.RemoveEffectFromEntity](../预设对象/通用/SDK接口封装SdkInterface.md#removeeffectfromentity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.AddEffectToEntity](../预设对象/通用/SDK接口封装SdkInterface.md#addeffecttoentity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityEffects](../预设对象/通用/SDK接口封装SdkInterface.md#getentityeffects),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateEngineTypeComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createenginetypecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityEngineTypeStr](../预设对象/通用/SDK接口封装SdkInterface.md#getentityenginetypestr),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityEngineType](../预设对象/通用/SDK接口封装SdkInterface.md#getentityenginetype),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateEntityEventComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createentityeventcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.TriggerEntityCustomEvent](../预设对象/通用/SDK接口封装SdkInterface.md#triggerentitycustomevent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateExtraDataComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createextradatacomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetExtraData](../预设对象/通用/SDK接口封装SdkInterface.md#getextradata),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SaveExtraData](../预设对象/通用/SDK接口封装SdkInterface.md#saveextradata),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetExtraData](../预设对象/通用/SDK接口封装SdkInterface.md#setextradata),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CleanExtraData](../预设对象/通用/SDK接口封装SdkInterface.md#cleanextradata),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetWholeExtraData](../预设对象/通用/SDK接口封装SdkInterface.md#getwholeextradata),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateExpComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createexpcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetPlayerExp](../预设对象/通用/SDK接口封装SdkInterface.md#getplayerexp),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.AddPlayerExp](../预设对象/通用/SDK接口封装SdkInterface.md#addplayerexp),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetPlayerTotalExp](../预设对象/通用/SDK接口封装SdkInterface.md#getplayertotalexp),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetPlayerTotalExp](../预设对象/通用/SDK接口封装SdkInterface.md#setplayertotalexp),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetOrbExperience](../预设对象/通用/SDK接口封装SdkInterface.md#getorbexperience),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetOrbExperience](../预设对象/通用/SDK接口封装SdkInterface.md#setorbexperience),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateExperienceOrb](../预设对象/通用/SDK接口封装SdkInterface.md#createexperienceorb),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateExplosionComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createexplosioncomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateExplosion](../预设对象/通用/SDK接口封装SdkInterface.md#createexplosion),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateFeatureComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createfeaturecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.AddNeteaseFeatureWhiteList](../预设对象/通用/SDK接口封装SdkInterface.md#addneteasefeaturewhitelist),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.RemoveNeteaseFeatureWhiteList](../预设对象/通用/SDK接口封装SdkInterface.md#removeneteasefeaturewhitelist),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ClearAllNeteaseFeatureWhiteList](../预设对象/通用/SDK接口封装SdkInterface.md#clearallneteasefeaturewhitelist),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.LocateStructureFeature](../预设对象/通用/SDK接口封装SdkInterface.md#locatestructurefeature),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.LocateNeteaseFeatureRule](../预设对象/通用/SDK接口封装SdkInterface.md#locateneteasefeaturerule),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateFlyComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createflycomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.IsPlayerFlying](../预设对象/通用/SDK接口封装SdkInterface.md#isplayerflying),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ChangePlayerFlyState](../预设对象/通用/SDK接口封装SdkInterface.md#changeplayerflystate),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateGameComponent](../预设对象/通用/SDK接口封装SdkInterface.md#creategamecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.KillEntity](../预设对象/通用/SDK接口封装SdkInterface.md#killentity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateEngineEntityByTypeStr](../预设对象/通用/SDK接口封装SdkInterface.md#createengineentitybytypestr),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.PlaceStructure](../预设对象/通用/SDK接口封装SdkInterface.md#placestructure),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.AddTimer](../预设对象/通用/SDK接口封装SdkInterface.md#addtimer),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.AddRepeatedTimer](../预设对象/通用/SDK接口封装SdkInterface.md#addrepeatedtimer),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CancelTimer](../预设对象/通用/SDK接口封装SdkInterface.md#canceltimer),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntitiesInArea](../预设对象/通用/SDK接口封装SdkInterface.md#getentitiesinarea),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntitiesAround](../预设对象/通用/SDK接口封装SdkInterface.md#getentitiesaround),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ShowHealthBar](../预设对象/通用/SDK接口封装SdkInterface.md#showhealthbar),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetNameDeeptest](../预设对象/通用/SDK接口封装SdkInterface.md#setnamedeeptest),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetScreenSize](../预设对象/通用/SDK接口封装SdkInterface.md#getscreensize),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetRenderLocalPlayer](../预设对象/通用/SDK接口封装SdkInterface.md#setrenderlocalplayer),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.AddPickBlacklist](../预设对象/通用/SDK接口封装SdkInterface.md#addpickblacklist),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ClearPickBlacklist](../预设对象/通用/SDK接口封装SdkInterface.md#clearpickblacklist),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CheckWordsValid](../预设对象/通用/SDK接口封装SdkInterface.md#checkwordsvalid),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CheckNameValid](../预设对象/通用/SDK接口封装SdkInterface.md#checknamevalid),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetScreenViewInfo](../预设对象/通用/SDK接口封装SdkInterface.md#getscreenviewinfo),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SimulateTouchWithMouse](../预设对象/通用/SDK接口封装SdkInterface.md#simulatetouchwithmouse),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetCurrentDimension](../预设对象/通用/SDK接口封装SdkInterface.md#getcurrentdimension),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetChinese](../预设对象/通用/SDK接口封装SdkInterface.md#getchinese),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetDisableHunger](../预设对象/通用/SDK接口封装SdkInterface.md#setdisablehunger),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetOneTipMessage](../预设对象/通用/SDK接口封装SdkInterface.md#setonetipmessage),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetPopupNotice](../预设对象/通用/SDK接口封装SdkInterface.md#setpopupnotice),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetTipMessage](../预设对象/通用/SDK接口封装SdkInterface.md#settipmessage),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetNotifyMsg](../预设对象/通用/SDK接口封装SdkInterface.md#setnotifymsg),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetPlayerGameType](../预设对象/通用/SDK接口封装SdkInterface.md#getplayergametype),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.HasEntity](../预设对象/通用/SDK接口封装SdkInterface.md#hasentity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.IsEntityAlive](../预设对象/通用/SDK接口封装SdkInterface.md#isentityalive),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateGravityComponent](../预设对象/通用/SDK接口封装SdkInterface.md#creategravitycomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityGravity](../预设对象/通用/SDK接口封装SdkInterface.md#getentitygravity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityGravity](../预设对象/通用/SDK接口封装SdkInterface.md#setentitygravity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateHurtComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createhurtcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetHurtByEntity](../预设对象/通用/SDK接口封装SdkInterface.md#sethurtbyentity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetHurtByEntityNew](../预设对象/通用/SDK接口封装SdkInterface.md#sethurtbyentitynew),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityImmuneDamage](../预设对象/通用/SDK接口封装SdkInterface.md#setentityimmunedamage),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateItemBannedComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createitembannedcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.AddBannedItem](../预设对象/通用/SDK接口封装SdkInterface.md#addbanneditem),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetBannedItemList](../预设对象/通用/SDK接口封装SdkInterface.md#getbanneditemlist),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.RemoveBannedItem](../预设对象/通用/SDK接口封装SdkInterface.md#removebanneditem),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ClearBannedItems](../预设对象/通用/SDK接口封装SdkInterface.md#clearbanneditems),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateItemComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createitemcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetItemBasicInfo](../预设对象/通用/SDK接口封装SdkInterface.md#getitembasicinfo),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ClearPlayerOffHand](../预设对象/通用/SDK接口封装SdkInterface.md#clearplayeroffhand),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetPlayerItem](../预设对象/通用/SDK接口封装SdkInterface.md#getplayeritem),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ChangePlayerItemTipsAndExtraId](../预设对象/通用/SDK接口封装SdkInterface.md#changeplayeritemtipsandextraid),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.AddEnchantToInvItem](../预设对象/通用/SDK接口封装SdkInterface.md#addenchanttoinvitem),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetInvItemEnchantData](../预设对象/通用/SDK接口封装SdkInterface.md#getinvitemenchantdata),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetOffhandItem](../预设对象/通用/SDK接口封装SdkInterface.md#getoffhanditem),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetInvItemNum](../预设对象/通用/SDK接口封装SdkInterface.md#setinvitemnum),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SpawnItemToLevel](../预设对象/通用/SDK接口封装SdkInterface.md#spawnitemtolevel),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SpawnItemToPlayerInv](../预设对象/通用/SDK接口封装SdkInterface.md#spawnitemtoplayerinv),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SpawnItemToPlayerCarried](../预设对象/通用/SDK接口封装SdkInterface.md#spawnitemtoplayercarried),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetCarriedItem](../预设对象/通用/SDK接口封装SdkInterface.md#getcarrieditem),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetSlotId](../预设对象/通用/SDK接口封装SdkInterface.md#getslotid),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetItemFormattedHoverText](../预设对象/通用/SDK接口封装SdkInterface.md#getitemformattedhovertext),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetItemHoverName](../预设对象/通用/SDK接口封装SdkInterface.md#getitemhovername),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetItemEffectName](../预设对象/通用/SDK接口封装SdkInterface.md#getitemeffectname),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetUserDataInEvent](../预设对象/通用/SDK接口封装SdkInterface.md#getuserdatainevent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ChangeItemTexture](../预设对象/通用/SDK接口封装SdkInterface.md#changeitemtexture),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateLvComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createlvcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetPlayerLevel](../预设对象/通用/SDK接口封装SdkInterface.md#getplayerlevel),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.AddPlayerLevel](../预设对象/通用/SDK接口封装SdkInterface.md#addplayerlevel),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateMobSpawnComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createmobspawncomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SpawnCustomModule](../预设对象/通用/SDK接口封装SdkInterface.md#spawncustommodule),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateModAttrComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createmodattrcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityModAttr](../预设对象/通用/SDK接口封装SdkInterface.md#setentitymodattr),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityModAttr](../预设对象/通用/SDK接口封装SdkInterface.md#getentitymodattr),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.RegisterEntityModAttrUpdateFunc](../预设对象/通用/SDK接口封装SdkInterface.md#registerentitymodattrupdatefunc),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.UnRegisterEntityModAttrUpdateFunc](../预设对象/通用/SDK接口封装SdkInterface.md#unregisterentitymodattrupdatefunc),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateModelComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createmodelcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityOpacity](../预设对象/通用/SDK接口封装SdkInterface.md#setentityopacity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.PlayEntityAnim](../预设对象/通用/SDK接口封装SdkInterface.md#playentityanim),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetModelId](../预设对象/通用/SDK接口封装SdkInterface.md#getmodelid),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityModel](../预设对象/通用/SDK接口封装SdkInterface.md#setentitymodel),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ResetEntityModel](../预设对象/通用/SDK接口封装SdkInterface.md#resetentitymodel),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.BindModelToEntity](../预设对象/通用/SDK接口封装SdkInterface.md#bindmodeltoentity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.UnBindModelToEntity](../预设对象/通用/SDK接口封装SdkInterface.md#unbindmodeltoentity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateMoveToComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createmovetocomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityMoveSetting](../预设对象/通用/SDK接口封装SdkInterface.md#setentitymovesetting),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateMsgComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createmsgcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SendMsg](../预设对象/通用/SDK接口封装SdkInterface.md#sendmsg),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SendMsgToPlayer](../预设对象/通用/SDK接口封装SdkInterface.md#sendmsgtoplayer),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.NotifyOneMessage](../预设对象/通用/SDK接口封装SdkInterface.md#notifyonemessage),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateNameComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createnamecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityName](../预设对象/通用/SDK接口封装SdkInterface.md#getentityname),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityName](../预设对象/通用/SDK接口封装SdkInterface.md#setentityname),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetPlayerPrefixAndSuffixName](../预设对象/通用/SDK接口封装SdkInterface.md#setplayerprefixandsuffixname),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityShowName](../预设对象/通用/SDK接口封装SdkInterface.md#setentityshowname),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityAlwaysShowName](../预设对象/通用/SDK接口封装SdkInterface.md#setentityalwaysshowname),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreatePersistenceComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createpersistencecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityPersistence](../预设对象/通用/SDK接口封装SdkInterface.md#setentitypersistence),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreatePetComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createpetcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.DisablePet](../预设对象/通用/SDK接口封装SdkInterface.md#disablepet),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.EnablePet](../预设对象/通用/SDK接口封装SdkInterface.md#enablepet),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreatePlayerComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createplayercomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.IsPlayerSneaking](../预设对象/零件/零件PartBase.md#isplayersneaking),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetPlayerHunger](../预设对象/零件/零件PartBase.md#getplayerhunger),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetPlayerHunger](../预设对象/零件/零件PartBase.md#setplayerhunger),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreatePortalComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createportalcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreatePosComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createposcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityPos](../预设对象/通用/SDK接口封装SdkInterface.md#getentitypos),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityFootPos](../预设对象/通用/SDK接口封装SdkInterface.md#getentityfootpos),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityPos](../预设对象/通用/SDK接口封装SdkInterface.md#setentitypos),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityFootPos](../预设对象/通用/SDK接口封装SdkInterface.md#setentityfootpos),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateProjectileComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createprojectilecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateProjectileEntity](../预设对象/通用/SDK接口封装SdkInterface.md#createprojectileentity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateRecipeComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createrecipecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetRecipeResult](../预设对象/通用/SDK接口封装SdkInterface.md#getreciperesult),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetRecipesByResult](../预设对象/通用/SDK接口封装SdkInterface.md#getrecipesbyresult),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetRecipesByInput](../预设对象/通用/SDK接口封装SdkInterface.md#getrecipesbyinput),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateRedStoneComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createredstonecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateRideComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createridecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateRotComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createrotcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityRot](../预设对象/通用/SDK接口封装SdkInterface.md#getentityrot),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityRot](../预设对象/通用/SDK接口封装SdkInterface.md#setentityrot),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetEntityLookAtPos](../预设对象/通用/SDK接口封装SdkInterface.md#setentitylookatpos),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetBodyRot](../预设对象/通用/SDK接口封装SdkInterface.md#getbodyrot),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.LockLocalPlayerRot](../预设对象/通用/SDK接口封装SdkInterface.md#locklocalplayerrot),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetPlayerLookAtPos](../预设对象/通用/SDK接口封装SdkInterface.md#setplayerlookatpos),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateScaleComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createscalecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateTameComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createtamecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateTimeComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createtimecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetTime](../预设对象/通用/SDK接口封装SdkInterface.md#gettime),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateWeatherComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createweathercomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateActorCollidableComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createactorcollidablecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateActorRenderComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createactorrendercomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateCustomAudioComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createcustomaudiocomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateBrightnessComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createbrightnesscomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateCameraComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createcameracomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.PickFacing](../预设对象/通用/SDK接口封装SdkInterface.md#pickfacing),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateFogComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createfogcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateFrameAniControlComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createframeanicontrolcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetFrameAniLoop](../预设对象/通用/SDK接口封装SdkInterface.md#setframeaniloop),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetFrameAniFaceCamera](../预设对象/通用/SDK接口封装SdkInterface.md#setframeanifacecamera),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetFrameAniDeepTest](../预设对象/通用/SDK接口封装SdkInterface.md#setframeanideeptest),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateFrameAniEntityBindComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createframeanientitybindcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateFrameAniSkeletonBindComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createframeaniskeletonbindcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateFrameAniTransComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createframeanitranscomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetFrameAniPos](../预设对象/通用/SDK接口封装SdkInterface.md#setframeanipos),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetFrameAniRot](../预设对象/通用/SDK接口封装SdkInterface.md#setframeanirot),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetFrameAniScale](../预设对象/通用/SDK接口封装SdkInterface.md#setframeaniscale),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateHealthComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createhealthcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ShowEntityHealth](../预设对象/通用/SDK接口封装SdkInterface.md#showentityhealth),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateOperationComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createoperationcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetCanAll](../预设对象/通用/SDK接口封装SdkInterface.md#setcanall),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateDeviceComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createdevicecomponent),创建device组件 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateParticleControlComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createparticlecontrolcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateParticleEntityBindComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createparticleentitybindcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateParticleSkeletonBindComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createparticleskeletonbindcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateParticleTransComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createparticletranscomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetParticlePos](../预设对象/通用/SDK接口封装SdkInterface.md#setparticlepos),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetParticleRot](../预设对象/通用/SDK接口封装SdkInterface.md#setparticlerot),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreatePlayerViewComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createplayerviewcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetPlayerPerspective](../预设对象/通用/SDK接口封装SdkInterface.md#getplayerperspective),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SetPlayerPerspective](../预设对象/通用/SDK接口封装SdkInterface.md#setplayerperspective),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.LockPlayerPerspective](../预设对象/通用/SDK接口封装SdkInterface.md#lockplayerperspective),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateQueryVariableComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createqueryvariablecomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateSkyRenderComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createskyrendercomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateTextBoardComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createtextboardcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateTextNotifyClientComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createtextnotifyclientcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateConfigClientComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createconfigclientcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreateVirtualWorldComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createvirtualworldcomponent),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreatePlayerAnimComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createplayeranimcomponent),组件工厂化 + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.2.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.2.md new file mode 100644 index 0000000..f84bf58 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.2.md @@ -0,0 +1,24 @@ +# 1.23.2 + +* 注:该版本功能仅在modpc开发包生效,移动端生效请期待1.24大版本更新。 + +- 新增 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetServerSystem](../预设对象/通用/SDK接口封装SdkInterface.md#getserversystem),返回当前对象可使用的服务端system + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetClientSystem](../预设对象/通用/SDK接口封装SdkInterface.md#getclientsystem),返回当前对象可使用的客户端system + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetSystem](../预设对象/通用/SDK接口封装SdkInterface.md#getsystem),返回当前对象可使用的system + +1. 新增[Preset.Model.UI.UIPreset.UIPreset](../预设对象/预设/界面预设UIPreset.md#__init__),界面预设 + +1. 新增[Preset.Model.UI.UIPreset.UIPreset.SetUiActive](../预设对象/预设/界面预设UIPreset.md#setuiactive),界面预设 + +1. 新增[Preset.Model.UI.UIPreset.UIPreset.GetUiActive](../预设对象/预设/界面预设UIPreset.md#getuiactive),界面预设 + +1. 新增[Preset.Model.UI.UIPreset.UIPreset.SetUiVisible](../预设对象/预设/界面预设UIPreset.md#setuivisible),界面预设 + +1. 新增[Preset.Model.UI.UIPreset.UIPreset.GetUiVisible](../预设对象/预设/界面预设UIPreset.md#getuivisible),界面预设 + +1. 新增[Preset.Model.UI.UIPreset.UIPreset.GetScreenNode](../预设对象/预设/界面预设UIPreset.md#getscreennode),界面预设 + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.3.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.3.md new file mode 100644 index 0000000..38b17a2 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.3.md @@ -0,0 +1,21 @@ +# 1.23.3 + +- 注:该版本功能仅在modpc开发包生效,移动端生效请期待1.24大版本更新。 +- 新增 + +1. 新增[Preset.Model.PartBase.PartBase.LogDebug](../预设对象/零件/零件PartBase.md#logdebug),打印调试日志,仅PC开发包有效 + +1. 新增[Preset.Model.PartBase.PartBase.LogInfo](../预设对象/零件/零件PartBase.md#loginfo),打印消息日志 + +1. 新增[Preset.Model.PartBase.PartBase.LogError](../预设对象/零件/零件PartBase.md#logerror),打印错误日志 + +1. 新增[Preset.Model.PartBase.PartBase.ListenForEngineEvent](../预设对象/零件/零件PartBase.md#listenforengineevent),监听指定的引擎事件 + +1. 新增[Preset.Model.PartBase.PartBase.UnListenForEngineEvent](../预设对象/零件/零件PartBase.md#unlistenforengineevent),反监听指定的引擎事件 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetApi](../预设对象/零件/零件PartBase.md#getapi),返回当前对象可使用的SDK API模块 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetExtraData](../预设对象/通用/SDK接口封装SdkInterface.md#getextradata),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.SaveExtraData](../预设对象/通用/SDK接口封装SdkInterface.md#saveextradata),组件工厂化 + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.4.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.4.md new file mode 100644 index 0000000..1c9d667 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.23.4.md @@ -0,0 +1,225 @@ +# 1.23.4 + +- 注:该版本功能仅在modpc开发包生效,移动端生效请期待1.25大版本更新。 +- 新增 + +1. 新增[Preset.Model.Effect.EffectObject.EffectObject](../预设对象/预设/特效对象EffectObject.md#__init__),特效对象 + +1. 新增[Preset.Model.Effect.EffectObject.EffectObject.Play](../预设对象/预设/特效对象EffectObject.md#play),播放特效 + +1. 新增[Preset.Model.Effect.EffectObject.EffectObject.Stop](../预设对象/预设/特效对象EffectObject.md#stop),停止播放特效 + +1. 新增[Preset.Model.Effect.EffectObject.EffectObject.BindToEntity](../预设对象/预设/特效对象EffectObject.md#bindtoentity),组件工厂化 + +1. 新增[Preset.Model.Effect.EffectObject.EffectObject.BindToSkeleton](../预设对象/预设/特效对象EffectObject.md#bindtoskeleton),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject](../预设对象/预设/玩家对象PlayerObject.md#__init__),玩家对象 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.GetPlayerId](../预设对象/预设/玩家对象PlayerObject.md#getplayerid),获取玩家预设的玩家ID + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.IsLocalPlayer](../预设对象/预设/玩家对象PlayerObject.md#islocalplayer),判断当前玩家对象是否本地玩家,服务端为False + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.IsSneaking](../预设对象/预设/玩家对象PlayerObject.md#issneaking),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.GetHunger](../预设对象/预设/玩家对象PlayerObject.md#gethunger),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetHunger](../预设对象/预设/玩家对象PlayerObject.md#sethunger),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetMotion](../预设对象/预设/玩家对象PlayerObject.md#setmotion),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.GetMotion](../预设对象/预设/玩家对象PlayerObject.md#getmotion),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetStepHeight](../预设对象/预设/玩家对象PlayerObject.md#setstepheight),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.GetStepHeight](../预设对象/预设/玩家对象PlayerObject.md#getstepheight),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.ResetStepHeight](../预设对象/预设/玩家对象PlayerObject.md#resetstepheight),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.GetExp](../预设对象/预设/玩家对象PlayerObject.md#getexp),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.AddExp](../预设对象/预设/玩家对象PlayerObject.md#addexp),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.GetTotalExp](../预设对象/预设/玩家对象PlayerObject.md#gettotalexp),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetTotalExp](../预设对象/预设/玩家对象PlayerObject.md#settotalexp),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.IsFlying](../预设对象/预设/玩家对象PlayerObject.md#isflying),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.ChangeFlyState](../预设对象/预设/玩家对象PlayerObject.md#changeflystate),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.GetLevel](../预设对象/预设/玩家对象PlayerObject.md#getlevel),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.AddLevel](../预设对象/预设/玩家对象PlayerObject.md#addlevel),组件工厂化 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetPrefixAndSuffixName](../预设对象/预设/玩家对象PlayerObject.md#setprefixandsuffixname),组件工厂化 + +1. 新增[Preset.Model.PartBase.PartBase.GetPlayerObject](../预设对象/零件/零件PartBase.md#getplayerobject),获取玩家对象 + +1. 新增[Preset.Model.PartBase.PartBase.GetEntityObject](../预设对象/零件/零件PartBase.md#getentityobject),获取实体对象 + +1. 新增[Preset.Model.PartBase.PartBase.GetEffectObject](../预设对象/零件/零件PartBase.md#geteffectobject),获取特效对象 + +1. 新增[Preset.Model.PartBase.PartBase.CreateEffectPreset](../预设对象/零件/零件PartBase.md#createeffectpreset),创建特效对象 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetChildPresetsByName](../预设对象/预设/预设基类PresetBase.md#getchildpresetsbyname),增加递归查找参数 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetChildObjectByTypeName](../预设对象/预设/预设基类PresetBase.md#getchildobjectbytypename),获取指定类型和名称的第一个游戏对象 + +1. 新增[Preset.Model.PresetBase.PresetBase.GetChildObjectsByTypeName](../预设对象/预设/预设基类PresetBase.md#getchildobjectsbytypename),获取指定类型和名称的第一个游戏对象 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.GetEntityId](../预设对象/通用/SDK接口封装SdkInterface.md#getentityid),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ToPlayerPreset](../预设对象/通用/SDK接口封装SdkInterface.md#toplayerpreset),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ToEntityPreset](../预设对象/通用/SDK接口封装SdkInterface.md#toentitypreset),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ToEffectPreset](../预设对象/通用/SDK接口封装SdkInterface.md#toeffectpreset),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ToBlockPreset](../预设对象/通用/SDK接口封装SdkInterface.md#toblockpreset),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.ToUIPreset](../预设对象/通用/SDK接口封装SdkInterface.md#touipreset),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.DestroyEntity](../预设对象/通用/SDK接口封装SdkInterface.md#destroyentity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.BindFrameAniToEntity](../预设对象/通用/SDK接口封装SdkInterface.md#bindframeanitoentity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.BindFrameAniToSkeleton](../预设对象/通用/SDK接口封装SdkInterface.md#bindframeanitoskeleton),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.BindParticleToEntity](../预设对象/通用/SDK接口封装SdkInterface.md#bindparticletoentity),组件工厂化 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.BindParticleToSkeleton](../预设对象/通用/SDK接口封装SdkInterface.md#bindparticletoskeleton),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject](../预设对象/预设/实体对象EntityObject.md#__init__),实体对象 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetEngineTypeStr](../预设对象/预设/实体对象EntityObject.md#getenginetypestr),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetEngineType](../预设对象/预设/实体对象EntityObject.md#getenginetype),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetModelId](../预设对象/预设/实体对象EntityObject.md#getmodelid),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.PlayAnim](../预设对象/预设/实体对象EntityObject.md#playanim),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetOpacity](../预设对象/预设/实体对象EntityObject.md#setopacity),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetHealth](../预设对象/预设/实体对象EntityObject.md#gethealth),获取实体预设的生命值 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetHealth](../预设对象/预设/实体对象EntityObject.md#sethealth),设置实体预设的生命值 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetMaxHealth](../预设对象/预设/实体对象EntityObject.md#getmaxhealth),获取实体预设的最大生命值 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetMaxHealth](../预设对象/预设/实体对象EntityObject.md#setmaxhealth),设置实体预设的最大生命值 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetSpeed](../预设对象/预设/实体对象EntityObject.md#getspeed),获取实体预设的速度 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetSpeed](../预设对象/预设/实体对象EntityObject.md#setspeed),设置实体预设的速度 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetMaxSpeed](../预设对象/预设/实体对象EntityObject.md#getmaxspeed),获取实体预设的最大速度 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetMaxSpeed](../预设对象/预设/实体对象EntityObject.md#setmaxspeed),设置实体预设的最大速度 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetDamage](../预设对象/预设/实体对象EntityObject.md#getdamage),获取实体预设的伤害 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetDamage](../预设对象/预设/实体对象EntityObject.md#setdamage),设置实体预设的伤害 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetMaxDamage](../预设对象/预设/实体对象EntityObject.md#getmaxdamage),获取实体预设的最大伤害 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetMaxDamage](../预设对象/预设/实体对象EntityObject.md#setmaxdamage),设置实体预设的最大伤害 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.ShowHealth](../预设对象/预设/实体对象EntityObject.md#showhealth),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetAttackTarget](../预设对象/预设/实体对象EntityObject.md#setattacktarget),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.ResetAttackTarget](../预设对象/预设/实体对象EntityObject.md#resetattacktarget),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetAttackTarget](../预设对象/预设/实体对象EntityObject.md#getattacktarget),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetKnockback](../预设对象/预设/实体对象EntityObject.md#setknockback),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetOwner](../预设对象/预设/实体对象EntityObject.md#setowner),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetOwner](../预设对象/预设/实体对象EntityObject.md#getowner),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.IsOnFire](../预设对象/预设/实体对象EntityObject.md#isonfire),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetOnFire](../预设对象/预设/实体对象EntityObject.md#setonfire),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetAttrValue](../预设对象/预设/实体对象EntityObject.md#getattrvalue),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetAttrMaxValue](../预设对象/预设/实体对象EntityObject.md#getattrmaxvalue),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetAttrValue](../预设对象/预设/实体对象EntityObject.md#setattrvalue),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetAttrMaxValue](../预设对象/预设/实体对象EntityObject.md#setattrmaxvalue),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.IsInLava](../预设对象/预设/实体对象EntityObject.md#isinlava),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.IsOnGround](../预设对象/预设/实体对象EntityObject.md#isonground),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetAuxValue](../预设对象/预设/实体对象EntityObject.md#getauxvalue),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetCurrentAirSupply](../预设对象/预设/实体对象EntityObject.md#getcurrentairsupply),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetMaxAirSupply](../预设对象/预设/实体对象EntityObject.md#getmaxairsupply),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetCurrentAirSupply](../预设对象/预设/实体对象EntityObject.md#setcurrentairsupply),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetMaxAirSupply](../预设对象/预设/实体对象EntityObject.md#setmaxairsupply),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.IsConsumingAirSupply](../预设对象/预设/实体对象EntityObject.md#isconsumingairsupply),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetRecoverTotalAirSupplyTime](../预设对象/预设/实体对象EntityObject.md#setrecovertotalairsupplytime),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetSourceId](../预设对象/预设/实体对象EntityObject.md#getsourceid),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetCollisionBoxSize](../预设对象/预设/实体对象EntityObject.md#setcollisionboxsize),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetCollisionBoxSize](../预设对象/预设/实体对象EntityObject.md#getcollisionboxsize),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetBlockControlAi](../预设对象/预设/实体对象EntityObject.md#setblockcontrolai),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetDimensionId](../预设对象/预设/实体对象EntityObject.md#getdimensionid),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.ChangeDimension](../预设对象/预设/实体对象EntityObject.md#changedimension),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.RemoveEffect](../预设对象/预设/实体对象EntityObject.md#removeeffect),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.AddEffect](../预设对象/预设/实体对象EntityObject.md#addeffect),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetEffects](../预设对象/预设/实体对象EntityObject.md#geteffects),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.TriggerCustomEvent](../预设对象/预设/实体对象EntityObject.md#triggercustomevent),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.IsAlive](../预设对象/预设/实体对象EntityObject.md#isalive),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetGravity](../预设对象/预设/实体对象EntityObject.md#getgravity),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetGravity](../预设对象/预设/实体对象EntityObject.md#setgravity),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetHurt](../预设对象/预设/实体对象EntityObject.md#sethurt),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetImmuneDamage](../预设对象/预设/实体对象EntityObject.md#setimmunedamage),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetModAttr](../预设对象/预设/实体对象EntityObject.md#setmodattr),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetModAttr](../预设对象/预设/实体对象EntityObject.md#getmodattr),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.RegisterModAttrUpdateFunc](../预设对象/预设/实体对象EntityObject.md#registermodattrupdatefunc),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.UnRegisterModAttrUpdateFunc](../预设对象/预设/实体对象EntityObject.md#unregistermodattrupdatefunc),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetName](../预设对象/预设/实体对象EntityObject.md#getname),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetName](../预设对象/预设/实体对象EntityObject.md#setname),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetShowName](../预设对象/预设/实体对象EntityObject.md#setshowname),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetAlwaysShowName](../预设对象/预设/实体对象EntityObject.md#setalwaysshowname),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetPersistence](../预设对象/预设/实体对象EntityObject.md#setpersistence),组件工厂化 + +1. 新增[Preset.Controller.PresetApi.GetGameObjectByTypeName](../预设管理/PresetApi.md#getgameobjectbytypename),获取指定类型和名称的第一个游戏对象 + +1. 新增[Preset.Controller.PresetApi.GetGameObjectsByTypeName](../预设管理/PresetApi.md#getgameobjectsbytypename),获取指定类型和名称的所有游戏对象 + +1. 新增[Preset.Controller.PresetApi.GetPartApi](../预设管理/PresetApi.md#getpartapi),获取零件API + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.24.0.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.24.0.md new file mode 100644 index 0000000..8e0a4cb --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.24.0.md @@ -0,0 +1,29 @@ +# 1.24.0 + +- 注:该版本功能仅在modpc开发包生效,移动端生效请期待1.25大版本更新。 +- 新增 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.EnableKeepInventory](../预设对象/预设/玩家对象PlayerObject.md#enablekeepinventory),组件工厂化 + +1. 新增[Preset.Model.PartBase.PartBase.GetLoadedPlayers](../预设对象/零件/零件PartBase.md#getloadedplayers),获取服务器所有玩家的ID列表 + +1. 新增[Preset.Model.PartBase.PartBase.BroadcastPresetSystemEvent](../预设对象/零件/零件PartBase.md#broadcastpresetsystemevent),广播给预设系统 + +1. 新增[Preset.Model.PartBase.PartBase.ListenPresetSystemEvent](../预设对象/零件/零件PartBase.md#listenpresetsystemevent),监听来自预设系统的事件 + +1. 新增[Preset.Model.PartBase.PartBase.UnListenPresetSystemEvent](../预设对象/零件/零件PartBase.md#unlistenpresetsystemevent),反监听来自预设系统的事件 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.EnablePlayerKeepInventory](../预设对象/通用/SDK接口封装SdkInterface.md#enableplayerkeepinventory),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetPos](../预设对象/预设/实体对象EntityObject.md#getpos),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetFootPos](../预设对象/预设/实体对象EntityObject.md#getfootpos),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetPos](../预设对象/预设/实体对象EntityObject.md#setpos),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetFootPos](../预设对象/预设/实体对象EntityObject.md#setfootpos),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetRot](../预设对象/预设/实体对象EntityObject.md#getrot),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetRot](../预设对象/预设/实体对象EntityObject.md#setrot),组件工厂化 + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.24.1.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.24.1.md new file mode 100644 index 0000000..3702c34 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.24.1.md @@ -0,0 +1,32 @@ +# 1.24.1 + +- 新增 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetId](../预设对象/通用/变换对象TransformObject.md#getid),获取当前预设的ID + +1. 新增[Preset.Model.SdkInterface.SdkInterface.AddBlockProtectField](../预设对象/通用/SDK接口封装SdkInterface.md#addblockprotectfield),设置一个方块无法被玩家/实体破坏的区域 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.RemoveBlockProtectField](../预设对象/通用/SDK接口封装SdkInterface.md#removeblockprotectfield),取消一个方块无法被玩家/实体破坏的区域 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CleanBlockProtectField](../预设对象/通用/SDK接口封装SdkInterface.md#cleanblockprotectfield),取消全部已设置的方块无法被玩家/实体破坏的区域 + +1. 新增[Preset.Parts.TriggerPart.TriggerPart](../预设对象/零件/触发器零件TriggerPart.md#__init__),触发器零件 + +1. 新增[Preset.Parts.TriggerPart.TriggerPart.GetEntitiesInTrigger](../预设对象/零件/触发器零件TriggerPart.md#getentitiesintrigger),获取当前在触发器区域的实体列表 + +1. 新增[Preset.Parts.NavPointsPart.NavPointsPart](../预设对象/零件/导航路径零件NavPointsPart.md#__init__),导航路径零件 + +1. 新增[Preset.Parts.EntityBasePart.EntityBasePart](../预设对象/零件/实体零件EntityBasePart.md#__init__),实体零件 + +1. 新增[Preset.Parts.EntityBasePart.EntityBasePart.CreateVirtualEntity](../预设对象/零件/实体零件EntityBasePart.md#createvirtualentity),手动创建关联实体 + +1. 新增[Preset.Parts.EntityBasePart.EntityBasePart.DestroyVirtualEntity](../预设对象/零件/实体零件EntityBasePart.md#destroyvirtualentity),移除已创建的关联实体 + +1. 新增[Preset.Parts.CameraTrackPart.CameraTrackPart](../预设对象/零件/相机轨迹CameraTrackPart.md#__init__),相机轨迹零件 + +1. 新增[Preset.Parts.PortalPart.PortalPart](../预设对象/零件/传送门零件PortalPart.md#__init__),传送门零件 + +1. 新增[Preset.Parts.PlayerBasicPart.PlayerBasicPart](../预设对象/零件/玩家基础属性零件PlayerBasicPart.md#__init__),玩家基础属性零件 + +1. 新增[Preset.Parts.WorldPart.WorldPart](../预设对象/零件/世界属性零件WorldPart.md#__init__),世界属性零件 + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.25.0.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.25.0.md new file mode 100644 index 0000000..d4872b9 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/1.25.0.md @@ -0,0 +1,22 @@ +# 1.25.0 + +- 新增 + +1. 新增[Preset.Model.PresetBase.PresetBase.SetBlockProtect](../预设对象/预设/预设基类PresetBase.md#setblockprotect),设置预设内的所有素材区域的方块保护状态 + +1. 新增[Preset.Model.GameObject.type.fromDict](../预设对象/通用/游戏对象GameObject.md#fromdict),将字典根据classType字段转换为对应类型的对象,该类型必须使用@registerGenericClass装饰 + +1. 新增[Preset.Parts.NavPointsPart.NavPointsPart](../预设对象/零件/导航路径零件NavPointsPart.md#__init__),导航路径零件 + +1. 新增[Preset.Parts.NavPointsPart.NavPointsPart.GetNavigationPoints](../预设对象/零件/导航路径零件NavPointsPart.md#getnavigationpoints),获得路径点的世界坐标列表 + +1. 新增[Preset.Parts.CameraTrackPart.CameraTrackPart](../预设对象/零件/相机轨迹CameraTrackPart.md#__init__),相机轨迹零件 + +1. 新增[Preset.Parts.CameraTrackPart.CameraTrackPart.PlayFromStart](../预设对象/零件/相机轨迹CameraTrackPart.md#playfromstart),从头开始播放相机运动轨迹 + +1. 新增[Preset.Parts.CameraTrackPart.CameraTrackPart.Pause](../预设对象/零件/相机轨迹CameraTrackPart.md#pause),暂停播放相机轨迹 + +1. 新增[Preset.Parts.CameraTrackPart.CameraTrackPart.Continue](../预设对象/零件/相机轨迹CameraTrackPart.md#continue),继续播放相机轨迹 + +1. 新增[Preset.Parts.CameraTrackPart.CameraTrackPart.Stop](../预设对象/零件/相机轨迹CameraTrackPart.md#stop),停止播放相机轨迹 + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.0.1.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.0.1.md new file mode 100644 index 0000000..731b8a7 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.0.1.md @@ -0,0 +1,10 @@ +# 2.0.1 + +- 新增 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetMotion](../预设对象/预设/实体对象EntityObject.md#setmotion),组件工厂化 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetMotion](../预设对象/预设/实体对象EntityObject.md#getmotion),组件工厂化 + +1. 新增[Preset.Parts.NavPointsPart.NavPointsPart.GetNavigationRadius](../预设对象/零件/导航路径零件NavPointsPart.md#getnavigationradius),获得路径点的随机半径列表 + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.0.2.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.0.2.md new file mode 100644 index 0000000..a7172fd --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.0.2.md @@ -0,0 +1,76 @@ +# 2.0.2 + +- 新增 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.AddAnimation](../预设对象/预设/玩家对象PlayerObject.md#addanimation),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetHealthLevel](../预设对象/预设/玩家对象PlayerObject.md#sethealthlevel),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetStarveLevel](../预设对象/预设/玩家对象PlayerObject.md#setstarvelevel),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetNaturalStarve](../预设对象/预设/玩家对象PlayerObject.md#setnaturalstarve),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetStarveTick](../预设对象/预设/玩家对象PlayerObject.md#setstarvetick),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetNaturalRegen](../预设对象/预设/玩家对象PlayerObject.md#setnaturalregen),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetHealthTick](../预设对象/预设/玩家对象PlayerObject.md#sethealthtick),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetMaxExhaustionValue](../预设对象/预设/玩家对象PlayerObject.md#setmaxexhaustionvalue),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetPickUpArea](../预设对象/预设/玩家对象PlayerObject.md#setpickuparea),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetJumpable](../预设对象/预设/玩家对象PlayerObject.md#setjumpable),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetMovable](../预设对象/预设/玩家对象PlayerObject.md#setmovable),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.AddAnimationController](../预设对象/预设/玩家对象PlayerObject.md#addanimationcontroller),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.AddAnimationIntoState](../预设对象/预设/玩家对象PlayerObject.md#addanimationintostate),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.AddGeometry](../预设对象/预设/玩家对象PlayerObject.md#addgeometry),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.AddParticleEffect](../预设对象/预设/玩家对象PlayerObject.md#addparticleeffect),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.AddRenderController](../预设对象/预设/玩家对象PlayerObject.md#addrendercontroller),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.AddRenderMaterial](../预设对象/预设/玩家对象PlayerObject.md#addrendermaterial),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.AddSoundEffect](../预设对象/预设/玩家对象PlayerObject.md#addsoundeffect),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.AddTexture](../预设对象/预设/玩家对象PlayerObject.md#addtexture),铺量属性接口 + +1. 新增[Preset.Model.Player.PlayerObject.PlayerObject.SetSkin](../预设对象/预设/玩家对象PlayerObject.md#setskin),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetItem](../预设对象/预设/实体对象EntityObject.md#setitem),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetCanOtherPlayerRide](../预设对象/预设/实体对象EntityObject.md#setcanotherplayerride),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetControl](../预设对象/预设/实体对象EntityObject.md#setcontrol),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetRidePos](../预设对象/预设/实体对象EntityObject.md#setridepos),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetNotRender](../预设对象/预设/实体对象EntityObject.md#setnotrender),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetCollidable](../预设对象/预设/实体对象EntityObject.md#setcollidable),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetHealthColor](../预设对象/预设/实体对象EntityObject.md#sethealthcolor),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.AddAnimation](../预设对象/预设/实体对象EntityObject.md#addanimation),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.AddAnimationController](../预设对象/预设/实体对象EntityObject.md#addanimationcontroller),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.AddScriptAnimate](../预设对象/预设/实体对象EntityObject.md#addscriptanimate),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.AddParticleEffect](../预设对象/预设/实体对象EntityObject.md#addparticleeffect),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.AddRenderController](../预设对象/预设/实体对象EntityObject.md#addrendercontroller),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.AddRenderMaterial](../预设对象/预设/实体对象EntityObject.md#addrendermaterial),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.AddSoundEffect](../预设对象/预设/实体对象EntityObject.md#addsoundeffect),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetPushable](../预设对象/预设/实体对象EntityObject.md#setpushable),铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetModel](../预设对象/预设/实体对象EntityObject.md#setmodel),铺量属性接口 + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.0.3.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.0.3.md new file mode 100644 index 0000000..abe4afc --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.0.3.md @@ -0,0 +1,38 @@ +# 2.0.3 + +- 新增 + +1. 新增[Preset.Model.PartBase.PartBase.CreateTextboardPreset](../预设对象/零件/零件PartBase.md#createtextboardpreset)(客户端/服务端), 创建文字面板对象 + +1. 新增[Preset.Model.Textboard.TextboardPreset.TextboardPreset](../预设对象/预设/文字面板预设TextboardPreset.md#__init__)(客户端/服务端), 文字面板预设 + +1. 新增[Preset.Model.SdkInterface.SdkInterface.CreatePostProcessComponent](../预设对象/通用/SDK接口封装SdkInterface.md#createpostprocesscomponent)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetLavaSpeed](../预设对象/预设/实体对象EntityObject.md#getlavaspeed)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetLavaSpeed](../预设对象/预设/实体对象EntityObject.md#setlavaspeed)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.GetMaxLavaSpeed](../预设对象/预设/实体对象EntityObject.md#getmaxlavaspeed)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Entity.EntityObject.EntityObject.SetMaxLavaSpeed](../预设对象/预设/实体对象EntityObject.md#setmaxlavaspeed)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Textboard.TextboardObject.TextboardObject](../预设对象/预设/文字面板对象TextboardObject.md#__init__)(客户端/服务端), 文字面板对象 + +1. 新增[Preset.Model.Textboard.TextboardObject.TextboardObject.SetBindEntity](../预设对象/预设/文字面板对象TextboardObject.md#setbindentity)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Textboard.TextboardObject.TextboardObject.SetPos](../预设对象/预设/文字面板对象TextboardObject.md#setpos)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Textboard.TextboardObject.TextboardObject.SetRot](../预设对象/预设/文字面板对象TextboardObject.md#setrot)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Textboard.TextboardObject.TextboardObject.SetScale](../预设对象/预设/文字面板对象TextboardObject.md#setscale)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Textboard.TextboardObject.TextboardObject.SetText](../预设对象/预设/文字面板对象TextboardObject.md#settext)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Textboard.TextboardObject.TextboardObject.SetColor](../预设对象/预设/文字面板对象TextboardObject.md#setcolor)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Textboard.TextboardObject.TextboardObject.SetBackgroundColor](../预设对象/预设/文字面板对象TextboardObject.md#setbackgroundcolor)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Textboard.TextboardObject.TextboardObject.SetFaceCamera](../预设对象/预设/文字面板对象TextboardObject.md#setfacecamera)(客户端/服务端), 铺量属性接口 + +1. 新增[Preset.Model.Textboard.TextboardObject.TextboardObject.SetBoardDepthTest](../预设对象/预设/文字面板对象TextboardObject.md#setboarddepthtest)(客户端/服务端), 铺量属性接口 + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.2.0.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.2.0.md new file mode 100644 index 0000000..80f764f --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.2.0.md @@ -0,0 +1,6 @@ +# 2.2.0 + +- 新增 + +1. 新增[Preset.Controller.PresetApi.CreateTransform](../预设管理/PresetApi.md#createtransform)(客户端/服务端), 构造变换对象 + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.4.0.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.4.0.md new file mode 100644 index 0000000..fe5b2b8 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/更新信息/2.4.0.md @@ -0,0 +1,30 @@ +# 2.4.0 + +- 新增 + +1. 新增[Preset.Model.TransformObject.TransformObject.GetDimension](../预设对象/通用/变换对象TransformObject.md#getdimension)(客户端/服务端), 获取所在的维度 + +1. 新增[Preset.Model.TransformObject.TransformObject.SetDimension](../预设对象/通用/变换对象TransformObject.md#setdimension)(客户端/服务端), 设置所在的维度 + +1. 新增[Preset.Controller.PresetApi.GetPresetSize](../预设管理/PresetApi.md#getpresetsize)(客户端/服务端), 根据预设ID获取预设的包围盒大小 + +- 调整 + +1. 调整[Preset.Controller.PresetApi.GetAllPresets](../预设管理/PresetApi.md#getallpresets)(客户端/服务端), 新增dimension参数 + +1. 调整[Preset.Controller.PresetApi.GetBlockPresetByPosition](../预设管理/PresetApi.md#getblockpresetbyposition)(客户端/服务端), 新增dimension参数 + +1. 调整[Preset.Controller.PresetApi.GetGameObjectByTypeName](../预设管理/PresetApi.md#getgameobjectbytypename)(客户端/服务端), 新增dimension参数 + +1. 调整[Preset.Controller.PresetApi.GetGameObjectsByTypeName](../预设管理/PresetApi.md#getgameobjectsbytypename)(客户端/服务端), 新增dimension参数 + +1. 调整[Preset.Controller.PresetApi.GetPresetByName](../预设管理/PresetApi.md#getpresetbyname)(客户端/服务端), 新增dimension参数 + +1. 调整[Preset.Controller.PresetApi.GetPresetByType](../预设管理/PresetApi.md#getpresetbytype)(客户端/服务端), 新增dimension参数 + +1. 调整[Preset.Controller.PresetApi.GetPresetsByName](../预设管理/PresetApi.md#getpresetsbyname)(客户端/服务端), 新增dimension参数 + +1. 调整[Preset.Controller.PresetApi.GetPresetsByType](../预设管理/PresetApi.md#getpresetsbytype)(客户端/服务端), 新增dimension参数 + +1. 调整[Preset.Controller.PresetApi.SpawnPreset](../预设管理/PresetApi.md#spawnpreset)(客户端/服务端), 新增dimension与virtual参数 + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/SDK接口封装SdkInterface.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/SDK接口封装SdkInterface.md new file mode 100644 index 0000000..734244f --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/SDK接口封装SdkInterface.md @@ -0,0 +1,10317 @@ +--- +sidebarDepth: 1 +--- +# SDK接口封装SdkInterface + + + +## 概述 + +- 描述 + + SdkInterface是对SDK接口封装的基类。 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 关联实体ID | + | isClient | bool | 是否客户端 | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [GetEntityId](#getentityid) | 客户端/服务端 | 获取对象实体ID | +| [ToPlayerPreset](#toplayerpreset) | 客户端/服务端 | 强制类型转换为玩家预设 | +| [ToEntityPreset](#toentitypreset) | 客户端/服务端 | 强制类型转换为实体预设 | +| [ToEffectPreset](#toeffectpreset) | 客户端/服务端 | 强制类型转换为特效预设 | +| [ToBlockPreset](#toblockpreset) | 客户端/服务端 | 强制类型转换为方块预设 | +| [ToUIPreset](#touipreset) | 客户端/服务端 | 强制类型转换为UI预设 | +| [GetServerSystem](#getserversystem) | 客户端/服务端 | 返回当前对象可使用的服务端system | +| [GetClientSystem](#getclientsystem) | 客户端/服务端 | 返回当前对象可使用的客户端system | +| [GetSystem](#getsystem) | 客户端/服务端 | 返回当前对象可使用的system | +| [GetLevelId](#getlevelid) | 客户端/服务端 | 获取当前对象所在的level_id | +| [CreateComponent](#createcomponent) | 客户端/服务端 | 给实体创建组件 | +| [GetMinecraftEnum](#getminecraftenum) | 客户端/服务端 | 用于获取枚举值文档中的枚举值 | +| [DestroyEntity](#destroyentity) | 客户端/服务端 | 销毁实体 | +| [CreateActionComponent](#createactioncomponent) | 服务端 | 创建action组件 | +| [SetEntityAttackTarget](#setentityattacktarget) | 服务端 | 设置仇恨目标 | +| [ResetEntityAttackTarget](#resetentityattacktarget) | 服务端 | 清除仇恨目标 | +| [GetEntityAttackTarget](#getentityattacktarget) | 服务端 | 获取仇恨目标 | +| [SetMobKnockback](#setmobknockback) | 服务端 | 设置击退的初始速度,需要考虑阻力的影响 | +| [CreateActorLootComponent](#createactorlootcomponent) | 服务端 | 创建actorLoot组件 | +| [SpawnLootTable](#spawnloottable) | 服务端 | 使用生物类型模拟一次随机掉落,生成的物品与json定义的概率有关 | +| [SpawnLootTableWithActor](#spawnloottablewithactor) | 服务端 | 使用生物实例模拟一次随机掉落,生成的物品与json定义的概率有关 | +| [CreateActorMotionComponent](#createactormotioncomponent) | 客户端/服务端 | 创建actorMotion组件 | +| [GetDirFromRot](#getdirfromrot) | 客户端/服务端 | 通过旋转角度获取朝向 | +| [SetEntityMotion](#setentitymotion) | 客户端/服务端 | 设置生物的瞬时移动方向向量,服务端只能对非玩家使用,客户端只能对本地玩家使用 | +| [GetEntityMotion](#getentitymotion) | 客户端/服务端 | 获取生物(含玩家)的瞬时移动方向向量 | +| [GetInputVector](#getinputvector) | 客户端 | 获取本地玩家方向键(移动轮盘)的输入 | +| [LockInputVector](#lockinputvector) | 客户端 | 锁定本地玩家方向键(移动轮盘)的输入,可使本地玩家持续向指定方向前行,且不会再受玩家输入影响 | +| [UnlockInputVector](#unlockinputvector) | 客户端 | 解锁本地玩家方向键(移动轮盘)的输入 | +| [CreateActorOwnerComponent](#createactorownercomponent) | 服务端 | 创建actorOwner组件 | +| [SetEntityOwner](#setentityowner) | 服务端 | 设置实体的属主 | +| [GetEntityOwner](#getentityowner) | 服务端 | 获取实体的属主 | +| [CreateActorPushableComponent](#createactorpushablecomponent) | 服务端 | 创建actorPushable组件 | +| [SetActorPushable](#setactorpushable) | 服务端 | 设置实体是否可推动 | +| [CreateAttrComponent](#createattrcomponent) | 客户端/服务端 | 创建attr组件 | +| [IsEntityOnFire](#isentityonfire) | 服务端 | 获取实体是否着火 | +| [SetEntityOnFire](#setentityonfire) | 服务端 | 设置实体着火 | +| [GetEntityAttrValue](#getentityattrvalue) | 服务端 | 获取属性值,包括生命值,饥饿度,移速 | +| [GetEntityAttrMaxValue](#getentityattrmaxvalue) | 服务端 | 获取属性最大值,包括生命值,饥饿度,移速 | +| [SetEntityAttrValue](#setentityattrvalue) | 服务端 | 设置属性值,包括生命值,饥饿度,移速 | +| [SetEntityAttrMaxValue](#setentityattrmaxvalue) | 服务端 | 设置属性最大值,包括生命值,饥饿度,移速 | +| [SetPlayerStepHeight](#setplayerstepheight) | 服务端 | 设置玩家前进非跳跃状态下能上的最大台阶高度, 默认值为0.5625,1的话表示能上一个台阶 | +| [GetPlayerStepHeight](#getplayerstepheight) | 服务端 | 返回玩家前进非跳跃状态下能上的最大台阶高度 | +| [ResetPlayerStepHeight](#resetplayerstepheight) | 服务端 | 恢复引擎默认玩家前进非跳跃状态下能上的最大台阶高度 | +| [IsEntityInLava](#isentityinlava) | 客户端 | 实体是否在岩浆中 | +| [IsEntityOnGround](#isentityonground) | 客户端 | 实体是否触地 | +| [CreateAuxValueComponent](#createauxvaluecomponent) | 客户端/服务端 | 创建auxValue组件 | +| [GetEntityAuxValue](#getentityauxvalue) | 客户端/服务端 | 获取射出的弓箭或投掷出的药水的附加值 | +| [CreateBiomeComponent](#createbiomecomponent) | 服务端 | 创建biome组件 | +| [GetBiomeName](#getbiomename) | 服务端 | 获取某一位置所属的生物群系信息 | +| [CreateBlockComponent](#createblockcomponent) | 服务端 | 创建block组件 | +| [RegisterBlockPatterns](#registerblockpatterns) | 服务端 | 注册特殊方块组合 | +| [CreateMicroBlockResStr](#createmicroblockresstr) | 服务端 | 生成微缩方块资源Json字符串 | +| [CreateBlockEntityData](#createblockentitydata) | 服务端 | 创建blockEntityData组件 | +| [GetCustomBlockEntityData](#getcustomblockentitydata) | 服务端 | 用于获取可操作某个自定义方块实体数据的对象,操作方式与dict类似 | +| [CreateBlockInfoComponent](#createblockinfocomponent) | 客户端/服务端 | 创建blockInfo组件 | +| [GetBlock](#getblock) | 客户端/服务端 | 获取某一位置的block | +| [SetBlock](#setblock) | 服务端 | 设置某一位置的方块 | +| [GetTopBlockHeight](#gettopblockheight) | 客户端/服务端 | 获取当前维度某一位置最高的非空气方块的高度 | +| [GetBlockDestroyTime](#getblockdestroytime) | 客户端/服务端 | 获取使用物品破坏方块需要的时间 | +| [GetBlockEntityData](#getblockentitydata) | 服务端 | 用于获取方块(包括自定义方块)的数据,数据只读不可写 | +| [CreateBlockStateComponent](#createblockstatecomponent) | 服务端 | 创建blockState组件 | +| [GetBlockStates](#getblockstates) | 服务端 | 获取 方块状态 | +| [SetBlockStates](#setblockstates) | 服务端 | 设置 方块状态 | +| [GetBlockAuxValueFromStates](#getblockauxvaluefromstates) | 服务端 | 根据方块名称和 方块状态 获取方块附加值AuxValue | +| [GetBlockStatesFromAuxValue](#getblockstatesfromauxvalue) | 服务端 | 根据方块名称和方块附加值AuxValue获取 方块状态 | +| [CreateBlockUseEventWhiteList](#createblockuseeventwhitelist) | 客户端/服务端 | 创建blockUseEventWhiteList组件 | +| [AddBlockItemListenForUseEvent](#addblockitemlistenforuseevent) | 客户端/服务端 | 增加blockName方块对ServerBlockUseEvent事件的脚本层监听 | +| [RemoveBlockItemListenForUseEvent](#removeblockitemlistenforuseevent) | 客户端/服务端 | 移除blockName方块对ServerBlockUseEvent事件的脚本层监听 | +| [ClearAllListenForBlockUseEventItems](#clearalllistenforblockuseeventitems) | 客户端/服务端 | 清空所有已添加方块对ServerBlockUseEvent事件的脚本层监听 | +| [CreateBreathComponent](#createbreathcomponent) | 服务端 | 创建breath组件 | +| [GetUnitBubbleAirSupply](#getunitbubbleairsupply) | 服务端 | 单位气泡数对应的氧气储备值 | +| [GetEntityCurrentAirSupply](#getentitycurrentairsupply) | 服务端 | 生物当前氧气储备值 | +| [GetEntityMaxAirSupply](#getentitymaxairsupply) | 服务端 | 获取生物最大氧气储备值 | +| [SetEntityCurrentAirSupply](#setentitycurrentairsupply) | 服务端 | 设置生物氧气储备值 | +| [SetEntityMaxAirSupply](#setentitymaxairsupply) | 服务端 | 设置生物最大氧气储备值 | +| [IsEntityConsumingAirSupply](#isentityconsumingairsupply) | 服务端 | 获取生物当前是否在消耗氧气 | +| [SetEntityRecoverTotalAirSupplyTime](#setentityrecovertotalairsupplytime) | 服务端 | 设置恢复最大氧气量的时间,单位秒 | +| [CreateBulletAttributesComponent](#createbulletattributescomponent) | 服务端 | 创建bulletAttributes组件 | +| [GetEntitySourceId](#getentitysourceid) | 服务端 | 获取抛射物发射者实体id | +| [CreateChestBlockComponent](#createchestblockcomponent) | 服务端 | 创建chestBlock组件 | +| [GetChestBoxSize](#getchestboxsize) | 服务端 | 获取箱子容量大小 | +| [SetChestBoxItemNum](#setchestboxitemnum) | 服务端 | 设置箱子槽位物品数目 | +| [SetChestBoxItemExchange](#setchestboxitemexchange) | 服务端 | 交换箱子里物品的槽位 | +| [CreateChunkSourceComponent](#createchunksourcecomponent) | 客户端/服务端 | 创建chunkSource组件 | +| [SetAddArea](#setaddarea) | 服务端 | 设置区块的常加载 | +| [DeleteArea](#deletearea) | 服务端 | 删除一个常加载区域 | +| [DeleteAllArea](#deleteallarea) | 服务端 | 删除所有常加载区域 | +| [GetAllAreaKeys](#getallareakeys) | 服务端 | 获取所有常加载区域名称列表 | +| [CheckChunkState](#checkchunkstate) | 服务端 | 判断指定位置的chunk是否加载完成 | +| [GetLoadedChunks](#getloadedchunks) | 服务端 | 获取指定维度当前已经加载完毕的全部区块的坐标列表 | +| [GetChunkEntities](#getchunkentities) | 服务端 | 获取指定位置的区块中,全部的实体和玩家的ID列表 | +| [GetChunkMobNum](#getchunkmobnum) | 服务端 | 获取某区块中的生物数量(不包括玩家,但包括盔甲架) | +| [IsChunkGenerated](#ischunkgenerated) | 服务端 | 获取某个区块是否生成过。 | +| [CreateCollisionBoxComponent](#createcollisionboxcomponent) | 服务端 | 创建collisionBox组件 | +| [SetEntityCollisionBoxSize](#setentitycollisionboxsize) | 服务端 | 设置实体的包围盒 | +| [GetEntityCollisionBoxSize](#getentitycollisionboxsize) | 服务端 | 获取实体的包围盒 | +| [CreateCommandComponent](#createcommandcomponent) | 服务端 | 创建command组件 | +| [SetCommand](#setcommand) | 服务端 | 使用游戏内指令 | +| [GetCommandPermissionLevel](#getcommandpermissionlevel) | 服务端 | 返回设定使用/op命令时OP的权限等级(对应server.properties中的op-permission-level配置) | +| [SetCommandPermissionLevel](#setcommandpermissionlevel) | 服务端 | 设置当玩家使用/op命令时OP的权限等级(对应server.properties中的op-permission-level配置) | +| [GetDefaultPlayerPermissionLevel](#getdefaultplayerpermissionlevel) | 服务端 | 返回新玩家加入时的权限身份(对应server.properties中的default-player-permission-level配置) | +| [SetDefaultPlayerPermissionLevel](#setdefaultplayerpermissionlevel) | 服务端 | 设置新玩家加入时的权限身份(对应server.properties中的default-player-permission-level配置) | +| [CreateControlAiComponent](#createcontrolaicomponent) | 服务端 | 创建controlAi组件 | +| [SetEntityBlockControlAi](#setentityblockcontrolai) | 服务端 | 设置屏蔽生物原生AI | +| [CreateDimensionComponent](#createdimensioncomponent) | 服务端 | 创建dimension组件 | +| [GetEntityDimensionId](#getentitydimensionid) | 服务端 | 获取实体所在维度 | +| [ChangeEntityDimension](#changeentitydimension) | 服务端 | 传送玩家以外的实体 | +| [ChangePlayerDimension](#changeplayerdimension) | 服务端 | 传送玩家 | +| [MirrorDimension](#mirrordimension) | 服务端 | 复制不同dimension的地形 | +| [CreateDimension](#createdimension) | 服务端 | 创建新的dimension | +| [RegisterEntityAOIEvent](#registerentityaoievent) | 服务端 | 注册感应区域,有实体进入时和离开时会有消息通知 | +| [UnRegisterEntityAOIEvent](#unregisterentityaoievent) | 服务端 | 反注册感应区域 | +| [SetUseLocalTime](#setuselocaltime) | 服务端 | 让某个维度拥有自己的局部时间规则,开启后该维度可以拥有与其他维度不同的时间与是否昼夜更替的规则 | +| [GetUseLocalTime](#getuselocaltime) | 服务端 | 获取某个维度是否设置了使用局部时间规则 | +| [SetLocalTime](#setlocaltime) | 服务端 | 设置使用局部时间规则维度的时间 | +| [SetLocalTimeOfDay](#setlocaltimeofday) | 服务端 | 设置使用局部时间规则维度在一天内所在的时间 | +| [GetLocalTime](#getlocaltime) | 服务端 | 获取维度的时间 | +| [SetLocalDoDayNightCycle](#setlocaldodaynightcycle) | 服务端 | 设置使用局部时间规则的维度是否打开昼夜更替 | +| [GetLocalDoDayNightCycle](#getlocaldodaynightcycle) | 服务端 | 获取维度是否打开昼夜更替 | +| [CreateEffectComponent](#createeffectcomponent) | 服务端 | 创建effect组件 | +| [RemoveEffectFromEntity](#removeeffectfromentity) | 服务端 | 为实体删除指定状态效果 | +| [AddEffectToEntity](#addeffecttoentity) | 服务端 | 为实体添加指定状态效果,如果添加的状态已存在则有以下集中情况:1、等级大于已存在则更新状态等级及持续时间;2、状态等级相等且剩余时间duration大于已存在则刷新剩余时间;3、等级小于已存在则不做修改;4、粒子效果以新的为准 | +| [GetEntityEffects](#getentityeffects) | 服务端 | 获取实体当前所有状态效果 | +| [CreateEngineTypeComponent](#createenginetypecomponent) | 客户端/服务端 | 创建engineType组件 | +| [GetEntityEngineTypeStr](#getentityenginetypestr) | 客户端/服务端 | 获取实体的类型名称 | +| [GetEntityEngineType](#getentityenginetype) | 客户端/服务端 | 获取实体类型 | +| [CreateEntityEventComponent](#createentityeventcomponent) | 服务端 | 创建entityEvent组件 | +| [TriggerEntityCustomEvent](#triggerentitycustomevent) | 服务端 | 触发生物自定义事件 | +| [CreateExtraDataComponent](#createextradatacomponent) | 服务端 | 创建extraData组件 | +| [GetExtraData](#getextradata) | 服务端 | 获取实体的自定义数据或者世界的自定义数据,某个键所对应的值。获取实体数据传入对应实体id | +| [SaveExtraData](#saveextradata) | 服务端 | 用于保存实体的自定义数据或者世界的自定义数据 | +| [SetExtraData](#setextradata) | 服务端 | 用于设置实体的自定义数据或者世界的自定义数据,数据以键值对的形式保存。设置实体数据时使用对应实体id创建组件,设置世界数据时使用levelId创建组件 | +| [CleanExtraData](#cleanextradata) | 服务端 | 清除实体的自定义数据或者世界的自定义数据,清除实体数据时使用对应实体id创建组件,清除世界数据时使用levelId创建组件 | +| [GetWholeExtraData](#getwholeextradata) | 服务端 | 获取完整的实体的自定义数据或者世界的自定义数据,获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件 | +| [CreateExpComponent](#createexpcomponent) | 服务端 | 创建exp组件 | +| [GetPlayerExp](#getplayerexp) | 服务端 | 获取玩家当前等级下的经验值 | +| [AddPlayerExp](#addplayerexp) | 服务端 | 增加玩家经验值 | +| [GetPlayerTotalExp](#getplayertotalexp) | 服务端 | 获取玩家的总经验值 | +| [SetPlayerTotalExp](#setplayertotalexp) | 服务端 | 设置玩家的总经验值 | +| [GetOrbExperience](#getorbexperience) | 服务端 | 获取经验球的经验 | +| [SetOrbExperience](#setorbexperience) | 服务端 | 设置经验球经验 | +| [CreateExperienceOrb](#createexperienceorb) | 服务端 | 创建专属经验球 | +| [CreateExplosionComponent](#createexplosioncomponent) | 服务端 | 创建explosion组件 | +| [CreateExplosion](#createexplosion) | 服务端 | 用于生成爆炸 | +| [CreateFeatureComponent](#createfeaturecomponent) | 服务端 | 创建feature组件 | +| [AddNeteaseFeatureWhiteList](#addneteasefeaturewhitelist) | 服务端 | 添加结构对PlaceNeteaseStructureFeatureEvent事件的脚本层监听 | +| [RemoveNeteaseFeatureWhiteList](#removeneteasefeaturewhitelist) | 服务端 | 移除structureName对PlaceNeteaseStructureFeatureEvent事件的脚本层监听 | +| [ClearAllNeteaseFeatureWhiteList](#clearallneteasefeaturewhitelist) | 服务端 | 清空所有已添加Netease Structure Feature对PlaceNeteaseStructureFeatureEvent事件的脚本层监听 | +| [LocateStructureFeature](#locatestructurefeature) | 服务端 | 与[/locate指令](https://zh.minecraft.wiki/w/%E5%91%BD%E4%BB%A4/locate)相似,用于定位原版的部分结构,如海底神殿、末地城等。 | +| [LocateNeteaseFeatureRule](#locateneteasefeaturerule) | 服务端 | 与[/locate指令](https://zh.minecraft.wiki/w/%E5%91%BD%E4%BB%A4/locate)相似,用于定位 网易自定义特征规则 | +| [CreateFlyComponent](#createflycomponent) | 服务端 | 创建fly组件 | +| [IsPlayerFlying](#isplayerflying) | 服务端 | 获取玩家是否在飞行 | +| [ChangePlayerFlyState](#changeplayerflystate) | 服务端 | 给予/取消飞行能力,并且进入飞行/非飞行状态 | +| [CreateGameComponent](#creategamecomponent) | 客户端/服务端 | 创建game组件 | +| [AddBlockProtectField](#addblockprotectfield) | 服务端 | 设置一个方块无法被玩家/实体破坏的区域 | +| [RemoveBlockProtectField](#removeblockprotectfield) | 服务端 | 取消一个方块无法被玩家/实体破坏的区域 | +| [CleanBlockProtectField](#cleanblockprotectfield) | 服务端 | 取消全部已设置的方块无法被玩家/实体破坏的区域 | +| [KillEntity](#killentity) | 服务端 | 杀死某个Entity | +| [CreateEngineEntityByTypeStr](#createengineentitybytypestr) | 服务端 | 创建指定identifier的实体 | +| [PlaceStructure](#placestructure) | 服务端 | 放置结构 | +| [AddTimer](#addtimer) | 客户端/服务端 | 添加定时器,非重复 | +| [AddRepeatedTimer](#addrepeatedtimer) | 客户端/服务端 | 添加服务端触发的定时器,重复执行 | +| [CancelTimer](#canceltimer) | 客户端/服务端 | 取消定时器 | +| [GetEntitiesInArea](#getentitiesinarea) | 客户端/服务端 | 获取区域内的entity列表 | +| [GetEntitiesAround](#getentitiesaround) | 服务端 | 获取区域内的entity列表 | +| [ShowHealthBar](#showhealthbar) | 客户端 | 设置是否显示血条 | +| [SetNameDeeptest](#setnamedeeptest) | 客户端 | 设置名字是否透视 | +| [GetScreenSize](#getscreensize) | 客户端 | 获取游戏分辨率 | +| [SetRenderLocalPlayer](#setrenderlocalplayer) | 客户端 | 设置本地玩家是否渲染 | +| [AddPickBlacklist](#addpickblacklist) | 客户端 | 添加使用camera组件选取实体时的黑名单,即该实体不会被选取到 | +| [ClearPickBlacklist](#clearpickblacklist) | 客户端 | 清除使用camera组件选取实体的黑名单 | +| [CheckWordsValid](#checkwordsvalid) | 客户端/服务端 | 检查语句是否合法,即不包含敏感词 | +| [CheckNameValid](#checknamevalid) | 客户端/服务端 | 检查昵称是否合法,即不包含敏感词 | +| [GetScreenViewInfo](#getscreenviewinfo) | 客户端 | 获取游戏视角信息。分辨率为1313,618时,画布是376,250的2倍,所以viewport得到的是1313 + (2-(1313%2)),y值类似,可参考 《我的世界》界面适配方法 | +| [SimulateTouchWithMouse](#simulatetouchwithmouse) | 客户端 | 模拟使用鼠标控制UI(PC F11快捷键) | +| [GetCurrentDimension](#getcurrentdimension) | 客户端 | 获取客户端当前维度 | +| [GetChinese](#getchinese) | 客户端/服务端 | 获取langStr对应的中文,可参考PC开发包中\handheld\bed-loc\handheld\data\resource_packs\vanilla\texts\zh_CN.lang | +| [SetDisableHunger](#setdisablehunger) | 服务端 | 设置是否屏蔽饥饿度 | +| [SetOneTipMessage](#setonetipmessage) | 服务端 | 在具体某个玩家的物品栏上方弹出tip类型通知,位置位于popup类型通知上方,此功能更建议在客户端使用game组件的对应接口SetTipMessage | +| [SetPopupNotice](#setpopupnotice) | 客户端/服务端 | 在物品栏上方弹出popup类型通知,位置位于tip类型消息下方,服务端调用是针对全体玩家,客户端调用只影响本地玩家 | +| [SetTipMessage](#settipmessage) | 客户端/服务端 | 在物品栏上方弹出tip类型通知,位置位于popup类型通知上方,服务端调用是针对全体玩家,客户端调用只影响本地玩家 | +| [SetNotifyMsg](#setnotifymsg) | 服务端 | 设置消息通知 | +| [GetPlayerGameType](#getplayergametype) | 服务端 | 获取指定玩家的游戏模式 | +| [HasEntity](#hasentity) | 客户端/服务端 | 判断 entity 是否存在 | +| [IsEntityAlive](#isentityalive) | 客户端/服务端 | 判断生物实体是否存活或非生物实体是否存在 | +| [CreateGravityComponent](#creategravitycomponent) | 服务端 | 创建gravity组件 | +| [GetEntityGravity](#getentitygravity) | 服务端 | 获取实体的重力因子,当生物重力因子为0时则应用世界的重力因子 | +| [SetEntityGravity](#setentitygravity) | 服务端 | 设置实体的重力因子,当生物重力因子为0时则应用世界的重力因子 | +| [CreateHurtComponent](#createhurtcomponent) | 服务端 | 创建hurt组件 | +| [SetHurtByEntity](#sethurtbyentity) | 服务端 | 对实体造成伤害 | +| [SetHurtByEntityNew](#sethurtbyentitynew) | 服务端 | 对实体造成伤害 | +| [SetEntityImmuneDamage](#setentityimmunedamage) | 服务端 | 设置实体是否免疫伤害(该属性存档) | +| [CreateItemBannedComponent](#createitembannedcomponent) | 服务端 | 创建itembanned组件 | +| [AddBannedItem](#addbanneditem) | 服务端 | 增加禁用物品 | +| [GetBannedItemList](#getbanneditemlist) | 服务端 | 获取禁用物品列表 | +| [RemoveBannedItem](#removebanneditem) | 服务端 | 移除禁用物品 | +| [ClearBannedItems](#clearbanneditems) | 服务端 | 清空禁用物品 | +| [CreateItemComponent](#createitemcomponent) | 客户端/服务端 | 创建item组件 | +| [GetItemBasicInfo](#getitembasicinfo) | 客户端/服务端 | 获取物品的基础信息 | +| [GetLocalPlayerId](#getlocalplayerid) | 客户端 | 获取本地玩家的id | +| [ClearPlayerOffHand](#clearplayeroffhand) | 服务端 | 清除玩家左手物品 | +| [GetPlayerItem](#getplayeritem) | 服务端 | 获取玩家物品,支持获取背包,盔甲栏,副手以及主手物品 | +| [ChangePlayerItemTipsAndExtraId](#changeplayeritemtipsandextraid) | 服务端 | 修改玩家物品的自定义tips和自定义标识符 | +| [AddEnchantToInvItem](#addenchanttoinvitem) | 服务端 | 给物品栏的物品添加附魔信息 | +| [GetInvItemEnchantData](#getinvitemenchantdata) | 服务端 | 获取物品栏的物品附魔信息 | +| [GetOffhandItem](#getoffhanditem) | 客户端 | 获取左手物品的信息 | +| [SetInvItemNum](#setinvitemnum) | 服务端 | 设置玩家背包物品数目 | +| [SpawnItemToLevel](#spawnitemtolevel) | 服务端 | 生成物品掉落物,如果需要获取物品的entityId,可以调用服务端系统接口CreateEngineItemEntity | +| [SpawnItemToPlayerInv](#spawnitemtoplayerinv) | 服务端 | 生成物品到玩家背包 | +| [SpawnItemToPlayerCarried](#spawnitemtoplayercarried) | 服务端 | 生成物品到玩家右手 | +| [GetCarriedItem](#getcarrieditem) | 客户端 | 获取右手物品的信息 | +| [GetSlotId](#getslotid) | 客户端 | 获取当前手持的快捷栏的槽id | +| [GetItemFormattedHoverText](#getitemformattedhovertext) | 客户端 | 获取物品的格式化hover文本,如:§f灾厄旗帜§r | +| [GetItemHoverName](#getitemhovername) | 客户端 | 获取物品的hover名称,如:灾厄旗帜§r | +| [GetItemEffectName](#getitemeffectname) | 客户端 | 获取物品的状态描述,如:§7保护 0§r | +| [GetUserDataInEvent](#getuserdatainevent) | 客户端/服务端 | 使物品相关客户端事件的 物品信息字典 参数带有userData。在mod初始化时调用即可 | +| [ChangeItemTexture](#changeitemtexture) | 客户端 | 替换物品的贴图,修改后所有用到该贴图的物品都会被改变,后续创建的此类物品也会被改变。会同时修改物品在UI界面上的显示,手持时候的显示与场景掉落的显示。 | +| [CreateLvComponent](#createlvcomponent) | 服务端 | 创建lv组件 | +| [GetPlayerLevel](#getplayerlevel) | 服务端 | 获取玩家等级 | +| [AddPlayerLevel](#addplayerlevel) | 服务端 | 修改玩家等级 | +| [CreateMobSpawnComponent](#createmobspawncomponent) | 服务端 | 创建mobSpawn组件 | +| [SpawnCustomModule](#spawncustommodule) | 服务端 | 设置自定义刷怪 | +| [CreateModAttrComponent](#createmodattrcomponent) | 客户端/服务端 | 创建modAttr组件 | +| [SetEntityModAttr](#setentitymodattr) | 客户端/服务端 | 设置属性值 | +| [GetEntityModAttr](#getentitymodattr) | 客户端/服务端 | 获取属性值 | +| [RegisterEntityModAttrUpdateFunc](#registerentitymodattrupdatefunc) | 客户端 | 注册属性值变换时的回调函数,当属性变化时会调用该函数 | +| [UnRegisterEntityModAttrUpdateFunc](#unregisterentitymodattrupdatefunc) | 客户端 | 反注册属性值变换时的回调函数 | +| [CreateModelComponent](#createmodelcomponent) | 客户端/服务端 | 创建model组件 | +| [SetEntityOpacity](#setentityopacity) | 客户端 | 设置生物模型的透明度 | +| [PlayEntityAnim](#playentityanim) | 客户端 | 播放骨骼动画 | +| [GetEntityModelId](#getentitymodelid) | 客户端 | 获取骨骼模型的Id,主要用于特效绑定骨骼模型 | +| [SetEntityModel](#setentitymodel) | 客户端/服务端 | 设置骨骼模型 | +| [ResetEntityModel](#resetentitymodel) | 客户端 | 恢复实体为原版模型 | +| [BindModelToEntity](#bindmodeltoentity) | 客户端 | 实体替换骨骼模型后,再往上其他挂接骨骼模型。 | +| [UnBindModelToEntity](#unbindmodeltoentity) | 客户端 | 取消实体上挂接的某个骨骼模型。取消挂接后,这个modelId的模型便会销毁,无法再使用,如果是临时隐藏可以使用HideModel | +| [CreateMoveToComponent](#createmovetocomponent) | 服务端 | 创建moveTo组件 | +| [SetEntityMoveSetting](#setentitymovesetting) | 服务端 | 寻路组件 | +| [CreateMsgComponent](#createmsgcomponent) | 服务端 | 创建msg组件 | +| [SendMsg](#sendmsg) | 服务端 | 模拟玩家给所有人发送聊天栏消息 | +| [SendMsgToPlayer](#sendmsgtoplayer) | 服务端 | 模拟玩家给另一个玩家发送聊天栏消息 | +| [NotifyOneMessage](#notifyonemessage) | 服务端 | 给指定玩家发送聊天框消息 | +| [CreateNameComponent](#createnamecomponent) | 客户端/服务端 | 创建name组件 | +| [GetEntityName](#getentityname) | 服务端 | 获取生物的自定义名称,即使用命名牌或者SetName接口设置的名称 | +| [SetEntityName](#setentityname) | 服务端 | 用于设置生物的自定义名称,跟原版命名牌作用相同,玩家和新版流浪商人暂不支持 | +| [SetPlayerPrefixAndSuffixName](#setplayerprefixandsuffixname) | 服务端 | 设置玩家前缀和后缀名字 | +| [SetEntityShowName](#setentityshowname) | 客户端 | 设置生物名字是否按照默认游戏逻辑显示 | +| [SetEntityAlwaysShowName](#setentityalwaysshowname) | 客户端 | 设置生物名字是否一直显示,瞄准点不指向生物时也能显示 | +| [CreatePersistenceComponent](#createpersistencecomponent) | 服务端 | 创建persistence组件 | +| [SetEntityPersistence](#setentitypersistence) | 服务端 | 设置实体是否存盘 | +| [CreatePetComponent](#createpetcomponent) | 服务端 | 创建pet组件 | +| [DisablePet](#disablepet) | 服务端 | 关闭官方伙伴功能,单人游戏以及本地联机不支持该接口 | +| [EnablePet](#enablepet) | 服务端 | 启用官方伙伴功能,单人游戏以及本地联机不支持该接口 | +| [CreatePlayerComponent](#createplayercomponent) | 服务端 | 创建player组件 | +| [EnablePlayerKeepInventory](#enableplayerkeepinventory) | 客户端/服务端 | 设置玩家死亡不掉落物品 | +| [CreatePortalComponent](#createportalcomponent) | 服务端 | 创建portal组件 | +| [CreatePosComponent](#createposcomponent) | 客户端/服务端 | 创建pos组件 | +| [GetEntityPos](#getentitypos) | 客户端/服务端 | 获取实体位置 | +| [GetEntityFootPos](#getentityfootpos) | 客户端/服务端 | 获取实体脚所在的位置 | +| [SetEntityPos](#setentitypos) | 服务端 | 设置实体位置 | +| [SetEntityFootPos](#setentityfootpos) | 服务端 | 设置实体脚底所在的位置 | +| [CreateProjectileComponent](#createprojectilecomponent) | 服务端 | 创建projectile组件 | +| [CreateProjectileEntity](#createprojectileentity) | 服务端 | 创建抛射物(直接发射) | +| [CreateRecipeComponent](#createrecipecomponent) | 客户端/服务端 | 创建recipe组件 | +| [GetRecipeResult](#getreciperesult) | 服务端 | 根据配方id获取配方结果。仅支持合成配方 | +| [GetRecipesByResult](#getrecipesbyresult) | 客户端/服务端 | 通过输出物品查询配方所需要的输入材料 | +| [GetRecipesByInput](#getrecipesbyinput) | 客户端/服务端 | 通过输入物品查询配方 | +| [CreateRedStoneComponent](#createredstonecomponent) | 服务端 | 创建redStone组件 | +| [CreateRideComponent](#createridecomponent) | 服务端 | 创建ride组件 | +| [CreateRotComponent](#createrotcomponent) | 客户端/服务端 | 创建rot组件 | +| [GetEntityRot](#getentityrot) | 客户端/服务端 | 获取实体角度 | +| [SetEntityRot](#setentityrot) | 客户端/服务端 | 设置实体的头的角度 | +| [SetEntityLookAtPos](#setentitylookatpos) | 服务端 | 设置非玩家的实体看向某个位置 | +| [GetBodyRot](#getbodyrot) | 客户端 | 获取实体的身体的角度 | +| [LockLocalPlayerRot](#locklocalplayerrot) | 客户端 | 在分离摄像机时,锁定本地玩家的头部角度 | +| [SetPlayerLookAtPos](#setplayerlookatpos) | 客户端 | 设置本地玩家看向某个位置 | +| [CreateScaleComponent](#createscalecomponent) | 服务端 | 创建scale组件 | +| [CreateTameComponent](#createtamecomponent) | 服务端 | 创建tame组件 | +| [CreateTimeComponent](#createtimecomponent) | 服务端 | 创建time组件 | +| [GetTime](#gettime) | 服务端 | 获取当前世界时间 | +| [CreateWeatherComponent](#createweathercomponent) | 服务端 | 创建weather组件 | +| [CreateActorCollidableComponent](#createactorcollidablecomponent) | 客户端 | 创建actorCollidable组件 | +| [CreateActorRenderComponent](#createactorrendercomponent) | 客户端 | 创建actorRender组件 | +| [CreateCustomAudioComponent](#createcustomaudiocomponent) | 客户端 | 创建customAudio组件 | +| [CreateBrightnessComponent](#createbrightnesscomponent) | 客户端 | 创建brightness组件 | +| [SetEntityBrightness](#setentitybrightness) | 客户端/服务端 | 设置实体的亮度 | +| [CreateCameraComponent](#createcameracomponent) | 客户端 | 创建camera组件 | +| [PickFacing](#pickfacing) | 客户端 | 获取准星选中的实体或者方块 | +| [CreateFogComponent](#createfogcomponent) | 客户端 | 创建fog组件 | +| [CreateFrameAniControlComponent](#createframeanicontrolcomponent) | 客户端 | 创建frameAniControl组件 | +| [SetFrameAniLoop](#setframeaniloop) | 客户端 | 设置序列帧是否循环播放,默认为否 | +| [SetFrameAniFaceCamera](#setframeanifacecamera) | 客户端 | 设置序列帧是否始终朝向摄像机,默认为是 | +| [SetFrameAniDeepTest](#setframeanideeptest) | 客户端 | 设置序列帧是否透视,默认为否 | +| [CreateFrameAniEntityBindComponent](#createframeanientitybindcomponent) | 客户端 | 创建frameAniEntityBind组件 | +| [BindFrameAniToEntity](#bindframeanitoentity) | 客户端/服务端 | 绑定entity | +| [CreateFrameAniSkeletonBindComponent](#createframeaniskeletonbindcomponent) | 客户端 | 创建frameAniSkeletonBind组件 | +| [BindFrameAniToSkeleton](#bindframeanitoskeleton) | 客户端/服务端 | 绑定骨骼模型 | +| [CreateFrameAniTransComponent](#createframeanitranscomponent) | 客户端 | 创建frameAniTrans组件 | +| [GetFrameAniPos](#getframeanipos) | 客户端 | 获取序列帧位置 | +| [GetFrameAniRot](#getframeanirot) | 客户端 | 获取序列帧的角度 | +| [GetFrameAniScale](#getframeaniscale) | 客户端 | 获取序列帧的缩放 | +| [SetFrameAniPos](#setframeanipos) | 客户端 | 设置序列帧位置 | +| [SetFrameAniRot](#setframeanirot) | 客户端 | 设置特效的角度 | +| [SetFrameAniScale](#setframeaniscale) | 客户端 | 设置序列帧的缩放 | +| [CreateHealthComponent](#createhealthcomponent) | 客户端 | 创建health组件 | +| [ShowEntityHealth](#showentityhealth) | 客户端 | 设置某个entity是否显示血条,默认为显示 | +| [CreateOperationComponent](#createoperationcomponent) | 客户端 | 创建operation组件 | +| [SetCanAll](#setcanall) | 客户端 | 同时设置SetCanMove,SetCanJump,SetCanAttack,SetCanWalkMode,SetCanPerspective,SetCanPause,SetCanChat,SetCanScreenShot,SetCanOpenInv,SetCanDrag,SetCanInair | +| [CreateDeviceComponent](#createdevicecomponent) | 客户端 | 创建device组件 | +| [CreateParticleControlComponent](#createparticlecontrolcomponent) | 客户端 | 创建particleControl组件 | +| [CreateParticleEntityBindComponent](#createparticleentitybindcomponent) | 客户端 | 创建particleEntityBind组件 | +| [BindParticleToEntity](#bindparticletoentity) | 客户端/服务端 | 粒子特效绑定entity | +| [CreateParticleSkeletonBindComponent](#createparticleskeletonbindcomponent) | 客户端 | 创建particleSkeletonBind组件 | +| [BindParticleToSkeleton](#bindparticletoskeleton) | 客户端/服务端 | 绑定粒子特效到骨骼模型 | +| [CreateParticleTransComponent](#createparticletranscomponent) | 客户端 | 创建particleTrans组件 | +| [GetParticlePos](#getparticlepos) | 客户端 | 获取特效位置 | +| [GetParticleRot](#getparticlerot) | 客户端 | 获取特效角度 | +| [SetParticlePos](#setparticlepos) | 客户端 | 设置特效位置 | +| [SetParticleRot](#setparticlerot) | 客户端/服务端 | 设置特效的角度 | +| [CreatePlayerViewComponent](#createplayerviewcomponent) | 客户端 | 创建playerView组件 | +| [GetPlayerPerspective](#getplayerperspective) | 客户端 | 获取当前的视角模式 | +| [SetPlayerPerspective](#setplayerperspective) | 客户端 | 设置视角模式 | +| [LockPlayerPerspective](#lockplayerperspective) | 客户端 | 锁定玩家的视角模式 | +| [CreateQueryVariableComponent](#createqueryvariablecomponent) | 客户端 | 创建queryVariable组件 | +| [CreateSkyRenderComponent](#createskyrendercomponent) | 客户端 | 创建skyRender组件 | +| [CreateTextBoardComponent](#createtextboardcomponent) | 客户端 | 创建textBoard组件 | +| [CreateTextNotifyClientComponent](#createtextnotifyclientcomponent) | 客户端 | 创建textNotifyClient组件 | +| [CreateConfigClientComponent](#createconfigclientcomponent) | 客户端 | 创建config组件 | +| [CreateVirtualWorldComponent](#createvirtualworldcomponent) | 客户端 | 创建virtualWorld组件实例组件 | +| [CreatePlayerAnimComponent](#createplayeranimcomponent) | 客户端 | 创建玩家动画组件 | +| [CreatePostProcessComponent](#createpostprocesscomponent) | 客户端 | 创建PostProcess组件 | + + + + +## GetEntityId + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取对象实体ID + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str或int | 实体ID或None | + + + +## ToPlayerPreset + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 强制类型转换为玩家预设 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PlayerPreset | 玩家预设或None | + + + +## ToEntityPreset + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 强制类型转换为实体预设 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | EntityPreset | 实体预设或None | + + + +## ToEffectPreset + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 强制类型转换为特效预设 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | EffectPreset | 特效预设或None | + + + +## ToBlockPreset + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 强制类型转换为方块预设 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BlockPreset | 方块预设或None | + + + +## ToUIPreset + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 强制类型转换为UI预设 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | UIPreset | UI预设或None | + + + +## GetServerSystem + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 返回当前对象可使用的服务端system + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ServerSystem | 服务端system,客户端返回空 | + + + +## GetClientSystem + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 返回当前对象可使用的客户端system + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ClientSystem | 客户端system,服务端返回空 | + + + +## GetSystem + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 返回当前对象可使用的system + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ClientSystem或ServerSystem | 返回当前对象可使用的system | + + + +## GetLevelId + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取当前对象所在的level_id + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | level_id | + + + +## CreateComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 给实体创建组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 该组件属主的实体id | + | nameSpace | str | 组件的命名空间,registerComponent的namespace | + | name | str | 组件的名字 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BaseComponent | 组件实例 | + + + +## GetMinecraftEnum + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 用于获取枚举值文档中的枚举值 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | minecraftEnum | 枚举集合类 | + +- 示例 + +```python +self.GetMinecraftEnum().GameType.Survival +``` + + + +## DestroyEntity + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 销毁实体 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 销毁的实体ID | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否销毁成功 | + + + +## CreateActionComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建action组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ActionCompServer | action组件实例 | + + + +## SetEntityAttackTarget + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置仇恨目标 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | targetId | str | 目标实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetEntityAttackTarget(entityId, targetId) +``` + + + +## ResetEntityAttackTarget + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 清除仇恨目标 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.ResetEntityAttackTarget(entityId) +``` + + + +## GetEntityAttackTarget + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取仇恨目标 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 仇恨目标的实体id | + +- 示例 + +```python +self.GetEntityAttackTarget(entityId) +``` + + + +## SetMobKnockback + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置击退的初始速度,需要考虑阻力的影响 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | xd | float | x轴方向,用來控制角度 | + | zd | float | z轴方向,用來控制角度 | + | power | float | 用来控制水平方向的初速度 | + | height | float | 竖直方向的初速度 | + | heightCap | float | 向上速度阈值,当实体本身已经有向上的速度时需要考虑这个值,用来确保最终向上的速度不会超过heightCap | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | None | 无返回值 | + +- 示例 + +```python +self.SetMobKnockback(entityId, 0.1, 0.1, 1.0, 1.0, 1.0) +``` + + + +## CreateActorLootComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建actorLoot组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ActorLootComponentServer | actorLoot组件实例 | + + + +## SpawnLootTable + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 使用生物类型模拟一次随机掉落,生成的物品与json定义的概率有关 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(int,int,int) | 掉落位置 | + | identifier | str | 实体identifier,如minecraft:guardian | + | playerKillerId | str | 玩家杀手(只能是玩家),不设置则会随机在一个玩家维度掉落 | + | damageCauseEntityId | str | 伤害来源实体Id(掉落与该实体手持物品的抢夺附魔等级有关),默认None | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功生成掉落 | + +- 备注 + - 需要在对应的player实体附近生成,否则会生成失败。对于某些特殊的生物,如minecraft:sheep,需要使用SpawnLootTableWithActor接口来模拟随机掉落。 + +- 示例 + +```python +result = self.SpawnEntityLootTable((1, 4, 5), 'minecraft:guardian') +``` + + + +## SpawnLootTableWithActor + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 使用生物实例模拟一次随机掉落,生成的物品与json定义的概率有关 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(int,int,int) | 掉落位置 | + | entityId | str | 模拟生物的生物Id | + | playerKillerId | str | 玩家杀手(只能是玩家),不设置则会随机在一个玩家维度掉落 | + | damageCauseEntityId | str | 伤害来源实体Id(掉落与该实体手持物品的抢夺附魔等级有关),默认None | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功生成掉落 | + +- 备注 + - 需要在对应的player实体附近生成,否则会生成失败 + +- 示例 + +```python +result = self.SpawnLootTableWithActor((1, 4, 5), '-335007449086') +``` + + + +## CreateActorMotionComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建actorMotion组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ActorMotionComponentServer或ActorMotionComponentClient | actorMotion组件实例 | + + + +## GetDirFromRot + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 通过旋转角度获取朝向 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | rot | tuple(float,float) | 俯仰角度及绕竖直方向的角度,单位是角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | 玩家朝向的单位向量 | + +- 示例 + +```python +direction = self.GetDirFromRot((0, 0)) +``` + + + +## SetEntityMotion + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置生物的瞬时移动方向向量,服务端只能对非玩家使用,客户端只能对本地玩家使用 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | motion | tuple(float,float,float) | 世界坐标系下的向量,该方向为世界坐标系下的向量,以x,z,y三个轴的正方向为正值,可以通过当前生物的rot组件判断目前玩家面向的方向,可在开发模式下打开F3观察数值变化。 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 使生物向准星的方向突进一段距离 +rot = self.GetEntityRot(entityId) +x, y, z = self.GetDirFromRot(rot) +self.SetMotion(entityId, (x * 5, y * 5, z * 5)) +# rot 和 世界坐标系关系 +# ^ x -90° +# | +# 180°/-180 ----------> z 0° +# | 90° +``` + + + +## GetEntityMotion + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取生物(含玩家)的瞬时移动方向向量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(int,int,int) | 瞬时移动方向向量,异常时返回None | + +- 示例 + +```python +self.GetEntityMotion(entityId) +``` + + + +## GetInputVector + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取本地玩家方向键(移动轮盘)的输入 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float) | 返回一个单位向量,向量第一项为向左的大小,第二项为向前的大小 | + +- 示例 + +```python +left, up = self.GetInputVector() +``` + + + +## LockInputVector + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 锁定本地玩家方向键(移动轮盘)的输入,可使本地玩家持续向指定方向前行,且不会再受玩家输入影响 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | inputVector | tuple(float,float) | 输入向量,第一项控制向左的大小,第二项控制向前的大小。传入(0, 0)时玩家将会被强制固定在原地,不允许移动。 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否锁定成功,True:成功 False:失败 | + +- 备注 + - 传入的向量会被转化为单位向量,因此传入(10, 0)与传入(0.1, 0)效果相同 + +- 示例 + +```python +# 使玩家向左前方持续移动 +self.LockInputVector((1, 1)) +``` + + + +## UnlockInputVector + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 解锁本地玩家方向键(移动轮盘)的输入 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否解锁成功,True:成功 False:失败 | + + + +## CreateActorOwnerComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建actorOwner组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ActorOwnerComponentServer | actorOwner组件实例 | + + + +## SetEntityOwner + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置实体的属主 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | ownerId | str | 属主实体id,为None时设置实体的属主为空 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功,True表示设置成功 | + +- 示例 + +```python +result = self.SetEntityOwner(entityId, ownerId) +``` + + + +## GetEntityOwner + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体的属主 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 实体属主id | + +- 示例 + +```python +ownerId = self.GetEntityOwner(entityId) +``` + + + +## CreateActorPushableComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建actorPushable组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ActorPushableCompServer | actorPushable组件实例 | + + + +## SetActorPushable + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置实体是否可推动 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | isPushable | int | 0:不可推动 1:可推动 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True表示设置成功 | + +- 示例 + +```python +success = self.SetActorPushable(entityId, 1) +``` + + + +## CreateAttrComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建attr组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | AttrCompServer或AttrCompClient | attr组件实例 | + + + +## IsEntityOnFire + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体是否着火 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否着火 | + +- 示例 + +```python +isOnFire = self.IsEntityOnFire(entityId) +``` + + + +## SetEntityOnFire + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置实体着火 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | seconds | int | 着火时间(单位:秒) | + | burn_damage | int | 着火状态下每秒扣的血量,不传的话默认是1 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 在水中或者雨中不会生效,着火时间受生物装备、生物的状态影响。burn_damage取值范围是0~1000,小于0将取0,大于1000将取1000 + +- 示例 + +```python +self.SetEntityOnFire(entityId, 1, 2) +``` + + + +## GetEntityAttrValue + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取属性值,包括生命值,饥饿度,移速 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | attrType | int | AttrType枚举 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 属性结果 | + +- 示例 + +```python +self.GetEntityAttrValue(entityId, self.GetMinecraftEnum().AttrType.HEALTH) +``` + + + +## GetEntityAttrMaxValue + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取属性最大值,包括生命值,饥饿度,移速 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | attrType | int | AttrType枚举 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 属性值结果 | + +- 示例 + +```python +self.GetEntityAttrMaxValue(entityId, self.GetMinecraftEnum().AttrType.HEALTH) +``` + + + +## SetEntityAttrValue + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置属性值,包括生命值,饥饿度,移速 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | attrType | int | AttrType枚举 | + | value | float | 属性值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 设置接口暂不支持 ABSORPTION + +- 示例 + +```python +self.SetEntityAttrValue(entityId, self.GetMinecraftEnum().AttrType.HEALTH, 20) +``` + + + +## SetEntityAttrMaxValue + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置属性最大值,包括生命值,饥饿度,移速 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | attrType | int | AttrType枚举 | + | value | float | 属性值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 设置的最大饱和度不能超过当前的饥饿值; 食用食物后,最大饱和度会被原版游戏机制修改 + - 设置接口暂不支持 ABSORPTION + +- 示例 + +```python +self.SetEntityAttrMaxValue(entityId, serverApi.GetMinecraftEnum().AttrType.SPEED, 0.2) +``` + + + +## SetPlayerStepHeight + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置玩家前进非跳跃状态下能上的最大台阶高度, 默认值为0.5625,1的话表示能上一个台阶 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + | stepHeight | float | 最大高度,需要大于0 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 为了避免因浮点数误差导致错误,设置的时候通常会增加1/16个方块大小,即0.0625。所以此处我们设置2.0625。游戏中默认值是0.5625,即半格高度。 + - 只对玩家生效,无法修改其它实体该属性 + - 修改后不影响跳跃逻辑及跳跃高度,并不会因此而跳到更高,因此在某些特定情况下,你可以走上方块但跳不上去。 + +- 示例 + +```python +#如果前面放置有两格高的方块,玩家按前进能直接上去,无须跳跃 +self.SetPlayerStepHeight(playerId, 2.0625) +``` + + + +## GetPlayerStepHeight + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 返回玩家前进非跳跃状态下能上的最大台阶高度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 台阶高度 | + + + +## ResetPlayerStepHeight + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 恢复引擎默认玩家前进非跳跃状态下能上的最大台阶高度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + + + +## IsEntityInLava + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 实体是否在岩浆中 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否在岩浆中,True为在岩浆中,False为不在岩浆中 | + +- 备注 + - 只能获取到本地客户端已加载的实体是否在岩浆中,若实体在其他维度或未加载(距离本地玩家太远),将获取失败 + +- 示例 + +```python +isInLava = self.isEntityInLava(entityId) +``` + + + +## IsEntityOnGround + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 实体是否触地 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否触地,True为触地,False为不触地 | + +- 备注 + - 客户端实体刚创建时引擎计算还没完成,此时获取该实体是否着地将返回默认值True,需要延迟一帧进行获取才能获取到正确的数据 + - 生物处于骑乘状态时,如玩家骑在猪身上,也视作触地 + - 只能获取到本地客户端已加载的实体是否触地,若实体在其他维度或未加载(距离本地玩家太远),将获取失败 + +- 示例 + +```python +isOnGound = self.isEntityOnGround(entityId) +``` + + + +## CreateAuxValueComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建auxValue组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | AuxValueComponentServer或AuxValueComponentClient | auxValue组件实例 | + + + +## GetEntityAuxValue + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取射出的弓箭或投掷出的药水的附加值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | auxValue | + +- 示例 + +```python +self.GetAuxValue(entityId) +``` + + + +## CreateBiomeComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建biome组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BiomeCompServer | biome组件实例 | + + + +## GetBiomeName + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取某一位置所属的生物群系信息 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(int,int,int) | 指定位置 | + | dimId | int | 维度id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 该位置所属生物群系name | + +- 备注 + - 如果在自定义群系中没有重写原版带hills_transformation,mutate_transformation组件的群系,那么这些没有被重写的相关群系获取名称可能不正确。 + +- 示例 + +```python +biomeName = self.GetBiomeName((0, 80, 0), 0) +``` + + + +## CreateBlockComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建block组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BlockCompServer | block组件实例 | + + + +## RegisterBlockPatterns + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 注册特殊方块组合 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pattern | list(str) | 方块组合位置 | + | defines | dict | 方块组合类型 | + | result_actor_name | str | 合成结果 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +pattern = [ + ' # ', + 'XXX', + ' X ' + ] +defines ={ + '#': 'minecraft:gold_block', + 'X': 'minecraft:iron_block' +} +self.RegisterBlockPatterns(pattern, defines, 'minecraft:chicken') +#该例子左中右下放铁块,上面放金块,会生成一只鸡 +``` + + + +## CreateMicroBlockResStr + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 生成微缩方块资源Json字符串 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | identifier | str | 微缩方块唯一标识 | + | start | tuple(int,int,int) | 微缩起始坐标 | + | end | tuple(int,int,int) | 微缩结束坐标 | + | colorMap | dict | 默认为None,微缩方块颜色对应表 | + | isMerge | bool | 默认为False,是否合并同类型方块 | + | icon | str | 默认为空字符串,微缩方块图标,需要定义在 terrain_texture.json 中 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 生成的微缩方块的资源字符串 | + +- 示例 + +```python +result = self.CreateMicroBlockResStr("x", (12, 60, 12), (26, 76, 26), colorMap={'minecraft:grass': [12, 22, 123, 255]}, isMerge=True, icon="micro_block_datiangou") +with open("micro_block_x.json", "w+") as f: + f.write(result) +#该例子中,方块将以 (12 60 12) 为起点,以 (26 76 26) 为终点进行微缩,最终微缩方块里所有草方块的颜色为 rgba(12,22,123,255),实际显示颜色会依据环境光照微调,物品栏里的图标为 terrain_texture.json 里 micro_block_datiangou 对应的图片。 +``` + + + +## CreateBlockEntityData + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建blockEntityData组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BlockEntityExDataCompServer | blockEntityData组件实例 | + + + +## GetCustomBlockEntityData + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 用于获取可操作某个自定义方块实体数据的对象,操作方式与dict类似 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度 | + | pos | tuple(int,int,int) | 方块所在位置 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BlockEntityData或None | 可操作该方块实体内数据的对象 | + +- 备注 + - GetBlockEntityData返回None通常是由于该方块所在区块未加载、正在退出游戏、该方块不是自定义方块或该自定义方块的json中并未配置netease:block_entity组件。
在对GetBlockEntityData返回对象进行操作前,请先判断它是否为空,否则会导致```'NoneType' object has no attribute '__getitem__'```错误。 + - 支持python基本数据类型(int/float/string/bool/dict/list),不支持tuple且**dict的key必须为字符串** + - **存储list时,list内各项的数据类型应相同,否则将存储失败**。如[True, False]可成功存储,[True, 1, 0.5]会存储失败 + - **虽然返回的对象操作与dict相似,但并不支持嵌套存储,只允许形如blockEntityData['key'] = value的直接赋值。如blockEntityData["value5"] ["v1"] = 9或blockEntityData["value6"].append(True)的操作将无法成功存储数据。** + - 存储整数时,若数值范围超过int所能表示的最大范围,将无法成功存储。建议将此类数值转为字符串进行存储。 + +- 示例 + +```python +dimension = 0 +pos = (4, 3, 2) +# GetBlockEntityData在某些情况下会返回None,对返回结果进行操作前务必先判断它是否为空 +blockEntityData = self.GetCustomBlockEntityData(dimension, pos) +# 存储数据 +# 支持存储python基本数据类型(int/float/string/bool/dict/list),不支持tuple,并且key必须为字符串 +# 存储list时,list内各项的数据类型应相同,否则将存储失败 +if blockEntityData: + blockEntityData['value1'] = 10 + blockEntityData['value2'] = 3.5 + blockEntityData['value3'] = True + blockEntityData['value4'] = "hello" + blockEntityData['value5'] = {"v1": 10, "v2": 3.5, "v3": [0,1,2]} + blockEntityData['value6'] = [True, False] +# 读取数据 +if blockEntityData: + value1 = blockEntityData['value1'] + value5 = blockEntityData['value5'] + # 不存在于方块实体中的数据将返回None + valueNone = blockEntityData['valueNone'] +``` + + + +## CreateBlockInfoComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建blockInfo组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BlockInfoComponentServer或BlockInfoComponentClient | blockInfo组件实例 | + + + +## GetBlock + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取某一位置的block + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(int,int,int) | 方块位置 | + | dimensionId | int | 方块所在维度,服务端可在对应维度的常加载区块获取方块,对客户端无效,客户端只能获取当前维度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | dict | 方块信息字典 | + +- 备注 + - 已经加载的地形才能获取方块信息,支持获取对应维度的常加载区块内方块信息 + - 对于有多种状态的方块,aux计算比较复杂,推荐使用GetBlockStates获取方块状态字典 + +- 示例 + +```python +blockDict = self.GetBlock((0, 5, 0), 0) +``` + + + +## SetBlock + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置某一位置的方块 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(int,int,int) | 方块位置 | + | blockDict | dict | 方块信息字典 | + | oldBlockHandling | int | 0:替换,1:销毁,2:保留,默认为0 | + | dimensionId | int | 方块所在维度,必需参数 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 已经加载的地形才能设置方块,支持在对应维度的常加载区块内设置方块 + - **若使用SetBlockNew接口替换含方块实体的方块,除自定义方块实体外,当替换前后方块实体类型相同时,其方块实体内数据不会发生改变。** + 例如在箱子中放置了物品,使用SetBlockNew接口将箱子方块替换为箱子方块后,新的箱子中依然保留旧箱子内的物品。
+ 要避免这种情况,中间添加一次不同方块实体类型(或不含方块实体)的方块替换即可。比如先将箱子替换为空气,再将空气替换为箱子。 + - 对于有多种状态的方块,aux计算方式比较复杂,推荐先设置完方块后再使用SetBlockStates设置方块状态字典 + +- 示例 + +```python +blockDict = { + 'name': 'minecraft:wool', + 'aux': 5 +} +self.SetBlock((0, 5, 0), blockDict, 0, 0) +``` + + + +## GetTopBlockHeight + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取当前维度某一位置最高的非空气方块的高度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(int,int) | x轴与z轴位置 | + | dimension | int | 维度id,默认为0,对客户端无效,服务端可在获取常加载区块内最高非空气方块高度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int或None | 高度。若位置上无无非空气方块返回-1。若区块未加载返回None | + +- 示例 + +```python +height = self.GetTopBlockHeight((5, 5)) +``` + + + +## GetBlockDestroyTime + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取使用物品破坏方块需要的时间 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | blockName | str | 方块标识符,格式[namespace:name:auxvalue],auxvalue默认为0 | + | itemName | str | 物品标识符,格式[namespace:name:auxvalue],auxvalue默认为0,默认为None(不使用物品) | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 需要消耗的时间 | + +- 示例 + +```python +self.GetBlockDestroyTime("minecraft:diamond_block", "minecraft:stone_pickaxe") +``` + + + +## GetBlockEntityData + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 用于获取方块(包括自定义方块)的数据,数据只读不可写 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度 | + | pos | tuple(int,int,int) | 方块所在位置 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | dict或None | 方块实体内数据的对象 | + +- 备注 + - **随着版本更迭,方块中包含的数据结构可能被微软团队调整,并且不会公告,使用该接口的开发者需注意版本更新时做好测试和兼容。数据编码为UTF-8 + 适用于:[方块实体](https://zh.minecraft.wiki/w/%E6%96%B9%E5%9D%97%E5%AE%9E%E4%BD%93) + 特殊情况:末影箱的物品信息不能通过该接口获取 + +- 示例 + +```python +blockEntityData = self.GetBlockEntityData(0, (4, 3, 2)) +``` + + + +## CreateBlockStateComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建blockState组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BlockStateComponentServer | blockState组件实例 | + + + +## GetBlockStates + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取 方块状态 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float) | 方块位置 | + | dimensionId | int | 方块所在维度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | dict | 方块状态,异常时为None | + +- 备注 + - 仅可获取到已加载区块内的方块状态,支持获取对应维度的常加载区块内方块状态 + +- 示例 + +```python +self.GetBlockStates((4,4,3), 0) +``` + + + +## SetBlockStates + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置 方块状态 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float) | 方块位置 | + | data | dict | 方块状态 | + | dimensionId | int | 方块所在维度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 备注 + - 仅可设置已加载区块内的方块状态,支持设置对应维度的常加载区块内方块状态 + +- 示例 + +```python +# 将白色羊毛设置为橙色羊毛 +pos = (4,4,3) +state = self.GetBlockStates(pos, 0) # state = { 'color': 'white' } +state['color'] = 'orange' +self.SetBlockStates(pos, state, 0) +``` + + + +## GetBlockAuxValueFromStates + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 根据方块名称和 方块状态 获取方块附加值AuxValue + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | blockName | str | 方块名称 | + | states | dict | 方块状态 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 方块附加值AuxValue,异常时为-1 | + +- 示例 + +```python +states = self.GetBlockAuxValueFromStates("minecraft:hopper", {"facing_direction": 0, "toggle_bit": 0}) +``` + + + +## GetBlockStatesFromAuxValue + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 根据方块名称和方块附加值AuxValue获取 方块状态 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | blockName | str | 方块名称 | + | auxValue | int | 方块附加值AuxValue | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | dict | 方块状态,异常时为None | + +- 示例 + +```python +states = self.GetBlockStatesFromAuxValue('minecraft:sapling', 9) +``` + + + +## CreateBlockUseEventWhiteList + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建blockUseEventWhiteList组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BlockUseEventWhiteListComponentServer或BlockUseEventWhiteListComponentClient | blockUseEventWhiteList组件实例 | + + + +## AddBlockItemListenForUseEvent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 增加blockName方块对ServerBlockUseEvent事件的脚本层监听 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | blockName | str | 方块名称,格式:namespace:name:auxvalue,其中namespace:name:*匹配所有的auxvalue | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否增加成功 | + +- 示例 + +```python +self.AddBlockItemListenForUseEvent("minecraft:nether_brick_stairs:2") +# 注意blockName格式为namespace:name:auxvalue,如果不填auxvalue,则默认为0 +# auxValue详细值详见官方wiki,如https://zh.minecraft.wiki/w/楼梯 中的‘方块数据值’ +``` + + + +## RemoveBlockItemListenForUseEvent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 移除blockName方块对ServerBlockUseEvent事件的脚本层监听 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | blockName | str | 方块名称,格式:namespace:name:auxvalue,其中namespace:name:*匹配所有的auxvalue | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否移除成功 | + +- 示例 + +```python +self.RemoveBlockItemListenForUseEvent("minecraft:nether_brick_stairs:2") +# 注意blockName格式为namespace:name:auxvalue,如果不填auxvalue,则默认为0 +# auxValue详细值详见官方wiki,如https://zh.minecraft.wiki/w/楼梯 中的‘方块数据值’ +``` + + + +## ClearAllListenForBlockUseEventItems + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 清空所有已添加方块对ServerBlockUseEvent事件的脚本层监听 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否清空成功 | + + + +## CreateBreathComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建breath组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BreathCompServer | breath组件实例 | + + + +## GetUnitBubbleAirSupply + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 单位气泡数对应的氧气储备值 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 单位气泡数对应的氧气储备值 | + + + +## GetEntityCurrentAirSupply + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 生物当前氧气储备值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 生物当前氧气储备值 | + +- 备注 + - 注意:该值返回的是当前氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数) + +- 示例 + +```python +self.GetCurrentAirSupply(entityId) +``` + + + +## GetEntityMaxAirSupply + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取生物最大氧气储备值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 最大氧气储备值 | + +- 备注 + - 注意:该值返回的是最大氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数) + +- 示例 + +```python +self.GetEntityMaxAirSupply(entityId) +``` + + + +## SetEntityCurrentAirSupply + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置生物氧气储备值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | data | int | 设置生物当前氧气值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 注意:该值设置的是当前氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数) + +- 示例 + +```python +self.SetEntityCurrentAirSupply(entityId, 300) +``` + + + +## SetEntityMaxAirSupply + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置生物最大氧气储备值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | data | int | 设置生物最大氧气值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 注意:该值设置的是最大氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数) + +- 示例 + +```python +self.SetEntityMaxAirSupply(entityId, 400) +``` + + + +## IsEntityConsumingAirSupply + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取生物当前是否在消耗氧气 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否消耗氧气 | + +- 示例 + +```python +self.IsEntityConsumingAirSupply(entityId) +``` + + + +## SetEntityRecoverTotalAirSupplyTime + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置恢复最大氧气量的时间,单位秒 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | timeSec | float | 恢复生物最大氧气值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 注意:当设置的最大氧气值小于(timeSec*10)时,生物每帧恢复氧气量的值为0 + +- 示例 + +```python +self.SetEntityRecoverTotalAirSupplyTime(entityId, 10) +``` + + + +## CreateBulletAttributesComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建bulletAttributes组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BulletAttributesComponentServer | bulletAttributes组件实例 | + + + +## GetEntitySourceId + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取抛射物发射者实体id + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 抛射物发射者实体id | + +- 示例 + +```python +self.GetEntitySourceId(entityId) +``` + + + +## CreateChestBlockComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建chestBlock组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ChestContainerCompServer | chestBlock组件实例 | + + + +## GetChestBoxSize + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取箱子容量大小 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(int,int,int) | 箱子位置 | + | dimensionId | int | 箱子所在维度,可获取对应维度的常加载区块内箱子容量 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 箱子大小,错误值-1 | + +- 示例 + +```python +self.GetChestBoxSize((x, y, z), 0) +``` + + + +## SetChestBoxItemNum + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置箱子槽位物品数目 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(int,int,int) | 箱子位置 | + | slotPos | int | 箱子槽位 | + | num | int | 物品数目 | + | dimensionId | int | 方块所在维度,可在对应维度的常加载区块设置方块 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetChestBoxItemNum((x,y,z), 0, 10, 0) +``` + + + +## SetChestBoxItemExchange + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 交换箱子里物品的槽位 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 玩家id | + | pos | tuple(int,int,int) | 箱子位置 | + | slotPos1 | int | 箱子槽位1 | + | slotPos2 | int | 箱子槽位2 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置成功返回True,失败返回False | + +- 示例 + +```python +self.SetChestBoxItemExchange(playerId, (x,y,z), 0, 1) +``` + + + +## CreateChunkSourceComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建chunkSource组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ChunkSourceCompServer或ChunkSourceCompClient | chunkSource组件实例 | + + + +## SetAddArea + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置区块的常加载 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | key | str | 常加载区域的名称 | + | dimensionId | int | 区块所在的维度 | + | minPos | tuple(int,int,int) | 加载区域的最小坐标 | + | maxPos | tuple(int,int,int) | 加载区域的最大坐标 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 备注 + - key必须唯一,若添加区域时key已存在将添加失败。 + - 该方式创建的常加载区域不会tick,即实体,方块实体,随机刻都不会进行更新。若需要区域被tick,请使用原版[tickingarea指令](https://zh.minecraft.wiki/w/%E5%91%BD%E4%BB%A4/tickingarea)。 + - 将当前未加载的区块设置为常加载区块时,不会从存档加载生物。但如果是当前已加载的区块,则玩家远离区块后,区块内的实体会一直保持加载。 + - 常加载区块内可以使用api创建实体、放置方块、放置结构、修改方块实体数据。但由于区块加载的特性,需要将操作位置的四周外延80格的区域都设置为常加载,例如需要在(0,5,0)的位置生成生物/放置方块,需要将(-80,0,-80)到(80,0,80)的区域设置为常加载。 + +- 示例 + +```python +self.SetAddArea('Area0', 0, (0,0,0), (60,0,60)) +``` + + + +## DeleteArea + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 删除一个常加载区域 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | key | str | 常加载区域的名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 删除是否成功 | + +- 示例 + +```python +self.DeleteArea('Area0') +``` + + + +## DeleteAllArea + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 删除所有常加载区域 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 删除的区域数目,错误时为None | + + + +## GetAllAreaKeys + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取所有常加载区域名称列表 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(str) | 名称列表list | + + + +## CheckChunkState + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 判断指定位置的chunk是否加载完成 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | chunk所在维度 | + | pos | tuple(int,int,int) | 指定位置的坐标 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 加载是否完成 | + +- 示例 + +```python +self.CheckChunkState(0, (0, 0, 0)) +``` + + + +## GetLoadedChunks + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取指定维度当前已经加载完毕的全部区块的坐标列表 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | None或list(tuple(int,int)) | 区块坐标的列表(区块坐标为(x,z)),当指定维度不存在或尚未创建时,返回None | + +- 示例 + +```python +result = self.GetLoadedChunks(0) +print "dimension {} has chunk {}".format(0, result) +``` + + + +## GetChunkEntities + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取指定位置的区块中,全部的实体和玩家的ID列表 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度 | + | pos | tuple(int,int,int) | 指定位置的坐标 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | None或list(str) | 实体和玩家的ID的列表,当指定位置的区块不存在或尚未加载时,返回None | + +- 示例 + +```python +entityList = self.GetChunkEntites(0, (0, 0, 0)) +print "GetChunkEntities entityList={}".format(entityList) +``` + + + +## GetChunkMobNum + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取某区块中的生物数量(不包括玩家,但包括盔甲架) + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 区块所在维度 | + | chunkPos | tuple(int,int) | 指定区块的坐标 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 该区块中的生物数量 | + +- 备注 + - 返回值为-1通常是由于该维度未加载、该区块未加载 + +- 示例 + +```python +mobNum = self.GetChunkMobNum(0, (1, 3)) +``` + + + +## IsChunkGenerated + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取某个区块是否生成过。 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 区块所在维度 | + | chunkPos | tuple(int,int) | 指定区块的坐标 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 该区块是否生成过 | + +- 备注 + - 玩家探索过(以玩家为中心,模拟距离(在游戏的设置页面内)为半径内的区块),或者使用SetAddArea设置常加载区块附近的区块,都是生成过的区块。这些区块会保存到存档里,再次探索时会从存档读取,不会重新生成。 + +- 示例 + +```python +# 获取主世界(10000,0,10000)坐标所在的区块是否生成过 +result = self.IsChunkGenerated(0, comp.GetChunkPosFromBlockPos((10000, 0, 10000))) +``` + + + +## CreateCollisionBoxComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建collisionBox组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | CollisionBoxComponentServer | collisionBox组件实例 | + + + +## SetEntityCollisionBoxSize + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置实体的包围盒 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | size | tuple(float,float) | 第一位表示宽度和长度,第二位表示高度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 对新生产的实体需要经过5帧之后再设置包围盒的大小才会生效 + +- 示例 + +```python +self.SetEntityCollisionBoxSize(entityId, (2,3)) +``` + + + +## GetEntityCollisionBoxSize + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体的包围盒 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float) | 包围盒大小 | + +- 示例 + +```python +self.GetEntityCollisionBoxSize(entityId) +``` + + + +## CreateCommandComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建command组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | CommandCompServer | command组件实例 | + + + +## SetCommand + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 使用游戏内指令 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | cmdStr | str | 指令 | + | playerId | str | 玩家id(可选),如果playerId不设置,则随机选择玩家 | + | showOutput | bool | 是否输出到聊天窗口:可选,默认False,如果为True的话会和聊天窗口输入原生指令一样输出返回信息。只有当该参数为True的时候会触发OnCommandOutputServerEvent与OnCommandOutputClientEvent | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 命令是否执行成功 | + +- 示例 + +```python +# 传送指令 +self.SetCommand("/tp @p 100 5 100") +``` + + + +## GetCommandPermissionLevel + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 返回设定使用/op命令时OP的权限等级(对应server.properties中的op-permission-level配置) + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 权限等级:1-OP可以绕过重生点保护;2-OP可以使用所有单人游戏作弊命令;3-OP可以使用大多数多人游戏中独有的命令;4-OP可以使用所有命令 | + +- 示例 + +```python +opLevel = self.GetCommandPermissionLevel() +print "GetCommandPermissionLevel oplevel={}".format(opLevel) +``` + + + +## SetCommandPermissionLevel + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置当玩家使用/op命令时OP的权限等级(对应server.properties中的op-permission-level配置) + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | opLevel | int | 权限等级:1-OP可以绕过重生点保护;2-OP可以使用所有单人游戏作弊命令;3-OP可以使用大多数多人游戏中独有的命令;4-OP可以使用所有命令 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 命令是否执行成功 | + +- 备注 + - 此API不会修改已经获取了op的玩家的权限等级,仅影响调用API之后才获取op的玩家,建议在游戏初始化时调用此API + +- 示例 + +```python +opLevel = 4 +suc = self.SetCommandPermissionLevel(opLevel) +print "SetCommandPermissionLevel to {} suc={}".format(opLevel, suc) +``` + + + +## GetDefaultPlayerPermissionLevel + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 返回新玩家加入时的权限身份(对应server.properties中的default-player-permission-level配置) + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 权限身份:0-Visitor;1-Member;2-Operator;3-自定义 | + +- 示例 + +```python +opLevel = self.GetDefaultPlayerPermissionLevel() +print "GetDefaultPlayerPermissionLevel oplevel={}".format(opLevel) +``` + + + +## SetDefaultPlayerPermissionLevel + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置新玩家加入时的权限身份(对应server.properties中的default-player-permission-level配置) + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | opLevel | int | 权限身份:0-Visitor;1-Member;2-Operator;3-自定义 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 命令是否执行成功 | + +- 备注 + - 此API不会修改已经加入过游戏的玩家的权限身份,仅影响调用API之后才新加入的玩家,建议在游戏初始化时调用此API + +- 示例 + +```python +opLevel = 1 +suc = self.SetDefaultPlayerPermissionLevel(opLevel) +print "SetDefaultPlayerPermissionLevel to {} suc={}".format(opLevel, suc) +``` + + + +## CreateControlAiComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建controlAi组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ControlAiCompServer | controlAi组件实例 | + + + +## SetEntityBlockControlAi + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置屏蔽生物原生AI + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | isBlock | bool | 是否保留AI,False为屏蔽 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 屏蔽AI后的生物无法行动,不受重力且不会被推动。但是可以受到伤害,也可以被玩家交互(例如马被骑或村民被交易) + +- 示例 + +```python +self.SetBlockControlAi(entityId, False) +``` + + + +## CreateDimensionComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建dimension组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | DimensionCompServer | dimension组件实例 | + + + +## GetEntityDimensionId + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体所在维度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 维度id,0-主世界; 1-下界; 2-末地; 或其他自定义维度 | + + + +## ChangeEntityDimension + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 传送玩家以外的实体 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | dimensionId | int | 维度id,0-主世界; 1-下界; 2-末地; 或其他自定义维度 | + | pos | tuple(int,int,int) | 传送的坐标,假如输入None,那么就优先选择目标维度的传送门作为目的地,其次使用维度坐标映射逻辑确定目的地 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 该接口无法对玩家使用,玩家请使用ChangePlayerDimension + +- 示例 + +```python +self.ChangeEntityDimension(entityId, 0, (0,4,0)) +``` + + + +## ChangePlayerDimension + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 传送玩家 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + | dimensionId | int | 维度,0-overWorld; 1-nether; 2-theEnd | + | pos | tuple(int,int,int) | 传送的坐标 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 该接口在成功切换维度时pos位置为玩家头的位置,即比设定位置低1.62 + +- 示例 + +```python +self.ChangePlayerDimension(playerId, 0, (0,4,0)) +``` + + + +## MirrorDimension + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 复制不同dimension的地形 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | fromId | int | 原dimensionId | + | toId | int | 目标dimensionId | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 仅复制源维度已经生成的区块信息到新的维度,对于未生成的源维度区块无法完全复制生成逻辑,可能采用部分新维度自己的信息。 + +- 示例 + +```python +self.MirrorDimension(0, 1) +``` + + + +## CreateDimension + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建新的dimension + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimensionId | int | 维度,0/1/2维度是不需要创建的。创建大于20的维度,需要在dimension_config.json中注册,注意,维度21是不可用的 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否创建成功 | + +- 备注 + - 建议在mod初始化时统一调用 + +- 示例 + +```python +self.CreateDimension(3) +``` + + + +## RegisterEntityAOIEvent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 注册感应区域,有实体进入时和离开时会有消息通知 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度id | + | name | str | 注册的感应区域名 | + | aabb | tuple(float,float,float,float,float,float) | 感应区域的坐标范围,依次为minX, minY, minZ, maxX, maxY, maxZ | + | ignoredEntities | list(str) | 忽略的实体id列表 | + | entityType | int | 期望响应的实体类型,不传则响应所有的实体类型EntityType枚举 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否注册成功 | + +- 备注 + - 注册完感应区域后,需通过监听OnEntityAreaEvent或NewOnEntityAreaEvent事件来获取感应事件 + +- 示例 + +```python +self.RegisterEntityAOIEvent(0, "test", (0, 0, 0, 1, 1, 1), None) +``` + + + +## UnRegisterEntityAOIEvent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 反注册感应区域 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度id | + | name | str | 需要反注册的感应区域名 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否注册成功 | + +- 示例 + +```python +self.UnRegisterEntityAOIEvent(0, "test") +``` + + + +## SetUseLocalTime + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 让某个维度拥有自己的局部时间规则,开启后该维度可以拥有与其他维度不同的时间与是否昼夜更替的规则 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度id | + | value | bool | 是否开启局部时间规则 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 我们对主世界以及自定义维度新增了“局部时间规则”的概念。在此之前,所有的维度会共享一个“全局时间”,即设置时间或dodaynightcycle规则时,会对所有维度生效。 + 现在,我们可以将某个维度使用局部时间规则,并且单独设置他的时间(见[SetLocalTime](#setlocaltime))与dodaynightcycle规则(见[SetLocalDoDayNightCycle](#setlocaldodaynightcycle))。 + 在下文中,我们会将使用局部时间规则的维度称为“局部维度”,而使用全局时间的维度称为“全局维度”。默认情况下,维度都是全局维度。 + 原版的time指令,gamerule dodaylightcycle指令与开启昼夜更替的设置,daylock指令与终为白日的设置,均不会对局部维度生效。 + 当世界上同时存在局部维度与全局维度时,只有以下两种情况可以睡觉来跳过黑夜: + 1. 所有玩家都在全局维度睡觉。这时会将全局时间跳到第二天早上。 + 2. 所有玩家都在同一个局部维度睡觉。这时会将该局部维度的时间跳到第二天早上。 + - 启用局部时间规则时,默认继承全局的时间与昼夜更替规则 + - 时间规则对原版的下界与末地无效,这两个维度永远为黑夜且没有昼夜更替 + - 建议统一在游戏启动时调用 + - 在pc开发包下,可以在聊天栏键入`dmtime on`或`dmtime off`来测试开启与关闭当前维度的局部时间 + +- 示例 + +```python +self.SetUseLocalTime(3, True) +``` + + + +## GetUseLocalTime + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取某个维度是否设置了使用局部时间规则 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否使用局部时间规则 | + +- 备注 + - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime) + +- 示例 + +```python +self.GetUseLocalTime(3) +``` + + + +## SetLocalTime + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置使用局部时间规则维度的时间 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度id | + | time | int | 时间,单位为帧数。表示该存档从新建起经过的时间,而非当前游戏天内的时间。mc中一个游戏天相当于现实的20分钟,即24000帧 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 游戏有天数的概念,使用时需要进行考虑。您也可以直接使用[SetLocalTimeOfDay](#setlocaltimeofday)设置一天内所在的时间而不用计算天数。 + - 只有使用局部时间规则维度才能设置 + - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime) + +- 示例 + +```python +# 获取当前的时间 +passedTime = self.GetLocalTime(3) +# 获取当前的天数 +day = passedTime / 24000 +# 设置为当天的正午 +self.SetLocalTime(3, day * 24000 + 6000) +# 设置为次日的日出 +self.SetLocalTime(3, (day + 1) * 24000 + 0) +``` + + + +## SetLocalTimeOfDay + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置使用局部时间规则维度在一天内所在的时间 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度id | + | timeOfDay | int | 时间,单位为帧数,表示游戏天内的时间,范围为0到24000。mc中一个游戏天相当于现实的20分钟,即24000帧 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 备注 + - 具体的逻辑与time指令相同,若timeOfDay比当前时间晚,则设置到当天的timeOfDay;若timeOfDay比当前时间早,则设置到次日的timeOfDay + - 在pc开发包下,可以在聊天栏键入`dmtime time `来测试设置当前维度的局部时间 + +- 示例 + +```python +# 设置为正午 +self.SetLocalTimeOfDay(3, 6000) +``` + + + +## GetLocalTime + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取维度的时间 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 时间,单位为帧数,表示该存档从新建起经过的时间,而非当前游戏天内的时间。mc中一个游戏天相当于现实的20分钟,即24000帧 | + +- 备注 + - 维度使用局部时间规则时,返回局部时间;没有使用时返回全局时间 + - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime) + +- 示例 + +```python +# 从游戏开始经过的总帧数 +passedTime = self.GetLocalTime(3) +# 当前游戏天内的帧数 +timeOfDay = passedTime % 24000 +# 从游戏开始经过的游戏天数 +day = passedTime / 24000 +``` + + + +## SetLocalDoDayNightCycle + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置使用局部时间规则的维度是否打开昼夜更替 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度id | + | value | bool | 是否打开昼夜更替 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 只有使用局部时间规则维度才能设置 + - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime) + - 在pc开发包下,可以在聊天栏键入`dmtime cycle on`或`dmtime cycle off`来测试开启与关闭当前维度的昼夜更替 + +- 示例 + +```python +self.SetLocalDoDayNightCycle(3, False) +``` + + + +## GetLocalDoDayNightCycle + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取维度是否打开昼夜更替 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 维度id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否打开昼夜更替 | + +- 备注 + - 维度使用局部时间规则时,返回维度自身的昼夜更替规则;没有使用时返回全局的昼夜更替规则 + - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime) + +- 示例 + +```python +self.GetLocalDoDayNightCycle(3) +``` + + + +## CreateEffectComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建effect组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | EffectComponentServer | effect组件实例 | + + + +## RemoveEffectFromEntity + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 为实体删除指定状态效果 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | effectName | str | 状态效果名称字符串,包括自定义状态效果和原版状态效果,原版状态效果可在wiki查询 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True表示删除成功 | + +- 示例 + +```python +res = self.RemoveEffectFromEntity(entityId, "speed") +``` + + + +## AddEffectToEntity + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 为实体添加指定状态效果,如果添加的状态已存在则有以下集中情况:1、等级大于已存在则更新状态等级及持续时间;2、状态等级相等且剩余时间duration大于已存在则刷新剩余时间;3、等级小于已存在则不做修改;4、粒子效果以新的为准 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | effectName | str | 状态效果名称字符串,包括自定义状态效果和原版状态效果,原版状态效果可在wiki查询 | + | duration | int | 状态效果持续时间,单位秒 | + | amplifier | int | 状态效果的额外等级。必须在0至255之间(含)。若未指定,默认为0。注意,状态效果的第一级(如生命恢复 I)对应为0,因此第二级状态效果,如生命回复 II,应指定强度为1。部分效果及自定义状态效果没有强度之分,如夜视 | + | showParticles | bool | 是否显示粒子效果,True显示,False不显示 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True表示设置成功 | + +- 示例 + +```python +res = self.AddEffectToEntity(entityId, "speed", 30, 2, True) +``` + + + +## GetEntityEffects + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体当前所有状态效果 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(dict) | 状态效果信息字典的list | + +- 备注 + - 状态效果信息字典 effectDict + | 关键字 | 数据类型 | 说明 | + | ----------| --------------------- | ---------| + | effectName | str | 状态效果名称 | + | duration | int | 状态效果剩余持续时间,单位秒 | + | amplifier | int | 状态效果额外等级 | + +- 示例 + +```python +effectDictList = self.GetEntityEffects(entityId) +``` + + + +## CreateEngineTypeComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建engineType组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | EngineTypeComponentServer或EngineTypeComponentClient | engineType组件实例 | + + + +## GetEntityEngineTypeStr + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体的类型名称 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 实体类型名称,如minecraft:husk | + +- 示例 + +```python +engineType = self.GetEntityEngineTypeStr(entityId) +``` + + + +## GetEntityEngineType + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体类型 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 详见EntityType枚举 | + +- 示例 + +```python +entityType = self.GetEntityEngineType(entityId) +# 以判断是否是 Mob 为例,如果要判断是否为弹射物,找到对应的类型Projectile修改即可 +if entityType & self.GetMinecraftEnum().EntityType.Mob == self.GetMinecraftEnum().EntityType.Mob: + logger.info("{} is Mod".format(self.GetEngineTypeStr(entityId))) +``` + + + +## CreateEntityEventComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建entityEvent组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | EntityEventComponentServer | entityEvent组件实例 | + + + +## TriggerEntityCustomEvent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 触发生物自定义事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 生物Id | + | eventName | str | 事件名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 触发苦力怕爆炸 + 在苦力怕的entity json文件中`events`字段下增加如下事件,然后在mod中运行示例代码: + ```json + "netease:custom_exploading":{ + "sequence": [ + { + "filters": { + "test": "has_component", + "operator": "!=", + "value": "minecraft:is_charged" + }, + "add": { + "component_groups": [ + "minecraft:forced_exploding" + ] + } + }, + { + "filters": { + "test": "has_component", + "value": "minecraft:is_charged" + }, + "add": { + "component_groups": [ + "minecraft:forced_charged_exploding" + ] + } + } + ] + } + ``` + +- 示例 + +```python +#触发entity自定义event +eventName = "netease:custom_exploading" +self.TriggerCustomEvent(entityId, eventName) +``` + + + +## CreateExtraDataComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建extraData组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id,不传则使用LevelId | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ExDataCompServer | extraData组件实例 | + + + +## GetExtraData + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体的自定义数据或者世界的自定义数据,某个键所对应的值。获取实体数据传入对应实体id + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | key | str | 自定义key | + | entityId | str或int | 实体id,不传则使用LevelId | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | any | key对应的值 | + +- 示例 + +```python +self.GetExtraData("globalMsg") +``` + + + +## SaveExtraData + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 用于保存实体的自定义数据或者世界的自定义数据 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id,不传则使用LevelId | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 保存结果 | + +- 示例 + +```python +# 保存自定义数据 +self.SaveExtraData() +``` + + + +## SetExtraData + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 用于设置实体的自定义数据或者世界的自定义数据,数据以键值对的形式保存。设置实体数据时使用对应实体id创建组件,设置世界数据时使用levelId创建组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | key | str | 自定义key | + | value | any | key对应的值,支持python基本数据类型 | + | entityId | str或int | 实体id,不传则使用LevelId | + | autoSave | bool | 默认自动保存,默认为True,如果批量设置数据,请将该参数设置为False,同时在设置数据完毕时调用SaveExtraData接口 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetExtraData("globalMsg", "helloWorld") +``` + + + +## CleanExtraData + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 清除实体的自定义数据或者世界的自定义数据,清除实体数据时使用对应实体id创建组件,清除世界数据时使用levelId创建组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | key | str | 自定义key | + | entityId | str或int | 实体id,不传则使用LevelId | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +suc = self.CleanExtraData("globalMsg") +print "CleanExtraData for level suc=%s" % suc +``` + + + +## GetWholeExtraData + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取完整的实体的自定义数据或者世界的自定义数据,获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id,不传则使用LevelId | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | dict或None | 获取指定实体或者全局的额外存储数据字典,假如没有任何额外存储数据,那么返回None或者空字典 | + +- 示例 + +```python +dataDict = self.GetWholeExtraData() +if dataDict: + for key, value in dataDict.iteritems(): + print "key=%s value=%s" % (key, str(value)) +``` + + + +## CreateExpComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建exp组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ExpComponentServer | exp组件实例 | + + + +## GetPlayerExp + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取玩家当前等级下的经验值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + | isPercent | bool | 是否为百分比 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 玩家经验值 | + +- 备注 + - 如果设置返回百分比为False,则返回玩家当前等级下经验的绝对值(非当前玩家总经验值)。 + +- 示例 + +```python +print(self.GetPlayerExp(playerId, False)) +``` + + + +## AddPlayerExp + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 增加玩家经验值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + | exp | int | 玩家经验值,可设置负数 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 备注 + - 如果设置的exp值为负数,且超过当前等级已有的经验值,调用接口后,该玩家等级不会下降但是经验值会置为最小值 + +- 示例 + +```python +self.AddPlayerExp(entityId, 25) +``` + + + +## GetPlayerTotalExp + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取玩家的总经验值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 总经验值,正整数。获取失败的情况下返回-1。 | + +- 示例 + +```python +print(self.GetPlayerTotalExp(playerId)) +``` + + + +## SetPlayerTotalExp + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置玩家的总经验值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + | exp | int | 总经验值,正整数 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 备注 + - 根据总经验值会重新计算等级,该接口可引起等级的变化 + - 内部运算采用浮点数,数值较大时会出现误差 + +- 示例 + +```python +self.SetPlayerTotalExp(playerId, 25) +``` + + + +## GetOrbExperience + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取经验球的经验 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 经验球实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 经验值,正整数。获取失败的情况下返回-1。 | + +- 示例 + +```python +print(self.GetOrbExperience(entityId)) +``` + + + +## SetOrbExperience + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置经验球经验 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 经验球实体id | + | exp | int | 经验球经验 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 备注 + - 设置经验球经验,entityId是经验球的entityId,如果经验小于等于0,拾取后不再加经验 + +- 示例 + +```python +self.SetOrbExperience(entityId, 25) +``` + + + +## CreateExperienceOrb + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建专属经验球 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | int | 专属玩家ID,只有该玩家可以拾取生成的经验球 | + | exp | int | 经验球经验 | + | position | tuple(float,float,float) | 创建的位置 | + | isSpecial | bool | 是否专属经验球 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.CreateExperienceOrb(playerId, 25, (10,10,10), False) +``` + + + +## CreateExplosionComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建explosion组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ExplosionComponentServer | explosion组件实例 | + + + +## CreateExplosion + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 用于生成爆炸 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float) | 爆炸位置 | + | radius | int | 爆炸威力,具体含义可参考[wiki](https://zh.minecraft.wiki/w/%E7%88%86%E7%82%B8)对爆炸的解释 | + | fire | bool | 是否带火 | + | breaks | bool | 是否破坏方块 | + | sourceId | str | 爆炸伤害源的实体id | + | playerId | str | 爆炸创造的实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.CreateExplosion((50,50,50),10,True,True,sourceId,playerId) +``` + + + +## CreateFeatureComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建feature组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | FeatureCompServer | feature组件实例 | + + + +## AddNeteaseFeatureWhiteList + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 添加结构对PlaceNeteaseStructureFeatureEvent事件的脚本层监听 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | structureName | str | 结构的identifier | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否增加成功 | + +- 示例 + +```python +# 注意structureName格式为floderName:structureName +self.AddNeteaseFeatureWhiteList("test:pumpkins") +``` + + + +## RemoveNeteaseFeatureWhiteList + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 移除structureName对PlaceNeteaseStructureFeatureEvent事件的脚本层监听 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | structureName | str | 结构名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否移除成功 | + +- 示例 + +```python +# 注意structureName格式为floderName:structureName +self.RemoveNeteaseFeatureWhiteList("test:pumpkins") +``` + + + +## ClearAllNeteaseFeatureWhiteList + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 清空所有已添加Netease Structure Feature对PlaceNeteaseStructureFeatureEvent事件的脚本层监听 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否清空成功 | + +- 示例 + +```python +self.ClearAllNeteaseFeatureWhiteList() +``` + + + +## LocateStructureFeature + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 与[/locate指令](https://zh.minecraft.wiki/w/%E5%91%BD%E4%BB%A4/locate)相似,用于定位原版的部分结构,如海底神殿、末地城等。 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | featureType | int | 原版的结构类型,StructureFeatureType枚举 | + | dimensionId | int | 结构所在维度,**要求该维度已加载** | + | pos | tuple(int,int,int) | 以该位置为中心来查找最近的结构 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float)或None | 最近的结构所在区块位置(x坐标,z坐标),y坐标不定,若定位失败则返回None | + +- 备注 + - 定位失败通常是由于该维度不存在、该维度未加载、该维度中不存在该结构、该结构距离传入位置过远等 + - 该接口返回值为对应结构所在区块的坐标,与结构实际生成位置可能相距一定距离 + +- 示例 + +```python +pos = self.LocateStructureFeature(self.GetMinecraftEnum().StructureFeatureType.Village, 0, (0, 64, 0)) +``` + + + +## LocateNeteaseFeatureRule + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 与[/locate指令](https://zh.minecraft.wiki/w/%E5%91%BD%E4%BB%A4/locate)相似,用于定位 网易自定义特征规则 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | ruleName | str | 特征规则名称,形式为namespace:featureRuleIdentifier,如custombiomes:overworld_pumpkins_feature_rule | + | dimensionId | int | 查找维度,**要求该维度已加载** | + | pos | tuple(int,int,int) | 以该位置为中心来查找满足网易自定义特征规则分布条件的坐标 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float)或None | 最近的满足网易自定义特征规则分布条件的坐标,定位失败则返回None | + +- 备注 + - 定位失败通常是由于传入维度不存在、维度未加载、没有满足该自定义特征规则分布条件的坐标、目标坐标距离传入位置过远(以该位置为中心,半径100个区块内无法找到)等 + - 若在feature rules中"conditions"内的"minecraft:biome_filter"中**填写了判断维度以外的过滤规则,将有概率无法定位到满足该自定义特征规则分布条件的坐标**。建议开发者在"distribution"的"iterations"中使用query.is_biome代替 + - 定位原理是根据网易自定义特征规则分布条件寻找可能的位置,因此**有可能会定位到在PlaceNeteaseStructureFeatureEvent事件中被取消生成的结构位置**。开发者应注意甄别,尽量避免对可能在PlaceNeteaseStructureFeatureEvent事件中被取消放置的结构对应特征规则文件调用定位函数 + +- 示例 + +```python +pos = self.LocateNeteaseFeatureRule("custombiomes:overworld_pumpkins_feature_rule", 0, (0, 64, 0)) +``` + + + +## CreateFlyComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建fly组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | FlyComponentServer | fly组件实例 | + + + +## IsPlayerFlying + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取玩家是否在飞行 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True:是 False:否 | + +- 示例 + +```python +self.IsPlayerFlying(playerId) +``` + + + +## ChangePlayerFlyState + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 给予/取消飞行能力,并且进入飞行/非飞行状态 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + | isFly | bool | 飞行状态,True:飞行模式,False:正常行走模式 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True:是 False:否 | + +- 示例 + +```python +self.ChangePlayerFlyState(playerId, True) +``` + + + +## CreateGameComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建game组件 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | GameComponentServer或GameComponentClient | game组件实例 | + + + +## AddBlockProtectField + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置一个方块无法被玩家/实体破坏的区域 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimensionId | int | 不可破坏区域所在维度 | + | startPos | tuple(int,int,int) | 初始位置,不可破坏区域AABB包围盒的最小点 | + | endPos | tuple(int,int,int) | 结束位置,不可破坏区域AABB包围盒的最大点 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 成功时返回区域的唯一ID,可用于取消不可破坏区域,失败时返回-1 | + +- 示例 + +```python +field = self.AddBlockProtectField(0, (-20, 0, -20), (20, 255, 20)) +if field > 0: + print "AddBlockProtectField success field={}".format(field) +else: + print "AddBlockProtectField fail" +``` + + + +## RemoveBlockProtectField + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 取消一个方块无法被玩家/实体破坏的区域 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | field | int | 不可破坏区域的唯一ID,AddBlockProtectField的返回值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | success True为取消成功,False为取消失败 | + + + +## CleanBlockProtectField + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 取消全部已设置的方块无法被玩家/实体破坏的区域 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | success True为取消成功,False为取消失败 | + + + +## KillEntity + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 杀死某个Entity + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 要杀死的目标的entityId | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否杀死成功 | + +- 示例 + +```python +self.KillEntity(entityId) +``` + + + +## CreateEngineEntityByTypeStr + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建指定identifier的实体 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | engineTypeStr | str | 实体identifier,例如'minecraft:husk' | + | pos | tuple(float,float,float) | 生成坐标 | + | rot | tuple(float,float) | (上下角度,左右角度)实体水平方向的俯仰角度和竖直方向的旋转角度,单位是角度而不是弧度。MC坐标系说明 | + | dimensionId | int | 生成的维度,默认值为0(0为主世界,1为地狱,2为末地) | + | isNpc | bool | 是否为npc,默认值为False。npc不会移动、转向、存盘。 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str或None | 实体Id或者None | + +- 备注 + - 在未加载的chunk无法创建 + 生成村民请使用"minecraft:villager_v2" + +- 示例 + +```python +self.CreateEngineEntityByTypeStr('minecraft:husk', (0, 5, 0), (0, 0), 0) +``` + + + +## PlaceStructure + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 放置结构 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float) | 放置结构的位置 | + | structureName | str | 结构名称 | + | dimensionId | int | 希望放置结构的维度,可在对应维度的常加载区块放置结构,默认为-1 | + | rotation | int | 放置结构的旋转角度,默认为0(只可旋转90,180,270度) | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否放置成功,True为放置成功,False为放置失败 | + +- 备注 + - 放置时需要确保所放置的区块都已加载,否则会放置失败或者部分缺失 + - 该接口是同步执行的,请勿在一帧内放置大量结构,会造成游戏卡顿 + +- 示例 + +```python +self.PlaceStructure((100, 70, 100), "test:structureName", 0) +``` + + + +## AddTimer + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 添加定时器,非重复 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | delay | float | 延迟时间,单位秒 | + | func | function | 定时器触发函数 | + | *args | any | 变长参数,可以不设置 | + | **kwargs | any | 字典变长参数,可以不设置 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | CallLater | 返回单次触发的定时器实例 | + + + +## AddRepeatedTimer + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 添加服务端触发的定时器,重复执行 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | delay | float | 延迟时间,单位秒 | + | func | function | 定时器触发函数 | + | *args | any | 变长参数,可以不设置 | + | **kwargs | any | 字典变长参数,可以不设置 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | CallLater | 返回触发的定时器实例 | + + + +## CancelTimer + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 取消定时器 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | timer | CallLater | AddTimer和AddRepeatedTimer时返回的定时器实例 | + +- 返回值 + + 无 + + + +## GetEntitiesInArea + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取区域内的entity列表 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | startPos | tuple(int,int,int) | 初始位置 | + | endPos | tuple(int,int,int) | 结束位置 | + | dimensionId | int | 区域所在维度,仅服务端有效,可获取对应维度的常加载区块内的实体列表 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(str) | 返回entityId的list | + +- 示例 + +```python +self.GetEntitiesInSquareArea((0,0,0), (100,100,100), 0) +``` + + + +## GetEntitiesAround + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取区域内的entity列表 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 某个entityId | + | radius | int | 正方体区域半径 | + | filters | dict | 过滤设置字典 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(str) | 返回entityId的list | + +- 示例 + +```python +#利用过滤器获取玩家身边的entity +#样例中的过滤器表示满足“是玩家”或者“没有头戴南瓜帽”的entity +filters = { + "any_of": [ + { + "subject" : "other", + "test" : "is_family", + "value" : "player" + }, + { + "test" : "has_equipment", + "domain": "head", + "subject" : "other", + "operator" : "not", + "value" : "carved_pumpkin" + } + ] +} +self.GetEntitiesAround(entityId, 100, filters) +``` + + + +## ShowHealthBar + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置是否显示血条 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | show | bool | True为显示。开启后可用health组件单独设置某个实体的血条颜色及是否显示 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.ShowHealthBar(True) +``` + + + +## SetNameDeeptest + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置名字是否透视 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | deeptest | bool | True为不透视。默认情况下为透视 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 设置为不透视 +self.SetNameDeeptest(True) +``` + + + +## GetScreenSize + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取游戏分辨率 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float) | 宽高(像素) | + +- 示例 + +```python +width, height = self.GetScreenSize() +``` + + + +## SetRenderLocalPlayer + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置本地玩家是否渲染 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | render | bool | True为渲染 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 不渲染本地玩家 +self.SetRenderLocalPlayer(False) +``` + + + +## AddPickBlacklist + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 添加使用camera组件选取实体时的黑名单,即该实体不会被选取到 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 添加黑名单 +self.AddPickBlacklist(entityId) +``` + + + +## ClearPickBlacklist + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 清除使用camera组件选取实体的黑名单 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 清除黑名单中所有实体 +self.ClearPickBlacklist() +``` + + + +## CheckWordsValid + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 检查语句是否合法,即不包含敏感词 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | words | str | 语句 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True:语句合法
False:语句非法 | + +- 示例 + +```python +isValid = self.CheckWordsValid("creeper? Aww man") +``` + + + +## CheckNameValid + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 检查昵称是否合法,即不包含敏感词 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 昵称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True:昵称合法 False:昵称非法 | + +- 示例 + +```python +isValid = self.CheckNameValid("史蒂夫") +``` + + + +## GetScreenViewInfo + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取游戏视角信息。分辨率为1313,618时,画布是376,250的2倍,所以viewport得到的是1313 + (2-(1313%2)),y值类似,可参考 《我的世界》界面适配方法 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float,float) | 依次为宽、高、x偏移、y偏移 | + +- 示例 + +```python +width, height, offsetX, offsetY= self.GetScreenViewInfo() +``` + + + +## SimulateTouchWithMouse + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 模拟使用鼠标控制UI(PC F11快捷键) + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | touch | bool | True:进入鼠标模式,False:退出鼠标模式 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 模拟结果 | + +- 示例 + +```python +self.SimulateTouchWithMouse(True) +``` + + + +## GetCurrentDimension + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取客户端当前维度 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 维度id。客户端未登录完成或正在切维度时返回-1 | + +- 示例 + +```python +dimId = self.GetCurrentDimension() +``` + + + +## GetChinese + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取langStr对应的中文,可参考PC开发包中\handheld\bed-loc\handheld\data\resource_packs\vanilla\texts\zh_CN.lang + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | langStr | str | 传入的langStr | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | langStr对应的中文,若找不到对应的中文,则会返回langStr本身 | + +- 示例 + +```python +# 获取"entity.wolf.name"对应的中文("狼") +Chinese = self.GetChinese("entity.wolf.name") +``` + + + +## SetDisableHunger + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置是否屏蔽饥饿度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | isDisable | bool | 是否屏蔽饥饿度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 备注 + - 如需隐藏饥饿度请使用extraClientApi的HideHungerGui + +- 示例 + +```python +self.SetDisableHunger(True) +``` + + + +## SetOneTipMessage + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 在具体某个玩家的物品栏上方弹出tip类型通知,位置位于popup类型通知上方,此功能更建议在客户端使用game组件的对应接口SetTipMessage + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 具体玩家Id | + | message | str | 消息内容,可以在消息前增加extraServerApi.GenerateColor("RED")字符来设置颜色,具体参考样例 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# playerId 变量改为具体的玩家Id +self.SetOneTipMessage(playerId, serverApi.GenerateColor("RED") + "tip提示") +``` + + + +## SetPopupNotice + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 在物品栏上方弹出popup类型通知,位置位于tip类型消息下方,服务端调用是针对全体玩家,客户端调用只影响本地玩家 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | message | str | 消息内容,可以在消息前增加extraClientApi.GenerateColor("RED")字符来设置颜色,具体参考样例 | + | subtitle | str | 消息子标题内容,效果同message,也可设置颜色,位置位于message上方 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.SetPopupNotice(clientApi.GenerateColor("RED") + "消息通知", "消息子标题") +``` + + + +## SetTipMessage + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 在物品栏上方弹出tip类型通知,位置位于popup类型通知上方,服务端调用是针对全体玩家,客户端调用只影响本地玩家 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | message | str | 消息内容,可以在消息前增加extraServerApi.GenerateColor("RED")字符来设置颜色,具体参考样例 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.SetTipMessage(serverApi.GenerateColor("RED") + "tip提示") +``` + + + +## SetNotifyMsg + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置消息通知 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | msg | str | 消息内容 | + | color | str | ColorCode,默认为白色 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.SetNotifyMsg("消息通知", self.GetMinecraftEnum().ColorCode.BLUE)) +``` + + + +## GetPlayerGameType + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取指定玩家的游戏模式 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 玩家id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | GameType枚举 | + +- 示例 + +```python +gameType = self.GetPlayerGameType(playerId) +``` + + + +## HasEntity + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 判断 entity 是否存在 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 0表示不存在,1表示存在 | + +- 示例 + +```python +exist = self.HasEntity(entityId) +``` + + + +## IsEntityAlive + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 判断生物实体是否存活或非生物实体是否存在 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | false表示生物实体已死亡或非生物实体已销毁,true表示生物实体存活或非生物实体存在 | + +- 备注 + - 注意,如果检测的实体所在的区块被卸载,则该接口返回False。因此,需要注意实体所在的区块是否被加载。 + - 区块卸载:游戏只会加载玩家周围的区块,玩家移动到别的区域时,原来所在区域的区块会被卸载,参考[区块介绍](https://zh.minecraft.wiki/w/%E5%8C%BA%E5%9D%97) + +- 示例 + +```python +alive = self.IsEntityAlive(entityId) +``` + + + +## CreateGravityComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建gravity组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | GravityComponentServer | gravity组件实例 | + + + +## GetEntityGravity + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体的重力因子,当生物重力因子为0时则应用世界的重力因子 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 重力因子 | + +- 示例 + +```python +self.GetEntityGravity(entityId) +``` + + + +## SetEntityGravity + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置实体的重力因子,当生物重力因子为0时则应用世界的重力因子 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | gravity | float | 负数,表示每帧向下的速度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetEntityGravity(entityId, -0.08) +``` + + + +## CreateHurtComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建hurt组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | HurtCompServer | hurt组件实例 | + + + +## SetHurtByEntity + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 对实体造成伤害 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | attackerId | str | 伤害来源的实体id | + | damage | int | 伤害值 | + | byPassArmor | bool | 是否忽略护甲 | + | knocked | bool | 实体是否被击退,可缺损,缺损时默认值为True | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + + + +## SetHurtByEntityNew + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 对实体造成伤害 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | damage | int | 伤害值 | + | cause | str | 伤害来源,详见Minecraft枚举值文档的ActorDamageCause枚举 | + | attackerId | str | 伤害来源的实体id,默认为None | + | childAttackerId | str | 伤害来源的子实体id,默认为None,比如玩家使用抛射物对实体造成伤害,该值应为抛射物Id | + | knocked | bool | 实体是否被击退,默认值为True | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + + + +## SetEntityImmuneDamage + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置实体是否免疫伤害(该属性存档) + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | immune | bool | 是否免疫伤害 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetEntityImmuneDamage(entityId, True) +``` + + + +## CreateItemBannedComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建itembanned组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ItemBannedCompServer | itembanned组件实例 | + + + +## AddBannedItem + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 增加禁用物品 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | itemName | str | 物品标识符,格式[namespace:name:auxvalue],auxvalue默认为0,auxvalue为*时候匹配任意auxvalue值。例如:minecraft:egg(也可以通过填写配置文件config/banned_items.json进行启动禁用) | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否增加成功 | + +- 示例 + +```python +self.AddBannedItem("minecraft:egg") +``` + + + +## GetBannedItemList + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取禁用物品列表 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(str)或None | 禁用物品列表或者None(异常情况),list元素为物品标识符,格式[namespace:name:auxvalue],auxvalue默认为0,auxvalue为*时候匹配任意auxvalue值。 | + + + +## RemoveBannedItem + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 移除禁用物品 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | itemName | str | 物品标识符,格式[namespace:name:auxvalue],auxvalue默认为0,auxvalue为*时候匹配任意auxvalue值。 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否移除成功 | + +- 示例 + +```python +self.RemoveBannedItem("minecraft:stained_glass:2") +``` + + + +## ClearBannedItems + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 清空禁用物品 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否清空成功 | + + + +## CreateItemComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建item组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ItemCompServer或ItemCompClient | item组件实例 | + + + +## GetItemBasicInfo + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取物品的基础信息 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | itemName | str | item的identifier | + | auxValue | int | 物品的附加值auxvalue,默认为0 | + | isEnchanted | bool | 是否附魔,默认为False。用于返回的idAux | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | dict | 基础信息字典,见备注 | + +- 备注 + - auxValue默认值是0,可以不设置。如果物品不存在,返回值为None + | 关键字 | 数据类型 | 说明 | + | ----------| --------------------- | ---------| + | itemName | str | 本地化的物品名字 | + | maxStackSize |int| 物品最大堆叠数目 | + | maxDurability |int| 物品最大耐久值 | + | idAux |int| 主要用于客户端的ui绑定,详见客户端接口 | + | tierDict |dict| 自定义方块定义的挖掘相关的属性 netease:tier,没有设置时返回None | + | itemCategory |str| 创造栏分类 | + | itemType |str| 物品类型 | + | itemTierLevel |int| 工具等级 | + - 自定义物品的itemCategory值为json文件中的category字段值,客户端读取resource包的json文件,服务端读取behavior包中的json文件,两个json文件中的category字段需要保持一致,否则会报错 + - 创造栏分类说明 + | 创造栏分类 | 意义 | + | --------- | -----| + | construction | 建筑 | + | nature | 自然 | + | equipment | 装备 | + | items | 物品 | + | custom | 自定义 | + | 空字符串 | 不在创造栏 | + - 物品类型,值为空字符串或者下列类型名之一: + | 类型名 | 意义 | + | ----- | ----- | + | book | 书 | + | sword | 剑 | + | shears | 剪刀 | + | axe | 斧头 | + | clock | 时钟 | + | bucket | 桶 | + | fishing_rod | 钓鱼竿 | + | hoe | 锄头 | + | shovel | 锹 | + | pickaxe | 镐 | + | dye | 骨粉 | + - 工具等级代表不同的材质,没有工具等级时为值-1,工具等级与材质对应关系如下 + | 工具等级 | 材质 | + | ------- | ---- | + | 0 | 木制/金制工具 | + | 1 | 石制工具 | + | 2 | 铁制工具 | + | 3 | 钻石工具 | + +- 示例 + +```python +self.GetItemBasicInfo("minecraft:bow") +``` + + + +## GetLocalPlayerId + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取本地玩家的id + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 客户端玩家Id | + + + +## ClearPlayerOffHand + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 清除玩家左手物品 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 玩家id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.ClearPlayerOffHand(playerId) +``` + + + +## GetPlayerItem + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取玩家物品,支持获取背包,盔甲栏,副手以及主手物品 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 玩家ID | + | posType | int | ItemPosType枚举 | + | slotPos | int | 槽位,获取INVENTORY及ARMOR时需要设置,其他情况写0即可 | + | getUserData | bool | 是否获取userData,默认为False | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | dict | 物品信息字典 ,没有物品则返回None | + +- 示例 + +```python +self.GetPlayerItem(playerId, self.GetMinecraftEnum().ItemPosType.INVENTORY, 0) +``` + + + +## ChangePlayerItemTipsAndExtraId + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 修改玩家物品的自定义tips和自定义标识符 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 玩家ID | + | posType | int | ItemPosType枚举 | + | slotPos | int | 箱子槽位 | + | customTips | str | 物品的自定义tips | + | extraId | str | 物品的自定义标识符 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.ChangePlayerItemTipsAndExtraId(playerId, self.GetMinecraftEnum().ItemPosType.INVENTORY, 0, "自定义tips", "自定义标识符") +``` + + + +## AddEnchantToInvItem + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 给物品栏的物品添加附魔信息 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 玩家ID | + | slotPos | int | 物品栏槽位 | + | enchantType | int | 附魔类型,可以查看枚举值文档 | + | level | int | 附魔等级 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.AddEnchantToInvItem(playerId, 0, serverApi.GetMinecraftEnum().EnchantType.BowDamage, 2) +``` + + + +## GetInvItemEnchantData + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取物品栏的物品附魔信息 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 玩家ID | + | slotPos | int | 物品栏槽位 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(tuple(int,int)) | list中每个tuple由附魔类型(EnchantType枚举)和附魔等级组成。没有附魔则为空list | + +- 示例 + +```python +self.GetInvItemEnchantData(playerId, 0) +``` + + + +## GetOffhandItem + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取左手物品的信息 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 玩家ID | + | getUserData | bool | 是否获取物品的userData,默认为False | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | dict | 物品信息字典 ,没有物品则返回None | + +- 示例 + +```python +offhandData = self.GetOffhandItem(entityId) +``` + + + +## SetInvItemNum + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置玩家背包物品数目 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 玩家ID | + | slotPos | int | 物品栏槽位 | + | num | int | 物品数目,可以通过设置数量为0来达到清除背包物品的效果 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetInvItemNum(playerId, 0, 10) +``` + + + +## SpawnItemToLevel + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 生成物品掉落物,如果需要获取物品的entityId,可以调用服务端系统接口CreateEngineItemEntity + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | itemDict | dict | 物品信息字典 | + | dimensionId | int | 设置dimension | + | pos | tuple(float,float,float) | 生成位置 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +itemDict = { + 'itemName': 'minecraft:bow', + 'count': 1, + 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),], + 'auxValue': 0, + 'customTips':'§c new item §r', + 'extraId': 'abc', + 'userData': {}, +} +self.SpawnItemToLevel(itemDict, 0, (0,80,20)) +# 当最大生成数量为 1 时,可以继续调用生成 2 个物品 +self.SpawnItemToLevel(itemDict, 0, (0,80,20)) +``` + + + +## SpawnItemToPlayerInv + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 生成物品到玩家背包 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | itemDict | dict | 物品信息字典 | + | playerId | str | 玩家id | + | slotPos | int | 背包槽位(可选) | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 当slotPos不设置时,当设置的数量超过单个槽位堆叠的上限时,会将多余的物品设置到另外的空闲槽位.如果生成的物品与背包中有的槽位的物品种类一致,该接口也会将物品增加到这些槽位中。注意:如果背包中剩余的物品数目和增加的物品数目之和大于64,则会生成物品数目到64,但是接口返回失败。 + +- 示例 + +```python +itemDict = { + 'itemName': 'minecraft:bow', + 'count': 1, + 'enchantData': [(self.GetMinecraftEnum().EnchantType.BowDamage, 1),], + 'auxValue': 0, + 'customTips':'§c new item §r', + 'extraId': 'abc', + 'userData': { }, +} +self.SpawnItemToPlayerInv(itemDict, playerId, 0) +``` + + + +## SpawnItemToPlayerCarried + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 生成物品到玩家右手 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | itemDict | dict | 物品信息字典 | + | playerId | str | 玩家id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +itemDict = { + 'itemName': 'minecraft:bow', + 'count': 1, + 'enchantData': [(self.GetMinecraftEnum().EnchantType.BowDamage, 1),], + 'auxValue': 0, + 'customTips':'§c new item §r', + 'extraId': 'abc', + 'userData': { }, +} +self.SpawnItemToPlayerCarried(itemDict, playerId) +``` + + + +## GetCarriedItem + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取右手物品的信息 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | getUserData | bool | 是否获取物品的userData,默认为False | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | dict | 物品信息字典 ,没有物品则返回None | + + + +## GetSlotId + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取当前手持的快捷栏的槽id + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 0到8 | + +- 示例 + +```python +slotId = self.GetSlotId() +``` + + + +## GetItemFormattedHoverText + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取物品的格式化hover文本,如:§f灾厄旗帜§r + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | itemName | str | item的identifier | + | auxValue | int | 物品的附加值auxValue,默认为不指定auxValue(0) | + | showCategory | bool | 是否包括item的类别信息,默认False | + | userData | dict | 物品userData,默认为None | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 物品的格式化hover文本 | + +- 示例 + +```python +# 灾厄旗帜 +self.GetItemFormattedHoverText("minecraft:banner", 15, True, {'Type': 1}) +``` + + + +## GetItemHoverName + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取物品的hover名称,如:灾厄旗帜§r + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | itemName | str | item的identifier | + | auxValue | int | 物品的附加值auxValue,默认为不指定auxValue(0) | + | userData | dict | 物品userData,默认为None | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 物品hover名称 | + +- 示例 + +```python +# 灾厄旗帜 +self.GetItemHoverName("minecraft:banner", 15, {'Type': 1}) +``` + + + +## GetItemEffectName + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取物品的状态描述,如:§7保护 0§r + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | itemName | str | item的identifier | + | auxValue | int | 物品的附加值auxValue,默认为不指定auxValue(0) | + | userData | dict | 物品userData,默认为None | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 物品的状态描述 | + +- 示例 + +```python +# 灾厄旗帜 +self.GetItemEffectName("minecraft:banner", 15, {'Type': 1}) +``` + + + +## GetUserDataInEvent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 使物品相关客户端事件的 物品信息字典 参数带有userData。在mod初始化时调用即可 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | eventName | str | 引擎事件名 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +# 这样调用之后,ActorAcquiredItemClientEvent事件的itemDict参数会带有userData字段 +self.GetUserDataInEvent("ActorAcquiredItemClientEvent") +``` + + + +## ChangeItemTexture + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 替换物品的贴图,修改后所有用到该贴图的物品都会被改变,后续创建的此类物品也会被改变。会同时修改物品在UI界面上的显示,手持时候的显示与场景掉落的显示。 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | identifier | str | 物品标识符,格式[namespace:name:auxvalue],auxvalue默认为0 | + | texturePath | str | 贴图路径 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否修改成功(因为采用延迟加载,此处返回成功不代表贴图路径正确,路径错误会导致渲染时贴图丢失显示异常) | + +- 备注 + - 因为会同时修改用到此贴图的所有物品,所以使用的时候尽量谨慎,不建议改原版的物品,建议只用于修改用到自已定义的新贴图的物品。 + - 序列帧贴图物品暂不支持动态修改贴图 + - 部分物品有特殊逻辑无法修改:箱子,旗帜,生物头颅,盾牌,三叉戟,鱼杆 + +- 示例 + +```python +print(self.ChangeItemTexture("mytool:hatchet_1:0", "textures/items/hatchet_1")) +``` + + + +## CreateLvComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建lv组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | LevelComponentServer | lv组件实例 | + + + +## GetPlayerLevel + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取玩家等级 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 玩家等级 | + +- 示例 + +```python +self.GetPlayerLevel(playerId) +``` + + + +## AddPlayerLevel + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 修改玩家等级 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + | level | int | 玩家等级,可设置负数 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.AddPlayerLevel(playerId, 2) +``` + + + +## CreateMobSpawnComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建mobSpawn组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | MobSpawnComponentServer | mobSpawn组件实例 | + + + +## SpawnCustomModule + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置自定义刷怪 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | biomeType | int | BiomeType枚举 | + | change | int | Change枚举 | + | entityType | int | EntityType枚举 | + | probability | int | 生成的权重[1, 10] | + | minCount | int | 最小生成数量[0, 10] | + | maxCount | int | 最大生成数量[0, 10] | + | environment | int | 1:生成在表面;2:生成在水里 | + | minBrightness | int | 生成该生物时的最小光照[1, 15],不设置时使用默认值 | + | maxBrightness | int | 生成该生物时的最大光照[1, 15],不设置时使用默认值 | + | minHeight | int | 生成该生物时最小的海拔高度[0, 256],不设置时使用默认值 | + | maxHeight | int | 生成该生物时最大的海拔高度[0, 256],不设置时使用默认值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SpawnCustomModule(BiomeType.river,Change.Add,EntityType.Dolphin,10,1,10,2) +``` + + + +## CreateModAttrComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建modAttr组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ModAttrComponentServer或ModAttrComponentClient | modAttr组件实例 | + + + +## SetEntityModAttr + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置属性值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | paramName | str | 属性名称,str的名称建议以mod命名为前缀,避免多个mod之间冲突 | + | paramValue | any | 属性值,支持python基础数据 | + +- 返回值 + + 无 + +- 备注 + - 注意:tuple、set在同步时会转成list。建议优先使用数字和字符串等非集合类型。 + +- 示例 + +```python +self.SetEntityModAttr(entityId, 'health', 1) +self.SetEntityModAttr(entityId, 'testDict', {'key':'value'}) +``` + + + +## GetEntityModAttr + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取属性值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | paramName | str | 属性名称,str的名称建议以mod命名为前缀,避免多个mod之间冲突 | + | defaultValue | any | 属性默认值,属性不存在时返回该默认值,此时属性值依然未设置 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | any | 返回属性值 | + +- 备注 + - defaultValue不传的时候默认为None + +- 示例 + +```python +# 如果直接修改GetAttr出来的集合类型,需要重新调用一遍SetAttr确保有进行更新 +testDict = self.GetEntityModAttr(entityId, 'testDict') +testDict['key'] = 'newValue' +self.SetEntityModAttr(entityId, 'testDict', testDict) +``` + + + +## RegisterEntityModAttrUpdateFunc + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 注册属性值变换时的回调函数,当属性变化时会调用该函数 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | paramName | str | 监听的属性名称 | + | func | function | 监听的回调函数 | + +- 返回值 + + 无 + +- 备注 + - 回调函数需要接受一个参数,参数是dict,具体数据示例:{'oldValue': 0, 'newValue': 1, 'entityId': ’-433231231231‘} + +- 示例 + +```python +# 这个entityId传的是所需要监听的对象的Id +self.RegisterEntityModAttrUpdateFunc(entityId, 'health', self.jumpingText) +# 当脚本层的health属性变化时则会调用self.jumpingText +def jumpingText(self, data): + entityId = data['entityId'] + oldValue = data['oldValue'] + newValue = data['newValue'] +``` + + + +## UnRegisterEntityModAttrUpdateFunc + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 反注册属性值变换时的回调函数 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | paramName | str | 监听的属性名称 | + | func | function | 监听的回调函数 | + +- 返回值 + + 无 + +- 备注 + - 需要传注册时的同一个函数作为参数 + +- 示例 + +```python +self.UnRegisterEntityModAttrUpdateFunc(entityId, 'health', self.jumpingText) +``` + + + +## CreateModelComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建model组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ModelComponentServer或ModelComponentClient | model组件实例 | + + + +## SetEntityOpacity + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置生物模型的透明度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | opacity | float | 透明度值,取值范围为[0, 1],值越小越透明 | + +- 返回值 + + 无 + +- 示例 + +```python +self.SetEntityOpacity(entityId, 0.2) +``` + + + +## PlayEntityAnim + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 播放骨骼动画 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | aniName | str | 动画名称 | + | isLoop | bool | 是否循环播放 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.PlayEntityAnim(entityId, "run", True) +``` + + + +## GetEntityModelId + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取骨骼模型的Id,主要用于特效绑定骨骼模型 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 当前骨骼模型实例的id | + +- 示例 + +```python +modelId = self.GetEntityModelId(entityId) +``` + + + +## SetEntityModel + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置骨骼模型 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | modelName | str | 模型名称,值为""时重置模型 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetModel(entityId, "xuenv") +``` + + + +## ResetEntityModel + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 恢复实体为原版模型 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.ResetModel(entityId) +``` + + + +## BindModelToEntity + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 实体替换骨骼模型后,再往上其他挂接骨骼模型。 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | boneName | str | 挂接的骨骼名称 | + | modelName | str | 要挂接的骨骼模型名称 | + | offset | tuple(float,float,float) | 偏移量 | + | rot | tuple(float,float,float) | 旋转 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 挂到骨骼上的骨骼模型的Id,失败返回-1 | + +- 示例 + +```python +# 把名称为gun的骨骼模型挂接到rightHand骨骼上 +gunModelId = self.BindModelToEntity(entityId, "rightHand", "gun") +``` + + + +## UnBindModelToEntity + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 取消实体上挂接的某个骨骼模型。取消挂接后,这个modelId的模型便会销毁,无法再使用,如果是临时隐藏可以使用HideModel + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | modelId | int | 要取消挂接的骨骼模型的id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 取消挂接是否成功 | + + + +## CreateMoveToComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建moveTo组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | MoveToComponentServer | moveTo组件实例 | + + + +## SetEntityMoveSetting + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 寻路组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | pos | tuple(float,float,float) | 寻路目标位置 | + | speed | float | 移动速度 | + | maxIteration | int | 寻路算法最大迭代次数 默认200 | + | callback | function | 寻路结束回调函数 | + +- 返回值 + + 无 + +- 备注 + - 使用该接口时,需要在生物中配置有寻路的json组件。配置寻路json组件后,该接口会自动选择相应类型的寻路 + 目前支持的寻路json组件包括: + - minecraft:navigation.walk + 陆地寻路,与原版僵尸的寻路相同 + - minecraft:navigation.generic + 水陆寻路,支持陆地与水中,与原版溺尸的寻路相同 + - minecraft:navigation.climb + 陆地寻路,但是支持爬墙,与原版蜘蛛的寻路相同。这种寻路可能会被头顶方块阻挡,一直无法抵达目的地 + - minecraft:navigation.fly + 空中寻路,与原版鹦鹉的寻路相同 + 以上的寻路都需要搭配一些其他json组件(例如movement)使用,具体可以参考NavigationMod的示例 + 上面没有提到的navigation类型暂不支持,例如minecraft:navigation.float(如原版恶魂),minecraft:navigation.hover(如原版蜜蜂) + - 不同的生物拥有不同的默认最大跟随距离,若要寻路的目标点距离大于此值引擎会拒绝寻路,要修改该距离可以通过在entity的json中配置. + ```json + { + "format_version": "1.8.0", + "minecraft:entity": { + "components": { + "minecraft:follow_range": { + "value": 48, + "max": 48 + } + } + } + } + ``` + - 关于maxIteration参数 + 该参数会影响实际寻到路径的长度。若寻路算法迭代一定次数后,未寻到目标点,会返回局部最优解,即生物只会走到半路。 + + 在无大型障碍物的情况下,参数对应的参考寻路距离如下:该参数默认值200,最大值2000,请开发者根据实际情况选择。 + | maxIteration | 与目标点直线距离 | + | ------------ | ---------------- | + | 200 | 13 | + | 500 | 20 | + | 1000 | 30 | + | 2000 | 43 | + - 关于callback函数 + 该函数需要接受两个参数,第一个参数为寻路的entityId,类型str,第二个参数为寻路结果,类型int + + (玩家获取到的位置比地面会高1.62格,若以玩家位置为目标点需要先把y轴减去1.62,否则callback会一直返回1) + | 结果 | 说明 | + | ---- | ------------------------------------------------------------ | + | -3 | 寻路失败,大于跟随距离,或者对正在寻路的飞行系生物使用 | + | -2 | 寻路失败,生物没有寻路组件(指minecraft:navigation) | + | -1 | 寻路失败,参数错误,或生物不存在 | + | 0 | 寻路完成。到达设定的目标点 | + | 1 | 寻路完成,但未到达目标点(可能由于maxIteration参数偏小) | + | 2 | 寻路中断。中途遇到障碍物被阻碍 | + | 3 | 寻路中断。被生物原版寻路行为覆盖,或寻路未结束时重复调用moveTo组件 | + - demo简介: + 聊天栏输入walk/generic/climb/fly会原地生成一个使用对应navigation json组件的生物,然后跑到其他位置,再输入go,会将刚才生成的生物导航到玩家当前位置。 + 这4种示例生物的行为json可以在NavigationMod_behavior/entities目录查看。 + 4种示例生物的最大寻路距离都设置为了48格。 + +- 示例 + +```python +def myCallback(entityId, result): + if result in (-1,-2,-3): + self.LogError('[SetMoveSetting] failed') + elif result==0: + self.LogInfo('[SetMoveSetting] success') + elif result in (1,2,3): + self.LogError('[SetMoveSetting] terminated') + +self.SetMoveSetting(entityId, (x,y,z),2.0,200,myCallback) +``` + + + +## CreateMsgComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建msg组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | MsgComponentServer | msg组件实例 | + + + +## SendMsg + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 模拟玩家给所有人发送聊天栏消息 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 发送者玩家的名字 | + | msg | str | 消息内容 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - name参数需要设置玩家的名字(可通过name组件获取),如果设置的玩家名字不存在,则随机找一个玩家发出该消息 + +- 示例 + +```python +self.SendMsg("playerName","test") +``` + + + +## SendMsgToPlayer + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 模拟玩家给另一个玩家发送聊天栏消息 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | fromEntityId | str | 发送者玩家ID | + | toEntityId | str | 接受者玩家ID | + | msg | str | 消息内容 | + +- 返回值 + + 无 + +- 示例 + +```python +self.SendMsgToPlayer(fromEntityId, toEntityId, "test") +``` + + + +## NotifyOneMessage + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 给指定玩家发送聊天框消息 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 指定玩家id | + | msg | str | 消息内容 | + | color | str | 颜色样式代码字符串,可参考wiki[样式代码](https://zh.minecraft.wiki/w/%E6%A0%B7%E5%BC%8F%E4%BB%A3%E7%A0%81),默认为白色 | + +- 返回值 + + 无 + +- 示例 + +```python +self.NotifyOneMessage(playerId, "test", "§c") +``` + + + +## CreateNameComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建name组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | NameComponentServer或NameComponentClient | name组件实例 | + + + +## GetEntityName + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取生物的自定义名称,即使用命名牌或者SetName接口设置的名称 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 生物的自定义名称 | + +- 示例 + +```python +name = self.GetEntityName(entityId) +``` + + + +## SetEntityName + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 用于设置生物的自定义名称,跟原版命名牌作用相同,玩家和新版流浪商人暂不支持 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | name | str | 名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetEntityName(entityId, "new Name") +``` + + + +## SetPlayerPrefixAndSuffixName + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置玩家前缀和后缀名字 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + | prefix | str | 前缀内容 | + | prefixColor | str | 前缀内容颜色描述,可以使用GenerateColor接口传入参数 | + | suffix | str | 后缀内容 | + | suffixColor | str | 后缀内容颜色描述,可以使用GenerateColor接口传入参数 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +color = self.GetMinecraftEnum().ColorCode.RED +self.SetPlayerPrefixAndSuffixName(playerId, "红队", color, '肉盾', color) +``` + + + +## SetEntityShowName + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置生物名字是否按照默认游戏逻辑显示 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | show | bool | True为显示 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 返回是否设置成功 | + +- 备注 + - 当设置为True时,生物的名字显示遵循游戏默认的渲染逻辑,即普通生物需要中心点指向生物才显示名字,玩家则是会一直显示名字 + +- 示例 + +```python +# 不显示头上的名字 +self.SetEntityShowName(entityId, False) +``` + + + +## SetEntityAlwaysShowName + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置生物名字是否一直显示,瞄准点不指向生物时也能显示 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | show | bool | True为显示 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 返回是否设置成功 | + +- 备注 + - 该接口只对普通生物生效,对玩家设置不起作用 + +- 示例 + +```python +# 不显示头上的名字 +self.SetEntityAlwaysShowName(entityId, False) +``` + + + +## CreatePersistenceComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建persistence组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PersistenceCompServer | persistence组件实例 | + + + +## SetEntityPersistence + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置实体是否存盘 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | isPersistent | bool | True为存盘,False为不存盘 | + +- 返回值 + + 无 + +- 备注 + - 实体默认都会存盘。设置为不存盘的实体,在区块卸载与退出游戏时不会存档。 + +- 示例 + +```python +self.SetEntityPersistence(entityId, True) +``` + + + +## CreatePetComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建pet组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PetComponentServer | pet组件实例 | + + + +## DisablePet + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 关闭官方伙伴功能,单人游戏以及本地联机不支持该接口 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 关闭结果 | + + + +## EnablePet + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 启用官方伙伴功能,单人游戏以及本地联机不支持该接口 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 启用结果 | + + + +## CreatePlayerComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建player组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PlayerCompServer | player组件实例 | + + + +## EnablePlayerKeepInventory + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置玩家死亡不掉落物品 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 实体id | + | enable | bool | 是否开启“保留物品栏” | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.EnablePlayerKeepInventory(playerId, True) +``` + + + +## CreatePortalComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建portal组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PortalComponentServer | portal组件实例 | + + + +## CreatePosComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建pos组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PosComponentServer或PosComponentClient | pos组件实例 | + + + +## GetEntityPos + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | 位置信息 | + +- 备注 + - 对于非玩家,获取到的是脚底部位的位置 + - 对于玩家,如果处于行走,站立,游泳,潜行,滑翔状态,获得的位置比脚底位置高1.62;如果处于睡觉状态,获得的位置比最低位置高0.2 + + + +## GetEntityFootPos + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体脚所在的位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | 位置信息 | + + + +## SetEntityPos + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置实体位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | pos | tuple(int,int,int) | xyz值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 行为与使用tp命令一致,实体会瞬移到目标点 + - 对于所有类型的实体都是设置脚底位置,与[SetFootPos](#setfootpos)等价 + - 在床上时调用该接口会返回False + +- 示例 + +```python +self.SetEntityPos(entityId, (1,2,3)) +``` + + + +## SetEntityFootPos + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置实体脚底所在的位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | pos | tuple(float,float,float) | 实体脚所在的位置 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 行为与使用tp命令一致,实体会瞬移到目标点 + - 在床上时调用该接口会返回False + +- 示例 + +```python +self.SetEntityFootPos(entityId, (0, 4, 0)) +``` + + + +## CreateProjectileComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建projectile组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ProjectileComponentServer | projectile组件实例 | + + + +## CreateProjectileEntity + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建抛射物(直接发射) + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | spawnerId | str | 创建者Id | + | entityIdentifier | str | 创建抛射物的类别,如minecraft:snowball | + | param | dict | 默认为None,详细说明请见备注 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 创建抛射物的Id,失败时为“-1” | + +- 备注 + - param参数解释如下: + | 参数 | 类型 | 解释 | + | ----------------- | ----- | ------------------------------------------------------------ | + | position | tuple(float,float,float) | 初始位置 | + | direction | tuple(float,float,float) | 初始朝向 | + | power | float | 投掷的力量值 | + | gravity | float | 抛射物重力因子,默认为json配置中的值 | + | damage | float | 抛射物伤害值,默认为json配置中的值 | + | targetId | str | 抛射物目标(指定了target之后,会和潜影贝生物发射的跟踪导弹的那个投掷物是一个效果),默认不指定 | + | isDamageOwner | bool | 对创建者是否造成伤害,默认不造成伤害 | + +- 示例 + +```python +param = { + 'position': (1,1,1), + 'direction': (1,1,1) +} +self.CreateProjectileEntity(playerId, "minecraft:snowball", param) +``` + + + +## CreateRecipeComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建recipe组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | RecipeCompServer或RecipeCompClient | recipe组件实例 | + + + +## GetRecipeResult + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 根据配方id获取配方结果。仅支持合成配方 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | recipeId | str | 配方id,对应配方json文件中的identifier字段 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(dict) | list的元素resultDict字典见备注 | + +- 备注 + - resultDict字典内容如下 + | 关键字 | 数据类型 | 说明 | + | ----------| --------------------- | ---------| + | itemName | str | 物品名称id | + |auxValue| int | 物品附加值 | + |num| int | 物品数目 | + +- 示例 + +```python +self.GetRecipeResult(recipe1) +``` + + + +## GetRecipesByResult + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 通过输出物品查询配方所需要的输入材料 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | resultIdentifier | str | 输出物品的标识符 | + | tag | str | 对应配方json中的tags字段里面的值 | + | aux | int | 输出物品的附加值, 不传参的话默认为0 | + | maxResultNum | int | 最大输出条目数,若大于等于0时,结果超过maxResultNum,则只返回maxResultNum条。默认-1,表示返回全部 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(dict) | 返回符合条件的配方列表 | + +- 备注 + - 在获取酿造台配方时,不匹配tag标签与aux值,药水的identifier需要输入全称,例如:minecraft:potion_type:long_turtle_master,否则无法获取正确的配方。 + +- 示例 + +```python +print(self.GetRecipesByResult("minecraft:boat", "crafting_table", 4, -1)) +``` + + + +## GetRecipesByInput + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 通过输入物品查询配方 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | inputIdentifier | str | 输入物品的标识符 | + | tag | str | 对应配方json中的tags字段里面的值 | + | aux | int | 输出物品的附加值, 不传参的话默认为0 | + | maxResultNum | int | 最大输出条目数,若大于等于0时,结果超过maxResultNum,则只返回maxResultNum条。默认-1,表示返回全部 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(dict) | 返回符合条件的配方列表 | + +- 备注 + - 在获取酿造台配方时,不匹配tag标签与aux值,药水的identifier需要输入全称,例如:minecraft:potion_type:long_turtle_master,否则无法获取正确的配方。 + - 需要遍历较多数据,不建议频繁调用 + +- 示例 + +```python +print(self.GetRecipesByInput("minecraft:log", "crafting_table", 0, -1)) +``` + + + +## CreateRedStoneComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建redStone组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | RedStoneComponentServer | redStone组件实例 | + + + +## CreateRideComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建ride组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | RideCompServer | ride组件实例 | + + + +## CreateRotComponent + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建rot组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | RotComponentServer或RotComponentClient | rot组件实例 | + + + +## GetEntityRot + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体角度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float) | (上下角度,左右角度)单位是角度而不是弧度 | + + + +## SetEntityRot + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置实体的头的角度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | rot | tuple(float,float) | 俯仰角度及绕竖直方向的角度,单位是角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 备注 + - 建议只用来设置本地玩家。如果设置其他生物,会被生物自身行为覆盖。 + +- 示例 + +```python +# 设为向上仰视45度,并朝向世界z轴正方向 +self.SetEntityRot(entityId, (-45, 0)) +``` + + + +## SetEntityLookAtPos + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置非玩家的实体看向某个位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | targetPos | tuple(float,float,float) | 要看向的目标位置 | + | minTime | float | 凝视行为最短维持时间,单位为秒 | + | maxTime | float | 凝视行为最长维持时间,单位为秒,最大值为60
实际行为维持时间将在minTime和maxTime之间取随机值 | + | reject | bool | 在进行凝视行为时,是否禁止触发其他行为
True为禁止其他行为
False为允许其他行为(此时凝视行为可能表现不明显) | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功,True为成功,False为失败 | + +- 备注 + - 调用本接口会打断该生物正在进行的行为,且该生物不会立刻看向目标位置,而是逐渐看向目标位置 + - 对部分不会转向的实体调用此接口,可能会返回失败或返回成功但实际无表现 + +- 示例 + +```python +# 设置该实体看向(0,78,0)这个位置,该凝视行为最少持续2秒,最多持续3秒,凝视过程中禁止触发其他行为 +self.SetEntityLookAtPos(entityId, (0,78,0), 2, 3, True) +``` + + + +## GetBodyRot + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取实体的身体的角度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 身体绕竖直方向的角度,单位是角度,如果没有身体,返回为0 | + +- 示例 + +```python +y = self.GetBodyRot(entityId) +``` + + + +## LockLocalPlayerRot + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 在分离摄像机时,锁定本地玩家的头部角度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | lock | bool | 传入True为锁定本地玩家头部角度
传入False为解锁本地玩家头部角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True:设置成功
False:设置失败 | + +- 备注 + - 只能设置localplayer,即本地玩家自己 + - 玩家重生、切换维度时会重置头部角度 + - 锁定本地玩家头部角度时第一人称视角下可以旋转镜头,但玩家头部角度不会发生改变,下次切换到第一人称视角时镜头角度仍为锁定时的角度 + - 锁定本地玩家头部角度后,玩家划船时头部角度会尽量靠近锁定时的角度,若无法转到该角度,则会向左或向右看(视哪边距离目标角度更近而定) + +- 示例 + +```python +# 分离摄像机 +self.DepartCamera() +# 锁定本地玩家的头部角度 +self.LockLocalPlayerRot(True) +``` + + + +## SetPlayerLookAtPos + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置本地玩家看向某个位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | targetPos | tuple(float,float,float) | 要看向的目标位置 | + | pitchStep | float | 俯仰角方向旋转的角速度(每帧),最小为0.2 | + | yawStep | float | 偏航角方向旋转的角速度(每帧),最小为0.2 | + | blockInput | bool | 转向目标角度时是否屏蔽玩家操作,默认为True
True:屏蔽玩家操作,此时玩家无法转向、移动
False:不屏蔽玩家操作,此时如果玩家有移动、镜头转向操作将会打断通过本接口设置的转向 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功,True为成功,False为失败 | + +- 备注 + - 当本地玩家未与摄像机分离时,调用本接口会导致摄像机一同看向指定位置
当本地玩家与摄像机分离时,调用本接口将只改变本地玩家模型的朝向 + +- 示例 + +```python +# 设置本地玩家以0.2度每帧的俯仰角速度、1度每帧的偏航角速度看向(0,78,0)这个位置,转向过程中屏蔽玩家操作 +self.SetPlayerLookAtPos((0,78,0), 0.2, 1, True) +``` + + + +## CreateScaleComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建scale组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ScaleComponentServer | scale组件实例 | + + + +## CreateTameComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建tame组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | TameComponentServer | tame组件实例 | + + + +## CreateTimeComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建time组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | TimeComponentServer | time组件实例 | + + + +## GetTime + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取当前世界时间 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 当前时间,单位为帧数,表示该存档从新建起经过的时间,而非当前游戏天内的时间。mc中一个游戏天相当于现实的20分钟,即24000帧 | + +- 示例 + +```python +# 从游戏开始经过的总帧数 +passedTime = self.GetTime() +# 当前游戏天内的帧数 +timeOfDay = passedTime % 24000 +# 从游戏开始经过的游戏天数 +day = passedTime / 24000 +``` + + + +## CreateWeatherComponent + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建weather组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | WeatherComponentServer | weather组件实例 | + + + +## CreateActorCollidableComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建actorCollidable组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ActorCollidableCompClient | actorCollidable组件实例 | + + + +## CreateActorRenderComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建actorRender组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ActorRenderCompClient | actorRender组件实例 | + + + +## CreateCustomAudioComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建customAudio组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | AudioCustomComponentClient | customAudio组件实例 | + + + +## CreateBrightnessComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建brightness组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BrightnessCompClient | brightness组件实例 | + + + +## SetEntityBrightness + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置实体的亮度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | brightness | float | 0:纯黑
1:正常亮度
1-14:较亮甚至纯白
超过14:通常为纯白,即使数值改变也没有明显变化 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True:设置成功 False:设置失败 | + +- 备注 + - 目前只支持修改替换了骨骼模型的实体亮度,使用游戏原生模型的实体暂不予支持。 + +- 示例 + +```python +success = self.SetEntityBrightness(entityId, 0.5) +``` + + + +## CreateCameraComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建camera组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | CameraComponentClient | camera组件实例 | + + + +## PickFacing + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取准星选中的实体或者方块 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | dict | 选中目标的数据,详见备注 | + +- 备注 + - 选中目标为实体时,返回值为: + ```python + { + "type": "Entity", + "entityId": entityId + } + ``` + - 选中目标为方块时,返回值为: + ```python + { + "type": "Block", + "x": x, + "y": y, + "z": z, + "face": face + } + ``` + - 没有选中目标时,返回值为: + ```python + { + "type": "None" + } + ``` + +- 示例 + +```python +pickData = self.PickFacing() +``` + + + +## CreateFogComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建fog组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | FogCompClient | fog组件实例 | + + + +## CreateFrameAniControlComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建frameAniControl组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | frameEntityId | str或int | 序列帧实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | FrameAniControlComp | frameAniControl组件实例 | + + + +## SetFrameAniLoop + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置序列帧是否循环播放,默认为否 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | frameEntityId | str或int | 序列帧实体id | + | loop | bool | True表示循环播放 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 设置为循环播放 +self.SetFrameAniLoop(frameEntityId, True) +``` + + + +## SetFrameAniFaceCamera + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置序列帧是否始终朝向摄像机,默认为是 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | frameEntityId | str或int | 序列帧实体id | + | face | bool | True表示朝摄像机 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 设置为不始终朝摄像机 +self.SetFaceCamera(frameEntityId, False) +``` + + + +## SetFrameAniDeepTest + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置序列帧是否透视,默认为否 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | frameEntityId | str或int | 序列帧实体id | + | deepTest | bool | False表示透视,则被物体/方块阻挡时仍然能看到序列帧 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 设置为透视 +self.SetDeepTest(frameEntityId, False) +``` + + + +## CreateFrameAniEntityBindComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建frameAniEntityBind组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | FrameAniEntityBindComp | frameAniEntityBind组件实例 | + + + +## BindFrameAniToEntity + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 绑定entity + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | frameEntityId | int | 序列帧entity的ID | + | bindEntityId | str | 绑定的entity的ID | + | offset | tuple(float,float,float) | 绑定的偏移量 | + | rot | tuple(float,float,float) | 绑定的旋转角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.BindFrameAniToEntity(frameEntityId, entityId, (0, 1, 0), (0, 0, 0)) +``` + + + +## CreateFrameAniSkeletonBindComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建frameAniSkeletonBind组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | FrameAniSkeletonBindComp | frameAniSkeletonBind组件实例 | + + + +## BindFrameAniToSkeleton + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 绑定骨骼模型 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | frameEntityId | int | 序列帧entity的ID | + | modelId | int | 绑定的骨骼模型的ID(见model组件的GetModelId) | + | boneName | str | 绑定具体骨骼的名称 | + | offset | tuple(float,float,float) | 绑定的偏移量 | + | rot | tuple(float,float,float) | 绑定的旋转角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.BindFrameAniToSkeleton(frameEntityId, modelId, "root", (0, 1, 0), (0, 0, 0)) +``` + + + +## CreateFrameAniTransComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建frameAniTrans组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | FrameAniTransComp | frameAniTrans组件实例 | + + + +## GetFrameAniPos + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取序列帧位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | 位置信息 | + + + +## GetFrameAniRot + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取序列帧的角度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float) | (上下角度,左右角度)单位是角度而不是弧度 | + + + +## GetFrameAniScale + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取序列帧的缩放 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | 对于平面序列帧,第一个参数为贴图横向上的缩放,第二个参数为纵向上的缩放,第三个参数无用。对于环状序列帧,为三个坐标轴上的缩放 | + + + +## SetFrameAniPos + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置序列帧位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | pos | tuple(int,int,int) | xyz值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + + + +## SetFrameAniRot + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置特效的角度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | rot | tuple(float,float) | 俯仰角度及绕竖直方向的角度,单位是角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + + + +## SetFrameAniScale + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置序列帧的缩放 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | scale | tuple(float,float,float) | 对于平面序列帧,第一个参数为贴图横向上的缩放,第二个参数为纵向上的缩放,第三个参数无用。对于环状序列帧,为三个坐标轴上的缩放 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 横向拉伸为2倍,纵向不变 +self.SetFrameAniScale(frameEntityId, (2, 1, 1)) +``` + + + +## CreateHealthComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建health组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | HealthComponentClient | health组件实例 | + + + +## ShowEntityHealth + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置某个entity是否显示血条,默认为显示 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | show | bool | 设置是否显示 | + +- 返回值 + + 无 + +- 备注 + - 必须先设置ShowHealthBar + +- 示例 + +```python +# 设置该entity不显示血条 +self.ShowHealth(entityId, False) +``` + + + +## CreateOperationComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建operation组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | OperationCompClient | operation组件实例 | + + + +## SetCanAll + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 同时设置SetCanMove,SetCanJump,SetCanAttack,SetCanWalkMode,SetCanPerspective,SetCanPause,SetCanChat,SetCanScreenShot,SetCanOpenInv,SetCanDrag,SetCanInair + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | flag | bool | True为全部响应 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 备注 + - 要在其他属性设置之前设置,不然在all之前设置的会被覆盖掉 + +- 示例 + +```python +# 全部设置为不响应 +self.SetCanAll(False) +``` + + + +## CreateDeviceComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建device组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | DeviceCompClient | device组件实例 | + + + +## CreateParticleControlComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建particleControl组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ParticleControlComp | particleControl组件实例 | + + + +## CreateParticleEntityBindComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建particleEntityBind组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ParticleEntityBindComp | particleEntityBind组件实例 | + + + +## BindParticleToEntity + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 粒子特效绑定entity + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | particleId | int | 特效ID | + | bindEntityId | str | 绑定的entity的ID | + | offset | tuple(float,float,float) | 绑定的偏移量,相对绑定entity脚下中心 | + | rot | tuple(float,float,float) | 绑定的旋转角度 | + | correction | bool | 默认不开启,开启后可以使特效的旋转角度准确设置为参照玩家的相对角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.BindParticleToEntity(particleId, entityId, (0, 1, 0), (0, 0, 0)) +``` + + + +## CreateParticleSkeletonBindComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建particleSkeletonBind组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ParticleSkeletonBindComp | particleSkeletonBind组件实例 | + + + +## BindParticleToSkeleton + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 绑定粒子特效到骨骼模型 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | particleId | int | 特效ID | + | modelId | int | 绑定的骨骼模型的ID(见model组件的GetModelId) | + | boneName | str | 绑定具体骨骼的名称 | + | offset | tuple(float,float,float) | 绑定的偏移量 | + | rot | tuple(float,float,float) | 绑定的旋转角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.BindParticleToEntity(particleId, modelId, "root", (0, 1, 0), (0, 0, 0)) +``` + + + +## CreateParticleTransComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建particleTrans组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ParticleTransComp | particleTrans组件实例 | + + + +## GetParticlePos + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取特效位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | 位置信息 | + + + +## GetParticleRot + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取特效角度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float) | (上下角度,左右角度)单位是角度而不是弧度 | + + + +## SetParticlePos + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置特效位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | pos | tuple(int,int,int) | xyz值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + + + +## SetParticleRot + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置特效的角度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + | rot | tuple(float,float) | 俯仰角度及绕竖直方向的角度,单位是角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + + + +## CreatePlayerViewComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建playerView组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PlayerViewCompClient | playerView组件实例 | + + + +## GetPlayerPerspective + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取当前的视角模式 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 0:第一人称视角;1:第三人称视角;2:前视第三人称视角 | + +- 示例 + +```python +persp = self.GetPlayerPerspective(playerId) +``` + + + +## SetPlayerPerspective + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置视角模式 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 实体id | + | persp | int | 0:第一人称视角;1:第三人称视角;2:前视第三人称视角 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.SetPlayerPerspective(playerId, 1) +``` + + + +## LockPlayerPerspective + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 锁定玩家的视角模式 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 实体id | + | persp | int | 0:第一人称视角;1:第三人称视角;2:前视第三人称视角 其他值:解除锁定 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否锁定成功 | + +- 示例 + +```python +self.LockPlayerPerspective(playerId, 1) +``` + + + +## CreateQueryVariableComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建queryVariable组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | QueryVariableComponentClient | queryVariable组件实例 | + + + +## CreateSkyRenderComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建skyRender组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | SkyRenderCompClient | skyRender组件实例 | + + + +## CreateTextBoardComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建textBoard组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | TextBoardComponentClient | textBoard组件实例 | + + + +## CreateTextNotifyClientComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建textNotifyClient组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | TextNotifyComponet | textNotifyClient组件实例 | + + + +## CreateConfigClientComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建config组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | levelId | str | 存档Id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ConfigCompClient | config组件实例 | + + + +## CreateVirtualWorldComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建virtualWorld组件实例组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | levelId | str | 存档Id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | VirtualWorldCompClient | virtualWorld组件实例 | + + + +## CreatePlayerAnimComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建玩家动画组件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 玩家Id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PlayerAnimCompClient | 玩家动画组件实例 | + + + +## CreatePostProcessComponent + +客户端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 创建PostProcess组件 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PostProcessComponent | 后处理效果组件实例 | + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/变换对象TransformObject.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/变换对象TransformObject.md new file mode 100644 index 0000000..e1791ef --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/变换对象TransformObject.md @@ -0,0 +1,1063 @@ +--- +sidebarDepth: 1 +--- +# 变换对象TransformObject + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +GameObject <|-- TransformObject +link GameObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E6%B8%B8%E6%88%8F%E5%AF%B9%E8%B1%A1GameObject.html" +TransformObject: 变换对象 +GameObject: 游戏对象 +GameObject: (点击跳转) +``` + +- 描述 + + TransformObject(变换对象)是拥有变换属性的GameObject(游戏对象)的基类,他们在游戏世界中有着确切的位置等信息。 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 对象名称 | + | transform | Transform | 局部坐标变换 | + | dimension | Transform | 所在维度ID | + | isBroken | bool | 是否可用,当素材文件丢失,零件代码语法错误时处于不可用状态 | + | isRemoved | bool | 是否已销毁 | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [GetDimension](#getdimension) | 客户端/服务端 | 获取所在的维度 | +| [SetDimension](#setdimension) | 服务端 | 设置所在的维度 | +| [GetChildTransformObjects](#getchildtransformobjects) | 客户端/服务端 | 获取子TransformObject列表 | +| [GetTransformObjects](#gettransformobjects) | 客户端/服务端 | 获取TransformObject列表,包含自身 | +| [GetChildGameObjects](#getchildgameobjects) | 客户端/服务端 | 获取子GameObject列表 | +| [GetGameObjects](#getgameobjects) | 客户端/服务端 | 获取GameObject列表,包含自身 | +| [GetGameObjectById](#getgameobjectbyid) | 客户端/服务端 | 根据ID获取GameObject | +| [GetGameObjectByEntityId](#getgameobjectbyentityid) | 客户端/服务端 | 根据实体ID获取GameObject | +| [GetId](#getid) | 客户端/服务端 | 获取当前预设的ID | +| [GetEntityId](#getentityid) | 客户端/服务端 | 获取当前预设的实体ID | +| [GetDisplayName](#getdisplayname) | 客户端/服务端 | 获取当前预设的显示名称 | +| [GetDisplayPath](#getdisplaypath) | 客户端/服务端 | 获取当前预设到根节点的显示路径 | +| [GetLocalTransform](#getlocaltransform) | 客户端/服务端 | 获取当前预设的局部坐标变换 | +| [SetLocalTransform](#setlocaltransform) | 客户端/服务端 | 设置当前预设的局部坐标变换 | +| [GetLocalPosition](#getlocalposition) | 客户端/服务端 | 获取当前预设的局部坐标位置 | +| [SetLocalPosition](#setlocalposition) | 客户端/服务端 | 设置当前预设的局部坐标位置 | +| [GetLocalRotation](#getlocalrotation) | 客户端/服务端 | 获取当前预设的局部坐标旋转 | +| [SetLocalRotation](#setlocalrotation) | 客户端/服务端 | 设置当前预设的局部坐标旋转 | +| [GetLocalScale](#getlocalscale) | 客户端/服务端 | 获取当前预设的局部坐标缩放 | +| [SetLocalScale](#setlocalscale) | 客户端/服务端 | 设置当前预设的局部坐标缩放 | +| [GetWorldTransform](#getworldtransform) | 客户端/服务端 | 获取当前预设的世界坐标变换 | +| [GetWorldMatrix](#getworldmatrix) | 客户端/服务端 | 获取世界坐标变换矩阵 | +| [GetLocalMatrix](#getlocalmatrix) | 客户端/服务端 | 获取局部坐标变换矩阵 | +| [SetWorldTransform](#setworldtransform) | 客户端/服务端 | 设置当前预设的世界坐标变换 | +| [GetWorldPosition](#getworldposition) | 客户端/服务端 | 获取当前预设的世界坐标位置 | +| [SetWorldPosition](#setworldposition) | 客户端/服务端 | 设置当前预设的世界坐标位置 | +| [GetWorldRotation](#getworldrotation) | 客户端/服务端 | 获取当前预设的世界坐标旋转 | +| [SetWorldRotation](#setworldrotation) | 客户端/服务端 | 设置当前预设的世界坐标旋转 | +| [GetWorldScale](#getworldscale) | 客户端/服务端 | 获取当前预设的世界坐标缩放 | +| [SetWorldScale](#setworldscale) | 客户端/服务端 | 设置当前预设的世界坐标缩放 | +| [AddLocalOffset](#addlocaloffset) | 客户端/服务端 | 给局部坐标变换位置增加偏移量 | +| [AddWorldOffset](#addworldoffset) | 客户端/服务端 | 给世界坐标变换位置增加偏移量 | +| [AddLocalRotation](#addlocalrotation) | 客户端/服务端 | 给局部坐标变换旋转增加偏移量 | +| [AddWorldRotation](#addworldrotation) | 客户端/服务端 | 给世界坐标变换旋转增加偏移量 | +| [AddLocalScale](#addlocalscale) | 客户端/服务端 | 给局部坐标变换缩放增加偏移量 | +| [AddWorldScale](#addworldscale) | 客户端/服务端 | 给世界坐标变换缩放增加偏移量 | +| [AddLocalTransform](#addlocaltransform) | 客户端/服务端 | 给局部坐标变换增加偏移量 | +| [AddWorldTransform](#addworldtransform) | 客户端/服务端 | 给世界坐标变换增加偏移量 | +| [GetRootParent](#getrootparent) | 客户端/服务端 | 获取当前预设所在的根预设 | +| [GetParent](#getparent) | 客户端/服务端 | 获取当前预设的父预设 | +| [SetParent](#setparent) | 客户端/服务端 | 设置当前预设的父预设 | +| [GetManager](#getmanager) | 客户端/服务端 | 获取当前预设所在的预设管理器 | +| [Unload](#unload) | 客户端/服务端 | 卸载当前预设 | +| [Destroy](#destroy) | 客户端/服务端 | 销毁当前预设 | + + + + +## GetDimension + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取所在的维度 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 维度ID | + + + +## SetDimension + +服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 设置所在的维度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 目标维度ID | + | pos | tuple(int,int,int) | 传送的坐标,默认为空,非空时会更新该对象的世界坐标 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否真正变更了维度,如果目标维度与对象维度一致,会返回False | + + + +## GetChildTransformObjects + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取子TransformObject列表 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | recursive | bool | 是否递归查找所有子节点 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(TransformObject) | TransformObject列表 | + + + +## GetTransformObjects + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取TransformObject列表,包含自身 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | recursive | bool | 是否递归查找所有子节点 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(TransformObject) | TransformObject列表 | + + + +## GetChildGameObjects + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取子GameObject列表 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | recursive | bool | 是否递归查找所有子节点 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(GameObject) | 游戏对象列表 | + + + +## GetGameObjects + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取GameObject列表,包含自身 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | recursive | bool | 是否递归查找所有子节点 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(GameObject) | 游戏对象列表 | + + + +## GetGameObjectById + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 根据ID获取GameObject + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | GameObject | 游戏对象 | + + + +## GetGameObjectByEntityId + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 根据实体ID获取GameObject + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | GameObject | 游戏对象 | + + + +## GetId + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设的ID + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | ID | + + + +## GetEntityId + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设的实体ID + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 实体ID | + + + +## GetDisplayName + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设的显示名称 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 名称 | + + + +## GetDisplayPath + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设到根节点的显示路径 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 节点路径 | + + + +## GetLocalTransform + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设的局部坐标变换 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | Transform | 坐标变换 | + + + +## SetLocalTransform + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 设置当前预设的局部坐标变换 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | transform | Transform | 坐标变换 | + +- 返回值 + + 无 + + + +## GetLocalPosition + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设的局部坐标位置 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | (X轴位置,Y轴位置,Z轴位置) | + + + +## SetLocalPosition + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 设置当前预设的局部坐标位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float) | (X轴位置,Y轴位置,Z轴位置) | + +- 返回值 + + 无 + + + +## GetLocalRotation + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设的局部坐标旋转 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | (X轴角度,Y轴角度,Z轴角度) | + + + +## SetLocalRotation + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 设置当前预设的局部坐标旋转 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | rotation | tuple(float,float,float) | (X轴角度,Y轴角度,Z轴角度) | + +- 返回值 + + 无 + + + +## GetLocalScale + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设的局部坐标缩放 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | (X轴缩放,Y轴缩放,Z轴缩放) | + + + +## SetLocalScale + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 设置当前预设的局部坐标缩放 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | scale | tuple(float,float,float) | (X轴缩放,Y轴缩放,Z轴缩放) | + +- 返回值 + + 无 + + + +## GetWorldTransform + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设的世界坐标变换 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | Transform | 坐标变换 | + + + +## GetWorldMatrix + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取世界坐标变换矩阵 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | Matrix | 世界坐标变换矩阵 | + + + +## GetLocalMatrix + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取局部坐标变换矩阵 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | Matrix | 局部坐标变换矩阵 | + + + +## SetWorldTransform + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 设置当前预设的世界坐标变换 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | transform | Transform | 坐标变换 | + +- 返回值 + + 无 + + + +## GetWorldPosition + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设的世界坐标位置 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | (X轴位置,Y轴位置,Z轴位置) | + + + +## SetWorldPosition + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 设置当前预设的世界坐标位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float) | (X轴位置,Y轴位置,Z轴位置) | + +- 返回值 + + 无 + + + +## GetWorldRotation + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设的世界坐标旋转 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | (X轴角度,Y轴角度,Z轴角度) | + + + +## SetWorldRotation + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 设置当前预设的世界坐标旋转 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | rotation | tuple(float,float,float) | (X轴角度,Y轴角度,Z轴角度) | + +- 返回值 + + 无 + + + +## GetWorldScale + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设的世界坐标缩放 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | (X轴缩放,Y轴缩放,Z轴缩放) | + + + +## SetWorldScale + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 设置当前预设的世界坐标缩放 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | scale | tuple(float,float,float) | (X轴缩放,Y轴缩放,Z轴缩放) | + +- 返回值 + + 无 + + + +## AddLocalOffset + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 给局部坐标变换位置增加偏移量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | offset | tuple(float,float,float) | 变换位置 | + +- 返回值 + + 无 + + + +## AddWorldOffset + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 给世界坐标变换位置增加偏移量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | offset | tuple(float,float,float) | 变换位置 | + +- 返回值 + + 无 + + + +## AddLocalRotation + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 给局部坐标变换旋转增加偏移量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | rotation | tuple(float,float,float) | 变换旋转 | + +- 返回值 + + 无 + + + +## AddWorldRotation + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 给世界坐标变换旋转增加偏移量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | rotation | tuple(float,float,float) | 变换旋转 | + +- 返回值 + + 无 + + + +## AddLocalScale + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 给局部坐标变换缩放增加偏移量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | scale | tuple(float,float,float) | 变换缩放 | + +- 返回值 + + 无 + + + +## AddWorldScale + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 给世界坐标变换缩放增加偏移量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | scale | tuple(float,float,float) | 变换缩放 | + +- 返回值 + + 无 + + + +## AddLocalTransform + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 给局部坐标变换增加偏移量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | transform | Transform | 坐标变换 | + +- 返回值 + + 无 + + + +## AddWorldTransform + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 给世界坐标变换增加偏移量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | transform | Transform | 坐标变换 | + +- 返回值 + + 无 + + + +## GetRootParent + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设所在的根预设 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PresetBase | 预设 | + + + +## GetParent + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设的父预设 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PresetBase | 预设 | + + + +## SetParent + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 设置当前预设的父预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | parent | PresetBase | 预设 | + +- 返回值 + + 无 + + + +## GetManager + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 获取当前预设所在的预设管理器 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PresetManager | 预设管理 | + + + +## Unload + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 卸载当前预设 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## Destroy + +客户端/服务端 + +method in Preset.Model.TransformObject.TransformObject + +- 描述 + + 销毁当前预设 + +- 参数 + + 无 + +- 返回值 + + 无 + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/坐标变换Transform.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/坐标变换Transform.md new file mode 100644 index 0000000..2e21678 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/坐标变换Transform.md @@ -0,0 +1,157 @@ +--- +sidebarDepth: 1 +--- +# 坐标变换Transform + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +GameObject <|-- Transform +link GameObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E6%B8%B8%E6%88%8F%E5%AF%B9%E8%B1%A1GameObject.html" +Transform: 坐标变换 +GameObject: 游戏对象 +GameObject: (点击跳转) +``` + +- 描述 + + 坐标变换,包含位置、旋转和缩放 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float) | 位置变换 | + | rotation | tuple(float,float,float) | 旋转变换 | + | scale | tuple(float,float,float) | 缩放变换 | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [AddOffset](#addoffset) | 客户端/服务端 | 给坐标变换位置增加偏移量 | +| [AddRotation](#addrotation) | 客户端/服务端 | 给坐标变换旋转增加偏移量 | +| [AddScale](#addscale) | 客户端/服务端 | 给坐标变换缩放增加偏移量 | +| [AddTransform](#addtransform) | 客户端/服务端 | 给坐标变换增加偏移量 | +| [GetMatrix](#getmatrix) | 客户端/服务端 | 获取坐标变换矩阵 | + + + + +## AddOffset + +客户端/服务端 + +method in Preset.Model.Transform.Transform + +- 描述 + + 给坐标变换位置增加偏移量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | offset | tuple(float,float,float) | 变换位置 | + +- 返回值 + + 无 + + + +## AddRotation + +客户端/服务端 + +method in Preset.Model.Transform.Transform + +- 描述 + + 给坐标变换旋转增加偏移量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | rotation | tuple(float,float,float) | 变换旋转 | + +- 返回值 + + 无 + + + +## AddScale + +客户端/服务端 + +method in Preset.Model.Transform.Transform + +- 描述 + + 给坐标变换缩放增加偏移量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | scale | tuple(float,float,float) | 变换缩放 | + +- 返回值 + + 无 + + + +## AddTransform + +客户端/服务端 + +method in Preset.Model.Transform.Transform + +- 描述 + + 给坐标变换增加偏移量 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | transform | Transform | 坐标变换 | + +- 返回值 + + 无 + + + +## GetMatrix + +客户端/服务端 + +method in Preset.Model.Transform.Transform + +- 描述 + + 获取坐标变换矩阵 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | Matrix | 坐标变换矩阵 | + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/游戏对象GameObject.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/游戏对象GameObject.md new file mode 100644 index 0000000..bfda33a --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/游戏对象GameObject.md @@ -0,0 +1,81 @@ +--- +sidebarDepth: 1 +--- +# 游戏对象GameObject + + + +## 概述 + +- 描述 + + GameObject(游戏对象)是所有预设对象的基类,即API文档中Preset API - 预设对象下的所有类都继承自GameObject。 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | id | int | 对象ID | + | classType | str | 对象类名 | + | isClient | bool | 对象运行于客户端还是服务端 | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [LoadFile](#loadfile) | 客户端/服务端 | 加载指定路径的非python脚本文件内容,如配置文件 | +| [fromDict](#fromdict) | 客户端/服务端 | 将字典根据classType字段转换为对应类型的对象,该类型必须使用@registerGenericClass装饰 | + + + + +## LoadFile + +客户端/服务端 + +method in Preset.Model.GameObject.GameObject + +- 描述 + + 加载指定路径的非python脚本文件内容,如配置文件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | path | str | 指定相对路径 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 文件内容 | + + + +## fromDict + +客户端/服务端 + +method in Preset.Model.GameObject.type + +- 描述 + + 将字典根据classType字段转换为对应类型的对象,该类型必须使用@registerGenericClass装饰 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | data | dict | 要转换的字典 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | GameObject或dict | 转换成功返回对象,否则返回字典本身 | + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/素材数据BoxData.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/素材数据BoxData.md new file mode 100644 index 0000000..e26d645 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/通用/素材数据BoxData.md @@ -0,0 +1,36 @@ +--- +sidebarDepth: 1 +--- +# 素材数据BoxData + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +TransformObject <|-- BoxData +link TransformObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E5%8F%98%E6%8D%A2%E5%AF%B9%E8%B1%A1TransformObject.html" +GameObject <|-- TransformObject +link GameObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E6%B8%B8%E6%88%8F%E5%AF%B9%E8%B1%A1GameObject.html" +BoxData: 素材数据 +GameObject: 游戏对象 +GameObject: (点击跳转) +TransformObject: 变换对象 +TransformObject: (点击跳转) +``` + +- 描述 + + BoxData(素材数据)与素材类似,可以挂接在预设下使用。BoxData在编辑器中不会实际生成,可以重叠放置。 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | filePath | str | 素材相对于BoxData目录的相对路径 | + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/世界属性零件WorldPart.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/世界属性零件WorldPart.md new file mode 100644 index 0000000..34a2100 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/世界属性零件WorldPart.md @@ -0,0 +1,23 @@ +--- +sidebarDepth: 1 +--- +# 世界属性零件WorldPart + + + +## 概述 + +- 描述 + + 世界属性零件 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | gameMode | int | 游戏模式 | + | difficulty | int | 游戏难度 | + | cheat | bool | 作弊模式 | + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/传送门零件PortalPart.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/传送门零件PortalPart.md new file mode 100644 index 0000000..41b43a3 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/传送门零件PortalPart.md @@ -0,0 +1,24 @@ +--- +sidebarDepth: 1 +--- +# 传送门零件PortalPart + + + +## 概述 + +- 描述 + + 传送门零件 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | portalGateType | int | 传送门类型,0表示单向,1表示双向 | + | portalGateShape | int | 传送门形状,当前只能是立式方框0 | + | portalGateWidth | int | 传送门宽度 | + | portalGateHeight | int | 传送门高度 | + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/实体零件EntityBasePart.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/实体零件EntityBasePart.md new file mode 100644 index 0000000..4ddfedd --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/实体零件EntityBasePart.md @@ -0,0 +1,75 @@ +--- +sidebarDepth: 1 +--- +# 实体零件EntityBasePart + + + +## 概述 + +- 描述 + + 实体零件 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | engineType | str | 实体类型 | + | autoCreate | bool | 是否在零件初始化时,自动创建关联实体,默认为True | + | persistence | bool | 创建的实体是否持久化,默认为False,设为True时,创建完实体会将autoCreate重置为False | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [CreateVirtualEntity](#createvirtualentity) | 服务端 | 手动创建关联实体,如果已创建会直接返回 | +| [DestroyVirtualEntity](#destroyvirtualentity) | 服务端 | 移除已创建的关联实体,引擎退出时会默认调用 | + + + + +## CreateVirtualEntity + +服务端 + +method in Preset.Parts.EntityBasePart.EntityBasePart + +- 描述 + + 手动创建关联实体,如果已创建会直接返回 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 返回创建的实体ID | + + + +## DestroyVirtualEntity + +服务端 + +method in Preset.Parts.EntityBasePart.EntityBasePart + +- 描述 + + 移除已创建的关联实体,引擎退出时会默认调用 + +- 参数 + + 无 + +- 返回值 + + 无 + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/导航路径零件NavPointsPart.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/导航路径零件NavPointsPart.md new file mode 100644 index 0000000..c34d448 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/导航路径零件NavPointsPart.md @@ -0,0 +1,75 @@ +--- +sidebarDepth: 1 +--- +# 导航路径零件NavPointsPart + + + +## 概述 + +- 描述 + + 导航路径零件, 在编辑器内可以选定一系列相对于该零件的坐标点,当零件运行时可以获得这些坐标点的世界坐标列表 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | patrolsPath | list(tuple(float,float,float)) | 路径点列表 | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [GetNavigationPoints](#getnavigationpoints) | 客户端/服务端 | 获得路径点的世界坐标列表 | +| [GetNavigationRadius](#getnavigationradius) | 客户端/服务端 | 获得路径点的随机半径列表 | + + + + +## GetNavigationPoints + +客户端/服务端 + +method in Preset.Parts.NavPointsPart.NavPointsPart + +- 描述 + + 获得路径点的世界坐标列表 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(tuple(float,float,float)) | 路径点的世界坐标列表 | + + + +## GetNavigationRadius + +客户端/服务端 + +method in Preset.Parts.NavPointsPart.NavPointsPart + +- 描述 + + 获得路径点的随机半径列表 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(float) | 路径点的随机半径列表 | + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/玩家基础属性零件PlayerBasicPart.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/玩家基础属性零件PlayerBasicPart.md new file mode 100644 index 0000000..e85b71e --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/玩家基础属性零件PlayerBasicPart.md @@ -0,0 +1,26 @@ +--- +sidebarDepth: 1 +--- +# 玩家基础属性零件PlayerBasicPart + + + +## 概述 + +- 描述 + + 玩家基础属性零件 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | attackDamage | float | 攻击力 | + | healthMax | float | 生命上限 | + | disableHunger | bool | 是否锁定饥饿值 | + | spawnPos | tuple(float,float,float) | 玩家复活点 | + | nameDeeptest | bool | 名字是否透视 | + | showName | bool | 是否在头顶显示名字 | + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/相机轨迹CameraTrackPart.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/相机轨迹CameraTrackPart.md new file mode 100644 index 0000000..752a7b4 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/相机轨迹CameraTrackPart.md @@ -0,0 +1,113 @@ +--- +sidebarDepth: 1 +--- +# 相机轨迹CameraTrackPart + + + +## 概述 + +- 描述 + + 相机轨迹零件 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | track | list(dict) | 路径点列表 | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [PlayFromStart](#playfromstart) | 客户端 | 从头开始播放相机运动轨迹 | +| [Pause](#pause) | 客户端 | 暂停播放相机轨迹 | +| [Continue](#continue) | 客户端 | 继续播放相机轨迹 | +| [Stop](#stop) | 客户端 | 停止播放相机轨迹 | + + + + +## PlayFromStart + +客户端 + +method in Preset.Parts.CameraTrackPart.CameraTrackPart + +- 描述 + + 从头开始播放相机运动轨迹 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## Pause + +客户端 + +method in Preset.Parts.CameraTrackPart.CameraTrackPart + +- 描述 + + 暂停播放相机轨迹 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## Continue + +客户端 + +method in Preset.Parts.CameraTrackPart.CameraTrackPart + +- 描述 + + 继续播放相机轨迹 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## Stop + +客户端 + +method in Preset.Parts.CameraTrackPart.CameraTrackPart + +- 描述 + + 停止播放相机轨迹 + +- 参数 + + 无 + +- 返回值 + + 无 + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/触发器零件TriggerPart.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/触发器零件TriggerPart.md new file mode 100644 index 0000000..9a1cfe9 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/触发器零件TriggerPart.md @@ -0,0 +1,53 @@ +--- +sidebarDepth: 1 +--- +# 触发器零件TriggerPart + + + +## 概述 + +- 描述 + + 触发器零件,当实体进入时触发OnTriggerEntityEnter,当实体退出时触发OnTriggerEntityExit,当实体停留时触发OnTriggerEntityStay + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | isTriggerEnter | bool | 是否监听实体进入,默认为True | + | isTriggerExit | bool | 是否监听实体退出,默认为True | + | isTriggerStay | bool | 是否监听实体进入,默认为False | + | support | int | 支持客户端(1)/服务端(2)/双端(3),默认为双端(3) | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [GetEntitiesInTrigger](#getentitiesintrigger) | 客户端/服务端 | 获取当前在触发器区域的实体列表 | + + + + +## GetEntitiesInTrigger + +客户端/服务端 + +method in Preset.Parts.TriggerPart.TriggerPart + +- 描述 + + 获取当前在触发器区域的实体列表 + +- 参数 + + 无 + +- 返回值 + + 无 + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/零件PartBase.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/零件PartBase.md new file mode 100644 index 0000000..a78809b --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/零件PartBase.md @@ -0,0 +1,1169 @@ +--- +sidebarDepth: 1 +--- +# 零件PartBase + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +SdkInterface <|-- PartBase +link SdkInterface "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDK%E6%8E%A5%E5%8F%A3%E5%B0%81%E8%A3%85SdkInterface.html" +TransformObject <|-- PartBase +link TransformObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E5%8F%98%E6%8D%A2%E5%AF%B9%E8%B1%A1TransformObject.html" +GameObject <|-- TransformObject +link GameObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E6%B8%B8%E6%88%8F%E5%AF%B9%E8%B1%A1GameObject.html" +PartBase: 零件 +SdkInterface: SDK接口封装 +SdkInterface: (点击跳转) +TransformObject: 变换对象 +TransformObject: (点击跳转) +GameObject: 游戏对象 +GameObject: (点击跳转) +``` + +- 描述 + + PartBase(零件基类)是可以与零件进行绑定,而零件可以挂接在预设下,以实现带逻辑的预设的组装。所有的自定义零件都需要继承PartBase,预设系统下的大部分代码都需要写在自定义零件中。注意,自定义零件只有挂接到预设,并且在游戏中实例化才能生效。 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | tickEnable | str | 是否启用零件tick | + | replicated | list | 启用网络复制的字段列表 | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [InitClient](#initclient) | 客户端 | 客户端的零件对象初始化入口 | +| [InitServer](#initserver) | 服务端 | 服务端的零件对象初始化入口 | +| [TickClient](#tickclient) | 客户端 | 客户端的零件对象逻辑驱动入口 | +| [TickServer](#tickserver) | 服务端 | 服务端的零件对象逻辑驱动入口 | +| [UnloadClient](#unloadclient) | 客户端 | 客户端的零件对象卸载逻辑入口 | +| [UnloadServer](#unloadserver) | 服务端 | 服务端的零件对象卸载逻辑入口 | +| [DestroyClient](#destroyclient) | 客户端 | 客户端的零件对象销毁逻辑入口 | +| [DestroyServer](#destroyserver) | 服务端 | 服务端的零件对象销毁逻辑入口 | +| [CanAdd](#canadd) | 客户端/服务端 | 判断零件是否可以挂接到指定的父节点上 | +| [GetTickCount](#gettickcount) | 客户端/服务端 | 获取当前帧数 | +| [LogDebug](#logdebug) | 客户端/服务端 | 打印msg % args调试日志,仅PC开发包有效 | +| [LogInfo](#loginfo) | 客户端/服务端 | 打印msg % args消息日志 | +| [LogError](#logerror) | 客户端/服务端 | 打印msg % args错误日志 | +| [GetGameObjectById](#getgameobjectbyid) | 客户端/服务端 | 获取指定对象ID的游戏对象 | +| [GetGameObjectByEntityId](#getgameobjectbyentityid) | 客户端/服务端 | 获取指定实体ID的游戏对象 | +| [GetLoadedPlayers](#getloadedplayers) | 客户端/服务端 | 获取服务器所有玩家的ID列表 | +| [GetPlayerObject](#getplayerobject) | 客户端/服务端 | 获取玩家对象 | +| [GetEntityObject](#getentityobject) | 客户端/服务端 | 获取实体对象 | +| [GetEffectObject](#geteffectobject) | 客户端 | 获取特效对象 | +| [CreateEffectPreset](#createeffectpreset) | 客户端 | 创建特效对象 | +| [CreateTextboardPreset](#createtextboardpreset) | 客户端 | 创建文字面板预设对象 | +| [ListenForEvent](#listenforevent) | 客户端/服务端 | 监听指定的事件 | +| [UnListenForEvent](#unlistenforevent) | 客户端/服务端 | 反监听指定的事件 | +| [ListenForEngineEvent](#listenforengineevent) | 客户端/服务端 | 监听指定的引擎事件 | +| [UnListenForEngineEvent](#unlistenforengineevent) | 客户端/服务端 | 反监听指定的引擎事件 | +| [CreateEventData](#createeventdata) | 客户端/服务端 | 创建自定义事件的数据,eventData用于发送事件。创建的eventData可以理解为一个dict,可以嵌套赋值dict,list和基本数据类型,但不支持tuple | +| [BroadcastEvent](#broadcastevent) | 客户端/服务端 | 广播事件,双端通用 | +| [BroadcastPresetSystemEvent](#broadcastpresetsystemevent) | 客户端/服务端 | 广播给预设系统 | +| [NotifyToServer](#notifytoserver) | 客户端 | 通知服务端触发事件 | +| [NotifyToClient](#notifytoclient) | 服务端 | 通知指定客户端触发事件 | +| [BroadcastToAllClient](#broadcasttoallclient) | 服务端 | 通知指所有客户端触发事件 | +| [ListenSelfEvent](#listenselfevent) | 客户端/服务端 | 监听来自自己的事件 | +| [UnListenSelfEvent](#unlistenselfevent) | 客户端/服务端 | 反监听来自自己的事件 | +| [ListenPartEvent](#listenpartevent) | 客户端/服务端 | 监听来自指定零件的事件 | +| [UnListenPartEvent](#unlistenpartevent) | 客户端/服务端 | 反监听来自指定零件的事件 | +| [ListenPresetSystemEvent](#listenpresetsystemevent) | 客户端/服务端 | 监听来自预设系统的事件 | +| [UnListenPresetSystemEvent](#unlistenpresetsystemevent) | 客户端/服务端 | 反监听来自预设系统的事件 | +| [DestroyStoryLines](#destroystorylines) | 客户端/服务端 | 手动销毁零件蓝图 | +| [GetSelf](#getself) | 客户端/服务端 | 获取零件自身 | +| [GetApi](#getapi) | 客户端/服务端 | 返回当前对象可使用的SDK API模块 | +| [IsPlayerSneaking](#isplayersneaking) | 服务端 | 是否潜行 | +| [GetPlayerHunger](#getplayerhunger) | 服务端 | 获取玩家饥饿度,展示在UI饥饿度进度条上,初始值为20,即每一个鸡腿代表2个饥饿度。 **饱和度(saturation)** :玩家当前饱和度,初始值为5,最大值始终为玩家当前饥饿度(hunger),该值直接影响玩家**饥饿度(hunger)**。
1)增加方法:吃食物。
2)减少方法:每触发一次**消耗事件**,该值减少1,如果该值不大于0,直接把玩家 **饥饿度(hunger)** 减少1。 | +| [SetPlayerHunger](#setplayerhunger) | 服务端 | 设置玩家饥饿度。 | + + + + +## InitClient + +客户端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 客户端的零件对象初始化入口 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## InitServer + +服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 服务端的零件对象初始化入口 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## TickClient + +客户端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 客户端的零件对象逻辑驱动入口 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## TickServer + +服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 服务端的零件对象逻辑驱动入口 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## UnloadClient + +客户端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 客户端的零件对象卸载逻辑入口 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## UnloadServer + +服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 服务端的零件对象卸载逻辑入口 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## DestroyClient + +客户端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 客户端的零件对象销毁逻辑入口 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## DestroyServer + +服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 服务端的零件对象销毁逻辑入口 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## CanAdd + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 判断零件是否可以挂接到指定的父节点上 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | parent | PresetBase | 即将挂接的父预设 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 不允许挂接时,返回对应的错误提示 | + + + +## GetTickCount + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 获取当前帧数 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 当前帧数 | + + + +## LogDebug + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 打印msg % args调试日志,仅PC开发包有效 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | msg | str | 要打印的格式化字符串 | + | *args | list(object) | 格式化参数列表 | + +- 返回值 + + 无 + +- 示例 + +```python +self.LogDebug(“self.isClient: %s”, self.isClient) +``` + + + +## LogInfo + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 打印msg % args消息日志 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | msg | str | 要打印的格式化字符串 | + | *args | list(object) | 格式化参数列表 | + +- 返回值 + + 无 + +- 示例 + +```python +self.LogInfo(“self.isClient: %s”, self.isClient) +``` + + + +## LogError + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 打印msg % args错误日志 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | msg | str | 要打印的格式化字符串 | + | *args | list(object) | 格式化参数列表 | + +- 返回值 + + 无 + +- 示例 + +```python +self.LogError(“self.isClient: %s”, self.isClient) +``` + + + +## GetGameObjectById + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 获取指定对象ID的游戏对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | id | int | 指定的对象ID | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | TransformObject | 成功返回游戏对象,失败返回None | + +- 示例 + +```python +obj = self.GetGameObjectById(0) +``` + + + +## GetGameObjectByEntityId + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 获取指定实体ID的游戏对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 指定的实体ID | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | TransformObject | 成功返回游戏对象,失败返回None | + +- 示例 + +```python +obj = self.GetGameObjectByEntityId(0) +``` + + + +## GetLoadedPlayers + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 获取服务器所有玩家的ID列表 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(str) | 所有玩家的ID列表 | + + + +## GetPlayerObject + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 获取玩家对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 玩家ID | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PlayerObject | 成功返回玩家对象,失败返回None | + +- 示例 + +```python +player = self.GetPlayerObject(playerId) +``` + + + +## GetEntityObject + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 获取实体对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 指定的实体ID | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | EntityObject | 成功返回实体对象,失败返回None | + +- 示例 + +```python +entity = self.GetEntityObject(entityId) +``` + + + +## GetEffectObject + +客户端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 获取特效对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | effectId | int | 特效ID | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | EffectObject | 成功返回特效对象,失败返回None | + +- 示例 + +```python +effect = self.GetEffectObject(effectId) +``` + + + +## CreateEffectPreset + +客户端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 创建特效对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | resource | str | 特效资源json | + | pos | tuple(float,float,float) | 特效位置 | + | rotation | tuple(float,float,float) | 特效旋转 | + | scale | tuple(float,float,float) | 特效缩放 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | EffectPreset | 成功返回特效对象,失败返回None | + +- 示例 + +```python +# 在某个实体位置播放指定特效 +effect = self.CreateEffectPreset("effects/xxx", self.GetEntityPos(entityId)) +``` + + + +## CreateTextboardPreset + +客户端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 创建文字面板预设对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | text | str | 文字显示内容 | + | textColor | tuple(float,float,float,float) | 文字颜色的RGBA值,范围0-1 | + | boardColor | tuple(float,float,float,float) | 可选参数,默认None,设置为黑色,面板颜色的RGBA值,范围0-1 | + | pos | tuple(float,float,float) | 可选参数,默认(0, 0, 0) 生成文字面板位置 | + | faceCamera | bool | 是否始终朝向相机, 默认为True | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | TextboardPreset | 成功返回文字面板对象,失败返回None | + +- 示例 + +```python +# 在某个位置生成文字面板预设 +textboard = self.CreateTextboardPreset('Hello', (0.5, 0.4, 0.3, 0.8)) +``` + + + +## ListenForEvent + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 监听指定的事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | namespace | str | 命名空间 | + | systemName | str | 事件系统名称 | + | eventName | str | 事件名称 | + | instance | object | 实例 | + | func | object | 函数 | + | priority | str | 优先级 | + +- 返回值 + + 无 + + + +## UnListenForEvent + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 反监听指定的事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | namespace | str | 命名空间 | + | systemName | str | 事件系统名称 | + | eventName | str | 事件名称 | + | instance | object | 实例 | + | func | object | 函数 | + | priority | str | 优先级 | + +- 返回值 + + 无 + + + +## ListenForEngineEvent + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 监听指定的引擎事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | eventName | str | 事件名称 | + | instance | object | 实例 | + | func | object | 函数 | + | priority | str | 优先级 | + +- 返回值 + + 无 + + + +## UnListenForEngineEvent + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 反监听指定的引擎事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | eventName | str | 事件名称 | + | instance | object | 实例 | + | func | object | 函数 | + | priority | str | 优先级 | + +- 返回值 + + 无 + + + +## CreateEventData + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 创建自定义事件的数据,eventData用于发送事件。创建的eventData可以理解为一个dict,可以嵌套赋值dict,list和基本数据类型,但不支持tuple + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | dict | 事件数据 | + + + +## BroadcastEvent + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 广播事件,双端通用 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | eventName | str | 事件名称 | + | eventData | object | 事件数据 | + +- 返回值 + + 无 + + + +## BroadcastPresetSystemEvent + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 广播给预设系统 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | eventName | str | 事件名称 | + | eventData | object | 事件数据 | + +- 返回值 + + 无 + + + +## NotifyToServer + +客户端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 通知服务端触发事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | eventName | str | 事件名称 | + | eventData | object | 事件数据 | + +- 返回值 + + 无 + + + +## NotifyToClient + +服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 通知指定客户端触发事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str | 玩家ID | + | eventName | str | 事件名称 | + | eventData | object | 事件数据 | + +- 返回值 + + 无 + + + +## BroadcastToAllClient + +服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 通知指所有客户端触发事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | eventName | str | 事件名称 | + | eventData | object | 事件数据 | + +- 返回值 + + 无 + + + +## ListenSelfEvent + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 监听来自自己的事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | eventName | str | 事件名称 | + | target | object | 目标 | + | func | object | 回调函数 | + +- 返回值 + + 无 + + + +## UnListenSelfEvent + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 反监听来自自己的事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | eventName | str | 事件名称 | + | target | object | 目标 | + | func | object | 回调函数 | + +- 返回值 + + 无 + + + +## ListenPartEvent + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 监听来自指定零件的事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | partId | int | 指定零件的ID | + | eventName | str | 事件名称 | + | target | object | 目标 | + | func | object | 回调函数 | + +- 返回值 + + 无 + + + +## UnListenPartEvent + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 反监听来自指定零件的事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | partId | int | 指定零件的ID | + | eventName | str | 事件名称 | + | target | object | 目标 | + | func | object | 回调函数 | + +- 返回值 + + 无 + + + +## ListenPresetSystemEvent + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 监听来自预设系统的事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | eventName | str | 事件名称 | + | target | object | 目标 | + | func | object | 回调函数 | + +- 返回值 + + 无 + + + +## UnListenPresetSystemEvent + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 反监听来自预设系统的事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | eventName | str | 事件名称 | + | target | object | 目标 | + | func | object | 回调函数 | + +- 返回值 + + 无 + + + +## DestroyStoryLines + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 手动销毁零件蓝图 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## GetSelf + +客户端/服务端 + +method in Preset.Model.PartBase.PartBase + +- 描述 + + 获取零件自身 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PartBase | 零件自身 | + + + +## GetApi + +客户端/服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 返回当前对象可使用的SDK API模块 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | extraClientApi或extraServerApi | 返回当前对象可使用的SDK API模块 | + + + +## IsPlayerSneaking + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 是否潜行 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否潜行 | + +- 示例 + +```python +self.IsPlayerSneaking(playerId) +``` + + + +## GetPlayerHunger + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 获取玩家饥饿度,展示在UI饥饿度进度条上,初始值为20,即每一个鸡腿代表2个饥饿度。 **饱和度(saturation)** :玩家当前饱和度,初始值为5,最大值始终为玩家当前饥饿度(hunger),该值直接影响玩家**饥饿度(hunger)**。
1)增加方法:吃食物。
2)减少方法:每触发一次**消耗事件**,该值减少1,如果该值不大于0,直接把玩家 **饥饿度(hunger)** 减少1。 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 玩家饥饿度 | + +- 示例 + +```python +self.GetPlayerHunger(playerId) +``` + + + +## SetPlayerHunger + +服务端 + +method in Preset.Model.SdkInterface.SdkInterface + +- 描述 + + 设置玩家饥饿度。 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | playerId | str或int | 玩家id | + | value | float | 饥饿度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetPlayerHunger(playerId, 10) +``` + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/零件事件PartEvent.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/零件事件PartEvent.md new file mode 100644 index 0000000..3ecf00e --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/零件/零件事件PartEvent.md @@ -0,0 +1,112 @@ +--- +sidebarDepth: 1 +--- +# 零件事件PartEvent + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [OnTriggerEntityEnter](#ontriggerentityenter) | 客户端/服务端 | 触发器范围有实体进入时触发,只适用于TriggerPart | +| [OnTriggerEntityExit](#ontriggerentityexit) | 客户端/服务端 | 触发器范围有实体离开时触发,只适用于TriggerPart | +| [OnTriggerEntityStay](#ontriggerentitystay) | 客户端/服务端 | 触发器范围有实体停留时触发,只适用于TriggerPart | + + + + +## OnTriggerEntityEnter + +客户端/服务端 + +method in Preset.Parts.PartEvent + +- 描述 + + 触发器范围有实体进入时触发,只适用于TriggerPart + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | TriggerPart | PartBase | 发射事件的触发器零件 | + | EnterEntityIds | list(str) | 进入触发器范围的实体ID列表 | + +- 返回值 + + 无 + +- 示例 + +```python +part = self.GetParent().GetPartByType("TriggerPart") +if not part: + return +self.ListenPartClientEvent(part.id, "OnTriggerEntityEnter", self, self.OnTriggerEntityEnter) +``` + + + +## OnTriggerEntityExit + +客户端/服务端 + +method in Preset.Parts.PartEvent + +- 描述 + + 触发器范围有实体离开时触发,只适用于TriggerPart + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | TriggerPart | PartBase | 发射事件的触发器零件 | + | ExitEntityIds | list(str) | 离开触发器范围的实体ID列表 | + +- 返回值 + + 无 + +- 示例 + +```python +part = self.GetParent().GetPartByType("TriggerPart") +if not part: + return +self.ListenPartClientEvent(part.id, "OnTriggerEntityExit", self, self.OnTriggerEntityExit) +``` + + + +## OnTriggerEntityStay + +客户端/服务端 + +method in Preset.Parts.PartEvent + +- 描述 + + 触发器范围有实体停留时触发,只适用于TriggerPart + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | TriggerPart | PartBase | 发射事件的触发器零件 | + | StayEntityIds | list(str) | 停留在触发器范围的实体ID列表 | + +- 返回值 + + 无 + +- 示例 + +```python +part = self.GetParent().GetPartByType("TriggerPart") +if not part: + return +self.ListenPartClientEvent(part.id, "OnTriggerEntityStay", self, self.OnTriggerEntityStay) +``` + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/实体对象EntityObject.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/实体对象EntityObject.md new file mode 100644 index 0000000..a454846 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/实体对象EntityObject.md @@ -0,0 +1,2843 @@ +--- +sidebarDepth: 1 +--- +# 实体对象EntityObject + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +SdkInterface <|-- EntityObject +link SdkInterface "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDK%E6%8E%A5%E5%8F%A3%E5%B0%81%E8%A3%85SdkInterface.html" +EntityObject: 实体对象 +SdkInterface: SDK接口封装 +SdkInterface: (点击跳转) +``` + +- 描述 + + EntityObject(实体对象)是对实体对象封装的基类,它为实体提供了面向对象的使用方式。 + +- 成员变量 + + 无 + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [GetPos](#getpos) | 客户端/服务端 | 获取实体位置 | +| [GetFootPos](#getfootpos) | 客户端/服务端 | 获取实体脚所在的位置 | +| [SetPos](#setpos) | 服务端 | 设置实体位置 | +| [SetFootPos](#setfootpos) | 服务端 | 设置实体脚底所在的位置 | +| [GetRot](#getrot) | 客户端/服务端 | 获取实体角度 | +| [SetRot](#setrot) | 客户端/服务端 | 设置实体的头的角度 | +| [GetEngineTypeStr](#getenginetypestr) | 客户端/服务端 | 获取实体的类型名称 | +| [GetEngineType](#getenginetype) | 客户端/服务端 | 获取实体类型 | +| [GetModelId](#getmodelid) | 客户端 | 获取骨骼模型的Id,主要用于特效绑定骨骼模型 | +| [PlayAnim](#playanim) | 客户端 | 播放骨骼动画 | +| [SetAnimSpeed](#setanimspeed) | 客户端 | 设置某个骨骼动画的播放速度 | +| [GetAnimLength](#getanimlength) | 客户端 | 获取某个骨骼动画的长度,单位为秒 | +| [SetBrightness](#setbrightness) | 客户端 | 设置实体的亮度 | +| [SetOpacity](#setopacity) | 客户端 | 设置生物模型的透明度 | +| [GetHealth](#gethealth) | 服务端 | 获取实体预设的生命值 | +| [SetHealth](#sethealth) | 服务端 | 设置实体预设的生命值 | +| [GetMaxHealth](#getmaxhealth) | 服务端 | 获取实体预设的最大生命值 | +| [SetMaxHealth](#setmaxhealth) | 服务端 | 设置实体预设的最大生命值 | +| [GetSpeed](#getspeed) | 服务端 | 获取实体预设的速度 | +| [SetSpeed](#setspeed) | 服务端 | 设置实体预设的速度 | +| [GetMaxSpeed](#getmaxspeed) | 服务端 | 获取实体预设的最大速度 | +| [SetMaxSpeed](#setmaxspeed) | 服务端 | 设置实体预设的最大速度 | +| [GetDamage](#getdamage) | 服务端 | 获取实体预设的伤害 | +| [SetDamage](#setdamage) | 服务端 | 设置实体预设的伤害 | +| [GetMaxDamage](#getmaxdamage) | 服务端 | 获取实体预设的最大伤害 | +| [SetMaxDamage](#setmaxdamage) | 服务端 | 设置实体预设的最大伤害 | +| [ShowHealth](#showhealth) | 客户端 | 设置是否显示血条,默认为显示 | +| [SetAttackTarget](#setattacktarget) | 服务端 | 设置仇恨目标 | +| [ResetAttackTarget](#resetattacktarget) | 服务端 | 清除仇恨目标 | +| [GetAttackTarget](#getattacktarget) | 服务端 | 获取仇恨目标 | +| [SetKnockback](#setknockback) | 服务端 | 设置击退的初始速度,需要考虑阻力的影响 | +| [SetOwner](#setowner) | 服务端 | 设置实体的属主 | +| [GetOwner](#getowner) | 服务端 | 获取实体的属主 | +| [IsOnFire](#isonfire) | 服务端 | 获取实体是否着火 | +| [SetOnFire](#setonfire) | 服务端 | 设置实体着火 | +| [GetAttrValue](#getattrvalue) | 服务端 | 获取属性值,包括生命值,饥饿度,移速 | +| [GetAttrMaxValue](#getattrmaxvalue) | 客户端/服务端 | 获取属性最大值,包括生命值,饥饿度,移速 | +| [SetAttrValue](#setattrvalue) | 服务端 | 设置属性值,包括生命值,饥饿度,移速 | +| [SetAttrMaxValue](#setattrmaxvalue) | 服务端 | 设置属性最大值,包括生命值,饥饿度,移速 | +| [IsInLava](#isinlava) | 客户端 | 实体是否在岩浆中 | +| [IsOnGround](#isonground) | 客户端 | 实体是否触地 | +| [GetAuxValue](#getauxvalue) | 客户端/服务端 | 获取射出的弓箭或投掷出的药水的附加值 | +| [GetCurrentAirSupply](#getcurrentairsupply) | 服务端 | 生物当前氧气储备值 | +| [GetMaxAirSupply](#getmaxairsupply) | 服务端 | 获取生物最大氧气储备值 | +| [SetCurrentAirSupply](#setcurrentairsupply) | 服务端 | 设置生物氧气储备值 | +| [SetMaxAirSupply](#setmaxairsupply) | 服务端 | 设置生物最大氧气储备值 | +| [IsConsumingAirSupply](#isconsumingairsupply) | 服务端 | 获取生物当前是否在消耗氧气 | +| [SetRecoverTotalAirSupplyTime](#setrecovertotalairsupplytime) | 服务端 | 设置恢复最大氧气量的时间,单位秒 | +| [GetSourceId](#getsourceid) | 服务端 | 获取抛射物发射者实体id | +| [SetCollisionBoxSize](#setcollisionboxsize) | 服务端 | 设置实体的包围盒 | +| [GetCollisionBoxSize](#getcollisionboxsize) | 服务端 | 获取实体的包围盒 | +| [SetBlockControlAi](#setblockcontrolai) | 服务端 | 设置屏蔽生物原生AI | +| [GetDimensionId](#getdimensionid) | 服务端 | 获取实体所在维度 | +| [ChangeDimension](#changedimension) | 服务端 | 传送实体 | +| [RemoveEffect](#removeeffect) | 服务端 | 为实体删除指定状态效果 | +| [AddEffect](#addeffect) | 服务端 | 为实体添加指定状态效果,如果添加的状态已存在则有以下集中情况:1、等级大于已存在则更新状态等级及持续时间;2、状态等级相等且剩余时间duration大于已存在则刷新剩余时间;3、等级小于已存在则不做修改;4、粒子效果以新的为准 | +| [GetEffects](#geteffects) | 服务端 | 获取实体当前所有状态效果 | +| [TriggerCustomEvent](#triggercustomevent) | 服务端 | 触发生物自定义事件 | +| [IsAlive](#isalive) | 客户端/服务端 | 判断生物实体是否存活或非生物实体是否存在 | +| [GetGravity](#getgravity) | 服务端 | 获取实体的重力因子,当生物重力因子为0时则应用世界的重力因子 | +| [SetGravity](#setgravity) | 服务端 | 设置实体的重力因子,当生物重力因子为0时则应用世界的重力因子 | +| [SetHurt](#sethurt) | 服务端 | 对实体造成伤害 | +| [SetImmuneDamage](#setimmunedamage) | 服务端 | 设置实体是否免疫伤害(该属性存档) | +| [SetModAttr](#setmodattr) | 客户端/服务端 | 设置属性值 | +| [GetModAttr](#getmodattr) | 客户端/服务端 | 获取属性值 | +| [RegisterModAttrUpdateFunc](#registermodattrupdatefunc) | 客户端 | 注册属性值变换时的回调函数,当属性变化时会调用该函数 | +| [UnRegisterModAttrUpdateFunc](#unregistermodattrupdatefunc) | 客户端 | 反注册属性值变换时的回调函数 | +| [GetName](#getname) | 服务端 | 获取生物的自定义名称,即使用命名牌或者SetName接口设置的名称 | +| [SetName](#setname) | 服务端 | 用于设置生物的自定义名称,跟原版命名牌作用相同,玩家和新版流浪商人暂不支持 | +| [SetShowName](#setshowname) | 客户端 | 设置生物名字是否按照默认游戏逻辑显示 | +| [SetAlwaysShowName](#setalwaysshowname) | 客户端 | 设置生物名字是否一直显示,瞄准点不指向生物时也能显示 | +| [SetPersistence](#setpersistence) | 服务端 | 设置实体是否存盘 | +| [SetMotion](#setmotion) | 客户端/服务端 | 设置生物的瞬时移动方向向量,服务端只能对非玩家使用,客户端只能对本地玩家使用 | +| [GetMotion](#getmotion) | 客户端/服务端 | 获取生物(含玩家)的瞬时移动方向向量 | +| [SetItem](#setitem) | 服务端 | 设置生物物品 | +| [SetCanOtherPlayerRide](#setcanotherplayerride) | 服务端 | 设置其他玩家是否有权限骑乘 | +| [SetControl](#setcontrol) | 服务端 | 设置该生物无需装备鞍就可以控制行走跳跃 | +| [SetRidePos](#setridepos) | 服务端 | 设置生物骑乘位置 | +| [SetNotRender](#setnotrender) | 客户端 | 设置是否关闭实体渲染 | +| [SetCollidable](#setcollidable) | 客户端 | 设置实体是否可碰撞 | +| [SetHealthColor](#sethealthcolor) | 客户端 | 设置血条的颜色及背景色, 必须用game组件设置ShowHealthBar时才能显示血条!! | +| [AddAnimation](#addanimation) | 客户端 | 增加生物渲染动画 | +| [AddAnimationController](#addanimationcontroller) | 客户端 | 增加生物渲染动画控制器 | +| [AddScriptAnimate](#addscriptanimate) | 客户端 | 在生物的客户端实体定义(minecraft:client_entity)json中的scripts/animate节点添加动画/动画控制器 | +| [AddParticleEffect](#addparticleeffect) | 客户端 | 增加生物特效资源 | +| [AddRenderController](#addrendercontroller) | 客户端 | 增加生物渲染控制器 | +| [AddRenderMaterial](#addrendermaterial) | 客户端 | 增加生物渲染需要的材质,调用该接口后需要调用RebuildActorRender才会生效 | +| [AddSoundEffect](#addsoundeffect) | 客户端 | 增加生物音效资源 | +| [SetPushable](#setpushable) | 服务端 | 设置实体是否可推动 | +| [SetModel](#setmodel) | 客户端/服务端 | 设置骨骼模型 | +| [GetLavaSpeed](#getlavaspeed) | 服务端 | 获取实体预设岩浆里的移速 | +| [SetLavaSpeed](#setlavaspeed) | 服务端 | 设置实体预设岩浆里的移速 | +| [GetMaxLavaSpeed](#getmaxlavaspeed) | 服务端 | 获取实体预设岩浆里的最大移速 | +| [SetMaxLavaSpeed](#setmaxlavaspeed) | 服务端 | 设置实体预设岩浆里的最大移速 | + + + + +## GetPos + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体位置 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | 位置信息 | + +- 备注 + - 对于非玩家,获取到的是脚底部位的位置 + - 对于玩家,如果处于行走,站立,游泳,潜行,滑翔状态,获得的位置比脚底位置高1.62;如果处于睡觉状态,获得的位置比最低位置高0.2 + + + +## GetFootPos + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体脚所在的位置 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float) | 位置信息 | + + + +## SetPos + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(int,int,int) | xyz值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 行为与使用tp命令一致,实体会瞬移到目标点 + - 对于所有类型的实体都是设置脚底位置,与[SetFootPos](#setfootpos)等价 + - 在床上时调用该接口会返回False + +- 示例 + +```python +self.SetPos((1,2,3)) +``` + + + +## SetFootPos + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体脚底所在的位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float) | 实体脚所在的位置 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 行为与使用tp命令一致,实体会瞬移到目标点 + - 在床上时调用该接口会返回False + +- 示例 + +```python +self.SetFootPos((0, 4, 0)) +``` + + + +## GetRot + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体角度 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float) | (上下角度,左右角度)单位是角度而不是弧度 | + + + +## SetRot + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体的头的角度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | rot | tuple(float,float) | 俯仰角度及绕竖直方向的角度,单位是角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 备注 + - 建议只用来设置本地玩家。如果设置其他生物,会被生物自身行为覆盖。 + +- 示例 + +```python +# 设为向上仰视45度,并朝向世界z轴正方向 +self.SetRot((-45, 0)) +``` + + + +## GetEngineTypeStr + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体的类型名称 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 实体类型名称,如minecraft:husk | + +- 示例 + +```python +entity = self.GetEntityObject(entityId) +engineType = entity.GetEngineTypeStr() +``` + + + +## GetEngineType + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体类型 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 详见EntityType枚举 | + +- 示例 + +```python +entity = self.GetEntityObject(entityId) +# 以判断是否是 Mob 为例,如果要判断是否为弹射物,找到对应的类型Projectile修改即可 +if entity.GetEngineType() & self.GetMinecraftEnum().EntityType.Mob == self.GetMinecraftEnum().EntityType.Mob: + logger.info("{} is Mod".format(self.GetEngineTypeStr(entityId))) +``` + + + +## GetModelId + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取骨骼模型的Id,主要用于特效绑定骨骼模型 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 当前骨骼模型实例的id | + + + +## PlayAnim + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 播放骨骼动画 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | aniName | str | 动画名称 | + | isLoop | bool | 是否循环播放 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.PlayAnim("run", True) +``` + + + +## SetAnimSpeed + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置某个骨骼动画的播放速度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | aniName | str | 骨骼动画名称 | + | speed | float | 速度倍率 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# run动作三倍速 +self.SetAnimSpeed("run", 3.0) +``` + + + +## GetAnimLength + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取某个骨骼动画的长度,单位为秒 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | aniName | str | 骨骼动画名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 骨骼动画长度 | + +- 示例 + +```python +# 获取run动画的长度 +animLength = self.GetAnimLength('run') +``` + + + +## SetBrightness + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体的亮度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | brightness | float | 0:纯黑
1:正常亮度
1-14:较亮甚至纯白
超过14:通常为纯白,即使数值改变也没有明显变化 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True:设置成功 False:设置失败 | + +- 备注 + - 目前只支持修改替换了骨骼模型的实体亮度,使用游戏原生模型的实体暂不予支持。 + +- 示例 + +```python +success = self.SetBrightness(0.5) +``` + + + +## SetOpacity + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置生物模型的透明度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | opacity | float | 透明度值,取值范围为[0, 1],值越小越透明 | + +- 返回值 + + 无 + +- 示例 + +```python +self.SetOpacity(0.2) +``` + + + +## GetHealth + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体预设的生命值 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 生命值 | + + + +## SetHealth + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体预设的生命值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | hp | float | 生命值 | + +- 返回值 + + 无 + + + +## GetMaxHealth + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体预设的最大生命值 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 生命值 | + + + +## SetMaxHealth + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体预设的最大生命值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | hp | float | 生命值 | + +- 返回值 + + 无 + + + +## GetSpeed + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体预设的速度 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 速度 | + + + +## SetSpeed + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体预设的速度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | speed | float | 速度 | + +- 返回值 + + 无 + + + +## GetMaxSpeed + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体预设的最大速度 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 速度 | + + + +## SetMaxSpeed + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体预设的最大速度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | speed | float | 速度 | + +- 返回值 + + 无 + + + +## GetDamage + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体预设的伤害 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 伤害 | + + + +## SetDamage + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体预设的伤害 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | hp | float | 伤害 | + +- 返回值 + + 无 + + + +## GetMaxDamage + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体预设的最大伤害 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 伤害 | + + + +## SetMaxDamage + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体预设的最大伤害 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | damage | float | 伤害 | + +- 返回值 + + 无 + + + +## ShowHealth + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置是否显示血条,默认为显示 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | show | bool | 设置是否显示 | + +- 返回值 + + 无 + +- 备注 + - 必须先设置ShowHealthBar + +- 示例 + +```python +# 设置该entity不显示血条 +self.ShowHealth(False) +``` + + + +## SetAttackTarget + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置仇恨目标 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | targetId | str | 目标实体id | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetAttackTarget(targetId) +``` + + + +## ResetAttackTarget + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 清除仇恨目标 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.ResetAttackTarget() +``` + + + +## GetAttackTarget + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取仇恨目标 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 仇恨目标的实体id | + +- 示例 + +```python +self.GetAttackTarget() +``` + + + +## SetKnockback + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置击退的初始速度,需要考虑阻力的影响 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | xd | float | x轴方向,用來控制角度 | + | zd | float | z轴方向,用來控制角度 | + | power | float | 用来控制水平方向的初速度 | + | height | float | 竖直方向的初速度 | + | heightCap | float | 向上速度阈值,当实体本身已经有向上的速度时需要考虑这个值,用来确保最终向上的速度不会超过heightCap | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | None | 无返回值 | + +- 示例 + +```python +self.SetKnockback(0.1, 0.1, 1.0, 1.0, 1.0) +``` + + + +## SetOwner + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体的属主 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | ownerId | str | 属主实体id,为None时设置实体的属主为空 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功,True表示设置成功 | + +- 示例 + +```python +result = self.SetOwner(ownerId) +``` + + + +## GetOwner + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体的属主 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 实体属主id | + +- 示例 + +```python +ownerId = self.GetOwner() +``` + + + +## IsOnFire + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体是否着火 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否着火 | + +- 示例 + +```python +isOnFire = self.IsEntityOnFire(entityId) +``` + + + +## SetOnFire + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体着火 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | seconds | int | 着火时间(单位:秒) | + | burn_damage | int | 着火状态下每秒扣的血量,不传的话默认是1 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 在水中或者雨中不会生效,着火时间受生物装备、生物的状态影响。burn_damage取值范围是0~1000,小于0将取0,大于1000将取1000 + +- 示例 + +```python +self.SetEntityOnFire(entityId, 1, 2) +``` + + + +## GetAttrValue + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取属性值,包括生命值,饥饿度,移速 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | attrType | int | AttrType枚举 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 属性结果 | + +- 示例 + +```python +self.GetAttrValue(self.GetMinecraftEnum().AttrType.HEALTH) +``` + + + +## GetAttrMaxValue + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取属性最大值,包括生命值,饥饿度,移速 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | attrType | int | AttrType枚举 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 属性值结果 | + +- 示例 + +```python +self.GetAttrMaxValue(self.GetMinecraftEnum().AttrType.HEALTH) +``` + + + +## SetAttrValue + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置属性值,包括生命值,饥饿度,移速 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | attrType | int | AttrType枚举 | + | value | float | 属性值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 设置接口暂不支持 ABSORPTION + +- 示例 + +```python +self.SetAttrValue(self.GetMinecraftEnum().AttrType.HEALTH, 20) +``` + + + +## SetAttrMaxValue + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置属性最大值,包括生命值,饥饿度,移速 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | attrType | int | AttrType枚举 | + | value | float | 属性值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 设置的最大饱和度不能超过当前的饥饿值; 食用食物后,最大饱和度会被原版游戏机制修改 + - 设置接口暂不支持 ABSORPTION + +- 示例 + +```python +self.SetAttrMaxValue(serverApi.GetMinecraftEnum().AttrType.SPEED, 0.2) +``` + + + +## IsInLava + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 实体是否在岩浆中 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否在岩浆中,True为在岩浆中,False为不在岩浆中 | + +- 备注 + - 只能获取到本地客户端已加载的实体是否在岩浆中,若实体在其他维度或未加载(距离本地玩家太远),将获取失败 + + + +## IsOnGround + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 实体是否触地 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否触地,True为触地,False为不触地 | + +- 备注 + - 客户端实体刚创建时引擎计算还没完成,此时获取该实体是否着地将返回默认值True,需要延迟一帧进行获取才能获取到正确的数据 + - 生物处于骑乘状态时,如玩家骑在猪身上,也视作触地 + - 只能获取到本地客户端已加载的实体是否触地,若实体在其他维度或未加载(距离本地玩家太远),将获取失败 + + + +## GetAuxValue + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取射出的弓箭或投掷出的药水的附加值 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | auxValue | + +- 示例 + +```python +self.GetAuxValue() +``` + + + +## GetCurrentAirSupply + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 生物当前氧气储备值 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 生物当前氧气储备值 | + +- 备注 + - 注意:该值返回的是当前氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数) + + + +## GetMaxAirSupply + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取生物最大氧气储备值 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 最大氧气储备值 | + +- 备注 + - 注意:该值返回的是最大氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数) + + + +## SetCurrentAirSupply + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置生物氧气储备值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | data | int | 设置生物当前氧气值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 注意:该值设置的是当前氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数) + +- 示例 + +```python +self.SetCurrentAirSupply(300) +``` + + + +## SetMaxAirSupply + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置生物最大氧气储备值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | data | int | 设置生物最大氧气值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 注意:该值设置的是最大氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数) + +- 示例 + +```python +self.SetMaxAirSupply(400) +``` + + + +## IsConsumingAirSupply + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取生物当前是否在消耗氧气 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否消耗氧气 | + + + +## SetRecoverTotalAirSupplyTime + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置恢复最大氧气量的时间,单位秒 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | timeSec | float | 恢复生物最大氧气值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 注意:当设置的最大氧气值小于(timeSec*10)时,生物每帧恢复氧气量的值为0 + +- 示例 + +```python +self.SetRecoverTotalAirSupplyTime(10) +``` + + + +## GetSourceId + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取抛射物发射者实体id + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 抛射物发射者实体id | + + + +## SetCollisionBoxSize + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体的包围盒 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | size | tuple(float,float) | 第一位表示宽度和长度,第二位表示高度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 对新生产的实体需要经过5帧之后再设置包围盒的大小才会生效 + +- 示例 + +```python +self.SetCollisionBoxSize((2,3)) +``` + + + +## GetCollisionBoxSize + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体的包围盒 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float) | 包围盒大小 | + + + +## SetBlockControlAi + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置屏蔽生物原生AI + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | isBlock | bool | 是否保留AI,False为屏蔽 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 屏蔽AI后的生物无法行动,不受重力且不会被推动。但是可以受到伤害,也可以被玩家交互(例如马被骑或村民被交易) + +- 示例 + +```python +self.SetBlockControlAi(False) +``` + + + +## GetDimensionId + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体所在维度 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 维度id,0-主世界; 1-下界; 2-末地; 或其他自定义维度 | + +- 示例 + +```python +self.GetDimensionId() +``` + + + +## ChangeDimension + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 传送实体 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimensionId | int | 维度id,0-主世界; 1-下界; 2-末地; 或其他自定义维度 | + | pos | tuple(int,int,int) | 传送的坐标,假如输入None,那么就优先选择目标维度的传送门作为目的地,其次使用维度坐标映射逻辑确定目的地 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.ChangeDimension(0, (0,4,0)) +``` + + + +## RemoveEffect + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 为实体删除指定状态效果 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | effectName | str | 状态效果名称字符串,包括自定义状态效果和原版状态效果,原版状态效果可在wiki查询 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True表示删除成功 | + +- 示例 + +```python +res = self.RemoveEffect(entityId, "speed") +``` + + + +## AddEffect + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 为实体添加指定状态效果,如果添加的状态已存在则有以下集中情况:1、等级大于已存在则更新状态等级及持续时间;2、状态等级相等且剩余时间duration大于已存在则刷新剩余时间;3、等级小于已存在则不做修改;4、粒子效果以新的为准 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | effectName | str | 状态效果名称字符串,包括自定义状态效果和原版状态效果,原版状态效果可在wiki查询 | + | duration | int | 状态效果持续时间,单位秒 | + | amplifier | int | 状态效果的额外等级。必须在0至255之间(含)。若未指定,默认为0。注意,状态效果的第一级(如生命恢复 I)对应为0,因此第二级状态效果,如生命回复 II,应指定强度为1。部分效果及自定义状态效果没有强度之分,如夜视 | + | showParticles | bool | 是否显示粒子效果,True显示,False不显示 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True表示设置成功 | + +- 示例 + +```python +res = self.AddEffect("speed", 30, 2, True) +``` + + + +## GetEffects + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体当前所有状态效果 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(dict) | 状态效果信息字典的list | + +- 备注 + - 状态效果信息字典 effectDict + | 关键字 | 数据类型 | 说明 | + | ----------| --------------------- | ---------| + | effectName | str | 状态效果名称 | + | duration | int | 状态效果剩余持续时间,单位秒 | + | amplifier | int | 状态效果额外等级 | + +- 示例 + +```python +effectDictList = self.GetEffects() +``` + + + +## TriggerCustomEvent + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 触发生物自定义事件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 生物Id | + | eventName | str | 事件名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +eventName = "netease:custom_exploading" +self.TriggerCustomEvent(eventName) +``` + + + +## IsAlive + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 判断生物实体是否存活或非生物实体是否存在 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | false表示生物实体已死亡或非生物实体已销毁,true表示生物实体存活或非生物实体存在 | + +- 备注 + - 注意,如果检测的实体所在的区块被卸载,则该接口返回False。因此,需要注意实体所在的区块是否被加载。 + - 区块卸载:游戏只会加载玩家周围的区块,玩家移动到别的区域时,原来所在区域的区块会被卸载,参考[区块介绍](https://zh.minecraft.wiki/w/%E5%8C%BA%E5%9D%97) + +- 示例 + +```python +alive = self.IsEntityAlive() +``` + + + +## GetGravity + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体的重力因子,当生物重力因子为0时则应用世界的重力因子 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 重力因子 | + + + +## SetGravity + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体的重力因子,当生物重力因子为0时则应用世界的重力因子 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | gravity | float | 负数,表示每帧向下的速度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetGravity(-0.08) +``` + + + +## SetHurt + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 对实体造成伤害 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | damage | int | 伤害值 | + | cause | str | 伤害来源,详见Minecraft枚举值文档的ActorDamageCause枚举 | + | attackerId | str | 伤害来源的实体id,默认为None | + | childAttackerId | str | 伤害来源的子实体id,默认为None,比如玩家使用抛射物对实体造成伤害,该值应为抛射物Id | + | knocked | bool | 实体是否被击退,默认值为True | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + + + +## SetImmuneDamage + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体是否免疫伤害(该属性存档) + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | immune | bool | 是否免疫伤害 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetImmuneDamage(True) +``` + + + +## SetModAttr + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置属性值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | paramName | str | 属性名称,str的名称建议以mod命名为前缀,避免多个mod之间冲突 | + | paramValue | any | 属性值,支持python基础数据 | + +- 返回值 + + 无 + +- 备注 + - 注意:tuple、set在同步时会转成list。建议优先使用数字和字符串等非集合类型。 + +- 示例 + +```python +self.SetModAttr('health', 1) +self.SetModAttr('testDict', {'key':'value'}) +``` + + + +## GetModAttr + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取属性值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | paramName | str | 属性名称,str的名称建议以mod命名为前缀,避免多个mod之间冲突 | + | defaultValue | any | 属性默认值,属性不存在时返回该默认值,此时属性值依然未设置 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | any | 返回属性值 | + +- 备注 + - defaultValue不传的时候默认为None + +- 示例 + +```python +# 如果直接修改GetAttr出来的集合类型,需要重新调用一遍SetAttr确保有进行更新 +testDict = self.GetModAttr('testDict') +testDict['key'] = 'newValue' +self.SetModAttr('testDict', testDict) +``` + + + +## RegisterModAttrUpdateFunc + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 注册属性值变换时的回调函数,当属性变化时会调用该函数 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | paramName | str | 监听的属性名称 | + | func | function | 监听的回调函数 | + +- 返回值 + + 无 + +- 备注 + - 回调函数需要接受一个参数,参数是dict,具体数据示例:{'oldValue': 0, 'newValue': 1, 'entityId': ’-433231231231‘} + +- 示例 + +```python +# 这个entityId传的是所需要监听的对象的Id +self.RegisterModAttrUpdateFunc('health', self.jumpingText) +# 当脚本层的health属性变化时则会调用self.jumpingText +def jumpingText(self, data): + entityId = data['entityId'] + oldValue = data['oldValue'] + newValue = data['newValue'] +``` + + + +## UnRegisterModAttrUpdateFunc + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 反注册属性值变换时的回调函数 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | paramName | str | 监听的属性名称 | + | func | function | 监听的回调函数 | + +- 返回值 + + 无 + +- 备注 + - 需要传注册时的同一个函数作为参数 + +- 示例 + +```python +self.UnRegisterModAttrUpdateFunc('health', self.jumpingText) +``` + + + +## GetName + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取生物的自定义名称,即使用命名牌或者SetName接口设置的名称 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 生物的自定义名称 | + + + +## SetName + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 用于设置生物的自定义名称,跟原版命名牌作用相同,玩家和新版流浪商人暂不支持 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetName("new Name") +``` + + + +## SetShowName + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置生物名字是否按照默认游戏逻辑显示 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | show | bool | True为显示 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 返回是否设置成功 | + +- 备注 + - 当设置为True时,生物的名字显示遵循游戏默认的渲染逻辑,即普通生物需要中心点指向生物才显示名字,玩家则是会一直显示名字 + +- 示例 + +```python +# 不显示头上的名字 +self.SetShowName(False) +``` + + + +## SetAlwaysShowName + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置生物名字是否一直显示,瞄准点不指向生物时也能显示 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | show | bool | True为显示 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 返回是否设置成功 | + +- 备注 + - 该接口只对普通生物生效,对玩家设置不起作用 + +- 示例 + +```python +# 不显示头上的名字 +self.SetAlwaysShowName(False) +``` + + + +## SetPersistence + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体是否存盘 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | isPersistent | bool | True为存盘,False为不存盘 | + +- 返回值 + + 无 + +- 备注 + - 实体默认都会存盘。设置为不存盘的实体,在区块卸载与退出游戏时不会存档。 + +- 示例 + +```python +self.SetPersistence(True) +``` + + + +## SetMotion + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置生物的瞬时移动方向向量,服务端只能对非玩家使用,客户端只能对本地玩家使用 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | motion | tuple(float,float,float) | 世界坐标系下的向量,该方向为世界坐标系下的向量,以x,z,y三个轴的正方向为正值,可以通过当前生物的rot组件判断目前玩家面向的方向,可在开发模式下打开F3观察数值变化。 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 使生物向准星的方向突进一段距离 +rot = self.GetEntityRot(entityId) +x, y, z = self.GetDirFromRot(rot) +self.SetMotion((x * 5, y * 5, z * 5)) +# rot 和 世界坐标系关系 +# ^ x -90° +# | +# 180°/-180 ----------> z 0° +# | 90° +``` + + + +## GetMotion + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取生物(含玩家)的瞬时移动方向向量 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(int,int,int) | 瞬时移动方向向量,异常时返回None | + + + +## SetItem + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置生物物品 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | posType | int | ItemPosType枚举 | + | itemDict | dict | 生物身上不同位置的物品信息字典列表,如果传入None将清除当前位置的物品/装备 | + | slotPos | int | 容器槽位 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置成功返回True | + +- 示例 + +```python +itemDict = { + 'itemName': 'minecraft:bow', + 'count': 1, + 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),], + 'auxValue': 0, + 'customTips':'§c new item §r', + 'extraId': 'abc', + 'userData': {}, +} +self.SetItem(serverApi.GetMinecraftEnum().ItemPosType.OFFHAND, None, 0) +``` + + + +## SetCanOtherPlayerRide + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置其他玩家是否有权限骑乘 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | canRide | bool | 是否控制 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetCanOtherPlayerRide(entityId,False) +``` + + + +## SetControl + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置该生物无需装备鞍就可以控制行走跳跃 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | isControl | bool | 是否控制 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetControl(entityId,False) +``` + + + +## SetRidePos + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置生物骑乘位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float) | 骑乘时挂接点 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 示例 + +```python +self.SetRidePos(entityId,(1, 1, 1)) +``` + + + +## SetNotRender + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置是否关闭实体渲染 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | notRender | bool | True表示不渲染该实体 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.SetNotRender(True) # 停止渲染该实体 +``` + + + +## SetCollidable + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体是否可碰撞 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | isCollidable | bool | False:不可碰撞 True:可碰撞 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True表示设置成功 | + +- 示例 + +```python +self.SetCollidable(True) # 设为可碰撞 +``` + + + +## SetHealthColor + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置血条的颜色及背景色, 必须用game组件设置ShowHealthBar时才能显示血条!! + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | front | tuple(float,float,float,float) | 血条颜色的RGBA值,范围0-1 | + | back | tuple(float,float,float,float) | 背景颜色的RGBA值,范围0-1 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | None | 无返回值 | + +- 示例 + +```python +self.SetHealthColor((0, 0, 0, 1), (1, 1, 1, 1)) +``` + + + +## AddAnimation + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 增加生物渲染动画 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | animationKey | str | 动画键 | + | animationName | str | 动画名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +self.AddAnimation("custom_move", "animation.pig.custom_move") +``` + + + +## AddAnimationController + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 增加生物渲染动画控制器 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | animationControllerKey | str | 动画控制器键 | + | animationControllerName | str | 动画控制器名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +self.AddAnimationController("controller__use_item_progress", "controller.animation.humanoid.use_item_progress") +``` + + + +## AddScriptAnimate + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 在生物的客户端实体定义(minecraft:client_entity)json中的scripts/animate节点添加动画/动画控制器 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | animateName | str | 动画/动画控制器名称,如look_at_targe | + | condition | str | 动画/动画控制器控制表达式,默认为空,如query.mod.index > 0 | + | autoReplace | bool | 是否覆盖已存在的动画/动画控制器,默认值为False | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +self.AddScriptAnimate("animation_controller_short_name", "query.mod.index > 0") +``` + + + +## AddParticleEffect + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 增加生物特效资源 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | effectKey | str | 特效资源Key | + | effectName | str | 特效资源名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +self.AddParticleEffect("nectar_dripping", "minecraft:nectar_drip_particle") +``` + + + +## AddRenderController + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 增加生物渲染控制器 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | renderControllerName | str | 渲染控制器名称 | + | condition | str | 渲染控制器条件 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 添加是否成功 | + +- 示例 + +```python +self.AddRenderController('custom_render_controller_name', 'query.mod.condition') +``` + + + +## AddRenderMaterial + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 增加生物渲染需要的材质,调用该接口后需要调用RebuildActorRender才会生效 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | materialKey | str | 材质key | + | materialName | str | 材质名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 添加是否成功 | + +- 示例 + +```python +self.AddRenderMaterial('custom_material_key', 'custom_material_name') +``` + + + +## AddSoundEffect + +客户端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 增加生物音效资源 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | soundKey | str | 音效资源Key | + | soundName | str | 音效资源名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 添加是否成功 | + +- 示例 + +```python +self.AddSoundEffect("sound_thunder", "ambient.weather.thunder") +``` + + + +## SetPushable + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体是否可推动 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | isPushable | bool | False:不可推动 True:可推动 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True表示设置成功 | + +- 示例 + +```python +self.SetPushable(True) +``` + + + +## SetModel + +客户端/服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置骨骼模型 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | modelName | str | 模型名称,值为""时重置模型 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置结果 | + +- 备注 + - 要恢复原版模型请使用ResetModel接口 + - 使用客户端组件更换模型不会同步及存盘,仅是纯客户端表现,如需要同步及存盘,请使用服务器的model组件 + +- 示例 + +```python +self.SetModel("xuenv") +``` + + + +## GetLavaSpeed + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体预设岩浆里的移速 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 岩浆里的移速 | + + + +## SetLavaSpeed + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体预设岩浆里的移速 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | value | float | 岩浆里的移速 | + +- 返回值 + + 无 + + + +## GetMaxLavaSpeed + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 获取实体预设岩浆里的最大移速 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 岩浆里的最大移速 | + + + +## SetMaxLavaSpeed + +服务端 + +method in Preset.Model.Entity.EntityObject.EntityObject + +- 描述 + + 设置实体预设岩浆里的最大移速 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | value | float | 岩浆里的最大移速 | + +- 返回值 + + 无 + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/实体预设EntityPreset.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/实体预设EntityPreset.md new file mode 100644 index 0000000..34f3b21 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/实体预设EntityPreset.md @@ -0,0 +1,50 @@ +--- +sidebarDepth: 1 +--- +# 实体预设EntityPreset + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +PresetBase <|-- EntityPreset +link PresetBase "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E9%A2%84%E8%AE%BE%E5%9F%BA%E7%B1%BBPresetBase.html" +EntityObject <|-- EntityPreset +link EntityObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E5%AE%9E%E4%BD%93%E5%AF%B9%E8%B1%A1EntityObject.html" +SdkInterface <|-- PresetBase +link SdkInterface "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDK%E6%8E%A5%E5%8F%A3%E5%B0%81%E8%A3%85SdkInterface.html" +TransformObject <|-- PresetBase +link TransformObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E5%8F%98%E6%8D%A2%E5%AF%B9%E8%B1%A1TransformObject.html" +GameObject <|-- TransformObject +link GameObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E6%B8%B8%E6%88%8F%E5%AF%B9%E8%B1%A1GameObject.html" +EntityPreset: 实体预设 +EntityObject: 实体对象 +EntityObject: (点击跳转) +PresetBase: 预设基类 +PresetBase: (点击跳转) +GameObject: 游戏对象 +GameObject: (点击跳转) +TransformObject: 变换对象 +TransformObject: (点击跳转) +SdkInterface: SDK接口封装 +SdkInterface: (点击跳转) +``` + +- 描述 + + EntityPreset(实体预设)是一类特殊的预设,实体预设通常会绑定MC的某类实体,实体预设实例与MC的某一个实体绑定,因此可以使用实体预设来进行一些实体相关的逻辑的编程。如果玩家同时启用了多个AddOn,且这些AddOn中均包含与同一种MC原版实体绑定的实体预设,那么只会加载第一个这种实体预设。 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | engineTypeStr | str | 实体的类型ID | + | entityId | str | 实体ID | + | updateTransformInterval | int | 实体预设子节点的变换更新间隔,0表示永不更新 | + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/文字面板对象TextboardObject.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/文字面板对象TextboardObject.md new file mode 100644 index 0000000..894a796 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/文字面板对象TextboardObject.md @@ -0,0 +1,321 @@ +--- +sidebarDepth: 1 +--- +# 文字面板对象TextboardObject + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +SdkInterface <|-- TextboardObject +link SdkInterface "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDK%E6%8E%A5%E5%8F%A3%E5%B0%81%E8%A3%85SdkInterface.html" +TextboardObject: 文字面板对象 +SdkInterface: SDK接口封装 +SdkInterface: (点击跳转) +``` + +- 描述 + + TextboardObject(文字面板对象)是对文字面板对象封装的基类,为文字面板提供了面向对象方法 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | textboardId | int | 关联文字面板ID | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [SetBindEntity](#setbindentity) | 客户端 | 文字面板绑定实体对象 | +| [SetPos](#setpos) | 客户端 | 修改文字面板预设位置 | +| [SetRot](#setrot) | 客户端 | 修改旋转角度, 若设置了文本朝向相机,则旋转角度的修改不会生效 | +| [SetScale](#setscale) | 客户端 | 内容整体缩放 | +| [SetText](#settext) | 客户端 | 修改文字面板内容 | +| [SetColor](#setcolor) | 客户端 | 修改字体颜色 | +| [SetBackgroundColor](#setbackgroundcolor) | 客户端 | 修改背景颜色 | +| [SetFaceCamera](#setfacecamera) | 客户端 | 设置是否始终朝向相机 | +| [SetBoardDepthTest](#setboarddepthtest) | 客户端 | 设置是否开启深度测试, 默认状态下是开启 | + + + + +## SetBindEntity + +客户端 + +method in Preset.Model.Textboard.TextboardObject.TextboardObject + +- 描述 + + 文字面板绑定实体对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | bindEntityId | str | 绑定entity的Id; 如果为None,则为取消实体绑定, 此时下面参数为世界坐标和旋转 | + | offset | tuple(float,float,float) | 相对于实体的偏移量 | + | rot | tuple(float,float,float) | 相对于实体的偏移角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 返回是否设置成功 | + +- 示例 + +```python +self.SetBindEntity(self.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0)) +``` + + + +## SetPos + +客户端 + +method in Preset.Model.Textboard.TextboardObject.TextboardObject + +- 描述 + + 修改文字面板预设位置 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float) | 坐标 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 返回是否设置成功 | + +- 示例 + +```python +self.SetPos((0.0, 3.0, 0.0)) +``` + + + +## SetRot + +客户端 + +method in Preset.Model.Textboard.TextboardObject.TextboardObject + +- 描述 + + 修改旋转角度, 若设置了文本朝向相机,则旋转角度的修改不会生效 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | rot | tuple(float,float,float) | 角度(不是弧度) | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 返回是否设置成功 | + +- 示例 + +```python +self.SetRot((45.0, 90.0, 0.0)) +``` + + + +## SetScale + +客户端 + +method in Preset.Model.Textboard.TextboardObject.TextboardObject + +- 描述 + + 内容整体缩放 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | scale | tuple(float,float) | x,y方向上的缩放值,要求值大于0,正常状态下是(1.0,1.0) | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 返回是否设置成功 | + +- 示例 + +```python +self.SetScale((2.0, 2.0)) +``` + + + +## SetText + +客户端 + +method in Preset.Model.Textboard.TextboardObject.TextboardObject + +- 描述 + + 修改文字面板内容 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | text | str | 文字内容 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否修改成功 | + +- 示例 + +```python +self.SetText("修改后的文字") +``` + + + +## SetColor + +客户端 + +method in Preset.Model.Textboard.TextboardObject.TextboardObject + +- 描述 + + 修改字体颜色 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | textColor | tuple(float,float,float,float) | 颜色的RGBA值,范围0-1 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 返回是否设置成功 | + +- 示例 + +```python +self.SetColor((1.0, 1.0, 0.0, 0.8)) +``` + + + +## SetBackgroundColor + +客户端 + +method in Preset.Model.Textboard.TextboardObject.TextboardObject + +- 描述 + + 修改背景颜色 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | backgroundColor | tuple(float,float,float,float) | 颜色的RGBA值,范围0-1 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 返回是否设置成功 | + +- 示例 + +```python +self.SetBackgroundColor((1.0, 1.0, 1.0, 1.0)) +``` + + + +## SetFaceCamera + +客户端 + +method in Preset.Model.Textboard.TextboardObject.TextboardObject + +- 描述 + + 设置是否始终朝向相机 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | faceCamera | bool | 是否始终朝向相机, 默认为True | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 返回是否设置成功 | + +- 示例 + +```python +self.SetFaceCamera(True) +``` + + + +## SetBoardDepthTest + +客户端 + +method in Preset.Model.Textboard.TextboardObject.TextboardObject + +- 描述 + + 设置是否开启深度测试, 默认状态下是开启 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | depthTest | bool | True为开启深度测试,False为不开启 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 返回是否设置成功 | + +- 示例 + +```python +self.SetBoardDepthTest(False) +``` + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/文字面板预设TextboardPreset.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/文字面板预设TextboardPreset.md new file mode 100644 index 0000000..d9ed2e3 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/文字面板预设TextboardPreset.md @@ -0,0 +1,46 @@ +--- +sidebarDepth: 1 +--- +# 文字面板预设TextboardPreset + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +PresetBase <|-- TextboardPreset +link PresetBase "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E9%A2%84%E8%AE%BE%E5%9F%BA%E7%B1%BBPresetBase.html" +TextboardObject <|-- TextboardPreset +link TextboardObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E6%96%87%E5%AD%97%E9%9D%A2%E6%9D%BF%E5%AF%B9%E8%B1%A1TextboardObject.html" +SdkInterface <|-- PresetBase +link SdkInterface "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDK%E6%8E%A5%E5%8F%A3%E5%B0%81%E8%A3%85SdkInterface.html" +TransformObject <|-- PresetBase +link TransformObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E5%8F%98%E6%8D%A2%E5%AF%B9%E8%B1%A1TransformObject.html" +GameObject <|-- TransformObject +link GameObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E6%B8%B8%E6%88%8F%E5%AF%B9%E8%B1%A1GameObject.html" +TextboardPreset: 文字面板预设 +TextboardObject: 文字面板对象 +TextboardObject: (点击跳转) +PresetBase: 预设基类 +PresetBase: (点击跳转) +GameObject: 游戏对象 +GameObject: (点击跳转) +TransformObject: 变换对象 +TransformObject: (点击跳转) +SdkInterface: SDK接口封装 +SdkInterface: (点击跳转) +``` + +- 描述 + + TextboardPreset(文字面板预设)与文字面板实体绑定,以面向对象的形式提供文字面板相关属性修改接口。 + +- 成员变量 + + 无 + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/方块预设BlockPreset.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/方块预设BlockPreset.md new file mode 100644 index 0000000..8db49e0 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/方块预设BlockPreset.md @@ -0,0 +1,77 @@ +--- +sidebarDepth: 1 +--- +# 方块预设BlockPreset + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +PresetBase <|-- BlockPreset +link PresetBase "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E9%A2%84%E8%AE%BE%E5%9F%BA%E7%B1%BBPresetBase.html" +SdkInterface <|-- PresetBase +link SdkInterface "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDK%E6%8E%A5%E5%8F%A3%E5%B0%81%E8%A3%85SdkInterface.html" +TransformObject <|-- PresetBase +link TransformObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E5%8F%98%E6%8D%A2%E5%AF%B9%E8%B1%A1TransformObject.html" +GameObject <|-- TransformObject +link GameObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E6%B8%B8%E6%88%8F%E5%AF%B9%E8%B1%A1GameObject.html" +BlockPreset: 方块预设 +SdkInterface: SDK接口封装 +SdkInterface: (点击跳转) +PresetBase: 预设基类 +PresetBase: (点击跳转) +TransformObject: 变换对象 +TransformObject: (点击跳转) +GameObject: 游戏对象 +GameObject: (点击跳转) +``` + +- 描述 + + BlockPreset(方块预设)是一类绑定方块的预设。由于MC的方块数量巨大,将方块预设与MC的原生方块绑定,尤其是地图中常见的原生方块可能对性能造成重大影响。 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | engineTypeStr | str | 方块类型ID | + | blockId | str | 方块类型数字ID | + | auxValue | int | 附加值 | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [GetEngineTypeStr](#getenginetypestr) | 客户端/服务端 | 获取方块预设的方块类型ID | + + + + +## GetEngineTypeStr + +客户端/服务端 + +method in Preset.Model.Block.BlockPreset.BlockPreset + +- 描述 + + 获取方块预设的方块类型ID + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 方块类型ID | + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/特效对象EffectObject.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/特效对象EffectObject.md new file mode 100644 index 0000000..18916c9 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/特效对象EffectObject.md @@ -0,0 +1,246 @@ +--- +sidebarDepth: 1 +--- +# 特效对象EffectObject + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +SdkInterface <|-- EffectObject +link SdkInterface "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDK%E6%8E%A5%E5%8F%A3%E5%B0%81%E8%A3%85SdkInterface.html" +EffectObject: 特效对象 +SdkInterface: SDK接口封装 +SdkInterface: (点击跳转) +``` + +- 描述 + + EffectObject(特效对象)是对特效对象封装的基类,它为特效提供了面向对象的使用方式。 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | effectId | int | 关联特效ID | + | effectType | str | 关联特效类型,frame/particle | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [Play](#play) | 客户端 | 播放特效,仅客户端有效 | +| [Stop](#stop) | 客户端 | 停止播放特效,仅客户端有效 | +| [BindToEntity](#bindtoentity) | 客户端 | 绑定到实体 | +| [BindToSkeleton](#bindtoskeleton) | 客户端 | 绑定骨骼模型 | +| [SetLoop](#setloop) | 客户端 | 设置特效是否循环播放,默认为否,仅对序列帧有效 | +| [SetDeepTest](#setdeeptest) | 客户端 | 设置序列帧是否透视,默认为否 | +| [SetFaceCamera](#setfacecamera) | 客户端 | 设置序列帧是否始终朝向摄像机,默认为是 | + + + + +## Play + +客户端 + +method in Preset.Model.Effect.EffectObject.EffectObject + +- 描述 + + 播放特效,仅客户端有效 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## Stop + +客户端 + +method in Preset.Model.Effect.EffectObject.EffectObject + +- 描述 + + 停止播放特效,仅客户端有效 + +- 参数 + + 无 + +- 返回值 + + 无 + + + +## BindToEntity + +客户端 + +method in Preset.Model.Effect.EffectObject.EffectObject + +- 描述 + + 绑定到实体 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | bindEntityId | str | 绑定的实体ID | + | offset | tuple(float,float,float) | 绑定的偏移量 | + | rot | tuple(float,float,float) | 绑定的旋转角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.BindToEntity(entityId, (0, 1, 0), (0, 0, 0)) +``` + + + +## BindToSkeleton + +客户端 + +method in Preset.Model.Effect.EffectObject.EffectObject + +- 描述 + + 绑定骨骼模型 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | modelId | int | 绑定的骨骼模型的ID(见model组件的GetModelId) | + | boneName | str | 绑定具体骨骼的名称 | + | offset | tuple(float,float,float) | 绑定的偏移量 | + | rot | tuple(float,float,float) | 绑定的旋转角度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.BindToSkeleton(modelId, "root", (0, 1, 0), (0, 0, 0)) +``` + + + +## SetLoop + +客户端 + +method in Preset.Model.Effect.EffectObject.EffectObject + +- 描述 + + 设置特效是否循环播放,默认为否,仅对序列帧有效 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | loop | bool | True表示循环播放 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 设置为循环播放 +self.SetLoop(True) +``` + + + +## SetDeepTest + +客户端 + +method in Preset.Model.Effect.EffectObject.EffectObject + +- 描述 + + 设置序列帧是否透视,默认为否 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | deepTest | bool | False表示透视,则被物体/方块阻挡时仍然能看到序列帧 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 设置为透视 +self.SetDeepTest(False) +``` + + + +## SetFaceCamera + +客户端 + +method in Preset.Model.Effect.EffectObject.EffectObject + +- 描述 + + 设置序列帧是否始终朝向摄像机,默认为是 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | face | bool | True表示朝摄像机 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +# 设置为不始终朝摄像机 +self.SetFaceCamera(False) +``` + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/特效预设EffectPreset.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/特效预设EffectPreset.md new file mode 100644 index 0000000..5599214 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/特效预设EffectPreset.md @@ -0,0 +1,105 @@ +--- +sidebarDepth: 1 +--- +# 特效预设EffectPreset + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +PresetBase <|-- EffectPreset +link PresetBase "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E9%A2%84%E8%AE%BE%E5%9F%BA%E7%B1%BBPresetBase.html" +EffectObject <|-- EffectPreset +link EffectObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E7%89%B9%E6%95%88%E5%AF%B9%E8%B1%A1EffectObject.html" +SdkInterface <|-- PresetBase +link SdkInterface "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDK%E6%8E%A5%E5%8F%A3%E5%B0%81%E8%A3%85SdkInterface.html" +TransformObject <|-- PresetBase +link TransformObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E5%8F%98%E6%8D%A2%E5%AF%B9%E8%B1%A1TransformObject.html" +GameObject <|-- TransformObject +link GameObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E6%B8%B8%E6%88%8F%E5%AF%B9%E8%B1%A1GameObject.html" +EffectPreset: 特效预设 +SdkInterface: SDK接口封装 +SdkInterface: (点击跳转) +PresetBase: 预设基类 +PresetBase: (点击跳转) +TransformObject: 变换对象 +TransformObject: (点击跳转) +EffectObject: 特效对象 +EffectObject: (点击跳转) +GameObject: 游戏对象 +GameObject: (点击跳转) +``` + +- 描述 + + EffectPreset(特效预设)是一类绑定特效资源的预设。 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | resource | str | 特效json的相对路径,不含后缀.json | + | effectType | str | 特效类型,frame/particle | + | effectId | int | 特效ID | + | auto | bool | 是否自动播放 | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [GetResource](#getresource) | 客户端 | 获取绑定的json资源 | +| [SetResource](#setresource) | 客户端 | 设置绑定的json资源 | + + + + +## GetResource + +客户端 + +method in Preset.Model.Effect.EffectPreset.EffectPreset + +- 描述 + + 获取绑定的json资源 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | json资源相对路径,不含.json后缀 | + + + +## SetResource + +客户端 + +method in Preset.Model.Effect.EffectPreset.EffectPreset + +- 描述 + + 设置绑定的json资源 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | resource | str | json资源相对路径,不含.json后缀 | + +- 返回值 + + 无 + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/玩家对象PlayerObject.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/玩家对象PlayerObject.md new file mode 100644 index 0000000..9efa527 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/玩家对象PlayerObject.md @@ -0,0 +1,1199 @@ +--- +sidebarDepth: 1 +--- +# 玩家对象PlayerObject + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +EntityObject <|-- PlayerObject +link EntityObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E5%AE%9E%E4%BD%93%E5%AF%B9%E8%B1%A1EntityObject.html" +SdkInterface <|-- EntityObject +link SdkInterface "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDK%E6%8E%A5%E5%8F%A3%E5%B0%81%E8%A3%85SdkInterface.html" +PlayerObject: 玩家对象 +SdkInterface: SDK接口封装 +SdkInterface: (点击跳转) +EntityObject: 实体对象 +EntityObject: (点击跳转) +``` + +- 描述 + + PlayerObject(玩家对象)是对玩家对象封装的基类,它为实体提供了面向对象的使用方式。 + +- 成员变量 + + 无 + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [GetPlayerId](#getplayerid) | 客户端/服务端 | 获取玩家预设的玩家ID | +| [IsLocalPlayer](#islocalplayer) | 客户端/服务端 | 判断当前玩家对象是否本地玩家 | +| [IsSneaking](#issneaking) | 服务端 | 是否潜行 | +| [GetHunger](#gethunger) | 服务端 | 获取玩家饥饿度,展示在UI饥饿度进度条上,初始值为20,即每一个鸡腿代表2个饥饿度。 **饱和度(saturation)** :玩家当前饱和度,初始值为5,最大值始终为玩家当前饥饿度(hunger),该值直接影响玩家**饥饿度(hunger)**。
1)增加方法:吃食物。
2)减少方法:每触发一次**消耗事件**,该值减少1,如果该值不大于0,直接把玩家 **饥饿度(hunger)** 减少1。 | +| [SetHunger](#sethunger) | 服务端 | 设置玩家饥饿度。 | +| [SetStepHeight](#setstepheight) | 服务端 | 设置玩家前进非跳跃状态下能上的最大台阶高度, 默认值为0.5625,1的话表示能上一个台阶 | +| [GetStepHeight](#getstepheight) | 服务端 | 返回玩家前进非跳跃状态下能上的最大台阶高度 | +| [ResetStepHeight](#resetstepheight) | 服务端 | 恢复引擎默认玩家前进非跳跃状态下能上的最大台阶高度 | +| [GetExp](#getexp) | 服务端 | 获取玩家当前等级下的经验值 | +| [AddExp](#addexp) | 服务端 | 增加玩家经验值 | +| [GetTotalExp](#gettotalexp) | 服务端 | 获取玩家的总经验值 | +| [SetTotalExp](#settotalexp) | 服务端 | 设置玩家的总经验值 | +| [IsFlying](#isflying) | 服务端 | 获取玩家是否在飞行 | +| [ChangeFlyState](#changeflystate) | 服务端 | 给予/取消飞行能力,并且进入飞行/非飞行状态 | +| [GetLevel](#getlevel) | 服务端 | 获取玩家等级 | +| [AddLevel](#addlevel) | 服务端 | 修改玩家等级 | +| [SetPrefixAndSuffixName](#setprefixandsuffixname) | 服务端 | 设置玩家前缀和后缀名字 | +| [EnableKeepInventory](#enablekeepinventory) | 服务端 | 设置玩家死亡不掉落物品 | +| [AddAnimation](#addanimation) | 客户端 | 增加玩家渲染动画 | +| [SetHealthLevel](#sethealthlevel) | 服务端 | 设置玩家健康临界值,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效.原版默认值为18 | +| [SetStarveLevel](#setstarvelevel) | 服务端 | 设置玩家饥饿临界值,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效。原版默认值为1 | +| [SetNaturalStarve](#setnaturalstarve) | 服务端 | 设置是否开启玩家饥饿掉血,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效.原版默认开启 | +| [SetStarveTick](#setstarvetick) | 服务端 | 设置玩家饥饿掉血速度,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效 | +| [SetNaturalRegen](#setnaturalregen) | 服务端 | 设置是否开启玩家自然恢复 | +| [SetHealthTick](#sethealthtick) | 服务端 | 设置玩家自然恢复速度 | +| [SetMaxExhaustionValue](#setmaxexhaustionvalue) | 服务端 | 设置玩家最大消耗度(maxExhaustion) | +| [SetPickUpArea](#setpickuparea) | 服务端 | 设置玩家的拾取物品范围 | +| [SetJumpable](#setjumpable) | 服务端 | 设置玩家是否可跳跃 | +| [SetMovable](#setmovable) | 服务端 | 设置玩家是否可移动 | +| [AddAnimationController](#addanimationcontroller) | 客户端 | 增加玩家渲染动画控制器 | +| [AddAnimationIntoState](#addanimationintostate) | 客户端 | 在玩家的动画控制器中的状态添加动画 | +| [AddGeometry](#addgeometry) | 客户端 | 增加玩家渲染几何体 | +| [AddParticleEffect](#addparticleeffect) | 客户端 | 增加玩家特效资源 | +| [AddRenderController](#addrendercontroller) | 客户端 | 增加玩家渲染控制器 | +| [AddRenderMaterial](#addrendermaterial) | 客户端 | 增加玩家渲染需要的材质 | +| [AddSoundEffect](#addsoundeffect) | 客户端 | 增加玩家音效资源 | +| [AddTexture](#addtexture) | 客户端 | 增加玩家渲染贴图 | +| [SetSkin](#setskin) | 客户端 | 更换原版自定义皮肤 | + + + + +## GetPlayerId + +客户端/服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 获取玩家预设的玩家ID + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | str | 玩家ID | + + + +## IsLocalPlayer + +客户端/服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 判断当前玩家对象是否本地玩家 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是本地玩家则返回True,否则返回False,服务端也返回False | + + + +## IsSneaking + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 是否潜行 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否潜行 | + +- 示例 + +```python +self.IsSneaking() +``` + + + +## GetHunger + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 获取玩家饥饿度,展示在UI饥饿度进度条上,初始值为20,即每一个鸡腿代表2个饥饿度。 **饱和度(saturation)** :玩家当前饱和度,初始值为5,最大值始终为玩家当前饥饿度(hunger),该值直接影响玩家**饥饿度(hunger)**。
1)增加方法:吃食物。
2)减少方法:每触发一次**消耗事件**,该值减少1,如果该值不大于0,直接把玩家 **饥饿度(hunger)** 减少1。 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 玩家饥饿度 | + +- 示例 + +```python +self.GetPlayerHunger(playerId) +``` + + + +## SetHunger + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家饥饿度。 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | value | float | 饥饿度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetPlayerHunger(playerId, 10) +``` + + + +## SetStepHeight + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家前进非跳跃状态下能上的最大台阶高度, 默认值为0.5625,1的话表示能上一个台阶 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | stepHeight | float | 最大高度,需要大于0 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 备注 + - 为了避免因浮点数误差导致错误,设置的时候通常会增加1/16个方块大小,即0.0625。所以此处我们设置2.0625。游戏中默认值是0.5625,即半格高度。 + - 只对玩家生效,无法修改其它实体该属性 + - 修改后不影响跳跃逻辑及跳跃高度,并不会因此而跳到更高,因此在某些特定情况下,你可以走上方块但跳不上去。 + +- 示例 + +```python +#如果前面放置有两格高的方块,玩家按前进能直接上去,无须跳跃 +self.SetPlayerStepHeight(playerId, 2.0625) +``` + + + +## GetStepHeight + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 返回玩家前进非跳跃状态下能上的最大台阶高度 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 台阶高度 | + + + +## ResetStepHeight + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 恢复引擎默认玩家前进非跳跃状态下能上的最大台阶高度 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + + + +## GetExp + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 获取玩家当前等级下的经验值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | isPercent | bool | 是否为百分比 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | float | 玩家经验值 | + +- 备注 + - 如果设置返回百分比为False,则返回玩家当前等级下经验的绝对值(非当前玩家总经验值)。 + +- 示例 + +```python +print(self.GetExp(False)) +``` + + + +## AddExp + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 增加玩家经验值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | exp | int | 玩家经验值,可设置负数 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 备注 + - 如果设置的exp值为负数,且超过当前等级已有的经验值,调用接口后,该玩家等级不会下降但是经验值会置为最小值 + +- 示例 + +```python +self.AddExp(25) +``` + + + +## GetTotalExp + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 获取玩家的总经验值 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 总经验值,正整数。获取失败的情况下返回-1。 | + +- 示例 + +```python +print(self.GetTotalExp()) +``` + + + +## SetTotalExp + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家的总经验值 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | exp | int | 总经验值,正整数 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 备注 + - 根据总经验值会重新计算等级,该接口可引起等级的变化 + - 内部运算采用浮点数,数值较大时会出现误差 + +- 示例 + +```python +self.SetTotalExp(25) +``` + + + +## IsFlying + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 获取玩家是否在飞行 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True:是 False:否 | + + + +## ChangeFlyState + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 给予/取消飞行能力,并且进入飞行/非飞行状态 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | isFly | bool | 飞行状态,True:飞行模式,False:正常行走模式 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | True:是 False:否 | + +- 示例 + +```python +self.ChangeFlyState(True) +``` + + + +## GetLevel + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 获取玩家等级 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 玩家等级 | + + + +## AddLevel + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 修改玩家等级 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | level | int | 玩家等级,可设置负数 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.AddLevel(2) +``` + + + +## SetPrefixAndSuffixName + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家前缀和后缀名字 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | prefix | str | 前缀内容 | + | prefixColor | str | 前缀内容颜色描述,如 'RED' | + | suffix | str | 后缀内容 | + | suffixColor | str | 后缀内容颜色描述,如 'RED' | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 设置是否成功 | + +- 示例 + +```python +self.SetPrefixAndSuffixName(playerId, "红队", 'RED', '肉盾', 'RED') +``` + + + +## EnableKeepInventory + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家死亡不掉落物品 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | enable | bool | 是否开启“保留物品栏” | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.EnableKeepInventory(True) +``` + + + +## AddAnimation + +客户端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 增加玩家渲染动画 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | animationKey | str | 动画键 | + | animationName | str | 动画名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.AddAnimation("move.arms", "animation.player.move.arms_custom") +``` + + + +## SetHealthLevel + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家健康临界值,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效.原版默认值为18 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | healthLevel | int | 健康临界值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetHealthLevel(16) +``` + + + +## SetStarveLevel + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家饥饿临界值,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效。原版默认值为1 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | starveLevel | int | 饥饿临界值 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetStarveLevel(2)# 饥饿值小于等于2就会进入饥饿掉血状态,默认每隔4秒掉1点血量 +``` + + + +## SetNaturalStarve + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置是否开启玩家饥饿掉血,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效.原版默认开启 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | value | bool | True开启,False关闭 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetNaturalStarve(False)# # 关闭饥饿掉血,即使饥饿值小于饥饿临界值时也不会扣除血量 +``` + + + +## SetStarveTick + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家饥饿掉血速度,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | starveTick | int | 饥饿掉血速度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetStarveTick(40) # 饥饿掉血状态下每隔2(40/20)秒扣除1点血量 +``` + + + +## SetNaturalRegen + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置是否开启玩家自然恢复 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | value | bool | True开启,False关闭 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetNaturalRegen(False) # 关闭自然恢复,即使饥饿值大于健康临界值时也不会恢复血量 +``` + + + +## SetHealthTick + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家自然恢复速度 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | healthTick | int | 自然恢复速度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetHealthTick(40) # 自然恢复状态下每隔2(40/20)秒恢复1点血量 +``` + + + +## SetMaxExhaustionValue + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家最大消耗度(maxExhaustion) + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | value | float | 最大消耗度(maxExhaustion) | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetMaxExhaustionValue(10.0) +``` + + + +## SetPickUpArea + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家的拾取物品范围 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | area | tuple(float,float,float) | 拾取物品范围,传入(0, 0, 0)时视作取消设置 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetPickUpArea((5, 0, 3)) +``` + + + +## SetJumpable + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家是否可跳跃 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | isJumpable | bool | 是否可跳跃,True允许跳跃,False禁止跳跃 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetJumpable(False) +``` + + + +## SetMovable + +服务端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 设置玩家是否可移动 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | isMovable | bool | 是否可移动,True允许移动,False禁止移动 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetMovable(False) +``` + + + +## AddAnimationController + +客户端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 增加玩家渲染动画控制器 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | animationControllerKey | str | 动画控制器键 | + | animationControllerName | str | 动画控制器名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.AddAnimationController("root", "controller.animation.player.root_custom") +``` + + + +## AddAnimationIntoState + +客户端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 在玩家的动画控制器中的状态添加动画 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | animationControllerName | str | 动画控制器名称 | + | stateName | str | 动画控制器名称 | + | animationName | str | 添加的动画名称或动画控制器名称 | + | condition | str | 动画控制表达式 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +self.AddAnimationIntoState("root", "first_person", "first_person_attack_controller_new", "query.mod.index > 0") +``` + + + +## AddGeometry + +客户端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 增加玩家渲染几何体 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | geometryKey | str | 渲染几何体键 | + | geometryName | str | 渲染几何体名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +self.AddGeometry("default", "geometry.player.custom") +``` + + + +## AddParticleEffect + +客户端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 增加玩家特效资源 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | effectKey | str | 特效资源Key | + | effectName | str | 特效资源名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +self.AddParticleEffect("nectar_dripping", "minecraft:nectar_drip_particle") +``` + + + +## AddRenderController + +客户端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 增加玩家渲染控制器 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | renderControllerName | str | 渲染控制器名称 | + | condition | str | 渲染控制器条件 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +self.AddRenderController('custom_render_controller_name', 'query.mod.condition') +``` + + + +## AddRenderMaterial + +客户端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 增加玩家渲染需要的材质 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | materialKey | str | 材质key | + | materialName | str | 材质名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +self.AddRenderMaterial('custom_material_key', 'custom_material_name') +``` + + + +## AddSoundEffect + +客户端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 增加玩家音效资源 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | soundKey | str | 音效资源Key | + | soundName | str | 音效资源名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +self.AddSoundEffect("sound_thunder", "ambient.weather.thunder") +``` + + + +## AddTexture + +客户端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 增加玩家渲染贴图 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | geometryKey | str | 贴图键 | + | geometryName | str | 贴图路径 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 备注 + - 调用该接口后需要调用RebuildPlayerRender才会生效 + +- 示例 + +```python +self.AddTexture("default", "textures/misc/missing_texture") +``` + + + +## SetSkin + +客户端 + +method in Preset.Model.Player.PlayerObject.PlayerObject + +- 描述 + + 更换原版自定义皮肤 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | skin | str | 贴图路径,以textures\models为当前路径的相对路径 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否设置成功 | + +- 示例 + +```python +self.SetSkin("kagura") +``` + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/玩家预设PlayerPreset.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/玩家预设PlayerPreset.md new file mode 100644 index 0000000..26c36a6 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/玩家预设PlayerPreset.md @@ -0,0 +1,56 @@ +--- +sidebarDepth: 1 +--- +# 玩家预设PlayerPreset + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +EntityPreset <|-- PlayerPreset +link EntityPreset "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E5%AE%9E%E4%BD%93%E9%A2%84%E8%AE%BEEntityPreset.html" +PlayerObject <|-- PlayerPreset +link PlayerObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E7%8E%A9%E5%AE%B6%E5%AF%B9%E8%B1%A1PlayerObject.html" +PresetBase <|-- EntityPreset +link PresetBase "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E9%A2%84%E8%AE%BE%E5%9F%BA%E7%B1%BBPresetBase.html" +EntityObject <|-- EntityPreset +link EntityObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E5%AE%9E%E4%BD%93%E5%AF%B9%E8%B1%A1EntityObject.html" +TransformObject <|-- PresetBase +link TransformObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E5%8F%98%E6%8D%A2%E5%AF%B9%E8%B1%A1TransformObject.html" +SdkInterface <|-- PresetBase +link SdkInterface "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDK%E6%8E%A5%E5%8F%A3%E5%B0%81%E8%A3%85SdkInterface.html" +GameObject <|-- TransformObject +link GameObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E6%B8%B8%E6%88%8F%E5%AF%B9%E8%B1%A1GameObject.html" +PlayerPreset: 玩家预设 +PlayerObject: 玩家对象 +PlayerObject: (点击跳转) +EntityPreset: 实体预设 +EntityPreset: (点击跳转) +GameObject: 游戏对象 +GameObject: (点击跳转) +EntityObject: 实体对象 +EntityObject: (点击跳转) +SdkInterface: SDK接口封装 +SdkInterface: (点击跳转) +TransformObject: 变换对象 +TransformObject: (点击跳转) +PresetBase: 预设基类 +PresetBase: (点击跳转) +``` + +- 描述 + + PlayerPreset(玩家预设)是一类特殊的实体预设,玩家预设与玩家实体进行绑定。每个AddOn(编辑器作品)只允许创建一个玩家预设。如果玩家同时启用了多个使用了玩家预设的AddOn,只会加载第一个玩家预设。 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 玩家ID | + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/界面预设UIPreset.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/界面预设UIPreset.md new file mode 100644 index 0000000..3dd8d05 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/界面预设UIPreset.md @@ -0,0 +1,177 @@ +--- +sidebarDepth: 1 +--- +# 界面预设UIPreset + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +PresetBase <|-- UIPreset +link PresetBase "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E9%A2%84%E8%AE%BE%E5%9F%BA%E7%B1%BBPresetBase.html" +TransformObject <|-- PresetBase +link TransformObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E5%8F%98%E6%8D%A2%E5%AF%B9%E8%B1%A1TransformObject.html" +SdkInterface <|-- PresetBase +link SdkInterface "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDK%E6%8E%A5%E5%8F%A3%E5%B0%81%E8%A3%85SdkInterface.html" +GameObject <|-- TransformObject +link GameObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E6%B8%B8%E6%88%8F%E5%AF%B9%E8%B1%A1GameObject.html" +UIPreset: 界面预设 +SdkInterface: SDK接口封装 +SdkInterface: (点击跳转) +PresetBase: 预设基类 +PresetBase: (点击跳转) +TransformObject: 变换对象 +TransformObject: (点击跳转) +GameObject: 游戏对象 +GameObject: (点击跳转) +``` + +- 描述 + + UIPreset(界面预设)是一类绑定界面资源的预设。 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | uiNodeScreen | str | UI画布路径,为"UI文件名.UI画布名"的字符串形式 | + | uiNodeModulePath | str | 继承自ScreenNode的UI逻辑文件模块路径 | + | uiNodeModule | str | 继承自ScreenNode的UI逻辑文件类名 | + | uiName | str | UI名称,需保证在单个addon中唯一 | + | autoCreate | bool | 在界面预设创建完成后是否自动创建UI | + | isHud | bool | 该界面是否屏蔽游戏操作 | + | createUIMethod | str | 创建界面接口 | + | isBindParent | bool | 是否绑定父预设,仅当父预设为实体预设时生效 | + | bindParentOffset | tuple | 当绑定父预设时生效,修改与绑定实体之间的偏移量 | + | bindParentAutoScale | bool | 当绑定父预设时生效,设置已绑定实体的UI是否根据绑定实体与本地玩家间的距离动态缩放 | + | showInEditor | bool | 是否在预设编辑器中创建UI | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [SetUiActive](#setuiactive) | 客户端 | 设置UI激活 | +| [GetUiActive](#getuiactive) | 客户端 | 获取当前UI是否激活 | +| [SetUiVisible](#setuivisible) | 客户端 | 设置UI显隐 | +| [GetUiVisible](#getuivisible) | 客户端 | 获取当前UI是否显示 | +| [GetScreenNode](#getscreennode) | 客户端 | 获取当前ScreenNode实例 | + + + + +## SetUiActive + +客户端 + +method in Preset.Model.UI.UIPreset.UIPreset + +- 描述 + + 设置UI激活 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | active | bool | 是否激活 | + +- 返回值 + + 无 + + + +## GetUiActive + +客户端 + +method in Preset.Model.UI.UIPreset.UIPreset + +- 描述 + + 获取当前UI是否激活 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | UI是否激活 | + + + +## SetUiVisible + +客户端 + +method in Preset.Model.UI.UIPreset.UIPreset + +- 描述 + + 设置UI显隐 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | visible | bool | 是否显示 | + +- 返回值 + + 无 + + + +## GetUiVisible + +客户端 + +method in Preset.Model.UI.UIPreset.UIPreset + +- 描述 + + 获取当前UI是否显示 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | UI是否显示 | + + + +## GetScreenNode + +客户端 + +method in Preset.Model.UI.UIPreset.UIPreset + +- 描述 + + 获取当前ScreenNode实例 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | ScreenNode | 当前ScreenNode实例 | + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/预设基类PresetBase.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/预设基类PresetBase.md new file mode 100644 index 0000000..4b1f16a --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设对象/预设/预设基类PresetBase.md @@ -0,0 +1,598 @@ +--- +sidebarDepth: 1 +--- +# 预设基类PresetBase + + + +## 概述 + +- 继承关系 + +```mermaid +classDiagram +SdkInterface <|-- PresetBase +link SdkInterface "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDK%E6%8E%A5%E5%8F%A3%E5%B0%81%E8%A3%85SdkInterface.html" +TransformObject <|-- PresetBase +link TransformObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E5%8F%98%E6%8D%A2%E5%AF%B9%E8%B1%A1TransformObject.html" +GameObject <|-- TransformObject +link GameObject "../../../../mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E6%B8%B8%E6%88%8F%E5%AF%B9%E8%B1%A1GameObject.html" +PresetBase: 预设基类 +SdkInterface: SDK接口封装 +SdkInterface: (点击跳转) +TransformObject: 变换对象 +TransformObject: (点击跳转) +GameObject: 游戏对象 +GameObject: (点击跳转) +``` + +- 描述 + + PresetBase(预设基类)是所有预设的基类。预设是一类可以被直接放置在场景中的TransformObject(变换对象),并且预设下可以挂接其他TransformObject,可以通过这种方式对游戏逻辑进行简单的封装。在编辑器中放置预设时,会生成预设的虚拟实例,在游戏中生成预设,会生成实例。 + +- 成员变量 + + | 变量名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | presetId | str | 预设文件ID | + | preLoad | bool | 是否预加载 | + | forceLoad | bool | 是否常加载 | + | childPresetInstances | list(PresetBase) | 子预设列表 | + | childPartInstances | list(PartBase) | 子零件列表 | + | dimension | int | 预设所在维度 | + | isAlive | bool | 预设是否存活 | + + + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [GetIsAlive](#getisalive) | 客户端/服务端 | 获取预设的存活状态 | +| [GetGameObjectById](#getgameobjectbyid) | 客户端/服务端 | 获取当前预设节点底下指定ID的游戏对象 | +| [GetGameObjectByEntityId](#getgameobjectbyentityid) | 客户端/服务端 | 获取当前预设节点底下指定实体ID的游戏对象 | +| [GetChildPresets](#getchildpresets) | 客户端/服务端 | 获取当前预设的所有子预设 | +| [GetChildPresetsByName](#getchildpresetsbyname) | 客户端/服务端 | 获取指定名称的所有子预设 | +| [GetChildPresetsByType](#getchildpresetsbytype) | 客户端/服务端 | 获取指定类型的所有子预设 | +| [GetChildObjectByTypeName](#getchildobjectbytypename) | 客户端/服务端 | 获取指定实体ID的游戏对象 | +| [GetChildObjectsByTypeName](#getchildobjectsbytypename) | 客户端/服务端 | 获取指定实体ID的游戏对象 | +| [SetBlockProtect](#setblockprotect) | 服务端 | 设置预设内的所有素材区域的方块保护状态 | +| [Replicate](#replicate) | 客户端/服务端 | 在指定位置坐标下复制当前预设 | +| [RemoveChild](#removechild) | 客户端/服务端 | 移除指定的子节点对象 | +| [AddBoxData](#addboxdata) | 客户端/服务端 | 添加指定的素材数据 | +| [RemoveBoxData](#removeboxdata) | 客户端/服务端 | 移除指定的素材数据 | +| [AddPreset](#addpreset) | 客户端/服务端 | 添加指定预设作为子预设 | +| [RemovePreset](#removepreset) | 客户端/服务端 | 移除指定的子预设 | +| [AddPart](#addpart) | 客户端/服务端 | 添加指定零件作为子零件 | +| [RemovePart](#removepart) | 客户端/服务端 | 移除指定的子零件 | +| [GetPartsByName](#getpartsbyname) | 客户端/服务端 | 获取指定名称的所有子零件 | +| [GetPartByName](#getpartbyname) | 客户端/服务端 | 获取指定名称的第一个子零件 | +| [GetPartsByType](#getpartsbytype) | 客户端/服务端 | 获取指定类型的所有子零件 | +| [GetPartByType](#getpartbytype) | 客户端/服务端 | 获取指定类型的第一个子零件 | +| [RemovePartsByType](#removepartsbytype) | 客户端/服务端 | 移除指定类型的所有子零件 | + + + + +## GetIsAlive + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 获取预设的存活状态 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否存活 | + + + +## GetGameObjectById + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 获取当前预设节点底下指定ID的游戏对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | id | int | 对象ID | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | GameObject | 成功返回游戏对象,失败返回None | + + + +## GetGameObjectByEntityId + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 获取当前预设节点底下指定实体ID的游戏对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 实体ID | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | GameObject | 成功返回游戏对象,失败返回None | + + + +## GetChildPresets + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 获取当前预设的所有子预设 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(PresetBase) | 子预设列表 | + + + +## GetChildPresetsByName + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 获取指定名称的所有子预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 名称 | + | recursive | bool | 是否递归查找,默认为是 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(PresetBase) | 子预设列表 | + + + +## GetChildPresetsByType + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 获取指定类型的所有子预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | classType | str | 类型 | + | recursive | bool | 是否递归查找,默认为是 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(PresetBase) | 子预设列表 | + + + +## GetChildObjectByTypeName + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 获取指定实体ID的游戏对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | classType | str | 指定类型 | + | name | str | 指定名称,可缺省 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | TransformObject | 成功返回游戏对象,失败返回None | + +- 示例 + +```python +self.GetChildObjectByTypeName("PresetDebugPart") +``` + + + +## GetChildObjectsByTypeName + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 获取指定实体ID的游戏对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | classType | str | 指定类型 | + | name | str | 指定名称,可缺省 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | TransformObject | 成功返回游戏对象,失败返回None | + +- 示例 + +```python +self.GetChildObjectsByTypeName("PresetDebugPart") +``` + + + +## SetBlockProtect + +服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 设置预设内的所有素材区域的方块保护状态 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | protect | bool | 保护/取消保护 | + +- 返回值 + + 无 + + + +## Replicate + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 在指定位置坐标下复制当前预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float) | 位置坐标 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PresetBase | 返回复制的预设,失败返回None | + + + +## RemoveChild + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 移除指定的子节点对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | child | TransformObject | 待移除的子对象 | + +- 返回值 + + 无 + + + +## AddBoxData + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 添加指定的素材数据 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | boxData | BoxData | 待添加的素材数据 | + +- 返回值 + + 无 + + + +## RemoveBoxData + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 移除指定的素材数据 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | boxData | BoxData | 待移除的素材数据 | + +- 返回值 + + 无 + + + +## AddPreset + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 添加指定预设作为子预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | preset | PresetBase | 待添加的预设 | + +- 返回值 + + 无 + + + +## RemovePreset + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 移除指定的子预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | preset | PresetBase | 待移除的子预设 | + +- 返回值 + + 无 + + + +## AddPart + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 添加指定零件作为子零件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | part | PartBase | 待添加的零件 | + +- 返回值 + + 无 + + + +## RemovePart + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 移除指定的子零件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | part | PartBase | 待移除的零件 | + +- 返回值 + + 无 + + + +## GetPartsByName + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 获取指定名称的所有子零件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 零件名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(PartBase) | 零件列表 | + + + +## GetPartByName + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 获取指定名称的第一个子零件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 零件名称 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PartBase | 零件/None | + + + +## GetPartsByType + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 获取指定类型的所有子零件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | type | str | 零件类名 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(PartBase) | 零件列表 | + + + +## GetPartByType + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 获取指定类型的第一个子零件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | type | str | 零件类名 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PartBase | 零件/None | + + + +## RemovePartsByType + +客户端/服务端 + +method in Preset.Model.PresetBase.PresetBase + +- 描述 + + 移除指定类型的所有子零件 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | type | str | 零件类名 | + +- 返回值 + + 无 + + + diff --git a/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设管理/PresetApi.md b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设管理/PresetApi.md new file mode 100644 index 0000000..400e199 --- /dev/null +++ b/mcguide/20-玩法开发/14-预设玩法编程/13-PresetAPI/预设管理/PresetApi.md @@ -0,0 +1,581 @@ +--- +sidebarDepth: 1 +--- +# PresetApi + +## 索引 + +| 接口 |
| 描述 | +| --- | --- | --- | +| [CreateTransform](#createtransform) | 客户端/服务端 | 构造变换对象 | +| [GetAllPresets](#getallpresets) | 客户端/服务端 | 获取所有预设 | +| [GetBlockPresetByPosition](#getblockpresetbyposition) | 客户端/服务端 | 获取指定位置的第一个方块预设 | +| [GetGameObjectByEntityId](#getgameobjectbyentityid) | 客户端/服务端 | 获取指定实体ID的游戏对象 | +| [GetGameObjectById](#getgameobjectbyid) | 客户端/服务端 | 获取指定对象ID的游戏对象 | +| [GetGameObjectByTypeName](#getgameobjectbytypename) | 客户端/服务端 | 获取指定类型和名称的第一个游戏对象 | +| [GetGameObjectsByTypeName](#getgameobjectsbytypename) | 客户端/服务端 | 获取指定类型和名称的所有游戏对象 | +| [GetPartApi](#getpartapi) | 客户端/服务端 | 获取零件API | +| [GetPresetByName](#getpresetbyname) | 客户端/服务端 | 获取指定名称的第一个预设 | +| [GetPresetByType](#getpresetbytype) | 客户端/服务端 | 获取指定维度的指定类型的第一个预设 | +| [GetPresetSize](#getpresetsize) | 客户端/服务端 | 根据预设ID获取预设的包围盒大小 | +| [GetPresetsByName](#getpresetsbyname) | 客户端/服务端 | 获取指定名称的所有预设 | +| [GetPresetsByType](#getpresetsbytype) | 客户端/服务端 | 获取指定维度的指定类型的所有预设 | +| [GetTickCount](#gettickcount) | 客户端/服务端 | 获取当前帧数 | +| [LoadPartByModulePath](#loadpartbymodulepath) | 客户端/服务端 | 通过模块相对路径加载零件并实例化 | +| [LoadPartByType](#loadpartbytype) | 客户端/服务端 | 通过类名加载零件并实例化 | +| [SpawnPreset](#spawnpreset) | 服务端 | 在指定维度的指定坐标变换处生成指定预设 | + + + + +## CreateTransform + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 构造变换对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float) | 位置变换 | + | rotation | tuple(float,float,float) | 旋转变换 | + | scale | tuple(float,float,float) | 缩放变换 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | Transform | 生成的变换对象 | + +- 示例 + +```python +# 创建Transform对象 +import Preset.Controller.PresetApi as presetApi +transform = presetApi.CreateTransform((0, 0, 0), (0, 0, 0), (1, 1, 1)) +``` + + + +## GetAllPresets + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 获取所有预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimension | int | 指定维度ID,默认为-1表示所有维度,本参数在客户端调用时无效,客户端只能获取当前维度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(PresetBase) | 预设列表 | + +- 示例 + +```python +import Preset.Controller.PresetApi as presetApi +presets = presetApi.GetAllPresets() +``` + + + +## GetBlockPresetByPosition + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 获取指定位置的第一个方块预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | x | int | X轴坐标 | + | y | int | Y轴坐标 | + | z | int | Z轴坐标 | + | dimension | int | 指定维度ID,默认为-1表示所有维度,本参数在客户端调用时无效,客户端只能获取当前维度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | BlockPreset | 指定位置的第一个方块预设,没有返回None | + +- 示例 + +```python +import Preset.Controller.PresetApi as presetApi +obj = presetApi.GetBlockPresetByPosition(0, 0, 0) +``` + + + +## GetGameObjectByEntityId + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 获取指定实体ID的游戏对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | entityId | str | 指定的实体ID | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | TransformObject | 成功返回游戏对象,失败返回None | + +- 示例 + +```python +import Preset.Controller.PresetApi as presetApi +obj = presetApi.GetGameObjectByEntityId(0) +``` + + + +## GetGameObjectById + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 获取指定对象ID的游戏对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | id | int | 指定的对象ID | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | TransformObject | 成功返回游戏对象,失败返回None | + +- 示例 + +```python +import Preset.Controller.PresetApi as presetApi +obj = presetApi.GetGameObjectById(0) +``` + + + +## GetGameObjectByTypeName + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 获取指定类型和名称的第一个游戏对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | classType | str | 指定类型 (包括预设,零件,素材数据的类型) | + | name | str | 指定名称,可缺省 | + | dimension | int | 指定维度ID,默认为-1表示所有维度,本参数在客户端调用时无效,客户端只能获取当前维度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | TransformObject | 成功返回游戏对象,失败返回None | + +- 示例 + +```python +# 找到第一个实体预设 +import Preset.Controller.PresetApi as presetApi +obj = presetApi.GetGameObjectByTypeName("EntityPreset") +``` + + + +## GetGameObjectsByTypeName + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 获取指定类型和名称的所有游戏对象 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | classType | str | 指定类型 (包括预设,零件,素材数据的类型) | + | name | str | 指定名称,可缺省 | + | dimension | int | 指定维度ID,默认为-1表示所有维度,本参数在客户端调用时无效,客户端只能获取当前维度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(TransformObject) | 变换对象列表 | + +- 示例 + +```python +# 找到第一个实体预设 +import Preset.Controller.PresetApi as presetApi +objects = presetApi.GetGameObjectsByTypeName("EntityPreset") +``` + + + +## GetPartApi + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 获取零件API + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PartBase | 空零件,用于调用零件API | + +- 示例 + +```python +import Preset.Controller.PresetApi as presetApi +partApi = presetApi.GetPartApi() +partApi.LogDebug("debug") +``` + + + +## GetPresetByName + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 获取指定名称的第一个预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 指定名称 | + | dimension | int | 指定维度ID,默认为-1表示所有维度,本参数在客户端调用时无效,客户端只能获取当前维度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PresetBase | 预设/None | + +- 示例 + +```python +import Preset.Controller.PresetApi as presetApi +obj = presetApi.GetPresetByName("name") +``` + + + +## GetPresetByType + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 获取指定维度的指定类型的第一个预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | classType | str | 指定类型 | + | dimension | int | 指定维度ID,默认为-1表示所有维度,本参数在客户端调用时无效,客户端只能获取当前维度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PresetBase | 预设/None | + +- 示例 + +```python +# 获取第一个实体预设 +import Preset.Controller.PresetApi as presetApi +obj = presetApi.GetPresetByType("EntityPreset") +``` + + + +## GetPresetSize + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 根据预设ID获取预设的包围盒大小 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | presetId | str | 预设ID | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float, | float, float) 预设的包围盒大小 | + +- 示例 + +```python +import Preset.Controller.PresetApi as presetApi +size = presetApi.GetPresetSize(presetId) +``` + + + +## GetPresetsByName + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 获取指定名称的所有预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 指定名称 | + | dimension | int | 指定维度ID,默认为-1表示所有维度,本参数在客户端调用时无效,客户端只能获取当前维度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(PresetBase) | 预设列表 | + +- 示例 + +```python +import Preset.Controller.PresetApi as presetApi +obj = presetApi.GetPresetsByName("name") +``` + + + +## GetPresetsByType + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 获取指定维度的指定类型的所有预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | classType | str | 指定类型 | + | dimension | int | 指定维度ID,默认为-1表示所有维度,本参数在客户端调用时无效,客户端只能获取当前维度 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(PresetBase) | 预设列表 | + +- 示例 + +```python +# 获取所有的空预设 +import Preset.Controller.PresetApi as presetApi +obj = presetApi.GetPresetsByType("EmptyPreset") +``` + + + +## GetTickCount + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 获取当前帧数 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | int | 当前帧数 | + +- 示例 + +```python +import Preset.Controller.PresetApi as presetApi +cnt = presetApi.GetTickCount() +``` + + + +## LoadPartByModulePath + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 通过模块相对路径加载零件并实例化 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | modulePath | str | 零件模块相对路径 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PartBase | 实例化后的零件,失败返回None | + +- 示例 + +```python +# 加载内置的世界属性零件 +import Preset.Controller.PresetApi as presetApi +obj = presetApi.LoadPartByModulePath("Preset.Parts.WorldPart") +# 加载自定义零件,需要把Script_xxxxxx,YourPartDir,YourPart替换为你的自定义零件 +import Preset.Controller.PresetApi as presetApi +obj = presetApi.LoadPartByModulePath("Script_xxxxxx.Parts.YourPartDir.YourPart") +``` + + + +## LoadPartByType + +客户端/服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 通过类名加载零件并实例化 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | partType | str | 零件类名 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PartBase | 实例化后的零件,失败返回None | + +- 示例 + +```python +import Preset.Controller.PresetApi as presetApi +obj = presetApi.LoadPartByType("WorldPart") +``` + + + +## SpawnPreset + +服务端 + +method in Preset.Controller.PresetApi + +- 描述 + + 在指定维度的指定坐标变换处生成指定预设 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | presetId | str | 指定预设的文件ID,对应预设对象的属性presetId | + | transform | Transform | 指定的坐标变换(预设对象->通用->坐标变换Transform) | + | dimension | int | 指定的维度ID | + | virtual | bool | 素材是否已实例化到地图,True表示未实例化,会在首次加载该预设时实例化素材到地图存档,False则会忽略所有素材 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | PresetBase | 返回生成的预设,失败返回None | + +- 示例 + +```python +# 内置空预设,特效预设的文件ID分别为EmptyPreset,EffectPreset +import Preset.Controller.PresetApi as presetApi +from Preset.Model.Transform import Transform +preset = presetApi.SpawnPreset("EmptyPreset", Transform(), 0) +``` + + + diff --git a/mcguide/20-玩法开发/15-自定义游戏内容/2-自定义方块/1-JSON组件.md b/mcguide/20-玩法开发/15-自定义游戏内容/2-自定义方块/1-JSON组件.md index 740c1c7..5007b7c 100644 --- a/mcguide/20-玩法开发/15-自定义游戏内容/2-自定义方块/1-JSON组件.md +++ b/mcguide/20-玩法开发/15-自定义游戏内容/2-自定义方块/1-JSON组件.md @@ -10,37 +10,35 @@ time: 分钟 基岩版自定义方块的json结构曾经过多次调整,当填写format_version时,需要按照对应版本的json结构编写components。 -你可以在以下两个版本进行选择: +例如`minecraft:destroy_time`,在1.10.0中为 -- 1.16.0 +```json +"minecraft:destroy_time": { + "value": 4.0 +} +``` - 该版本的components结构详见[bedrock.dev](https://bedrock.dev/zh/docs/1.16.0.0/1.16.0.66/Blocks)。 +而在1.16.0的版本中为 -- 1.10.0 +```json +"minecraft:destroy_time": 4.0 +``` - 该版本的components结构详见[bedrock.dev](https://bedrock.dev/zh/docs/1.12.0.0/1.12.0.28/Blocks)。该版本相比于1.16.0,component的值为一个Json Object,例如`minecraft:destroy_time`,在1.10.0中为 +而在1.19.20以上的版本中为 - ```json - "minecraft:destroy_time": { - "value": 4.0 - } - ``` - - 而在更高的版本中为 - - ```json - "minecraft:destroy_time": 4.0 - ``` - - +```json +"minecraft:destructible_by_mining": { + "seconds_to_destroy": 4.0 +} +``` ## description | 键 | 类型 | 默认值 | 解释 | | ----------------------- | ---- | ------ | ------------------------------------------------------------ | -| identifier | str | | 包括命名空间及物品名。需要全局唯一。
建议使用mod名称作为命名空间 | +| identifier | str | | 包括命名空间及物品名。需要全局唯一。建议使用mod名称作为命名空间 | | register_to_create_menu | bool | false | 是否注册到创造栏 | -| category | str | Nature | 注册到创造栏的分类,可选的值有:
Construction
Nature
Equipment
Items | +| category | str | Nature | 注册到创造栏的分类,可选的值有:
Construction
Nature
Equipment
Items | ## components @@ -56,6 +54,12 @@ time: 分钟 可参考[CustomBlocksMod](../../13-模组SDK编程/60-Demo示例.md#CustomBlocksMod)的customblocks:customblocks_test_ore方块 + + +### minecraft:friction + +可用于设置方块的摩擦力,取值范围为(0.0-0.9)。`注意此摩擦力和原版方块的摩擦力不是同一个摩擦力` + ### minecraft:max_stack_size @@ -70,11 +74,40 @@ time: 分钟 主要用于[挖掘](./2-功能.md#wajue)的功能 + + +### minecraft:destructible_by_mining + +可用于控制挖掘所需的时间。该值的含义与[官方wiki](https://minecraft-zh.gamepedia.com/%E6%8C%96%E6%8E%98#.E6.96.B9.E5.9D.97.E7.A1.AC.E5.BA.A6)的“硬度”一致 + +- 如果设置为 `true`,方块会采用默认的破坏时间。 +- 如果设置为 `false`,方块将不可被挖掘破坏。 +- 如果省略该组件,则方块同样会使用默认的破坏时间。 +- 如果类型为object,则是以下参数: + +| 键 | 类型| 默认值 | 解释| +|------------------|--------|----------------|-------------| +| seconds_to_destroy| 浮点数| `0.0` |设置方块的硬度,实际破坏时间 = 1.5 × seconds_to_destroy。 | + +此组件需要在`format_version`大于等于1.19.20的方块行为中代替[minecraft:destroy_time](./1-JSON组件.md###minecraft:destroy_time)使用。 + +主要用于[挖掘](./2-功能.md#wajue)的功能 + ### minecraft:block_light_emission -可用于设置方块亮度。关于亮度及方块光源可参考[官方wiki](https://minecraft-zh.gamepedia.com/%E4%BA%AE%E5%BA%A6) +可用于设置方块亮度,取值范围为[0, 1]。关于亮度及方块光源可参考[官方wiki](https://minecraft-zh.gamepedia.com/%E4%BA%AE%E5%BA%A6) + +主要用于[亮度](./2-功能.md#liangdu)的功能 + + + +### minecraft:light_emission + +可用于设置方块亮度, 取值范围为[0, 15]。此组件需要在`format_version`大于等于1.19.20的方块行为中代替 +[minecraft:block_light_emission](./1-JSON组件.md###minecraft:block_light_emission)使用。 +关于亮度及方块光源可参考[官方wiki](https://minecraft-zh.gamepedia.com/%E4%BA%AE%E5%BA%A6) 主要用于[亮度](./2-功能.md#liangdu)的功能 @@ -84,6 +117,26 @@ time: 分钟 可用于设置爆炸抗性。原版方块的爆炸抗性见[官方wiki](https://minecraft-zh.gamepedia.com/%E7%88%86%E7%82%B8#.E7.88.86.E7.82.B8.E6.8A.97.E6.80.A7) + + +### minecraft:destructible_by_explosion + +可用于控制挖掘所需的时间。该值的含义与[官方wiki](https://minecraft-zh.gamepedia.com/%E6%8C%96%E6%8E%98#.E6.96.B9.E5.9D.97.E7.A1.AC.E5.BA.A6)的“硬度”一致 + +- 如果设置为 `true`,方块会采用默认的爆炸抗性。 +- 如果设置为 `false`,方块将不可被爆炸破坏。 +- 如果省略该组件,则方块同样会使用默认的爆炸抗性。 +- 如果类型为object,则是以下参数: + +| 键 | 类型| 默认值 | 解释| +|------------------|--------|----------------|-------------| +| explosion_resistance| 浮点数| `0.0` |设置方块的爆炸抗性,实际爆炸抗性 = 5 × explosion_resistance。 | + +此组件需要在`format_version`大于等于1.19.20的方块行为中代替[minecraft:explosion_resistance](./1-JSON组件.md###minecraft:explosion_resistance)使用。 + +原版方块的爆炸抗性见[官方wiki](https://minecraft-zh.gamepedia.com/%E7%88%86%E7%82%B8#.E7.88.86.E7.82.B8.E6.8A.97.E6.80.A7) + + ### minecraft:block_light_absorption @@ -94,12 +147,27 @@ time: 分钟 主要用于[亮度](./2-功能.md#liangdu)的功能 + + +### minecraft:light_dampening + +可用于设置方块吸光程度, 取值范围为[0, 15]。此组件需要在 `format_version`大于等于1.19.20的方块行为中代替[minecraft:block_light_absorption](./1-JSON组件.md###minecraft:block_light_absorption)使用。 +关于亮度及方块光源可参考[官方wiki](https://minecraft-zh.gamepedia.com/%E4%BA%AE%E5%BA%A6) + +主要用于[亮度](./2-功能.md#liangdu)的功能 + ### minecraft:map_color 可用于设置方块显示在地图上的颜色 + + +### minecraft:display_name + +指定语言文件键,用于映射鼠标悬停在物品栏和快捷栏中的方块物品上时显示的文本。如果给定的字符串无法解析为本地字符串,则将显示给定的原始字符串。使用需要方块行为的 `format_version`大于等于1.19.60。 + ### netease:tier @@ -108,11 +176,11 @@ time: 分钟 主要用于[挖掘](./2-功能.md#wajue)的功能 -| 键 | 类型 | 默认值 | 解释 | -| :-------------: | :----: | :----: | :----------------------------------------------------------- | -| digger | string | | 必须设置。表示方块使用此工具挖掘时有速度加成。
可选的值有:
shovel:铲
pickaxe:镐
hatchet:斧
hoe:锄 | -| destroy_special | bool | false | 可选。
当设置为true时,表示只有使用digger设置的工具进行挖掘才会产生掉落物。 | -| level | int | 0 | 可选。
当destroy_special为true时才会生效。表示挖掘所需的工具等级,若手持工具等级小于该值,则不会产生掉落物。
原版工具的等级:
空手/其他非工具物品:0
木制/金制工具:0
石制工具:1
铁制工具:2
钻石工具:3 | +| 键 | 类型 | 默认值 | 解释 | +| :-------------: | :----: | :----: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| digger | string | | 必须设置。表示方块使用此工具挖掘时有速度加成。
可选的值有:
shovel:铲
pickaxe:镐
hatchet:斧
hoe:锄 | +| destroy_special | bool | false | 可选。当设置为true时,表示只有使用digger设置的工具进行挖掘才会产生掉落物。 | +| level | int | 0 | 可选。当destroy_special为true时才会生效。表示挖掘所需的工具等级,若手持工具等级小于该值,则不会产生掉落物。
原版工具的等级:
空手/其他非工具物品:0
木制/金制工具:0
石制工具:1
铁制工具:2
钻石工具:3 | @@ -128,25 +196,25 @@ time: 分钟 可参考[CustomBlocksMod](../../13-模组SDK编程/60-Demo示例.md#CustomBlocksMod)的customblocks_model_flower及customblocks_model_wire方块。 -| 键 | 类型 | 默认值 | 解释 | -| --------- | ------------- | ------ | ------------------------------------------------------------ | -| collision | object或array | | 计算与物体碰撞时用的碰撞盒 | -| clip | object或array | | 计算射线检测时用的碰撞盒。如准心选取及弹射物碰撞。
(那么当该AABB没有体积时,准心与弹射物都会无视这个方块) | +| 键 | 类型 | 默认值 | 解释 | +| --------- | ------------- | ------ | -------------------------------------------------------------------------------------------------------------- | +| collision | object或array | | 计算与物体碰撞时用的碰撞盒 | +| clip | object或array | | 计算射线检测时用的碰撞盒。如准心选取及弹射物碰撞。(那么当该AABB没有体积时,准心与弹射物都会无视这个方块) | 当collision或clip为object时,用于表示恒定大小的单一碰撞盒,结构为: -| 键 | 类型 | 默认值 | 解释 | -| ---- | ------------ | --------- | ---------------------------------- | -| min | array(float) | [0, 0, 0] | min的三个值必须小于等于max的三个值 | -| max | array(float) | [1, 1, 1] | | +| 键 | 类型 | 默认值 | 解释 | +| --- | ------------ | --------- | ---------------------------------- | +| min | array(float) | [0, 0, 0] | min的三个值必须小于等于max的三个值 | +| max | array(float) | [1, 1, 1] | | 当collision或clip为array时,用于可变化的多个碰撞盒的组合,通常用于可变化的自定义方块模型。元素的结构为: -| | 类型 | 默认值 | 解释 | -| ------ | ------------ | --------- | ------------------------------------------------------------ | -| enable | molang | true | 控制是否开启该碰撞箱
目前仅支持is_connect查询,详见[netease:connection](#netease_connection) | -| min | array(float) | [0, 0, 0] | min的三个值必须小于等于max的三个值 | -| max | array(float) | [1, 1, 1] | | +| | 类型 | 默认值 | 解释 | +| ------ | ------------ | --------- | ------------------------------------------------------------------------------------------------ | +| enable | molang | true | 控制是否开启该碰撞箱目前仅支持is_connect查询,详见[netease:connection](#netease_connection) | +| min | array(float) | [0, 0, 0] | min的三个值必须小于等于max的三个值 | +| max | array(float) | [1, 1, 1] | | @@ -158,17 +226,17 @@ time: 分钟 | 键 | 类型 | 默认值 | 解释 | | ---- | ------ | ------ | ----------------------------------------------------- | -| type | string | | direction:四面向方块
facing_direction:六面向方块 | +| type | string | | direction:四面向方块facing_direction:六面向方块 | -### netease:fuel +### netease:fuel - 可燃类物品组件。允许该方块物品作为燃料在熔炉中燃烧 +可燃类物品组件。允许该方块物品作为燃料在熔炉中燃烧 -| 键 | 类型 | 默认值 | 解释 | -| ------- | ------ | ------ | ------------------------------------------------------------ | -| duration| float | 0 | 可填, 该物品可提供的熔炉燃烧时长(秒)。 | +| 键 | 类型 | 默认值 | 解释 | +| -------- | ----- | ------ | ----------------------------------------- | +| duration | float | 0 | 可填, 该物品可提供的熔炉燃烧时长(秒)。 | @@ -180,7 +248,7 @@ time: 分钟 | 键 | 类型 | 默认值 | 解释 | | ----- | ------ | ------ | ------------------------------------------------------------ | -| value | string | | 目前支持的材质有:
opaque:不透明,即“terrain_opaque”材质。默认为此项
alpha:全透明,即“terrain_alpha”材质,如火焰,该材质用于异形方块,用在方块类上但与其他方块重合时会出现闪烁,可以使用no_crop_face_block组件避免闪烁。
blend:半透明,即“terrain_blend”材质,如彩色玻璃。
optionalAlpha:局部透明,与alpha不同,alpha超过一定距离将不渲染,而optionalAlpha不会,能配合no_crop_face_block组件实现原版叶子效果。 | +| value | string | | 目前支持的材质有:
opaque:不透明,即“terrain_opaque”材质。默认为此项
alpha:全透明,即“terrain_alpha”材质,如火焰,该材质用于异形方块,用在方块类上但与其他方块重合时会出现闪烁,可以使用no_crop_face_block组件避免闪烁。
blend:半透明,即“terrain_blend”材质,如彩色玻璃。
optionalAlpha:局部透明,与alpha不同,alpha超过一定距离将不渲染,而optionalAlpha不会,能配合no_crop_face_block组件实现原版叶子效果。 | @@ -192,9 +260,9 @@ time: 分钟 可参考[CustomBlocksMod](../../13-模组SDK编程/60-Demo示例.md#CustomBlocksMod)的customblocks:customblocks_model_flower方块。 -| 键 | 类型 | 默认值 | 解释 | -| ----- | ---- | ------ | ------------------------------------------------------------ | -| value | bool | true | 为true时,生物在方块内会受到窒息伤害
为false时,生物在方块内不会受到窒息伤害 | +| 键 | 类型 | 默认值 | 解释 | +| ----- | ---- | ------ | ------------------------------------------------------------------------------- | +| value | bool | true | 为true时,生物在方块内会受到窒息伤害为false时,生物在方块内不会受到窒息伤害 | @@ -204,22 +272,23 @@ time: 分钟 可参考[CustomBlocksMod](../../13-模组SDK编程/60-Demo示例.md#CustomBlocksMod)的customblocks:customblocks_model_flower方块。 -| 键 | 类型 | 默认值 | 解释 | -| ----- | ---- | ------ | ------------------------------------------------------------ | -| value | bool | false | 为true时,寻路时被当作空气
为false时,寻路时被当作障碍物,并且可在其上方行走 | +| 键 | 类型 | 默认值 | 解释 | +| ----- | ---- | ------ | ------------------------------------------------------------------------------- | +| value | bool | false | 为true时,寻路时被当作空气为false时,寻路时被当作障碍物,并且可在其上方行走 | + ### netease:block_entity 用于给自定义方块添加[自定义方块实体](./4-自定义方块实体.md)。 可参考[CustomBlocksMod](../../13-模组SDK编程/60-Demo示例.md#CustomBlocksMod)的customblocks:customblocks_test_block_entity方块。 -| 键 | 类型 | 默认值 | 解释 | -| ------- | ---- | ------ | ------------------------------------------------------------ | -| tick | bool | false | 为true时,当玩家进入方块tick范围时,该方块每秒会发送**20次**ServerBlockEntityTickEvent事件
为false时,该方块不会发送ServerBlockEntityTickEvent事件 | -| client_tick | bool | false | 为true时,当玩家进入方块tick范围时,该方块每秒会发送**20次**ModBlockEntityTickClientEvent事件
为false时,该方块不会发送ModBlockEntityTickClientEvent事件 | -| movable | bool | true | 为true时,该方块可被粘性活塞拉回
为false时,该方块不可被粘性活塞拉回 | +| 键 | 类型 | 默认值 | 解释 | +| ----------- | ---- | ------ | ------------------------------------------------------------ | +| tick | bool | false | 为true时,当玩家进入方块tick范围时,该方块每秒会发送**20次**ServerBlockEntityTickEvent事件
为false时,该方块不会发送ServerBlockEntityTickEvent事件 | +| client_tick | bool | false | 为true时,当玩家进入方块tick范围时,该方块每秒会发送**20次**ModBlockEntityTickClientEvent事件
为false时,该方块不会发送ModBlockEntityTickClientEvent事件 | +| movable | bool | true | 为true时,该方块可被粘性活塞拉回为false时,该方块不可被粘性活塞拉回 | @@ -227,24 +296,24 @@ time: 分钟 用于给自定义方块定义是否可以随机tick,并且设置该tick事件是否发送到脚本层。 -| 键 | 类型 | 默认值 | 解释 | -| -------------- | ---- | ------ | ------------------------------------------------------------ | -| enable | bool | false | 方块是否随机tick | -| tick_to_script | bool | false | 是否发送事件 BlockRandomTickServerEvent 到python脚本 | +| 键 | 类型 | 默认值 | 解释 | +| -------------- | ---- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| enable | bool | false | 方块是否随机tick | +| tick_to_script | bool | false | 是否发送事件 BlockRandomTickServerEvent 到python脚本 | ### netease:redstone_property 用于给自定义方块设置红石属性 -| 键 | 类型 | 默认值 | 解释 | -| ----- | ---- | ------ | ------------------------------------------------------------ | +| 键 | 类型 | 默认值 | 解释 | +| ----- | ---- | ------ | ----------------------------------------------------------------------------------------------- | | value | str | None | 目前只支持break_on_push,设置之后,方块可以被活塞破坏变成掉落物,否则,方块会被活塞推动而不破坏 | ### netease:neighborchanged_sendto_script -| 键 | 类型 | 默认值 | 解释 | -| ----- | ---- | ------ | ------------------------------------------------------------ | -| value | bool | false | 方块周围环境变化是否发送事件 BlockNeighborChangedServerEvent 到脚本层 | +| 键 | 类型 | 默认值 | 解释 | +| ----- | ---- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| value | bool | false | 方块周围环境变化是否发送事件 BlockNeighborChangedServerEvent 到脚本层 | @@ -266,7 +335,7 @@ time: 分钟 | 名称 | 解释 | | ---------------- | ------------------------------------------------------------ | -| query.is_connect | 传入一个参数,返回该方块与对应临面上的方块是否有connection属性
参数取值与对应的面:
0-down面,1-up面,2-north面,3-south面,4-west面,5-east面。 | +| query.is_connect | 传入一个参数,返回该方块与对应临面上的方块是否有connection属性参数取值与对应的面:
0-down面,
1-up面,
2-north面,
3-south面,
4-west面,
5-east面。 | @@ -283,8 +352,6 @@ time: 分钟 | type | str | | 红石类型:
producer:红石源
consumer:红石机械元件 | | strength | int | 15 | 红石信号值,范围[0,15] | - - ### netease:listen_block_remove @@ -305,11 +372,11 @@ time: 分钟 可参考CustomBlocksMod示例中的customblocks_model_flower -| 键 | 类型 | 默认值 | 说明 | -| --------------- | ------------ | ------ | ------------------------------------------------------------ | -| block | list(str) | | 方块identifier的列表。这些方块的所有[方块状态](../../10-基本概念/1-我的世界基础概念.md#方块状态)都可放置 | -| block_state | list(object) | | [方块状态](../../10-基本概念/1-我的世界基础概念.md#方块状态)的列表。
每个元素只对应一个特定的方块状态,如果方块有多个种类的状态,需要考虑排列组合的所有情况
最终可在上面放置的方块是block字段与block_state字段的并集 | -| spawn_resources | bool | true | 已存在的方块因下方的方块发生改变而被破坏时,是否生成掉落物 | +| 键 | 类型 | 默认值 | 说明 | +| --------------- | ------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| block | list(str) | | 方块identifier的列表。这些方块的所有[方块状态](../../10-基本概念/1-我的世界基础概念.md#方块状态)都可放置 | +| block_state | list(object) | | [方块状态](../../10-基本概念/1-我的世界基础概念.md#方块状态)的列表。每个元素只对应一个特定的方块状态,如果方块有多个种类的状态,需要考虑排列组合的所有情况最终可在上面放置的方块是block字段与block_state字段的并集 | +| spawn_resources | bool | true | 已存在的方块因下方的方块发生改变而被破坏时,是否生成掉落物 | @@ -333,31 +400,31 @@ time: 分钟 可参考CustomBlocksMod示例中的customblocks_slime、customblocks_flower_extend -| 键 | 类型 | 默认值 | 说明 | -| ----- | ---- | ------ | -------- | +| 键 | 类型 | 默认值 | 说明 | +| ---------- | ----- | ------ | -------------- | | properties | array | | 所有属性字符串 | 其中properties数组目前支持以下字符串填充 -| 键 | 说明 | -| ----- |-------- | -| piston_block_grabber | 被活塞推动时是否带动旁边方块 | -| slime | 主要用于变为移动方块(例如被活塞推)时修改对实体力的计算 | -|breaks_when_fallen_on_by_heavy| 当重力方块结束下落在该方块位置后,自身是否被毁坏| +| 键 | 说明 | +| ------------------------------ | -------------------------------------------------------- | +| piston_block_grabber | 被活塞推动时是否带动旁边方块 | +| slime | 主要用于变为移动方块(例如被活塞推)时修改对实体力的计算 | +| breaks_when_fallen_on_by_heavy | 当重力方块结束下落在该方块位置后,自身是否被毁坏 | 如果方块碰撞盒体积使用netease:aabb或minecraft:entity_collision改小可能会导致无法触发(目前可参考范围是边长0.4以下不会触发)。 ### netease:on_stand_on -用于触发实体站在方块上的事件 +用于触发实体站在方块上的事件 可参考CustomBlocksMod示例中的customblocks_slime,利用了该事件组合做出了个模拟原版粘液块的效果。 -| 键 | 类型 | 默认值 | 说明 | -| ----- | ---- | ------ | -------- | +| 键 | 类型 | 默认值 | 说明 | +| ----------------- | ---- | ------ | -------------------- | | send_python_event | bool | | 是否发送事件至python | -当send_python_event为true时,该方块会触发OnStandOnBlockClientEvent、OnStandOnBlockServerEvent事件。 +当send_python_event为true时,该方块会触发OnStandOnBlockClientEvent、OnStandOnBlockServerEvent事件。 如果方块碰撞盒体积使用netease:aabb或minecraft:entity_collision改小可能会导致无法触发(目前可参考范围是边长0.4以下不会触发)。 @@ -383,7 +450,6 @@ time: 分钟 当send_python_event为true时,该方块会触发OnEntityInsideBlockClientEvent、OnEntityInsideBlockServerEvent事件。 - ### netease:on_step_on 用于触发实体刚移动至一个实心方块上的事件 @@ -406,8 +472,8 @@ time: 分钟 该组件会把方块的材质设置为透明,且不可与netease:render_layer的不透明材质一起共用,否则会出现渲染错误 -| 键 | 类型 | 默认值 | 解释 | -| ------- | ------------- | ------ | ------------------------------------------------------------ | +| 键 | 类型 | 默认值 | 解释 | +| ------- | ------------- | ------ | ------------------------------------------------------------------------------ | | x_scope | [float,float] | [0,0] | x轴方向的偏移范围,size为2的array,取值范围为0.0~1.0,如果两个值相同则为指定点 | | z_scope | [float,float] | [0,0] | z轴方向的偏移范围,size为2的array,取值范围为0.0~1.0,如果两个值相同则为指定点 | @@ -423,14 +489,26 @@ time: 分钟 使用SetBlockNew接口创建自定义箱子的时候,需要先调用一次SetBlockNew将目标位置方块设置为Air,再使用AddTimer延后调用SetBlockNew创建自定义箱子 -| 键 | 类型 | 默认值 | 解释 | -| ------------------ | ---- | ------ | ------------------------------------------------------------ | -| custom_description | str | | 箱子UI上面显示的箱子名称,不填为空 | -| chest_capacity | int | | 必填,箱子的容量行数,取值范围1-8,如果can_pair取值为true且该值大于4,将自动变为4 | -| can_pair | bool | false | 是否可以与隔壁箱子组合,合成一个大箱子 | +| 键 | 类型 | 默认值 | 解释 | +| ------------------ | ---- | ------ | ------------------------------------------------------------------------------------------ | +| custom_description | str | | 箱子UI上面显示的箱子名称,不填为空 | +| chest_capacity | int | | 必填,箱子的容量行数,取值范围1-8,如果can_pair取值为true且该值大于4,将自动变为4 | +| can_pair | bool | false | 是否可以与隔壁箱子组合,合成一个大箱子 | | is_shulker_box | bool | false | 是否为潜影盒箱子,如果开启摧毁方块将不会掉落,与原版潜影盒功能相同,无法与隔壁箱子进行组合 | -| mute | bool | true | 是否关闭箱子开启与关闭时的音效 | -| can_be_blocked | bool | false | 是否能被阻挡,即箱子上面有阻挡的方块时能否打开箱子 | +| mute | bool | true | 是否关闭箱子开启与关闭时的音效 | +| can_be_blocked | bool | false | 是否能被阻挡,即箱子上面有阻挡的方块时能否打开箱子 | + + + +### netease:block_container + +[自定义容器](./3-特殊方块/11-自定义容器.md)组件,使用时需要将base_block设为netease_container。相比[netease:block_chest](#netease-block-chest),该组件支持使用资源包UI Json配置方块打开后的UI界面,方便开发者制作自定义熔炉等界面,而无需考虑复杂的交互逻辑,数据同步逻辑等。 + +| 键 | 类型 | 默认值 | 解释 | +| ------------------ | ---- | ----- | ------------------------------------------ | +| custom_description | str | | 容器ui打开时的title(复用原版ui时生效) | +| screen_name | str | | 交互方块时打开的ui,形如namespace.screenName | +| container_size | int | | 方块容器能够存放的物品槽位数量,取值范围1-108,需与ui槽位匹配。若ui槽位大于配置容量,超过配置的部分无法放入物品;若ui槽位小于配置容量,按shift可放入,但无法在ui中显示 | @@ -459,3 +537,4 @@ time: 分钟 | 键 | 类型 | 默认值 | 解释 | | ----- | ---- | -------- | -------------- | | value | str | 物品名称 | 物品的描述信息 | + diff --git a/mcguide/20-玩法开发/15-自定义游戏内容/2-自定义方块/3-特殊方块/11-自定义容器.md b/mcguide/20-玩法开发/15-自定义游戏内容/2-自定义方块/3-特殊方块/11-自定义容器.md new file mode 100644 index 0000000..972c143 --- /dev/null +++ b/mcguide/20-玩法开发/15-自定义游戏内容/2-自定义方块/3-特殊方块/11-自定义容器.md @@ -0,0 +1,309 @@ +--- +hard: 入门 +time: 分钟 +--- + +# 自定义容器 + +## 概述 + +该功能类似自定义箱子,使用原生c++驱动背包界面,实现自定义容器界面的方块。 +包含长按分堆、双击合堆、右键拖放等功能,方块破坏后内部物品会掉落,方便开发者制作自定义熔炉等界面,而无需考虑复杂的UI逻辑,数据同步逻辑等。 + +## base_block新增netease_container + +base_block指定现在可以指定为netease_container + +## netease:block_container + +| 键 | 类型 | 默认值 | 解释 | +| ----- | ---- | -------- | -------------- | +| custom_description | str | 容器名 | 容器ui打开时的title(复用原版ui时生效)| +| screen_name | str | ui名 | 交互方块时打开的ui,形如namespace.screenName | +| container_size | int | 容器容量 | 方块容器能够存放的物品槽位数量,取值范围1-108,需与ui槽位匹配。若ui槽位大于配置容量,超过配置的部分无法放入物品;若ui槽位小于配置容量,按shift可放入,但无法在ui中显示 | + +### 注意事项 + +- netease_container的size限定为1-108,不在该范围会导致注册失败,需在组件中配置 + +- netease_ui_container的size为108,ui中如果指定了大于108的slot将无法放入物品,无需配置 + +## 自定义容器事件 + +1. PlayerTryPutCustomContainerItemServerEvent事件,玩家尝试改变自定义容器物品时触发该事件,开发者可以监听该事件实现其他逻辑 + +## 示例 + +自定义容器方块配置: + +```json +{ + "format_version": "1.16.100", + "minecraft:block": { + "components": { + "netease:block_container": { + "custom_description": "自定义方块容器", + "screen_name": "netease_container.netease_custom_container_screen", // 交互该方块时打开的ui + "container_size": 27 // 关闭后保存在方块中的容器size,对应ui中的netease_container扩展写法 + } + }, + "description": { + "base_block": "netease_container", + "category": "construction", + "identifier": "test:my_custom_container" + } + } +} +``` + +ui配置: +> 此处以原版箱子的json为基础进行修改 + +注意: +- collection_name指定为netease_container + +- ui的grid空格数量如果大于组件中设置的size,那超出的那一部分无法放置物品 + +```json +{ + "namespace": "netease_container", + "test_collection": { + "type": "stack_panel", + "size": [ "100%", "100%c" ], + "controls": [ + { + "row_1": { + "type": "stack_panel", + "orientation": "horizontal", + "size": [ "100%", "100%cm" ], + "collection_name": "netease_container", + "controls": [ + { + "a@netease_container.custom_grid_item": { + "collection_index": 27 + } + }, + { + "padding": { + "type": "panel", + "size": [ 4, 0 ] + } + }, + { + "b@netease_container.custom_grid_item": { + "collection_index": 28 + } + } + ] + } + }, + { + "padding_1": { + "type": "panel", + "size": [ "100%", 4 ] + } + }, + { + "row_2": { + "type": "stack_panel", + "orientation": "horizontal", + "size": [ "100%", "100%cm" ], + "collection_name": "netease_container", + "controls": [ + { + "c@netease_container.custom_grid_item": { + "collection_index": 29 + } + }, + { + "padding": { + "type": "panel", + "size": [ 4, 0 ] + } + }, + { + "d@netease_container.custom_grid_item": { + "collection_index": 30 + } + } + ] + } + }, + { + "padding_2": { + "type": "panel", + "size": [ "100%", 4 ] + } + } + ] + }, + "custom_grid_item@common.container_item": { + "$item_collection_name": "netease_container" + }, + "custom_drop_grid_item@common.container_item": { + "$item_collection_name": "netease_ui_container" + }, + "netease_custom_container_grid": { + "type": "grid", + "size": [ 162, "100.0%c" ], + "anchor_from": "top_left", + "anchor_to": "top_left", + "grid_dimensions": [ 9, 3 ], + "grid_item_template": "netease_container.custom_grid_item", + "collection_name": "netease_container", + "maximum_grid_items": 27 + }, + "netease_drop_container_grid": { + "type": "grid", + "size": [ 162, "100.0%c" ], + "anchor_from": "top_left", + "anchor_to": "top_left", + "grid_dimensions": [ 9, 2 ], + "grid_item_template": "netease_container.custom_drop_grid_item", + "collection_name": "netease_ui_container", + "maximum_grid_items": 18 + }, + "container_label": { + "type": "label", + "offset": [ 7, -1 ], + "anchor_from": "top_left", + "anchor_to": "top_left", + "text": "$container_title", + "size": [ "90%", "default" ], + "color": "$title_text_color", + "layer": 2 + }, + "selected_item_details@common.selected_item_details": { + "offset": [ 0, 0 ] + }, + "netease_custom_container_panel_top_half": { + "type": "panel", + "size": [ "100%", "100.0%c" ], + "offset": [ 0, 11 ], + "anchor_to": "top_left", + "anchor_from": "top_left", + "controls": [ + { + "container_label@netease_container.container_label": {} + }, + { + "netease_custom_container_grid1@netease_container.netease_custom_container_grid": { + "offset": [ 7, 10 ] + } + }, + { + "netease_custom_container_grid2@netease_container.netease_drop_container_grid": { + "offset": [ 7, 70 ] + } + } + ] + }, + "netease_custom_container_panel": { + "type": "panel", + "controls": [ + { + "container_gamepad_helpers@common.container_gamepad_helpers": {} + }, + { + "flying_item_renderer@common.flying_item_renderer": { + "layer": 11 + } + }, + { + "selected_item_details_factory@common.selected_item_details_factory": { + "control_name": "@netease_container.selected_item_details" + } + }, + { + "item_lock_notification_factory@common.item_lock_notification_factory": { + "control_name": "@common.item_lock_notification" + } + }, + { + "root_panel@common.root_panel": { + "size": [ 176, 220 ], + "layer": 1, + "controls": [ + { + "common_panel@common.common_panel": { + "size": [ "100%", "100.0%c" ], + "$dialog_background|default": "common.dialog_background_opaque", + "controls": [ + { + "bg_image@$dialog_background": { + "size": [ "100%", "100.0%c+-37.0px" ], + "layer": 1, + "controls": [ + { + "chest_panel": { + "type": "panel", + "layer": 5, + "size": [ "100%", "100.0%c+-7.0px" ], + "controls": [ + { + "netease_custom_container_panel_top_half@netease_container.netease_custom_container_panel_top_half": {} + }, + { + "inventory_panel_bottom_half_with_label@common.inventory_panel_bottom_half_with_label": {} + }, + { + "hotbar_grid@common.hotbar_grid_template": {} + } + ] + } + }, + { + "inventory_selected_icon_button@common.inventory_selected_icon_button": {} + }, + { + "gamepad_cursor@common.gamepad_cursor_button": {} + }, + { + "close@common.close_button": { + "layer": "$close_button_layer", + "offset": "$close_button_offset", + "ignored": "$use_compact_close_button" + } + }, + { + "compact_close@common.compact_close_button": { + "layer": "$close_button_layer", + "offset": "$close_button_offset", + "ignored": "(not $use_compact_close_button)" + } + } + ], + "bindings": [ + { + "binding_name": "$close_button_visible_binding_name", + "binding_name_override": "#visible" + } + ] + } + } + ] + } + } + ] + } + } + ] + }, + "netease_custom_container_screen@common.inventory_screen_common": { + "$close_on_player_hurt|default": true, + "close_on_player_hurt": "$close_on_player_hurt", + "variables": [ + { + "requires": "$desktop_screen", + "$screen_content": "netease_container.netease_custom_container_panel", + "$screen_bg_content": "common.screen_background", + "$screen_background_alpha": 0.4 + }, + { + "requires": "$pocket_screen", + "$screen_content": "netease_container_pocket.netease_custom_container_panel" + } + ] + } +} +``` \ No newline at end of file diff --git a/mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.md b/mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.md index 1bed52e..6649f41 100644 --- a/mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.md +++ b/mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.md @@ -500,23 +500,23 @@ resource_pack/models/entity/squirrel.geo.json ```json "render_controllers": [ - { "controller.render.player.first_person": "variable.is_first_person" }, - { "controller.render.player.third_person": "!variable.is_first_person && !variable.map_face_icon" }, - { "controller.render.player.map": "variable.map_face_icon" }, - { "controller.render.player.first_person_bloom": "variable.is_first_person" }, - { "controller.render.player.third_person_bloom": "!variable.is_first_person && !variable.map_face_icon" } + {"controller.render.player.first_person_spectator": "variable.is_first_person && query.is_spectator"}, + {"controller.render.player.third_person_spectator": "!variable.is_first_person && !variable.map_face_icon && query.is_spectator"}, + {"controller.render.player.first_person": "variable.is_first_person && !query.is_spectator"}, + {"controller.render.player.third_person": "!variable.is_first_person && !variable.map_face_icon && !query.is_spectator"}, + {"controller.render.player.map": "variable.map_face_icon"} ], ``` 在render_controllers数组中,玩家存在五个渲染控制器。 | 渲染控制器名称 | 渲染控制器应用条件 | 说明 | -| ------------------------------------------- | ---------------------------------------------------- | -------------------------------- | -| controller.render.player.first_person | variable.is_first_person | 第一人称时该渲染控制器生效 | -| controller.render.player.third_person | !variable.is_first_person && !variable.map_face_icon | 非第一人称下同时非地图图标下生效 | -| controller.render.player.map | variable.map_face_icon | 地图图标模式下生效 | -| controller.render.player.first_person_bloom | variable.is_first_person | 第一人称时该渲染控制器生效 | -| controller.render.player.third_person_bloom | !variable.is_first_person && !variable.map_face_icon | 非第一人称下同时非地图图标下生效 | +| ------------------------------------------- | ---------------------------------------------------- | -------------------------------- | +| controller.render.player.first_person_spectator | variable.is_first_person && query.is_spectator | 第一人称且旁观者模式下该渲染控制器生效 | +| controller.render.player.third_person_spectator | !variable.is_first_person && !variable.map_face_icon && query.is_spectator | 非第一人称、非地图图标、旁观者模式下生效 | +| controller.render.player.first_person | variable.is_first_person && !query.is_spectator | 第一人称且非旁观者模式下生效 | +| controller.render.player.third_person | !variable.is_first_person && !variable.map_face_icon && !query.is_spectator | 非第一人称、非地图图标、非旁观者模式下生效 | +| controller.render.player.map | variable.map_face_icon | 地图图标下生效 | **其中,以上五个渲染控制器在渲染过程中并不保证顺序。** diff --git a/mcguide/20-玩法开发/15-自定义游戏内容/picture/custom_command6.png b/mcguide/20-玩法开发/15-自定义游戏内容/picture/custom_command6.png new file mode 100644 index 0000000..3b2445b Binary files /dev/null and b/mcguide/20-玩法开发/15-自定义游戏内容/picture/custom_command6.png differ diff --git a/mcguide/20-玩法开发/18-性能优化/images/after_optimization.png b/mcguide/20-玩法开发/18-性能优化/images/after_optimization.png new file mode 100644 index 0000000..9b9620e Binary files /dev/null and b/mcguide/20-玩法开发/18-性能优化/images/after_optimization.png differ diff --git a/mcguide/20-玩法开发/18-性能优化/images/before_optimization.png b/mcguide/20-玩法开发/18-性能优化/images/before_optimization.png new file mode 100644 index 0000000..185ec80 Binary files /dev/null and b/mcguide/20-玩法开发/18-性能优化/images/before_optimization.png differ diff --git a/mcguide/20-玩法开发/18-性能优化/代码优化.md b/mcguide/20-玩法开发/18-性能优化/代码优化.md new file mode 100644 index 0000000..18429b2 --- /dev/null +++ b/mcguide/20-玩法开发/18-性能优化/代码优化.md @@ -0,0 +1,659 @@ +--- +front: https://nie.res.netease.com/r/pic/20210728/2dc2a94f-71f6-4cc5-8700-3c3696f79a0c.jpg +hard: 进阶 +time: 30分钟 +--- + +# 代码优化 + +## 前言 + +本文介绍了基于Python 2的一些常用技巧,能够优化代码,提升程序运行效率。 + +## 使用缓存(内存换CPU) + +对象的重复创建与销毁会有一定性能消耗,对于需要频繁使用的数据,建议保存起来,下次从内存取出来直接使用,是一种常用的空间换时间(内存换CPU)的优化手段,对于减少游戏卡顿有较好效果。 + +### 避免在tick函数内使用import + +import模块的消耗并没有小到可以忽略的地步,建议挪到文件的顶部进行import。如果这样会导致循环引用,则可以将模块缓存为类的成员变量 + +- 错误写法: + +```python +class DemoClientSystem(ClientSystem): + def Update(self): + # 在每帧执行的逻辑内import模块 + import mod.client.extraClientApi as clientApi + clientApi.xxx +``` + +- 正确写法: + +```python +# 在文件顶部import模块 +import mod.client.extraClientApi as clientApi +class DemoClientSystem(ClientSystem): + def Update(self): + clientApi.xxx +``` + +如果两个模块需要相互引用,那么同时在文件顶部import对方,会导致循环引用报错,则可以用下面的方法处理: + +```python +class DemoClientSystem(ClientSystem): + def __init__(self, namespace, systemName): + ClientSystem.__init__(self, namespace, systemName) + # 假设当前模块与另一个otherModule模块需要相互引用 + import demoScripts.client.otherModule as otherModule + self.otherModule = otherModule + + def Update(self): + self.otherModule.xxx +``` + +### 避免多次初始化常量 + +- 错误写法: + +在频繁调用的函数中进行声明,例如每次Update的时候 + +```python +class DemoClientSystem(ClientSystem): + def Update(self): + # 常量,每帧创建,实际中可能这里会是比较多的数据 + bigDict = { + (-1, -1): 1, + (-1, 0): 2, + (-1, 1): 3, + (0, -1): 4, + (0, 0): 5, + (0, 1): 6, + (1, -1): 7, + (1, 0): 8, + (1, 1): 9, + } + # 读取常量做一些逻辑 + do_something(bigDict) +``` + +- 正确写法: + +包含数据比较多的一些常量,特别是List或者Dict类型的,可以放到类的__init__函数当中 + +```python +class DemoClientSystem(ClientSystem): + # 构造函数 + def __init__(self, namespace, systemName): + ClientSystem.__init__(self, namespace, systemName) + # 在初始化时创建 + self.bigDict = { + (-1, -1): 1, + (-1, 0): 2, + (-1, 1): 3, + (0, -1): 4, + (0, 0): 5, + (0, 1): 6, + (1, -1): 7, + (1, 0): 8, + (1, 1): 9, + } + + def Update(self): + do_something(self.bigDict) +``` + +### 缓存多次用到的中间数据 + +一些方法多次调用的返回值是一样,可以使用临时变量缓存,不需要重复调用 + +- 错误写法: +```python +class DemoServerSystem(ServerSystem): + # 监听的ServerItemUseOnEvent事件回调 + def ServerItemUseOnEvent(self, args): + # 设置多个方块 + self.SetBlock(args['dimensionId'], (args['x']-1, args['y'], args['z']), 'minecraft:air') + self.SetBlock(args['dimensionId'], (args['x']-1, args['y'], args['z']), 'minecraft:air') + self.SetBlock(args['dimensionId'], (args['x'], args['y'], args['z']), 'minecraft:air') + self.SetBlock(args['dimensionId'], (args['x'], args['y'], args['z']-1), 'minecraft:air') + self.SetBlock(args['dimensionId'], (args['x'], args['y'], args['z']+1), 'minecraft:air') + + def SetBlock(self, dimensionId, pos, blockName): + serverApi.GetEngineCompFactory().CreateBlockInfo(levelId).SetBlockNew(pos, {'name': blockName}, 0, dimensionId) +``` + +- 正确写法: + +```python +# compFactory使用缓存 +serverCompFactory = serverApi.GetEngineCompFactory() +class DemoServerSystem(ServerSystem): + # 监听的ServerItemUseOnEvent事件回调 + def ServerItemUseOnEvent(self, args): + # 对字典内的值做缓存 + dimensionId = args['dimensionId'] + x = args['x'] + y = args['y'] + z = args['z'] + self.SetBlock(dimensionId, (x-1, y, z), 'minecraft:air') + self.SetBlock(dimensionId, (x-1, y, z), 'minecraft:air') + self.SetBlock(dimensionId, (x, y, z), 'minecraft:air') + self.SetBlock(dimensionId, (x, y, z-1), 'minecraft:air') + self.SetBlock(dimensionId, (x, y, z+1), 'minecraft:air') + + def SetBlock(self, dimensionId, pos, blockName): + serverCompFactory.CreateBlockInfo(levelId).SetBlockNew(pos, {'name': blockName}, 0, dimensionId) +``` + +### 使用dict代替多个else if + +当条件判断的分支很多时,dict跳转的性能会比一连串的else高很多。如果一定要用if,推荐把命中概率较高的判断放前面。 + +- 错误写法: + +```python +serverCompFactory = serverApi.GetEngineCompFactory() +class DemoServerSystem(ServerSystem): + def HandleBlocks(self, pos, dimensionId): + # 获取方块信息 + blockIdentifier = serverCompFactory.CreateBlockInfo(levelId).GetBlockNew(pos, dimensionId)[0] + # 根据方块类型做出不同的处理 + if blockIdentifier == "minecraft:iron_ore": + self.handleIronBlock() + elif blockIdentifier == "minecraft:gold_ore": + self.handleGoldBlock() + elif blockIdentifier == "minecraft:diamond_ore": + self.handleDiamondBlock() + ... +``` + +- 正确写法: + +```python +serverCompFactory = serverApi.GetEngineCompFactory() +class DemoServerSystem(ServerSystem): + def __init__(self): + # 注册处理函数 + self.blockHandlers = { + "minecraft:iron_ore": self.handleIronBlock, + "minecraft:gold_ore": self.handleGoldBlock, + "minecraft:diamond_ore": self.handleDiamondBlock, + } + + def HandleBlocks(self, data): + blockIdentifier = serverCompFactory.CreateBlockInfo(levelId).GetBlockNew(pos, dimensionId)[0] + # 从dict中选取处理函数 + handler = self.blockHandlers.get(blockIdentifier) + if handler: + handler() +``` + +## 使用分帧(实时性换CPU) + +同一时刻内处理大量的逻辑,容易造成卡顿。这时候需要把逻辑执行的时间错开到多帧去执行,让每一帧的任务量不要太重。 + +### 大批量修改数据分多帧处理 + +这里以方块为例: + +- 错误写法: (同一时刻全部处理,需要处理 100 * 100 * 100 即一百万个方块,必然会卡) + +```python +# 修改某个区域 100 * 100 * 100范围内的方块为空气 +def SetBlocksToAir(self, fromPos): + blockcomp = serverApi.CreateComponent(id, "Minecraft", "blockInfo") + for x in range(1, 100): + for y in range(1, 100): + for z in range(1, 100): + blockcomp.SetBlockNew((fromPos[0] + x, fromPos[1] + y, fromPos[2] + z), {'name':'minecraft:air'}) +``` + +- 正确写法: (分开每帧只处理5个) + +```python +# 修改某个区域 100 * 100 * 100范围内的方块为空气 +def SetBlocksToAir(self, fromPos): + # 命令队列 + self.posList = [] + self.posIndex = 0 + + for x in range(1, 100): + for y in range(1, 100): + for z in range(1, 100): + self.posList.append((fromPos[0] + x, fromPos[1] + y, fromPos[2] + z)) + +# 被引擎直接执行的父类的重写函数,引擎会执行该Update回调,1秒钟30帧 +def Update(self): + if self.posList: + posListLen = len(self.posList) + blockcomp = serverApi.CreateComponent(id, "Minecraft", "blockInfo") + #每帧处理5个 + handleNum = 5 + while(handleNum > 0 and self.posIndex < posListLen): + blockcomp.SetBlockNew(self.posList[self.posIndex], {'name':'minecraft:air'}) + self.posIndex = self.posIndex + 1 + handleNum = handleNum - 1 + + # 全部处理完成 + if self.posIndex >= posListLen: + self.posList = None +``` + +### 非重要逻辑降帧处理 + +不要每帧执行所有逻辑更新,不同的逻辑实际中根据实时性要求进行间隔更新 + +- 错误写法: +(每帧执行所有更新逻辑) +```python +def Update(self): + self.do_something1() + self.do_something2() + self.do_something3() +``` + +- 正确写法: +(分开每帧只处理5个) +```python +class DemoClientSystem(ClientSystem): + # 构造函数 + def __init__(self, namespace, systemName): + ClientSystem.__init__(self, namespace, systemName) + self.tick = 0 + + def Update(self): + self.tick = self.tick + 1 + # 重要逻辑每帧执行 + self.do_something1() + + if self.tick % 5 == 0: + # 次要逻辑降帧执行 + self.do_something2() + + if self.tick % 10 == 0: + # 更次要的逻辑,使用更低的帧率执行 + self.do_something3() +``` + +### 少用轮询逻辑 + +使用事件或一些适用的接口来代替每帧尝试的操作。 + +假想有一个需求:我想删除一个实体,但是当前这个实体没有被加载 + +- 错误写法: + + 每帧尝试删除该实体,直到成功为止 + +- 推荐写法: + + 1. 监听AddEntityServerEvent,在该实体的回调中删除。 + 2. 如果该实体是手动创建的,可以使用SetPersistence接口将其设置为不存盘,那就不再需要处理该实体被卸载而无法删除的情况。 + +## 优化字节码 + +Python 是解释型语言,代码在运行时会先编译为字节码(Bytecode),再由解释器逐行执行字节码,优化字节码可以直接提升执行效率。 + +### 使用推导式 + +如果要对容器进行操作,使用推导式是最快的办法。在可以使用列表/字典/集合推导式时,尽量使用推导式,而不是使用for循环。 + +**列表添加元素:** + +```python +a = [] +for i in xrange(1000): + if i % 2 == 0: + a.append(i*i) +``` + +**缓存append方法:** + +```python +a = [] +l = a.append +for i in xrange(1000): + if i % 2 == 0: + l(i*i) +``` + +**列表推导式:** + +```python +a = [i*i for i in xrange(1000) if i % 2 == 0] +``` + +**测试样例:** + +```python +from timeit import timeit +print "loop + append:", timeit("for i in xrange(1000):\n if i % 2 == 0:\n a.append(i*i)", "a=[]", number=10000) +print "loop + append(cache):", timeit("for i in xrange(1000):\n if i % 2 == 0:\n l(i*i)", "a=[];l=a.append", number=10000) +print "list comprehenshion:", timeit("a = [i*i for i in xrange(1000) if i % 2 == 0]", number=10000) +``` + +**测试结果:** + +```python +loop + append: 0.6161811 +loop + append(cache): 0.5132234 +list comprehenshion: 0.4063318 +``` + +**结论:** + +列表推导式,能获得明显的性能提升,元素越多差距越明显。 + +还有**字典推导式:** + +```python +g = (('a',1),('b',2),('c',3),('d',4),('e',5),('f',6)) +d = {k:v for k, v in g if v % 2 == 0} +``` + +**集合推导式:** + +```python +g = (1,2,3,4,5,6) +s = {v for v in g if v % 2 == 0} +``` + +### 字符串拼接 + +我们有很多办法拼接字符串,比如直接相加、使用format、使用%、使用join,那么到底哪种办法最快呢? + +**常见写法:** + +```python +s = s1 + s2 + s3 + +s = s1; s += s2; s += s3 + +s = '%s%s%s' % (s1,s2,s3) + +s = ''.join((s1,s2,s3)) +``` + +**测试样例1:** + +```python +from timeit import timeit +N = 10000000 +setup = 's1="hello"*35; s2="world"*25; s3="!"*30; s4=s3*2; s5=s3*2' +print(timeit("s = s1 + s2 + s3", setup, number=N)) +print(timeit("s = s1; s+=s2; s+=s3", setup, number=N)) +print(timeit("s = '%s%s%s' % (s1,s2,s3)", setup, number=N)) +print(timeit("s = '{}{}{}'.format(s1,s2,s3)", setup, number=N)) +print(timeit("s = ''.join((s1,s2,s3))", setup, number=N)) +``` + +**测试结果1:** + +```python +0.7396258 +0.8553558 +1.5691264 +3.8130296 +1.0085892 +``` + +**测试样例2:** + +```python +from timeit import timeit +N = 10000000 +setup = 's1="hello"*35; s2="world"*25; s3="!"*30; s4=s3*2; s5=s3*2' +print(timeit("s = s1 + s2 + s3 + s4 + s5", setup, number=N)) +print(timeit("s = s1; s+=s2; s+= s3; s+= s4; s+= s5", setup, number=N)) +print(timeit("s = '%s%s%s%s%s' % (s1,s2,s3,s4,s5)", setup, number=N)) +print(timeit("s = '{}{}{}{}{}'.format(s1,s2,s3,s4,s5)", setup, number=N)) +print(timeit("s = ''.join((s1,s2,s3,s4,s5))", setup, number=N)) +``` + +**测试结果2:** + +```python +1.4091635 +1.6201083 +3.4721674 +4.6679361 +1.2252783 +``` + +**结论:** + +- 要拼接的子串数量较少时(如不多于3个),直接相加是最快的 +- 当拼接的子串数量较多时,`join`方法是最快的 +- 如果只是想纯粹拼接一下字符串,不要使用格式化方法 + +### 变量访问 + +局部变量访问速度最快,其次是全局变量。如果要访问对象的属性,比如self.client.aaa.bbb中出现了三个点,而每一个点代表一次访问,就会多消耗一次性能。建议在频繁使用时缓存为局部变量。 + +```python +# 缓存为全局变量CF,减少了一次访问 +CF = serverApi.GetEngineCompFactory() +def OnCustomCommandTrigger(self, args): + # 在循环前,将api方法缓存为局部变量 + createExplosion = CF.CreateExplosion(levelId).CreateExplosion + for _ in xrange(1000): + createExplosion(...)# 直接调用 + + # 将自己的方法/属性缓存为局部变量 + func = self.xxxsystem.aaa.bbb + for _ in xrange(1000): + func(...) +``` + +### 字典查询 + +字典的查询属于属性访问中的一个特例。取字典中特定key的值,如取不到返回None,可有下列写法: + +```python +def get1(d, key): + if key in d: + return d[key] + return None + +def get2(d, key): + if d.has_key(key): + return d[key] + return None + +def get3(d, key): + return d.get(key) + +def get4(d, key): + return d.get(key, None) + +def get5(d, key): + try: + return d[key] + except KeyError: + pass +``` + +**测试样例:** + +```python +g_d = {"a": 23, "b": 11, "c": 88, "d": 2, "e": 3, "f": 4, "g": 11, "h": 25, "i": 46} +from timeit import timeit +print(timeit('get1(g_d, "b")', 'from __main__ import get1, g_d', number=100000)) +print(timeit('get2(g_d, "b")', 'from __main__ import get2, g_d', number=100000)) +print(timeit('get3(g_d, "b")', 'from __main__ import get3, g_d', number=100000)) +print(timeit('get4(g_d, "b")', 'from __main__ import get4, g_d', number=100000)) +print(timeit('get5(g_d, "b")', 'from __main__ import get5, g_d', number=100000)) + +print(timeit('get1(g_d, "z")', 'from __main__ import get1, g_d', number=100000)) +print(timeit('get2(g_d, "z")', 'from __main__ import get2, g_d', number=100000)) +print(timeit('get3(g_d, "z")', 'from __main__ import get3, g_d', number=100000)) +print(timeit('get4(g_d, "z")', 'from __main__ import get4, g_d', number=100000)) +print(timeit('get5(g_d, "z")', 'from __main__ import get5, g_d', number=100000)) +``` + +结果分命中、不命中两种情况汇总: + +| 单位:ms/1w次 | 命中 | 不命中 | +| --------- | -------- | -------- | +| get1 | 1.17 | **1.05** | +| get2 | 1.59 | 1.43 | +| get3 | 1.62 | 1.59 | +| get4 | **1.75** | 1.80 | +| get5 | **1.04** | **9.01** | + +从这个表可以看到,get1用in来判断,平均表现是最好的,是否命中,都是1ms多一点。而最后这个try except,命中的时候是最佳的,不命中的时候性能就大幅恶化。 + +**结论:** + +- 对于key是否存在,直接用in来做判断即可,has_key接口比in慢。当然in方法不止可以对字典用,也可以对任何iterable的对象用,python是动态语言,要清楚你in的对象到底是什么。 +- get的default参数不必填None,因为它本来就是None,填进去反而更慢。 + +### 函数调用 + +函数调用是有额外开销的,效率敏感场合不容忽略。 + +**测试样例:** + +```python +log = lambda msg: None + +def foo(msg): + log(msg) + +from timeit import timeit +print(timeit('foo("hello")', 'from __main__ import foo', number=100000)) +print(timeit('log("hello")', 'from __main__ import log', number=100000)) +``` + +**测试结果:** + +```python +0.0104322 +0.0051873 +``` + +**结论:** + +python里1万次的函数调用的消耗,约1毫秒的量级。在效率敏感场合,尽量省去不必要的几行代码的函数包装,减少调用层级,以及减少默认参数个数。 + +### 方法调用 + +类与实例方法的调用和函数调用类似,封装太多也会有明显的效率下降,而且情况可能更严重。 + +**测试样例:** + +```python +# -*- coding: gbk -*- +import time +# 定义时间测量装饰器 +def time_it(func): + def wrapper(*args, **kwargs): + start_time = time.time() + result = func(*args, **kwargs) + end_time = time.time() + print "函数 {} 耗时: {:.0f} 毫秒".format(func.__name__, (end_time - start_time) * 1000) + return result + return wrapper +def show_warn(message): + pass +HP_TH = 10 +class Player(object): + def __init__(self): + self.hp = 0 + self.hp_th = HP_TH + def tick(self): + if self.hp < self.hp_th: + self.perform_warn() + def perform_warn(self): + show_warn("warn") +class Player2(object): + def __init__(self): + self.hp = 0 + self.hp_th = HP_TH + def tick(self): + if self.hp < self.hp_th: + show_warn("warn") +# 性能测试 +if __name__ == "__main__": + N = 10000 + # 测试 Player 类 + players = [] + for _ in xrange(N): + players.append(Player()) + @time_it + def run(n): + for _ in xrange(n): + for p in players: + p.tick() + run(100) + # 测试 Player2 类 + players = [] + for _ in xrange(N): + players.append(Player2()) + @time_it + def run2(n): + for _ in xrange(n): + for p in players: + p.tick() + run2(100) +``` + +**测试结果:** + +```python +函数 run 耗时: 274 毫秒 +函数 run2 耗时: 168 毫秒 +``` + +可见,减少一层方法调用后,耗时274ms能降到168ms。 + +**结论:** + +为了效率的话,请尽量避免过多的类方法封装;同一实例方法的频繁调用,请先缓存下来(如第一个例子中的l=a.append) + +### 模块导入 + +关于import写在什么地方,我们都知道,写在模块开头,有这么一些弊端: + +- 首次加载卡顿 +- 内存过多 +- 带来冗余 +- 循环引用 + +但写在函数内就一定是最好的办法吗? + +**测试样例:** + +```python +def tick(): + from packageA.subpackageA import math + math.fabs(100) + +from packageA.subpackageA import math +def tick2(): + math.fabs(100) + +from timeit import timeit +print timeit("tick()", "from __main__ import tick", number=100000) +print timeit("tick2()", "from __main__ import tick2", number=100000) + +# 假设把tick函数移到另一个package下(packageB/test.py): +print timeit("tick()", "from packageB.test import tick", number=100000) +``` + +**测试结果:** + +```python +0.1006268 +0.0177434 +0.1125192 +``` + +可见,函数内import明显要慢很多,尤其是在另外一个package里面import。 + +**结论:** + +基础性/通用性模块的导入,import写在模块头,当然前提是这些基础模块要做好规划,不要过于臃肿,不要互相耦合严重。 + +对于频繁调用的函数,函数开头不适宜有太多import,package结构也不宜搞得过于复杂。 \ No newline at end of file diff --git a/mcguide/20-玩法开发/18-性能优化/着色器优化.md b/mcguide/20-玩法开发/18-性能优化/着色器优化.md new file mode 100644 index 0000000..1ccaa4b --- /dev/null +++ b/mcguide/20-玩法开发/18-性能优化/着色器优化.md @@ -0,0 +1,222 @@ +--- +front: https://nie.res.netease.com/r/pic/20210728/5a263f49-e1f3-4a9a-96b3-307b11848590.png +hard: 进阶 +time: 30分钟 +--- + +# Shader优化 + +## 前言 + +为了做出更加炫酷的效果,我们往往会自定义材质,然后定义自己的Shader,或者直接重写替换原版Shader,特别是目前的很多光影MOD,基本都需要对Shader进行修改。Shader与GPU性能密切相关,Shader写得好能让配置不是很高的玩家也能流畅体验炫酷的效果。写得不好,则可能导致高端机也很卡。 + +## 尽量少用 if else 条件语句 + +GPU是并行处理逻辑的,采用SIMD(单指令多数据)结构, 同一段代码,同一时刻会被多个GPU的处理单元同时处理,这段代码的执行耗时取决于会被执行到的时间最长的代码。为了充分发挥GPU的并行性,我们尽量少用条件分支逻辑,让所有GPU处理单元都执行相同的代码。 + +if else的写法如果底下逻辑不多,大部分可以合并,则常常可以改用step()函数进行优化 + +step(a,b)的功能为: +```glsl +若b >= a则返回1,否则返回0 +``` + +所以如果有这么一个写法: +```glsl +if(r >= 0.5) +{ + r = 0.6; +}else{ + r = 0.4; +} +``` + +则应该写成: +```glsl +r = 0.4 + step(0.5, r) * (0.6 - 0.4); +``` + +逻辑上相当于若r >= 0.5 ,则: +```glsl +r = 0.4 + 1 * 0.2 = 0.6; +``` +否则r < 0.5,则: +```glsl +r = 0.4 + 0 * 0.2 = 0.4; +``` +由此即可消去if else语句。 + + +- 错误写法: +(if else大量使用) +```python + // 简单的卡通着色例子,把连续的颜色值映射到几个特殊的离散的值上面 + //根据传入的颜色值取得一个新的颜色值, 这里为了展示简单,我们用仅用一个通道进行举例 + void main() + { + color.r = getNewRedColor(color.r); + ...(省略无关代码) + } + float getNewRedColor(float r) + { + float newR; + if(r >= 0.6) + { + newR = 0.8; + }else if(r >= 0.3) + { + newR = 0.5; + }else{ + newR = 0.1; + } + return newR; + } +``` + +- 正确写法: +(分开每帧只处理5个) +```python + // 简单的卡通着色例子,把连续的颜色值映射到几个特殊的离散的值上面 + //根据传入的颜色值取得一个新的颜色值, 这里为了展示简单,我们用仅用一个通道进行举例 + void main() + { + color.r = getNewRedColor(color.r); + ...(省略无关代码) + } + float getNewRedColor(float r) + { + float newR = 0.0; + newR = newR + step(0.6, r) * 0.8; + newR = newR + step(0.3, r) * step(r, 0.6) * 0.5; + newR = newR + step(r, 0.3) * 0.1; + return newR; + } +``` + +## 循环语句 + +for, while这类的循环语句内部实现其实也会有条件判断if else语句,并行性比较低,所以如果可以不用尽量不用,但这并不是让大家去复制粘贴多少次代码,这没有意义,则是尽量从逻辑上避免循环逻辑的出现,如果实在需要使用,则建议循环体内不要做太多耗性能的操作。 +除此之外,循环变量一定要记得初始化!变量的初始值在不同设备上有时候是不一样的, 比如int的初始值并不一定在所有设备上都是0。 + +- 错误写法: +(循环变量i没有初始化) +```python + for(int i; i < 5; i ++) + { + func(); + } +``` +在一些设备上i的值会被初始化为0,循环5次没有问题。但在一些设备上,i的默认值可能是一个没有意义的数,甚至是负数!例如是−2147483648,上面循环则会循环超级多次,玩家会直接卡到动不了。 + +- 正确写法: +(分开每帧只处理5个) +```python + //这里i一定要给一个默认值 + for(int i = 0; i < 5; i ++) + { + func(); + } +``` + +## 精美贴图开关 + +开关在游戏中的位置:设置->视频->精美贴图 +开发者可根据玩家是否开启精美贴图执行不一样的shader逻辑。这里需要声明两个文件,materials/sad.json 和 materials/fancy.json。我们先看下原版中两个文件的内容: +```python + sad.json: + [ + {"path":"materials/sad.material"}, + {"path":"materials/entity.material"}, + {"path":"materials/terrain.material"}, + {"path":"materials/portal.material"}, + {"path":"materials/barrier.material"}, + {"path":"materials/wireframe.material"} + ] + + fancy.json: + [ + {"path":"materials/fancy.material", "+defines":["FANCY"]}, + {"path":"materials/entity.material", "+defines":["FANCY"]}, + {"path":"materials/terrain.material", "+defines":["FANCY"]}, + {"path":"materials/hologram.material"}, + {"path":"materials/portal.material", "+defines":["FANCY"]}, + {"path":"materials/barrier.material"}, + {"path":"materials/wireframe.material"} + ] +``` + +开启精美贴图的时候会加载下面的材质,不开启的话加载上面的材质。我们用一个材质进行举例,比如sad和fancy中都有的terrain.material材质,fancy中不同在于额外定义了FANCY字段,则在Shader中可以这样写: +```python + void main() + { +#ifdef FANCY + //这里可以做更多的逻辑,渲染更好的效果 + renderBeautiful(); +#else + // 这里是关闭了精美贴图,这里不应该执行过多逻辑,只需要提供简单的显示效果就可以了 + renderSimple(); +#endif + } +``` + +## 降低精度 + +通常来说,我们写的shader不需要过于关注精度,因为大部分情况下性能瓶颈不在这里,但一些过于复杂,大部分玩家都说卡的MOD,建议可以考虑在精度方面做一些优化。 + +shader中变量精度越低,GPU运算越快,精度分为3档,关键字分别为: +```glsl +低:lowp +中:mediump +高:highp +``` + +int(整数):建议256内的整数使用lowp, 1024内的整数使用mediump,其它情况则使用highp +float(浮点):建议256内的浮点数使用lowp, 16384内的浮点数使用mediump,其它情况则使用highp + +默认精度: +```glsl +顶点着色器中float, int均为highp +像素着色器中int为mediump,float根据设备不同无默认精度 +``` +声明方法例子(直接把精度关键字加在变量类型前面): +```glsl +lowp float color +``` + +## 移除无用变量与逻辑 + +部分开发者编写Shader的时候可能会偷下懒,从自己以前写的代码里面复制粘贴过来,但这部分代码可能有很多逻辑或者变量都没有用上,导致大量的运算是无意义浪费性能的,需要去掉。 + +- 错误写法: +(包含大量无用逻辑) +```python + void main() + { + //这里声明多个变量,又或许是从其它地方复制过来,具体值先省略 + A = ...; + B = ...; + C = ...; + + //这里只用了变量A;B和C都没有用到 + DoSomeThingWithA(A); + return; + } +``` + +- 正确写法: +(删除无用逻辑) +```python + void main() + { + //只留下A,把其它没用上的都删除掉 + A = ...; + + //这里只用了变量A;B和C都没有用到 + DoSomeThingWithA(A); + return; + } +``` + +## 分级做多个MOD版本 + +开发者可根据Shader复杂度上架不同版本,举个例子,例如可以有“网易光影低配版”, “网易光影高配版”,玩家看名字就大概知道对性能有不同的要求了,让玩家下载时自行选择。 \ No newline at end of file diff --git a/mcguide/20-玩法开发/18-性能优化/配置文件优化.md b/mcguide/20-玩法开发/18-性能优化/配置文件优化.md new file mode 100644 index 0000000..f9533de --- /dev/null +++ b/mcguide/20-玩法开发/18-性能优化/配置文件优化.md @@ -0,0 +1,177 @@ +--- +front: https://nie.res.netease.com/r/pic/20210728/5507b669-4c6f-4958-b5d0-b8556ab4cfb5.png +hard: 进阶 +time: 20分钟 +--- + +# 配置文件优化指南 + +本文介绍了如何优化Python配置文件的内存使用。 + +## 1. 使用结构优化建筑生成 + +在建筑生成和放置方面,我们推荐使用结构文件而不是Python配置。 + +### 使用feature\_rules控制建筑生成 + +参考教程:[自定义特征](../15-自定义游戏内容/4-自定义维度/4-自定义特征.md) + +**优点:** + +* 无需代码处理,无卡顿效果 +* 采用微软原生机制,性能优异 + +**缺点:** + +* feature\_rules文件中的molang表达式不宜过于复杂 +* 复杂的表达式可能导致内存占用增加,影响游戏加载速度 + +### 通过API放置structure + + +参考API:PlaceStructure + +**优点:** + +* 提供灵活的代码控制能力 +* 可实现复杂的生成规则 + +**缺点:** + +* 放置时可能出现短暂卡顿 + +## 2. 使用方块调色板节约内存 + +方块调色板可用于保存建筑数据。使用GetBlockPaletteBetweenPos等接口获取方块调色板后,使用SerializeBlockPalette将调色板转化成字典后,手动存入配置文件中。 + +**优点:** + +* 方块调色板是高度压缩的字典结构,可最大程度节约内存 +* 对应的放置接口SetBlockByBlockPalette是原生c++批量放置,性能较好 +* 可实现复杂的生成规则 + +**缺点:** + +* 放置时可能出现短暂卡顿 + +## 3. 使用引用避免重复定义 + +在配置文件中,应避免重复定义相同的配置项,而是采用引用方式: + +* 错误的写法 + +```python +# 存在大量重复的方块数据定义 +building = { + 'build_A': { + 'size': [0, 1, 2], + 'blocks': [ + {'aux': 0, 'name': 'minecraft:air'}, + {'aux': 0, 'name': 'minecraft:air'}, + {'aux': 0, 'name': 'minecraft:air'}, + {'aux': 0, 'name': 'minecraft:air'}, + {'aux': 0, 'name': 'minecraft:air'}, + {'aux': 0, 'name': 'minecraft:air'}, + {'aux': 0, 'name': 'minecraft:air'}, + {'aux': 0, 'name': 'minecraft:air'}, + {'aux': 0, 'name': 'minecraft:air'}, + {'aux': 0, 'name': 'minecraft:air'}, + {'aux': 0, 'name': 'minecraft:air'}, + ], + }, +} +``` + +* 正确的写法 + +```python +# 定义基础方块数据 +AirBlock = {'aux': 0, 'name': 'minecraft:air'} +GrassBlock = {'aux': 0, 'name': 'minecraft:grass'} +StoneBlock = {'aux': 0, 'name': 'minecraft:stone'} + +# 通过引用复用方块数据 +building = { + 'build_A': { + 'size': (0, 1, 2), + 'blocks': [ + AirBlock, AirBlock, StoneBlock, AirBlock, AirBlock, + GrassBlock, AirBlock, GrassBlock, AirBlock, AirBlock, StoneBlock, + ], + }, +} +``` + +## 4. 使用元组替代字典 + +对于只读的配置数据,建议使用元组代替字典,以提高内存使用效率: + +* 错误的写法 + +```python +# 定义基础方块数据 +AirBlock = {'aux': 0, 'name': 'minecraft:air'} +GrassBlock = {'aux': 0, 'name': 'minecraft:grass'} +StoneBlock = {'aux': 0, 'name': 'minecraft:stone'} +``` + +* 正确的写法 + +```python +# 使用元组存储只读数据,提高内存效率 +AirBlock = ('minecraft:air', 0) +GrassBlock = ('minecraft:grass', 0) +StoneBlock = ('minecraft:stone', 0) +``` + +## 5. 分割配置文件并动态加载 + +如果你的配置文件已经有几十M的大小,建议将配置文件按功能模块分割,采用动态加载方式: + +* 错误的写法 + +```python +# 一次性导入所有配置 +from build import build1, build2, build3 +``` + +* 正确的写法 + +```python +def load_build_config(data): + building = data['build'] + + if build == '1': + # 按需导入配置 + import build1 + place_build(data, build1) + elif build == '2': + # 按需导入配置 + import build2 + place_build(data, build) +``` + +## 注意事项 + +* 建议将一个模块切割得尽量细,并结合前面所述的方法减少单个模块的大小,否则动态加载模块也会带来卡顿。 +* 即便使用动态加载,如果玩家将各个类型的建筑都摆放一次,那么所有配置也会被加载进来,大量占用内存。 +* 如果想进一步优化,可以将配置存储为json文件,通过json方式使用和卸载,相关接口GetModConfigJson。 +* 可以使用`zlib`库压缩数据。 + +## 优化效果 + +**优化前内存占用715.32M、优化后占用下降到了224.46M** + +优化前的内存占用(使用方块探针工具): +![image](./images/before_optimization.png) + +优化后的内存占用(使用方块探针工具): +![image](./images/after_optimization.png) + +## 总结 + +1. 优先使用结构文件/方块调色板存储大型数据 +2. 使用类组织相关配置 +3. 采用引用而不是重复定义 +4. 使用元组存储只读数据 +5. 按功能分割配置文件 \ No newline at end of file diff --git a/mcguide/27-网络游戏/课程0:基岩版网络游戏概述/README.md b/mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/README.md similarity index 100% rename from mcguide/27-网络游戏/课程0:基岩版网络游戏概述/README.md rename to mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/README.md diff --git a/mcguide/27-网络游戏/课程0:基岩版网络游戏概述/images/0_0.png b/mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/images/0_0.png similarity index 100% rename from mcguide/27-网络游戏/课程0:基岩版网络游戏概述/images/0_0.png rename to mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/images/0_0.png diff --git a/mcguide/27-网络游戏/课程0:基岩版网络游戏概述/images/0_1.png b/mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/images/0_1.png similarity index 100% rename from mcguide/27-网络游戏/课程0:基岩版网络游戏概述/images/0_1.png rename to mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/images/0_1.png diff --git a/mcguide/27-网络游戏/课程0:基岩版网络游戏概述/images/0_2.png b/mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/images/0_2.png similarity index 100% rename from mcguide/27-网络游戏/课程0:基岩版网络游戏概述/images/0_2.png rename to mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/images/0_2.png diff --git a/mcguide/27-网络游戏/课程0:基岩版网络游戏概述/images/0_3.png b/mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/images/0_3.png similarity index 100% rename from mcguide/27-网络游戏/课程0:基岩版网络游戏概述/images/0_3.png rename to mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/images/0_3.png diff --git a/mcguide/27-网络游戏/课程0:基岩版网络游戏概述/images/0_4.png b/mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/images/0_4.png similarity index 100% rename from mcguide/27-网络游戏/课程0:基岩版网络游戏概述/images/0_4.png rename to mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/images/0_4.png diff --git a/mcguide/27-网络游戏/课程0:基岩版网络游戏概述/images/0_5.png b/mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/images/0_5.png similarity index 100% rename from mcguide/27-网络游戏/课程0:基岩版网络游戏概述/images/0_5.png rename to mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/images/0_5.png diff --git a/mcguide/27-网络游戏/课程0:基岩版网络游戏概述/第1节:基岩版网络游戏概述与工具指引.md b/mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/第1节:基岩版网络游戏概述与工具指引.md similarity index 97% rename from mcguide/27-网络游戏/课程0:基岩版网络游戏概述/第1节:基岩版网络游戏概述与工具指引.md rename to mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/第1节:基岩版网络游戏概述与工具指引.md index ca0fd70..67e2997 100644 --- a/mcguide/27-网络游戏/课程0:基岩版网络游戏概述/第1节:基岩版网络游戏概述与工具指引.md +++ b/mcguide/27-手机网络游戏/课程0:基岩版网络游戏概述/第1节:基岩版网络游戏概述与工具指引.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 5分钟 --- @@ -10,7 +10,7 @@ time: 5分钟 图层 2 -基岩版网络游戏是指开发者通过 **官方提供** 的服务器资源进行玩法搭建的多人游戏服务。在《我的世界》手机版主页右下方有显目的入口位置,用户可以通过入口找到处于 **上线阶段** 的在线多人服务器。 **网络游戏解除了本地联机的多种限制,让玩家与玩家间可以不受时间和地区因素干扰,遇到更多兴趣相投的玩家好友。** +基岩版网络游戏是指开发者通过 **官方提供** 的服务器资源进行玩法搭建的多人游戏服务。在《我的世界》手机版主页右下方有显目的入口位置,用户可以通过入口找到处于 **上线阶段** 的在线多人服务器。 **网络游戏解除了本地联机的多种限制,让玩家与玩家间可以不受时间和地区因素干扰,遇到更多兴趣相投的玩家好友。** 微信图片_20220425162806 diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/10-支持基岩版客户端的Java版网络游戏概述.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/10-支持基岩版客户端的Java版网络游戏概述.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/10-支持基岩版客户端的Java版网络游戏概述.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/10-支持基岩版客户端的Java版网络游戏概述.md index 0a56038..c398e8f 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/10-支持基岩版客户端的Java版网络游戏概述.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/10-支持基岩版客户端的Java版网络游戏概述.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 60分钟 --- @@ -18,15 +18,15 @@ time: 60分钟 ### 名词介绍 - Spigot、Spigot服 - + > Spigot是一个开源的、高效的Java版MC服务器,并且提供了丰富的api可以编写插件。他是由第三方提供的,并非官方提供,是由官方的minecraft server反编译后,打进去一些patch后而来 - BC、BungeeCord、BC服 - + > BungeeCord(后面简称BC)是一个代理,提供了切服、数据包转发、插件编写、BC指令等等 - Geyser、Geyser服、协议服 - + > Geyser是第三方开源的MC协议转换工具,它能把MC-Bedrock版本协议转换为MC-java版本协议,也就是说通过Geyser,我们能实现基岩版客户端进入Java版服务器游玩的效果 - Master服、Proxy服 diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/11-部署服务器.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/11-部署服务器.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/11-部署服务器.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/11-部署服务器.md index a70417a..10eddbc 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/11-部署服务器.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/11-部署服务器.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 60分钟 --- @@ -11,13 +11,13 @@ time: 60分钟 在进行Java版网络游戏搭建和部署流程前,首先需要注册成为我的世界开发者,并完成入驻申请,申请开发阶段服务器。具体步骤,请详细阅读如下文档: 1. [开发准备阶段概述](../课程1:成为Apollo服主及相关准备/第2节:开发准备阶段概述.md) - + 2. [入驻申请](../课程1:成为Apollo服主及相关准备/第3节:入驻申请.md) - + 3. [申请开发阶段服务器](../课程1:成为Apollo服主及相关准备/第4节:申请开发阶段服务器.md) - + 4. [使用数据库前端连接数据库](../课程1:成为Apollo服主及相关准备/第5节(拓展):使用数据库前端连接数据库.md) - + 5. [连接开发机](../课程1:成为Apollo服主及相关准备/第5节:连接开发机.md) ## 特别提示 @@ -58,17 +58,17 @@ time: 60分钟 ![config.yml](./res/bc04.png) - 打开**BC服目录/config.yml**文件(此为bc服配置),配置bc服监听的端口,端口范围要求[29000,31000) - + - 记下端口参数,后面需要在studio中填写 - 注意,此处的**query_port**和**host中冒号后面的端口值**,请保持一致 - 该处的端口,均为**BC服**用于监听来自**Geyser**服相关连接的端口 - + ![config.yml](./res/bc05.png) ## 负载/协议转换部分部署流程 - 打开MCStudio,选择基岩版服务器,并选择右上角新建选项,打开后,选择空白Spigot服 - + ![Studio部署流程](./res/studio1.png) - 选择更多后,点击服务器配置,开始配置 @@ -97,7 +97,7 @@ time: 60分钟 - 查看日志,若部署成功,则可以通过工具箱打开ModPC开发包,进入游戏开始测试 ![框架上半部分部署](./res/studio5.png) - + ## 部署多个代理服与BC - 在代理服的配置界面填写数量即可部署多个代理服(协议服与代理服为一对一的关系,所以这个数量也是协议服的数量),点击增加代理服则可以在不同机器上部署代理服。 diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/12-Spigot服务器开发规范.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/12-Spigot服务器开发规范.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/12-Spigot服务器开发规范.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/12-Spigot服务器开发规范.md index 5cd5483..d4ff450 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/12-Spigot服务器开发规范.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/12-Spigot服务器开发规范.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 60分钟 --- @@ -33,12 +33,12 @@ time: 60分钟 ## Spigot服 server.properties参数规范 - view-distance - + ``` 建议值: 4-6 ``` 决定服务端发送的区块信息数据,对服务器性能与流量消耗影响巨大,建议调小。 - + - online-mode ``` 必须值: false @@ -51,7 +51,7 @@ time: 60分钟 必须值: true ``` 决定Spigot是否进行飞行检测。由于目前基岩版登录Java服务器需要经过Geyser服翻译协议,在这过程中,玩家移动相关包体不能完美翻译,若这个字段设为false,存在玩家移动被服务器当作飞行封禁的可能性。 - + - network-compression-threshold ``` diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/13-1-【必读】玩家uuid数据存储说明.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/13-1-【必读】玩家uuid数据存储说明.md similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/13-1-【必读】玩家uuid数据存储说明.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/13-1-【必读】玩家uuid数据存储说明.md diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/13-其他部署时可配置字段.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/13-其他部署时可配置字段.md similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/13-其他部署时可配置字段.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/13-其他部署时可配置字段.md diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/20-Spigot插件结构与部署.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/20-Spigot插件结构与部署.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/20-Spigot插件结构与部署.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/20-Spigot插件结构与部署.md index b9a193a..f7e6843 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/20-Spigot插件结构与部署.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/20-Spigot插件结构与部署.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 60分钟 --- @@ -37,6 +37,6 @@ time: 60分钟 ## Spigot插件加载流程 - 如图所示,把mvn clean install编译出的xxx.jar放入Spigot的Plugin文件夹 ![上传](./res/spigotPlugin/plugin11.png) - + - Spigot加载插件后,会有输出,具体命名由plugin.yml决定 ![加载成功2](./res/spigotPlugin/plugin12.png) \ No newline at end of file diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/21-Spigot服与客户端python通信原理简介.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/21-Spigot服与客户端python通信原理简介.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/21-Spigot服与客户端python通信原理简介.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/21-Spigot服与客户端python通信原理简介.md index 16933ad..cf5d97c 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/21-Spigot服与客户端python通信原理简介.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/21-Spigot服与客户端python通信原理简介.md @@ -42,7 +42,7 @@ @Mod.InitClient() def InitClient(self): clientApi.RegisterSystem("MyMod", "MySystemClient", client_system_class_path) - + # clientSystem class MySystemClient(ClientSystem): def __init__(self, namespace, systemName): @@ -51,7 +51,7 @@ self.ListenForEvent("MyMod", "MySystemServer", "serverEvent", self, self.onEvent) # 给spigot发一个事件 self.NotifyToServer("clientEvent", {'a': 1}) - + def onEvent(self, data): # 可以在客户端日志中看到onEvent {"a": 1} print 'onEvent', data diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/21-客户端Mod结构与部署.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/21-客户端Mod结构与部署.md similarity index 96% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/21-客户端Mod结构与部署.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/21-客户端Mod结构与部署.md index a80c8ed..199c86d 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/21-客户端Mod结构与部署.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/21-客户端Mod结构与部署.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 60分钟 --- @@ -20,10 +20,10 @@ time: 60分钟 modMain.py __init__.py entities - pack_manifest.json + manifest.json resource_packs resource_pack_geyser_demo_mod - pack_manifest.json + manifest.json | 文件/文件夹 | 解释 | | ------------------------- | ------------------------------------------------------------ | diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/22-Spigot服自定义物品原理简介.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/22-Spigot服自定义物品原理简介.md similarity index 98% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/22-Spigot服自定义物品原理简介.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/22-Spigot服自定义物品原理简介.md index 7522397..1dc47b2 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/22-Spigot服自定义物品原理简介.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/22-Spigot服自定义物品原理简介.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 60分钟 --- @@ -42,13 +42,13 @@ time: 60分钟 设置物品是否防火 "netease:fire_resistant"{ "value" : true} ``` - + - 基岩版自定义物品中用于物品是否可做燃料的组件 ``` 设置物品是否可作为燃料 "netease:fuel" { "value" : true} ``` - + - 基岩版自定义物品中用于物品的使用间隔 ``` 设置物品使用间隔 diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/23-Spigot服自定义实体原理简介.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/23-Spigot服自定义实体原理简介.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/23-Spigot服自定义实体原理简介.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/23-Spigot服自定义实体原理简介.md index 3d0ee48..870ef08 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/23-Spigot服自定义实体原理简介.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/23-Spigot服自定义实体原理简介.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 60分钟 --- @@ -16,7 +16,7 @@ time: 60分钟 - 开发流程如下: 1. 编写客户端Mod,制作生物的模型、贴图、动画、客户端逻辑等 2. 编写Spigot插件,制作生物运行逻辑、属性、生成规则等 - + - 对于客户端Mod来说,请参照文档 [自定义生物](../../20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.md) 制作生物的模型、贴图、动画等 - 与纯基岩版的自定义生物区别在于,绝大部分Components、ComponentGroups、events均需要通过Java插件实现,无法通过Json配置生效 - 客户端Mod的主要作用为告知客户端当生成对应Identifier生物时,渲染的模型、贴图、动画、碰撞体等 @@ -69,4 +69,4 @@ time: 60分钟 ``` - 1.12版本的Spigot由于需要使用Viaversion,因此在通过反射注册新生物时,需要注意生物的type必须复用已有的生物,或者同时为Viaversion注册,不然会出现生物无法生成的问题。 - + diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/24-Spigot服自定义方块原理简介.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/24-Spigot服自定义方块原理简介.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/24-Spigot服自定义方块原理简介.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/24-Spigot服自定义方块原理简介.md index 4ca318d..27d0fc0 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/24-Spigot服自定义方块原理简介.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/24-Spigot服自定义方块原理简介.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 60分钟 --- @@ -26,7 +26,7 @@ time: 60分钟 - 开发流程如下: 1. 编写客户端Mod,配置方块Json、客户端逻辑等 2. 编写Spigot插件,制作基于头颅实体的自定义逻辑等 - + - 对于客户端Mod来说,请参照文档 [自定义生物](../../20-玩法开发/15-自定义游戏内容/2-自定义方块/0-自定义方块概述.md) 制作自定义方块 - 对于Spigot插件来说,仅需给对应Skull方块设置上给定要求的SkullOwner即可,如: diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/1-自定义物品Demo详解.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/1-自定义物品Demo详解.md similarity index 98% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/1-自定义物品Demo详解.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/1-自定义物品Demo详解.md index ce18f5a..0d87bfd 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/1-自定义物品Demo详解.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/1-自定义物品Demo详解.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 60分钟 --- @@ -101,11 +101,11 @@ Demo实现了11个不同的自定义物品: ##### 流程 1. 安装SpigotMaster插件 - + 详见[下载内容](../99-下载内容.md) 2. 如App.java所示,实例ServerOriginalListener监听了Spigot原生事件 - + 通过下述接口实现 ``` getServer().getPluginManager().registerEvents(new ServerOriginalListener(), this); @@ -196,4 +196,4 @@ Demo实现了11个不同的自定义物品: "armor_slot":2 } ``` - 盔甲槽位,详见 ArmorSlotType + 盔甲槽位,详见 ArmorSlotType diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/2-Python通信Demo详解.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/2-Python通信Demo详解.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/2-Python通信Demo详解.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/2-Python通信Demo详解.md index 49bda49..fe2c6cc 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/2-Python通信Demo详解.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/2-Python通信Demo详解.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 30分钟 --- @@ -22,7 +22,7 @@ time: 30分钟 * 点击”广播消息“会在spigot内所有玩家的聊天栏显示一条消息 - + ### 客户端部分 diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/3-商城Demo详解.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/3-商城Demo详解.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/3-商城Demo详解.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/3-商城Demo详解.md index b0a5a72..ff4a5dd 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/3-商城Demo详解.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/3-商城Demo详解.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 30分钟 --- @@ -9,7 +9,7 @@ time: 30分钟 Demo给出了基于目前SpigotMaster提供的接口接入商场的基础方案 - 提供了四个命令 - - openShop + - openShop 打开玩家商城界面 - closeShop @@ -36,7 +36,7 @@ Demo给出了基于目前SpigotMaster提供的接口接入商场的基础方案 该接口用于通知网易服务器标记指定订单已发货 值得注意的是,目前两个接口采用http异步请求,意味着调用**finPlayerOrder**后,订单不一定已经标记完成。 - + 如果出现已经通知过网易服务器完成发货的订单,请调用**finPlayerOrder**再次通知网易服务器 # 插件逻辑流程 diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/4-自定义生物模型Demo详解.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/4-自定义生物模型Demo详解.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/4-自定义生物模型Demo详解.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/4-自定义生物模型Demo详解.md index b3055f1..d7c8ec8 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/4-自定义生物模型Demo详解.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/4-自定义生物模型Demo详解.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 40分钟 --- diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/5-自定义实体Demo详解.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/5-自定义实体Demo详解.md similarity index 98% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/5-自定义实体Demo详解.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/5-自定义实体Demo详解.md index ea9bb11..dfb6487 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/5-自定义实体Demo详解.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/5-自定义实体Demo详解.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 40分钟 --- @@ -39,8 +39,8 @@ time: 40分钟 - 生成客户端为机器人,实际为MythicMob骷髅王,骷髅王被攻击后会发送信息,并且有概率会召唤骷髅兵 - 继承原生生物类进行换皮 - - 命令 - - /addEntity + - 命令 + - /addEntity - 效果 - 生成一只客户端表现为机器人,实际行为为狼的生物,修改攻击力为20,同时覆写了攻击函数,实现攻击时产生随机特效 - 生成一只客户端表现为蜘蛛,实际行为为马的生物,同时覆写骑乘函数,实现骑乘两人 @@ -49,7 +49,7 @@ time: 40分钟 - 自定义松鼠 1. 参照[自定义生物](../../../20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.md),如实体定义、动画controller、动画、客户端实体定义、骨骼模型、贴图等 ![示例4](../res/spigotCustomEntity/4.png) - + 2. 需要注意的是animation_controllers中使用molong语法,获取mod.is_moving变量,当收到rpc调用时,修改相关值,让松鼠在被攻击时播放移动动作 ![示例5](../res/spigotCustomEntity/5.png) @@ -63,10 +63,10 @@ time: 40分钟 ![示例7](../res/spigotCustomEntity/7.png) 3. 机器人的 animation_controllers使用Mod自定义molang变量,只要plugin发送rpc包,即可触发机器人放技能动作 ![示例21](../res/spigotCustomEntity/21.png) - + 强烈建议阅读: - 关于机器人的模型来源、动画制作、molong语法详细解读 - + [机器人Demo](https://learn.microsoft.com/zh-cn/minecraft/creator/documents/entitymodelingandanimation) - 自定义蜘蛛 @@ -82,7 +82,7 @@ Demo中的Java插件演示了三种换皮方式,其具体的适用范围、实 ### 仅客户端换皮 - 应用场景: - + - 只支持修改生物的模型、动画、碰撞盒大小 - 不支持修改生物的行为逻辑,如攻击、生命、敌对行为等等 @@ -99,7 +99,7 @@ Demo中的Java插件演示了三种换皮方式,其具体的适用范围、实 EntityType spigotType = EntityType.valueOf(spigotIdentifier); Entity mob = spigotMaster.spawnEntity(player, player.getLocation(), spigotType, clientIdentifier); ``` - + - 上述代码的最终效果如下,生成一个本质上为狼,但是模型是机器人的实体 ![示例2](../res/spigotCustomEntity/2.gif) @@ -108,7 +108,7 @@ Demo中的Java插件演示了三种换皮方式,其具体的适用范围、实 Demo中使用的MythicMob插件为**4.13.0**版本 - 应用场景: - + - MythicMob插件提供了强大的自定义生物功能,包括生物的技能、血量、体积等等 - 不同版本的MythicMob需要根据各自版本的事件、API自行适配 @@ -118,7 +118,7 @@ Demo中使用的MythicMob插件为**4.13.0**版本 ![示例17](../res/spigotCustomEntity/17.png) - 同时新增Mechanic,通过配置,达到玩家触发技能时,发送rpc包 - + 下图演示的是新增的yml配置 ![示例22](../res/spigotCustomEntity/22.png) ![示例23](../res/spigotCustomEntity/23.png) @@ -140,7 +140,7 @@ Demo中使用的MythicMob插件为**4.13.0**版本 String typeStr = event.getMob().getMobType(); spigotMaster.setMythicMobIdentifier(event.getEntity(), typeStr); ``` - + - 第二种适用于想自定义对应identifier,相同Mob可对应不同identifier,如下代码 ``` // 把MythicMob插件的骷髅王样例映射为客户端的机器人 @@ -161,15 +161,15 @@ Demo中使用的MythicMob插件为**4.13.0**版本 ### 继承原生生物类进行换皮 - 应用场景: - + - 要求十分了解生物属性、逻辑,能阅读混淆后逻辑,并自行继承改造相应逻辑 - 可改造范围十分广泛,行为逻辑定制灵活性很高 - 命令格式为: - + 1、目前demo样例中,展示了如何继承并修改原生狼的攻击函数,在客户端以机器人的模型表现出来 - + 2、展示了客户端模型为蜘蛛的马 ``` @@ -188,7 +188,7 @@ Demo中使用的MythicMob插件为**4.13.0**版本 ![示例18](../res/spigotCustomEntity/18.png) - MySpider类中,修改马的骑乘判断函数、骑乘函数 - + ![示例27](../res/spigotCustomEntity/27.png) diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/6-ServerFormDemo详解.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/6-ServerFormDemo详解.md similarity index 98% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/6-ServerFormDemo详解.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/6-ServerFormDemo详解.md index 5ec283b..f4549f9 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/6-ServerFormDemo详解.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/6-ServerFormDemo详解.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 40分钟 --- @@ -45,9 +45,9 @@ Demo中的Java插件演示了三种FormUI及FormUI响应处理逻辑,其具体 ### ModalForm - 应用场景: - + - ModalForm是最简单的表单形式,但可定制程度较低 - + - 仅支持标题、内容和两个按钮 - 命令格式为: @@ -72,7 +72,7 @@ Demo中的Java插件演示了三种FormUI及FormUI响应处理逻辑,其具体 }); spigotMaster.sendForm(player, builder); ``` - + - 最终效果如下: ![示例1](../res/spigotForm/1.png) @@ -80,7 +80,7 @@ Demo中的Java插件演示了三种FormUI及FormUI响应处理逻辑,其具体 ### SimpleForm - 应用场景: - + - SimpleForm比ModalForm稍显复杂,但是可定制程度也更高,支持带图片按钮 - 仅支持标题、内容和不限数量的按钮 @@ -109,7 +109,7 @@ Demo中的Java插件演示了三种FormUI及FormUI响应处理逻辑,其具体 ### CustomForm - 应用场景: - + - 最为复杂,但是可定制程度最高 - 支持标题、内容、标签列表、滑块、输入等等 @@ -176,9 +176,9 @@ Demo中的Java插件演示了三种FormUI及FormUI响应处理逻辑,其具体 从上面几种form的效果我们可以看到,在不修改客户端Json配置的情况下,FormUI的布局、贴图等表现效果十分受限,排序只能从头列到尾,控件效果也只有单调的一种 ### 扩展方案 - + 我们可以通过修改客户端JSON配置文件,来让FormUI的样式更丰富,同时不需要编写额外的客户端Python代码。 - + 在阅读下述内容前,默认开发者已阅读过 [客户端ui开发相关知识](../../../18-界面与交互/2-从零开始创建UI.md) 同时默认开发者已阅读过 [客户端基础ui知识](https://wiki.bedrock.dev/json-ui/json-ui-intro.html) @@ -268,11 +268,11 @@ Demo中的Java插件演示了三种FormUI及FormUI响应处理逻辑,其具体 - 定义五个自定义控件 - - grid_long_form@server_form.long_form - - 继承自原生server_form.long_form + - grid_long_form@server_form.long_form + + 继承自原生server_form.long_form - grid_long_form_panel - + 为内容面板增加了背景贴图 ``` { @@ -296,11 +296,11 @@ Demo中的Java插件演示了三种FormUI及FormUI响应处理逻辑,其具体 ``` - grid_long_form_scrolling_content@server_form.long_form_scrolling_content - + 继承自原生**server_form.long_form_scrolling_content**的滚动面板,内容填充为**grid_long_form_dynamic_buttons_panel@server_form.grid_long_form_dynamic_buttons_panel** - + - grid_long_form_dynamic_buttons_panel - + 自定义的grid面板,用于生成动态按钮,从配置中可以见到,我们定义该面板由6行2列组成,每项控件模板为**server_form.grid_dynamic_button** ``` @@ -359,10 +359,10 @@ Demo中的Java插件演示了三种FormUI及FormUI响应处理逻辑,其具体 - 最后,我们把原生的long_form的定义改为我们自定义的控件**@server_form.apollo_demo_switch_long_form** - + long_form对应的是SimpleForm,custom_form对应的是CustomForm ![示例7](../res/spigotForm/7.png) - + - Spigot中我们构造如下的Form,把Title设置为**§g**开头 ![示例8](../res/spigotForm/8.png) diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/7-自定义方块Demo详解.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/7-自定义方块Demo详解.md similarity index 98% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/7-自定义方块Demo详解.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/7-自定义方块Demo详解.md index ba25464..b131aa0 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/7-自定义方块Demo详解.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/30-Spigot服Demo详解/7-自定义方块Demo详解.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 40分钟 --- @@ -16,22 +16,22 @@ time: 40分钟 使用了自定义松鼠模型的方块 - custom:my_block1 - + 破坏时间为10s的自定义方块 - custom:my_block2 - + 自发光方块,发光强度为1.0 - custom:my_block3 - + 四面向方块,根据玩家摆放方向不同而不同 ## 开发流程 - 自定义方块1-3 1. 参照[自定义方块实体概述](../../../20-玩法开发/15-自定义游戏内容/2-自定义方块/0-自定义方块概述.md) 、[自定义方块Json组件](../../../20-玩法开发/15-自定义游戏内容/2-自定义方块/1-JSON组件.md),增加对应方块定义、Json组件 ![示例4](../res/spigotCustomBlock/2.png) - + 2. 使用原生Spigot命令,获取带SkullOwner的头颅 ``` /give @s minecraft:skull 64 3 {SkullOwner: { "Name" : "geyser_custom_block_custom:my_block1"}} @@ -45,7 +45,7 @@ time: 40分钟 - 自定义松鼠方块 1. 参照[自定义方块实体外观](../../../20-玩法开发/15-自定义游戏内容/2-自定义方块/4.1-自定义方块实体外观.md),定义方块实体、动画controller、动画、骨骼模型、贴图等 ![示例4](../res/spigotCustomBlock/1.png) - + 2. 需要注意的是,基于头颅换皮的情况下,方块本身即带有服务端方块实体。若加上**netease:block_entity**字段,则同时会生成客户端方块实体;不加**netease:block_entity**字段则无客户端方块实体。 ``` "netease:block_entity": { @@ -61,11 +61,11 @@ time: 40分钟 4. 最终效果如下: ![效果2](../res/spigotCustomBlock/1.gif) - + ## 目前支持组件详解 1. Q: **netease:aabb** 组件在使用上有没有限制? - + A: 由于方块实际上为头颅换皮,因此目前**netease:aabb**设置值应大于头颅的aabb,否则会出现服务端客户端不一致的挖掘表现,头颅aabb具体为 ```json { @@ -85,13 +85,13 @@ time: 40分钟 PS:另外需要注意的是,在apollo2.0中**collision**和**clip**均为必须字段,缺少时Geyser会报错! 2. Q: **netease:face_directional** 组件在使用上有没有限制? - + A: 由于头颅方块并没有细致到上下朝向的区分,因此目前组件只支持四方向类型,即只支持 **type: "direction"** 3. Q:**netease:block_entity**使用时有什么需要注意的地方? - + A:对于Apollo2.0来说,服务端本身就自带了Skull方块实体,而只需要有这个组件即可保证客户端同时生成方块实体。 - + 由于子字段中的 **tick** 、 **moveable** 为服务端逻辑,在Apollo2.0中为无效字段,需要自行通过Spigot插件的方式,修改Skull方块实体进行兼容。 **tick** 、 **moveable** 为无效字段可以理解成不配置相应字段也不会出现问题 @@ -99,5 +99,5 @@ time: 40分钟 4. Q:**minecraft:destory_time**使用时有什么需要注意的地方吗? A:目前**destory_time** 可以设置方块所需的挖掘时间,由于服务端仍然是头颅 **destory_time**设置小于原生头颅时,会出现挖掘纹理和挖掘时间不一致问题。 - + 因此,不建议**destory_time**值小于 **1.5** diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/81-SpigotMasterAPI文档.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/81-SpigotMasterAPI文档.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/81-SpigotMasterAPI文档.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/81-SpigotMasterAPI文档.md index 2a13f35..6c5cff3 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/81-SpigotMasterAPI文档.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/81-SpigotMasterAPI文档.md @@ -11,7 +11,7 @@ SpigotMaster import com.neteasemc.spigotmaster.SpigotMaster; SpigotMaster spigotMaster = (SpigotMaster)Bukkit.getPluginManager().getPlugin("SpigotMaster"); ``` - + ## `public Material getCustomItemMaterial(String customItemIdentifier)` @@ -222,7 +222,7 @@ SpigotMaster | -----------------| ---------------| ---- | | player | Player | 玩家 | | json_result | 订单json数据 | 玩家 | - + ## `public void finPlayerOrder(Player player, List orderList, FutureCallback> callback)` @@ -241,7 +241,7 @@ SpigotMaster | -----------------| ---------------| ---- | | player | Player | 玩家 | | json_result | 订单json数据 | 玩家 | - + ## `public void enableClientChatExtension(Player player)` @@ -261,7 +261,7 @@ SpigotMaster } }); ``` - + ## `public void disableClientChatExtension(Player player)` @@ -281,7 +281,7 @@ SpigotMaster } }); ``` - + ## `public String getCustomEntityIdentifier(Entity entity)` @@ -461,7 +461,7 @@ SkeletalMinion 会自动转为客户端的 mythicmob:skeletalMinion setTimeByteBuf.release(); spigotMaster.sendBedrockPacket(setTimePacketId, setTimeData); ``` - + ## `public void sendBedrockPacketToPlayer(int packetId, byte[] packetData, Player player)` diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/82-SpigotMasterEvent文档.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/82-SpigotMasterEvent文档.md similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/82-SpigotMasterEvent文档.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/82-SpigotMasterEvent文档.md diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/90-常见问题合集.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/90-常见问题合集.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/90-常见问题合集.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/90-常见问题合集.md index 8215641..68ed819 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/90-常见问题合集.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/90-常见问题合集.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 60分钟 --- @@ -46,9 +46,9 @@ time: 60分钟 - 当玩家正常连接上proxy及geyser时,会输出如下日志 ![问题1-7](./res/quest7.png) - + - 当玩家登录时没有上述输出,证明Geyser和Master、Proxy连接异常,请对照文档检查配置 - + [Apollo2.0简述](./10-支持基岩版客户端的Java版网络游戏概述.md) ### (3) 排查BC服及BungeeMaster插件是否正常加载 diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/99-下载内容.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/99-下载内容.md similarity index 99% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/99-下载内容.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/99-下载内容.md index 7e0536e..088a582 100644 --- a/mcguide/27-网络游戏/课程10:使用Spigot开服/99-下载内容.md +++ b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/99-下载内容.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 分钟 --- diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/README.md b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/README.md similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/README.md rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/README.md diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/SpigotCustomModel/customModel1.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/SpigotCustomModel/customModel1.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/SpigotCustomModel/customModel1.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/SpigotCustomModel/customModel1.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/SpigotCustomModel/customModel2.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/SpigotCustomModel/customModel2.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/SpigotCustomModel/customModel2.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/SpigotCustomModel/customModel2.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/SpigotCustomModel/customModel3.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/SpigotCustomModel/customModel3.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/SpigotCustomModel/customModel3.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/SpigotCustomModel/customModel3.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/bc01.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/bc01.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/bc01.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/bc01.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/bc02.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/bc02.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/bc02.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/bc02.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/bc03.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/bc03.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/bc03.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/bc03.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/bc04.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/bc04.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/bc04.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/bc04.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/bc05.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/bc05.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/bc05.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/bc05.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/deployjson0.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/deployjson0.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/deployjson0.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/deployjson0.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/dl.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/dl.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/dl.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/dl.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/dl1.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/dl1.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/dl1.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/dl1.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/frame.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/frame.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/frame.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/frame.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest1.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest1.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest1.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest1.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest10.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest10.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest10.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest10.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest2.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest2.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest2.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest2.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest3.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest3.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest3.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest3.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest4.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest4.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest4.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest4.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest5.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest5.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest5.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest5.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest6.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest6.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest6.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest6.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest7.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest7.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest7.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest7.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest8.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest8.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest8.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest8.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest9.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest9.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/quest9.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/quest9.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomBlock/1.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomBlock/1.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomBlock/1.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomBlock/1.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomBlock/2.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomBlock/2.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomBlock/2.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomBlock/2.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/17.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/17.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/17.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/17.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/18.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/18.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/18.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/18.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/20.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/20.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/20.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/20.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/21.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/21.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/21.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/21.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/22.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/22.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/22.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/22.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/23.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/23.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/23.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/23.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/24.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/24.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/24.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/24.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/25.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/25.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/25.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/25.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/26.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/26.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/26.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/26.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/27.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/27.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/27.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/27.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/28.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/28.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/28.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/28.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/4.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/4.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/4.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/4.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/5.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/5.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/5.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/5.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/6.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/6.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/6.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/6.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/7.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/7.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/7.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/7.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/8.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/8.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/8.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/8.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/9.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/9.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/9.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/9.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem1.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem1.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem1.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem1.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem10.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem10.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem10.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem10.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem2.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem2.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem2.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem2.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem3.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem3.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem3.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem3.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem4.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem4.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem4.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem4.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem5.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem5.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem5.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem5.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem6.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem6.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem6.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem6.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem7.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem7.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem7.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem7.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem8.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem8.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem8.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem8.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem9.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem9.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem9.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotCustomItem/customItem9.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/1.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/1.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/1.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/1.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/2.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/2.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/2.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/2.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/3.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/3.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/3.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/3.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/4.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/4.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/4.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/4.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/5.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/5.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/5.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/5.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/6.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/6.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/6.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/6.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/7.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/7.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/7.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/7.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/8.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/8.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotForm/8.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotForm/8.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin1.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin1.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin1.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin1.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin10.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin10.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin10.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin10.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin11.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin11.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin11.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin11.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin12.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin12.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin12.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin12.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin13.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin13.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin13.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin13.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin14.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin14.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin14.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin14.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin16.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin16.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin16.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin16.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin17.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin17.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin17.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin17.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin18.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin18.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin18.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin18.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin19.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin19.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin19.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin19.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin20.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin20.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin20.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin20.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin21.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin21.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin21.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotPlugin/plugin21.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotShop/shop1.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotShop/shop1.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotShop/shop1.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotShop/shop1.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotShop/shop2.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotShop/shop2.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotShop/shop2.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotShop/shop2.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotShop/shop3.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotShop/shop3.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotShop/shop3.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/spigotShop/shop3.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/studio1.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/studio1.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/studio1.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/studio1.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/studio2.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/studio2.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/studio2.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/studio2.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/studio3.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/studio3.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/studio3.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/studio3.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/studio4.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/studio4.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/studio4.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/studio4.png diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/studio5.png b/mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/studio5.png similarity index 100% rename from mcguide/27-网络游戏/课程10:使用Spigot开服/res/studio5.png rename to mcguide/27-手机网络游戏/课程10:使用Spigot开服/res/studio5.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/README.md b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/README.md similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/README.md rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/README.md diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm1.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm1.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm1.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm1.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm2.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm2.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm2.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm2.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm4.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm4.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm4.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm4.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm5.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm5.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm5.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/MobaXterm5.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/downloadstudio.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/downloadstudio.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/downloadstudio.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/downloadstudio.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/private1.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/private1.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/private1.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/private1.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/private3.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/private3.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/private3.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/private3.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/private4.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/private4.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/private4.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/private4.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/privatersa.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/privatersa.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/privatersa.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/privatersa.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy01.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy01.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy01.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy01.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy02.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy02.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy02.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy02.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy03.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy03.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy03.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy03.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy04.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy04.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy04.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy04.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy05.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy05.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy05.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy05.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy06.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy06.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy06.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy06.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy07.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy07.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy07.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/ssh_proxy07.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoquanxian1.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoquanxian1.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoquanxian1.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoquanxian1.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoquanxian2.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoquanxian2.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoquanxian2.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoquanxian2.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoquanxian3.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoquanxian3.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoquanxian3.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoquanxian3.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoshezhi.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoshezhi.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoshezhi.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoshezhi.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoyaoqing.png b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoyaoqing.png similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoyaoqing.png rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/images/zizhanghaoyaoqing.png diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第1节:Apollo介绍.md b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第1节:Apollo介绍.md similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第1节:Apollo介绍.md rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第1节:Apollo介绍.md diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第2节:开发准备阶段概述.md b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第2节:开发准备阶段概述.md similarity index 98% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第2节:开发准备阶段概述.md rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第2节:开发准备阶段概述.md index 7e4b798..246d04e 100644 --- a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第2节:开发准备阶段概述.md +++ b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第2节:开发准备阶段概述.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 2分钟 --- diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第3节:入驻申请.md b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第3节:入驻申请.md similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第3节:入驻申请.md rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第3节:入驻申请.md diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第4节:申请开发阶段服务器.md b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第4节:申请开发阶段服务器.md similarity index 77% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第4节:申请开发阶段服务器.md rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第4节:申请开发阶段服务器.md index 4cc35dc..660293b 100644 --- a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第4节:申请开发阶段服务器.md +++ b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第4节:申请开发阶段服务器.md @@ -6,7 +6,7 @@ time: 10分钟 # 申请开发阶段服务器 -审核通过后,官方人员将根据审核信息中预留的QQ号联系开发者,开发者需要在审核信息中提供**登录服务器的公钥**。资料确认无误之后,官方人员将发放开发阶段服务器(简称:开发机)。 +审核通过后,官方人员将根据审核信息中预留的QQ号联系开发者,开发者需要提供**固定IP**以及**登录服务器的公钥**给官方人员。资料确认无误之后,官方人员将发放开发阶段服务器(简称:开发机)。 @@ -49,13 +49,10 @@ time: 10分钟 -## 添加白名单IP +## 固定IP -- 只有在白名单的IP,才能访问并部署Apollo测试机器、正式机器。 -- 在机器发放后,可以在服务器使用情况处,添加白名单。 - ![](./images/whitelist_1.png) -- 进行白名单添加或删除操作。 - ![](./images/whitelist_2.png) +- 特别说明的是,此处若提供了非固定IP,会影响后续的开发阶段的服务器链接,敬请留意。 +- 只有在白名单的IP,才能访问并部署Apollo测试机器、正式机器。[**点击此处**](http://temp-white-list.mc.netease.com:9999/?machine=)可把当前机器的固定IP加入白名单。 diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第5节(拓展):使用数据库前端连接数据库.md b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第5节(拓展):使用数据库前端连接数据库.md similarity index 99% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第5节(拓展):使用数据库前端连接数据库.md rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第5节(拓展):使用数据库前端连接数据库.md index 3711f4c..1d63dbd 100644 --- a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第5节(拓展):使用数据库前端连接数据库.md +++ b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第5节(拓展):使用数据库前端连接数据库.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 5分钟 --- @@ -12,7 +12,7 @@ time: 5分钟 * 注意:只要是支持SSH代理的数据库前端,均可通过代理的方式连接Apollo为服主提供的数据库,**Navicat for MySQL**仅为示例 - + ## 以Navicat for MySQL为例,展示如何连接Apollo的数据库 - 启动**Navicat for MySQL**后,点击左上角的【新建连接】 - ![](./images/ssh_proxy01.png) diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第5节:连接开发机.md b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第5节:连接开发机.md similarity index 100% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第5节:连接开发机.md rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第5节:连接开发机.md diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第6节:版本管理建议.md b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第6节:版本管理建议.md similarity index 99% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第6节:版本管理建议.md rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第6节:版本管理建议.md index 94d0015..6843d34 100644 --- a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第6节:版本管理建议.md +++ b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第6节:版本管理建议.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 15分钟 --- diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第7节:McStudio多账号协作.md b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第7节:McStudio多账号协作.md similarity index 99% rename from mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第7节:McStudio多账号协作.md rename to mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第7节:McStudio多账号协作.md index b201247..4e874c0 100644 --- a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/第7节:McStudio多账号协作.md +++ b/mcguide/27-手机网络游戏/课程1:成为Apollo服主及相关准备/第7节:McStudio多账号协作.md @@ -72,7 +72,7 @@ time: 15分钟 - 在移动端测试时,子账号能看到主账号的所有组件和网络服,并可以自身玩家账号的身份下载和进入。 - + ### 子账号协同提交内容 diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/README.md b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/README.md similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/README.md rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/README.md diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/apollo_framework.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/apollo_framework.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/apollo_framework.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/apollo_framework.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/bushujieshao.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/bushujieshao.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/bushujieshao.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/bushujieshao.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/chajian1.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/chajian1.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/chajian1.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/chajian1.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/chajian2.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/chajian2.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/chajian2.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/chajian2.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/chongxinbushu.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/chongxinbushu.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/chongxinbushu.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/chongxinbushu.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/gundonggengxin.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/gundonggengxin.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/gundonggengxin.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/gundonggengxin.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/hotfix.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/hotfix.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/hotfix.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/hotfix.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210127171721936.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210127171721936.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210127171721936.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210127171721936.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210127172516895.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210127172516895.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210127172516895.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210127172516895.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210127172754284.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210127172754284.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210127172754284.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210127172754284.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210127172928809.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210127172928809.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210127172928809.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210127172928809.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128145729718.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128145729718.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128145729718.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128145729718.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128145754405.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128145754405.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128145754405.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128145754405.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128145952235.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128145952235.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128145952235.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128145952235.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128150008665.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128150008665.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128150008665.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128150008665.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128150334059.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128150334059.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128150334059.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128150334059.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128150810194.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128150810194.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128150810194.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128150810194.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128152712391.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128152712391.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128152712391.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128152712391.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128153503054.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128153503054.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210128153503054.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210128153503054.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210223144701813.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210223144701813.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210223144701813.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210223144701813.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210223144721613.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210223144721613.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210223144721613.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210223144721613.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210223144935188.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210223144935188.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210223144935188.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210223144935188.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210223145148829.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210223145148829.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-20210223145148829.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-20210223145148829.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan1.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan1.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan1.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan1.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan2.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan2.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan2.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan2.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan3.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan3.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan3.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan3.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan4.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan4.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan4.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan4.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan7.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan7.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan7.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan7.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan8.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan8.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan8.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan8.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan9.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan9.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan9.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image-zhuanhuan9.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/image071.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image071.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/image071.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/image071.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/kaifabushu.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/kaifabushu.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/kaifabushu.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/kaifabushu.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/kaifaliucheng.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/kaifaliucheng.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/kaifaliucheng.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/kaifaliucheng.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/lingdichajian.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/lingdichajian.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/lingdichajian.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/lingdichajian.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/lingdichajian1.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/lingdichajian1.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/lingdichajian1.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/lingdichajian1.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/shangxianbushu.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/shangxianbushu.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/shangxianbushu.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/shangxianbushu.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/images/shenhebushu.png b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/shenhebushu.png similarity index 100% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/images/shenhebushu.png rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/images/shenhebushu.png diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/第1节:开发流程说明.md b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第1节:开发流程说明.md similarity index 97% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/第1节:开发流程说明.md rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/第1节:开发流程说明.md index 631ebf0..38a56d1 100644 --- a/mcguide/27-网络游戏/课程2:Apollo基础知识/第1节:开发流程说明.md +++ b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第1节:开发流程说明.md @@ -9,7 +9,7 @@ selection: true ​ 从入驻到上线可分为四个阶段,详见下图: -![img](./images/kaifaliucheng.png) +![img](./images/kaifaliucheng.png) diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/第2节:Apollo框架.md b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第2节:Apollo框架.md similarity index 99% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/第2节:Apollo框架.md rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/第2节:Apollo框架.md index f35af79..252b249 100644 --- a/mcguide/27-网络游戏/课程2:Apollo基础知识/第2节:Apollo框架.md +++ b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第2节:Apollo框架.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 15分钟 --- diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/第3节:服务器Mod.md b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第3节:服务器Mod.md similarity index 99% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/第3节:服务器Mod.md rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/第3节:服务器Mod.md index cbc86fb..a521c4e 100644 --- a/mcguide/27-网络游戏/课程2:Apollo基础知识/第3节:服务器Mod.md +++ b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第3节:服务器Mod.md @@ -105,9 +105,9 @@ developer_mods支持多个mod,每个mod对应一个目录,下面是neteaseAn } ] } - + ``` - + - 并非所有resource_packs都会被客户端下载 - 需要将`manifest.json`配置header中uuid配置到worlds/level/`world_resource_packs.json`中才会被客户端下载 @@ -123,7 +123,7 @@ developer_mods支持多个mod,每个mod对应一个目录,下面是neteaseAn ``` -​ +​ ## behavior_packs - 存放客户端MOD diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/第4节:部署.md b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第4节:部署.md similarity index 99% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/第4节:部署.md rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/第4节:部署.md index 38ed256..27bbe01 100644 --- a/mcguide/27-网络游戏/课程2:Apollo基础知识/第4节:部署.md +++ b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第4节:部署.md @@ -16,7 +16,7 @@ time: 15分钟 ![](./images/bushujieshao.png) -​ +​ 以下内容涉及较多进阶知识,建议在入门阶段暂时跳过。 diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/第5节:插件.md b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第5节:插件.md similarity index 98% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/第5节:插件.md rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/第5节:插件.md index 821ccc8..b5f6346 100644 --- a/mcguide/27-网络游戏/课程2:Apollo基础知识/第5节:插件.md +++ b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第5节:插件.md @@ -4,7 +4,7 @@ hard: 入门 time: 15分钟 --- -# 网络服插件 +# 网络服插件 ### 什么是插件 diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/第6节:从Mod到网络游戏Mod.md b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第6节:从Mod到网络游戏Mod.md similarity index 99% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/第6节:从Mod到网络游戏Mod.md rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/第6节:从Mod到网络游戏Mod.md index c892c4e..f04b333 100644 --- a/mcguide/27-网络游戏/课程2:Apollo基础知识/第6节:从Mod到网络游戏Mod.md +++ b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第6节:从Mod到网络游戏Mod.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 20分钟 --- @@ -112,7 +112,7 @@ class TutorialMod(object): # @Mod.DestroyServer() # def TutorialServerDestroy(self): # print "===== destroy tutorial server =====" - + # InitClient绑定的函数作为客户端脚本初始化的入口函数,通常用来注册客户端系统system和组件component @Mod.InitClient() def TutorialClientInit(self): @@ -120,7 +120,7 @@ class TutorialMod(object): # 函数可以将System注册到客户端引擎中,实例的创建和销毁交给引擎处理。第一个参数是MOD名称,第二个是System名称,第三个是自定义MOD System类的路径 # 取名名称尽量个性化,不能与其他人的MOD冲突,可以使用英文、拼音、下划线这三种。 clientApi.RegisterSystem("TutorialMod", "TutorialClientSystem", "tutorialScripts.tutorialClientSystem.TutorialClientSystem") - + # DestroyClient绑定的函数作为客户端脚本退出的时候执行的析构函数,通常用来反注册一些内容,可为空 @Mod.DestroyClient() def TutorialClientDestroy(self): diff --git a/mcguide/27-网络游戏/课程2:Apollo基础知识/第7节:Mod和网络游戏Mod相互转换.md b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第7节:Mod和网络游戏Mod相互转换.md similarity index 99% rename from mcguide/27-网络游戏/课程2:Apollo基础知识/第7节:Mod和网络游戏Mod相互转换.md rename to mcguide/27-手机网络游戏/课程2:Apollo基础知识/第7节:Mod和网络游戏Mod相互转换.md index b78db7c..62b38f8 100644 --- a/mcguide/27-网络游戏/课程2:Apollo基础知识/第7节:Mod和网络游戏Mod相互转换.md +++ b/mcguide/27-手机网络游戏/课程2:Apollo基础知识/第7节:Mod和网络游戏Mod相互转换.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 20分钟 --- @@ -76,7 +76,7 @@ class TutorialMod(object): # @Mod.DestroyServer() # def TutorialServerDestroy(self): # print "===== destroy tutorial server =====" - + # InitClient绑定的函数作为客户端脚本初始化的入口函数,通常用来注册客户端系统system和组件component @Mod.InitClient() def TutorialClientInit(self): @@ -84,7 +84,7 @@ class TutorialMod(object): # 函数可以将System注册到客户端引擎中,实例的创建和销毁交给引擎处理。第一个参数是MOD名称,第二个是System名称,第三个是自定义MOD System类的路径 # 取名名称尽量个性化,不能与其他人的MOD冲突,可以使用英文、拼音、下划线这三种。 clientApi.RegisterSystem("TutorialMod", "TutorialClientSystem", "tutorialScripts.tutorialClientSystem.TutorialClientSystem") - + # DestroyClient绑定的函数作为客户端脚本退出的时候执行的析构函数,通常用来反注册一些内容,可为空 @Mod.DestroyClient() def TutorialClientDestroy(self): diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/README.md b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/README.md similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/README.md rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/README.md diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/1590024486604.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/1590024486604.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/1590024486604.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/1590024486604.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/1591078533362.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/1591078533362.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/1591078533362.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/1591078533362.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/1591078639263.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/1591078639263.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/1591078639263.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/1591078639263.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/1591078869592.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/1591078869592.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/1591078869592.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/1591078869592.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/b_allow_pc_user.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/b_allow_pc_user.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/b_allow_pc_user.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/b_allow_pc_user.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/bushujieshao.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/bushujieshao.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/bushujieshao.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/bushujieshao.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/chajian_sql.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/chajian_sql.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/chajian_sql.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/chajian_sql.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/configdir.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/configdir.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/configdir.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/configdir.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/e2f9324a-3808-4674-afc8-5073fdbad5eb.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/e2f9324a-3808-4674-afc8-5073fdbad5eb.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/e2f9324a-3808-4674-afc8-5073fdbad5eb.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/e2f9324a-3808-4674-afc8-5073fdbad5eb.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin01.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin01.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin01.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin01.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin02.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin02.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin02.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin02.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin03.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin03.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin03.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin03.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin04.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin04.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin04.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin04.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin05.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin05.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin05.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin05.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin06.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin06.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin06.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin06.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin07.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin07.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin07.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin07.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin08.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin08.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin08.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/firstplugin08.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/fuwuqirizhi.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/fuwuqirizhi.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/fuwuqirizhi.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/fuwuqirizhi.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191129151441535.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191129151441535.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191129151441535.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191129151441535.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230101214669.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230101214669.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230101214669.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230101214669.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230103018372.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230103018372.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230103018372.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230103018372.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230105610857.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230105610857.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230105610857.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230105610857.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230105652514.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230105652514.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230105652514.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230105652514.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230105808587.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230105808587.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230105808587.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230105808587.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230111523901.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230111523901.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230111523901.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230111523901.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230112037901.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230112037901.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230112037901.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230112037901.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230170211461.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230170211461.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230170211461.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20191230170211461.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20200220180628580.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20200220180628580.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20200220180628580.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20200220180628580.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20200221225755733.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20200221225755733.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20200221225755733.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/image-20200221225755733.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/jcpz1.png b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/jcpz1.png similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/images/jcpz1.png rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/images/jcpz1.png diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第1节:简易网络服视频教程.md b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第1节:简易网络服视频教程.md similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第1节:简易网络服视频教程.md rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第1节:简易网络服视频教程.md diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第2节:创建网络服.md b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第2节:创建网络服.md similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第2节:创建网络服.md rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第2节:创建网络服.md diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第3节:网络服基础配置.md b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第3节:网络服基础配置.md similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第3节:网络服基础配置.md rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第3节:网络服基础配置.md diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第4节:网络服进阶配置.md b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第4节:网络服进阶配置.md similarity index 99% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第4节:网络服进阶配置.md rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第4节:网络服进阶配置.md index b3c3b25..19d9654 100644 --- a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第4节:网络服进阶配置.md +++ b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第4节:网络服进阶配置.md @@ -6,7 +6,7 @@ 大厅服相当于主城,一个玩家登陆后首先会被放到类型为lobby的服务器中。 -游戏服是具体的游戏玩法,玩家可以从大厅服跳转到游戏服。 +游戏服是具体的游戏玩法,玩家可以从大厅服跳转到游戏服。 大厅服与游戏服的配置如图所示。 @@ -49,7 +49,7 @@ - 玩家登陆服务器后,会在所有类型名为lobby的大厅服务器中随机一个加入,如果没有类型名为lobby的大厅服务器,将无法登入。 - + ### 游戏服地图保存说明 diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第5节:部署网络服.md b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第5节:部署网络服.md similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第5节:部署网络服.md rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第5节:部署网络服.md diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第6节:服务器日志.md b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第6节:服务器日志.md similarity index 100% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第6节:服务器日志.md rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第6节:服务器日志.md diff --git a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第7节:官方插件.md b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第7节:官方插件.md similarity index 99% rename from mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第7节:官方插件.md rename to mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第7节:官方插件.md index 0eede3f..4c8ca91 100644 --- a/mcguide/27-网络游戏/课程3:简易网络服模板部署与常见操作/第7节:官方插件.md +++ b/mcguide/27-手机网络游戏/课程3:简易网络服模板部署与常见操作/第7节:官方插件.md @@ -112,10 +112,10 @@ time: 20分钟 ALTER TABLE `neteaseUserMail` MODIFY COLUMN `itemList` VARCHAR (4000) NOT NULL DEFAULT ''; -- 群发邮件:增加邮件附件长度限制 ALTER TABLE `neteaseGroupMail` MODIFY COLUMN `itemList` VARCHAR (4000) NOT NULL DEFAULT ''; - + ``` - + ![image-20191230170155729](./images/chajian_sql.png) @@ -143,7 +143,7 @@ time: 20分钟 ![image-20200221210532737](./images/firstplugin08.png) - + - 在游戏中查看效果 diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/README.md b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/README.md similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/README.md rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/README.md diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/1559293031316.png b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/1559293031316.png similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/1559293031316.png rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/1559293031316.png diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/hint001.png b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/hint001.png similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/hint001.png rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/hint001.png diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224192458475.png b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224192458475.png similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224192458475.png rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224192458475.png diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224192541433.png b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224192541433.png similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224192541433.png rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224192541433.png diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224192724141.png b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224192724141.png similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224192724141.png rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224192724141.png diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224193054128.png b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224193054128.png similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224193054128.png rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/image-20210224193054128.png diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/image071.png b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/image071.png similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/image071.png rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/image071.png diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps11.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps11.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps11.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps11.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps12.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps12.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps12.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps12.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps13.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps13.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps13.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps13.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps14.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps14.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps14.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps14.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps15.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps15.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps15.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps15.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps16.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps16.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps16.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps16.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps17.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps17.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps17.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps17.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps18.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps18.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps18.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps18.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps19.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps19.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps19.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps19.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps20.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps20.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps20.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps20.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps21.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps21.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps21.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps21.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps22.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps22.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps22.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps22.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps23.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps23.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps23.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps23.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps24.jpg b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps24.jpg similarity index 100% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/images/wps24.jpg rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/images/wps24.jpg diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第1节:框架.md b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第1节:框架.md similarity index 99% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第1节:框架.md rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第1节:框架.md index 2939fb8..8f64a61 100644 --- a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第1节:框架.md +++ b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第1节:框架.md @@ -39,8 +39,8 @@ time: 10分钟 - OrdinaryGameMod:简单的对战pvp - lobbyMod:提供三个NPC,点击不同NPC分别进入不同的game服 - - + + ### 功能执行过程 说明玩家体验游戏过程中,引擎(开服工具框架)和开发者mod分别完成的功能。 diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第2节:服务器Mod目录.md b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第2节:服务器Mod目录.md similarity index 99% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第2节:服务器Mod目录.md rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第2节:服务器Mod目录.md index d4c6569..378257f 100644 --- a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第2节:服务器Mod目录.md +++ b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第2节:服务器Mod目录.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 10分钟 --- @@ -100,7 +100,7 @@ developer_mods支持多个mod,每个mod对应一个目录,下面是neteaseAn ``` -​ +​ - 并非所有resource_packs都会被客户端下载 - 需要将`manifest.json`配置header中uuid配置到worlds/level/`world_resource_packs.json`中才会被客户端下载 @@ -116,7 +116,7 @@ developer_mods支持多个mod,每个mod对应一个目录,下面是neteaseAn ``` -​ +​ ## behavior_packs - 存放客户端MOD diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第3节:进入与退出游戏.md b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第3节:进入与退出游戏.md similarity index 89% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第3节:进入与退出游戏.md rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第3节:进入与退出游戏.md index 8619ae1..6e84c5d 100644 --- a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第3节:进入与退出游戏.md +++ b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第3节:进入与退出游戏.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 20分钟 --- @@ -26,26 +26,26 @@ Apollo引擎在登录过程中会处理顶号问题,开发者开发过程不 下面开发LobbyMod服务端登录功能。首先处理登录逻辑,监听AddServerPlayerEvent事件,初始化玩家信息,核心代码如下: ```python -class AwesomeServer(ServerSystem): - def __init__(self, namespace, systemName): - ServerSystem.__init__(self, namespace, systemName) +class AwesomeServer(ServerSystem): + def __init__(self, namespace, systemName): + ServerSystem.__init__(self, namespace, systemName) #注册事件 self.ListenForEvent( - serverApi.GetEngineNamespace(), + serverApi.GetEngineNamespace(), serverApi.GetEngineSystemName(), modConfig.AddServerPlayerEvent, self, self.OnAddServerPlayer - ) - ... - - def OnAddServerPlayer(self, args): - ''' - 添加玩家的监听函数 - ''' - playerId = args.get('id','-1') - uid = netgameApi.GetPlayerUid(playerId) - self.mPlayerid2uid[playerId] = uid - + ) + ... + + def OnAddServerPlayer(self, args): + ''' + 添加玩家的监听函数 + ''' + playerId = args.get('id','-1') + uid = netgameApi.GetPlayerUid(playerId) + self.mPlayerid2uid[playerId] = uid + ``` ### 读写数据库 @@ -69,14 +69,14 @@ class AwesomeServer(ServerSystem): def __init__(self, namespace, systemName): ... self.mysqlMgr = MysqlOperation() - - def OnAddServerPlayer(self, args): - ''' - 添加玩家的监听函数 - ''' + + def OnAddServerPlayer(self, args): + ''' + 添加玩家的监听函数 + ''' ... self.mysqlMgr.QueryPlayerData(playerId,uid,lambda data: self.QuerySinglePlayerCallback(playerId, uid, data)) - + def QuerySinglePlayerCallback(self, player_id, uid, data): ''' 回调函数。若玩家存在,则注册玩家;否则记录玩家信息 @@ -96,7 +96,7 @@ class AwesomeServer(ServerSystem): #刷新玩家登录时间 player.refreshLoginTime() self.player_map[uid] = player - + ``` ### 同步玩家数据 @@ -112,31 +112,31 @@ class AwesomeClient(ClientSystem): ... # 注册事件 self.ListenForEvent( - modConfig.Minecraft, - modConfig.LobbyServerSystemName, - modConfig.LoginResponseEvent, + modConfig.Minecraft, + modConfig.LobbyServerSystemName, + modConfig.LoginResponseEvent, self, self.OnLoginResponse ) self.ListenForEvent( - clientApi.GetEngineNamespace(), + clientApi.GetEngineNamespace(), clientApi.GetEngineSystemName(), - ‘OnLocalPlayerStopLoading’, + ‘OnLocalPlayerStopLoading’, self, self.OnOnLocalPlayerStopLoading ) self.ListenForEvent( - clientApi.GetEngineNamespace(), - clientApi.GetEngineSystemName(), - 'UiInitFinished', + clientApi.GetEngineNamespace(), + clientApi.GetEngineSystemName(), + 'UiInitFinished', self, self.OnUiInitFinished) self.mMyPlayerData = None - + def OnUiInitFinished(self, args): ''' 初始化UI ''' print 'OnUiInitFinished', args self.InitUi() - + def OnOnLocalPlayerStopLoading(self,args): ''' 请求登录到服务端,获取玩家数据 @@ -164,9 +164,9 @@ class AwesomeClient(ClientSystem): class AwesomeServer(ServerSystem): def __init__(self, namespace, systemName): ... - self.ListenForEvent(modConfig.Minecraft, modConfig.LobbyClientSystemName, + self.ListenForEvent(modConfig.Minecraft, modConfig.LobbyClientSystemName, modConfig.LoginRequestEvent, self, self.OnLoginRequest) - + def OnLoginRequest(self, data): ''' 玩家登录逻辑 @@ -177,7 +177,7 @@ class AwesomeServer(ServerSystem): comp = serverApi.GetEngineCompFactory().CreateDimension(player_id) comp.ChangePlayerDimension(4, (1395.664, 5.2, 51.441)) CoroutineMgr.StartCoroutine(self._DoSendLoginResponseData(player_id, uid)) - + def _DoSendLoginResponseData(self, player_id, uid): ''' 将玩家数据推送给客户端。若还没从db获取玩家数据,则延迟5帧再试 @@ -202,11 +202,11 @@ class AwesomeServer(ServerSystem): - 进入mysql,可以查看到玩家数据: ![image-20210224192541433](./images/image-20210224192541433.png) - + - MCStudio中查看玩家登录日志,也即OnLoginResponse方法打印的日志: ![image-20210224192458475](./images/image-20210224192458475.png) - - + + ## 定时存档 @@ -220,19 +220,19 @@ class AwesomeServer(ServerSystem): ```python class AwesomeServer(ServerSystem): def __init__(self, namespace, systemName): - ... + ... netgameApi.SetUseDatabaseSave(True, "awesome", 120)#定时存档,时间间隔是120s netgameApi.SetNonePlayerSaveMode(True) self.ListenForEvent( - serverApi.GetEngineNamespace(), - serverApi.GetEngineSystemName(), + serverApi.GetEngineNamespace(), + serverApi.GetEngineSystemName(), 'savePlayerDataEvent', self, self.OnSavePlayerData ) self.ListenForEvent( - serverApi.GetEngineNamespace(), - serverApi.GetEngineSystemName(), + serverApi.GetEngineNamespace(), + serverApi.GetEngineSystemName(), 'savePlayerDataOnShutDownEvent', self, self.OnSavePlayerData ) @@ -303,9 +303,9 @@ class AwesomeServer(ServerSystem): def __init__(self, namespace, systemName): ... self.ListenForEvent( - serverApi.GetEngineNamespace(), - serverApi.GetEngineSystemName(), - 'DelServerPlayerEvent', + serverApi.GetEngineNamespace(), + serverApi.GetEngineSystemName(), + 'DelServerPlayerEvent', self, self.OnDelServerPlayer ) @@ -350,13 +350,13 @@ class AwesomeServer(ServerSystem): def __init__(self, namespace, systemName): ... self.ListenForEvent( - serverApi.GetEngineNamespace(), - serverApi.GetEngineSystemName(), + serverApi.GetEngineNamespace(), + serverApi.GetEngineSystemName(), 'ServerWillShutDownEvent', self, self.OnServerWillShutDown ) ... - + def OnServerWillShutDown(self, args): # 即将关机,先给所有还在线玩家挂一个存档任务 for uid, player in self.mPlayerMap.iteritems(): diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第4节:游戏玩法.md b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第4节:游戏玩法.md similarity index 98% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第4节:游戏玩法.md rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第4节:游戏玩法.md index 1b77fba..b6b877a 100644 --- a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第4节:游戏玩法.md +++ b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第4节:游戏玩法.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 20分钟 --- @@ -187,7 +187,7 @@ time: 20分钟 ```python class AwesomeServer(ServerSystem): ... - + def OnNpcTouched(self, npc_entity_id, player_entity_id, gameType): ''' 点击npc回调函数。 @@ -227,8 +227,8 @@ class AwesomeServer(ServerSystem): if playerLevel >= 0:#大于0级才能匹配 request_data = {'uid': uid, 'player_id': playerId,'game':args["game"]} self.RequestToService( - modConfig.awesome_match, - modConfig.RequestMatch, + modConfig.awesome_match, + modConfig.RequestMatch, request_data ) tipData = {'tipType' : TipType.matching} #1匹配中 @@ -261,7 +261,7 @@ class AwesomeServer(ServerSystem): ``` - service开发 -service监听UpdateServerStatusEvent事件,可以获取所有game的状态,这些可用game构成了可用资源池。当有玩家请求匹配时,则从可用资源池中分配资源(也就是匹配算法),然后告知玩家。核心代码如下: +service监听UpdateServerStatusEvent事件,可以获取所有game的状态,这些可用game构成了可用资源池。当有玩家请求匹配时,则从可用资源池中分配资源(也就是匹配算法),然后告知玩家。核心代码如下: ```python class AwesomeService(ServiceSystem): @@ -326,7 +326,7 @@ class AwesomeService(ServiceSystem): playerId = self.mGameCMatchingPlayer[i] self.NotifyToServerNode(self.mPlayerServer[playerId], modConfig.MatchResultEvent, {'player_id': playerId,'desc_game':desc_game,'game':'gameC'}) self.mGameCMatchingPlayer = []#清空匹配队列 - + def Update(self): self.mFrameCnt += 1 if self.mFrameCnt % 10 == 0:#10帧匹配一次 @@ -360,7 +360,7 @@ class AwesomeService(ServiceSystem): ``` - Master开发 -Master查询对应游戏玩家人数用。核心代码如下: +Master查询对应游戏玩家人数用。核心代码如下: ```python class AwesomeMaster(MasterSystem): ... ... @@ -376,13 +376,13 @@ class AwesomeMaster(MasterSystem): for serverid in checkServeridList: playernum += serverManager.GetOnlineNumByServerId(serverid) request_data = { - 'game': args["game"], + 'game': args["game"], 'playernum': playernum, 'player_id':args["player_id"] } self.NotifyToServerNode( - args["client_id"], - modConfig.GetPlayerNumOfGameRequestEvent, + args["client_id"], + modConfig.GetPlayerNumOfGameRequestEvent, request_data) ``` 用MCStudio进入游戏,点击不同的NPC发现切服到对应game。 diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第5节:游戏外功能.md b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第5节:游戏外功能.md similarity index 97% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第5节:游戏外功能.md rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第5节:游戏外功能.md index b3be36b..8117ab3 100644 --- a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第5节:游戏外功能.md +++ b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第5节:游戏外功能.md @@ -22,7 +22,7 @@ master是运营执行入口,开发者可以根据需要,把请求分发到lo 处理过程如下所示: ![img](./images/wps13.jpg) -master主要接受请求然后转发,核心代码如下所示: +master主要接受请求然后转发,核心代码如下所示: ```python class AwesomeMaster(MasterSystem): @@ -31,8 +31,8 @@ class AwesomeMaster(MasterSystem): # 注册gm指令 masterHttp.RegisterMasterHttp('/get-user-info', self, self.OnGetUserInfo) self.DefineEvent('GetUserInfoRequestEvent') self.ListenForEvent( - 'Minecraft', 'AwesomeLobby', - 'GetUserInfoResponseEvent', + 'Minecraft', 'AwesomeLobby', + 'GetUserInfoResponseEvent', self, self.OnGetUserInfoResponse ) @@ -46,7 +46,7 @@ class AwesomeMaster(MasterSystem): redis_key_player = "online_user_%d" % uid #获取玩家在线状态 redisPool.AsyncHgetall( - redis_key_player, + redis_key_player, lambda record:self._GetUserInfoCb(client_id, uid, record) ) @@ -91,9 +91,9 @@ class AwesomeServer(ServerSystem): def __init__(self, namespace, systemName): ServerSystem.__init__(self, namespace, systemName) self.ListenForEvent( - modConfig.Minecraft, modConfig.MasterSystemName, modConfig.GetUserInfoRequestEvent, + modConfig.Minecraft, modConfig.MasterSystemName, modConfig.GetUserInfoRequestEvent, self, self.OnGetUserInfoRequest) - + def OnGetUserInfoRequest(self, args): ''' 获取玩家数据。 diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第6节:优化与维护.md b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第6节:优化与维护.md similarity index 99% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第6节:优化与维护.md rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第6节:优化与维护.md index 49e6e45..e3a0728 100644 --- a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第6节:优化与维护.md +++ b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第6节:优化与维护.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 15分钟 --- diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第7节:控制服务器Mod加载顺序.md b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第7节:控制服务器Mod加载顺序.md similarity index 99% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第7节:控制服务器Mod加载顺序.md rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第7节:控制服务器Mod加载顺序.md index 8469658..96d8c36 100644 --- a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第7节:控制服务器Mod加载顺序.md +++ b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第7节:控制服务器Mod加载顺序.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 5分钟 --- diff --git a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第8节:性能数据.md b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第8节:性能数据.md similarity index 99% rename from mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第8节:性能数据.md rename to mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第8节:性能数据.md index 802a8c5..3d7b173 100644 --- a/mcguide/27-网络游戏/课程4:简易网络服模板知识讲解/第8节:性能数据.md +++ b/mcguide/27-手机网络游戏/课程4:简易网络服模板知识讲解/第8节:性能数据.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 5分钟 --- diff --git a/mcguide/27-网络游戏/课程5:插件教学/README.md b/mcguide/27-手机网络游戏/课程5:插件教学/README.md similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/README.md rename to mcguide/27-手机网络游戏/课程5:插件教学/README.md diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chajian_01.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chajian_01.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chajian_01.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chajian_01.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chajian_02.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chajian_02.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chajian_02.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chajian_02.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chajian_03.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chajian_03.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chajian_03.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chajian_03.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chajian_04.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chajian_04.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chajian_04.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chajian_04.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chajian_05.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chajian_05.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chajian_05.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chajian_05.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chajian_06.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chajian_06.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chajian_06.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chajian_06.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chat_01.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chat_01.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chat_01.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chat_01.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chat_02.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chat_02.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chat_02.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chat_02.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chat_03.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chat_03.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chat_03.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chat_03.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chat_04.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chat_04.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chat_04.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chat_04.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chat_05.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chat_05.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chat_05.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chat_05.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chat_06.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chat_06.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chat_06.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chat_06.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/chat_07.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/chat_07.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/chat_07.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/chat_07.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_01.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_01.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_01.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_01.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_02.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_02.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_02.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_02.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_03.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_03.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_03.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_03.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_04.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_04.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_04.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_04.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_05.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_05.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_05.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_05.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_06.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_06.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_06.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_06.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_07.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_07.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_07.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_07.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_08.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_08.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_08.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_08.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_09.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_09.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_09.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_09.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_10.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_10.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_10.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_10.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_11.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_11.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_11.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_11.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_12.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_12.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_12.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_12.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_13.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_13.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_13.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_13.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_14.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_14.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_14.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_14.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_15.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_15.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_15.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_15.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_16.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_16.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_16.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_16.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_17.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_17.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_17.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_17.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_18.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_18.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_18.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_18.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_19.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_19.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_19.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_19.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_20.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_20.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_20.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_20.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_21.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_21.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_21.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_21.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_22.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_22.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_22.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_22.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_23.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_23.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_23.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_23.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_24.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_24.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_24.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_24.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_25.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_25.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_25.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_25.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_26.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_26.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_26.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_26.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_27.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_27.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_27.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_27.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/ditu_28.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_28.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/ditu_28.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/ditu_28.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/image-20220411162929246.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/image-20220411162929246.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/image-20220411162929246.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/image-20220411162929246.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/image-20220411163053963.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/image-20220411163053963.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/image-20220411163053963.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/image-20220411163053963.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/image-20220411163207919.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/image-20220411163207919.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/image-20220411163207919.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/image-20220411163207919.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/image-20220411163546702.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/image-20220411163546702.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/image-20220411163546702.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/image-20220411163546702.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/image-20220411163641320.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/image-20220411163641320.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/image-20220411163641320.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/image-20220411163641320.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/image-20220411163922869.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/image-20220411163922869.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/image-20220411163922869.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/image-20220411163922869.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/images/plugin_guide.png b/mcguide/27-手机网络游戏/课程5:插件教学/images/plugin_guide.png similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/images/plugin_guide.png rename to mcguide/27-手机网络游戏/课程5:插件教学/images/plugin_guide.png diff --git a/mcguide/27-网络游戏/课程5:插件教学/第0节:使用工作台新建插件.md b/mcguide/27-手机网络游戏/课程5:插件教学/第0节:使用工作台新建插件.md similarity index 100% rename from mcguide/27-网络游戏/课程5:插件教学/第0节:使用工作台新建插件.md rename to mcguide/27-手机网络游戏/课程5:插件教学/第0节:使用工作台新建插件.md diff --git a/mcguide/27-网络游戏/课程5:插件教学/第1节:官网插件规范.md b/mcguide/27-手机网络游戏/课程5:插件教学/第1节:官网插件规范.md similarity index 99% rename from mcguide/27-网络游戏/课程5:插件教学/第1节:官网插件规范.md rename to mcguide/27-手机网络游戏/课程5:插件教学/第1节:官网插件规范.md index ba38de5..82d3217 100644 --- a/mcguide/27-网络游戏/课程5:插件教学/第1节:官网插件规范.md +++ b/mcguide/27-手机网络游戏/课程5:插件教学/第1节:官网插件规范.md @@ -195,7 +195,7 @@ module_names(service mod需要)|配置当前service mod的模块名,要求与 "support_server_type":["lobby"], "author":"lovecraft", "group":"lovecraftGuild", - + "_comment":"公会名称最多支持多少个字符", "guild_name_limit":20, ... @@ -250,7 +250,7 @@ response: "key": value #注释 }, "message": "" -} +} ``` - 更新记录 @@ -312,7 +312,7 @@ response: "name": "player_name" #玩家昵称 }, "message": "" - } + } 更新列表: 1.0.1版本: diff --git a/mcguide/27-网络游戏/课程5:插件教学/第2节:地图插件调整(概述).md b/mcguide/27-手机网络游戏/课程5:插件教学/第2节:地图插件调整(概述).md similarity index 99% rename from mcguide/27-网络游戏/课程5:插件教学/第2节:地图插件调整(概述).md rename to mcguide/27-手机网络游戏/课程5:插件教学/第2节:地图插件调整(概述).md index 2ed1be8..25a6cba 100644 --- a/mcguide/27-网络游戏/课程5:插件教学/第2节:地图插件调整(概述).md +++ b/mcguide/27-手机网络游戏/课程5:插件教学/第2节:地图插件调整(概述).md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 5分钟 --- diff --git a/mcguide/27-网络游戏/课程5:插件教学/第3节:地图插件调整(上).md b/mcguide/27-手机网络游戏/课程5:插件教学/第3节:地图插件调整(上).md similarity index 99% rename from mcguide/27-网络游戏/课程5:插件教学/第3节:地图插件调整(上).md rename to mcguide/27-手机网络游戏/课程5:插件教学/第3节:地图插件调整(上).md index 638f659..043d446 100644 --- a/mcguide/27-网络游戏/课程5:插件教学/第3节:地图插件调整(上).md +++ b/mcguide/27-手机网络游戏/课程5:插件教学/第3节:地图插件调整(上).md @@ -117,7 +117,7 @@ response: | modMain.py # 服务端Mod入口 | playerMgr.py # 服务端Mod中管理玩家的类,主要用于实现【功能6】,具体分析见下文 └─util.py # 服务端Mod的一些功能函数 - └─mapStructureConfig + └─mapStructureConfig └─neteaseMapStructueConfig.json # 此文件是与客户端Mod中mcstructure文件对应的配置文件(内容由编辑器生成) ├─resource_packs # 资源包总目录,插件没有美术资源,所以是空的 ├─worlds diff --git a/mcguide/27-网络游戏/课程5:插件教学/第4节:地图插件调整(中).md b/mcguide/27-手机网络游戏/课程5:插件教学/第4节:地图插件调整(中).md similarity index 99% rename from mcguide/27-网络游戏/课程5:插件教学/第4节:地图插件调整(中).md rename to mcguide/27-手机网络游戏/课程5:插件教学/第4节:地图插件调整(中).md index 9fb9f47..9ea3818 100644 --- a/mcguide/27-网络游戏/课程5:插件教学/第4节:地图插件调整(中).md +++ b/mcguide/27-手机网络游戏/课程5:插件教学/第4节:地图插件调整(中).md @@ -44,11 +44,11 @@ class MapAttrsClientSys(ClientSystem): def __init__(self, namespace, systemName): ... util.ListenClientEngineEvent("DimensionChangeClientEvent", self, self.OnDimChange) - + def OnDimChange(self, data): self.mPlayerDim = data["toDimensionId"] self.mTextMgr.OnDimChange(data) - + def OnLoginResponse(self, data): print 'OnLoginResponse', data self.mPlayerDim = data["dim"] @@ -60,7 +60,7 @@ class MapAttrsClientSys(ClientSystem): def __init__(self, namespace, systemName): ... util.ListenServerEvent(ServerEvent.LoginResponse, self, self.OnLoginResponse) - + def OnLoginResponse(self, data): print 'OnLoginResponse', data self.mPlayerDim = data["dim"] @@ -77,7 +77,7 @@ class TextBoardMgr(object): def __init__(self, playerId, offset=5.0): ... self.mCheckOffset = offset - + def Init(self, configData): # 通过服务端自定义事件【ServerEvent.LoginResponse】中的浮空文字配置信息,生成等待创建的浮空文字字典。 textWithPlaceList = configData.get("text_with_place_list", None) @@ -126,10 +126,10 @@ class MapAttrsServerSys(ServerSystem): ... self.Init() self.mCoroutineMgr = CoroutineMgr() - + def Update(self): self.mCoroutineMgr.Tick() - + def Init(self): ... self.mPlayerMgr = None @@ -168,7 +168,7 @@ if util.GetModConfByField("enable_clean_drop_item"): interval = util.GetModConfByField("clean_drop_item_interval") if interval > 0: self.mCleanDropTimer = gameComp.AddRepeatedTimer(interval, self.CleanDropItem) - + def CleanDropItem(self): comp = extraServerApi.CreateComponent(extraServerApi.GetLevelId(), "Minecraft", "command") comp.SetCommand("/kill @e[type=item]") @@ -219,7 +219,7 @@ def SetMapStructure(self, playerId, playerUid): return for oneConfig in neteaseMapStructureConfig: self.mCoroutineMgr.StartCoroutine(self.RealSetMapStructure(playerId, needChangeDimension, oneConfig, neteaseMapStructureConfig.index(oneConfig) + 1)) - + def RealSetMapStructure(self, playerId, needChangeDimension, oneConfig, delayFrame): yield -1 * delayFrame * 60 tpPos = oneConfig.get("pos") @@ -339,7 +339,7 @@ class PlayerMgr(object): gameComp = extraServerApi.CreateComponent(extraServerApi.GetLevelId(), 'Minecraft', 'game') self.mCheckTimer = gameComp.AddRepeatedTimer(1.0, self.CheckSafePos) ... - + def CheckSafePos(self): for playerId, obj in self.mPlayerMap.iteritems(): ... @@ -369,11 +369,11 @@ class CoroutineMgr(object): ended = [] for c, v in cls.coroutines.iteritems(): try: - if v < 0: + if v < 0: v += 1 cls.coroutines[c] = v if v == 0 or (v > 0 and time.time() >= v): - newv = c.next() + newv = c.next() if newv > 0: newv = newv + time.time() cls.coroutines[c] = newv diff --git a/mcguide/27-网络游戏/课程5:插件教学/第5节:地图插件调整(下).md b/mcguide/27-手机网络游戏/课程5:插件教学/第5节:地图插件调整(下).md similarity index 99% rename from mcguide/27-网络游戏/课程5:插件教学/第5节:地图插件调整(下).md rename to mcguide/27-手机网络游戏/课程5:插件教学/第5节:地图插件调整(下).md index fe37bf8..e186e74 100644 --- a/mcguide/27-网络游戏/课程5:插件教学/第5节:地图插件调整(下).md +++ b/mcguide/27-手机网络游戏/课程5:插件教学/第5节:地图插件调整(下).md @@ -18,7 +18,7 @@ def Init(self): ... util.ListenServerEngineEvent("MobGriefingBlockServerEvent", self, self.OnMobGriefingBlock) ... - + def OnMobGriefingBlock(self, data): # print "OnMobGriefingBlock", data if data["blockName"] in ("minecraft:farmland", ): @@ -33,7 +33,7 @@ def Init(self): ... util.ListenServerEngineEvent("StepOnBlockServerEvent", self, self.OnStepOnBlock) ... - + def OnStepOnBlock(self, data): # print "OnStepOnBlock", data data["cancel"] = True diff --git a/mcguide/27-网络游戏/课程5:插件教学/第6节:聊天插件调整.md b/mcguide/27-手机网络游戏/课程5:插件教学/第6节:聊天插件调整.md similarity index 98% rename from mcguide/27-网络游戏/课程5:插件教学/第6节:聊天插件调整.md rename to mcguide/27-手机网络游戏/课程5:插件教学/第6节:聊天插件调整.md index 6ec1f51..e64e9c4 100644 --- a/mcguide/27-网络游戏/课程5:插件教学/第6节:聊天插件调整.md +++ b/mcguide/27-手机网络游戏/课程5:插件教学/第6节:聊天插件调整.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 45分钟 --- @@ -30,7 +30,7 @@ neteaseChat ------------------------------- 聊天插件(不属于大厅服或 │ ├─behavior_packs -------------------------- 行为包总目录 │ └─neteaseChatBehavior ------------------ 插件行为包 -│ │ manifest.json ------------------- 行为包记录文件,用于标识行为包 +│ │ manifest.json ------------------- 行为包记录文件,用于标识行为包 │ │ │ └─neteaseChatScript ---------------- 客户端Mod脚本根目录 │ │ chatConsts.py --------------- 常量定义 @@ -61,7 +61,7 @@ neteaseChat ------------------------------- 聊天插件(不属于大厅服或 │ │ manifest.json -------------------- 行为包记录文件,用于标识资源包 │ │ │ ├─textures -------------------------- 贴图资源 -│ │ └─ui ----------------------------- UI贴图目录 +│ │ └─ui ----------------------------- UI贴图目录 │ │ └─netease_chat --------------- 聊天界面UI贴图路径 │ │ │ └─ui -------------------------------- UI配置目录 @@ -72,7 +72,7 @@ neteaseChat ------------------------------- 聊天插件(不属于大厅服或 └─level -------------------------------- 存档目录 world_behavior_packs.json ------ 记录用到的行为包 world_resource_packs.json ------ 记录用到的资源包 - + neteaseChatService ------------------------- 聊天插件(部署于功能服) │ readme.txt ------------------------------ 说明文件 │ @@ -161,7 +161,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) } ``` - + 1.2 Client System 初始化,创建UI Manager @@ -173,7 +173,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.mUIMgr = uiMgr.UIMgr() ``` - + 1.3 Service System 初始化,响应`NetGameCommonConfChangeEvent`,创建各服频道和世界频道,服务器列表中的每个服务器创建一个频道,频道id为各服务器id,世界频道id为0 @@ -191,11 +191,11 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.mChatManagers[serverid] = chatManager.ChatManager(self, serverid) if self.mChatManagers.has_key(chatConsts.ALL_SERVER_CHANNEL) == False: self.mChatManagers[chatConsts.ALL_SERVER_CHANNEL] = chatManager.ChatManager(self, chatConsts.ALL_SERVER_CHANNEL) - + self.mCommonConfig = serverIds ``` - + 2. **客户端响应 `UiInitFinished` 事件** @@ -212,7 +212,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.NotifyToServer("ClientUiInitFinished", data) ``` - + 2.3 服务端System响应`ClientUiInitFinished`,获取玩家uid和昵称,发送`ModConfigResponseFromServerEvent`事件和`TellYourPlayerUidAndSidEvent`给客户端 @@ -226,7 +226,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.NotifyToClient(playerId, "TellYourPlayerUidAndSidEvent", {"playerId":playerId, "playerUid":playerUid, "nickName":nickName, "serverid":self.mServerid, 'exBtnList': self.modConfig.get('exBtnList')}) ``` - + 2.4 客户端响应 `ModConfigResponseFromServerEvent`事件,更新聊天插件配置 @@ -236,7 +236,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.modConfig = modConfig ``` - + 2.5 客户端响应`TellYourPlayerUidAndSidEvent`,创建世界频道和本地频道,本地频道id为连接服务器的id,世界频道id为0 @@ -249,13 +249,13 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.mChatManagers[self.mServerid] = chatManager.ChatManager(self, self.mServerid) self.mChatManagers[chatConsts.ALL_SERVER_CHANNEL] = chatManager.ChatManager(self, chatConsts.ALL_SERVER_CHANNEL) self.mCurrentChannel = self.mServerid - + exBtnList = args.get('exBtnList') if isinstance(exBtnList, list) and exBtnList != self.mExBtnList: self.mExBtnList = exBtnList ``` - + #### 主要流程 @@ -277,7 +277,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.NotifyToClient(playerId, "OpenChatList", {}) ``` - + 1.3 客户端响应 `OpenChatList`,显示聊天主界面 @@ -311,14 +311,14 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.SetSprite(self.mChannelBar + '/c0/default', "textures/ui/netease_chat/btn01_select") self.SetSprite(self.mChannelBar + '/c1/default', "textures/ui/netease_chat/btn01") self.mClientSystem.ChangeChannel(0) - + # ChatClientSystem def ChangeChannel(self, channel): self.mCurrentChannel = channel self.BroadcastEvent('LocalChannelChange', {"chatChannel": self.mCurrentChannel}) ``` - + 2.3 响应`LocalChannelChange`,刷新频道聊天消息 @@ -328,7 +328,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) # 请查看源代码 ``` - + 3. **发送消息** @@ -347,7 +347,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) # 省略一些代码 ``` - + 3.3 服务端响应`PlayerChatFfromClientEvent`,发送`ChatFromServerEvent`到功能服 @@ -359,7 +359,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) # 省略一些代码 ``` - + 3.4 功能服响应`ChatFromServerEvent`,插入消息到对应频道 @@ -370,7 +370,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) print "OnChatFromServerEvent", self.mChatManagers.keys() if self.mChatManagers.has_key(chatChannel): self.mChatManagers[chatChannel].InsertChatMes(args) - + # ChatManager def InsertChatMes(self, args): print "serviceInsertChatMes", args @@ -382,7 +382,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.TellServerNewChat(chatDict) ``` - + 3.5 功能服Chat Manager发送消息到频道所在服务器,如果是世界频道的消息,则发到所有服务器,通过发送`newChatFromServiceEvent`实现 @@ -397,7 +397,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.system.NotifyToServerNode(serverid, "newChatFromServiceEvent", chatDict) ``` - + 3.6 服务端响应`newChatFromServiceEvent`,插入消息到对应频道 @@ -408,7 +408,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) chatChannel = chatDict["chatChannel"] if self.mChatManagers.has_key(chatChannel): self.mChatManagers[chatChannel].InsertChatMes(chatDict) - + # ChatManager def InsertChatMes(self, chatDict): print "ServerInsertChatMes", chatDict @@ -419,7 +419,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.TellClientNewChat(chatDict) ``` - + 3.7 服务端Chat Manager发送消息到所有客户端,通过发送`newChatFromServerEvent`实现 @@ -430,7 +430,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) print "newChatFromServerEvent", chatDict ``` - + 3.8 客户端响应`newChatFromServerEvent`,插入消息到对应频道 @@ -442,7 +442,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) chatChannel = chatDict["chatChannel"] if self.mChatManagers.has_key(chatChannel): self.mChatManagers[chatChannel].InsertChatMes(chatDict) - # ChatManager + # ChatManager def InsertChatMes(self, chatDict): print "ClientInsertChatMes", chatDict playerUid = chatDict["playerUid"] @@ -457,19 +457,19 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.mDirty = True ``` - + 3.9 客户端Chat Manager定时刷新本频道的未读消息,广播事件`LocalNewChatRecord` ```python - # ChatManager + # ChatManager def RepeatedTellClientNewChat(self): if self.mDirty == True: self.system.BroadcastEvent('LocalNewChatRecord', {"chatChannel":self.mChatChannel}) self.mDirty = False ``` - + 3.10 Chat UI响应`LocalNewChatRecord`,刷新当前频道消息 @@ -521,9 +521,9 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.mChatManagers[serverid] = chatManager.ChatManager(self, serverid, conf['app_type']) if self.mChatManagers.has_key(chatConsts.ALL_SERVER_CHANNEL) == False: self.mChatManagers[chatConsts.ALL_SERVER_CHANNEL] = chatManager.ChatManager(self, chatConsts.ALL_SERVER_CHANNEL) - + self.mCommonConfig = serverIds - + # ChatManager修改 # 创建ChatManager时保存 服务器类型 class ChatManager(object): @@ -534,7 +534,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) self.mChatRecords = [] # 修改此处 self.mType = channelType - + # 拼接聊天消息时加入服务器类型 def GenChatDict(self, args): chatDict = { @@ -549,11 +549,11 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) # 修改此处 "serverType": self.mType } - return chatDict - + return chatDict + ``` - + 2. 增加切服逻辑 @@ -591,7 +591,7 @@ neteaseChatService ------------------------- 聊天插件(部署于功能服) richText = "§e[%s]§r%s 邀请大家一起加入队伍。%s" % (serverType, playerText, mes) # 省略一些代码 ``` - + ### 部署 diff --git a/mcguide/27-网络游戏/课程5:插件教学/第7节:插件系列教程.md b/mcguide/27-手机网络游戏/课程5:插件教学/第7节:插件系列教程.md similarity index 88% rename from mcguide/27-网络游戏/课程5:插件教学/第7节:插件系列教程.md rename to mcguide/27-手机网络游戏/课程5:插件教学/第7节:插件系列教程.md index 7b8e431..ddc9540 100644 --- a/mcguide/27-网络游戏/课程5:插件教学/第7节:插件系列教程.md +++ b/mcguide/27-手机网络游戏/课程5:插件教学/第7节:插件系列教程.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 120分钟 --- @@ -24,9 +24,9 @@ time: 120分钟 - 04插件制作——本章以实战内容为主,先介绍插件开发的规范,再以官方插件为例拆解相关知识点,最后以一个全新插件为例,从需求分析、架构规划到代码编写,详细说明插件开发。开发者可根本本章的说明与代码,从实战中学习插件开发。 - + ### 跳转链接 -[课程链接](https://mc.163.com/dev/mcmanual/mc-dev/mconline/100-历史归档教程/30-网络服插件教程/1-准备知识/0-插件的概念.html) +[课程链接](https://mc.163.com/dev/mcmanual/mc-dev/mconline/30-网络服插件教程/1-准备知识/0-插件的概念.html) diff --git a/mcguide/27-网络游戏/课程6:模板教学/README.md b/mcguide/27-手机网络游戏/课程6:模板教学/README.md similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/README.md rename to mcguide/27-手机网络游戏/课程6:模板教学/README.md diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG1.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG1.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG1.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG1.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG10.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG10.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG10.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG10.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG11.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG11.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG11.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG11.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG12.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG12.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG12.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG12.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG13.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG13.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG13.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG13.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG14.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG14.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG14.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG14.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG15.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG15.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG15.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG15.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG16.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG16.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG16.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG16.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG17.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG17.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG17.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG17.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG18.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG18.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG18.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG18.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG19.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG19.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG19.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG19.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG2.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG2.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG2.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG2.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG20.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG20.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG20.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG20.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG21.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG21.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG21.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG21.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG22.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG22.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG22.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG22.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG23.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG23.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG23.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG23.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG24.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG24.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG24.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG24.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG25.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG25.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG25.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG25.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG26.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG26.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG26.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG26.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG27.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG27.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG27.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG27.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG3.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG3.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG3.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG3.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG4.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG4.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG4.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG4.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG5.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG5.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG5.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG5.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG6.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG6.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG6.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG6.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG7.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG7.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG7.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG7.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG8.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG8.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG8.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG8.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/RPG9.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/RPG9.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/RPG9.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/RPG9.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR1.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR1.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR1.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR1.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR10.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR10.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR10.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR10.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR11.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR11.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR11.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR11.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR12.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR12.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR12.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR12.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR13.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR13.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR13.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR13.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR2.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR2.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR2.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR2.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR3.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR3.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR3.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR3.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR4.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR4.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR4.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR4.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR5.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR5.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR5.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR5.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR6.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR6.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR6.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR6.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR7.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR7.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR7.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR7.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR8.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR8.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR8.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR8.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/images/WAR9.png b/mcguide/27-手机网络游戏/课程6:模板教学/images/WAR9.png similarity index 100% rename from mcguide/27-网络游戏/课程6:模板教学/images/WAR9.png rename to mcguide/27-手机网络游戏/课程6:模板教学/images/WAR9.png diff --git a/mcguide/27-网络游戏/课程6:模板教学/第1节:生存+RPG服模板简介.md b/mcguide/27-手机网络游戏/课程6:模板教学/第1节:生存+RPG服模板简介.md similarity index 98% rename from mcguide/27-网络游戏/课程6:模板教学/第1节:生存+RPG服模板简介.md rename to mcguide/27-手机网络游戏/课程6:模板教学/第1节:生存+RPG服模板简介.md index 88c113f..86f528f 100644 --- a/mcguide/27-网络游戏/课程6:模板教学/第1节:生存+RPG服模板简介.md +++ b/mcguide/27-手机网络游戏/课程6:模板教学/第1节:生存+RPG服模板简介.md @@ -6,7 +6,7 @@ time: 60分钟 # 生存+RPG服模板简介 -## 概述 +## 概述 ​ 这是常见的带生存元素的RPG网络游戏模板,包含常见的功能,供开发者参考学习。 @@ -16,7 +16,7 @@ time: 60分钟 -## 如何运行模板 +## 如何运行模板 - 步骤1:MCStudio——新建——基岩版网络服——生存+RPG模板。 @@ -245,7 +245,7 @@ time: 60分钟 - 排行榜奖励放在neteaseRawer\behavior_packs\neteaseRawerBeh\neteaseRawerScript\commonConfig\rawerRankConfig.py。 - + ## 插件代码说明 @@ -257,13 +257,13 @@ time: 60分钟 - 修改setlayer逻辑,让界面堆叠更合理 - + ### 2、面板描述 - 无修改 - + ### 3、战斗系统 @@ -281,19 +281,19 @@ time: 60分钟 - battleServerSystem设置怪物属性、装备属性,提供了除了在mod.json中配置之外的另外一种方案 - + ### 4、聊天 - 修改setlayer逻辑,让界面堆叠更合理 - + ### 5、云端玩家信息 - 无修改 - + ### 6、每日登陆 @@ -301,13 +301,13 @@ time: 60分钟 - dailyServerSystem增加每日功能尚未领取判断 - + ### 7、副本 - 修改setlayer逻辑,让界面堆叠更合理 - + ### 8、好友 @@ -325,19 +325,19 @@ time: 60分钟 - 运营数据记录:加入公会时记录角色ID、公会ID,离开公会时记录角色ID、公会ID,每日排行榜结算时,记录排行榜前20的数据 - + ### 10、宝石 - 修改setlayer逻辑,让界面堆叠更合理 - + ### 11、称号 - 无修改 - + ### 12、主菜单 @@ -345,13 +345,13 @@ time: 60分钟 - 原生menu控件的点击按钮响应是直接发送给了按钮控件的服务端mod处理,改写后直接把事件发送给了主逻辑,然后在主逻辑里面处理是直接显示界面 - + ### 13、功能NPC - 无修改 - + ### 14、pvp @@ -365,7 +365,7 @@ time: 60分钟 - 增加结算逻辑 - + ### 16、领地 @@ -377,7 +377,7 @@ time: 60分钟 - residenceGasMgr中增加地皮构建逻辑:InitRawerResidence,增加了初始地皮无属主的逻辑,增加了认领地皮的逻辑,增加了不允许新建、改建领地的提示 - + ### 17、队伍 @@ -385,7 +385,7 @@ time: 60分钟 - OnPosDataToAllMembersReq,队长主导开始进入副本服后,向所有队员发送事件,队员也会一起开始转服进对应的副本 - + ### 18、摆摊 @@ -405,29 +405,29 @@ time: 60分钟 - behavior_packs 1)副本中怪物的行为、属性配置 - + 2)角色属性配置 - + 3)各等级副本的通关要求、开放等级配置 - + 4)各种物品的属性、tips配置 - + 5)排行榜奖励配置 6)副本选择、积分、进入、结算界面 - + 7)主菜单按钮状态、提示 - + 8)各类自定义物品、合成配方 - + 9)领地、资源世界、珍稀资源传送平台结构 - + - develop_mods 1)游戏各种主要逻辑,包含但不限于:角色、怪物属性设置,升级,加经验,复活,玩家登录、离开服务器,使用物品, 死亡,货币变化。 - + - resource_packs 1)各种自定义物品、NPC的外观、贴图资源 - + - worlds 1)不包含具体地图 @@ -440,25 +440,25 @@ time: 60分钟 - develop_mods 1)购买领地 - + 2)设置出生点、游戏模式、难度 - worlds 1)领地地图 - + ### 3、neteaseRawerMine——资源世界game服 - behavior_packs 1)通用代码 - + - develop_mods 1)设置不同资源世界的伤害系数 - + 2)设置出生点、游戏模式、难度 - + - worlds 1)原版资源世界地图的主世界和下界,无需新增地图 @@ -468,12 +468,12 @@ time: 60分钟 - behavior_packs 1)通用代码 - + - develop_mods 1)副本各种主要逻辑:玩家进入副本、怪物死亡结算、玩家死亡计算、玩家复活、离开副本 - + 2)设置出生点、游戏模式、难度 - + - worlds 1)副本地图 @@ -483,12 +483,12 @@ time: 60分钟 - behavior_packs 1)通用代码 - + - develop_mods 1)大厅各种主要逻辑:开启主城保护,禁止主城刷怪,加载NPC,NPC打开功能界面以及具体跳转功能,召集队员进副本 - + 2)设置出生点、游戏模式、难度 - + - worlds 1)大厅地图 diff --git a/mcguide/27-网络游戏/课程6:模板教学/第2节:小游戏服模板简介.md b/mcguide/27-手机网络游戏/课程6:模板教学/第2节:小游戏服模板简介.md similarity index 98% rename from mcguide/27-网络游戏/课程6:模板教学/第2节:小游戏服模板简介.md rename to mcguide/27-手机网络游戏/课程6:模板教学/第2节:小游戏服模板简介.md index e4f5fc7..adffb1f 100644 --- a/mcguide/27-网络游戏/课程6:模板教学/第2节:小游戏服模板简介.md +++ b/mcguide/27-手机网络游戏/课程6:模板教学/第2节:小游戏服模板简介.md @@ -6,7 +6,7 @@ time: 60分钟 # 小游戏服模板简介 -## 概述 +## 概述 ​ 这是常见的小游戏网络游戏模板,供开发者参考学习。 @@ -26,7 +26,7 @@ time: 60分钟 -## 如何运行模板 +## 如何运行模板 - 步骤1:MCStudio——新建——基岩版网络服——小游戏模板。 @@ -119,9 +119,9 @@ time: 60分钟 - 自定义物品、货币放在neteaseWars\behavior_packs\netease_items_beh之下。 - - + + ## 插件代码说明 @@ -170,7 +170,7 @@ time: 60分钟 - neteaseBedwar\script_Currency\modServer\serverSystem\currencyServerSystem.py中,增加一个集合用于记录当前服务器参与起床战争的玩家,若加入游戏,则进入该集合,若退出游戏,则从该集合中移除。集合中的玩家,定期将背包中的货币更新到界面中。 - + ## 核心代码说明 @@ -180,33 +180,33 @@ time: 60分钟 - game服、lobby服通用 - + - behavior_packs 1)两种飞行体验券、两种货币配置。 - + 2)起床战争中增加离开逻辑,增加结算显示逻辑。 - + 3)从大厅进入起床战争之前,增加二次确认功能。若玩家选择确认,则向服务器发起申请游戏房间请求。 - + 4)对于新增的两种飞行体验券以及两种货币,双击物品栏,将使用该位置全部堆叠物品。 - + 5)榜首形象设置。 - - + + - develop_mods 1)控制大厅服npc创建。 - + 2)进入、离开起床战争的服务器跳转。 - - - + + + - resource_packs 1)各种自定义物品、界面资源 - - - + + + - worlds 1)不包含具体地图 diff --git a/mcguide/27-网络游戏/课程7:开发技巧/README.md b/mcguide/27-手机网络游戏/课程7:开发技巧/README.md similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/README.md rename to mcguide/27-手机网络游戏/课程7:开发技巧/README.md diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/cmd1.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd1.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/cmd1.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd1.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/cmd11.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd11.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/cmd11.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd11.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/cmd12.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd12.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/cmd12.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd12.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/cmd4.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd4.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/cmd4.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd4.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/cmd6.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd6.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/cmd6.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd6.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/cmd7.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd7.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/cmd7.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd7.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/cmd9.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd9.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/cmd9.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/cmd9.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_01.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_01.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_01.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_01.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_02.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_02.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_02.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_02.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_03.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_03.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_03.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_03.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_04.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_04.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_04.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_04.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_05.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_05.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_05.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_05.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_06.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_06.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_06.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_06.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_07.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_07.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_07.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_07.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_08.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_08.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/help_ui_08.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/help_ui_08.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411193031517.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411193031517.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411193031517.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411193031517.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411202033275.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411202033275.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411202033275.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411202033275.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411202352736.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411202352736.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411202352736.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411202352736.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411202445382.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411202445382.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411202445382.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411202445382.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411203104534.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411203104534.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411203104534.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411203104534.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411203212061.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411203212061.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411203212061.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411203212061.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411204137558.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411204137558.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/image-20220411204137558.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220411204137558.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/image-20220412161046230.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220412161046230.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/image-20220412161046230.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/image-20220412161046230.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/zdbs01.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/zdbs01.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/zdbs01.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/zdbs01.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/zdbs02.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/zdbs02.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/zdbs02.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/zdbs02.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/zdbs03.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/zdbs03.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/zdbs03.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/zdbs03.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/images/zdbs04.png b/mcguide/27-手机网络游戏/课程7:开发技巧/images/zdbs04.png similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/images/zdbs04.png rename to mcguide/27-手机网络游戏/课程7:开发技巧/images/zdbs04.png diff --git a/mcguide/27-网络游戏/课程7:开发技巧/第1节:UI表现提升小技巧.md b/mcguide/27-手机网络游戏/课程7:开发技巧/第1节:UI表现提升小技巧.md similarity index 99% rename from mcguide/27-网络游戏/课程7:开发技巧/第1节:UI表现提升小技巧.md rename to mcguide/27-手机网络游戏/课程7:开发技巧/第1节:UI表现提升小技巧.md index 27bf9a5..04cf8ef 100644 --- a/mcguide/27-网络游戏/课程7:开发技巧/第1节:UI表现提升小技巧.md +++ b/mcguide/27-手机网络游戏/课程7:开发技巧/第1节:UI表现提升小技巧.md @@ -97,7 +97,7 @@ class UIMgr(object): return ui # 假如没有缓存,那么新【创建】一个 return self.CreateSingleUI(uiKey) - + # 【显示】一个UI界面 # 假如UI还没有【创建】过,那么先执行【创建】流程 # 假如UI已经完成了【创建】,那么直接从缓存中获取UI实例 @@ -185,10 +185,10 @@ def PlusSomePart(self, plusNum): baseUIControl.SetVisible(True) self.mOnUseParts.append(data["id"]) self.ResizeScroll() - + def OnButtonAsyncPlus(self, plusNum, args): self.mAyncPlusLeftNum += plusNum - + def Update(self): if self.mAyncPlusLeftNum <= 0: return diff --git a/mcguide/27-网络游戏/课程7:开发技巧/第2节:多账号协同部署.md b/mcguide/27-手机网络游戏/课程7:开发技巧/第2节:多账号协同部署.md similarity index 99% rename from mcguide/27-网络游戏/课程7:开发技巧/第2节:多账号协同部署.md rename to mcguide/27-手机网络游戏/课程7:开发技巧/第2节:多账号协同部署.md index dba93e1..9b41727 100644 --- a/mcguide/27-网络游戏/课程7:开发技巧/第2节:多账号协同部署.md +++ b/mcguide/27-手机网络游戏/课程7:开发技巧/第2节:多账号协同部署.md @@ -38,7 +38,7 @@ time: 20分钟 - 对于自动部署中的网络游戏,点击“关闭自动部署”按钮,可关闭自动部署功能。 - + - 对于子账号,也能查看自动部署日志。 diff --git a/mcguide/27-网络游戏/课程7:开发技巧/第3节:控制台调试.md b/mcguide/27-手机网络游戏/课程7:开发技巧/第3节:控制台调试.md similarity index 96% rename from mcguide/27-网络游戏/课程7:开发技巧/第3节:控制台调试.md rename to mcguide/27-手机网络游戏/课程7:开发技巧/第3节:控制台调试.md index 53cbb4d..6b0f3ab 100644 --- a/mcguide/27-网络游戏/课程7:开发技巧/第3节:控制台调试.md +++ b/mcguide/27-手机网络游戏/课程7:开发技巧/第3节:控制台调试.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 20分钟 --- @@ -12,7 +12,7 @@ time: 20分钟 - ​ 脚本测试:便于加载mod的时候,额外执行脚本,获取关注的变量或返回值。 - ​ 原生指令:可在指定的服务器类型,执行原生指令。 -- ​ POST指令:POST指令是Apollo网络服的自定义指令,固定在控制服(Master)执行。 +- ​ POST指令:POST指令是Apollo网络服的自定义指令,固定在控制服(Master)执行。 @@ -58,6 +58,6 @@ time: 20分钟 ![](./images/cmd11.png) -​ +​ ![](./images/cmd12.png) \ No newline at end of file diff --git a/mcguide/27-网络游戏/课程7:开发技巧/第4节:子账号部署和控制台调试功能.md b/mcguide/27-手机网络游戏/课程7:开发技巧/第4节:子账号部署和控制台调试功能.md similarity index 100% rename from mcguide/27-网络游戏/课程7:开发技巧/第4节:子账号部署和控制台调试功能.md rename to mcguide/27-手机网络游戏/课程7:开发技巧/第4节:子账号部署和控制台调试功能.md diff --git a/mcguide/27-网络游戏/课程8:性能优化/README.md b/mcguide/27-手机网络游戏/课程8:性能优化/README.md similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/README.md rename to mcguide/27-手机网络游戏/课程8:性能优化/README.md diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/help_debug_01.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/help_debug_01.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/help_debug_01.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/help_debug_01.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/help_debug_02.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/help_debug_02.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/help_debug_02.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/help_debug_02.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/help_debug_03.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/help_debug_03.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/help_debug_03.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/help_debug_03.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/mysql001.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/mysql001.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/mysql001.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/mysql001.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/mysql002.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/mysql002.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/mysql002.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/mysql002.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/mysql003.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/mysql003.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/mysql003.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/mysql003.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/mysql004.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/mysql004.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/mysql004.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/mysql004.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/mysql005.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/mysql005.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/mysql005.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/mysql005.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/opt01.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/opt01.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/opt01.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/opt01.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/opt02.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/opt02.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/opt02.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/opt02.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile001.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile001.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile001.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile001.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile002.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile002.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile002.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile002.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile003.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile003.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile003.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile003.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile004.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile004.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile004.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile004.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile006.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile006.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile006.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile006.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile007.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile007.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile007.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile007.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile008.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile008.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile008.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile008.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile009.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile009.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile009.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile009.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile010.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile010.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile010.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile010.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile011.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile011.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile011.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile011.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile012.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile012.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile012.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile012.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile013.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile013.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile013.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile013.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile014.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile014.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile014.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile014.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile015.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile015.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile015.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile015.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile016.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile016.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile016.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile016.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile017.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile017.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile017.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile017.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile018.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile018.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile018.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile018.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile019.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile019.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile019.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile019.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile020.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile020.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile020.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile020.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile021.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile021.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile021.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile021.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/profile022.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/profile022.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/profile022.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/profile022.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/quick01.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/quick01.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/quick01.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/quick01.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/quick03_1.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/quick03_1.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/quick03_1.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/quick03_1.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/quick03_2.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/quick03_2.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/quick03_2.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/quick03_2.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/quick03_3.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/quick03_3.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/quick03_3.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/quick03_3.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/quick04.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/quick04.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/quick04.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/quick04.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/images/redis1.png b/mcguide/27-手机网络游戏/课程8:性能优化/images/redis1.png similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/images/redis1.png rename to mcguide/27-手机网络游戏/课程8:性能优化/images/redis1.png diff --git a/mcguide/27-网络游戏/课程8:性能优化/第1节:插件调试小技巧.md b/mcguide/27-手机网络游戏/课程8:性能优化/第1节:插件调试小技巧.md similarity index 99% rename from mcguide/27-网络游戏/课程8:性能优化/第1节:插件调试小技巧.md rename to mcguide/27-手机网络游戏/课程8:性能优化/第1节:插件调试小技巧.md index 81d8253..7080617 100644 --- a/mcguide/27-网络游戏/课程8:性能优化/第1节:插件调试小技巧.md +++ b/mcguide/27-手机网络游戏/课程8:性能优化/第1节:插件调试小技巧.md @@ -8,7 +8,7 @@ time: 20分钟 ## 定位内存增长 * 使用运营指令【/check-memory-run】检查服务器脚本层内存泄漏。需要执行两次指令,第一次生成快照,第二次生成同第一次的diff。 参数为: -关键字 | 数据类型| 说明 +关键字 | 数据类型| 说明 ---|:---|---: serverId |int | useList |list | 通常是 ["tracemalloc", "objreport"] @@ -28,7 +28,7 @@ curl -X POST '42.186.17.79:8014/check-memory-run' -H 'Content-Type: application/ ``` [2021-05-06 16:27:23 INFO] Python:[2021-05-06 16:27:23,359] [INFO][Engine] run_check use_list:['tracemalloc', 'objreport'] obj_names:[] [2021-05-06 16:27:23 INFO] Python:[2021-05-06 16:27:23,399] [INFO][Engine] run_tracemalloc traceback -[2021-05-06 16:27:23 INFO] Python:[2021-05-06 16:27:23,422] [INFO][Engine] Top 10 differences +[2021-05-06 16:27:23 INFO] Python:[2021-05-06 16:27:23,422] [INFO][Engine] Top 10 differences [2021-05-06 16:27:23 INFO] Python:redirect.py:127: size=195 KiB (+195 KiB), count=1860 (+1860), average=107 B [2021-05-06 16:27:23 INFO] Python:mod/server/memory/obj_report.py:43: size=48.0 KiB (+48.0 KiB), count=1 (+1), average=48.0 KiB [2021-05-06 16:27:23 INFO] Python:/usr/local/lib/python2.7/re.py:261: size=12.0 KiB (+12.0 KiB), count=1 (+1), average=12.0 KiB @@ -78,7 +78,7 @@ curl -X POST '42.186.17.79:8014/check-memory-run' -H 'Content-Type: application/ ## 实时定位性能问题 * 使用运营指令【/profile】测量python函数占用cpu时间。需要执行两次指令,第一次开始profile,第二次生成性能数据文件。性能数据文件放到可执行文件所在目录下的profile子目录中。性能数据文件名的格式:profile+生成文件的时间戳 参数为: -关键字 | 数据类型| 说明 +关键字 | 数据类型| 说明 ---|:---|---: serverId |int |服务器对应ID。0表示为master,-1表示所有服务器,其他表示lobby/game/service的服务器ID bBegin |bool |true:开始profile;false:完成profile| diff --git a/mcguide/27-网络游戏/课程8:性能优化/第2节:性能开关.md b/mcguide/27-手机网络游戏/课程8:性能优化/第2节:性能开关.md similarity index 98% rename from mcguide/27-网络游戏/课程8:性能优化/第2节:性能开关.md rename to mcguide/27-手机网络游戏/课程8:性能优化/第2节:性能开关.md index 4b6ad8f..721ac2d 100644 --- a/mcguide/27-网络游戏/课程8:性能优化/第2节:性能开关.md +++ b/mcguide/27-手机网络游戏/课程8:性能优化/第2节:性能开关.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 20分钟 --- @@ -18,7 +18,7 @@ time: 20分钟 -​ +​ diff --git a/mcguide/27-网络游戏/课程8:性能优化/第3节:快速切服.md b/mcguide/27-手机网络游戏/课程8:性能优化/第3节:快速切服.md similarity index 98% rename from mcguide/27-网络游戏/课程8:性能优化/第3节:快速切服.md rename to mcguide/27-手机网络游戏/课程8:性能优化/第3节:快速切服.md index 6cb23f6..ef9c7f6 100644 --- a/mcguide/27-网络游戏/课程8:性能优化/第3节:快速切服.md +++ b/mcguide/27-手机网络游戏/课程8:性能优化/第3节:快速切服.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 20分钟 --- @@ -16,7 +16,7 @@ time: 20分钟 ### 跳转的服务器具有相同的mod -​ 应用场景举例:假设该游戏具有两类game服,gameA、gameB部署了相同的插件。需要实现gameA到gameA或gameA到gameB之间的快速切服。 +​ 应用场景举例:假设该游戏具有两类game服,gameA、gameB部署了相同的插件。需要实现gameA到gameA或gameA到gameB之间的快速切服。 ​ 详见接口介绍: diff --git a/mcguide/27-网络游戏/课程8:性能优化/第4节:数据库优化小技巧.md b/mcguide/27-手机网络游戏/课程8:性能优化/第4节:数据库优化小技巧.md similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/第4节:数据库优化小技巧.md rename to mcguide/27-手机网络游戏/课程8:性能优化/第4节:数据库优化小技巧.md diff --git a/mcguide/27-网络游戏/课程8:性能优化/第5节:Redis缓存的使用.md b/mcguide/27-手机网络游戏/课程8:性能优化/第5节:Redis缓存的使用.md similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/第5节:Redis缓存的使用.md rename to mcguide/27-手机网络游戏/课程8:性能优化/第5节:Redis缓存的使用.md diff --git a/mcguide/27-网络游戏/课程8:性能优化/第6节:性能优化小贴士.md b/mcguide/27-手机网络游戏/课程8:性能优化/第6节:性能优化小贴士.md similarity index 99% rename from mcguide/27-网络游戏/课程8:性能优化/第6节:性能优化小贴士.md rename to mcguide/27-手机网络游戏/课程8:性能优化/第6节:性能优化小贴士.md index a3be37b..7cc0300 100644 --- a/mcguide/27-网络游戏/课程8:性能优化/第6节:性能优化小贴士.md +++ b/mcguide/27-手机网络游戏/课程8:性能优化/第6节:性能优化小贴士.md @@ -207,7 +207,7 @@ class Buff(object): @property def data(self): return self._data - + a = Buff() b = a.dataGetter n = 10000000 @@ -264,7 +264,7 @@ for i in xrange(1000000): # 3.33126372555 提升19% # ************************************************** # 1.0912625188 提升99.9999% -# 2.64364066034e-05 +# 2.64364066034e-05 ``` ### 分支逻辑改成dict lookup进行分发 ```Python diff --git a/mcguide/27-网络游戏/课程8:性能优化/第7节:服务器部署优化.md b/mcguide/27-手机网络游戏/课程8:性能优化/第7节:服务器部署优化.md similarity index 100% rename from mcguide/27-网络游戏/课程8:性能优化/第7节:服务器部署优化.md rename to mcguide/27-手机网络游戏/课程8:性能优化/第7节:服务器部署优化.md diff --git a/mcguide/27-网络游戏/课程9:服务器上线/README.md b/mcguide/27-手机网络游戏/课程9:服务器上线/README.md similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/README.md rename to mcguide/27-手机网络游戏/课程9:服务器上线/README.md diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/1588127428119.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/1588127428119.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/1588127428119.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/1588127428119.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/1588127516541.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/1588127516541.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/1588127516541.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/1588127516541.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/1588151529184.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/1588151529184.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/1588151529184.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/1588151529184.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/1588151626891.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/1588151626891.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/1588151626891.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/1588151626891.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/1588151711263.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/1588151711263.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/1588151711263.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/1588151711263.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/1591086788989.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/1591086788989.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/1591086788989.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/1591086788989.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-15-20-46-23.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-15-20-46-23.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-15-20-46-23.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-15-20-46-23.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-15-21-07-01.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-15-21-07-01.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-15-21-07-01.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-15-21-07-01.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-15-21-10-38.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-15-21-10-38.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-15-21-10-38.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-15-21-10-38.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-16-20-04-20.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-16-20-04-20.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-16-20-04-20.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-16-20-04-20.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-16-20-11-16.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-16-20-11-16.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-16-20-11-16.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-16-20-11-16.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-16-20-22-19.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-16-20-22-19.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-16-20-22-19.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-16-20-22-19.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-16-20-31-41.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-16-20-31-41.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-16-20-31-41.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-16-20-31-41.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-16-20-53-45.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-16-20-53-45.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-16-20-53-45.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-16-20-53-45.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-16-20-55-42.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-16-20-55-42.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/2019-05-16-20-55-42.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/2019-05-16-20-55-42.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/IMG20200604_160631.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/IMG20200604_160631.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/IMG20200604_160631.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/IMG20200604_160631.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database001.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database001.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database001.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database001.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database002.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database002.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database002.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database002.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database003.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database003.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database003.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database003.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database004.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database004.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database004.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database004.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database005.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database005.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database005.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database005.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database006.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database006.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database006.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database006.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database007.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database007.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database007.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database007.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database008.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database008.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database008.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database008.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database009.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database009.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database009.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database009.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database010.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database010.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database010.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database010.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database011.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database011.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database011.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database011.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database012.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database012.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database012.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database012.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database013.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database013.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database013.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database013.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database014.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database014.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database014.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database014.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database015.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database015.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database015.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database015.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database016.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database016.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database016.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database016.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/database017.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/database017.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/database017.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/database017.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/elk001.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/elk001.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/elk001.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/elk001.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/elk002.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/elk002.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/elk002.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/elk002.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/elk003.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/elk003.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/elk003.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/elk003.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/elk004.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/elk004.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/elk004.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/elk004.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/elk005.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/elk005.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/elk005.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/elk005.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_01.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_01.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_01.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_01.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_02.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_02.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_02.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_02.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_01.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_01.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_01.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_01.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_02.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_02.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_02.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_02.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_03.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_03.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_03.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_03.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_04.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_04.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_04.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_04.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_05.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_05.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_05.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_05.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_06.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_06.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_06.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_06.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_07.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_07.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_07.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_07.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_08.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_08.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_08.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_08.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_09.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_09.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_09.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_09.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_10.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_10.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_10.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_10.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_11.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_11.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_11.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_11.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_12.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_12.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_12.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_12.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_13.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_13.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_13.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_13.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_14.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_14.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_14.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_14.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_15.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_15.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_15.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_15.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_16.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_16.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_16.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_16.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_17.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_17.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_17.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_17.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_18.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_18.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_18.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_18.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_19.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_19.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_19.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_19.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_20.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_20.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_20.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_20.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_21.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_21.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_21.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_21.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_22.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_22.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/grafana_help_22.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/grafana_help_22.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/hotfix_01.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/hotfix_01.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/hotfix_01.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/hotfix_01.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/hotfix_02.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/hotfix_02.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/hotfix_02.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/hotfix_02.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015145555301.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015145555301.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015145555301.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015145555301.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015153007727.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015153007727.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015153007727.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015153007727.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015153253908.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015153253908.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015153253908.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015153253908.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015153406700.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015153406700.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015153406700.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015153406700.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015153546589.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015153546589.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015153546589.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015153546589.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015153719169.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015153719169.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015153719169.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015153719169.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015170824022.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015170824022.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/image-20211015170824022.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/image-20211015170824022.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts01.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts01.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts01.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts01.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts02.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts02.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts02.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts02.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts03.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts03.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts03.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts03.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts04.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts04.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts04.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts04.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts05.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts05.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts05.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts05.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts06.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts06.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts06.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts06.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts07.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts07.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts07.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts07.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts08.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts08.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts08.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts08.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts09.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts09.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts09.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts09.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts10.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts10.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts10.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts10.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts11.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts11.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts11.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts11.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts12.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts12.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts12.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts12.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts13.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts13.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts13.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts13.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/img_ts14.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts14.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/img_ts14.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/img_ts14.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/plugin_11.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/plugin_11.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/plugin_11.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/plugin_11.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/plugin_12.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/plugin_12.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/plugin_12.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/plugin_12.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/plugin_13.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/plugin_13.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/plugin_13.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/plugin_13.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/plugin_14.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/plugin_14.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/plugin_14.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/plugin_14.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/ptff_petest.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/ptff_petest.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/ptff_petest.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/ptff_petest.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/ptff_shfz.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/ptff_shfz.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/ptff_shfz.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/ptff_shfz.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/ptff_shfz1.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/ptff_shfz1.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/ptff_shfz1.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/ptff_shfz1.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/ptff_xsbs.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/ptff_xsbs.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/ptff_xsbs.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/ptff_xsbs.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh1.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh1.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh1.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh1.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh10.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh10.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh10.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh10.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh11.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh11.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh11.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh11.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh12.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh12.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh12.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh12.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh13.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh13.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh13.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh13.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh14.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh14.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh14.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh14.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh15.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh15.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh15.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh15.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh16.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh16.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh16.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh16.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh2.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh2.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh2.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh2.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh3.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh3.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh3.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh3.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh4.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh4.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh4.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh4.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh5.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh5.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh5.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh5.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/syh8.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/syh8.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/syh8.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/syh8.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/zaixian1.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/zaixian1.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/zaixian1.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/zaixian1.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/zaixian2.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/zaixian2.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/zaixian2.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/zaixian2.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/images/zaixian3.png b/mcguide/27-手机网络游戏/课程9:服务器上线/images/zaixian3.png similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/images/zaixian3.png rename to mcguide/27-手机网络游戏/课程9:服务器上线/images/zaixian3.png diff --git a/mcguide/27-网络游戏/课程9:服务器上线/第10节:使用ELK查询服务器日志.md b/mcguide/27-手机网络游戏/课程9:服务器上线/第10节:使用ELK查询服务器日志.md similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/第10节:使用ELK查询服务器日志.md rename to mcguide/27-手机网络游戏/课程9:服务器上线/第10节:使用ELK查询服务器日志.md diff --git a/mcguide/27-网络游戏/课程9:服务器上线/第1节:平台发布.md b/mcguide/27-手机网络游戏/课程9:服务器上线/第1节:平台发布.md similarity index 99% rename from mcguide/27-网络游戏/课程9:服务器上线/第1节:平台发布.md rename to mcguide/27-手机网络游戏/课程9:服务器上线/第1节:平台发布.md index 789554b..241b190 100644 --- a/mcguide/27-网络游戏/课程9:服务器上线/第1节:平台发布.md +++ b/mcguide/27-手机网络游戏/课程9:服务器上线/第1节:平台发布.md @@ -136,7 +136,7 @@ time: 15分钟 - 关闭配置页面后,**部署网络服**。 - + ### 上架操作 diff --git a/mcguide/27-网络游戏/课程9:服务器上线/第2节:PE测试.md b/mcguide/27-手机网络游戏/课程9:服务器上线/第2节:PE测试.md similarity index 99% rename from mcguide/27-网络游戏/课程9:服务器上线/第2节:PE测试.md rename to mcguide/27-手机网络游戏/课程9:服务器上线/第2节:PE测试.md index ee1327c..0332513 100644 --- a/mcguide/27-网络游戏/课程9:服务器上线/第2节:PE测试.md +++ b/mcguide/27-手机网络游戏/课程9:服务器上线/第2节:PE测试.md @@ -14,7 +14,7 @@ time: 10分钟 - 详见教程“平台发布”的审核阶段部分[平台发布——审核阶段](./第1节:平台发布.html#审核阶段)。 - + ### 手机端下载 diff --git a/mcguide/27-网络游戏/课程9:服务器上线/第3节:商业化操作.md b/mcguide/27-手机网络游戏/课程9:服务器上线/第3节:商业化操作.md similarity index 99% rename from mcguide/27-网络游戏/课程9:服务器上线/第3节:商业化操作.md rename to mcguide/27-手机网络游戏/课程9:服务器上线/第3节:商业化操作.md index d60e581..eec2548 100644 --- a/mcguide/27-网络游戏/课程9:服务器上线/第3节:商业化操作.md +++ b/mcguide/27-手机网络游戏/课程9:服务器上线/第3节:商业化操作.md @@ -15,9 +15,9 @@ time: 20分钟 - 在开发者平台中的“PE商品管理”添加商品。 ![1568016399843](./images/syh1.png) - + ![1568016399843](./images/syh2.png) - + - 正确填写商品的各项基本信息,填写完成后点击“保存” ![1568016399843](./images/syh3.png) @@ -32,9 +32,9 @@ time: 20分钟 ![1568016399843](./images/syh12.png) - - + + - 在“PE商品管理——查看详情——库存编辑”分页处提交审核 @@ -60,13 +60,13 @@ time: 20分钟 - 假如游戏有自定义的特殊发货逻辑,那么可以选择不自动发货(mod.json中配置auto_detect为false),然后按照商城插件readme.txt中的指引,使用API【StartShipProcess】触发查询订单的逻辑 ![1568016399843](./images/syh13.png) - + - 发货逻辑的实现,可以参考示例代码,位于商城插件服务端mod的【neteaseTestServerSystem.py】中 ```Python class TestServerSystem(ServerSystem): def __init__(self, namespace, systemName): self.ListenForEvent("neteaseShop", "neteaseShopDev", "ServerShipItemsEvent", self, self.OnServerShipItems) - + def OnServerShipItems(self, args): ''' 收到订单信息,执行发货逻辑 @@ -99,7 +99,7 @@ class TestServerSystem(ServerSystem): #todo:开发者在需要根据cmd给玩家发货 #发货之后,需要通知Apollo发货成功了。 self.ShipSuccess(args) - + def ShipSuccess(self,args): ''' 通知Apollo发货成功了 @@ -120,7 +120,7 @@ class TestServerSystem(ServerSystem): ![1568016399843](./images/plugin_14.png) #### 移动端测试 - 在[测试版登录器](./第2节:PE测试.html)中登录游戏。 -- 假如配置了不使用商城插件的自定义道具商店(mod.json中配置use_custom_shop为false),点击左上角商店入口,可以打开引擎的道具商店,用测试货币购买对应成功上架的商品。 +- 假如配置了不使用商城插件的自定义道具商店(mod.json中配置use_custom_shop为false),点击左上角商店入口,可以打开引擎的道具商店,用测试货币购买对应成功上架的商品。 ![1568016399843](./images/syh10.png) - 假如配置了使用商城插件的自定义道具商店(mod.json中配置use_custom_shop为true),点击左上角的【打开商店】按钮,可以打开插件自定义道具商店,用测试货币购买对应成功上架的商品。 diff --git a/mcguide/27-网络游戏/课程9:服务器上线/第4节:Monitor监控报警系统.md b/mcguide/27-手机网络游戏/课程9:服务器上线/第4节:Monitor监控报警系统.md similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/第4节:Monitor监控报警系统.md rename to mcguide/27-手机网络游戏/课程9:服务器上线/第4节:Monitor监控报警系统.md diff --git a/mcguide/27-网络游戏/课程9:服务器上线/第5节:Grafana监控进阶功能.md b/mcguide/27-手机网络游戏/课程9:服务器上线/第5节:Grafana监控进阶功能.md similarity index 99% rename from mcguide/27-网络游戏/课程9:服务器上线/第5节:Grafana监控进阶功能.md rename to mcguide/27-手机网络游戏/课程9:服务器上线/第5节:Grafana监控进阶功能.md index 2309939..c675bf6 100644 --- a/mcguide/27-网络游戏/课程9:服务器上线/第5节:Grafana监控进阶功能.md +++ b/mcguide/27-手机网络游戏/课程9:服务器上线/第5节:Grafana监控进阶功能.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 60分钟 --- diff --git a/mcguide/27-网络游戏/课程9:服务器上线/第6节:在线人数显示.md b/mcguide/27-手机网络游戏/课程9:服务器上线/第6节:在线人数显示.md similarity index 99% rename from mcguide/27-网络游戏/课程9:服务器上线/第6节:在线人数显示.md rename to mcguide/27-手机网络游戏/课程9:服务器上线/第6节:在线人数显示.md index 863f787..c6286e1 100644 --- a/mcguide/27-网络游戏/课程9:服务器上线/第6节:在线人数显示.md +++ b/mcguide/27-手机网络游戏/课程9:服务器上线/第6节:在线人数显示.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 入门 time: 10分钟 --- diff --git a/mcguide/27-网络游戏/课程9:服务器上线/第7节:多版本客户端引擎支持.md b/mcguide/27-手机网络游戏/课程9:服务器上线/第7节:多版本客户端引擎支持.md similarity index 97% rename from mcguide/27-网络游戏/课程9:服务器上线/第7节:多版本客户端引擎支持.md rename to mcguide/27-手机网络游戏/课程9:服务器上线/第7节:多版本客户端引擎支持.md index 46283e4..965e5fb 100644 --- a/mcguide/27-网络游戏/课程9:服务器上线/第7节:多版本客户端引擎支持.md +++ b/mcguide/27-手机网络游戏/课程9:服务器上线/第7节:多版本客户端引擎支持.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 20分钟 --- @@ -78,7 +78,7 @@ class testMaster(MasterSystem): callback(targetId) #必须执行,执行登陆后续操作 netMasterApi.SetLoginStratege(loginStratege) self.ListenForEvent('gameANameaspace', 'gameASystem', 'NewLoginServerEvent', self, self.OnNewLoginServer) - + def OnNewLoginServer(self, args): # 将有效目标服务器记录下来 protocolVersion = args['protocolVersion'] @@ -91,13 +91,13 @@ class testMaster(MasterSystem): class gameServer(ServerSystem): def __init__(self, namespace, systemName): ServerSystem.__init__(self, namespace, systemName) - self.ListenForEvent(serverApi.GetEngineNamespace(), serverApi.GetEngineSystemName(), 'MasterConnectStatusEvent', + self.ListenForEvent(serverApi.GetEngineNamespace(), serverApi.GetEngineSystemName(), 'MasterConnectStatusEvent', self,self.OnMasterConnectStatus) def OnMasterConnectStatus(self, args): # 同master建立连接后,马上向master注册为有效服务器 if args['isConnect']: data = { - 'serverId' : lobbyGameApi.GetServerId(), + 'serverId' : lobbyGameApi.GetServerId(), 'protocolVersion' : lobbyGameApi.GetServerProtocolVersion()#获取服务器协议版本号 } self.NotifyToMaster('NewLoginServerEvent', data) @@ -122,17 +122,17 @@ class testMaster(MasterSystem): MasterSystem.__init__(self, namespace, systemName) self.mVersion2TargetServerIds = {} #protocolVersion--> serverIds self.InitServerInfo() - self.ListenForEvent(extraMasterApi.GetEngineNamespace(), extraMasterApi.GetEngineSystemName(), + self.ListenForEvent(extraMasterApi.GetEngineNamespace(), extraMasterApi.GetEngineSystemName(), 'NetGameCommonConfChangeEvent',self, self.OnNetGameCommonConfChange) - self.ListenForEvent('gameNameaspace', 'gameSystem', 'ChooseTargeGameServerRequestEvent', + self.ListenForEvent('gameNameaspace', 'gameSystem', 'ChooseTargeGameServerRequestEvent', self, self.ChooseTargeGameAServer) - + def OnNetGameCommonConfChange(self, args) ''' 每次配置发生变化,需要重新获取目标服务器 ''' self.InitServerInfo() - + def InitServerInfo(self): ''' 获取gameA服务器和它的协议版本号 @@ -148,7 +148,7 @@ class testMaster(MasterSystem): ids = self.mVersion2TargetServerIds.get(protocolVersion, []) ids.append(serverId) self.mVersion2TargetServerIds[protocolVersion] = ids - + def ChooseTargeGameAServer(self, args): ''' 随机选择一个目标服务器 @@ -165,25 +165,25 @@ class testMaster(MasterSystem): targetId = random.choice(targetIds) data = {'uid' : uid, 'targetId' : targetId} self.NotifyToServerNode(serverId, "ChooseTargeGameResponseServerEvent", data) - + #game mod class gameServer(ServerSystem): def __init__(self, namespace, systemName): ServerSystem.__init__(self, namespace, systemName) - self.ListenForEvent('masterNameaspace', 'masterSystem', 'ChooseTargeGameResponseServerEvent', + self.ListenForEvent('masterNameaspace', 'masterSystem', 'ChooseTargeGameResponseServerEvent', self,self.ChooseTargeGameResponseServer) - + def DoTransferPlayer(self, uid): ''' 玩家切服,会从master请求获取适配服务器 ''' data = { - 'uid' : uid, - 'protocolVersion' : lobbyGameApi.GetServerProtocolVersion(), + 'uid' : uid, + 'protocolVersion' : lobbyGameApi.GetServerProtocolVersion(), 'serverId' : lobbyGameApi.GetServerId() } self.NotifyToMaster('ChooseTargeGameServerRequestEvent', data) - + def ChooseTargeGameResponseServer(self, args): ''' 从master获取适配服务器后执行切服操作 diff --git a/mcguide/27-网络游戏/课程9:服务器上线/第8节:正式机器信息说明.md b/mcguide/27-手机网络游戏/课程9:服务器上线/第8节:正式机器信息说明.md similarity index 100% rename from mcguide/27-网络游戏/课程9:服务器上线/第8节:正式机器信息说明.md rename to mcguide/27-手机网络游戏/课程9:服务器上线/第8节:正式机器信息说明.md diff --git a/mcguide/27-网络游戏/课程9:服务器上线/第9节:上线阶段热更.md b/mcguide/27-手机网络游戏/课程9:服务器上线/第9节:上线阶段热更.md similarity index 99% rename from mcguide/27-网络游戏/课程9:服务器上线/第9节:上线阶段热更.md rename to mcguide/27-手机网络游戏/课程9:服务器上线/第9节:上线阶段热更.md index f11aa2f..28dbd9a 100644 --- a/mcguide/27-网络游戏/课程9:服务器上线/第9节:上线阶段热更.md +++ b/mcguide/27-手机网络游戏/课程9:服务器上线/第9节:上线阶段热更.md @@ -1,5 +1,5 @@ --- -front: +front: hard: 进阶 time: 10分钟 --- @@ -14,7 +14,7 @@ time: 10分钟 - 为提升玩家的游戏体验,对于符合上述条件的调整,我们建议服主采用上线阶段热更功能。热更前后,可将更新内容通过游戏公告等形式告知线上玩家。 - + ### 热更步骤 diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomBlock/1.gif b/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomBlock/1.gif deleted file mode 100644 index 653b676..0000000 Binary files a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomBlock/1.gif and /dev/null differ diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/2.gif b/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/2.gif deleted file mode 100644 index 6be706f..0000000 Binary files a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/2.gif and /dev/null differ diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/3.gif b/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/3.gif deleted file mode 100644 index 8f2aa66..0000000 Binary files a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/3.gif and /dev/null differ diff --git a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/5.gif b/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/5.gif deleted file mode 100644 index 90caf6a..0000000 Binary files a/mcguide/27-网络游戏/课程10:使用Spigot开服/res/spigotCustomEntity/5.gif and /dev/null differ diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/whitelist_1.png b/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/whitelist_1.png deleted file mode 100644 index 4058942..0000000 Binary files a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/whitelist_1.png and /dev/null differ diff --git a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/whitelist_2.png b/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/whitelist_2.png deleted file mode 100644 index bafd8c9..0000000 Binary files a/mcguide/27-网络游戏/课程1:成为Apollo服主及相关准备/images/whitelist_2.png and /dev/null differ diff --git a/mcguide/28-电脑网络游戏/0-电脑版网络游戏概述与工具指引.md b/mcguide/28-电脑网络游戏/0-电脑版网络游戏概述与工具指引.md new file mode 100644 index 0000000..9bfc71e --- /dev/null +++ b/mcguide/28-电脑网络游戏/0-电脑版网络游戏概述与工具指引.md @@ -0,0 +1,19 @@ +--- +front: +hard: 入门 +time: 5分钟 +--- + +# 电脑端网络游戏概述与工具指引 + +## 电脑端网络游戏概述 + +![](./images/0_0.png) + +电脑端网络游戏是指开发者通过 **第三方** 的服务端软件,并由官方提供物理机进行玩法搭建的多人游戏服务。在《我的世界》电脑版主页左侧侧边栏有明显的入口,用户可以通过入口找到处于 **上线阶段** 的在线多人服务器。 **网络游戏解除了本地联机的多种限制,让玩家与玩家间可以不受时间和地区因素干扰,遇到更多兴趣相投的玩家好友。** + + + +## 电脑端网络游戏工具指引 + +**《我的世界》电脑网络游戏** 当前 **支持** 接入 **常见的第三方服务端如Bukkit、Spigot、Paper、CatServer、Mohist等服务端** 架设的网络游戏。这些第三方服务端软件都可以在Github找到对应仓库,这些服务端能够很好的支持本地开发和调试 ,为制作我的世界服务器创意玩法带来更多可能。在根据下方流程入驻成功后,开发者将会获得一台用于上线的 **物理机** ,物理机可以直接用于部署服务端。由于这些服务端软件并不是官方制作的,所以我们无法提供关于服务端方面的技术支持。但我们也能够提供诸如商业化、认证接入和平台等技术服务。: diff --git a/mcguide/28-电脑网络游戏/images/0_0.png b/mcguide/28-电脑网络游戏/images/0_0.png new file mode 100644 index 0000000..e877d0a Binary files /dev/null and b/mcguide/28-电脑网络游戏/images/0_0.png differ diff --git a/mcguide/28-电脑网络游戏/课程0:电脑端网络游戏概述/README.md b/mcguide/28-电脑网络游戏/课程0:电脑端网络游戏概述/README.md new file mode 100644 index 0000000..e69de29 diff --git a/mcguide/28-电脑网络游戏/课程0:电脑端网络游戏概述/images/0_0.png b/mcguide/28-电脑网络游戏/课程0:电脑端网络游戏概述/images/0_0.png new file mode 100644 index 0000000..e877d0a Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程0:电脑端网络游戏概述/images/0_0.png differ diff --git a/mcguide/28-电脑网络游戏/课程0:电脑端网络游戏概述/第1节:电脑版网络游戏概述与工具指引.md b/mcguide/28-电脑网络游戏/课程0:电脑端网络游戏概述/第1节:电脑版网络游戏概述与工具指引.md new file mode 100644 index 0000000..9bfc71e --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程0:电脑端网络游戏概述/第1节:电脑版网络游戏概述与工具指引.md @@ -0,0 +1,19 @@ +--- +front: +hard: 入门 +time: 5分钟 +--- + +# 电脑端网络游戏概述与工具指引 + +## 电脑端网络游戏概述 + +![](./images/0_0.png) + +电脑端网络游戏是指开发者通过 **第三方** 的服务端软件,并由官方提供物理机进行玩法搭建的多人游戏服务。在《我的世界》电脑版主页左侧侧边栏有明显的入口,用户可以通过入口找到处于 **上线阶段** 的在线多人服务器。 **网络游戏解除了本地联机的多种限制,让玩家与玩家间可以不受时间和地区因素干扰,遇到更多兴趣相投的玩家好友。** + + + +## 电脑端网络游戏工具指引 + +**《我的世界》电脑网络游戏** 当前 **支持** 接入 **常见的第三方服务端如Bukkit、Spigot、Paper、CatServer、Mohist等服务端** 架设的网络游戏。这些第三方服务端软件都可以在Github找到对应仓库,这些服务端能够很好的支持本地开发和调试 ,为制作我的世界服务器创意玩法带来更多可能。在根据下方流程入驻成功后,开发者将会获得一台用于上线的 **物理机** ,物理机可以直接用于部署服务端。由于这些服务端软件并不是官方制作的,所以我们无法提供关于服务端方面的技术支持。但我们也能够提供诸如商业化、认证接入和平台等技术服务。: diff --git a/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/README.md b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/README.md new file mode 100644 index 0000000..e69de29 diff --git a/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/images/0_0.png b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/images/0_0.png new file mode 100644 index 0000000..e877d0a Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/images/0_0.png differ diff --git a/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/images/0_1.png b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/images/0_1.png new file mode 100644 index 0000000..a38bb28 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/images/0_1.png differ diff --git a/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/第1节:开发准备阶段概述.md b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/第1节:开发准备阶段概述.md new file mode 100644 index 0000000..4f233d6 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/第1节:开发准备阶段概述.md @@ -0,0 +1,19 @@ +--- +front: +hard: 入门 +time: 1分钟 +--- + +# 开发阶段概述 + +## 准备阶段步骤 + +步骤一: 本地开发服务器玩法与内容 + +步骤二: 入驻申请 + +步骤三: 申请物理机 + +步骤四: 将服务器迁移到官方提供的物理机上 + +步骤五: 进一步开发服务器 \ No newline at end of file diff --git a/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/第2节:具备一定的开发能力.md b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/第2节:具备一定的开发能力.md new file mode 100644 index 0000000..c360522 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/第2节:具备一定的开发能力.md @@ -0,0 +1,31 @@ +--- +front: +hard: 入门 +time: 5分钟 +--- + +# 具备一定的开发能力 + +## 综述 + +由于电脑端服务端软件用到的开发语言基本为Java,这就导致开发者在对服务端进行修改或者编写服务器运行的插件,需要掌握较为牢固的Java面向对象编程技术,通过官方文档来编写可运行的插件 (少数可以用第三方库如 TabooLib、KotlinLib,使得能够用Kotlin来编写插件) + + + +## 开发工具 + +我们推荐您使用IntelliJ IDEA这一款IDE来编写第三方服务端软件所需的插件、MOD等内容,其中的Minecraft Development插件就非常方便,可以通过快速此插件快速创建有关PC的项目,并自动配置Gradle或者Maven +![](./images/0_1.png) + + + +## Linux使用 + +官方提供的物理机使用的系统为Linux,您需要掌握一定的Linux运维技术才能使服务器运行的更加平稳顺利,而不会出现当服务器出现崩溃等现象时出现束手无措的尴尬情况。 +您可以查看[Linux基础](https://www.runoob.com/linux/linux-tutorial.html) + + + +## 配置文件 + +目前第三方服务端编写的插件配置文件格式都是YAML格式,YAML 的语法和其他高级语言类似,并且可以简单表达清单、散列表,标量等数据形态。它使用空白符号缩进和大量依赖外观的特色,特别适合用来表达或编辑数据结构、各种配置文件、倾印调试内容、文件大纲(例如:许多电子邮件标题格式和YAML非常接近)。详情可以查看[YAML 入门教程](https://www.runoob.com/w3cnote/yaml-intro.html)。 \ No newline at end of file diff --git a/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/第3节:准备开发环境.md b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/第3节:准备开发环境.md new file mode 100644 index 0000000..f620598 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/第3节:准备开发环境.md @@ -0,0 +1,12 @@ +--- +front: +hard: 入门 +time: 1分钟 +--- + +# 准备开发环境 + +## 综述 + +电脑端入驻前没有开发机,开发者们如果要开发PC Java网络服务器需要先自备可让外部链接的物理机或者直接在本地计算机部署服务端进行开发,开发完毕后提交入驻审核。 + diff --git a/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/第4节:入驻申请.md b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/第4节:入驻申请.md new file mode 100644 index 0000000..faf6d2a --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程1:成为电脑端服主的准备/第4节:入驻申请.md @@ -0,0 +1,19 @@ +--- +front: +hard: 入门 +time: 3分钟 +--- + +# 电脑端网络服入驻申请 + +具体的入驻流程请参考:[《我的世界》中国版端游网络游戏入驻指南](../../35-上架与入驻/课程13-《我的世界》中国版JAVA网络游戏入驻指南.md)。 + + + +## 提交审核并等待审核结果 + +PC Java网络服务器提交申请后,审核人员会根据你所选的排期前往您的服务器进行审核,不管审核通过与否,最后都会通过开发者邮箱以及您的预留手机短信通知审核结果。 + +如果审核通过:官方会发放服务器物理机,服主需要及时将服务器内容迁移到官方的物理机上,最后在正式物理机上终审上架。长时间未进行二审会要求回收申请的物理机 + +如果审核未通过:则服主需要进行修改后再提交,PC Java入驻申请没有次数限制,但请根据要求一次改正,节省时间。 \ No newline at end of file diff --git a/mcguide/28-电脑网络游戏/课程2:开Bukkit插件服/README.md b/mcguide/28-电脑网络游戏/课程2:开Bukkit插件服/README.md new file mode 100644 index 0000000..e69de29 diff --git a/mcguide/28-电脑网络游戏/课程2:开Bukkit插件服/images/0_0.png b/mcguide/28-电脑网络游戏/课程2:开Bukkit插件服/images/0_0.png new file mode 100644 index 0000000..e877d0a Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程2:开Bukkit插件服/images/0_0.png differ diff --git a/mcguide/28-电脑网络游戏/课程2:开Bukkit插件服/images/0_1.png b/mcguide/28-电脑网络游戏/课程2:开Bukkit插件服/images/0_1.png new file mode 100644 index 0000000..a38bb28 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程2:开Bukkit插件服/images/0_1.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/1-署名.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/1-署名.md new file mode 100644 index 0000000..e2e76ee --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/1-署名.md @@ -0,0 +1,21 @@ +--- +front: +hard: 入门 +time: 1分钟 +--- + +# 署名 + +**署名信息** + +本文作者: tdiant + +Github个人账户: [https://github.com/tdiant](https://github.com/tdiant) + +原文: [https://bdn.tdiant.net/#/](https://bdn.tdiant.net/#/) + +**相关说明** + +中国版对文章部分内容有所改动 + +本文主体内容以 Bukkit 1.12.2 为蓝本进行教学,如有高版本开发需求可以先了解基础框架再着手开发高版本服务器插件 diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/2-写在前面.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/2-写在前面.md new file mode 100644 index 0000000..e92512d --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/2-写在前面.md @@ -0,0 +1,42 @@ +--- +front: +hard: 入门 +time: 3分钟 +--- + +# 写在前面 + +也许你已经有了雄心壮志, 准备开发一个Bukkit插件出来了! 但是等一下. 开发Bukkit插件**也需要一定的基础知识**! +本文在编写时默认你已经具有了下面所罗列的能力: + +**了解我的世界** + +我们假定你已经对我的世界有充分了解. +例如, 我们认为类似"哪些方块是玩家不能破坏的", "某个物品使用后是什么效果"这种问题是您早已明白的内容, 不会过分提及. + +**Java基础** + +Bukkit插件开发对Java语言能力要求并不高, 通常情况下插件开发只会用到最基础的Java语法知识(如面向对象基础等), 且开发环境搭建极其简单. +但是不会Java的新手绝对不会开发插件, 绝对弄不明白如何开发插件. +本教程不针对Java初学者或从未学习过Java的人. 在本教程中, 将会尽可能避免较为复杂的Java语法知识. + +本教程认为会Java还应当具备一定的开发能力和使用相关工具等资源的能力, 例如JavaDoc如何使用, 你正在使用的IDE如何操作等问题, 本教程不会提及. + +**编程的思维** + +编程的思维在实际编写一个项目当中尤为关键. +有Java基础并不够, 只知道语法, 不知道怎么写, 与不会Java没有什么区别. + +在本教程中, 我们能做的只是告诉你“有什么”, 而无法解决你的插件“怎么写”的问题. +例如, 我们告诉你“事件”, 但是如何利用“事件”真正的写出来一个“登录插件”、“商店插件”等各种插件出来, 这需要你自己思考! + +希望你在实际开发中能够“脑洞大开”, 想出别人想不到的内容, 想出能打本文作者脸的好办法、新思路! + +**不觉得尝试是件麻烦事** + +光看教程而不去实际操作是无法学到真正的原理,正如常言道“好记性不如烂笔头”,学习Bukkit开发亦是如此. + +**学会对自己编写的内容进行调试** + +插件开发离不开调试. +请你在提出问题之前、编写插件的过程中, 不要忘记不断调试, 这样你才能知道你的插件是否真的可以用, 别人说的不如自己试的, 自己想的不如实际干的. diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/3-MC服务端介绍.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/3-MC服务端介绍.md new file mode 100644 index 0000000..792fc9f --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/3-MC服务端介绍.md @@ -0,0 +1,56 @@ +--- +front: +hard: 入门 +time: 10分钟 +--- + +# MC的服务端介绍 + +如果你想开一个MC服务器, 你会发现有各式各样的服务端可以选择. 由于MC是一款社区驱动发展的游戏, 各种各样的玩家社区正在以非常快的速度开发以及维护各式各样的服务端. +那么, 它们都是什么? 它们本质上是怎样的? 本节大致上以时间顺序进行叙述来讲述这个问题. + +## 官服 + +最开始, 我的世界这款游戏只有Java版本, 在每个版本(不考虑远古版本)发布时, Mojang都会同时发布其对应的ServerJar文件. +利用ServerJar文件可以开启一个MC服务器, 这种服务器俗称为官服. + +官服启动后, 会在根目录下创建`server.properties`文件, 这是它的配置文件. + +## Bukkit服务端 + +官服有显而易见的问题, 那就是没有“插件系统”. +假设你有特殊需求, 就偏偏想让玩家没法把手里的钻石扔在地上, 正常情况下根本无法在官服实现这个功能. +MC日渐完善的红石和命令方块功能根本无法满足社区玩家对服务器自定义的需求, 因而一种成熟的“插件系统”显得极为迫切. + +Bukkit因此出现. + +Bukkit服务端启动后会额外多创建一个配置文件`bukkit.yml`, 还有一个名为`plugins`的文件夹. +Bukkit会自动的将`plugins`里的Jar通过Java中的ClassLoader特性加载进服务端中,从而使服主能够通过插件执行服务端能执行的内容. +开发者可以利用Bukkit官方给出的API开发一款插件, 丰富并拓展玩法. + +## Spigot服务端 + +SpigotMC社区发布了Spigot服务端. 最开始是对Bukkit服务端的各种优化和拓展. + +后来由于Bukkit服务端直接使用了Mojang的代码, 由于法律原因, Bukkit被Mojang起诉并败诉, Bukkit服务端停止开发. +虽然Bukkit停止开发, 但是社区内Bukkit的热度依然很高, Bukkit服务端插件数量极大. 后来SpigotMC社区渐渐地接管了Bukkit的开发工作, 这意味着SpigotMC社区接管了BukkitAPI的维护工作. + +目前网上流传的Spigot服务端现成的Jar版本, 绝大多数都是基于BuildTool编译后的成品Jar文件. 实际上在SpigotMC社区官方网站上不提供这些成品Jar文件. + +## 其他的各种服务端 + +后来又有许多服务端基于Spigot进行修改, 创造出了其他各种各样的服务端. 例如`Paper`服务端, 它是基于Spigot服务端的社区优化版本. +如果你运行了一个Paper服务端服务器, 你会发现服务端目录下会有`bukkit.yml`、`spigot.yml`、`paper.yml`这三个配置文件, 足以看出这背后的故事. + +最早时还有`MCPC+`服务端. 其开发者将Spigot与Forge整合在一起, 使服务器既可以装MOD又可以装插件. 后来`MCPC+`改为了`Cauldron`, 又衍生出了`KCauldron`, 但这三款服务端都停在了1.7.10版本不再更新. +社区还出现了`CatServer`、`Uranium`、`Arclight`、`Mohist`等服务端, 它们可以也可以实现开出插件+MOD服的功能. + +> 社区中部分服务端存在极大争议, 并因此发生过一些影响深远的故事. +> 本教程功能仅为介绍, 如果没有纳入某些常用的服务端不能代表作者对这些服务端持有任何形式的不良想法, 服务端名称的排序没有先后, 不能认为某款服务端的名字排在前面即是作者对该款服务端存在某些偏向性指向或理解. + +## 关于本教程 + +本教程正如其名, 是Bukkit插件开发教程. +这意味着理论上应当支持Bukkit服务端、Spigot服务端和各种衍生服务端. Sponge服务端由于使用的API体系与Bukkit完全不一样, 本教程不考虑Sponge服务端. + +BukkitAPI由于发展原因变动很多, 本教程尽可能提及. 这意味着本教程的内容肯定是不能支持全部版本的BukkitAPI版本. 但是问题不大, 变动虽然多但是不大, 思路一致, 如果你足够清晰BukkitAPI, 你应当可以在你需要开发的版本中找到你想要的API用法. diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/4-信息检索.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/4-信息检索.md new file mode 100644 index 0000000..22d3d31 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/4-信息检索.md @@ -0,0 +1,41 @@ +--- +front: +hard: 入门 +time: 10分钟 +--- + +# 检索需要的信息 + +在实际开发中你肯定需要检索需要的信息. +笔者在各个QQ群里、论坛里最经常看到的问题莫过于一些新开发者问的诸如 "XXX应该监听那个事件?"、"怎么设置玩家昵称?"、"怎么设置方块的Material?" 的问题. +实际上, 这些问题会被人视作"劣质问题". **因为这些问题的答案就是一查就能查到**. 说心里话, **有问问题的时间, 不如自己翻一下JavaDoc自己找到答案**. +当然, 要是真的找不到答案, 还是应该问一下. + +本教程不涉及JavaDoc的基础使用, 仅作为指向提醒作用. + +## Bukkit各部分以包划类, 类名即表示其作用 + +> 假如你想问的是`玩家移动应该监听什么事件?`这个问题. + +首先, 你想问的是监听什么事件, 请打开JavaDoc看一看BukkitAPI给出的所有的包. +显然, 根据名称即可判断出你应当从`org.bukkit.event`包内寻找才对, 因为其他包跟"事件"这二字一点关系也没有. +然后你会发现`org.bukkit.event`包还分为若干子包, 你同样可以按照名称判断出与玩家有关的事件应该都在`org.bukkit.event.player`包. + +打开`org.bukkit.event.player`包, 你会发现与玩家有关的事件基本上都是按照`PlayerXxxxxEvent`的格式命名的. 仔细看一看便知道, `PlayerMoveEvent`事件的名称与我们想要的玩家移动这一功能即为一致, 它很有可能就是我们想要的. + +打开它的详细介绍, 看看它的描述, 是 + +![示例1](../images/0_1.png) + +``` +Holds information for player movement events +``` + +所以, 这就是我们需要的玩家移动事件了. + +
+ +> 假如你想问的是`怎么获取玩家的飞行速度?` + +这与玩家有关, 肯定要考虑获取玩家飞行速度的方法在`Player`类中. 我们打开`Player`类的详细介绍寻找答案. +检索这一类的方法, 根据名称和方法描述, 可以得知我们想找的方法是`getFlySpeed`方法. \ No newline at end of file diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/5-服务端与客户端.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/5-服务端与客户端.md new file mode 100644 index 0000000..3d4c681 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/1-基本概念/5-服务端与客户端.md @@ -0,0 +1,34 @@ +--- +front: +hard: 入门 +time: 20分钟 +--- + +# 服务端与客户端 + +## 永远不能相信客户端 + +有人说, 从游戏行业诞生的那一刻, 也是游戏反作弊诞生的那一刻. +客户端给的数据不能轻易相信. 在开发插件时一定要注意, 如果你的插件要接收某个信息, 这个信息不是你自己指定的, 而是服主设置配置文件自己设定的或者是客户端发来的, 那你一定要仔细思考, 多加留意. + +早前在GitHub上, 一个来自俄罗斯的账户发布了一个作弊MOD. +这款作弊MOD的作者研究了各大主流MOD的协议包漏洞, 发现这些知名的MOD的协议包或多或少在接收到玩家客户端数据时, **对玩家客户端发来的数据的合理性判定极度缺失, 甚至是根本没有**. +(不恰当的比方)玩家客户端说自己有一百万个钻石, 服务端真的就认为玩家客户端有一百万个钻石. 因此, 这款作弊MOD针对主流的大MOD的这些协议包问题, 有针对性的对每个MOD都开发了作弊方案. + +可见开发者对客户端的警惕意识有多么重要. + +我们要编写的是服务端插件. +服务端插件根本上面向于这一服务器的玩家, 最直接的使用者是这一服务器的服主. 那么, 服主能不能正确配置配置文件? 玩家的数据信息真的正确吗? +也许你说, 你写的又不是反作弊插件, 不可能做到处处提防玩家. 诚然如此, 但是警惕意识绝对不能丢. + +**先虑忧患, 享于安乐.** + +## 理清楚客户端和服务端的关系 + +如果你有经验你应该知道, 装上`Resdience`插件后, 创建一个领地, 关闭领地所有玩家的移动权限, 把一个玩家扔进去, 玩家在里面试图移动的话, 效果并不是完全动不了, 而是玩家仍然可以运动, 但是在一个间隔时间之后会被“弹回来”. 这是为什么? + +为什么最终的效果不是"玩家一点都动不了"呢? + +事实上, 我们无法在服务端取消玩家一点也不能移动. 客户端移动玩家时, 会在客户端显示出移动后的样子, 然后才会传递给服务器玩家移动的信号, 服务端收到客户端的信号后, 服务器才会做出响应. + +也就是说, 客户端与服务端之间, **客户端往往都是"先斩后奏"的**. 客户端不管你服务端想干什么, 先那么显示出来再说. 因为毕竟玩家在服务器里完全动不了不是MC原版的设定之一. \ No newline at end of file diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/2-基础内容/1-最简单的插件.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/2-基础内容/1-最简单的插件.md new file mode 100644 index 0000000..d2064eb --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/2-基础内容/1-最简单的插件.md @@ -0,0 +1,143 @@ +--- +front: +hard: 入门 +time: 15分钟 +--- + +# 最简单的插件 + +# Bukkit插件的本质 +插件本质是一个基于BukkitAPI的Java应用. 一个插件必须要有 主类 和 `plugin.yml`文件. + +例如下面是一个常见插件, 让我们找一下它的主类和`plugin.yml`文件. + +![](../images/0_2.jpg) + +# 简单的插件 +在编写自己想做的插件之前, 不妨做一个简单的插件来了解一下Bukkit插件如何编写. + +新建一个Java工程, 导入开服用的服务端jar文件到工程的Libraries中. 创建`tdiant.helloworld.HelloWorld`类作为插件的主类, 并继承`JavaPlugin`类. +在主类里覆写`onEnable`方法和`onDisable`方法. 完成后, 代码应该类似这样: + +```java +package tdiant.helloworld; + +import org.bukkit.plugin.java.JavaPlugin; + +public class HelloWorld extends JavaPlugin { + @Override + public void onEnable() { + System.out.println("Hello World"); + } + + @Override + public void onDisable() { } +} +``` + +Bukkit服务端会在插件被启用时调用`onEnable`方法, 被停用时调用`onDisable`方法. + +但这还不够,我们还需要告诉Bukkit,插件的一些信息才能让他更好的识别. +创建`plugin.yml`文件. 打开plugin.yml文件并在其中输入如下信息: +```yml +name: HelloWorld +main: tdiant.helloworld.HelloWorld +version: 1 +author: MinecraftDev +``` + +> **特别注意: 如果你的插件是基于新版本API(1.13以及以上版本)编写的, 应当在plugin.yml中额外增加`api-version: 1.13`键值对.例如这样:** +> ```yml +> name: HelloWorld +> main: tdiant.helloworld.HelloWorld +> api-version: 1.13 +> version: 1 +> author: MinecraftDev +> ``` +> **这会告诉Bukkit, 这个插件是基于新版API编写的.** +> 若要兼容1.13及以上版本的同时兼容旧版本, 应特别注意各版本之间的 API 变化(譬如1.12进度系统取代了成就系统, 1.13的 Material 枚举发生了巨大变化). + +*注意: 主类的名称并不是固定的, 但是`plugin.yml`文件的名称是固定的.* + +上面的plugin.yml文件逐行分析如下: + +| 键 | 意义 | 备注 | +| :-: | :-: | :- | +| name | 插件名 | 不允许带有中文和空格, 推荐只含有下划线、英文. | +| main | 插件的完整主类名 | 例如我这里插件主类为tdiant.helloworld.HelloWorld, 此处则需填写tdiant.helloworld.HelloWorld. | +| version | 插件版本 | 您可以填写一个合理的String内容, 而不一定必须为数字, 例如可填写v1.0.0 | +| author | 作者 | - | + + +可以发现, 当插件Jar被正常加载后, 会在控制台输出`Hello World`字符串, 这标志着我们的HelloWorld插件正常工作. + +![](../images/0_3.png) + +# BukkitAPI中的Logger + +## Logger +*这里只是简要提及, 不详细介绍, 只需要知道有这件事即可.* + +BukkitAPI“修改”了我们常用的sout (即`System.out.println`), 将其“引入”了BukkitAPI提供的Logger. +只有通过Logger输出的文本信息才能记录在服务端生成的log文件中. + +在BukkitAPI插件开发时, 我们通常不用sout输出想往后台输出给服主看的文本信息, 而应用Logger. +主类有`getLogger()`方法, 可以利用这个方法获得Logger. +例如这样: + +```java +public class HelloWorld extends JavaPlugin { + @Override + public void onEnable(){ + this.getLogger().info("Hello World"); + } + + @Override + public void onDisable(){} +} +``` + +这样输出信息的方式与sout相比最主要的区别是, 如果你的插件`plugin.yml`里的名称为`Test`那么: + +```java +this.getLogger().info("测试"); +System.out.println("测试"); +``` + +输出的结果是 + +``` +[23:33:33] [Server thread/INFO]: [Test] 测试 +[23:33:33] [Server thread/INFO]: 测试 +``` + + + +## ChatColor +在所有能发彩色文字的地方, 你可以直接使用双s (即`§`符号, Windows系统下按住键盘Alt键, 在数字键盘区域依次按下0167后松开Alt键即可输入该字符) + 对应颜色代码(可以在Minecraft Wiki上查到)代表颜色. +颜色是可以混用的: `§4比§c如§6这§2样`. + +在开发中, 你不必这样, `ChatColor`可以替代. + +```java +p.sendMessage(ChatColor.RED+"你" + ChatColor.GREEN+"好"+ ChatColor.YELLOW + "!"); +``` + +这样就可以发送一个 红色的“你”, 绿色的“好”, 黄色的感叹号 给玩家. + +后面了解配置文件的操作后, 一些插件允许服主在设定一些提示语时用`&`符号代替`§`, 插件处理这样的文本信息时, 可以这样处理成带颜色的字符串: +```java +String str = "&4哈&c哈&6哈....."; //待处理字符串 +p.sendMessage(str); //发给玩家的还是: &4哈&c哈&6哈..... +String str_finish = ChatColor.translateAlternateColorCodes('&',str); //处理好的字符串 +p.sendMessage(str_finish); //发给玩家就是彩色的 +``` + +> 提示:你可以使用 +> ```java +> import static org.bukkit.ChatColor.*; +> ``` +> 来导入`ChatColor`中的所有枚举。接下来你就可以更方便地写颜色代码: +> ```java +> String str = RED + "/test help" + GREY + " - " + WHITE + "显示帮助菜单。"; +> ``` diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/2-基础内容/2-事件监听.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/2-基础内容/2-事件监听.md new file mode 100644 index 0000000..eb6c1d6 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/2-基础内容/2-事件监听.md @@ -0,0 +1,260 @@ +--- +front: +hard: 入门 +time: 30分钟 +--- + +# 事件的监听 + +事件是服务器里发生的事. +例如, 天气的变化, 玩家的移动. 玩家把树打掉, 又捡起了掉落地上的原木. 这些都是事件. + +事件分为可控事件和不可控事件. 其最大区别在于能不能取消(*也就是能不能setCancelled*). +不难理解, 玩家如果退出服务器, 这不能被取消, 它是不可控事件. 玩家的移动可以被取消, 它是可控事件. + +BukkitAPI给了一些基本的服务器事件. 大多数情况下可以满足我们的需求. +本章以监听这些事件为例, 讲述事件的监听如何实现. + + +## 监听器(Listener) + +监听器实质上是一个实现了`Listener`的类, 其中包含一些带有`@EventHandler`注解的方法. +当服务器某个事件触发后, 例如玩家移动事件, 服务器就会创建一个对应的`PlayerMoveEvent`对象, 如果你的插件有注册并正在监听该事件的监听器, 那么服务端会按照`@EventHandler`注解找到对应的方法并调用, 你的插件因而便可监听到玩家移动事件了. + +我们以一个登录插件作为展开, 写一个“玩家不登录就不允许移动”的插件出来. +因为截止到现在还没有说怎么注册命令, 这里我们设定玩家“只要右键空气就可以登录”. +*这里我们为了偷懒, 下面把主类直接实现`Listener`当做监听器用. 其实可以分开* + +```java +public class HelloWorld extends JavaPlugin implements Listener { + private List playerNameList = new ArrayList(); //这是没登录玩家列表 + + public void onEnable() { + this.getLogger().info("Hello World!"); + Bukkit.getPluginManager().registerEvents(this,this); //这里HelloWorld类是监听器, 将当前HelloWorld对象注册监听器 + } + + public void onDisable() {} + + /* 功能一:刚进入服务器的玩家都记录到“小本本”playerNameList上,他们是没登录的玩家 */ + @EventHandler // 这个注解告诉Bukkit这个方法正在监听某个事件 + public void onPlayerJoin(PlayerJoinEvent e) { // 玩家登录服务器就会调用这个方法 + if(!playerNameList.contains(e.getPlayer().getName())) { // 先判断这个玩家的名是不是记过了 + playerNameList.add(e.getPlayer().getName()); // 玩家一登录就给他记上名, 代表他没登录 + } + } + + /* 功能二:没登录的玩家不让移动 */ + @EventHandler + public void onPlayerMove(PlayerMoveEvent e) { //玩家移动时Bukkit就会调用这个方法 + if(playerNameList.contains(e.getPlayer().getName())) { + e.setCancelled(true); //判断玩家是不是没登录, 是则取消事件 + } + } + + /* 功能三:右击空气登录(本质就是从playerNameList把他删了) */ + @EventHandler + public void onPlayerInteract(PlayerInteractEvent e) { // 玩家交互时会调用这个方法(这个下面会解释) + if(e.getAction()==Action.RIGHT_CLICK_AIR) { // 判断是不是右键空气 + playerNameList.remove(e.getPlayerName()); + } + } +} +``` + +从上面的代码我们可以看出每一个事件都对应着一个`XXXEvent`对象. 事件类都以`Event`作为名称的结尾. + +**监听器类里由若干个带`@EventHandler`注解, 参数仅为一个`XXXEvent`的方法. 这些事件触发后会触发这些方法, 这就是事件监听的本质.** +要特别注意, **监听器中带有`@EventHandler`的方法一个只能监听某一个事件, 而不能监听多个事件!** 换而言之, 这也就意味着, **你不能填写两个参数, 实现一个方法同时监听两个事件的目的!** + +这里我们用到了玩家交互事件. 这个事件抽象不易理解. +确切的来说, `PlayerInteractEvent`指的是玩家与方块交互, 交互指的是左右键方块的几乎一切操作. 具体的解释完全可以在JavaDoc中了解到. +如果你曾经用过领地插件`Residence`, 你肯定对某个领地的权限`use`印象很深, 这个`use`权限与`PlayerInteractEvent`事件差不多, 可以近似认为`Residence`插件的`use`权限就是通过监听`PlayerInteractEvent`写出来的. + +要注意, **监听器必须要注册才能算生效**! +我们的监听器里的方法都能监听到对应的事件的原因是, 在`onEnable`方法中, 我们写了这样的代码: + +```java +Bukkit.getPluginManager().registerEvents(this,this); //这行代码注册了HelloWorld类为监听器, 如果没有这行代码, 下面所有带@EventHandler注解的方法都不会在事件触发时被调用! +``` + +*registerEvents方法的第一个参数是监听器,第二个参数是插件主类的实例. 在这里主类就是监听器. 具体你可以在后面了解到.* + +## 理解客户端与服务端的关系 +如果你实际去使用上面的那个代码, 你可能会发现一个问题: 玩家移动在游戏里还可以移动, 但是一会儿会被服务器"弹回来". +这样确实是达到了取消玩家移动的目的, 但是, 为什么最终的效果不是"玩家一点都动不了"呢? + +事实上, 我们无法在服务端取消玩家一点也不能移动. +客户端移动玩家时, 会在客户端显示出移动后的样子, 然后才会传递给服务器玩家移动的信号, 服务端收到客户端的信号后, 服务器才会触发`PlayerMoveEvent`事件, 做出响应. + +也就是说, 客户端与服务端之间, 客户端往往都是"先斩后奏"的. 客户端不管你服务端取不取消, 先那么显示出来再说. + +*值得注意的是, 如果玩家并没有改变他的X/Y/Z, 而只是利用鼠标转了一下身, 这也属于玩家移动, 仍会触发`PlayerMoveEvent`事件.* + +*如果要是真的想实现让玩家在服务器的某个坐标一点也动不了, 也许需要发挥你的聪明才智了. 让玩家卡在一个透明方块里? 也许有更好的方案? 现在有人已经实现了!* +*目前我们通常利用设置玩家移动速度的方法来让玩家无法移动!* + +## 查询我们想了解的事件 + +### 事件是怎么取名的 + +你可以发现, 玩家移动`PlayerMoveEvent`、玩家进入服务器`PlayerJoinEvent`事件都有明显的特征. + +1. 功能决定名称, 看了名称你就能大致明白它的功能. +2. 都以`Event`作为结尾. 这也就说BukkitAPI中所有名字最后是`Event`的类都是事件类. +3. 开头的第一个词决定作用范围. 例如上面两个类开头都是`Player`, 这两个类都是与玩家有关的事件类. + +所有的事件类都在`org.bukkit.event`包或其子包里. + +### 可取消事件与不可取消事件怎么判断 +例如`PlayerMoveEvent`在JavaDoc中, 我们可以注意到这些内容: + +```java +public class PlayerMoveEvent +extends PlayerEvent +implements Cancellable +``` + +`PlayerMoveEvent`事件实现了`Cancellable`接口. +`Cancellable`中定义了`setCancelled`方法和`isCancelled`方法. +通过`setCancelled`方法, 你可以在事件触发时设置是否取消该事件. 例如, 如果监听玩家移动, 事件触发时使用`setCancelled`方法, 可以取消玩家移动. +`isCancelled`方法可以判断该事件是否被取消. + +对于不可取消事件, 它们没有实现`Cancellable`接口, 因此它们无法被取消. +就像玩家退出服务器, 你总不能像刀剑神域一样, 不让玩家退出服务器吧. + +如果你真的想这么做,你或许可以考虑用MOD去阻止玩家关闭进程. +因为链接到服务器是客户端主动发起的. + +### 找到我们要找的事件 + +我们了解了如何监听事件, 那么我们想做到“不让玩家破坏方块”这个功能, 应该怎么做? +思考后可以发现, 我们需要监听“方块被破坏”这个事件!那破坏方块后触发什么事件? 你需要在JavaDoc中找才能找到! + +分析: 破坏方块这个事件是一个与方块有关的事件. 打开JavaDoc你可以发现`BlockXXXXEvent`这类的类有许多. +你也许会说, 玩家破坏方块为什么不是一个与玩家有关的事件呢?很有道理!你也可以在玩家事件中找找看有没有这样的事件. + +JavaDoc左侧上方是所有的包, 点击`org.bukkit.event.block`就能在左侧下方看所有与方块有关的事件了. +你可以轻松地发现, 在前几个的位置迅速就能看到`BlockBreakEvent`, 根据名字就能判断出, 这就是你想找的方块破坏事件, 打开后看到描述为`Called when a block is broken by a player.`, 很明显, 监听它就对了. + +```java +@EventHandler +public void onBlockBreak(BlockBreakEvent e) { + e.setCancelled(true); +} +``` + +这样我们就写出了想要的功能. + +### 并不是所有的事件都能监听. + +在查阅JavaDoc时你可能发现`PlayerEvent`、`BlockEvent`这种事件.这些都是不可以被监听的事件. +你不可以通过监听`PlayerEvent`事件来达到一次性监听所有与玩家有关的事件的目的. +*它们不能被监听的原因是没有做HandlerList. 在这里不多说明, 后面讲述如何自己做一个自定义事件时你会明白.* + +一般来说,如果事件名由两个词构成(例如`PlayerEvent`)都不能监听, 大多数事件都可以监听. + +你可能好奇, 常见的登录插件都是把所有需要的玩家事件都写了`@EventHandler`注解方法一个个监听的? +答案是, 的确如此. 你要想写登录插件, 你就应该去监听许许多多事件, 累也没办法, 就得这样写. + +## EventHandler注解的参数 +##监听优先级 +想象一下, 如果有两个插件, 他们同时监听玩家移动. 其中一个插件判断后发现玩家没有充够450块钱, 于是它取消了这名玩家的移动. 但是另外一个插件判断后发现玩家非常帅, 于是它允许了这名玩家的移动. +那么就会存在问题: 有一个插件`setCancelled(true)`, 而又有插件`setCancelled(false)`. 应该以谁为准? +那就要看监听优先级了! + +下面是两个插件处理`PlayerMoveEvent`的部分: +A插件: +```java + // A插件 + @EventHandler(priority=EventPriority.LOWEST) + public void onPlayerMove(PlayerMoveEvent e) { + System.out.println("testA"); + e.setCancelled(true); + } +``` +B插件: +```java + // B插件 + @EventHandler(priority=EventPriority.HIGHEST) + public void onPlayerMove(PlayerMoveEvent e){ + System.out.println("testB"); + e.setCancelled(false); + } +``` +在实际的运行中, 当玩家移动时你会发现, 控制台中先输出了`testA`后输出了`testB`, 玩家都在服务器内可以自如移动. +这意味着A插件第一个响应了玩家移动, 然后B插件才相应的玩家移动. +`@EventHandler`注解有一个成员叫做`priority`, 给他设置对应的`EventPriority`, 即可设置监听优先级. 在上面的例子中, Bukkit会在所有的LOWEST级监听被调用完毕后, 再去调用HIGHEST级监听. + +`EventPriority`提供了五种优先级, 按照被调用顺序,为: +LOWEST < LOW < NORMAL(如果你不设置, 默认就是它) < HIGH < HIGHEST < MONITOR . +其中, LOWEST最先被调用, 但对事件的影响最小. MONITOR最后被调用, 对事件的影响最大. + +### ignoreCancelled +`@EventHandler`注解除了`priority`之外, 还有`ignoreCancelled`. 如果不设置, 它默认为false. + +让我们回到上面的A插件与B插件的例子中. 我们把B插件的`onPlayerMove`改成这样: +```java + // B插件 + @EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true) + public void onPlayerMove(PlayerMoveEvent e) { + System.out.println("testB"); + e.setCancelled(false); + } +``` +可以发现, 后台只输出了`testA`, 玩家无法在服务器中移动. 这说明B插件的`onPlayerMove`没有被触发. +如果有其他监听已经取消了该事件, 设置`ignoreCancelled`为`true`将可以忽略掉这个事件, 所以B插件的`onPlayerMove`方法没有被触发. + +## 监听器的注册 +可能你已经发现了, 在之前的代码中, 我们都会在`onEnable`方法中插入这样的语句: +```java +Bukkit.getPluginManager().registerEvents(this,this); +``` +当时解释的是, `registerEvents`方法注册了该监听器. +如果没有这样的注册语句, 那么Bukkit就不会在事件触发时调用监听器类的对应方法. + +该方法的第一个参数是监听器, 第二个参数是插件主类的实例. 当时由于我们为了偷懒, 直接把主类实现了`Listener`作为监听器, 因此我们可以这样写. +可我们不能写插件的时候把代码都堆在主类中. 这也就意味着, 我们可以把其他类实现`Listener`, 用同样的方式注册它, 这样我们就可以把监听事件部分的代码放在别的地方, 使插件代码更有条理性. + +我们新创建一个类, 让它实现`Listener`, 再写对应的方法监听玩家移动, 就像这样: +```java +public class DemoListener implements Listener { + @EventHandler + public void onPlayerMove(PlayerMoveEvent e) { + System.out.println("PLAYER MOVE!"); + } +} +``` +现在我们在主类的`onEnable`方法里, 就可以注册它了! +```java +Bukkit.getPluginManager().registerEvents(new DemoListener(), this); +``` + +## 常用事件简介 + +这里可能罗列不会全面, 在我想到哪些“坑事件”后会列在这里. + +### 登录、进入服务器 +BukkitAPI中与登录有关的常见的有: `PlayerLoginEvent` `PlayerJoinEvent`. +值得注意的是, 所有玩家进入服务器的事件都是不可取消事件. + +在玩家尝试连接服务器时, 会触发`PlayerLoginEvent`, 玩家完全地进入服务器后, 会触发`PlayerJoinEvent`. +在`PlayerLoginEvent`触发的时候, 你不可以操控玩家`Player`对象获取其背包等信息, 而仅可以获取UUID、玩家名和网络信息(IP等)等. +*顺便一提, 玩家如果不在线, 你不可以通过BukkitAPI操控其背包. * +`PlayerJoinEvent`触发时, 服务器内将会出现玩家实体. 此时你可以当做玩家完全进入服务器, 对其自由操作. + + +打个比方, 你家有一扇防盗门, 有人想进入你家. +首先他需要敲门, 在门外喊出自己的基本信息(名字等), 这是`PlayerLoginEvent`触发的时候. 如果你想从他背包里拿出东西, 不可以, 因为他在门外面. +当你给他打开门, 他进了你家中站稳了以后, 这是`PlayerJoinEvent`触发的时候, 这时候不管你是想打他还是想拿走他的东西, 都可以. + +### 玩家移动 +在上面我们已经提及过, 玩家移动是“先斩后奏”被触发的. 具体请见上文. + +### 玩家打开背包 +也许你会看到`InventoryOpenEvent`. 根据描述你大概明白, 类似右击箱子后出现的那种带格子的界面被打开可以被监听. +但是有一件事很重要: 玩家按E打开背包是没办法被监听的. + +一般如果要实现禁止玩家打开背包, 其实最常规的做法就是开一个`BukkitRunnable`, 定时调用`p.closeInventory()`关闭玩家正在打开的背包实现的. +*这里不详细讲述具体如何操作, 感兴趣可以在Github翻阅优秀插件的源码进行学习.* +*后面会讲述Runnable, 也许看后你会明白如何操作.* diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/2-基础内容/3-配置API.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/2-基础内容/3-配置API.md new file mode 100644 index 0000000..6eff5ab --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/2-基础内容/3-配置API.md @@ -0,0 +1,205 @@ +--- +front: +hard: 入门 +time: 30分钟 +--- + +# 配置API + +配置文件用来储存配置信息, 以便使用文件开关功能、储存数据、修改信息. +我们往往需要读写配置文件. Bukkit为我们提供了配置API. + +配置API是BukkitAPI提供的读写配置文件的工具. 其相对而言较为简单, 是插件开发中常用的API. + +*目前为止, 配置API只有YAML配置功能可用. 这也是大多数插件为什么配置文件是YAML文件的原因. +在本文中, 我们也将使用YAML配置API.* +*现在的配置API的类均在 `org.bukkit.configuration` 和 `org.bukkit.configuration.file` 包中.* +*但是这不代表你只能使用 YAML,如果你有无限的创意和实现方法,你甚至可以将表格作为配置文件以实现更现代化的配表方式.* + + +## 了解YAML文件 + +### 键值对 + +相信开服的经验已经使你对YAML文件有了初步认识. +YAML文件的文件后缀是`.yml`. 其配置文件结构需要严格遵守YAML标准. + +下面是一个符合标准的YAML配置文件的内容: + +```yaml +Settings: + DebugMode: true + Time: + CoolDown: 10 +Data: + player1: + NickName: HandsomeBoy + Score: 50 + TotalTime: 40 + Title: + - Toilet Protecter + - Widow Maker + - Chicken Fucker +``` + +相信你可以**根据空格看出每个项目之间的所属关系**, 如下: + +![](../images/0_4.jpg) + +**我们把上面所属关系图中, 矩形框内的东西叫做键(Key)**. 例如, `Settings`是一个键, `Data`是个键. **在`Settings`键下存在`DebugMode`、`Time`两个子键, 它们分别叫做`Settings.DebugMode`键和`Settings.Time`键**. 同理, 在`Settings.Time`键下还有`CoolDown`这个子键, 这个子键叫`Settings.Time.CoolDown`键. + +我们可以用这样的命名方法来称呼一个YAML文件中的任一一个键了. 并且还可以根据名称看出所属关系. +例如, `Data.player1.Score`键对应的值是 `50`. + +在YAML中, 键和值一一对应, 一个键一定会有一个值. + +### 数据类型 + +通常可以用配置文件存储一些基本类型(int、double、boolean)、String、数组和可被序列化的对象. + +Bukkit中给出的一些对象有些是可以直接存进配置文件的, 这需要看这个类是不是实现了`ConfigurationSerializable`接口. 例如, `Player`类型的对象就可以被直接存入配置文件, 因为查阅JavaDoc后可以发现它实现了`ConfigurationSerializable`. + +![](../images/0_5.jpg) + +*后续会详细介绍, 这里需要知道判断方法.* + +在上面的配置文件中, 配置文件里储存了: +1. 存储了一个`boolean`类型的值(`Settings.DebugMode`键). +2. 存储了一些数字类型的值. +3. 存储了一个`String`字符串(`Data.player1.NickName`键). +4. 存储了一个`StringList`(YAML里的`StringList`就是Java中的`List`, 例如`Data.player1.Title`键). + +YAML中注释以`#`表示. +```yaml +#就像这样写注释, 配置文件读取时会忽略掉注释 +Settings: + DebugMode: true +``` + +相信你可以通过这个例子明白配置文件中可以储存哪些数据了. + +### 对于不存在的数据 + +很明显, 上面的配置文件中, 并没有`Data.player2.NickName`键, 那么如果我非要获取`Data.player2.NickName`键的值, 获取到的数据是什么呢? +答案是null. 换句话说, **YAML里所有不存在的键, 值是null.** + +请记住这句话. 我们可以根据这个原理推导出, 如果你想删除一个已经存在的键, 那就是把这个键的值设置为null. + +## 操作默认配置文件 + +这里的默认配置文件指的是`config.yml`文件. +首先我们需要准备一个默认的`config.yml`文件. 这个文件会在插件检测到`plugins\插件名`文件夹下没有`config.yml`文件时被放入该文件夹中. +在插件jar文件里, 默认的`config.yml`文件要与`plugin.yml`文件处于同一目录下, 所以创建默认`config.yml`的方法与创建`plugin.yml`文件的操作方法一致. 在这里我们在默认`config.yml`文件中存入我们一开始举的例子. + +### 读取config.yml数据 + 下面做一个插件, 在玩家登陆服务器时, 给玩家显示配置文件`Data.玩家名.Score`键对应的值. + +```java +public class HelloWorld extends JavaPlugin implements Listener{ + public void onEnable(){ + saveDefaultConfig(); //这个代码会自动判断插件配置文件里是不是有config.yml, 没有就会放入默认的config.yml + Bukkit.getPluginManager().registerEvents(this,this); + } + + public void onDisable(){} + + @EventHandler + public void onPlayerJoin(PlayerJoinEvent e){ + //在这里我们监听了PlayerJoinEvent, 并操作`config.yml` + String key = "Data." + e.getPlayer().getName() + ".Score"; //这是我们要获取的键名 + int score; + if(getConfig().contains(key)){ //先判断一下有没有这个键 + score = getConfig().getInt(key); //有的话读取 + } else { + score = 0; //没有的话就按0处理 + } + e.getPlayer().sendMessage("你的积分是: " + score); //然后给玩家发送 + } +} +``` + +如果你用`getConfig().getString(key)`获取玩家数据`Score`键的值, 那么获取到的就是一个String字符串. +也就是, YAML中值对应的数据类型具体是什么, 关键要看你用的getter是什么. + +### 写入数据到config.yml + +我们再来做个"加分项", 玩家挖掉一个石头后, 给他加分. + +```java +public class HelloWorld extends JavaPlugin implements Listener{ + public void onEnable(){ + saveDefaultConfig(); + Bukkit.getPluginManager().registerEvents(this,this); + } + + public void onDisable(){} + + @EventHandler + public void onPlayerJoin(PlayerJoinEvent e){ + //这里代码跟上面是一模一样的, 这里只是做了简化, 因为原先的if占篇幅太大 + String key = "Data." + e.getPlayer().getName() + ".Score"; + int score = getConfig().contains(key)?getConfig().getInt(key):0; + e.getPlayer().sendMessage("你的积分是: " + score); + } + + @EventHandler + public void onBlockBreak(BlockBreakEvent e){ + if (e.isCancelled()) return; //判断此事件是不是被其它插件取消掉了 + if(e.getBlock().getType() == Material.STONE){ //判断类型, 是石头 + String key = "Data." + e.getPlayer().getName() + ".Score"; + int score = getConfig().contains(key)?getConfig().getInt(key):0; //获取玩家当前积分, 如果从未记录此玩家的积分数据则默认为0 + getConfig().set(key,score + 10); //挖一个石头加10分 + + //但是写到这里要小心!你只是修改了内存上的数据, 你没有修改硬盘上的config.yml文件里的数据! + saveConfig(); //所以要注意, 修改数据要记得保存 + } + } +} +``` + +由此, 你需要小心, **getConfig()的内容是内存上的内容, 修改它并没有修改硬盘上的内容, 关服/重载后就会消失, 因此要注意保存!** + +`set`不区分数据类型是什么, 存储数据全部都用`set`方法. `set`不管这个键在配置文件里存不存在, 都会写入这个数据. + +还记得我们一开始说的`YAML里所有不存在的键, 值是null`吗? 如果你想删除掉`player3`的数据, 那你应该写成: + +```java +getConfig().set("Data.player3",null); +``` + +这样配置文件里`Data`键下就没有`player3`的数据了,也就达到了删除一个键的目的. + +## 操作自定义的配置文件 +关于非`config.yml`的YAML文件的操作, 有很多种方式可以做到. +下文叙述的是其中的一种. + +### 准备默认配置文件 +我们还是需要像`config.yml`那样准备一份默认配置文件, 放在与plugin.yml相同目录下. 不同的是, 除了`saveDefaultConfig`以外, 我们还需要其他的代码来保存默认配置文件. + +例如我们有`config.yml`和`biu.yml`两个配置文件, 插件加载时应该这样生成默认配置文件: +```java +this.saveDefaultConfig(); //生成默认config.yml +this.saveResource("biu.yml", false); //生成默认biu.yml +``` +*`saveResource`方法的第一个参数是文件名, 第二个参数是是否覆盖, 设置成false可以达到saveDefaultConfig的效果.* + +同理,利用`saveResource`可以生成你想生成的默认的非`config.yml`的配置文件. + +如果我想实现在插件配置文件夹创建一个新的文件夹存放配置文件怎么做呢? 很简单: +``` +this.saveResource("test\biu.yml", false); //生成默认biu.yml, 放在test文件夹里, Jar文件中也需要有test文件夹 +``` + +### 基本读写与保存 +下面是一个读写与保存的示例: +```java +// 读取配置文件 +// this.getDataFolder()方法返回插件配置文件夹的File对象 +File biuConfigFile = new File(this.getDataFolder(), "biu.yml"); +// 也可以在插件配置文件夹创建一个新的文件夹以存放配置文件 +// File biuConfigFile = new File(this.getDataFolder(), "test/biu.yml"); +FileConfiguration biuConfig = YamlConfiguration.loadConfiguration(biuConfigFile); +biuConfig.get....... +biuConfig.set....... +// set完了记得保存! +biuConfig.save(biuConfigFile); diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/2-基础内容/4-命令执行器.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/2-基础内容/4-命令执行器.md new file mode 100644 index 0000000..49e72e4 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/2-基础内容/4-命令执行器.md @@ -0,0 +1,128 @@ +--- +front: +hard: 入门 +time: 30分钟 +--- + +# 命令执行器 + +## 认识命令机制 +MC中的命令是一个字符串, 用来实现游戏内高级功能. + +在MC客户端中, 玩家将在聊天框内输入命令. +**当且仅当在“聊天”内, 命令与普通的聊天内容的区别在于其内容的第一个字符是一个斜杠`/`**. + +该字符串中的空格表示一个分隔, 开头的一节为命令的名称. +除去命令的名称, 剩下的部分从空格处断开可以分成一个数组. + +例如, `a b c`是一个命令, 其命令名称为`a`, 其参数可用一个数组`args`表示为: +``` +args[0]: "b" +args[1]: "c" +``` + + + +## 定义新命令 +如果我们需要定义一个新的命令, 首先我们需要在`plugin.yml`文件中增加相关信息: +```yml +name: HelloWorld +main: tdiant.helloworld.HelloWorld +version: 1 +author: tdiant +commands: + rua: + description: RUA!RUA!RUA! +``` + +在`plugin.yml`文件里, 我们增加了`commands.rua`键, 这就可以代表注册了一个`rua`命令. 我们给他增加了一个`description`子键表示对该命令的描述, 描述信息会出现在`/help`菜单里. + +请注意, 请不要在plugin.yml文件里出现中文! 这可能会出现问题! + +`commands.命令名`键可以有很多个子键, 这些都不是必须添加的, 甚至它可以没有子键. 具体子键如下: + +| 键 | 用途 | 例子 | +| ----- | ----- | ---- | +| description | 描述作用. 将会在/help中显示 | description: "I am a cute command." | +| aliases | 设置别名. 比如登录插件login命令也可以用/l命令代替. | aliases: [l, log] | +| permission | 设置命令需要的权限 | permission: rua.use | +| permission-message | 没权限时的提示语 | permission-message: "YOU HAVE NO PERMISSION!" | +| usage | 命令的用法. | usage: `/ YOUR_NAME` | + + +注意: +1. ``在usage里可以代表你的命令名. +2. 你的命令设置了aliases后命令名不能按照aliases称呼. 比如你给login命令设置了`aliases: [l]`你不能也叫他`l`命令, 它还是`login`命令. +3. 不推荐使用`permission`和`permission-message`, 因为plugin.yml里出现中文爱出问题. 事实上, 我们可以用`Player.hasPermission`方法在监听命令的时候自己亲自判断有没有权限. +4. 如果一个名称被别的插件注册了或设置为了某个命令的别称, 会出现冲突问题, 尽量避免. +5. 别弄中文的命令, 如果想搞, 去试试监听`PlayerCommandPreprocessEvent`. + +## onCommand +我们可以类似`Listener`, 做一个`CommandExecutor`监听命令. + +```java +public class DemoCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { + sender.sendMessage("HI!"); + return true; //true代表命令执行没问题, 返回false的话Bukkit会给命令输入方一个错误提示语 + } +} +``` + +然后也同理, 在onEnable里加入注册: +```java +Bukkit.getPluginCommand("rua").setExecutor(new DemoCommand()); +``` +但是如果onCommand方法放在了主类里, 那就不需要注册了. + +`onCommand`方法有四个参数, 分别为: +1. `CommandSender sender` —— 命令输入方, 实际传入的有可能是Console, 有可能是Player或者其他情况. +2. `Command cmd` —— 所执行的命令对象. +3. `String label` —— 如果该指令被设置了别名(`aliases`), 此值将为玩家使用哪一个别名执行了该指令. +4. `String[] args` —— 参数. 例如/rua a b的话, args[0]为"a", args[1]为"b". + +> 警告: 字符串的比较, 请不要使用`==`, 因为其比对的是内存地址, 可能造成一些没有预料到的结果! 建议使用`equals`方法, 例如`args[0].equals(string)` + +如果你的命令希望只被玩家使用, 通常这样判断: +```java +if(!(sender instanceof Player)){ + sender.sendMessage("你不是玩家!不能用!"); + return true; //不返回true, Bukkit还会显示出来一串错误提示, 你可以试试看. +} +``` + +判断完为玩家后, 若希望判断其有没有权限执行命令, 可以: +```java +Player p=(Player)sender; //sender可以直接强转为Player +if(p.hasPermission("rua.use")){ + p.sendMessage("你有权限!"); +} +``` +玩家将会在聊天区域内看到输出: +``` +你有权限! +``` + +Bukkit内可以用ChatColor表示颜色前缀, 例如: +```java +p.sendMessage(ChatColor.RED+"你输错了!"); //输出红色的 "你输错了" +p.sendMessage(ChatColor.RED+"还可以"+ChatColor.YELLOW+"两种颜色混着用!"); +p.sendMessage(ChatColor.BOLD+"猜猜我会显示成什么效果"); +p.sendMessage(ChatColor.RED+""+ChatColor.BOLD+"猜猜我会显示成什么效果"); +p.sendMessage(ChatColor.BOLD+""+ChatColor.RED+"猜猜我会显示成什么效果"); + +String str = "&4哈哈"; //假如你从配置文件里读出来了一串 "&4哈哈". +p.sendMessage(str); //这样会显示出 "&4哈哈", 不带颜色 +p.sendMessage(ChatColor.translateAlternateColorCodes('&',str)); //这样就带颜色了 +``` + +还有其他的好玩的东西, 把下面的代码放在onEnable方法里试试看: +```java +System.out.println(ChatColor.RED+"猜猜我是什么效果"); +this.getLogger().info(ChatColor.RED+"你再猜猜我是什么效果"); +``` +以后推荐您用`getLogger().info`方法代替`System.out.println(也就是sout、sysout方法)`! + +在实际应用的时候, 还要小心`args.length`! 玩家只输入`/rua`没有参数的时候, 小心因为自己的疏忽造成`ArrayIndexOutOfBoundsException`! + diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/1-箱子GUI的实现.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/1-箱子GUI的实现.md new file mode 100644 index 0000000..c4a94b3 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/1-箱子GUI的实现.md @@ -0,0 +1,109 @@ +--- +front: +hard: 进阶 +time: 20分钟 +--- + +# Bukkit类与箱子GUI的实现 + +服务器里经常会利用箱子的GUI做“按钮菜单”功能. 有些服务器可能利用`ChestCommand`插件做出了各种花样的菜单. +如何写一个插件来实现这样的箱子GUI呢? + +# Bukkit类 + +我们早在事件监听注册监听器时就已经见过`Bukkit`类了. + +```java +Bukkit.getPluginManager().registerEvents(this,this); +``` + +`Bukkit`类是服务器的单例. 我们可以通过它操作服务器. +例如, 你可以用`Bukkit.banIP("某个IP")`来封禁某个IP号. 更多的用法可以在JavaDoc上查到. + +你也可以利用`Server`对象操作服务器, 二者几乎没有差别(`Bukkit`类内部就是操作`Server`对象). +插件主类提供`getServer()`方法, 返回值就是一个`Server`对象. + +# Inventory的使用 + +箱子GUI本质是一个Inventory界面. 首先我们需要创建一个Inventory对象出来. +但我们不必直接`new Inventory(...)`, 这是因为查阅JavaDocs可以得知,Inventory是一个接口,无法直接实例化。 +但是`Bukkit`类给我们提供了创建`Inventory`对象的方法: + +```java +Inventory inv = Bukkit.createInventory(player, 6*9, "URARA!"); +//第一项是主人, 在这里可以设打开界面的玩家Player对象(还记得Inventory和箱子或玩家背包等一一对应吗) +//第二项必须是 9n (n是1≤n≤6的正整数) +//第三项是标题 +ItemStack item_bk = new ItemStack(Material.DIAMOND); + +//在四周设置钻石边框 +//这里用这样脑残的写法是为了告诉你一个大概的意思 +//我相信你实际写的时候不会这么简单粗暴解决问题的, 应该会用上循环解决, 对吧 +inv.setItem(0,item_bk); +inv.setItem(1,item_bk); +inv.setItem(2,item_bk); +inv.setItem(3,item_bk); +inv.setItem(4,item_bk); +inv.setItem(5,item_bk); +inv.setItem(6,item_bk); +inv.setItem(7,item_bk); +inv.setItem(8,item_bk); +inv.setItem(9,item_bk); +inv.setItem(17,item_bk); +inv.setItem(18,item_bk); +inv.setItem(26,item_bk); +inv.setItem(27,item_bk); +inv.setItem(35,item_bk); +inv.setItem(36,item_bk); +inv.setItem(44,item_bk); +inv.setItem(45,item_bk); +inv.setItem(46,item_bk); +inv.setItem(47,item_bk); +inv.setItem(48,item_bk); +inv.setItem(49,item_bk); +inv.setItem(50,item_bk); +inv.setItem(51,item_bk); +inv.setItem(52,item_bk); +inv.setItem(53,item_bk); + +ItemStack item_button1 = new ItemStack(Material.GOLD); +ItemStack item_button2 = new ItemStack(Material.ANVIL); +inv.setItem(22,item_button1); +inv.setItem(31,item_button2); + +//然后可以给玩家打开这个Inventory(注意, 我们还没做限制, 这个时候玩家可以自由的在这个GUI里拿东西出来) +p.openInventory(inv); +``` + +然后我们监听`InventoryClickEvent`实现功能和限制: +```java +@EventHandler +public void onInventoryClick(InventoryClickEvent e){ + //从这里可以看出来, 标题不是随意设置的, 我们经常用标题作为区分GUI的标志 + if(e.getWhoClicked().getOpenInventory().getTitle().equals("URARA!")){ + e.setCancelled(true); //这样玩家就没办法拿出来物品了 + + //getRawSlot获得玩家点击的格子编号 + //但是玩家点击GUI之外不是格子的地方也会触发InventoryClickEvent, 需要做处理! + if(e.getRawSlot()<0 || e.getRawSlot()>e.getInventory().getSize() || e.getInventory()==null) + return; + + //自从Mojang把HIM删掉以后, 能触发InventoryClickEvent的只有Player了 + //目前来说可以直接把它强转成Player + Player p = (Player)e.getWhoClicked(); + + if(e.getRawSlot()==22){ + p.sendMessage("你点击了金锭!"); + p.closeInventory(); + } else { + p.sendMessage("你没有点击金锭!"); + p.closeInventory(); + } + } +} +``` +基于这个思路, 你可以做出一个有功能的箱子GUI了! + +> 思考: 如果遇到了某些能够修改箱子GUI的标题的插件(比如帮助加前缀) +> 能不能利用 InventoryHolder 来区分GUI呢? + diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/2-自定义事件.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/2-自定义事件.md new file mode 100644 index 0000000..d1623ef --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/2-自定义事件.md @@ -0,0 +1,145 @@ +--- +front: +hard: 进阶 +time: 30分钟 +--- + +# 自定义事件 + +我们现在所了解的事件都是Bukkit提供的. 例如, 玩家移动等. +那如果我们想自己去做一个事件呢? + +## 按需创建类 + +比如, 我想自己做出来一个`RuaEvent`, 实现在玩家聊天说`rua`的时候触发. +很明显, Bukkit只会提供玩家发送聊天信息的事件, 肯定不会单独为了实现在玩家聊天发送`rua`的时候单独做个事件. 那应该怎么做? + +首先想到的应该是监听玩家聊天事件, 然后判断玩家聊天发送的内容是什么, 如果是`rua`做我想做的事情. 这是常规的解决方法. +但是如果我想做一个强化插件, 我想在玩家强化物品的时候触发一个事件给自己和其他插件, 那我应该怎么做? 不如自定义一个属于自己的事件! + +这里我们以创建上文的`RuaEvent`事件举例, 我们的大致思路是这样的: +1. 创建一个`RuaEvent`类. +2. 监听玩家聊天, 判断玩家聊天内容, 如果是`rua`, 让Bukkit触发我们新建的`RuaEvent`对象. +3. 向玩家发送消息`rua`. + +我们就先新建一个类`RuaEvent`, 让其继承`org.bukkit.event.Event`类. 在该类中写下这些固定代码: +```java +public class RuaEvent extends Event{ + private static final HandlerList handlers = new HandlerList(); + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } +} +``` +HandlerList储存与监听本事件的监听器相关的对象. +这意味着Bukkit中注册监听器的本质就是在每个对应的事件HandlerList中加入该监听器的有关对象. +这也意味着Bukkit中事件的触发本质是遍历被触发事件的HandlerList, 调用监听器对应方法. + +> 假如我想让服务器里的玩家触发的所有事件, 已知所有的诸如PlayerJoinEvent等玩家事件都继承了PlayerEvent, 那我可以监听PlayerEvent事件吗? +> 答案是不可以, 因为`PlayerEvent`没有`getHandlerList()`方法, 结合上面的内容, 你应该可以意识到PlayerEvent是无法正常工作的吧. +> 所以你只能把所有Player开头的Event监听一个遍才可以达到目的! + +现在我们的自定义事件雏形已经完成. 你可以根据自己的需要添加相关代码! +这里我们示例的`RuaEvent`代码最终如下: + +```java +public class RuaEvent extends Event { + private static final HandlerList handlers = new HandlerList(); + private Player p; + + public RuaEvent(Player p){ + this.p = p; + } + + public Player getPlayer(){ + return p; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } +} +``` + +## 可取消事件的实现 + +等一等, 这样做出来的事件没有`setCancelled`方法和`isCancelled`方法, 这是不可取消的事件. +如果想做成可取消事件, 需要实现`Cancellable`接口: +```java +public class RuaEvent extends Event implements Cancellable{ + private static final HandlerList handlers = new HandlerList(); + private Player p; + + private boolean cancelledFlag = false; + + public RuaEvent(Player p){ + this.p = p; + } + + public Player getPlayer(){ + return p; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } + + @Override + public boolean isCancelled() { + return cancelledFlag; + } + + @Override + public void setCancelled(boolean cancelledFlag) { + this.cancelledFlag = cancelledFlag; + } +} +``` + +如果是不可取消的事件, 无需实现`Cancelled`. +截止到现在, `RuaEvent`已经自定义成功, 现在我们只需要做第二步即可: + +1. 如果RuaEvent是个不可取消事件 + +```java +@EventHandler +public void onPlayerChat_DEMO1 (PlayerChatEvent e){ //如果RuaEvent是个不可取消事件 + if(e.getMessage().equals("rua")) Bukkit.getServer().getPluginManager().callEvent(new RuaEvent(e.getPlayer())); //触发事件 + e.sendMessage("Rua!"); +} +``` + +2. 如果RuaEvent是个可取消事件 + +```java +@EventHandler +public void onPlayerChat_DEMO1 (PlayerChatEvent e){ //如果RuaEvent是个可取消事件 + if(e.getMessage().equals("rua")){ + RuaEvent event = new RuaEvent(e.getPlayer()); + Bukkit.getServer().getPluginManager().callEvent(event); + if(event.isCancelled()) { + return; //事件被取消, 终止事件的处理 + } + // 事件未取消对应的逻辑 + e.sendMessage("Rua!"); + } +} +``` + +*在这里监听了**PlayerChatEvent**,但是此事件已被标记@Deprecated,实际的开发过程中不推荐监听此事件.* +*实际开发中建议监听的是**AsyncPlayerChatEvent**事件. 注意这是异步监听,用法基本类同于上述事件的监听,具体请参见JavaDoc.* diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/3-深入plugin配置.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/3-深入plugin配置.md new file mode 100644 index 0000000..7ed7577 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/3-深入plugin配置.md @@ -0,0 +1,98 @@ +--- +front: +hard: 进阶 +time: 15分钟 +--- + +# 深入plugin.yml + +`plugin.yml`文件是Bukkit及其衍生服务端识别插件的重要文件. + +在服务端加载插件时, 服务端加载完毕Jar文件后做的第一件事就是读取该Jar文件的`plugin.yml`文件. +如果把任一可正常工作的插件的Jar文件用相应的ZIP压缩软件打开, 删除`plugin.yml`文件后再启动服务端, 会抛出错误. +``` +Could not load 'plugins\[YOUR_PLUGIN].jar' in folder 'plugins' +org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml +``` +可发现, 服务端将会因为没有`plugin.yml`文件而抛出`InvalidDescriptionException`错误. + +
+ +在`plugin.yml`文件中, 目前我们已知的有`name`、`version`、`main`、`author`四个项目可以设置. +事实上, `plugin.yml`文件中还有许多可以设置的项目, 部分项目是本节的内容, 其余可以在SpigotMC的官方文档中查阅到. + +> 目前BukkitAPI主要由SpigotMC维护, 因此大量的BukkitAPI文档都在 SpigotMC 网站上. +> 有关plugin.yml文件的官方文档在这里: +> https://www.spigotmc.org/wiki/plugin-yml/ + +## 必要设置项 +`plugin.yml`文件中, `name`、`main`、`version`三项必须存在. +*这也意味着, 前面的实例中, 我们使用的`plugin.yml`文件, 删去`author`键仍可被服务端正常加载.* + +不妨来认识一下这三个设置项. + +### name +顾名思义, 它定义了插件的名称. + +对于名称, 官方WIKI中给出了严格的要求, 即只能由 **英文小写或大写字符、阿拉伯数字或下划线** 构成. 决不能出现中文字符、空格等. +在后续生成插件配置文件夹时, 该项设置的插件名将会是插件配置文件夹的名称. + +起名的时候应该注意, 尽可能起一个“个性”的名称, 防止与其他插件重名. + +### version +指插件的版本号. +该键理论上可以在后面填写任意String内容. 但是官方WIKI要求尽可能使用X.X.X格式的版本号表示(例如: 2.3.3). +关于版本号规则,可以参考[语义化版本](https://semver.org/lang/zh-CN/) + +### main +指插件的主类名. + +在插件中, 主类有且只有一个, 且需要继承`JavaPlugin`类. 主类是插件的“入口”, 这里的`main`即意在说明主类的名称. +这里需填写主类的全名, 也就是精确到主类所在的具体包. 说白了就是不只是需要把主类名带上, 还要把包名带上. + +## 可选设置项 +`plugin.yml`文件只需要存在必要设置项的三个键即可. +下面的键可选, 可有可无. 但有一些在一些特定的情况下必须要有. + +### 依赖 +有时候你的插件可能需要调用`Vault`(用来获取玩家货币余额)或其他的插件, 即依赖其他插件. +这时候需要在`plugin.yml`文件中进行设置告知服务端, 从而保证所依赖的插件在本插件之前被加载. + +你可以在`plugin.yml`文件中加入`depend`键或`softdepend`键来控制依赖. + +`depend`键或`softdepend`键接的值必须是数组. 例如这样: +```yml +depend: [Vault, WorldEdit] +softdepend: [Essentials] +``` +两个键设置的内容区别如下: +1. depend: 插件强制要求的依赖. 如果没有这个插件, 该插件将无法正常工作, Bukkit此时会抛出相应错误. +2. softdepend: 插件不强制要求的插件. 如果服务端内没有这个插件, 插件仍可正常工作. + +后面设置的数组内的内容都是所依赖插件的名称, 此处名称应与所依赖的插件的`plugin.yml`文件的`name`键的值相同. + +### loadbefore +`depend`与`softdepend`可以实现插件在某个插件之后加载. 但也许有时你的插件可能需要实现在某个插件之前被加载. +此时你可以使用`loadbefore`设置, 用法类似. 例如: +```yml +loadbefore: [Essentials, WorldEdit] +``` + +在上面的例子中, 可保证插件在WorldEdit与Essentials插件之前被加载. + +### commands +如果你的插件定义了新指令, 你第一步就需要设置该项告知服务端. +此处仅做示范: +```yml +commands: + test: + description: "Hello World!" +``` +这可以告知服务端注册了指令`test`, 并且描述为`Hello World!`字符串, 该描述字符串将会在`/help`指令中被显示. + +### author与authors +此处不再赘述其作用. 如果你想表示多名作者, 你可以设置`authors`项, 值需为一个数组. +```yml +authors: [tdiant, Seraph_JACK] +``` +如果同时存在`author`与`authors`, 将忽略`author`. diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/4-配置API的序列化以及遍历.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/4-配置API的序列化以及遍历.md new file mode 100644 index 0000000..e11d1f6 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/4-配置API的序列化以及遍历.md @@ -0,0 +1,212 @@ +--- +front: +hard: 进阶 +time: 30分钟 +--- + +# 配置API的序列化和遍历 + +# 序列化 +## 了解序列化 +如果我自己做了一个类型, 例如下面的`Person`类: + +```java +public class Person { + public String name; + public String introduction; + + public Person(String name, String introduction) { + this.name = name; + this.introduction = introduction; + } +} +``` + +现在我们新建一个`Person`对象: + +```java +Person person = new Person("tdiant", "hello!!"); +``` + +我们想把`Person`保存在配置文件里怎么办? +很遗憾,直接`getConfig().set("demo",person);`是行不通的. 你会发现`getConfig.get("demo")`根本得不到这个对象. + +> 哪些东西可以直接set保存呢? +> 类似getInt, 所有拥有get方法的类型都可以直接保存. (包括`List`) +> +> 还有一些BukkitAPI给的类型, 例如ItemStack. 但不是全部都是这样. +> 如果你想判断一个类型是不是可以直接set, 你可以在JavaDoc中找到它, 看它是否实现了`ConfigurationSerializable`类. + + +你可能想到了最简单粗暴的办法: +```java +//这样set +getConfig().set("demo.name",test.name); +getConfig().set("demo.introduction",test.introduction); +//然后保存, 用的时候这样 +getConfig().getString("demo.name"); +getConfig().getString("demo.introduction"); +``` + +这的确是一种切实可行的办法. 但是这真的是太麻烦了. 有没有一种方法直接set或get这个对象的办法呢? 有! 你可以使用序列化和反序列化实现它! + +## 让自定义类型实现序列化与反序列化 +以上文`Person`为例. 首先让他实现`ConfigurationSerializable`, 并添加`deserialize`方法. 如下: +```java +public class Person implements ConfigurationSerializable { + public String name; + public String introduction; + + public Person(String name, String introduction) { + this.name = name; + this.introduction = introduction; + } + + @Override + public Map serialize() { + Map map = new HashMap<>(); + return map; + } + + public static Person deserialize(Map map) { + + } +} +``` + +然后继续完善`serialize`, 实现序列化. 我们只需要把需要保存的数据写入map当中即可. +注意, 需要保存的数据要保证可以直接set, 不能则也需要为他实现序列化与反序列化. +```java +@Override +public Map serialize() { + Map map = new HashMap<>(); + map.put("name",name); + map.put("introduction",introduction); + return map; +} +``` + +序列化后, 数据即可直接set进配置文件里. 为了实现直接get的目的, 还需要进行反序列化. +```java +public static Person deserialize(Map map) { + return new Person( + (map.get("name") != null ? (String) map.get("name") : ""), + (map.get("introduction") != null ? (String) map.get("introduction") : "") + ); +} +``` +编写完毕后, 我们需要像注册监听器一样, 注册序列化. 在插件主类的`onEnable`中加入如下语句: +```java +ConfigurationSerialization.registerClass(Person.class); +``` +为什么要这么做呢? +可以找到 ConfigurationSerializable的JavaDocs页面 + +![](../images/0_6.png) + + +至此, 你就可以自由地对一个自定义的对象直接地get和set了! +下面分别演示set与get: +```java +// set +Person person = new Person("tdiant", "hello!!"); +getConfig().set("demo", person); +saveConfig(); +``` +默认配置文件(config.yml)将出现: +```yml +demo: + ==: myplugin.Person + name: tdiant + introduction: hello!! +``` +BukkitAPI会根据`==`的值判断这段配置是由什么类序列化而来的, 进而方便其反序列化. +不要轻易改动`==`属性的值, 否则BukkitAPI会因为找不到类或此类没有被注册(ConfigurationSerialization类的registerClass方法)而报错. +```java +// get +Person person = (Person) getConfig().get("demo"); +System.out.println("name = " + person.name + " introduction = " + person.introduction); +``` +控制台将输出: +``` +name = tdiant introduction = hello!! +``` +# 配置文件的遍历 +试想, 如果存在下面的配置文件: +```yml +demo_list: + a: 1 + b: 233 + c: 666 + d: lalalalalal +``` +我应该如何对`demo_list`的子键进行遍历, 得到所有子键的对应值? +最简单错报的方式就是将`demo_list.a`键、`demo_list.b`键...依次读取. 但这是建立在你知道`demo_list`有`a`、`b`、`c`...这些子键的基础之上的. +如果我事先不知道`demo_list`的子键都各自叫什么, 又应该如何对`demo_list`的子键进行遍历, 得到所有子键的对应值? + +## 配置片段 ConfigurationSection +我们可以把`demo_list`键对应的部分拆出来. +*下文假设config对象是我们现在正在操作的FileConfiguration对象.* +```java +ConfigurationSection cs = config.getConfigurationSection("demo_list"); +``` +这里我们得到了`ConfigurationSection`对象, 这个对象可以当做config对象`demo_list`键部分的片段, 等效于这个yaml数据: +```yml +a: 1 +b: 233 +c: 666 +d: lalalalalal +``` +对于一个`ConfigurationSection`对象, 其代表着一个完整配置数据的某个片段, 你不能直接利用诸如`saveConfig`的方式保存这个片段到另外一个yml文件里. + +## 利用getKeys方法实现遍历 +在上面我们得到了`ConfigurationSection`对象, 这代表着config对象`demo_list`键部分的片段. +现在问题转化成了, 如何获取到`ConfigurationSection`对象里的所有键. +可以利用`getKeys(false)`的方式达到目的. + +```java +for(String key : cs.getKeys(false)) { + System.out.println(key + " = " + cs.get(key)); +} +``` +上面的代码将输出: +``` +a = 1 +b = 233 +c = 666 +d = lalalalalal +``` +这样就实现了遍历. + +`getKeys`方法不只是`ConfigurationSection`拥有, 根据其继承关系, 我们可以推知对`FileConfiguration`类也拥有`getKeys`方法, 同理, `ConfigurationSection`类也有`getConfigurationSection`方法. + +但是我们刚才为什么要给`getKeys`的一个`false`的参数呢? 请看下面的yaml数据: +```yml +test: + a: + b: 1 + c: 2 +d: 1 +``` +我们得到了这个配置文件的`FileConfiguration`对象`config`, 现在对其用`getKeys(false)`进行遍历, 得到所有键. +```java +for(String key : config.getKeys(false)) { + System.out.println(key); +} +System.out.println("==================="); +for(String key : config.getKeys(true)) { + System.out.println(key); +} +``` +输出结果如下: +``` +test +d +=================== +test +test.a +test.a.b +test.c +d +``` +由此可知, `getKeys(false)`只能获取“一层的键”, 不能递归获取配置文件里所有的键. 而`getKeys(true)`会递归获取配置文件里所有出现的键. diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/5-多线程与多任务.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/5-多线程与多任务.md new file mode 100644 index 0000000..0fb8ec9 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/5-多线程与多任务.md @@ -0,0 +1,155 @@ +--- +front: +hard: 困难 +time: 40分钟 +--- + +# Bukkit 的多线程多任务框架 + +# 前言 +本节前半部分内容基本是对Javadoc的复述, 以及使用它们的注意事项. 如果此前您已经使用过了此包, 或者您有良好的文档阅读及应用能力, 建议您先阅读“注意事项”和“小技巧”一栏, 这才是本节教程更重要的知识! + +# org.bukkit.scheduler 包结构 +Bukkit 的多线程多任务框架放在了此包, 此包只含有三个接口(`BukkitSheduler`, `BukkitTask`, `BukkitWorker`)和一个抽象类(`BukkitRunnable`,实现了java.lang.Runnable). 相关实现在实现了 Bukkit API 的底层服务器代码中(比如CraftBukkit). +他们之间的关系大致是这样的: `BukkitSheduler` 负责调度/创建任务,并管理他们(类似于线程池). `BukkitTask` 负责存储由 `BukkitSheduler` 调度的单个任务, 并提供获取它们的任务 id 以及取消它们的一系列方法. `BukkitWorker` 是处理对应异步任务的worker线程. `BukkitRunnable` 基本上是对 BukkitScheduler 的包装, 使用它比使用 BukkitScheduler 相对来说更简洁些. + +# 访问 org.bukkit.scheduler 的两个入口 +一是使用`org.bukkit.Bukkit.getScheduler()`或`org.bukkit.Bukkit.getServer().getScheduler()`获取`BukkitScheduler`实例. +例子: +```java +Bukkit.getScheduler().runTask(this, new Runnable() { + @Override + public void run() { + // 逻辑代码 + } +}); +``` +另一个是构造一个继承`org.bukkit.scheduler.BukkitRunnable`的匿名内部类, 就像这样: +```java +new BukkitRunnable() { + @Override + public void run() { + // 您的代码逻辑 + } +}.runxxx(); +``` +然后再调用 BukkitRunnable 里的各种方法(事实上最终它还是要访问`BukkitScheduler`, 因此两种方法是等效的). 您也可以直接在Runnable内调用BukkitRunnable的方法, 实现自我取消, 等等. 使用BukkitRunnable的优点在于它简单便捷. + +# 如何使用 +在这里只介绍Bukkit 任务调度API的核心 ———— BukkitScheduler 的使用方法, 并且不对那些已过时的方法做解释说明(通常情况下你不应该使用它们). +值得注意的是, Bukkit 的调度任务系统是以 Minecraft 的游戏刻为时间单位的, 其中一个游戏刻(又叫做tick, 下文都使用`tick`指代游戏刻)对应现实世界的50ms(也就是说, 理想情况下20 ticks是一秒). 但实际上受服务器性能因素的影响, 不一定每一tick都精确地经过了50ms (服务器每秒经过的ticks数可以使用命令`tps`查询). 所以在您编写Bukkit 插件时, 请把你置身于 Minecraft 的世界里:) +如果没有特别说明, Bukkit所提供的调度任务的方法, 时间均以tick为单位. 方法全名规则是前者为方法返回值, 后者为方法名和相关参数. + +## 调度同步任务 +### BukkitTask runTask(Plugin plugin, java.lang.Runnable task) +这是调度**同步任务**的主要方法, 另一个方法`runTaskLater`提供了一个`delay`延迟参数, 用于指定调度任务多久后才开始执行. 不指定`delay`的情况下, delay值为1. +### BukkitTask runTaskTimer(Plugin plugin, java.lang.Runnable task, long delay, long period) +这是调度重复任务的方法, 所得的任务是**同步**的, `period`最低值为1,您不能将其设为比1低的值 (若设为0则等效于1, 小于0表示该任务不是重复的). +由于是同步任务, 您在Runnable的run()方法中的代码, 是运行于服务器主线程的, 所以请仔细评估这些代码的效率, 因为这可能会影响服务器的性能(尤其是TPS指标), 从而降低服务器流畅度. 如果不与 Minecraft 有关, 请放在下面要介绍的异步任务. + +## 调度异步任务 +### BukkitTask runTaskAsynchronously(Plugin plugin, java.lang.Runnable task) +这是调度**异步任务**的主要方法, 另一个方法`runTaskLaterAsynchronously`提供一个`delay`延迟参数. +### BukkitTask runTaskTimerAsynchronously(Plugin plugin, java.lang.Runnable task, long delay, long period) +这是调度重复任务的方法, 所得的任务是**异步**的. 通常我们使用异步任务来处理非Minecraft的逻辑,比如数据库的CRUD(增删改查)操作. +在异步任务中, 需要特别注意线程安全问题, 比如您不能随意调用 Bukkit API. 这个问题会稍后予以详细的解释说明. + +# 注意事项 +## 线程安全 +Bukkit API文档清楚地告诉我们异步任务中不应访问某些Bukkit API, 需要着重考虑线程安全. 大多数 Bukkit API 不是线程安全的. +什么是线程安全呢? +> 在拥有共享数据的多条线程并行执行的程序中,线程安全的代码会通过同步机制保证各个线程都可以正常且正确的执行,不会出现数据污染等意外情况。 +> “引自百度百科” + +大多数集合不是线程安全的, 比如经常使用的`HashMap`、`ArrayList`. 同样适用于非线程安全的对象. +限于篇幅, 这里不作深入探讨. 想要了解更多, 请询问您的书籍与搜索引擎. +Bukkit 中的线程安全? +Minecraft 中几乎所有的游戏逻辑都运行于主线程中, 而插件的大多数逻辑也是运行于主线程中的, 这包括插件命令的执行、(同步)事件的处理等等. +如果我们调度了一个异步任务, 或者处于异步事件中, 那么就不应当访问与Minecraft游戏内容有关的API(比如操作方块、加载区块、踢出玩家等). 尝试这么做极有可能得到异常, 使得插件崩溃. + +## 如何在异步任务中调度同步任务, 以访问 Bukkit 的非线程安全的方法? +一种就是`BukkitScheduler.runTask` (方法不带`asynchronously`字眼). 这返回的永远是同步任务, 可以大胆访问 Bukkit API, 就像这样: +```java +Bukkit.getScheduler().runTaskAsynchronously(this, () -> { + // 从数据库拉取些数据 + // 执行同步任务 + Bukkit.getScheduler().runTask(ExamplePlugin.instance, () -> player.sendMessage("你好, 世界!")); +}); +``` +另一种就是`BukkitScheduler.callSyncMethod`, 这个会在之后的小技巧一栏作介绍. +## Bukkit API中哪些操作是非线程安全的, 哪些又是线程安全的? +> 不完整列表. 仅供参考. 不保证线程安全的方法的行为将来会变化. 不对版本差异导致的行为不同作担保. + +线程安全的有: +1. scheduler包自身. +2. Player#sendMessage() +> 你可以发现大量插件在AsyncPlayerChatEvent事件中调用player.sendMessage(). 因此我们有理由确信这是线程安全的. +3. PluginManager#callEvent(event) +> 用于触发事件的方法. 在`SimplePluginManager`中, 该方法使用了synchronized关键字对其实例加锁, 因此是线程安全的. 更多细节请阅读源代码. +4. 发包 - sendPacket +> 为何Player#sendMessage()是线程安全的就是因为它. 我们可以深入craftbukkit乃至nms(net.minecraft.server), sendPacket不过是将数据包传入netty管道, 让netty处理. 如果某个方法仅仅执行了发包流程而没有实际从游戏里加载数据, 那么一般可视其为线程安全的. 因此利用`World#spawnParticle`发送粒子效果以及`World#playEffect`向玩家发送特效、`Player#sendTitle`向玩家发title等也是线程安全的. 我们可以把相关数学运算放到异步线程中, 算完再切换线程发粒子特效. + +非线程安全的有: +1. 设置/获取方块、加载/生成区块 +2. 操作实体 +3. 权限检查(是的. 某些情况下这是非线程安全的, 因为插件一同共享权限列表) + +## 关闭插件时, 确保取消你调度的所有任务 +最简单的方法就是在插件主类的`onDisable`方法写上这一行代码: +```java +Bukkit.getScheduler().cancelTasks(plugin); +``` +其中plugin是你的插件实例, 通常是`this`. +如果不这么做,那么你的插件被关闭之后, 残存的任务(一般是重复任务)仍在运行, 任务会调用相关变量, 而你在关闭插件时如果清理了那些变量, 将会导致一些无法预料的问题. + +# 小技巧 +## 使用 lambda 表达式替换匿名内部类 +自Java 8开始提供对 lambda 表达式的支持. 匿名内部类转 lambda 表达式可使代码看上去更加简洁漂亮. 比如 +```java +scheduler.runTask(this, new Runnable() { + @Override + public void run() { + System.out.println("这是从在任务中输出的一句话."); + } +}); +``` +可以替换成: +```java +scheduler.runTask(this, () -> System.out.println("这是从在任务中输出的一句话.")); +``` +是不是觉得匿名内部类多不优雅, 而 lambda 表达式一行就解决了所有问题? 尽早对丑陋的匿名内部类说byebye吧~ + +## 使用 BukkitScheduler 提供的`callSyncMethod`方法 +> 其实这不应出现在这里的. 不过使用这种方法有点门槛, 如果没有学过相关概念, 你可能不知道从何下手. 该方法涉及到了 Java 的 Future 和 Callable 概念. 如果不知道是什么, 可以搜索来查找资料. 相对于线程安全, Future 和 Callable 概念理解起来容易多了. + +这也是使你的代码置于服务器主线程执行的方法之一, 通常用于需要在主线程执行操作获取数据并返回给异步线程的场景. +下面是鄙人对这些概念的粗略理解: +> 常规的Runnable的run方法是没有返回值的, 它是一个void方法. 这时我们需要使用`Callable`, `Callable`的call方法是有返回值的, 值类型受泛型影响. 使用Runnable还有一个缺点:我(Boss)命令手下一位职员做点任务. 命令完后(开线程, 使用Runnable), 我需要等待职员做完任务的一些反馈, 没有职员提供的数据不能继续工作. 然后在职员执行完任务之前我能干嘛? 没办法, 只能等, 无论职员会执行多久. 有没有办法, 在职员执行任务的过程中, 我还可以做点别的事情呢? + +Java提供了Future这个模式. 于是上面的情况变成了这样: +> 我命令手下一位职员做点任务. 命令完后(开线程, task为FutureTask), 我可以做些别的事情了, 比如与某某打情骂俏...... 之后我可以询问那位职员事情做完没有(Future#isDone()), 或者直接问他结果(Future#get()), 这个取值过程是阻塞的, 直到那位职员完成任务后才能报告结果. 如果我等不耐烦了我还可以使他停下来, 不做了(Future#cancel(boolean)). ~~甚至看不顺眼解雇他~~ 等待职员完成任务的同时, 又多了一份愉悦, 何乐而不为呢~ + +这里就不作更多介绍了. 欲了解更多内容和用法可以参考[Javadoc](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Future.html) 以及询问搜索引擎. + +直接上食用方法吧! 这是一个使用主线程获取当前在线玩家数量并返回的例子: +```java +Future future = Bukkit.getScheduler().callSyncMethod(ExamplePlugin.instance, () -> { + // call方法是可以抛出异常的 + // 假设这个操作有些耗时...这是对主线程的sleep(事实上这最好不要超过50ms) + Thread.sleep(1000); + return Bukkit.getOnlinePlayers().size(); +}); +try { + // 比如这里是数据库操作过程, 假设连接数据库并进行操作耗时1s, 这时我们应该可以拿到在线玩家数了 + // 如果操作过程小于1s更好, 只要等上面的方法执行完即可 + // future.get()是阻塞的, 直到执行完毕 + int players = future.get(); + // 向数据库写入数据 + System.out.println("玩家数:" + players); +} catch (InterruptedException | ExecutionException e) { + // 异常处理 +} +``` +这段代码是在异步任务中运行的. + +食用方法可以说是较复杂了, 如果你没有获取数据的需要, 仅仅需要在主线程内运行特定代码, 使用`BukkitScheduler#runTask()`更好. 没有必要为了 bigger 而 bigger, 唯有**simple**得人心. diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/6-自定义合成表.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/6-自定义合成表.md new file mode 100644 index 0000000..7dbec1f --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/6-自定义合成表.md @@ -0,0 +1,121 @@ +--- +front: +hard: 进阶 +time: 20分钟 +--- + +# 自定义合成表 + +在背包、工作台中, 玩家可以通过指定的物品摆放, 消耗所摆放的物品得到新物品, 这被称作物品的合成. 物品的摆放方式与得到的新物品即为合成表. + +## 合成表物品摆放的文字表述法 + +如何用文字表述物品在2X2格子或3X3格子中的摆放方式? + +首先我们来使用数学中“方程”的概念, 把金锭设成x, 把铁锭设成y. 打个比方, 我现在想实现八个金锭和一个铁锭合成一个绿宝石, 摆放方式可以这样表示: + +``` +xxx +xyx +xxx +``` + +那现在如果想表示类似“工作台”的合成方式呢? 工作台合成需要四个木板, 在背包的合成区内可以填满木板来合成, 在工作台合成区内可以有这样的摆放方式: + +``` +设x为木板 +xx空 +xx空 +空空空 + +空xx +空xx +空空空 + +空空空 +xx空 +xx空 + +空空空 +空xx +空xx +``` +对于这样的非3X3的合成方式, 我们可以这样表示: + +``` +xx +xx +``` + +这也意味着, 在用文字表述合成表时, 不一定非得是3x3的表示方式, 还可以2x2, 还可以1x1, 只要是mXn的格式即可(例如门的合成是2X3). + +## 新建合成规则 + +以上文合成金铁锭合成绿宝石为例, 在onEnable方法的适当位置添加如下内容: + +```java +ShapedRecipe sr1 = new ShapedRecipe( +new ItemStack(Material.EMERALD)) //合成出的物品(提示: 修改这个ItemStack的Amount可以控制能合成多少个目标物品) +.shape("xxx","xyx","xxx") //这是刚才我们摆出来的文字表述 +.setIngredient('x',Material.GOLD_INGOT). //设x为金锭 +setIngredient('y',Material.IRON_INGOT); //设y为铁锭 + +getServer().addRecipe(sr1); +``` + +在onDisable方法中添加如下内容: + +```java +getServer().clearRecipes(); +``` + +经验证可发现, 现在我们可以通过控制台通过在铁锭周围围一圈金锭的方式合成绿宝石了. + +那么设x为金锭, 我想实现像熔炉那样, 八个金锭围一圈合成一个绿宝石, 不需要铁锭了. 就像这样: + +``` +xxx +x空x +xxx +``` + +中间有个位置是空的, 该怎么办? 应该设个y表示AIR吗? 不需要, 空位置可以使用空格表示. 就像下面这个例子: + +```java +ShapedRecipe sr2 = new ShapedRecipe( +new ItemStack(Material.EMERALD)) //合成出的物品 +.shape("xxx","x x","xxx") //这是刚才我们摆出来的文字表述(中间的y改成了空格) +.setIngredient('x',Material.GOLD_INGOT). //设x为金锭 +setIngredient('y',Material.IRON_INGOT); //设y为铁锭 + +getServer().addRecipe(sr2); +``` + +shape方法的参数个数不限制, 这也意味着你可以这样表述非3X3摆放方式: + +```java +.shape("x") //1X1(就像按钮那样的摆放方式) +.shape("xx","xx","xx") //2X3(就像木门那样的摆放方式) +.shape("xx","xx") //2X2(就像合成台那样的摆放方式) +``` + +如果你这样设置 + +```java +.shape("xx ","xx "," ") +``` + +那玩家在游戏中只能这样在合成台合成: +``` +xx空 +xx空 +空空空 +``` + +而不能用其他等效的位置摆放合成, 比如这样: + +``` +空空空 +xx空 +xx空 +``` diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/7-粒子效果与音效播放.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/7-粒子效果与音效播放.md new file mode 100644 index 0000000..77ec107 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/7-粒子效果与音效播放.md @@ -0,0 +1,85 @@ +--- +front: +hard: 进阶 +time: 20分钟 +--- + +# 粒子效果及音效播放 + +## 粒子效果 + +客户端正常配置时,若对草方块上使用骨粉,草方块上会长出草丛,同时还会生成绿色的颗粒动画. 这样的动画效果就是Minecraft中的粒子效果. + +### 播放粒子效果 +如果想在某一个`Location`对象所对应的位置播放粒子效果,对于不同的Minecraft版本有不同的方案: + +#### PlayEffect +可以利用World类的`PlayEffect`方法: +*对于Effect,BukkitAPI在后续的更改中,其中的枚举几乎都或多或少有些许改动。开发时应小心。* + +```java +Location loc = 某一Location对象; +loc.getWorld.playEffect(loc, Effect.HAPPY_VILLAGER, 1); //播放的是绿色的闪光星星⭐效果 +``` + +`PlayEffect`方法在较早的BukkitAPI版本中即被加入. 在使用这一方法时需要与`Effect`打交道. +`Effect`是效果枚举. 值得注意的是,这其中既包含动效(Effect.Type.VISUAL),也包含声效(Effect.Type.SOUND). + +***作为一个老旧的API,在实际开发当中,这一方法并不常用. 其中的常见枚举(例如这里使用的HAPPY_VILLAGER)在新的API中被标记废除.*** + +#### spawnParticle +在新版的API中加入了`spawnParticle`方法. 目前开发插件常用这一方法来播放粒子效果. + +新版的BukkitAPI有意将`Sound`与`Visual`这两个概念分隔开,对于粒子效果,在使用`spawnParticle`方法时,取`Effect`而代之的是`Particle`枚举. + +*spawnParticle的用法较多,在此略去大篇幅对各个方法与参数的介绍,可以查阅JavaDoc,其中有十分简单易懂的注释.* +*BukkitAPI后续更新中,枚举或多或少都有变动,应当注意!* + +### 播放所需的形状 + +> 开发实例: 在玩家脚底播放一圈半径为1的粒子效果 + +**分析** +1. 几何角度考虑 + +以玩家脚底处为原点,建立平面直角坐标系. 如下图所示: +![](../images/0_8.jpg) + +*绿色部分为粒子效果* + +由圆的定义知,所绘制的粒子为到原点的点集. + +2. 实现 +播放想要的形状就是逐次的在所需播放的坐标处播放粒子效果. + +*这里将不解释什么是弧度制,而是做强制要求,只要算角度都必须用这样的方法变为弧度制,有兴趣可以在网上查阅* + +```java +Location loc = p.getLocation().clone(); +for(int t=0;t<360;t++){ //这里的t表示旋转角,从0到360度遍历一遍就是转了一圈 + double r = Math.toRadians(t); //角度制变弧度制 + //在这里,我们使用三角函数依次计算出了对应点的坐标. + //建议作图体会这样计算的原理. + double x = Math.cos(r); + double y = Math.sin(r); + //在刚开始时,loc是坐标系原点(也就是玩家所在的位置) + //这里我们的add将其变为了我们想要播放粒子的坐标位置 + //后面我们又subtract(减)将其又变为了坐标原点 + loc.add(x,0,y); + loc.getWorld().spawnParticle(Particle.VILLAGER_HAPPY,loc,1,null); + loc.subtract(x, 0, y); +} +``` + +这样我们就完成了这一效果. + +依此,可以大致概括出实现粒子效果的基本步骤: +1. 分析: 从数学角度分析, 思考怎么才能获得所需形状中所有的点;从代码角度分析,思考怎样才能依此获得这些点的坐标值 +2. 实现:利用恰当的方法播放粒子效果 + +## 音效播放 +由于`Effect`既包含动效,也包含声效,这意味着使用与上面`PlayerEffect`方法一样的方法,我们也可以播放音效. + +在新API中提供了`playSound`方法并且加入了`Sound`枚举. 目前常用这一方法. 这一方法是World也同样是Player类的方法, 具体使用哪一方法,取决于你希望对谁播放. + +*BukkitAPI后续更新中,枚举或多或少都有变动,应当注意!* diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/8-世界生成器.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/8-世界生成器.md new file mode 100644 index 0000000..876eaa1 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/8-世界生成器.md @@ -0,0 +1,126 @@ +--- +front: +hard: 进阶 +time: 20分钟 +--- + +# 世界生成器 +> +> *在Bukkit中, 截止到目前, BukkitAPI仍沿用旧有规则的API.* +> *这意味着本文内容截止目前对于新版本的插件开发仍然有效.* + +本文中使用了`Material.GRASS_BLOCK`, 这是1.13版本的新用法. +在旧版API中, 应该使用`Material.GRASS`. + +## 简述世界生成 + +Minecraft中, 一个世界(World)按照一定的大小被分为多个区块(Chunk). +MC会自动地按照一定的规则卸载无人Chunk, 在需要的时候加载所需的Chunk到内存, 以此来保证一个World被加载到内存, 这样不至于整个World都需要加载到内存以备调用. +世界的生成同样以Chunk为单位. + +Minecraft游戏中, 世界生成分为两个阶段, 分别为 Generation 与 Population. + +Minecraft生成一个World, 首先进入 Generation 阶段. 这一阶段主要是绘制地形等. +1. Minecraft首先会获取该Chunk中包含的所有生物群系. 然后会根据特定的生物群系绘制基本的地形. 地形的绘制依靠了一些特殊的算法, 游戏通常会以高度63作为水平面, 通过这些特殊算法绘制基本的地形. 绘制完毕后, 整个世界只有空气、水和石头. +2. 接着会在高度0-5范围内生成基岩, 并逐个对各个生物群系添加特有的方块. 例如, 对平原添加草方块和泥土, 对沙漠添加沙子和沙石等. +3. 再然后会生成特殊地形. 这里的特殊地形指的是涉及到多个区块的大型地形, 例如规模很大的洞穴、村庄、矿井等. +4. 最后会进一步处理, 做最后的准备收尾工作, 至此Generation阶段完毕. + +Generation阶段完成, 意味着该世界的整体结构已经定型. 但是这个世界上还缺少“点缀”. 这个世界上仍然没有树、生物、沼泽上的荷叶、水边的甘蔗等. 此时进入 Population 阶段. +1. 首先会对该世界的实体进行完善, 并生成各种各样的特殊的方块(指的是箱子等方块实体, 这些方块与其它方块相比复杂许多). +2. 然后会生成小型地形. 比如一些地表小水坑、地表岩浆池、地下地牢等. +3. 然后会在地下按照一定的规则生成矿物. +4. 最后增加地面点缀, 生成水边的甘蔗、沼泽上的荷叶、地面大蘑菇和树木等物, 并增加一些生物群系特定物, 生成一些基础生物(比如牛、鸡、羊等). + +待 Population 阶段结束后, 该Chunk的数据便会存储起来, 显示出来. + +## 干涉Population + +Bukkit中, 在世界初始化前会触发`WorldInitEvent`事件. 监听该事件, 我们可以对该世界生成的 Population 阶段进行干涉. + +在下面的案例中, 我们将在Chunk的 Population 阶段, 在世界的草方块上人为的添加许多钻石块(DIAMOND_BLOCK). + +```java +public class WorldListener implements Listener { + @EventHandler + public void onWorldInit(WorldInitEvent e){ + if(e.getWorld().getName().equals("World")) + e.getWorld().getPopulators().add(new RuaPopulator()); + } +} + +class RuaPopulator extends BlockPopulator { + @Override + public void populate(World w, Random r, Chunk c){ + final int maxn = 16; //一个区块的X或Y范围是0-16 + for(int i=0; i<12; i++){ //这里打算一个区块生成12个 + int x = r.nextInt(maxn), z = r.nextInt(maxn); + for (int y = 125; y > 0; y--) { + if (c.getBlock(x, y, z).getType() == Material.GRASS_BLOCK && c.getBlock(x, y + 1, z).getType() == Material.AIR) { + c.getBlock(x, y + 1, z).setType(Material.DIAMOND_BLOCK); + break; + } + } + } + } +} + +``` + +最终效果如下: + +![](../images/0_9.jpg) + +可以发现, 生成的world中, 按照我们的设定, 在地表草方块上零散的分布了钻石块. +这说明在Bukkit中, 你可以创建一个BlockPopulator对象, 在世界初始化时添加为某一World的Populator, 依此来干涉Population阶段. +*Bukkit中的Populator只有BlockPopulator一种.* +*但是你可以以此类推, 通过这种方式实现在地面随机生成某种建筑等其他效果.* + +值得注意的是, 在自定义的Populator中, populate方法的参数中有一个传入的Random对象. +这是为了让随机数的生成符合World对应的种子. 在需要生成随机数的时候, 应尽可能使用方法参数中的Random对象. + +## 控制Generation + +通过控制一个世界的Generation, 我们可以控制世界的大体地形. +下面我们将在插件加载时, 生成一个新的世界`RuaWorld`, 这个世界是一个超平坦世界, 第一第二层为基岩, 第三层为草方块. + +```java +public class Main extends JavaPlugin { + public void onEnable(){ + Bukkit.getPluginManager().registerEvents(new WorldListener(),this); + Bukkit.createWorld(new WorldCreator("RuaWorld").generator(new RuaChunkGenerator())); + } + + public void onDisable(){ + // + } +} + +class RuaChunkGenerator extends ChunkGenerator { + @Override + public ChunkData generateChunkData(World w, Random r, int x, int z, BiomeGrid b) { + ChunkData chunkData = createChunkData(w); //创建区块数据 + + //下面这行方法调用参数中, 前三个参数代表一个XYZ对, 后面又是一个XYZ对. + //这两个XYZ对是选区的意思, 你可以结合Residence插件圈地、WorldEdit选区的思路思考. + //提醒: 一个Chunk的X、Z取值是0-16, Y取值是0-255. + chunkData.setRegion(0, 0, 0, 16, 2, 16, Material.BEDROCK); //填充基岩 + chunkData.setRegion(0, 2, 0, 16, 3, 16, Material.GRASS_BLOCK); //填充草方块 + + //将整个区块都设置为平原生物群系(PLAINS) + for (int i = 0; i < 16; i++) { + for (int j = 0; j < 16; j++) { + b.setBiome(i, j, Biome.PLAINS); + } + } + return chunkData; + } +} +``` + +![](../images/0_10.jpg) + +![](../images/0_11.jpg) + +我们进入`RuaWorld`世界, 可以发现世界按照我们所需要的地形生成了. + diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/9-Title与ActionBar的显示.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/9-Title与ActionBar的显示.md new file mode 100644 index 0000000..8e615f7 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/3-进阶内容/9-Title与ActionBar的显示.md @@ -0,0 +1,15 @@ +--- +front: +hard: 进阶 +time: 3分钟 +--- + +# Title与ActionBar的显示 +> +> *主观上,在1.12.2后我们发送ActionBar和Title.* +> *Title只需要通过Player中的sendTitle方法.* +> *而ActionBar发送方式则是 Player 对象封装了内部对象 spigot(),其中里面则有静态方法 sendMessage 通过传入ChatMessageType枚举参数,便可以发送ActionBar* +> *用Spigot的sendMessage得将内容转换成TextComponent* + +但是Bukkit就没有能够直接发送ActionBar的发送方法. +所以我们就要通过NMS底层去自行封装一个方法. diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/4-底层内容/1-认识NMS与OBC.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/4-底层内容/1-认识NMS与OBC.md new file mode 100644 index 0000000..0b93179 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/4-底层内容/1-认识NMS与OBC.md @@ -0,0 +1,146 @@ +--- +front: +hard: 高级 +time: 20分钟 +--- + +# 认识 NMS 和 OBC + +nms,即 Java 包 `net.minecraft.server`,存放的是 Minecraft 服务端游戏逻辑代码,这篇教程将会采用 `Spigot` 作为 Bukkit API(就你们日常开发用的API) 体系的例子(CraftBukkit 也是 SpigotMC 维护,且基本所有 Bukkit 分支都是基于 Spigot 开发) + +BukkitAPI 真的涵盖了不少东西,但是 BukkitAPI 并不是十全十美的,有时候我们确实需要使用 NMS。 +~~Forge其实也有个net.minecraft.server,但他和Spigot的没半点关系~~ +## 使用 NMS 之前 + +md_5:*Wait!* 你真的需要使用 NMS 吗? +> NMS不是API。当你遇到什么想做的事情的时候,你不应该第一时间去考虑 NMS 或者 发包 +令人费解的是,我们几乎每天都看到人们专门使用 NMS 做一些简单的事情,如 ScoreBoard、BossBar 或粒子。但是实际上,自从Mojang添加了这些东西之后,Spigot/Bukkit-API 早就有这些功能了。 + +每当你考虑使用 NMS 时,请思考以下问题: + 1. 我是否需要NMS来做这个? + 2. 是否有一个API来实现这个功能? + 3. 我可以为这个贡献/创建/ ***提议*** 一个API吗? + + +对NMS的滥用造成的后果非常严重。 + - 1. 插件将失去版本迁移的能力(针对单个版本而言) + - 2. 阻碍了 API 的发展并且树立了一个坏榜样。 + +如果你确实想清楚确实没有现有的 API 能帮到你,那么来... + +# 怎么使用 NMS +NMS 里的内容太多,故本教程**不会**教授NMS有什么东西,但是可以教你怎么玩。 + +## 开发环境准备 +由于DMCA的原因,Bukkit不会直接提供NMS,您需要将构建好的服务端代码引入项目中 + +如果没有且你正在使用 `Gradle` , `Maven` 这样的依赖管理器,考虑如下方法(图文): + +这边以Gradle为例 +1. 在项目根目录创建libs文件夹用于放第三方库 +![](../images/0_12.png) +2. 将构建好的服务端直接拖入libs文件夹中 +![](../images/0_13.png) +3. 配置Gradle +![](../images/0_14.png) +4. 同步Gradle配置 +![](../images/0_15.png) +5. 你已经成功引入NMS + +## 获取到一个来自 API 背后的对象 +*当你从控制台直接输出一个 `Player` 对象时,会发生什么?* + +你会得到一个 `CraftPlayer{name=玩家名}`而不是NMS里面的`EntityPlayer`。这是因为在Bukkit-API背后还有一层,他叫`OBC`,也就是`org.bukkit.craftbukkit`。 + +OBC 是 Bukkit API 的实现,其本质是NMS的封装,因此我们并不需要太关心它。 + +最简单的一个说法就是,实际上我们操作NMS封装API也是OBC所做的事情。 + +就上文问题,怎么拿到一个 NMS 里面的 `EntityPlayer`? + +首先我们需要使用反编译工具,当然了,你也可以通过IDEA直接查看。 + +来看 `CraftPlayer` 对 `EntityPlayer` 做了什么.. + +![](../images/0_16.png) +CraftPlayer 将 EntityPlayer 传给了他的父类构造器,我们接着追踪.. +![](../images/0_17.png) +而 CraftPlayer 的父类 CraftHumanEntity 依然将 EntityPlayer 传入父类 CraftLivingEntity,我们继续翻阅到 CraftLivingEntity 中 +![](../images/0_18.png) +经过一条不 是 很 长的继承链后,我们找到了 `CraftEntity`,看来 `EntityPlayer` 最后是被传道这里了! +> 注意:OBC里面的类 `implements` 的都是BukkitAPI的实现,不要搞混了! + +然后往上翻,看看 entity 是什么情况。 +![](../images/0_19.png) +他的修饰符是 `protected`,这意味着只有继承树内或者同一个包里面才能访问到它,而这在NMS/OBC中是常有的事情。 + +## 反射! +我们很容易就可以写出这样的代码来获取到这个 entity 对象。 + +而这就需要用到Java的特性 —— 反射 +```java +public static final String serverVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; +try{ + Player player = ....; // Who cares ? + Class clazz = Class.forName("org.bukkit.craftbukkit."+serverVersion+".entity.CraftEntity"); + Field f = clazz.getDeclaredField("entity"); + f.setAccessible(true); + Object result = f.get(player); +}catch(Throwable t){ + t.printStackTrace(); +} +``` +现在 `result` 里面存的就是我们需要的 EntityPlayer,然后我们可以转换它...做点事情。 +为什么要这么麻烦?其实下面的代码一样可以做到这个效果: +```java +try{ + Player player = ....; // Who cares ? + Field f = CraftEntity.class.getDeclaredField("entity"); + f.setAccessible(true); + Object result = f.get(player); +}catch(Throwable t){ + t.printStackTrace(); +} +``` + +假设BukkitAPI没有封装修改经验值的方法,我们要修改玩家实体的经验值 + +就可以通过刚刚获取到的result的变量判断是否为 NMS 的 EntityPlayer 对象 +```java +try{ + Player player = event.getPlayer(); + getLogger().info("test"); + Class clazz = Class.forName("org.bukkit.craftbukkit."+serverVersion+".entity.CraftEntity"); + Field f = clazz.getDeclaredField("entity"); + f.setAccessible(true); + Object result = f.get(player); + if (result instanceof EntityPlayer){ + ((EntityPlayer) result).d(1000); + } +}catch(Throwable t){ + t.printStackTrace(); +} +``` + +> 那为什么result的方法是 `d`? +> 这是因为 Minecraft源码本身就是混淆的,OBC则是Bukkit反编译探索出来这个大概是什么方法然后进行封装的 +> 所以我们在和OBC做同样的事情时,也要大概去猜测这些方法名是做什么的 +> 大家可以尝试翻阅一下 EntityPlayer 源码,其中成员变量 newExp 被 方法 d() 所修改 +> 所以大概猜测这个就是修改经验值的方法,调用后证实确实是这个方法 + + +## 版本兼容性 + +实际上,如果你直接采用了 `CraftEntity.class` 的方法都会对这个 class 建立符号引用。 +每个版本的 Spigot,无论是 OBC 或者 NMS,他们的包名都会变化——也就是说你的插件会爆炸 +所以,如果你不想为了一个版本再把逻辑写一次,最好还是用反射的写法。对于公开的方法,也可以使用更高效的 `MethodHandle`。 + +如果你有注意到的话, md_5 说过 `NMS 并不是`一个API(其实也包括OBC)。 +什么意思呢?也就是`使用NMS没有任何安全性保障`,**你反射的字段/方法或许下一个版本就会被删改。** +实例惨案: Minecraft 1.17 Spigot大改,使用 Mojang 官方混淆表,以往 NMS 插件**全都**报废。(除了一些自带兼容的服务端) + +# 本章小结 +- NMS是`net.minecraft.server`,一个包名,放MC逻辑 +- Spigot的NMS没有安全保障,md_5 都不推荐用 +- 使用NMS之前要先找是否已经有了对应的 API +- 在 Bukkit-API 和 NMS 之间还有一个实现,它叫 OBC。 \ No newline at end of file diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/4-底层内容/2-自定义发包.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/4-底层内容/2-自定义发包.md new file mode 100644 index 0000000..decf265 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/4-底层内容/2-自定义发包.md @@ -0,0 +1,106 @@ +--- +front: +hard: 高级 +time: 30分钟 +--- + +# 自定义发包 + +## 数据包介绍 + +翻阅NMS我们可以知道的是,服务端的数据变更一般都是通过 DataWatcher 来判断以后通过 + +数据包的方式发送到客户端,客户端接收到数据包后对玩家客户端内容从而进行更改 + +这就是为什么上一个教程中,我们更改玩家的经验时不能直接通过赋值的方式进行更改 + +而是通过内置的一个“神秘(混淆了)”封装的方法去更改,这是因为只有通过此方法,才能将参数传参给父类 + +然后在通过父类的方法赋值给 DataWatcher + +而翻阅 DataWatcher 类里的方法我们在一大堆混淆的代码发现了 +```java +public void refresh(EntityPlayer to) { + if (!this.d()) { + List> list = this.packAll(); + if (list != null && to.getBukkitEntity().canSee(this.d.getBukkitEntity())) { + to.c.a(new PacketPlayOutEntityMetadata(this.d.af(), list)); + } + } + +} +``` + +此方法大概率就是发送数据包的方法了. + +此时你会发现,他将 `PacketPlayOutEntityMetadata` 包发了出去 + +那这个包是干嘛的呢? + +我们查阅[我的世界维基百科数据包](https://minecraft.wiki/w/Java_Edition_protocol/Packets?oldid=2772385) + +可以发现其中的EntityMetadata 正好是更新现有生物实体的元数据,而经验值属于玩家实体特有的元数据,所以符合我们上述的说法 + +![](../images/0_20.png) + +## 如何自定义一个数据包并发出去呢 + +说了那么多如何自定义一个数据包发出去呢 + +在这里做一个示例便是 + +在1.8更新,我的世界更新了Title等一系列文字显示的内容,但是Bukkit并没有及时的更新相关的API + +直到1.12.2才更新快速发送Title的方法,所以在1.8 - 1.11 期间,开发者想要发送Title则需要自己通过封装NMS去手动发包 + +我们查阅对应版本的数据包,在这里我拿1.12.2的wiki去演示 [我的世界维基百科数据包](https://minecraft.wiki/w/Java_Edition_protocol/Packets?oldid=2772385) + +找到有关于Title的,可以发现此数据包 + +![](../images/0_21.png) + +我们可以看到基本介绍,他是发送给客户端的,状态是Play,那么在NMS里应该就是 `PacketPlayOutTitle` + +再查看PacketPlayOutTitle类,虽然里面全部混淆了 + +但是对比成员变量与Wiki中Action描述可以不难猜出PacketPlayOutTitle包构造函数里的参数 + +按照顺序每个参数类型都是按照顺序填写的 + +![](../images/0_22.png) + +我们发现有四个构造函数,那我们选择能够自定义程度最高的,也就是参数填入最多的那一个构造函数 + +第一个参数传入 Title 类型 (TITLE、SUBTITLE) + +> 这就代表着我们要同时发2个包。一个是TITLE的数据包,另一个是SUBTITLE的数据包。 + +第二个参数传入 `IChatBaseComponent` ,这个是我的世界的文本基础组件。 + +第三个参数传入 淡入时间 + +第四个参数传入 停留时间 + +第五个参数传入 淡出时间 + +当我们都填写好参数后,可以写出下述代码 +```java +public void sendTitle(Player player, String title, String subtitle, int fadeIn, int stayIn, int fadeOut) { + IChatBaseComponent titlesend = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + title + "\"}"); + IChatBaseComponent subtitlesend = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + subtitle + "\"}"); + PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, titlesend, fadeIn, stayIn, fadeOut); + PacketPlayOutTitle packet2 = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, subtitlesend, fadeIn, stayIn, fadeOut); + (((CraftPlayer)player).getHandle()).playerConnection.sendPacket((Packet)packet); + (((CraftPlayer)player).getHandle()).playerConnection.sendPacket((Packet)packet2); +} +``` + +此时我们即可快速调用自己写的 sendTitle 快速发送一份Title文字 + +但是翻阅各版本NMS可以发现,每一个版本的Packet的参数混淆名、类的位置等都不一样 + +所以这就导致我们通过NMS去发送title,就可能导致版本不互通 + +所以这就需要我们对各版本都有处理,主要就是利用到Java的接口对不同版本都有一定的兼容,这里就不再过多介绍 + +> 由于NMS兼容性确实很差,一般来说开发者在操作Packet的时候都是通过第三方库 ProtocolLib 处理 \ No newline at end of file diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/README.md b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/README.md new file mode 100644 index 0000000..e69de29 diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_1.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_1.png new file mode 100644 index 0000000..aa4a27e Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_1.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_10.jpg b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_10.jpg new file mode 100644 index 0000000..1ebb3e7 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_10.jpg differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_11.jpg b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_11.jpg new file mode 100644 index 0000000..04d37a2 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_11.jpg differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_12.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_12.png new file mode 100644 index 0000000..a46ccf9 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_12.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_13.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_13.png new file mode 100644 index 0000000..fc0fdb3 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_13.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_14.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_14.png new file mode 100644 index 0000000..8d18799 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_14.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_15.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_15.png new file mode 100644 index 0000000..47b0881 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_15.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_16.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_16.png new file mode 100644 index 0000000..2a7e4f8 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_16.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_17.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_17.png new file mode 100644 index 0000000..9b83f72 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_17.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_18.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_18.png new file mode 100644 index 0000000..2162246 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_18.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_19.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_19.png new file mode 100644 index 0000000..368b581 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_19.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_2.jpg b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_2.jpg new file mode 100644 index 0000000..0488498 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_2.jpg differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_20.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_20.png new file mode 100644 index 0000000..21c8e5d Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_20.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_21.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_21.png new file mode 100644 index 0000000..be6dca1 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_21.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_22.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_22.png new file mode 100644 index 0000000..e10fe41 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_22.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_3.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_3.png new file mode 100644 index 0000000..bf759ed Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_3.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_4.jpg b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_4.jpg new file mode 100644 index 0000000..f4876ee Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_4.jpg differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_5.jpg b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_5.jpg new file mode 100644 index 0000000..d4af02f Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_5.jpg differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_6.png b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_6.png new file mode 100644 index 0000000..2027289 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_6.png differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_8.jpg b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_8.jpg new file mode 100644 index 0000000..8ae87e9 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_8.jpg differ diff --git a/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_9.jpg b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_9.jpg new file mode 100644 index 0000000..c55d357 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程3:编写Bukkit插件/images/0_9.jpg differ diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/20-PlaceholderAPI/1-PlaceholderAPI介绍.md b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/20-PlaceholderAPI/1-PlaceholderAPI介绍.md new file mode 100644 index 0000000..02d8b90 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/20-PlaceholderAPI/1-PlaceholderAPI介绍.md @@ -0,0 +1,19 @@ +--- +front: +hard: 入门 +time: 20分钟 +--- + +# PlaceholderAPI介绍 + +PlaceholderAPI 是适用于 Bukkit 及其衍生服务端的插件,它允许服主以固定的格式替换占位符 (俗称变量) 显示各种对接了PlaceholderAPI插件的信息。 + +对于插件的变量支持,通常由插件自己提供,或者安装变量扩展来提供变量。变量扩展可以在游戏内通过 PAPI eCloud 下载安装。现有超过 230 个扩展可下载,可支持非常多的插件,比如 Essentials、Factions、LuckPerms、Vault 等。如果你是开发者,并且希望为你的插件添加 PlaceholderAPI 支持,请参阅 API 使用文档。 + +PlaceholderAPI 已破 170 万下载量,同时使用本插件的服务器数已超过 4.5 万,成为了各规模各类型服务器的必需品。 + +由于此篇文章偏向于如何通过接入PlaceholderAPI来开发自己插件的占位符 + +所以插件的使用方法还需要服主们自行查阅PlaceholderAPI的WIKI [**PlaceholderAPI WIKI**](https://wiki.placeholderapi.com/users/) + + diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/20-PlaceholderAPI/2-接入PlaceholderAPI.md b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/20-PlaceholderAPI/2-接入PlaceholderAPI.md new file mode 100644 index 0000000..b83f689 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/20-PlaceholderAPI/2-接入PlaceholderAPI.md @@ -0,0 +1,196 @@ +--- +front: +hard: 入门 +time: 20分钟 +--- + +# 接入PlaceholderAPI + +本篇教程针对 `PlaceholderAPI 2.10.0` 为蓝本进行教学,版本不一致时可作为参考,然后查阅相关开发API进行调整 + +## 引入库到本地项目 + +在你可以实际使用 `PlaceholderAPI` ,你首先需要将第三方库通过 Gradle 或者 Maven 导入到你的本地项目 +您可以使用下方仓库进行引入 + +### Maven + +```xml + + + placeholderapi + https://repo.extendedclip.com/releases/ + + + + + me.clip + placeholderapi + {version} + provided + + +``` + +### Gradle +```kotlin +repositories { + maven { + url = 'https://repo.extendedclip.com/releases/' + } +} + +dependencies { + compileOnly 'me.clip:placeholderapi:{version}' +} +``` + +> 您可以通过查阅PlaceholderAPI发布页面,查阅需要引入的PlaceholderAPI版本 +> [PlaceholderAPI发行页](https://github.com/PlaceholderAPI/PlaceholderAPI/releases) + + +## 在plugin.yml声明依赖 + +在编写插件前,你还需要在插件的`plugin.yml`中将`PlaceholderAPI` 设置为depend或者softdepend + +具体填写格式可以查阅 Bukkit开发教程/深入plugin.yml + + +## 解析变量 + +`PlaceholderAPI` 提供了自动解析插件内其他插件变量的能力,从而改变了开发路径。 + +以往开发者如果想要获取其他插件的一些变量,通常需要用到反射等特性才能获取到,兼容性无法得到保证,还比较麻烦。 + +但是如果想要获取的插件对接了 PlaceholderAPI 并有占位符显示的话,开发者可快速解析占位符获得内容。 + +若要在你的插件内使用来自其他插件的变量,使用 setPlaceholders 方法即可。 + +需要注意的是,任何需要插件或依赖的变量拓展必须在服务器上启用,否则变量不会被解析(返回原字符串)。 + +假设我们需要对一个玩家拥有的初级权限组发送一条自定义加入消息。 + +若要这么做,我们可以按如下步骤实现: + + +```java +package at.helpch.placeholderapi; + +import me.clip.placeholderapi.PlaceholderAPI; + +import org.bukkit.Bukkit; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.plugin.java.JavaPlugin; +import me.clip.placeholderapi.PlaceholderAPI; + +public class JoinExample extends JavaPlugin implements Listener { + + @Override + public void onEnable() { + + if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) { + Bukkit.getPluginManager().registerEvents(this, this); + } else { + getLogger().warn("Invaild PlaceholderAPI! 插件已被禁用."); + Bukkit.getPluginManager().disablePlugin(this); + } + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void onJoin(PlayerJoinEvent event) { + String joinText = "%player_name% 加入了服务器! 他的级别是 %vault_rank%"; + + joinText = PlaceholderAPI.setPlaceholders(event.getPlayer(), joinText); + event.setJoinMessage(joinText); + } +} +``` + +## 创建一个新的变量 + +除了解析变量以外,开发者还可以利用到`PlaceholderAPI`创建自己插件的变量 + +你所创建的变量都是 PlaceholderExpansion 的子类,都属于拓展变量 + +新建一个类取名叫 `SomeExpansion.class` + +按照下方格式即可创建一个新变量 + +```java +package at.helpch.placeholderapi.example.expansion; + +import me.clip.placeholderapi.expansion.PlaceholderExpansion; + +public class SomeExpansion extends PlaceholderExpansion { + + @Override + @NotNull + public String getAuthor() { + return "Author"; // + } + + @Override + @NotNull + public String getIdentifier() { + return "example"; // + } + + @Override + @NotNull + public String getVersion() { + return "1.0.0"; // + } + + // 这些方法默认不覆写. + // 你需要覆写其中一个. + // onRequest 是允许离线玩家的变量 + + // onPlaceholderRequest 是允许在线玩家的变量 + + @Override + public String onRequest(OfflinePlayer player, @NotNull String params) { + if (params.equalsIgnoreCase("placeholder1")) { + return "test"; + } + } + + @Override + public String onPlaceholderRequest(Player player, @NotNull String params) { + + // TODO + } +} + + +``` + +### 注册变量拓展 + +创建好的变量还需要注册,否则插件无法识别你注册的变量 + +```java +package at.helpch.placeholderapi.example; + +import at.helpch.placeholderapi.example.expansion.SomeExpansion; +import org.bukkit.Bukkit; +import org.bukkit.plugin.java.JavaPlugin; + +public class SomePlugin extends JavaPlugin { + + @Override + public void onEnable() { + if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) { // 检查 PlaceholderAPI 是否存在并启用,否则就会抛出报错。 + new SomeExpansion(this).register(); 注册变量。 + } + } +} +``` + +现在你已经注册了一个变量了 + +当你存在需要填写变量的地方 写入 `%example_placeholder1%` 就会自动解析成 test 并显示出来 + +更多内容可以查阅官方维基百科[**PlaceholderAPI WIKI**](https://wiki.placeholderapi.com/users/) \ No newline at end of file diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/30-Vault/1-Vault介绍.md b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/30-Vault/1-Vault介绍.md new file mode 100644 index 0000000..a601ca9 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/30-Vault/1-Vault介绍.md @@ -0,0 +1,16 @@ +--- +front: +hard: 入门 +time: 5分钟 +--- + +# Vault介绍 + +`Vault` 插件是一个关于权限、聊天以及经济插件的前置插件,他能让这些插件快速地与 `Vault` 插件挂钩而不需要依赖于其他个别插件。 +多数关于注册和权限的前置插件配置过于繁琐且缺乏大部分功能,于是这个插件便诞生了。 +`Vault` 插件可以通过更加直观明了的方式解决这些问题,并为这些插件提供他们可能所需要的支持与依赖服务。 + +> Vault虽然能够通过API管控经济方面的特性,但是他本身不存在任何存储功能 + +[Vault的JavaDocs](https://milkbowl.github.io/VaultAPI/) + diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/30-Vault/2-接入Vault.md b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/30-Vault/2-接入Vault.md new file mode 100644 index 0000000..165736b --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/30-Vault/2-接入Vault.md @@ -0,0 +1,154 @@ +--- +front: +hard: 入门 +time: 10分钟 +--- + +# 接入Vault + +本篇教程针对 `Vault 1.7` 为蓝本进行教学,版本不一致时可作为参考,然后查阅相关开发API进行调整 + +## 引入库到本地项目 + +在你可以实际使用 `Vault` ,你首先需要将第三方库通过 Gradle 或者 Maven 导入到你的本地项目 +您可以使用下方仓库进行引入 + +### Maven + +```xml + + + jitpack.io + https://jitpack.io + + + + + com.github.MilkBowl + VaultAPI + 1.7 + provided + + +``` + +### Gradle +```kotlin +repositories { + maven { + url 'https://jitpack.io' + } +} +dependencies { + compileOnly "com.github.MilkBowl:VaultAPI:1.7" +} +``` + +## 实现 Vault + +通过一个简单的例子,从而快速了解如何获得 经济、权限、聊天 Service + +```java +package com.example.plugin; + +import net.milkbowl.vault.chat.Chat; +import net.milkbowl.vault.economy.Economy; +import net.milkbowl.vault.economy.EconomyResponse; +import net.milkbowl.vault.permission.Permission; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.plugin.RegisteredServiceProvider; +import org.bukkit.plugin.java.JavaPlugin; + +public class ExamplePlugin extends JavaPlugin { + + private static Economy econ = null; + private static Permission perms = null; + private static Chat chat = null; + + @Override + public void onDisable() { + getLogger().info(String.format("[%s] Disabled Version %s", getDescription().getName(), getDescription().getVersion())); + } + + @Override + public void onEnable() { + if (!setupEconomy() ) { + getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName())); + getServer().getPluginManager().disablePlugin(this); + return; + } + setupPermissions(); + setupChat(); + } + + private boolean setupEconomy() { + if (getServer().getPluginManager().getPlugin("Vault") == null) { + return false; + } + RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Economy.class); + if (rsp == null) { + return false; + } + econ = rsp.getProvider(); + return econ != null; + } + + private boolean setupChat() { + RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Chat.class); + chat = rsp.getProvider(); + return chat != null; + } + + private boolean setupPermissions() { + RegisteredServiceProvider rsp = getServer().getServicesManager().getRegistration(Permission.class); + perms = rsp.getProvider(); + return perms != null; + } + + public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) { + if(!(sender instanceof Player)) { + getLogger().info("Only players are supported for this Example Plugin, but you should not do this!!!"); + return true; + } + + Player player = (Player) sender; + + if(command.getLabel().equals("test-economy")) { + // Lets give the player 1.05 currency (note that SOME economic plugins require rounding!) + sender.sendMessage(String.format("You have %s", econ.format(econ.getBalance(player.getName())))); + EconomyResponse r = econ.depositPlayer(player, 1.05); + if(r.transactionSuccess()) { + sender.sendMessage(String.format("You were given %s and now have %s", econ.format(r.amount), econ.format(r.balance))); + } else { + sender.sendMessage(String.format("An error occured: %s", r.errorMessage)); + } + return true; + } else if(command.getLabel().equals("test-permission")) { + // Lets test if user has the node "example.plugin.awesome" to determine if they are awesome or just suck + if(perms.has(player, "example.plugin.awesome")) { + sender.sendMessage("You are awesome!"); + } else { + sender.sendMessage("You suck!"); + } + return true; + } else { + return false; + } + } + + public static Economy getEconomy() { + return econ; + } + + public static Permission getPermissions() { + return perms; + } + + public static Chat getChat() { + return chat; + } +} +``` \ No newline at end of file diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/31-TabooLib/1-署名.md b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/31-TabooLib/1-署名.md new file mode 100644 index 0000000..a601ca9 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/31-TabooLib/1-署名.md @@ -0,0 +1,16 @@ +--- +front: +hard: 入门 +time: 5分钟 +--- + +# Vault介绍 + +`Vault` 插件是一个关于权限、聊天以及经济插件的前置插件,他能让这些插件快速地与 `Vault` 插件挂钩而不需要依赖于其他个别插件。 +多数关于注册和权限的前置插件配置过于繁琐且缺乏大部分功能,于是这个插件便诞生了。 +`Vault` 插件可以通过更加直观明了的方式解决这些问题,并为这些插件提供他们可能所需要的支持与依赖服务。 + +> Vault虽然能够通过API管控经济方面的特性,但是他本身不存在任何存储功能 + +[Vault的JavaDocs](https://milkbowl.github.io/VaultAPI/) + diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/31-TabooLib/2-TabooLib介绍.md b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/31-TabooLib/2-TabooLib介绍.md new file mode 100644 index 0000000..676c5cd --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/31-TabooLib/2-TabooLib介绍.md @@ -0,0 +1,27 @@ +--- +front: +hard: 入门 +time: 10分钟 +--- + + +# 署名 + +## 署名信息 + +本文作者: TabooLib社区. +TabooLib官网: [https://www.tabooproject.org/](https://www.tabooproject.org/). +原文: [https://taboolib.feishu.cn/wiki/Lzf8wFEsfiHclskCuGkctoUNn9b](https://taboolib.feishu.cn/wiki/Lzf8wFEsfiHclskCuGkctoUNn9b). +特别鸣谢: 枫溪. + +## 相关说明 + +中国版对文章部分内容有所改动. +本文主体内容以 `TabooLib 6` 为蓝本进行教学. + +## 建议 + +虽然`Taboolib`能够使开发者能够更快速的开发Bukkit可运行的插件. +但是在使用之前,需要确保你已经较为熟练的掌握Bukkit基本开发思路,并且能够独立的开发一个中小型插件. + +> 工具库始终只是为了你开发更灵活而建设的 \ No newline at end of file diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/31-TabooLib/3-快速上手.md b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/31-TabooLib/3-快速上手.md new file mode 100644 index 0000000..9eaad55 --- /dev/null +++ b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/31-TabooLib/3-快速上手.md @@ -0,0 +1,102 @@ +--- +front: +hard: 入门 +time: 10分钟 +--- + + +# 快速上手 + +## 创建项目 + +打开 IDEA -> Plugins -> 搜索 Taboo Development -> 安装此插件 + +![](../images/0_0.png) + +> https://plugins.jetbrains.com/plugin/25210-taboolib-development + +新建项目中选择 Taboo Development . +选择项目名称和项目位置. + +![](../images/0_1.png) + +输入插件名、 主类、 版本等信息 +选择需要用到的模块 + +![](../images/0_2.png) + +> 模块化是`TabooLib`特点之一,开发者无需下载不需要的前置库,各取所需即可 +> 如果还不确定自己会用到什么模块也不要着急,后续仍然可以在`Gradle`配置文件中配置Install + +接下来输入插件基本信息 + +![](../images/0_3.png) + + +## 认识目录 + +![](../images/0_4.png) + +### 修改项目名 + +在`settings.gradle.kts`中. +你会看到 `rootProject.name = "TestProject"`. + +修改后同步Gradle可以快速修改项目名. + +### 修改基础信息 + +在`gradle.properties`中. +您可以在这里面修改插件的基础信息 + +```java-properties +group=top.maplex.testproject +version=1.0.0 +kotlin.incremental=true +kotlin.incremental.java=true +kotlin.caching.enabled=true +kotlin.parallel.tasks.in.project=true +kotlin.experimental.tryK2=true +kapt.use.k2=true +``` + +这其中包括了是否开启Kotlin2 + +> 为什么要用Kotlin2呢,您可以看看这个图 + +![](../images/0_5.png) + +**节省了将近一半的编译时间** + +### 构建配置 + +在`build.gradle.kts`,这个是构建配置文件,非常重要 + +![](../images/0_6.png) + +如果你需要使用Kotlin2 +在构建配置中 id("org.jetbrains.kotlin.jvm") version "1.9.22" 版本设置成 1.9.22 + +```kotlin + +plugins { + java + id("io.izzel.taboolib") version "2.0.6" + id("org.jetbrains.kotlin.jvm") version "1.9.22" +} + +``` + +然后再代码块中新增一个信息 + +```kotlin + +kotlin { + sourceSets.all { + languageSettings { + languageVersion = "2.0" + } + } +} + +``` \ No newline at end of file diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/README.md b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/README.md new file mode 100644 index 0000000..e69de29 diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_0.png b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_0.png new file mode 100644 index 0000000..ee942a8 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_0.png differ diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_1.png b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_1.png new file mode 100644 index 0000000..09fbfdf Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_1.png differ diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_2.png b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_2.png new file mode 100644 index 0000000..875e934 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_2.png differ diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_3.png b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_3.png new file mode 100644 index 0000000..61fefc5 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_3.png differ diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_4.png b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_4.png new file mode 100644 index 0000000..7cce910 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_4.png differ diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_5.png b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_5.png new file mode 100644 index 0000000..fcd2a70 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_5.png differ diff --git a/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_6.png b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_6.png new file mode 100644 index 0000000..bb3d799 Binary files /dev/null and b/mcguide/28-电脑网络游戏/课程4:常见第三方库教程/images/0_6.png differ diff --git a/mcguide/28-成就系统/images/achievement_0.png b/mcguide/29-成就系统/images/achievement_0.png similarity index 100% rename from mcguide/28-成就系统/images/achievement_0.png rename to mcguide/29-成就系统/images/achievement_0.png diff --git a/mcguide/28-成就系统/images/achievement_1.png b/mcguide/29-成就系统/images/achievement_1.png similarity index 100% rename from mcguide/28-成就系统/images/achievement_1.png rename to mcguide/29-成就系统/images/achievement_1.png diff --git a/mcguide/28-成就系统/images/achievement_2.png b/mcguide/29-成就系统/images/achievement_2.png similarity index 100% rename from mcguide/28-成就系统/images/achievement_2.png rename to mcguide/29-成就系统/images/achievement_2.png diff --git a/mcguide/28-成就系统/images/achievement_3.png b/mcguide/29-成就系统/images/achievement_3.png similarity index 100% rename from mcguide/28-成就系统/images/achievement_3.png rename to mcguide/29-成就系统/images/achievement_3.png diff --git a/mcguide/28-成就系统/images/achievement_4.png b/mcguide/29-成就系统/images/achievement_4.png similarity index 100% rename from mcguide/28-成就系统/images/achievement_4.png rename to mcguide/29-成就系统/images/achievement_4.png diff --git a/mcguide/28-成就系统/images/achievement_5.png b/mcguide/29-成就系统/images/achievement_5.png similarity index 100% rename from mcguide/28-成就系统/images/achievement_5.png rename to mcguide/29-成就系统/images/achievement_5.png diff --git a/mcguide/28-成就系统/picture/achievement_1.png b/mcguide/29-成就系统/picture/achievement_1.png similarity index 100% rename from mcguide/28-成就系统/picture/achievement_1.png rename to mcguide/29-成就系统/picture/achievement_1.png diff --git a/mcguide/28-成就系统/picture/achievement_2.png b/mcguide/29-成就系统/picture/achievement_2.png similarity index 100% rename from mcguide/28-成就系统/picture/achievement_2.png rename to mcguide/29-成就系统/picture/achievement_2.png diff --git a/mcguide/28-成就系统/picture/achievement_3.png b/mcguide/29-成就系统/picture/achievement_3.png similarity index 100% rename from mcguide/28-成就系统/picture/achievement_3.png rename to mcguide/29-成就系统/picture/achievement_3.png diff --git a/mcguide/28-成就系统/picture/cloudAchievement.png b/mcguide/29-成就系统/picture/cloudAchievement.png similarity index 100% rename from mcguide/28-成就系统/picture/cloudAchievement.png rename to mcguide/29-成就系统/picture/cloudAchievement.png diff --git a/mcguide/28-成就系统/云成就使用文档.md b/mcguide/29-成就系统/云成就使用文档.md similarity index 100% rename from mcguide/28-成就系统/云成就使用文档.md rename to mcguide/29-成就系统/云成就使用文档.md diff --git a/mcguide/28-成就系统/成就系统功能配置文档.md b/mcguide/29-成就系统/成就系统功能配置文档.md similarity index 99% rename from mcguide/28-成就系统/成就系统功能配置文档.md rename to mcguide/29-成就系统/成就系统功能配置文档.md index 8efd686..4ccc4f7 100644 --- a/mcguide/28-成就系统/成就系统功能配置文档.md +++ b/mcguide/29-成就系统/成就系统功能配置文档.md @@ -64,7 +64,7 @@ time: 15分钟 | 成就配置文件压缩包 | 限制大小:3M | | 成就页面展示头图 | 宽x高:1000 * 1625 | -**注意:目前尚不支持在电脑版的基岩版网络游戏服务器上使用成就配置功能。在电脑版平台上也将无法正常使用云端成就上报的接口。** +**注意:目前尚不支持在电脑版的基岩版网络游戏服务器上使用成就配置功能。在电脑版平台上也将无法正常使用云端成就上报的接口。** diff --git a/mcguide/30-测试/images/airperf01.png b/mcguide/30-测试/images/airperf01.png new file mode 100644 index 0000000..bf3d896 Binary files /dev/null and b/mcguide/30-测试/images/airperf01.png differ diff --git a/mcguide/30-测试/images/airperf02.png b/mcguide/30-测试/images/airperf02.png new file mode 100644 index 0000000..c294ede Binary files /dev/null and b/mcguide/30-测试/images/airperf02.png differ diff --git a/mcguide/30-测试/images/airperf03.png b/mcguide/30-测试/images/airperf03.png new file mode 100644 index 0000000..57ab1fa Binary files /dev/null and b/mcguide/30-测试/images/airperf03.png differ diff --git a/mcguide/30-测试/images/airperf04.png b/mcguide/30-测试/images/airperf04.png new file mode 100644 index 0000000..afcce87 Binary files /dev/null and b/mcguide/30-测试/images/airperf04.png differ diff --git a/mcguide/30-测试/images/airperf05.png b/mcguide/30-测试/images/airperf05.png new file mode 100644 index 0000000..ca970b0 Binary files /dev/null and b/mcguide/30-测试/images/airperf05.png differ diff --git a/mcguide/30-测试/images/airperf06.png b/mcguide/30-测试/images/airperf06.png new file mode 100644 index 0000000..67d58b0 Binary files /dev/null and b/mcguide/30-测试/images/airperf06.png differ diff --git a/mcguide/30-测试/images/tracy01.png b/mcguide/30-测试/images/tracy01.png new file mode 100644 index 0000000..0113fba Binary files /dev/null and b/mcguide/30-测试/images/tracy01.png differ diff --git a/mcguide/30-测试/images/tracy02.png b/mcguide/30-测试/images/tracy02.png new file mode 100644 index 0000000..e154674 Binary files /dev/null and b/mcguide/30-测试/images/tracy02.png differ diff --git a/mcguide/30-测试/images/tracy03.png b/mcguide/30-测试/images/tracy03.png new file mode 100644 index 0000000..2237231 Binary files /dev/null and b/mcguide/30-测试/images/tracy03.png differ diff --git a/mcguide/30-测试/images/tracy04.png b/mcguide/30-测试/images/tracy04.png new file mode 100644 index 0000000..7de1321 Binary files /dev/null and b/mcguide/30-测试/images/tracy04.png differ diff --git a/mcguide/30-测试/images/tracy05.png b/mcguide/30-测试/images/tracy05.png new file mode 100644 index 0000000..560c95d Binary files /dev/null and b/mcguide/30-测试/images/tracy05.png differ diff --git a/mcguide/30-测试/images/tracy06.png b/mcguide/30-测试/images/tracy06.png new file mode 100644 index 0000000..e19baa9 Binary files /dev/null and b/mcguide/30-测试/images/tracy06.png differ diff --git a/mcguide/30-测试/images/tracy07.png b/mcguide/30-测试/images/tracy07.png new file mode 100644 index 0000000..f204735 Binary files /dev/null and b/mcguide/30-测试/images/tracy07.png differ diff --git a/mcguide/30-测试/images/tracy08.png b/mcguide/30-测试/images/tracy08.png new file mode 100644 index 0000000..e154674 Binary files /dev/null and b/mcguide/30-测试/images/tracy08.png differ diff --git a/mcguide/30-测试/images/tracy09.png b/mcguide/30-测试/images/tracy09.png new file mode 100644 index 0000000..8e233dd Binary files /dev/null and b/mcguide/30-测试/images/tracy09.png differ diff --git a/mcguide/30-测试/images/tracy10.png b/mcguide/30-测试/images/tracy10.png new file mode 100644 index 0000000..fabd7fd Binary files /dev/null and b/mcguide/30-测试/images/tracy10.png differ diff --git a/mcguide/30-测试/images/tracy11.png b/mcguide/30-测试/images/tracy11.png new file mode 100644 index 0000000..2bf39d5 Binary files /dev/null and b/mcguide/30-测试/images/tracy11.png differ diff --git a/mcguide/30-测试/images/tracy12.png b/mcguide/30-测试/images/tracy12.png new file mode 100644 index 0000000..3a0d5a8 Binary files /dev/null and b/mcguide/30-测试/images/tracy12.png differ diff --git a/mcguide/30-测试/images/tracy13.png b/mcguide/30-测试/images/tracy13.png new file mode 100644 index 0000000..b594997 Binary files /dev/null and b/mcguide/30-测试/images/tracy13.png differ diff --git a/mcguide/30-测试/images/tracy14.png b/mcguide/30-测试/images/tracy14.png new file mode 100644 index 0000000..f0c6a7c Binary files /dev/null and b/mcguide/30-测试/images/tracy14.png differ diff --git a/mcguide/30-测试/images/tracy15.png b/mcguide/30-测试/images/tracy15.png new file mode 100644 index 0000000..af94b37 Binary files /dev/null and b/mcguide/30-测试/images/tracy15.png differ diff --git a/mcguide/30-测试/images/tracy16.png b/mcguide/30-测试/images/tracy16.png new file mode 100644 index 0000000..ed8caa6 Binary files /dev/null and b/mcguide/30-测试/images/tracy16.png differ diff --git a/mcguide/30-测试/images/tracy17.png b/mcguide/30-测试/images/tracy17.png new file mode 100644 index 0000000..012e4c8 Binary files /dev/null and b/mcguide/30-测试/images/tracy17.png differ diff --git a/mcguide/30-测试/images/tracy18.png b/mcguide/30-测试/images/tracy18.png new file mode 100644 index 0000000..0f43e47 Binary files /dev/null and b/mcguide/30-测试/images/tracy18.png differ diff --git a/mcguide/30-测试/images/tracy19.png b/mcguide/30-测试/images/tracy19.png new file mode 100644 index 0000000..4dae7d1 Binary files /dev/null and b/mcguide/30-测试/images/tracy19.png differ diff --git a/mcguide/30-测试/images/tracy20.png b/mcguide/30-测试/images/tracy20.png new file mode 100644 index 0000000..27247b1 Binary files /dev/null and b/mcguide/30-测试/images/tracy20.png differ diff --git a/mcguide/30-测试/images/tracy21.png b/mcguide/30-测试/images/tracy21.png new file mode 100644 index 0000000..2f2ce74 Binary files /dev/null and b/mcguide/30-测试/images/tracy21.png differ diff --git a/mcguide/30-测试/images/tracy22.png b/mcguide/30-测试/images/tracy22.png new file mode 100644 index 0000000..33bc330 Binary files /dev/null and b/mcguide/30-测试/images/tracy22.png differ diff --git a/mcguide/30-测试/images/tracy23.png b/mcguide/30-测试/images/tracy23.png new file mode 100644 index 0000000..0b5a9dd Binary files /dev/null and b/mcguide/30-测试/images/tracy23.png differ diff --git a/mcguide/35-上架与入驻/images/8_10new.png b/mcguide/35-上架与入驻/images/8_10new.png new file mode 100644 index 0000000..e8ca615 Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_10new.png differ diff --git a/mcguide/35-上架与入驻/images/8_11new.png b/mcguide/35-上架与入驻/images/8_11new.png new file mode 100644 index 0000000..c202fd1 Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_11new.png differ diff --git a/mcguide/35-上架与入驻/images/8_12new.png b/mcguide/35-上架与入驻/images/8_12new.png new file mode 100644 index 0000000..f65728f Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_12new.png differ diff --git a/mcguide/35-上架与入驻/images/8_13new.png b/mcguide/35-上架与入驻/images/8_13new.png new file mode 100644 index 0000000..ca7bce6 Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_13new.png differ diff --git a/mcguide/35-上架与入驻/images/8_14new.png b/mcguide/35-上架与入驻/images/8_14new.png new file mode 100644 index 0000000..a8293d6 Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_14new.png differ diff --git a/mcguide/35-上架与入驻/images/8_15.png b/mcguide/35-上架与入驻/images/8_15.png new file mode 100644 index 0000000..1b48387 Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_15.png differ diff --git a/mcguide/35-上架与入驻/images/8_16.png b/mcguide/35-上架与入驻/images/8_16.png new file mode 100644 index 0000000..fb65eca Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_16.png differ diff --git a/mcguide/35-上架与入驻/images/8_17.png b/mcguide/35-上架与入驻/images/8_17.png new file mode 100644 index 0000000..eea6909 Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_17.png differ diff --git a/mcguide/35-上架与入驻/images/8_18.png b/mcguide/35-上架与入驻/images/8_18.png new file mode 100644 index 0000000..8ab5786 Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_18.png differ diff --git a/mcguide/35-上架与入驻/images/8_1new.png b/mcguide/35-上架与入驻/images/8_1new.png new file mode 100644 index 0000000..e2617c9 Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_1new.png differ diff --git a/mcguide/35-上架与入驻/images/8_2_1.png b/mcguide/35-上架与入驻/images/8_2_1.png new file mode 100644 index 0000000..5322390 Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_2_1.png differ diff --git a/mcguide/35-上架与入驻/images/8_2_2.png b/mcguide/35-上架与入驻/images/8_2_2.png new file mode 100644 index 0000000..7f927de Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_2_2.png differ diff --git a/mcguide/35-上架与入驻/images/8_3new.png b/mcguide/35-上架与入驻/images/8_3new.png new file mode 100644 index 0000000..be997ec Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_3new.png differ diff --git a/mcguide/35-上架与入驻/images/8_4_2.png b/mcguide/35-上架与入驻/images/8_4_2.png new file mode 100644 index 0000000..ec85f2c Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_4_2.png differ diff --git a/mcguide/35-上架与入驻/images/8_4_3.png b/mcguide/35-上架与入驻/images/8_4_3.png new file mode 100644 index 0000000..80df0b5 Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_4_3.png differ diff --git a/mcguide/35-上架与入驻/images/8_4_4.png b/mcguide/35-上架与入驻/images/8_4_4.png new file mode 100644 index 0000000..492912b Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_4_4.png differ diff --git a/mcguide/35-上架与入驻/images/8_4new.png b/mcguide/35-上架与入驻/images/8_4new.png new file mode 100644 index 0000000..c1f241c Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_4new.png differ diff --git a/mcguide/35-上架与入驻/images/8_4newnew.png b/mcguide/35-上架与入驻/images/8_4newnew.png new file mode 100644 index 0000000..53fd99b Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_4newnew.png differ diff --git a/mcguide/35-上架与入驻/images/8_5new.png b/mcguide/35-上架与入驻/images/8_5new.png new file mode 100644 index 0000000..f357bb1 Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_5new.png differ diff --git a/mcguide/35-上架与入驻/images/8_6new.png b/mcguide/35-上架与入驻/images/8_6new.png new file mode 100644 index 0000000..b1302f5 Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_6new.png differ diff --git a/mcguide/35-上架与入驻/images/8_7new.png b/mcguide/35-上架与入驻/images/8_7new.png new file mode 100644 index 0000000..35b517d Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_7new.png differ diff --git a/mcguide/35-上架与入驻/images/8_8new.png b/mcguide/35-上架与入驻/images/8_8new.png new file mode 100644 index 0000000..35b517d Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_8new.png differ diff --git a/mcguide/35-上架与入驻/images/8_9new.png b/mcguide/35-上架与入驻/images/8_9new.png new file mode 100644 index 0000000..e0c6dfe Binary files /dev/null and b/mcguide/35-上架与入驻/images/8_9new.png differ diff --git a/mcguide/35-上架与入驻/课程12.2-基岩版网络游戏审核与上架规范.md b/mcguide/35-上架与入驻/课程12.2-基岩版网络游戏审核与上架规范.md index 7e4998c..4948bb8 100644 --- a/mcguide/35-上架与入驻/课程12.2-基岩版网络游戏审核与上架规范.md +++ b/mcguide/35-上架与入驻/课程12.2-基岩版网络游戏审核与上架规范.md @@ -101,10 +101,10 @@ time: 10分钟 ### 服务器准备申请正式服务器,多久能得到一审结果? -答:服务器开发完成并自测无误后,请您在平台提交审核并联系QQ 2840356667对接上架前审核。 +答:服务器开发完成并自测无误后,请您在平台提交审核并联系QQ 3894235831对接上架前审核。 ### 服务器准备申请正式上架,多久能得到二审结果? -答:服务器正式上架前,请您在平台提交审核并联系QQ 2840356667对接上架前审核。 \ No newline at end of file +答:服务器正式上架前,请您在平台提交审核并联系QQ 3894235831对接上架前审核。 diff --git a/mcguide/36-审核与下架/images/airperf.png b/mcguide/36-审核与下架/images/airperf.png new file mode 100644 index 0000000..dab38f0 Binary files /dev/null and b/mcguide/36-审核与下架/images/airperf.png differ diff --git a/mcguide/36-审核与下架/images/developer_platform.png b/mcguide/36-审核与下架/images/developer_platform.png new file mode 100644 index 0000000..b97cfda Binary files /dev/null and b/mcguide/36-审核与下架/images/developer_platform.png differ diff --git a/mcguide/36-审核与下架/images/developer_platform1.png b/mcguide/36-审核与下架/images/developer_platform1.png new file mode 100644 index 0000000..6cb5be7 Binary files /dev/null and b/mcguide/36-审核与下架/images/developer_platform1.png differ diff --git a/mcguide/36-审核与下架/images/price_review_process.svg b/mcguide/36-审核与下架/images/price_review_process.svg new file mode 100644 index 0000000..7159a41 --- /dev/null +++ b/mcguide/36-审核与下架/images/price_review_process.svg @@ -0,0 +1 @@ +
组件包体上传
组件包体上传
机审核价
机审核价
开发者提交审核
开发者提交审核
开发者设置价格
不小于推荐定价区间的
最低价格
开发者设置价格不小于推荐定价区间的最低价格...
进入后续审核流程
进入后续审核流程
开发者设置价格
小于推荐定价区间的
最低价格
开发者设置价格小于推荐定价区间的最低价格...
站内信反馈
站内信反馈
开发者调整价格
开发者调整价格
Viewer does not support full SVG 1.1
\ No newline at end of file diff --git a/mcguide/36-审核与下架/images/tracy.png b/mcguide/36-审核与下架/images/tracy.png new file mode 100644 index 0000000..0b5a9dd Binary files /dev/null and b/mcguide/36-审核与下架/images/tracy.png differ diff --git a/mcguide/36-审核与下架/课程03-机器审核流程及指标介绍.md b/mcguide/36-审核与下架/课程03-机器审核流程及指标介绍.md new file mode 100644 index 0000000..ebc84e9 --- /dev/null +++ b/mcguide/36-审核与下架/课程03-机器审核流程及指标介绍.md @@ -0,0 +1,111 @@ +--- +front: https://mc.res.netease.com/pc/zt/20201109161633/mc-dev/assets/img/0_25_5.cb909f47.png +hard: 入门 +time: 5分钟 +selection: true +--- + +# 机器审核流程及指标介绍 + +目前机审的流程主要由以下几个步骤构成: + +- 代码机审 +- 组件核价 +- 性能检测 + +## 代码机审 + +系统对上传的包体进行静态代码审核,检测是否存在违规代码、恶意脚本或不符合规范的代码结构。此步骤的作用是确保组件的代码安全性和规范性,避免潜在的安全风险。 + +若代码机审不通过,将返回平台内机审邮件,请在开发者平台右上角邮箱处查收。并根据[打包错误信息文档](../50-常见问题答疑/60-我的世界中国版打包错误信息汇整.html)的提示进行调整。 + +## 组件核价 + +系统根据组件的复杂度、资源占用情况等因素,自动生成组件的最低定价标准。 + +如果开发者提审时的最终售价(包括折扣)小于推荐区间的最低价格,则以开发者平台站内信的方式通知开发者进行定价更改。 + +此步骤的作用是根据标准限定售卖价格区间,消除当前存在的价格内卷现象,使整体市场的售卖价格趋向合理和体系化。 + +![image](./images/price_review_process.svg) + +## 性能检测 + +开发者上传包体后,系统自动将包体上传至手机测试集群环境,模拟玩家操作进行性能测试,主要检测进入时长、内存占用、平均帧率三个指标是否符合要求。避免因性能问题导致玩家体验下降,确保组件在不同设备上都能流畅运行。 + +从组件的运行周期来看,主要由启动和运行两个阶段产生性能问题。 + +- 启动阶段:启动加载时长和组件大小,该数据将显著影响用户成功进入游戏的意愿 +- 运行阶段:内存峰值、CPU占用、体验流畅度(帧率、卡顿)等 +- 其他兼容性问题,包括脚本代码错误 + +### 线上性能数据 + +截至2025.3.5,对线上存量组件,进行性能测试,性能分布情况如下: + +| 性能指标 | 指标范围 | 占比 | 机审拦截 | +| ---------------- | --------- | -------- | -------- | +| 平均帧率 | [0,10] | 0.04% | 是 | +| | (10,30] | 0.22% | 是 | +| | (30,40] | 0.48% | 是 | +| | (40,~) | 99.26% | | +| 加载时长(秒) | [0,10] | 97.52% | | +| | (10,60] | 0.66% | | +| | (60,120] | 0.09% | | +| | (120,~) | 0.07% | 是 | +| 内存峰值(MB) | [0,150] | 88.88% | | +| | (150,450] | 9.33% | | +| | (450,950] | 1.58% | 是 | +| | (950,1250]| 0.09% | 是 | +| | (1250,~) | 0.12% | 是 | + +注:上述数据基于多台中端机设备(高通 骁龙778G,高通 骁龙765G,MTK 天玑900,海思 Kirin 980)跑测结果,具备一定参考价值,但不同的玩家设备,操作系统版本,会略有差别。 + +### 组件性能标准 + +结合现状和线上玩家设备情况,组件性能标准如下 + +| 阶段 | 指标 | 优秀 | 平台建议 | 达标 | +| -------- | -------------- | ---------- | ---------- | --------- | +| 启动阶段 | 加载时长(秒) | <10 | <60 | <120 | +| 测试阶段 | 内存峰值(MB) | <150 | <300 | <450 | +| | 平均帧率 | >55 | >50 | >40 | +| 线上数据 | 平均卡顿次数 | / | / | / | + +### 核心指标介绍 + +- 内存峰值:组件内存占用超过设备阈值时,可能引发崩溃等问题,严重影响用户体验。 +- 平均帧率:低帧率会使游戏画面卡顿,影响流畅性,严重影响用户体验。 +- 平均卡顿次数:卡顿会导致游戏画面不流畅,进而影响玩家的体验,严重时甚至可能破坏整个游戏的乐趣。为了评估卡顿情况,我们会记录线上Python执行时间时长超过一定时间的函数,并在一定时间范围内计算其平均发生次数。 + +### 评测环境与方法 + +我们主要从开发、审核和线上三个环境进行评测。 + +- 在开发阶段,核心指标为内存、帧率和卡顿次数。开发者可使用Airperf和Tracy工具来监测内存、帧率和卡顿情况,并进行优化,确保玩家能有高质量性能体验。 +- 在审核阶段,我们将对组件进行核心指标性能测试,性能不达标的组件将被拒审。因此,开发者需在开发阶段进行自查,确保审核顺利通过。 +- 在线上环境,我们将采集玩家的帧率、内存和卡顿情况,以验证组件的性能。开发者可以通过开发者平台性能看板查看这些性能数据。 + +### 开发者工具指引 + +为了帮助开发者发现和解决性能问题,我的世界开发组提供了相应工具,以提高问题排查和解决的效率,详见[性能监测与调试](../30-测试/5-性能监测与调试工具.md)。 + +#### 开发者平台 + +后台展示了线上帧率,卡顿情况,可以查看和验证线上问题情况,效果如下图: + +![image](./images/developer_platform.png) + +![image](./images/developer_platform1.png) + +#### 方块探针(Tracy) + +卡顿排查工具,可以逐帧分析函数耗时,定位高消耗函数,帮助发现和解决问题,效果如下图 + +![image](./images/tracy.png) + +#### 方块易测(Airperf) + +基础性能检测工具,可以抓取帧率,内存等数据,用于自测是否达标,效果如下图: + +![image](./images/airperf.png) \ No newline at end of file diff --git a/mcguide/36-审核与下架/课程04-模组性能违规及处罚细则.md b/mcguide/36-审核与下架/课程04-模组性能违规及处罚细则.md new file mode 100644 index 0000000..85f4962 --- /dev/null +++ b/mcguide/36-审核与下架/课程04-模组性能违规及处罚细则.md @@ -0,0 +1,133 @@ +# 模组性能违规及处罚细则 + +## 违规及处罚细则 + +1. **目的和范围** + +为推动开发者持续优化模组性能,保障玩家游戏体验,维护《我的世界》中国版游戏生态的健康与稳定发展,根据《\<我的世界\>开发者协议》等相关协议,《我的世界》开发者平台(以下简称“**平台**”或“**我们**”)特制定本细则。本细则适用于所有通过《我的世界》开发者平台注册的开发者(以下简称“**开发者**”或“**您**”)。 + +2. **模组性能违规情况说明** + + 1. **模组性能违规的认定** + + 当开发者组件和/或开发者服务器游戏(合称“**开发者模组**”或“**模组**”)存在以下任一情形时,将被认定为开发者模组性能违规: + + 1. **玩家投诉频率超标**:针对同一开发者模组性能的有效投诉率(当日有效反馈次数/当日游玩该模组人数)≥5%,且有效反馈次数≥50次。 + + 2. **模组线上性能数据不达标**:开发者模组线上崩溃率数据超过阈值。 + + 2. **模组性能违规风险分级及示例** + + 平台将结合模组性能违规对游戏及玩家造成的影响等因素,综合评定开发者模组性能的违规程度,具体分级及示例如下: + +| **违规级别** | **分级标准** | +| ---------------- | ------------------------------------------------------------ | +| 轻度风险 | 线上崩溃率或玩家反馈率>=5% | +| 中度风险 | 线上崩溃率或玩家反馈率>=8% 或 组件问题影响的玩家数量偏多 | +| 高度风险 | 线上崩溃率或玩家反馈率>=12% 或 组件问题影响的玩家数量多 | +| 严重风险 | 线上崩溃率或玩家反馈率>=15% 或 组件问题影响的玩家数量极多 | + +3. **模组性能违规处罚标准** + +对于违反本细则的模组,平台有权采取如下一项或者多项处罚措施: + +| **违规级别** | **处罚方式(合格需要三项均达标,任一项达到处罚标准则处罚升级)** | +| ------------------ | ------------------------------------------------------------ | +| 中度风险 | 1.立刻弱下架开发者模组并告知开发者改进开发者模组质量
2.开发者信用分-1 | +| 高度风险 | 1.立刻弱下架开发者模组并告知开发者改进开发者模组质量
2.违约金:**下架时开发者模组价格 X 下架前3日的开发者模组总购买人数** X 处罚倍数
3.根据实际问题严重程度及对玩家的影响程度,**处罚倍数最高可至5倍** | +| 严重风险 | 1.立刻弱下架开发者模组并告知开发者改进开发者模组质量
2.违约金:**下架时开发者模组价格 X 下架前7日的开发者模组总购买人数** X 处罚倍数
3.根据实际问题严重程度及对玩家的影响程度,**处罚倍数最高可至10倍**
4.开发者信用分-6
5.开发者模组停止上传7个工作日
6.推广资源取消申请资格7个工作日 | + +注: + +(1)平台有权根据违规情节严重程度,对具体的处罚措施进行调整,包括但不限于延长弱下架时间、追究违规行为给平台造成的全部损失等; + +(2)若一个月内单一开发者重复触发同一等级的处罚,则第二次处罚升级,第三次处罚继续升级; + +(3)若处罚升级前已经到达封顶等级,则该处罚系数固定为【10】。 + +4. **模组性能违规处罚流程** + + 1. **组件问题处理阶段展示**: + + + + + + + + + + + + + + + + + + + +
组件状态阶段开发者独立整改时间正式整改期(固定21天)
开发者独立整改时间开始开发者独立整改时间结束整改期开始整改期结束
进入此节点的判定条件开发者收到警告邮件后台确认组件问题后,对组件进行弱下架开发者组件被弱下架根据近期线上数据决定是否对组件进行正式处罚
+ + 组件收到性能警报提示邮件后需要开发者自行对组件问题进行排查和修改,这个过程称为开发者独立整改期。独立整改期的时长会根据组件的实际线上崩溃率和反馈率进行调整,为减少问题组件带给玩家的影响,**线上崩溃率和反馈率越高的组件独立整改期越短**。独立整改期结束时如果组件问题得到改善则不会进行后续处罚,若组件性能数据依然超标,我们会对组件进行弱下架处理,组件进入正式整改期。 + + 2. **正式整改期时长为固定的21天**,此期间您需要对违规模组的性能表现进行提升,平台将视违规情况决定是否联系您并提供专项优化技术支持,您应积极配合平台。 + + 3. **若您在正式整改期结束后未予整改,或者消极整改、不积极进行性能优化、整改结果未能达到平台规定的模组性能标准,平台将执行最终处罚决定(“处罚通知”)**,并酌情将处罚情况予以公示。 + 若您对于处罚通知有异议,应在整改期内向平台书面提出异议并提供相关证据,平台将在收到异议后7个工作日内对您提出的异议数据及相关证据进行审查。除非有证据证明是平台故意造成数据错误的,否则您同意以平台二次审查后确认的数据作为最终处罚判定依据。若您未在整改期内提出书面异议的,视为您对处罚通知无异议。 + + 4. 因您在开发者平台登记的联系信息不准确,导致平台无法与您取得联系的,由此造成的损失由您自行负责。 +5. **违约金支付与结算** + + 1. 违约金支付方式: + + 1. **直接扣除:** 平台有权优先从您的违规行为发生当月的开发者分成收入中直接扣除相应的违约金,并按照平台结算系统进行实际收益结算。若当月结算账单金额不足以覆盖违约金,平台将扣除您在平台缴纳的押金,并依次递延冻结后续结算月份的账单,直至累计结算金额足以全额支付违约金。 + + 2. **汇款或转账:** 平台亦有权要求您通过汇款或转账的形式支付违约金。您需在收到平台发出的缴费通知后,按照缴费通知的要求,将违约金转账或汇款至平台指定的账户。若您逾期仍未缴纳违约金,平台有权采取进一步措施,包括但不限于暂停或终止模组的运营、封禁您的开发者账号,并将历史未结算金额及押金扣缴违约金进行结算。 + + 2. 平台指定银行汇款账号信息如下: + + 公司名称:上海网之易璀璨网络科技有限公司 + + 纳税人识别号:91310000MA1FR5564G + + 地址:上海市徐汇区龙水南路99号B1层-01室 + + 电话:021-61947163 + + 开户行:招商银行股份有限公司上海田林支行 + + 银行账号:121922114910604 + + 3. 关于发票和收据: + + 1. 若违约金是从开发者分成收入中扣除的,违约金将在账单中作为坏账处理。开发者应根据开发者平台后台显示的实际结算收益金额开具发票,不再另行开具收据。 + 2. 若违约金无法从开发者分成收入中足额扣除,采用冻结结算款项方式处理。针对冻结的结算月份账单,不另开具收据。 + + 4. 其余开发者分成实际收益结算事宜依据《\<我的世界\>开发者协议》的相关条款进行处理。 关于开发者分成实际收益结算的任何疑问,请通过联系客服按钮提交问题。 + +6. **其他** + + 1. **本细则自发布之日起生效,并将不定期进行完善或修改,完善或修改后的新细则自更新之日起生效。** + + 2. **您同意并理解,为适应模组开发技术与平台检测能力的不断发展,我们有权根据平台业务需要对本细则进行更新。如更新内容为重大或实质性内容,我们将通过以下任意一种或多种方式通知您:网页公告、电子邮件、手机短信或常规的信件。该等通知自发送之日视为已送达您。如果您不同意更新的全部或者部分内容,您必需立即书面通知我们并按照相关程序指引停止使用我们的服务。否则,即视为您同意遵守前述更新内容。** + + 3. 本细则是您已签署的《\<我的世界\>开发者协议》等相关协议的组成部分,具有同等法律效力。本细则与《\<我的世界\>开发者协议》有冲突时,以本细则为准,本细则未作规定之内容,适用《\<我的世界\>开发者协议》等相关协议之约定。 + + + +## 常见问题 + +**Q:收到了警示邮件,我的组件会被弱下架吗?我对组件优化没有头绪,能获得官方的帮助吗?** + + + +A:目前警示系统会在组件性能数据恢复正常后,自动将其移出问题组件列表。因此,如果您的组件性能指标仅在阈值附近波动,无需担心被下架处理。我们也在持续优化警示邮件的发送机制,未来将在组件性能长期稳定超出阈值时才会发送通知,避免误报或过早干预。 + + + +如果您的组件确实在一段时间内稳定超过性能标准,我们会根据问题的严重程度进行处理,包括可能的**暂时弱下架**,并进入**整改期**。整改期间建议您优先尝试自助优化组件性能;若在优化过程中遇到困难,欢迎通过开发者平台提交反馈,我们将提供必要支持。 + + + +目前,我们正在对组件性能服务流程进行调试与优化,并会定期汇总开发者反馈中的共性问题,形成优化建议,帮助您更高效地提升组件质量。 diff --git a/mcguide/36-审核与下架/课程07-Python模块白名单.md b/mcguide/36-审核与下架/课程07-Python模块白名单.md index 911567d..4379c9f 100644 --- a/mcguide/36-审核与下架/课程07-Python模块白名单.md +++ b/mcguide/36-审核与下架/课程07-Python模块白名单.md @@ -8,7 +8,7 @@ | 白名单 | 白名单 | 白名单 | | ----------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------- | -| __future__ | mod.server.component.actorPushableCompServer | client.component.particleSystemCompClient | +| \_\_future\_\_ | mod.server.component.actorPushableCompServer | client.component.particleSystemCompClient | | _md5 | mod.server.component.aiCommandCompServer | client.component.particleTransComp | | _random | mod.server.component.attrCompServer | client.component.playerAnimCompClient | | logging | mod.server.component.auxValueCompServer | client.component.playerCompClient | diff --git a/mcguide/50-常见问题答疑/images/30.png b/mcguide/50-常见问题答疑/images/30.png new file mode 100644 index 0000000..0f82020 Binary files /dev/null and b/mcguide/50-常见问题答疑/images/30.png differ diff --git a/mconline/100-历史归档教程/10-addon教程/第03章:基本开发工具介绍/课程01.基本开发工具介绍.md b/mconline/100-历史归档教程/10-addon教程/第03章:基本开发工具介绍/课程01.基本开发工具介绍.md index 1e7f0dc..0c12778 100644 --- a/mconline/100-历史归档教程/10-addon教程/第03章:基本开发工具介绍/课程01.基本开发工具介绍.md +++ b/mconline/100-历史归档教程/10-addon教程/第03章:基本开发工具介绍/课程01.基本开发工具介绍.md @@ -47,6 +47,4 @@ WEB版入口:[https://web.blockbench.net/](https://web.blockbench.net/) 这里主要补充一种途径,方便开发者将JAVA版与基岩版地图格式互相转换的方法。MCCTOOLCHESTPE是由cynodontA开发维护的一款免费闭源的MC世界存档转化软件,支持Java版地图转基岩版、基岩版地图转Java。 -下载入口:[http://mcctoolchest.com/download](http://mcctoolchest.com/download) - -![](./images/1_4.jpg) \ No newline at end of file +![](./images/1_4.jpg)