diff --git a/api-index.json b/api-index.json index a4d3426c..2ed0b27b 100644 --- a/api-index.json +++ b/api-index.json @@ -1,38722 +1,39328 @@ [ { - "type": "api", - "name": "ModSdk技术手册", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/0-概述/0-概述.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/0-概述/0-概述.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "ModSdk技术手册" + }, { - "type": "api", - "name": "Apollo技术手册", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/0-概述/0-概述.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/0-概述/0-概述.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "Apollo技术手册" + }, { - "type": "api", - "name": "预设架构技术手册", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/0-概述/0-概述.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/0-概述/0-概述.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "预设架构技术手册" + }, { - "type": "event", - "name": "AchievementButtonMovedClientEvent", - "method": "", - "description": "触发时机:使用自定义成就系统的时,拖动成就入口结束时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "remark": "", + "return": [], + "description": "触发时机:使用自定义成就系统的时,拖动成就入口结束时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", "params": [ { - "name": "oldPosition", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "oldPosition", "description": "移动前该控件相对父节点的坐标信息,第一项为横轴,第二项为纵轴" - }, + }, { - "name": "newPosition", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "newPosition", "description": "移动后该控件相对父节点的坐标信息,第一项为横轴,第二项为纵轴" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "AchievementButtonMovedClientEvent" + }, { - "type": "event", - "name": "ClientChestCloseEvent", - "method": "", - "description": "关闭箱子界面时触发,包括小箱子,合并后大箱子和末影箱(实体容器不属于方块,不会触发该事件)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "关闭箱子界面时触发,包括小箱子,合并后大箱子和末影箱(实体容器不属于方块,不会触发该事件)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "ClientChestCloseEvent" + }, { - "type": "event", - "name": "ClientChestOpenEvent", - "method": "", - "description": "打开箱子界面时触发,包括小箱子,合并后大箱子和末影箱(实体容器不属于方块,不会触发该事件)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "remark": "", + "return": [], + "description": "打开箱子界面时触发,包括小箱子,合并后大箱子和末影箱(实体容器不属于方块,不会触发该事件)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "箱子位置x值" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "箱子位置y值" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "箱子位置z值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ClientChestOpenEvent" + }, { - "type": "event", - "name": "ClientPlayerInventoryCloseEvent", - "method": "", - "description": "关闭物品背包界面时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "关闭物品背包界面时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "ClientPlayerInventoryCloseEvent" + }, { - "type": "event", - "name": "ClientPlayerInventoryOpenEvent", - "method": "", - "description": "打开物品背包界面时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "remark": "", + "return": [], + "description": "打开物品背包界面时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", "params": [ { - "name": "isCreative", - "type": "bool", + "type": "bool", + "name": "isCreative", "description": "是否是创造模式背包界面" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "取消打开物品背包界面" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ClientPlayerInventoryOpenEvent" + }, { - "type": "event", - "name": "CloseNeteaseShopEvent", - "method": "", - "description": "关闭商城界面时触发,包括脚本商城和Apollo插件商城", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "关闭商城界面时触发,包括脚本商城和Apollo插件商城", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "CloseNeteaseShopEvent" + }, { - "type": "event", - "name": "GridComponentSizeChangedClientEvent", - "method": "", - "description": "触发时机:UI grid组件里格子数目发生变化时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "remark": "", + "return": [], + "description": "触发时机:UI grid组件里格子数目发生变化时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", "params": [ { - "name": "path", - "type": "str", + "type": "str", + "name": "path", "description": "grid网格所在的路径(从UI根节点算起)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GridComponentSizeChangedClientEvent" + }, { - "type": "event", - "name": "HudButtonChangedClientEvent", - "method": "", - "description": "当原生HUD按钮位置或大小发生改变时触发,例如玩家使用了自定义控件功能会触发,可在该事件中修改mod按钮的位置防止重叠", - "remark": "- 修改后的按钮列表中,每个按钮的字段如下:\r\n | 字段名 | 类型 | 说明 |\r\n | --- | --- | --- |\r\n | areaEnum | str | [HUD原生UI枚举值](../枚举值/OriginGUIName.md) |\r\n | beforeSize | tuple(float,float,float,float) | (xMin, yMin, xMax, yMax)修改前原生UI的Area |\r\n | afterSize | tuple(float,float,float,float) | (xMin, yMin, xMax, yMax)修改后原生UI的Area |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "remark": "- 修改后的按钮列表中,每个按钮的字段如下:\r\n | 字段名 | 类型 | 说明 |\r\n | --- | --- | --- |\r\n | areaEnum | str | [HUD原生UI枚举值](../枚举值/OriginGUIName.md) |\r\n | beforeSize | tuple(float,float,float,float) | (xMin, yMin, xMax, yMax)修改前原生UI的Area |\r\n | afterSize | tuple(float,float,float,float) | (xMin, yMin, xMax, yMax)修改后原生UI的Area |", + "return": [], + "description": "当原生HUD按钮位置或大小发生改变时触发,例如玩家使用了自定义控件功能会触发,可在该事件中修改mod按钮的位置防止重叠", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", "params": [ { - "name": "changedList", - "type": "tuple(dict)", + "type": "tuple(dict)", + "name": "changedList", "description": "修改后的按钮列表" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HudButtonChangedClientEvent" + }, { - "type": "event", - "name": "OnItemSlotButtonClickedEvent", - "method": "", - "description": "点击快捷栏、背包栏、盔甲栏、副手栏的物品槽时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "remark": "", + "return": [], + "description": "点击快捷栏、背包栏、盔甲栏、副手栏的物品槽时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", "params": [ { - "name": "slotIndex", - "type": "int", + "type": "int", + "name": "slotIndex", "description": "点击的物品槽的编号,编号对应位置详见[物品栏]" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnItemSlotButtonClickedEvent" + }, { - "type": "event", - "name": "PlayerChatButtonClickClientEvent", - "method": "", - "description": "玩家点击聊天按钮或回车键触发呼出聊天窗口时客户端抛出的事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "玩家点击聊天按钮或回车键触发呼出聊天窗口时客户端抛出的事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "PlayerChatButtonClickClientEvent" + }, { - "type": "event", - "name": "PlayerInventoryOpenScriptServerEvent", - "method": "", - "description": "某个客户端打开物品背包界面时触发", - "remark": "- 可以监听此事件判定客户端是否打开了创造背包\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "remark": "- 可以监听此事件判定客户端是否打开了创造背包\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "某个客户端打开物品背包界面时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "客户端对应的玩家entity的唯一ID" - }, + }, { - "name": "isCreative", - "type": "bool", + "type": "bool", + "name": "isCreative", "description": "是否是创造模式背包界面" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerInventoryOpenScriptServerEvent" + }, { - "type": "event", - "name": "PopScreenAfterClientEvent", - "method": "", - "description": "screen移除触发", - "remark": "- 与PopScreenEvent不同,PopScreenAfterClientEvent触发时机是在完全把UI弹出后,返回的参数是弹出后最顶层UI的", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "remark": "- 与PopScreenEvent不同,PopScreenAfterClientEvent触发时机是在完全把UI弹出后,返回的参数是弹出后最顶层UI的", + "return": [], + "description": "screen移除触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", "params": [ { - "name": "screenName", - "type": "str", + "type": "str", + "name": "screenName", "description": "UI名字" - }, + }, { - "name": "screenDef", - "type": "str", + "type": "str", + "name": "screenDef", "description": "包含命名空间的UI名字,格式为namespace.screenName" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PopScreenAfterClientEvent" + }, { - "type": "event", - "name": "PopScreenEvent", - "method": "", - "description": "screen移除触发", - "remark": "- screenName为正在弹出的Screen名,如果需要获取下一个Screen可使用PopScreenAfterClientEvent", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "remark": "- screenName为正在弹出的Screen名,如果需要获取下一个Screen可使用PopScreenAfterClientEvent", + "return": [], + "description": "screen移除触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", "params": [ { - "name": "screenName", - "type": "str", + "type": "str", + "name": "screenName", "description": "UI名字" - }, + }, { - "name": "screenDef", - "type": "str", + "type": "str", + "name": "screenDef", "description": "包含命名空间的UI名字,格式为namespace.screenName" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PopScreenEvent" + }, { - "type": "event", - "name": "PushScreenEvent", - "method": "", - "description": "screen创建触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "remark": "", + "return": [], + "description": "screen创建触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", "params": [ { - "name": "screenName", - "type": "str", + "type": "str", + "name": "screenName", "description": "UI名字" - }, + }, { - "name": "screenDef", - "type": "str", + "type": "str", + "name": "screenDef", "description": "包含命名空间的UI名字,格式为namespace.screenName" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PushScreenEvent" + }, { - "type": "event", - "name": "ScreenSizeChangedClientEvent", - "method": "", - "description": "改变屏幕大小时会触发的事件", - "remark": "- 该事件仅支持PC", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "remark": "- 该事件仅支持PC", + "return": [], + "description": "改变屏幕大小时会触发的事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", "params": [ { - "name": "beforeX", - "type": "float", + "type": "float", + "name": "beforeX", "description": "屏幕大小改变前的宽度" - }, + }, { - "name": "beforeY", - "type": "float", + "type": "float", + "name": "beforeY", "description": "屏幕大小改变前的高度" - }, + }, { - "name": "afterX", - "type": "float", + "type": "float", + "name": "afterX", "description": "屏幕大小改变后的宽度" - }, + }, { - "name": "afterY", - "type": "float", + "type": "float", + "name": "afterY", "description": "屏幕大小改变后的高度" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ScreenSizeChangedClientEvent" + }, { - "type": "event", - "name": "UiInitFinished", - "method": "", - "description": "UI初始化框架完成,此时可以创建UI", - "remark": "- 切换维度后会重新初始化UI并触发该事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 切换维度后会重新初始化UI并触发该事件", + "return": [], + "description": "UI初始化框架完成,此时可以创建UI", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "UiInitFinished" + }, { - "type": "event", - "name": "UrgeShipEvent", - "method": "", - "description": "玩家点击商城催促发货按钮时触发该事件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "remark": "", + "return": [], + "description": "玩家点击商城催促发货按钮时触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/UI.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "UrgeShipEvent" + }, { - "type": "event", - "name": "AchievementCompleteEvent", - "method": "", - "description": "玩家完成自定义成就时触发该事件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "玩家完成自定义成就时触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "rootNodeId", - "type": "str", + "type": "str", + "name": "rootNodeId", "description": "所属的页面的根节点成就id" - }, + }, { - "name": "achievementId", - "type": "str", + "type": "str", + "name": "achievementId", "description": "达成的成就id" - }, + }, { - "name": "title", - "type": "str", + "type": "str", + "name": "title", "description": "成就标题" - }, + }, { - "name": "description", - "type": "str", + "type": "str", + "name": "description", "description": "成就描述" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "AchievementCompleteEvent" + }, { - "type": "event", - "name": "AddEntityClientEvent", - "method": "", - "description": "客户端侧创建新实体时触发", - "remark": "- 创建玩家时不会触发该事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 创建玩家时不会触发该事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "客户端侧创建新实体时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" - }, + }, { - "name": "posX", - "type": "float", + "type": "float", + "name": "posX", "description": "位置x" - }, + }, { - "name": "posY", - "type": "float", + "type": "float", + "name": "posY", "description": "位置y" - }, + }, { - "name": "posZ", - "type": "float", + "type": "float", + "name": "posZ", "description": "位置z" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "实体维度" - }, + }, { - "name": "isBaby", - "type": "bool", + "type": "bool", + "name": "isBaby", "description": "是否为幼儿" - }, + }, { - "name": "engineTypeStr", - "type": "str", + "type": "str", + "name": "engineTypeStr", "description": "实体类型" - }, + }, { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "物品identifier(仅当物品实体时存在该字段)" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "物品附加值(仅当物品实体时存在该字段)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "AddEntityClientEvent" + }, { - "type": "event", - "name": "AddEntityServerEvent", - "method": "", - "description": "服务端侧创建新实体,或实体从存档加载时触发", - "remark": "- 创建玩家时不会触发该事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 创建玩家时不会触发该事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "服务端侧创建新实体,或实体从存档加载时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" - }, + }, { - "name": "posX", - "type": "float", + "type": "float", + "name": "posX", "description": "位置x" - }, + }, { - "name": "posY", - "type": "float", + "type": "float", + "name": "posY", "description": "位置y" - }, + }, { - "name": "posZ", - "type": "float", + "type": "float", + "name": "posZ", "description": "位置z" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "实体维度" - }, + }, { - "name": "isBaby", - "type": "bool", + "type": "bool", + "name": "isBaby", "description": "是否为幼儿" - }, + }, { - "name": "engineTypeStr", - "type": "str", + "type": "str", + "name": "engineTypeStr", "description": "实体类型,即实体identifier" - }, + }, { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "物品identifier(仅当物品实体时存在该字段)" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "物品附加值(仅当物品实体时存在该字段)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "AddEntityServerEvent" + }, { - "type": "event", - "name": "AddPlayerAOIClientEvent", - "method": "", - "description": "玩家加入游戏或者其余玩家进入当前玩家视野时触发的事件,替换AddPlayerEvent", - "remark": "- 该事件触发只表明在服务端数据中接收到了新玩家,并不能代表此时玩家在客户端中可见,若想在玩家进入视野后立马调用玩家渲染相关接口,建议使用[AddPlayerCreatedClientEvent](#addplayercreatedclientevent)。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 该事件触发只表明在服务端数据中接收到了新玩家,并不能代表此时玩家在客户端中可见,若想在玩家进入视野后立马调用玩家渲染相关接口,建议使用[AddPlayerCreatedClientEvent](#addplayercreatedclientevent)。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家加入游戏或者其余玩家进入当前玩家视野时触发的事件,替换AddPlayerEvent", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "AddPlayerAOIClientEvent" + }, { - "type": "event", - "name": "AddPlayerCreatedClientEvent", - "method": "", - "description": "玩家进入当前玩家所在的区块AOI后,玩家皮肤数据异步加载完成后触发的事件", - "remark": "- 由于玩家皮肤是异步加载的原因,该事件触发时机比[AddPlayerAOIClientEvent](#addplayeraoiclientevent)晚,触发该事件后可以对该玩家调用相关[玩家渲染接口](../接口/玩家/渲染.md)。\r\n - 当前客户端每加载好一个玩家的皮肤,就会触发一次该事件,比如刚进入世界时,localPlayer加载好会触发一次,周围的所有玩家加载好后也会分别触发一次。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 由于玩家皮肤是异步加载的原因,该事件触发时机比[AddPlayerAOIClientEvent](#addplayeraoiclientevent)晚,触发该事件后可以对该玩家调用相关[玩家渲染接口](../接口/玩家/渲染.md)。\r\n - 当前客户端每加载好一个玩家的皮肤,就会触发一次该事件,比如刚进入世界时,localPlayer加载好会触发一次,周围的所有玩家加载好后也会分别触发一次。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家进入当前玩家所在的区块AOI后,玩家皮肤数据异步加载完成后触发的事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "AddPlayerCreatedClientEvent" + }, { - "type": "event", - "name": "AddServerPlayerEvent", - "method": "", - "description": "触发时机:玩家加入时触发该事件。", - "remark": "- 触发此事件时,客户端mod未加载完毕,因此响应本事件时不能客户端发送事件。若需要在玩家进入世界时,服务器往客户端发送事件,请使用ClientLoadAddonsFinishServerEvent\r\n - 触发此事件时,玩家的实体还未加载完毕,请勿在这时切换维度。请在客户端监听OnLocalPlayerStopLoading事件并发送事件到server端再进行维度切换。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 触发此事件时,客户端mod未加载完毕,因此响应本事件时不能客户端发送事件。若需要在玩家进入世界时,服务器往客户端发送事件,请使用ClientLoadAddonsFinishServerEvent\r\n - 触发此事件时,玩家的实体还未加载完毕,请勿在这时切换维度。请在客户端监听OnLocalPlayerStopLoading事件并发送事件到server端再进行维度切换。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家加入时触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "玩家id" - }, + }, { - "name": "isTransfer", - "type": "bool", + "type": "bool", + "name": "isTransfer", "description": "是否是切服时进入服务器,仅用于Apollo。如果是True,则表示切服时加入服务器,若是False,则表示登录进入网络游戏" - }, + }, { - "name": "isReconnect", - "type": "bool", + "type": "bool", + "name": "isReconnect", "description": "是否是断线重连,仅用于Apollo。如果是True,则表示本次登录是断线重连,若是False,则表示本次是正常登录或者转服" - }, + }, { - "name": "isPeUser", - "type": "bool", + "type": "bool", + "name": "isPeUser", "description": "是否从手机端登录,仅用于Apollo。如果是True,则表示本次登录是从手机端登录,若是False,则表示本次登录是从PC端登录" - }, + }, { - "name": "transferParam", - "type": "str", + "type": "str", + "name": "transferParam", "description": "切服传入参数,仅用于Apollo。调用【TransferToOtherServer】或【TransferToOtherServerById】传入的切服参数" - }, + }, { - "name": "uid", - "type": "int/long", + "type": "int/long", + "name": "uid", "description": "仅用于Apollo,玩家的netease uid,玩家的唯一标识" - }, + }, { - "name": "proxyId", - "type": "int", + "type": "int", + "name": "proxyId", "description": "仅用于Apollo,当前客户端连接的proxy服务器id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "AddServerPlayerEvent" + }, { - "type": "event", - "name": "ChunkAcquireDiscardedClientEvent", - "method": "", - "description": "触发时机:客户端区块即将被卸载时", - "remark": "- 区块卸载:游戏只会加载玩家周围的区块,玩家移动到别的区域时,原来所在区域的区块会被卸载,参考[区块介绍](https://minecraft-zh.gamepedia.com/%E5%8C%BA%E5%9D%97)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 区块卸载:游戏只会加载玩家周围的区块,玩家移动到别的区域时,原来所在区域的区块会被卸载,参考[区块介绍](https://minecraft-zh.gamepedia.com/%E5%8C%BA%E5%9D%97)", + "return": [], + "description": "触发时机:客户端区块即将被卸载时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "区块所在维度" - }, + }, { - "name": "chunkPosX", - "type": "int", + "type": "int", + "name": "chunkPosX", "description": "区块的x坐标,对应方块X坐标区间为[x * 16, x * 16 + 15]" - }, + }, { - "name": "chunkPosZ", - "type": "int", + "type": "int", + "name": "chunkPosZ", "description": "区块的z坐标,对应方块Z坐标区间为[z * 16, z * 16 + 15]" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ChunkAcquireDiscardedClientEvent" + }, { - "type": "event", - "name": "ChunkAcquireDiscardedServerEvent", - "method": "", - "description": "服务端区块即将被卸载时触发", - "remark": "- 区块卸载:游戏只会加载玩家周围的区块,玩家移动到别的区域时,原来所在区域的区块会被卸载,参考[区块介绍](https://minecraft-zh.gamepedia.com/%E5%8C%BA%E5%9D%97)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 区块卸载:游戏只会加载玩家周围的区块,玩家移动到别的区域时,原来所在区域的区块会被卸载,参考[区块介绍](https://minecraft-zh.gamepedia.com/%E5%8C%BA%E5%9D%97)", + "return": [], + "description": "服务端区块即将被卸载时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "区块所在维度" - }, + }, { - "name": "chunkPosX", - "type": "int", + "type": "int", + "name": "chunkPosX", "description": "区块的x坐标,对应方块X坐标区间为[x * 16, x * 16 + 15]" - }, + }, { - "name": "chunkPosZ", - "type": "int", + "type": "int", + "name": "chunkPosZ", "description": "区块的z坐标,对应方块Z坐标区间为[z * 16, z * 16 + 15]" - }, + }, { - "name": "entities", - "type": "list(str)", + "type": "list(str)", + "name": "entities", "description": "随区块卸载而从世界移除的实体id的列表。注意事件触发时已经无法获取到这些实体的信息,仅供脚本资源回收用。" - }, + }, { - "name": "blockEntities", - "type": "list(dict)", + "type": "list(dict)", + "name": "blockEntities", "description": "随区块卸载而从世界移除的自定义方块实体的坐标的列表,列表元素dict包含posX,posY,posZ三个int表示自定义方块实体的坐标,blockName表示方块的identifier,包含命名空间及名称。注意事件触发时已经无法获取到这些方块实体的信息,仅供脚本资源回收用。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ChunkAcquireDiscardedServerEvent" + }, { - "type": "event", - "name": "ChunkGeneratedServerEvent", - "method": "", - "description": "触发时机:区块创建完成时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "触发时机:区块创建完成时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "该区块所在的维度" - }, + }, { - "name": "blockEntityData", - "type": "[{\"blockName\":str,\"posX\":int,\"posY\":int,\"posZ\":int}...]/None", + "type": "[{\"blockName\":str,\"posX\":int,\"posY\":int,\"posZ\":int}...]/None", + "name": "blockEntityData", "description": "该区块中的自定义方块实体列表,通常是由自定义特征生成的自定义方块,没有自定义方块实体时该值为None" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ChunkGeneratedServerEvent" + }, { - "type": "event", - "name": "ChunkLoadedClientEvent", - "method": "", - "description": "触发时机:客户端区块加载完成时", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "触发时机:客户端区块加载完成时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "区块所在维度" - }, + }, { - "name": "chunkPosX", - "type": "int", + "type": "int", + "name": "chunkPosX", "description": "区块的x坐标,对应方块X坐标区间为[x * 16, x * 16 + 15]" - }, + }, { - "name": "chunkPosZ", - "type": "int", + "type": "int", + "name": "chunkPosZ", "description": "区块的z坐标,对应方块Z坐标区间为[z * 16, z * 16 + 15]" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ChunkLoadedClientEvent" + }, { - "type": "event", - "name": "ChunkLoadedServerEvent", - "method": "", - "description": "触发时机:服务端区块加载完成时", - "remark": "- 注意:服务端的自定义方块实体加载完成时对应的客户端的自定义方块实体并没有初始化完成,无法使用该事件对客户端的自定义方块实体进行相关操作。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 注意:服务端的自定义方块实体加载完成时对应的客户端的自定义方块实体并没有初始化完成,无法使用该事件对客户端的自定义方块实体进行相关操作。", + "return": [], + "description": "触发时机:服务端区块加载完成时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "区块所在维度" - }, + }, { - "name": "chunkPosX", - "type": "int", + "type": "int", + "name": "chunkPosX", "description": "区块的x坐标,对应方块X坐标区间为[x * 16, x * 16 + 15]" - }, + }, { - "name": "chunkPosZ", - "type": "int", + "type": "int", + "name": "chunkPosZ", "description": "区块的z坐标,对应方块Z坐标区间为[z * 16, z * 16 + 15]" - }, + }, { - "name": "blockEntities", - "type": "list(dict)", + "type": "list(dict)", + "name": "blockEntities", "description": "随区块加载而加载进世界的自定义方块实体的坐标的列表,列表元素dict包含posX,posY,posZ三个int表示自定义方块实体的坐标,blockName表示方块的identifier,包含命名空间及名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ChunkLoadedServerEvent" + }, { - "type": "event", - "name": "ClientLoadAddonsFinishServerEvent", - "method": "", - "description": "触发时机:客户端mod加载完成时,服务端触发此事件。服务器可以使用此事件,往客户端发送数据给其初始化。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "触发时机:客户端mod加载完成时,服务端触发此事件。服务器可以使用此事件,往客户端发送数据给其初始化。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ClientLoadAddonsFinishServerEvent" + }, { - "type": "event", - "name": "CommandEvent", - "method": "", - "description": "玩家请求执行指令时触发", - "remark": "- 该事件是玩家请求执行指令时触发的Hook,该事件不响应命令方块的指令和通过modSDK调用的指令,阻止玩家的该条指令只需要将cancel设置为True\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 该事件是玩家请求执行指令时触发的Hook,该事件不响应命令方块的指令和通过modSDK调用的指令,阻止玩家的该条指令只需要将cancel设置为True\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家请求执行指令时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "玩家ID" - }, + }, { - "name": "command", - "type": "str", + "type": "str", + "name": "command", "description": "指令字符串" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "CommandEvent" + }, { - "type": "event", - "name": "CustomCommandTriggerServerEvent", - "method": "", - "description": "自定义命令触发事件", - "remark": "- origin参数说明如下\r\n \r\n |键|类型|解释|\r\n |:-|:-|:-|\r\n |entityId|str|触发指令的实体id,**若由命令方块触发,则不会含有此字段**|\r\n |dimension|int|指令触发的维度id,0-主世界; 1-下界; 2-末地; 或其他自定义维度|\r\n |blockPos|tuple|触发指令的实体或命令方块的整数坐标|\r\n - 自定义命令参数中的dict说明如下\r\n \r\n |键|类型|解释|\r\n |:-|:-|:-|\r\n |name|str|参数名称,对应json中的name字段|\r\n |type|str|参数类型,对应json中的type字段|\r\n |value|any|参数的值,若玩家没传,则采用json中填写的default的值,但会转为python变量格式。如null转为None,array转为tuple|\r\n - 对于玩家传入的参数,type不同则对应的value也不同,type对应value的类型和具体数据格式如下\r\n \r\n |type|value类型|解释|\r\n |:-|:-|:-|\r\n |int|int|整数,如114|\r\n |float|float|浮点数,如5.14|\r\n |bool|bool|布尔值,如True|\r\n |str|str|字符串,如'niganma'|\r\n |enum|str|开发者在json中指定的某个字符串|\r\n |enum_short|str|开发者在json中指定的某个字符串|\r\n |block|str|方块的identifier,如'minecraft:grass'|\r\n |item|dict|含有物品名称,如{'itemName': 'minecraft:apple'}|\r\n |pos|tuple|含有三个float的坐标,如(-0.93, 81.25, -5.67)|\r\n |target|tuple|含有对应的所有目标entityId,如('-139816907912', '-263852559602')|\r\n |entity|dict|含有实体名称,如{'entityType': 'minecraft:cow'}|\r\n |effect|dict|含有状态效果名称和对应的[EffectType](../枚举值/EffectType.md)枚举,如`{'name': 'absorption', 'id': 22}`|\r\n |dimension|dict|含有维度名称和对应数字id,如`{'name': 'nether', 'id': 1}`|\r\n |biome|dict|含有生物群系名称和对应的[BiomeType](../枚举值/BiomeType.md)枚举,如`{'name': 'bamboo_jungle', 'biomeType': 48}`|\r\n |structure|dict|含有结构名称和对应的[StructureFeatureType](../枚举值/StructureFeatureType.md)枚举,如`{'name': 'ancient_city', 'structureType': 15}`|\r\n |enchant|dict|含有附魔名称和对应的[EnchantType](../枚举值/EnchantType.md)枚举,如`{'identifier': 'knockback', 'type': 12}`|", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- origin参数说明如下\r\n \r\n |键|类型|解释|\r\n |:-|:-|:-|\r\n |entityId|str|触发指令的实体id,**若由命令方块触发,则不会含有此字段**|\r\n |dimension|int|指令触发的维度id,0-主世界; 1-下界; 2-末地; 或其他自定义维度|\r\n |blockPos|tuple|触发指令的实体或命令方块的整数坐标|\r\n - 自定义命令参数中的dict说明如下\r\n \r\n |键|类型|解释|\r\n |:-|:-|:-|\r\n |name|str|参数名称,对应json中的name字段|\r\n |type|str|参数类型,对应json中的type字段|\r\n |value|any|参数的值,若玩家没传,则采用json中填写的default的值,但会转为python变量格式。如null转为None,array转为tuple|\r\n - 对于玩家传入的参数,type不同则对应的value也不同,type对应value的类型和具体数据格式如下\r\n \r\n |type|value类型|解释|\r\n |:-|:-|:-|\r\n |int|int|整数,如114|\r\n |float|float|浮点数,如5.14|\r\n |bool|bool|布尔值,如True|\r\n |str|str|字符串,如'niganma'|\r\n |enum|str|开发者在json中指定的某个字符串|\r\n |enum_short|str|开发者在json中指定的某个字符串|\r\n |block|str|方块的identifier,如'minecraft:grass'|\r\n |item|dict|含有物品名称,如{'itemName': 'minecraft:apple'}|\r\n |pos|tuple|含有三个float的坐标,如(-0.93, 81.25, -5.67)|\r\n |target|tuple|含有对应的所有目标entityId,如('-139816907912', '-263852559602')|\r\n |entity|dict|含有实体名称,如{'entityType': 'minecraft:cow'}|\r\n |effect|dict|含有状态效果名称和对应的[EffectType](../枚举值/EffectType.md)枚举,如`{'name': 'absorption', 'id': 22}`|\r\n |dimension|dict|含有维度名称和对应数字id,如`{'name': 'nether', 'id': 1}`|\r\n |biome|dict|含有生物群系名称和对应的[BiomeType](../枚举值/BiomeType.md)枚举,如`{'name': 'bamboo_jungle', 'biomeType': 48}`|\r\n |structure|dict|含有结构名称和对应的[StructureFeatureType](../枚举值/StructureFeatureType.md)枚举,如`{'name': 'ancient_city', 'structureType': 15}`|\r\n |enchant|dict|含有附魔名称和对应的[EnchantType](../枚举值/EnchantType.md)枚举,如`{'identifier': 'knockback', 'type': 12}`|", + "return": [], + "description": "自定义命令触发事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "command", - "type": "str", + "type": "str", + "name": "command", "description": "自定义命令名称,对应json中的name字段" - }, + }, { - "name": "args", - "type": "list(dict)", + "type": "list(dict)", + "name": "args", "description": "自定义命令参数,详情见下方" - }, + }, { - "name": "variant", - "type": "int", + "type": "int", + "name": "variant", "description": "表示是哪条变体,范围[0, 9],对应json中args键中的数字,未配置变体则为0" - }, + }, { - "name": "origin", - "type": "dict", + "type": "dict", + "name": "origin", "description": "触发源的信息,详情见下方" - }, + }, { - "name": "return_failed", - "type": "bool", + "type": "bool", + "name": "return_failed", "description": "设置自定义命令是否执行失败,默认为False,如果执行失败,返回信息以红色字体显示" - }, + }, { - "name": "return_msg_key", - "type": "str", + "type": "str", + "name": "return_msg_key", "description": "设置返回给玩家或命令方块的信息,也支持通过语言文件(.lang)定义,默认值为commands.custom.success(自定义命令执行成功)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "CustomCommandTriggerServerEvent" + }, { - "type": "event", - "name": "DelServerPlayerEvent", - "method": "", - "description": "触发时机:删除玩家时触发该事件。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "触发时机:删除玩家时触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "玩家id" - }, + }, { - "name": "isTransfer", - "type": "bool", + "type": "bool", + "name": "isTransfer", "description": "是否是切服时退出服务器,仅用于Apollo。如果是True,则表示切服时退出服务器;若是False,则表示退出网络游戏" - }, + }, { - "name": "uid", - "type": "int/long", + "type": "int/long", + "name": "uid", "description": "玩家的netease uid,玩家的唯一标识" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "DelServerPlayerEvent" + }, { - "type": "event", - "name": "EntityRemoveEvent", - "method": "", - "description": "实体被删除时触发", - "remark": "- 触发情景:实体从场景中被删除,例如:生物死亡,生物被[清除](https://minecraft.fandom.com/zh/wiki/%E7%94%9F%E6%88%90#.E6.B8.85.E9.99.A4),玩家退出游戏,船/盔甲架被破坏,掉落物/经验球被捡起或清除\r\n - 当生物随区块卸载时,不会触发该事件,而是ChunkAcquireDiscardedServerEvent事件\r\n - 关于生物的清除:当生物离玩家大于wiki所说的距离,并且还在玩家的模拟距离内时,会被清除。也就是说,如果玩家瞬间传送到远处,原处的生物马上离开了模拟距离,并不会被清除\r\n - 玩家退出游戏时,EntityRemoveEvent,DelServerPlayerEvent按顺序依次触发\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 触发情景:实体从场景中被删除,例如:生物死亡,生物被[清除](https://minecraft.fandom.com/zh/wiki/%E7%94%9F%E6%88%90#.E6.B8.85.E9.99.A4),玩家退出游戏,船/盔甲架被破坏,掉落物/经验球被捡起或清除\r\n - 当生物随区块卸载时,不会触发该事件,而是ChunkAcquireDiscardedServerEvent事件\r\n - 关于生物的清除:当生物离玩家大于wiki所说的距离,并且还在玩家的模拟距离内时,会被清除。也就是说,如果玩家瞬间传送到远处,原处的生物马上离开了模拟距离,并不会被清除\r\n - 玩家退出游戏时,EntityRemoveEvent,DelServerPlayerEvent按顺序依次触发\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "实体被删除时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityRemoveEvent" + }, { - "type": "event", - "name": "ExplosionServerEvent", - "method": "", - "description": "当发生爆炸时触发。", - "remark": "- 通过设置blocks中cancel的bool值为True可以将该方块的爆炸取消,例如(x,y,z,True)\r\n - 某些情况下爆炸创建者id为None,此时受伤实体id列表也为None,比如爬行者所造成的爆炸。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 通过设置blocks中cancel的bool值为True可以将该方块的爆炸取消,例如(x,y,z,True)\r\n - 某些情况下爆炸创建者id为None,此时受伤实体id列表也为None,比如爬行者所造成的爆炸。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "当发生爆炸时触发。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "blocks", - "type": "list[[x,y,z,cancel],...]", + "type": "list[[x,y,z,cancel],...]", + "name": "blocks", "description": "爆炸导致的被破坏方块坐标(x,y,z),cancel是一个bool值" - }, + }, { - "name": "victims", - "type": "list/None", + "type": "list/None", + "name": "victims", "description": "受伤实体id列表,当该爆炸创建者id为None时,victims也为None" - }, + }, { - "name": "sourceId", - "type": "str/None", + "type": "str/None", + "name": "sourceId", "description": "爆炸创建者id" - }, + }, { - "name": "explodePos", - "type": "list", + "type": "list", + "name": "explodePos", "description": "爆炸位置[x,y,z]" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ExplosionServerEvent" + }, { - "type": "event", - "name": "GameRenderTickEvent", - "method": "", - "description": "客户端渲染帧开始时触发该事件,一秒触发次数为当前的帧数", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "客户端渲染帧开始时触发该事件,一秒触发次数为当前的帧数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GameRenderTickEvent" + }, { - "type": "event", - "name": "GlobalCommandServerEvent", - "method": "", - "description": "服务端全局命令事件,包括聊天栏发送、SetCommand接口、命令方块(矿车)、行为包动画执行命令", - "remark": "- 有实体的事件参数例子:\r\n ```python\r\n {\r\n 'cancel' : False,\r\n 'entityId' : '-8589934591',\r\n 'command' : '/kill @e',\r\n 'dimension' : 0,\r\n 'blockPos' : (227,66,569)\r\n }\r\n ```\r\n - 命令方块(无实体)的事件参数例子:\r\n ```python\r\n {\r\n 'cancel' : False,\r\n 'command' : '/say I am a command_block',\r\n 'dimension' : 0,\r\n 'blockPos' : (226,64,579)\r\n }\r\n ```\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 有实体的事件参数例子:\r\n ```python\r\n {\r\n 'cancel' : False,\r\n 'entityId' : '-8589934591',\r\n 'command' : '/kill @e',\r\n 'dimension' : 0,\r\n 'blockPos' : (227,66,569)\r\n }\r\n ```\r\n - 命令方块(无实体)的事件参数例子:\r\n ```python\r\n {\r\n 'cancel' : False,\r\n 'command' : '/say I am a command_block',\r\n 'dimension' : 0,\r\n 'blockPos' : (226,64,579)\r\n }\r\n ```\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "服务端全局命令事件,包括聊天栏发送、SetCommand接口、命令方块(矿车)、行为包动画执行命令", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "执行命令的实体id, 如果没有此键,则是命令方块执行的命令" - }, + }, { - "name": "command", - "type": "str", + "type": "str", + "name": "command", "description": "将要被执行的命令" - }, + }, { - "name": "blockPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "blockPos", "description": "执行命令的实体或方块的方块坐标" - }, + }, { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "执行命令的实体或方块所在维度id" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设置为True可以取消命令执行" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "GlobalCommandServerEvent" + }, { - "type": "event", - "name": "LoadClientAddonScriptsAfter", - "method": "", - "description": "客户端加载mod完成事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "客户端加载mod完成事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "LoadClientAddonScriptsAfter" + }, { - "type": "event", - "name": "LoadServerAddonScriptsAfter", - "method": "", - "description": "服务器加载完mod时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "服务器加载完mod时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "LoadServerAddonScriptsAfter" + }, { - "type": "event", - "name": "NewOnEntityAreaEvent", - "method": "", - "description": "反注册感应区域", - "remark": "- 注册完感应区域后,需通过监听OnEntityAreaEvent或NewOnEntityAreaEvent事件来获取感应事件\r\n - 不支持长或宽大于2000格的区域。对于大范围区域,建议在脚本中每隔一段时间获取实体坐标判断来实现。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 注册完感应区域后,需通过监听OnEntityAreaEvent或NewOnEntityAreaEvent事件来获取感应事件\r\n - 不支持长或宽大于2000格的区域。对于大范围区域,建议在脚本中每隔一段时间获取实体坐标判断来实现。", + "return": [], + "description": "反注册感应区域", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" - }, + }, { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "需要反注册的感应区域名" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "NewOnEntityAreaEvent" + }, { - "type": "event", - "name": "OnCommandOutputClientEvent", - "method": "", - "description": "当command命令有成功消息输出时触发", - "remark": "- 部分命令在返回的时候没有命令名称,SetCommand接口需要showOutput参数为True时才会有返回", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 部分命令在返回的时候没有命令名称,SetCommand接口需要showOutput参数为True时才会有返回", + "return": [], + "description": "当command命令有成功消息输出时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "command", - "type": "str", + "type": "str", + "name": "command", "description": "命令名称" - }, + }, { - "name": "message", - "type": "str", + "type": "str", + "name": "message", "description": "命令返回的消息" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnCommandOutputClientEvent" + }, { - "type": "event", - "name": "OnCommandOutputServerEvent", - "method": "", - "description": "Command命令执行成功事件", - "remark": "- 部分命令在返回的时候没有命令名称,SetCommand接口需要showOutput参数为True时才会有返回", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 部分命令在返回的时候没有命令名称,SetCommand接口需要showOutput参数为True时才会有返回", + "return": [], + "description": "Command命令执行成功事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "command", - "type": "str", + "type": "str", + "name": "command", "description": "命令名称" - }, + }, { - "name": "message", - "type": "str", + "type": "str", + "name": "message", "description": "命令返回的消息" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnCommandOutputServerEvent" + }, { - "type": "event", - "name": "OnContainerFillLoottableServerEvent", - "method": "", - "description": "触发时机:随机奖励箱第一次打开根据loottable生成物品时", - "remark": "- 只有当dirty为True时才会重新读取item列表并生成对应的掉落物,如果不需要修改掉落结果的话请勿随意修改dirty值\r\n - 可疑的沙子也具有奖励箱性质,使用刷子刷可疑的沙子也会触发该事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 只有当dirty为True时才会重新读取item列表并生成对应的掉落物,如果不需要修改掉落结果的话请勿随意修改dirty值\r\n - 可疑的沙子也具有奖励箱性质,使用刷子刷可疑的沙子也会触发该事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:随机奖励箱第一次打开根据loottable生成物品时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "loottable", - "type": "str", + "type": "str", + "name": "loottable", "description": "奖励箱子所读取的loottable的json路径" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "打开奖励箱子的玩家的playerId" - }, + }, { - "name": "itemList", - "type": "list", + "type": "list", + "name": "itemList", "description": "掉落物品列表,每个元素为一个itemDict,格式可参考物品信息字典" - }, + }, { - "name": "dirty", - "type": "bool", + "type": "bool", + "name": "dirty", "description": "默认为False,如果需要修改掉落列表需将该值设为True" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnContainerFillLoottableServerEvent" + }, { - "type": "event", - "name": "OnLightningLevelChangeServerEvent", - "method": "", - "description": "打雷强度发生改变", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "打雷强度发生改变", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "oldLevel", - "type": "float", + "type": "float", + "name": "oldLevel", "description": "改变前的打雷强度" - }, + }, { - "name": "newLevel", - "type": "float", + "type": "float", + "name": "newLevel", "description": "改变后的打雷强度" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnLightningLevelChangeServerEvent" + }, { - "type": "event", - "name": "OnLocalLightningLevelChangeServerEvent", - "method": "", - "description": "独立维度天气打雷强度发生改变时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "独立维度天气打雷强度发生改变时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "oldLevel", - "type": "float", + "type": "float", + "name": "oldLevel", "description": "改变前的打雷强度" - }, + }, { - "name": "newLevel", - "type": "float", + "type": "float", + "name": "newLevel", "description": "改变后的打雷强度" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "独立天气维度id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnLocalLightningLevelChangeServerEvent" + }, { - "type": "event", - "name": "OnLocalPlayerStopLoading", - "method": "", - "description": "触发时机:玩家进入存档,出生点地形加载完成时触发。该事件触发时可以进行切换维度的操作。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "触发时机:玩家进入存档,出生点地形加载完成时触发。该事件触发时可以进行切换维度的操作。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "加载完成的玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnLocalPlayerStopLoading" + }, { - "type": "event", - "name": "OnLocalRainLevelChangeServerEvent", - "method": "", - "description": "独立维度天气下雨强度发生改变时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "独立维度天气下雨强度发生改变时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "oldLevel", - "type": "float", + "type": "float", + "name": "oldLevel", "description": "改变前的下雨强度" - }, + }, { - "name": "newLevel", - "type": "float", + "type": "float", + "name": "newLevel", "description": "改变后的下雨强度" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "独立天气维度id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnLocalRainLevelChangeServerEvent" + }, { - "type": "event", - "name": "OnRainLevelChangeServerEvent", - "method": "", - "description": "下雨强度发生改变", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "下雨强度发生改变", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "oldLevel", - "type": "float", + "type": "float", + "name": "oldLevel", "description": "改变前的下雨强度" - }, + }, { - "name": "newLevel", - "type": "float", + "type": "float", + "name": "newLevel", "description": "改变后的下雨强度" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnRainLevelChangeServerEvent" + }, { - "type": "event", - "name": "OnScriptTickClient", - "method": "", - "description": "客户端tick事件,1秒30次", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "客户端tick事件,1秒30次", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "OnScriptTickClient" + }, { - "type": "event", - "name": "OnScriptTickServer", - "method": "", - "description": "服务器tick时触发,1秒有30个tick", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "服务器tick时触发,1秒有30个tick", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "OnScriptTickServer" + }, { - "type": "event", - "name": "PlaceNeteaseLargeFeatureServerEvent", - "method": "", - "description": "触发时机:网易版大型结构即将生成时服务端抛出该事件。", - "remark": "- 1.使用PlaceNeteaseLargeFeature接口触发此事件时,可正常调用其他Mod SDK接口\r\n 2.使用自定义大型特征功能,配置Json的方式触发此事件时,调用其他Mod SDK接口将无法生效,强烈建议仅用于设置结构放置与否", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 1.使用PlaceNeteaseLargeFeature接口触发此事件时,可正常调用其他Mod SDK接口\r\n 2.使用自定义大型特征功能,配置Json的方式触发此事件时,调用其他Mod SDK接口将无法生效,强烈建议仅用于设置结构放置与否", + "return": [], + "description": "触发时机:网易版大型结构即将生成时服务端抛出该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "pos", - "type": "tuple", + "type": "tuple", + "name": "pos", "description": "中心结构放置坐标(x, z)" - }, + }, { - "name": "rot", - "type": "int", + "type": "int", + "name": "rot", "description": "中心结构顺时针旋转角度" - }, + }, { - "name": "depth", - "type": "int", + "type": "int", + "name": "depth", "description": "大型结构递归深度" - }, + }, { - "name": "centerPool", - "type": "str", + "type": "str", + "name": "centerPool", "description": "中心池的identifier" - }, + }, { - "name": "ignoreFitInContext", - "type": "bool", + "type": "bool", + "name": "ignoreFitInContext", "description": "是否允许生成过结构的地方是否可以继续生成结构" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设置为True时可阻止该大型结构的放置" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlaceNeteaseLargeFeatureServerEvent" + }, { - "type": "event", - "name": "PlaceNeteaseStructureFeatureEvent", - "method": "", - "description": "清空所有已添加Netease Structure Feature对PlaceNeteaseStructureFeatureEvent事件的脚本层监听", - "remark": "- **需要配合AddNeteaseFeatureWhiteList接口一同使用**\r\n 若在本监听事件中调用其他mod SDK接口将无法生效,强烈建议本事件仅用于设置结构放置与否\r\n 该事件只会在网易版结构放置时抛出\r\n structureName参数修改为不存在结构或者原生结构时,开发包会出现断言。\r\n\r\n\r\n\r\n### 相关接口\r\n\r\n\r\n### AddNeteaseFeatureWhiteList\r\n\r\nmethod in mod.server.component.featureCompServer.FeatureCompServer", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- **需要配合AddNeteaseFeatureWhiteList接口一同使用**\r\n 若在本监听事件中调用其他mod SDK接口将无法生效,强烈建议本事件仅用于设置结构放置与否\r\n 该事件只会在网易版结构放置时抛出\r\n structureName参数修改为不存在结构或者原生结构时,开发包会出现断言。\r\n\r\n\r\n\r\n### 相关接口\r\n\r\n\r\n### AddNeteaseFeatureWhiteList\r\n\r\nmethod in mod.server.component.featureCompServer.FeatureCompServer", + "return": [], + "description": "清空所有已添加Netease Structure Feature对PlaceNeteaseStructureFeatureEvent事件的脚本层监听", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "PlaceNeteaseStructureFeatureEvent" + }, { - "type": "event", - "name": "PlayerIntendLeaveServerEvent", - "method": "", - "description": "触发时机:即将删除玩家时触发该事件,此时可以通过各种API获取玩家的当前状态。", - "remark": "- 与【DelServerPlayerEvent】事件不同,此时可以通过各种API获取玩家的当前状态。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 与【DelServerPlayerEvent】事件不同,此时可以通过各种API获取玩家的当前状态。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:即将删除玩家时触发该事件,此时可以通过各种API获取玩家的当前状态。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerIntendLeaveServerEvent" + }, { - "type": "event", - "name": "PlayerJoinMessageEvent", - "method": "", - "description": "触发时机:准备显示“xxx加入游戏”的玩家登录提示文字时服务端抛出的事件。", - "remark": "- 对于联机类游戏(如联机大厅、网络游戏等),请勿在此事件的回调函数中使用SetFootPos接口修改玩家的位置,否则可能会因为触发服务端反作弊机制而传送失败。如需要在进入游戏时使用SetFootPos接口,建议监听AddServerPlayerEvent并设置位置。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 对于联机类游戏(如联机大厅、网络游戏等),请勿在此事件的回调函数中使用SetFootPos接口修改玩家的位置,否则可能会因为触发服务端反作弊机制而传送失败。如需要在进入游戏时使用SetFootPos接口,建议监听AddServerPlayerEvent并设置位置。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:准备显示“xxx加入游戏”的玩家登录提示文字时服务端抛出的事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "玩家实体id" - }, + }, { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "玩家昵称" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否显示提示文字,允许修改。True:不显示提示" - }, + }, { - "name": "message", - "type": "str", + "type": "str", + "name": "message", "description": "玩家加入游戏的提示文字,允许修改" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerJoinMessageEvent" + }, { - "type": "event", - "name": "PlayerLeftMessageServerEvent", - "method": "", - "description": "触发时机:准备显示“xxx离开游戏”的玩家离开提示文字时服务端抛出的事件。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "触发时机:准备显示“xxx离开游戏”的玩家离开提示文字时服务端抛出的事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "玩家实体id" - }, + }, { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "玩家昵称" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否显示提示文字,允许修改。True:不显示提示" - }, + }, { - "name": "message", - "type": "str", + "type": "str", + "name": "message", "description": "玩家离开游戏的提示文字,允许修改" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerLeftMessageServerEvent" + }, { - "type": "event", - "name": "PrimaryClientSyncSkinClientEvent", - "method": "", - "description": "主客户端自己更换了皮肤触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "主客户端自己更换了皮肤触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "PrimaryClientSyncSkinClientEvent" + }, { - "type": "event", - "name": "RemoveEntityClientEvent", - "method": "", - "description": "客户端侧实体被移除时触发", - "remark": "- 客户端接收到了服务端监测实体离开玩家视野时触发,原事件名 RemoveEntityPacketEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 客户端接收到了服务端监测实体离开玩家视野时触发,原事件名 RemoveEntityPacketEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "客户端侧实体被移除时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "移除的实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "RemoveEntityClientEvent" + }, { - "type": "event", - "name": "RemovePlayerAOIClientEvent", - "method": "", - "description": "玩家离开当前玩家视野时触发的事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "玩家离开当前玩家视野时触发的事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "RemovePlayerAOIClientEvent" + }, { - "type": "event", - "name": "ServerChatEvent", - "method": "", - "description": "玩家发送聊天信息时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "玩家发送聊天信息时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "username", - "type": "str", + "type": "str", + "name": "username", "description": "玩家名称" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "message", - "type": "str", + "type": "str", + "name": "message", "description": "玩家发送的聊天消息内容" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消这个聊天事件,若取消可以设置为True" - }, + }, { - "name": "bChatById", - "type": "bool", + "type": "bool", + "name": "bChatById", "description": "是否把聊天消息发送给指定在线玩家,而不是广播给所有在线玩家,若只发送某些玩家可以设置为True" - }, + }, { - "name": "bForbid", - "type": "bool", + "type": "bool", + "name": "bForbid", "description": "是否禁言,仅apollo可用。true:被禁言,玩家聊天会提示“你已被管理员禁言”。" - }, + }, { - "name": "toPlayerIds", - "type": "list(str)", + "type": "list(str)", + "name": "toPlayerIds", "description": "接收聊天消息的玩家id列表,bChatById为True时生效" - }, + }, { - "name": "gameChatPrefix", - "type": "str", + "type": "str", + "name": "gameChatPrefix", "description": "设置当前玩家在网易聊天界面中的前缀,字数限制4,从字符串头部开始取。前缀文本输入非字符串格式时会被置为空。若cancel为True,会取消掉本次的前缀修改" - }, + }, { - "name": "gameChatPrefixColorR", - "type": "float", + "type": "float", + "name": "gameChatPrefixColorR", "description": "设置当前玩家在网易聊天界面中前缀颜色rgb的r值,范围为[0,1]。颜色数值输入其他格式时会被置为0。若cancel为True,会取消掉本次的颜色修改" - }, + }, { - "name": "gameChatPrefixColorG", - "type": "float", + "type": "float", + "name": "gameChatPrefixColorG", "description": "设置当前玩家在网易聊天界面中前缀颜色rgb的g值,范围为[0,1]。颜色数值输入其他格式时会被置为0。若cancel为True,会取消掉本次的颜色修改" - }, + }, { - "name": "gameChatPrefixColorB", - "type": "float", + "type": "float", + "name": "gameChatPrefixColorB", "description": "设置当前玩家在网易聊天界面中前缀颜色rgb的b值,范围为[0,1]。颜色数值输入其他格式时会被置为0。若cancel为True,会取消掉本次的颜色修改" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ServerChatEvent" + }, { - "type": "event", - "name": "ServerPostBlockPatternEvent", - "method": "", - "description": "触发时机:用方块组合生成生物,生成生物之后触发该事件。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "触发时机:用方块组合生成生物,生成生物之后触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生成生物的id" - }, + }, { - "name": "entityGenerated", - "type": "str", + "type": "str", + "name": "entityGenerated", "description": "生成生物的名字,如\"minecraft:pig\"" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ServerPostBlockPatternEvent" + }, { - "type": "event", - "name": "ServerPreBlockPatternEvent", - "method": "", - "description": "触发时机:用方块组合生成生物,在放置最后一个组成方块时触发该事件。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "", + "return": [], + "description": "触发时机:用方块组合生成生物,在放置最后一个组成方块时触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否允许继续生成。若设为False,可阻止生成生物" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "entityWillBeGenerated", - "type": "str", + "type": "str", + "name": "entityWillBeGenerated", "description": "即将生成生物的名字,如\"minecraft:pig\"" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ServerPreBlockPatternEvent" + }, { - "type": "event", - "name": "ServerSpawnMobEvent", - "method": "", - "description": "游戏内自动生成生物,以及使用api生成生物时触发", - "remark": "- 如果通过MOD API生成,identifier命名空间为custom。如果需要屏蔽原版的生物生成,可以判断identifier命名空间不为custom时设置cancel为True\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "remark": "- 如果通过MOD API生成,identifier命名空间为custom。如果需要屏蔽原版的生物生成,可以判断identifier命名空间不为custom时设置cancel为True\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "游戏内自动生成生物,以及使用api生成生物时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "identifier", - "type": "str", + "type": "str", + "name": "identifier", "description": "生成实体的命名空间" - }, + }, { - "name": "type", - "type": "int", + "type": "int", + "name": "type", "description": "生成实体的类型,参考[EntityType](../枚举值/EntityType.md)" - }, + }, { - "name": "baby", - "type": "bool", + "type": "bool", + "name": "baby", "description": "生成怪物是否是幼年怪" - }, + }, { - "name": "x", - "type": "float", + "type": "float", + "name": "x", "description": "生成实体坐标x" - }, + }, { - "name": "y", - "type": "float", + "type": "float", + "name": "y", "description": "生成实体坐标y" - }, + }, { - "name": "z", - "type": "float", + "type": "float", + "name": "z", "description": "生成实体坐标z" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "生成实体的维度,默认值为0(0为主世界,1为地狱,2为末地)" - }, + }, { - "name": "realIdentifier", - "type": "str", + "type": "str", + "name": "realIdentifier", "description": "生成实体的命名空间,通过MOD API生成的生物在这个参数也能获取到真正的命名空间,而不是以custom开头的" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消生成该实体" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ServerSpawnMobEvent" + }, { - "type": "event", - "name": "UnLoadClientAddonScriptsBefore", - "method": "", - "description": "客户端卸载mod之前触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "客户端卸载mod之前触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/世界.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "UnLoadClientAddonScriptsBefore" + }, { - "type": "event", - "name": "世界", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "世界" + }, { - "type": "event", - "name": "实体", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "实体" + }, { - "type": "event", - "name": "玩家", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "玩家" + }, { - "type": "event", - "name": "方块", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "方块" + }, { - "type": "event", - "name": "物品", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "物品" + }, { - "type": "event", - "name": "模型", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "模型" + }, { - "type": "event", - "name": "UI", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "UI" + }, { - "type": "event", - "name": "音效", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "音效" + }, { - "type": "event", - "name": "控制", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "控制" + }, { - "type": "event", - "name": "联机大厅", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/事件索引表.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "联机大厅" + }, { - "type": "event", - "name": "ActorHurtServerEvent", - "method": "", - "description": "触发时机:生物(包括玩家)受伤时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "触发时机:生物(包括玩家)受伤时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物Id" - }, + }, { - "name": "cause", - "type": "str", + "type": "str", + "name": "cause", "description": "伤害来源,详见Minecraft枚举值文档的[ActorDamageCause](../枚举值/ActorDamageCause.md)" - }, + }, { - "name": "damage", - "type": "float", + "type": "float", + "name": "damage", "description": "伤害值(被伤害吸收后的值),不可修改" - }, + }, { - "name": "absorbedDamage", - "type": "int", + "type": "int", + "name": "absorbedDamage", "description": "被伤害吸收效果吸收的伤害值" - }, + }, { - "name": "customTag", - "type": "str", + "type": "str", + "name": "customTag", "description": "使用[Hurt接口](../接口/实体/行为.md#hurt)传入的自定义伤害类型" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ActorHurtServerEvent" + }, { - "type": "event", - "name": "ActuallyHurtServerEvent", - "method": "", - "description": "实体实际受到伤害时触发,相比于DamageEvent,该伤害为经过护甲及buff计算后,实际的扣血量", - "remark": "- 药水与状态效果造成的伤害不触发,可以使用ActorHurtServerEvent\r\n - 为了游戏运行效率请尽可能避免将火的伤害设置为0,因为这样会导致大量触发该事件。\r\n - 若要修改damage的值,请确保修改后的值与原值不同,且支持转换为浮点型,否则引擎会忽略这次修改。\r\n - 青蛙、山羊跳跃落地时也会触发此伤害事件,但它们的掉落伤害实际会有减免,青蛙减少5,山羊减少10\r\n - 在无懈可击时间内,只要实体受到高于上次受击的伤害,可以连续触发不受SetHurtCD影响,如实体连续受到1伤害,如果在本事件中修改damage为0.5,则引擎会认为每次都有0.5的溢出伤害,可以通过invulnerableTime和lastHurt来判断是否取消这次伤害\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 药水与状态效果造成的伤害不触发,可以使用ActorHurtServerEvent\r\n - 为了游戏运行效率请尽可能避免将火的伤害设置为0,因为这样会导致大量触发该事件。\r\n - 若要修改damage的值,请确保修改后的值与原值不同,且支持转换为浮点型,否则引擎会忽略这次修改。\r\n - 青蛙、山羊跳跃落地时也会触发此伤害事件,但它们的掉落伤害实际会有减免,青蛙减少5,山羊减少10\r\n - 在无懈可击时间内,只要实体受到高于上次受击的伤害,可以连续触发不受SetHurtCD影响,如实体连续受到1伤害,如果在本事件中修改damage为0.5,则引擎会认为每次都有0.5的溢出伤害,可以通过invulnerableTime和lastHurt来判断是否取消这次伤害\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "实体实际受到伤害时触发,相比于DamageEvent,该伤害为经过护甲及buff计算后,实际的扣血量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "srcId", - "type": "str", + "type": "str", + "name": "srcId", "description": "伤害源id" - }, + }, { - "name": "projectileId", - "type": "str", + "type": "str", + "name": "projectileId", "description": "投射物id" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "被伤害id" - }, + }, { - "name": "damage", - "type": "float", + "type": "float", + "name": "damage", "description": "伤害值(被伤害吸收后的值),允许修改,设置为0则此次造成的伤害为0,若设置数值和原来一样则视为没有修改" - }, + }, { - "name": "invulnerableTime", - "type": "int", + "type": "int", + "name": "invulnerableTime", "description": "实体受击后,剩余的无懈可击帧数,在无懈可击时间内,damage和damage_f为超过上次伤害的部分" - }, + }, { - "name": "lastHurt", - "type": "float", + "type": "float", + "name": "lastHurt", "description": "实体上次受到的伤害" - }, + }, { - "name": "cause", - "type": "str", + "type": "str", + "name": "cause", "description": "伤害来源,详见Minecraft枚举值文档的[ActorDamageCause](../枚举值/ActorDamageCause.md)" - }, + }, { - "name": "customTag", - "type": "str", + "type": "str", + "name": "customTag", "description": "使用[Hurt接口](../接口/实体/行为.md#hurt)传入的自定义伤害类型" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ActuallyHurtServerEvent" + }, { - "type": "event", - "name": "AddEffectServerEvent", - "method": "", - "description": "触发时机:实体获得状态效果时", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "触发时机:实体获得状态效果时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "effectName", - "type": "str", + "type": "str", + "name": "effectName", "description": "实体获得状态效果的名字" - }, + }, { - "name": "effectDuration", - "type": "int", + "type": "int", + "name": "effectDuration", "description": "状态效果的持续时间,单位秒" - }, + }, { - "name": "effectAmplifier", - "type": "int", + "type": "int", + "name": "effectAmplifier", "description": "状态效果的放大倍数" - }, + }, { - "name": "damage", - "type": "float", + "type": "float", + "name": "damage", "description": "状态造成的伤害值(真实扣除生命值的量)。只有持续时间为0时有用" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "AddEffectServerEvent" + }, { - "type": "event", - "name": "ApproachEntityClientEvent", - "method": "", - "description": "玩家靠近生物时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "玩家靠近生物时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "靠近的生物实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ApproachEntityClientEvent" + }, { - "type": "event", - "name": "ChangeSwimStateServerEvent", - "method": "", - "description": "触发时机:实体开始或者结束游泳时", - "remark": "- 当实体的状态没有变化时,不会触发此事件,即formState和toState必定一真一假\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 当实体的状态没有变化时,不会触发此事件,即formState和toState必定一真一假\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:实体开始或者结束游泳时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体的唯一ID" - }, + }, { - "name": "formState", - "type": "bool", + "type": "bool", + "name": "formState", "description": "事件触发前,实体是否在游泳状态" - }, + }, { - "name": "toState", - "type": "bool", + "type": "bool", + "name": "toState", "description": "事件触发后,实体是否在游泳状态" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ChangeSwimStateServerEvent" + }, { - "type": "event", - "name": "DamageEvent", - "method": "", - "description": "实体受到伤害时触发", - "remark": "- damage值会被护甲和absorption等吸收,不一定是最终扣血量。通过设置这个伤害值可以取消伤害,但不会取消由击退效果或者点燃效果带来的伤害\r\n - 该事件在实体受伤之前触发,由于部分伤害是在tick中处理,因此持续触发受伤时(如站在火中)会每帧触发事件(可以使用ActorHurtServerEvent来避免)。\r\n - 这里的damage是伤害源具有的攻击伤害值,并非实体真实的扣血量,如果需要获取真实伤害,可以使用ActuallyHurtServerEvent事件。\r\n - 当目标无法被击退时,knock值无效\r\n - 药水与状态效果造成的伤害不触发,可以使用ActorHurtServerEvent\r\n - 由于点燃的实现原因,此处ignite设置为false并不能取消实体的点燃效果(如果需要取消点燃效果,请通过OnFireHurtEvent事件实现)\r\n - 青蛙、山羊跳跃落地时也会触发此伤害事件,但它们的掉落伤害实际会有减免,青蛙减少5,山羊减少10\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- damage值会被护甲和absorption等吸收,不一定是最终扣血量。通过设置这个伤害值可以取消伤害,但不会取消由击退效果或者点燃效果带来的伤害\r\n - 该事件在实体受伤之前触发,由于部分伤害是在tick中处理,因此持续触发受伤时(如站在火中)会每帧触发事件(可以使用ActorHurtServerEvent来避免)。\r\n - 这里的damage是伤害源具有的攻击伤害值,并非实体真实的扣血量,如果需要获取真实伤害,可以使用ActuallyHurtServerEvent事件。\r\n - 当目标无法被击退时,knock值无效\r\n - 药水与状态效果造成的伤害不触发,可以使用ActorHurtServerEvent\r\n - 由于点燃的实现原因,此处ignite设置为false并不能取消实体的点燃效果(如果需要取消点燃效果,请通过OnFireHurtEvent事件实现)\r\n - 青蛙、山羊跳跃落地时也会触发此伤害事件,但它们的掉落伤害实际会有减免,青蛙减少5,山羊减少10\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "实体受到伤害时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "srcId", - "type": "str", + "type": "str", + "name": "srcId", "description": "伤害源id" - }, + }, { - "name": "projectileId", - "type": "str", + "type": "str", + "name": "projectileId", "description": "投射物id" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "被伤害id" - }, + }, { - "name": "damage", - "type": "float", + "type": "float", + "name": "damage", "description": "伤害值(被伤害吸收前的值),允许修改,设置为0则此次造成的伤害为0" - }, + }, { - "name": "absorption", - "type": "int", + "type": "int", + "name": "absorption", "description": "受到伤害时,扣除黄心前,实体拥有的黄心血量(见[AttrType枚举](../枚举值/AttrType.md)的ABSORPTION)" - }, + }, { - "name": "cause", - "type": "str", + "type": "str", + "name": "cause", "description": "伤害来源,详见Minecraft枚举值文档的[ActorDamageCause](../枚举值/ActorDamageCause.md)" - }, + }, { - "name": "knock", - "type": "bool", + "type": "bool", + "name": "knock", "description": "是否击退被攻击者,允许修改,设置该值为False则不产生击退" - }, + }, { - "name": "ignite", - "type": "bool", + "type": "bool", + "name": "ignite", "description": "是否点燃被伤害者,允许修改,设置该值为True产生点燃效果" - }, + }, { - "name": "customTag", - "type": "str", + "type": "str", + "name": "customTag", "description": "使用[Hurt接口](../接口/实体/行为.md#hurt)传入的自定义伤害类型" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "DamageEvent" + }, { - "type": "event", - "name": "EntityChangeDimensionServerEvent", - "method": "", - "description": "实体维度改变时服务端抛出", - "remark": "- 实体转移维度时,如果对应维度的对应位置的区块尚未加载,实体会缓存在维度自身的缓冲区中,直到对应区块被加载时才会创建对应的实体,此事件的抛出只代表实体从原维度消失,不代表必定会在对应维度出现\r\n - 注意,玩家维度改变时不触发该事件,而是会触发DimensionChangeServerEvent事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 实体转移维度时,如果对应维度的对应位置的区块尚未加载,实体会缓存在维度自身的缓冲区中,直到对应区块被加载时才会创建对应的实体,此事件的抛出只代表实体从原维度消失,不代表必定会在对应维度出现\r\n - 注意,玩家维度改变时不触发该事件,而是会触发DimensionChangeServerEvent事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "实体维度改变时服务端抛出", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "fromDimensionId", - "type": "int", + "type": "int", + "name": "fromDimensionId", "description": "维度改变前的维度" - }, + }, { - "name": "toDimensionId", - "type": "int", + "type": "int", + "name": "toDimensionId", "description": "维度改变后的维度" - }, + }, { - "name": "fromX", - "type": "float", + "type": "float", + "name": "fromX", "description": "改变前的位置x" - }, + }, { - "name": "fromY", - "type": "float", + "type": "float", + "name": "fromY", "description": "改变前的位置Y" - }, + }, { - "name": "fromZ", - "type": "float", + "type": "float", + "name": "fromZ", "description": "改变前的位置Z" - }, + }, { - "name": "toX", - "type": "float", + "type": "float", + "name": "toX", "description": "改变后的位置x" - }, + }, { - "name": "toY", - "type": "float", + "type": "float", + "name": "toY", "description": "改变后的位置Y" - }, + }, { - "name": "toZ", - "type": "float", + "type": "float", + "name": "toZ", "description": "改变后的位置Z" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityChangeDimensionServerEvent" + }, { - "type": "event", - "name": "EntityDefinitionsEventServerEvent", - "method": "", - "description": "触发时机:生物定义json文件中设置的event触发时同时触发。生物行为变更事件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "触发时机:生物定义json文件中设置的event触发时同时触发。生物行为变更事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物id" - }, + }, { - "name": "eventName", - "type": "str", + "type": "str", + "name": "eventName", "description": "触发的事件名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityDefinitionsEventServerEvent" + }, { - "type": "event", - "name": "EntityDieLoottableAfterServerEvent", - "method": "", - "description": "触发时机:生物死亡掉落物品之后", - "remark": "- 该事件为生物死亡掉落物品生成后触发,可以得到掉落物的id列表,如果需要更改掉落物,请使用EntityDieLoottableServerEvent\r\n - 该事件在生物死亡后会触发,无论是否掉落物品,因此掉落物品列表可能存在为空的情况\r\n - 掉落物不包含玩家或生物携带以及背包内的物品,若要获取死亡后由背包扔出的物品请参考EntityDroppedItemServerEvent事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 该事件为生物死亡掉落物品生成后触发,可以得到掉落物的id列表,如果需要更改掉落物,请使用EntityDieLoottableServerEvent\r\n - 该事件在生物死亡后会触发,无论是否掉落物品,因此掉落物品列表可能存在为空的情况\r\n - 掉落物不包含玩家或生物携带以及背包内的物品,若要获取死亡后由背包扔出的物品请参考EntityDroppedItemServerEvent事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:生物死亡掉落物品之后", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "dieEntityId", - "type": "str", + "type": "str", + "name": "dieEntityId", "description": "死亡实体的entityId" - }, + }, { - "name": "attacker", - "type": "str", + "type": "str", + "name": "attacker", "description": "伤害来源的entityId" - }, + }, { - "name": "itemList", - "type": "list(dict)", + "type": "list(dict)", + "name": "itemList", "description": "掉落物品列表,每个元素为一个itemDict,格式可参考物品信息字典" - }, + }, { - "name": "itemEntityIdList", - "type": "list(str)", + "type": "list(str)", + "name": "itemEntityIdList", "description": "掉落物品entityId列表" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityDieLoottableAfterServerEvent" + }, { - "type": "event", - "name": "EntityDieLoottableServerEvent", - "method": "", - "description": "触发时机:生物死亡掉落物品时", - "remark": "- 只有当dirty为True时才会重新读取item列表并生成对应的掉落物,如果不需要修改掉落结果的话请勿随意修改dirty值\r\n - 该事件在生物死亡后会触发,无论是否掉落物品,因此掉落物品列表可能存在为空的情况\r\n - 掉落物不包含玩家或生物携带以及背包内的物品,若要获取死亡后由背包扔出的物品请参考EntityDroppedItemServerEvent事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 只有当dirty为True时才会重新读取item列表并生成对应的掉落物,如果不需要修改掉落结果的话请勿随意修改dirty值\r\n - 该事件在生物死亡后会触发,无论是否掉落物品,因此掉落物品列表可能存在为空的情况\r\n - 掉落物不包含玩家或生物携带以及背包内的物品,若要获取死亡后由背包扔出的物品请参考EntityDroppedItemServerEvent事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:生物死亡掉落物品时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "dieEntityId", - "type": "str", + "type": "str", + "name": "dieEntityId", "description": "死亡实体的entityId" - }, + }, { - "name": "attacker", - "type": "str", + "type": "str", + "name": "attacker", "description": "伤害来源的entityId" - }, + }, { - "name": "itemList", - "type": "list(dict)", + "type": "list(dict)", + "name": "itemList", "description": "掉落物品列表,每个元素为一个itemDict,格式可参考物品信息字典" - }, + }, { - "name": "dirty", - "type": "bool", + "type": "bool", + "name": "dirty", "description": "默认为False,如果需要修改掉落列表需将该值设为True" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityDieLoottableServerEvent" + }, { - "type": "event", - "name": "EntityDroppedItemServerEvent", - "method": "", - "description": "触发时机:生物扔出物品时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "触发时机:生物扔出物品时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物Id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "扔出的物品的物品信息字典" - }, + }, { - "name": "itemEntityId", - "type": "str", + "type": "str", + "name": "itemEntityId", "description": "物品实体Id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityDroppedItemServerEvent" + }, { - "type": "event", - "name": "EntityEffectDamageServerEvent", - "method": "", - "description": "生物受到状态伤害/回复事件。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "生物受到状态伤害/回复事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "damage", - "type": "float", + "type": "float", + "name": "damage", "description": "伤害值(伤害吸收后实际扣血量),负数表示生命回复量" - }, + }, { - "name": "attributeBuffType", - "type": "int", + "type": "int", + "name": "attributeBuffType", "description": "状态类型,参考[AttributeBuffType](../枚举值/AttributeBuffType.md)" - }, + }, { - "name": "duration", - "type": "float", + "type": "float", + "name": "duration", "description": "状态持续时间,单位秒(s)" - }, + }, { - "name": "lifeTimer", - "type": "float", + "type": "float", + "name": "lifeTimer", "description": "状态生命时间,单位秒(s)" - }, + }, { - "name": "isInstantaneous", - "type": "bool", + "type": "bool", + "name": "isInstantaneous", "description": "是否为立即生效状态" - }, + }, { - "name": "cause", - "type": "str", + "type": "str", + "name": "cause", "description": "伤害来源,详见Minecraft枚举值文档的[ActorDamageCause](../枚举值/ActorDamageCause.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityEffectDamageServerEvent" + }, { - "type": "event", - "name": "EntityLoadScriptEvent", - "method": "", - "description": "数据库加载实体自定义数据时触发", - "remark": "- 只有使用过extraData组件的SetExtraData接口的实体才有此事件,触发时可以通过extraData组件的GetExtraData或GetWholeExtraData接口获取该实体的自定义数据", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 只有使用过extraData组件的SetExtraData接口的实体才有此事件,触发时可以通过extraData组件的GetExtraData或GetWholeExtraData接口获取该实体的自定义数据", + "return": [], + "description": "数据库加载实体自定义数据时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "args", - "type": "list", + "type": "list", + "name": "args", "description": "该事件的参数为长度为2的list,而非dict,其中list的第一个元素为实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityLoadScriptEvent" + }, { - "type": "event", - "name": "EntityModelChangedClientEvent", - "method": "", - "description": "触发时机:实体模型切换时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "触发时机:实体模型切换时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "newModel", - "type": "str", + "type": "str", + "name": "newModel", "description": "新的模型名字" - }, + }, { - "name": "oldModel", - "type": "str", + "type": "str", + "name": "oldModel", "description": "原来的模型名字" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "EntityModelChangedClientEvent" + }, { - "type": "event", - "name": "EntityMotionStartServerEvent", - "method": "", - "description": "实体运动器开始事件。实体(包含玩家)添加运动器后,运动器开始运行时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "实体运动器开始事件。实体(包含玩家)添加运动器后,运动器开始运行时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "运动器id" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityMotionStartServerEvent" + }, { - "type": "event", - "name": "EntityMotionStopServerEvent", - "method": "", - "description": "实体运动器停止事件。实体(包含玩家)添加运动器并开始运行后,运动器自动停止时触发", - "remark": "- 注意:该事件触发表示运动器播放顺利完成,手动调用的[StopEntityMotion](../接口/实体/行为.md#StopEntityMotion)、[RemoveEntityMotion](../接口/实体/行为.md#RemoveEntityMotion)以及实体被销毁导致的运动器停止不会触发该事件。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 注意:该事件触发表示运动器播放顺利完成,手动调用的[StopEntityMotion](../接口/实体/行为.md#StopEntityMotion)、[RemoveEntityMotion](../接口/实体/行为.md#RemoveEntityMotion)以及实体被销毁导致的运动器停止不会触发该事件。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "实体运动器停止事件。实体(包含玩家)添加运动器并开始运行后,运动器自动停止时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "运动器id" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "remove", - "type": "bool", + "type": "bool", + "name": "remove", "description": "是否移除该运动器,设置为False则保留,默认为True,即运动器停止后自动移除,该参数设置只对非玩家实体有效" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityMotionStopServerEvent" + }, { - "type": "event", - "name": "EntityPickupItemServerEvent", - "method": "", - "description": "有minecraft:behavior.pickup_items行为的生物拾取物品时触发该事件,例如村民拾取面包、猪灵拾取金锭", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "有minecraft:behavior.pickup_items行为的生物拾取物品时触发该事件,例如村民拾取面包、猪灵拾取金锭", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物Id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "拾取的物品的物品信息字典" - }, + }, { - "name": "secondaryActor", - "type": "str", + "type": "str", + "name": "secondaryActor", "description": "物品给予者id(一般是玩家),如果不存在给予者的话,这里为空字符串" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityPickupItemServerEvent" + }, { - "type": "event", - "name": "EntityStartRidingEvent", - "method": "", - "description": "当实体骑乘上另一个实体时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "当实体骑乘上另一个实体时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "乘骑者实体id" - }, + }, { - "name": "rideId", - "type": "str", + "type": "str", + "name": "rideId", "description": "被乘骑者实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityStartRidingEvent" + }, { - "type": "event", - "name": "EntityStopRidingEvent", - "method": "", - "description": "触发时机:当实体停止骑乘时", - "remark": "- 以下情况不允许取消\r\n 1. ride组件StopEntityRiding接口\r\n 2. 玩家传送时\r\n 3. 坐骑死亡时\r\n 4. 玩家睡觉时\r\n 5. 玩家死亡时\r\n 6. 未驯服的马\r\n 7. 怕水的生物坐骑进入水里\r\n 8. 切换维度\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 以下情况不允许取消\r\n 1. ride组件StopEntityRiding接口\r\n 2. 玩家传送时\r\n 3. 坐骑死亡时\r\n 4. 玩家睡觉时\r\n 5. 玩家死亡时\r\n 6. 未驯服的马\r\n 7. 怕水的生物坐骑进入水里\r\n 8. 切换维度\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:当实体停止骑乘时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" - }, + }, { - "name": "rideId", - "type": "str", + "type": "str", + "name": "rideId", "description": "坐骑id" - }, + }, { - "name": "exitFromRider", - "type": "bool", + "type": "bool", + "name": "exitFromRider", "description": "是否下坐骑" - }, + }, { - "name": "entityIsBeingDestroyed", - "type": "bool", + "type": "bool", + "name": "entityIsBeingDestroyed", "description": "坐骑是否将要销毁" - }, + }, { - "name": "switchingRides", - "type": "bool", + "type": "bool", + "name": "switchingRides", "description": "是否换乘坐骑" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设置为True可以取消(需要与服务端事件一同取消)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "EntityStopRidingEvent" + }, { - "type": "event", - "name": "EntityTickServerEvent", - "method": "", - "description": "添加实体类型到EntityTickServerEvent事件的触发白名单。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "添加实体类型到EntityTickServerEvent事件的触发白名单。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "identifier", - "type": "str", + "type": "str", + "name": "identifier", "description": "实体的类型名,原版的实体需要加上minecraft命名空间" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityTickServerEvent" + }, { - "type": "event", - "name": "HealthChangeBeforeServerEvent", - "method": "", - "description": "生物生命值发生变化之前触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "生物生命值发生变化之前触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "from", - "type": "float", + "type": "float", + "name": "from", "description": "变化前的生命值" - }, + }, { - "name": "to", - "type": "float", + "type": "float", + "name": "to", "description": "将要变化到的生命值,cancel设置为True时可以取消该变化,但是此参数不变" - }, + }, { - "name": "byScript", - "type": "bool", + "type": "bool", + "name": "byScript", "description": "是否通过SetAttrValue或SetAttrMaxValue调用产生的变化" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消该变化" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "HealthChangeBeforeServerEvent" + }, { - "type": "event", - "name": "HealthChangeClientEvent", - "method": "", - "description": "生物生命值发生变化时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "生物生命值发生变化时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "from", - "type": "float", + "type": "float", + "name": "from", "description": "变化前的生命值" - }, + }, { - "name": "to", - "type": "float", + "type": "float", + "name": "to", "description": "变化后的生命值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HealthChangeClientEvent" + }, { - "type": "event", - "name": "HealthChangeServerEvent", - "method": "", - "description": "生物生命值发生变化时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "生物生命值发生变化时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "from", - "type": "float", + "type": "float", + "name": "from", "description": "变化前的生命值" - }, + }, { - "name": "to", - "type": "float", + "type": "float", + "name": "to", "description": "变化后的生命值" - }, + }, { - "name": "byScript", - "type": "bool", + "type": "bool", + "name": "byScript", "description": "是否通过SetAttrValue或SetAttrMaxValue调用产生的变化" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "HealthChangeServerEvent" + }, { - "type": "event", - "name": "LeaveEntityClientEvent", - "method": "", - "description": "玩家远离生物时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "玩家远离生物时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "远离的生物实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "LeaveEntityClientEvent" + }, { - "type": "event", - "name": "MobDieEvent", - "method": "", - "description": "实体死亡时触发", - "remark": "- 注意:不能在该事件回调中对此玩家手持物品进行修改,如[SpawnItemToPlayerCarried](../接口/玩家/背包.md#spawnitemtoplayercarried)、[ChangePlayerItemTipsAndExtraId](../接口/玩家/背包.md#changeplayeritemtipsandextraId)等接口\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 注意:不能在该事件回调中对此玩家手持物品进行修改,如[SpawnItemToPlayerCarried](../接口/玩家/背包.md#spawnitemtoplayercarried)、[ChangePlayerItemTipsAndExtraId](../接口/玩家/背包.md#changeplayeritemtipsandextraId)等接口\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "实体死亡时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" - }, + }, { - "name": "attacker", - "type": "str", + "type": "str", + "name": "attacker", "description": "伤害来源id" - }, + }, { - "name": "cause", - "type": "str", + "type": "str", + "name": "cause", "description": "伤害来源,详见Minecraft枚举值文档的[ActorDamageCause](../枚举值/ActorDamageCause.md)" - }, + }, { - "name": "customTag", - "type": "str", + "type": "str", + "name": "customTag", "description": "使用[Hurt接口](../接口/实体/行为.md#hurt)传入的自定义伤害类型" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "MobDieEvent" + }, { - "type": "event", - "name": "MobGriefingBlockServerEvent", - "method": "", - "description": "环境生物改变方块时触发,触发的时机与mobgriefing游戏规则影响的行为相同", - "remark": "- 触发的时机包括:生物踩踏耕地、破坏单个方块、破门、火矢点燃方块、凋灵boss破坏方块、末影龙破坏方块、末影人捡起方块、蠹虫破坏被虫蚀的方块、蠹虫把方块变成被虫蚀的方块、凋零杀死生物生成凋零玫瑰、生物踩坏海龟蛋。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 触发的时机包括:生物踩踏耕地、破坏单个方块、破门、火矢点燃方块、凋灵boss破坏方块、末影龙破坏方块、末影人捡起方块、蠹虫破坏被虫蚀的方块、蠹虫把方块变成被虫蚀的方块、凋零杀死生物生成凋零玫瑰、生物踩坏海龟蛋。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "环境生物改变方块时触发,触发的时机与mobgriefing游戏规则影响的行为相同", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否允许触发,默认为False,若设为True,可阻止触发后续物理交互事件" - }, + }, { - "name": "blockX", - "type": "int", + "type": "int", + "name": "blockX", "description": "方块x坐标" - }, + }, { - "name": "blockY", - "type": "int", + "type": "int", + "name": "blockY", "description": "方块y坐标" - }, + }, { - "name": "blockZ", - "type": "int", + "type": "int", + "name": "blockZ", "description": "方块z坐标" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "触发的entity的唯一ID" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "MobGriefingBlockServerEvent" + }, { - "type": "event", - "name": "OnFireHurtEvent", - "method": "", - "description": "生物受到火焰伤害时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "生物受到火焰伤害时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "victim", - "type": "str", + "type": "str", + "name": "victim", "description": "受伤实体id" - }, + }, { - "name": "src", - "type": "str", + "type": "str", + "name": "src", "description": "火焰创建者id" - }, + }, { - "name": "fireTime", - "type": "float", + "type": "float", + "name": "fireTime", "description": "着火时间,单位秒, 不支持修改" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消此处火焰伤害" - }, + }, { - "name": "cancelIgnite", - "type": "bool", + "type": "bool", + "name": "cancelIgnite", "description": "是否取消点燃效果" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnFireHurtEvent" + }, { - "type": "event", - "name": "OnGroundClientEvent", - "method": "", - "description": "实体着地事件。玩家,沙子,铁砧,掉落的物品,点燃的TNT掉落地面时触发,其余实体着地不触发。", - "remark": "- 因为掉落是服务端与客户端各自计算的,对于掉落的方块,有时会出现服务端先着地,然后把FallingBlock实体移除掉了,导致客户端没触发着地事件的情况。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 因为掉落是服务端与客户端各自计算的,对于掉落的方块,有时会出现服务端先着地,然后把FallingBlock实体移除掉了,导致客户端没触发着地事件的情况。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "实体着地事件。玩家,沙子,铁砧,掉落的物品,点燃的TNT掉落地面时触发,其余实体着地不触发。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnGroundClientEvent" + }, { - "type": "event", - "name": "OnGroundServerEvent", - "method": "", - "description": "实体着地事件。实体,掉落的物品,点燃的TNT掉落地面时触发", - "remark": "- 不支持抛射物实体\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 不支持抛射物实体\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "实体着地事件。实体,掉落的物品,点燃的TNT掉落地面时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnGroundServerEvent" + }, { - "type": "event", - "name": "OnKnockBackServerEvent", - "method": "", - "description": "实体被击退时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "实体被击退时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnKnockBackServerEvent" + }, { - "type": "event", - "name": "OnMobHitBlockServerEvent", - "method": "", - "description": "关闭碰撞方块的检测,关闭后,生物(不包括玩家)碰撞到方块时将不会触发OnMobHitBlockServerEvent事件", - "remark": "- 注:该碰撞检测会屏蔽草、空气、火、高草四种方块", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 注:该碰撞检测会屏蔽草、空气、火、高草四种方块", + "return": [], + "description": "关闭碰撞方块的检测,关闭后,生物(不包括玩家)碰撞到方块时将不会触发OnMobHitBlockServerEvent事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物的实体Id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnMobHitBlockServerEvent" + }, { - "type": "event", - "name": "OnMobHitMobClientEvent", - "method": "", - "description": "关闭碰撞生物的检测,关闭后将不会触发OnMobHitMobClientEvent事件。(该接口对生物同样有效)", - "remark": "- 该接口对生物同样有效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 该接口对生物同样有效", + "return": [], + "description": "关闭碰撞生物的检测,关闭后将不会触发OnMobHitMobClientEvent事件。(该接口对生物同样有效)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "OnMobHitMobClientEvent" + }, { - "type": "event", - "name": "OnMobHitMobServerEvent", - "method": "", - "description": "关闭碰撞生物的检测,关闭后将不会触发OnMobHitMobServerEvent事件。", - "remark": "- 该接口对生物同样有效", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 该接口对生物同样有效", + "return": [], + "description": "关闭碰撞生物的检测,关闭后将不会触发OnMobHitMobServerEvent事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "OnMobHitMobServerEvent" + }, { - "type": "event", - "name": "ProjectileCritHitEvent", - "method": "", - "description": "关闭玩家爆头,关闭后将无法触发ProjectileCritHitEvent事件。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "关闭玩家爆头,关闭后将无法触发ProjectileCritHitEvent事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "ProjectileCritHitEvent" + }, { - "type": "event", - "name": "ProjectileDoHitEffectEvent", - "method": "", - "description": "触发时机:当抛射物碰撞时触发该事件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "触发时机:当抛射物碰撞时触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "抛射物id" - }, + }, { - "name": "hitTargetType", - "type": "str", + "type": "str", + "name": "hitTargetType", "description": "碰撞目标类型,'ENTITY'或是'BLOCK'" - }, + }, { - "name": "targetId", - "type": "str", + "type": "str", + "name": "targetId", "description": "碰撞目标id" - }, + }, { - "name": "hitFace", - "type": "int", + "type": "int", + "name": "hitFace", "description": "撞击在方块上的面id,参考[Facing枚举](../枚举值/Facing.md)" - }, + }, { - "name": "x", - "type": "float", + "type": "float", + "name": "x", "description": "碰撞x坐标" - }, + }, { - "name": "y", - "type": "float", + "type": "float", + "name": "y", "description": "碰撞y坐标" - }, + }, { - "name": "z", - "type": "float", + "type": "float", + "name": "z", "description": "碰撞z坐标" - }, + }, { - "name": "blockPosX", - "type": "int", + "type": "int", + "name": "blockPosX", "description": "碰撞是方块时,方块x坐标" - }, + }, { - "name": "blockPosY", - "type": "int", + "type": "int", + "name": "blockPosY", "description": "碰撞是方块时,方块y坐标" - }, + }, { - "name": "blockPosZ", - "type": "int", + "type": "int", + "name": "blockPosZ", "description": "碰撞是方块时,方块z坐标" - }, + }, { - "name": "srcId", - "type": "str", + "type": "str", + "name": "srcId", "description": "创建者id" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消这个碰撞事件,若取消可以设置为True" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ProjectileDoHitEffectEvent" + }, { - "type": "event", - "name": "RefreshEffectServerEvent", - "method": "", - "description": "触发时机:实体身上状态效果更新时触发,更新条件1、新增状态等级较高,更新状态等级及时间;2、新增状态等级不变,时间较长,更新状态持续时间", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "触发时机:实体身上状态效果更新时触发,更新条件1、新增状态等级较高,更新状态等级及时间;2、新增状态等级不变,时间较长,更新状态持续时间", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "effectName", - "type": "str", + "type": "str", + "name": "effectName", "description": "更新状态效果的名字" - }, + }, { - "name": "effectDuration", - "type": "int", + "type": "int", + "name": "effectDuration", "description": "更新后状态效果剩余持续时间,单位秒" - }, + }, { - "name": "effectAmplifier", - "type": "int", + "type": "int", + "name": "effectAmplifier", "description": "更新后的状态效果放大倍数" - }, + }, { - "name": "damage", - "type": "float", + "type": "float", + "name": "damage", "description": "状态造成的伤害值,如药水" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "RefreshEffectServerEvent" + }, { - "type": "event", - "name": "RemoveEffectServerEvent", - "method": "", - "description": "触发时机:实体身上状态效果被移除时", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "触发时机:实体身上状态效果被移除时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "effectName", - "type": "str", + "type": "str", + "name": "effectName", "description": "被移除状态效果的名字" - }, + }, { - "name": "effectDuration", - "type": "int", + "type": "int", + "name": "effectDuration", "description": "被移除状态效果的剩余持续时间,单位秒" - }, + }, { - "name": "effectAmplifier", - "type": "int", + "type": "int", + "name": "effectAmplifier", "description": "被移除状态效果的放大倍数" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "RemoveEffectServerEvent" + }, { - "type": "event", - "name": "SpawnProjectileServerEvent", - "method": "", - "description": "触发时机:抛射物生成时触发", - "remark": "- 该事件里无法获取弹射物实体的auxvalue。如有需要可以延迟一帧获取,或者在ProjectileDoHitEffectEvent获取\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 该事件里无法获取弹射物实体的auxvalue。如有需要可以延迟一帧获取,或者在ProjectileDoHitEffectEvent获取\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:抛射物生成时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "projectileId", - "type": "str", + "type": "str", + "name": "projectileId", "description": "抛射物的实体id" - }, + }, { - "name": "projectileIdentifier", - "type": "str", + "type": "str", + "name": "projectileIdentifier", "description": "抛射物的identifier" - }, + }, { - "name": "spawnerId", - "type": "str", + "type": "str", + "name": "spawnerId", "description": "发射者的实体id,没有发射者时为-1" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "SpawnProjectileServerEvent" + }, { - "type": "event", - "name": "StartRidingClientEvent", - "method": "", - "description": "触发时机:一个实体即将骑乘另外一个实体", - "remark": "- 如果需要修改cancel,请通过服务端事件StartRidingServerEvent同步修改,客户端触发该事件时,实体已经骑乘成功。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 如果需要修改cancel,请通过服务端事件StartRidingServerEvent同步修改,客户端触发该事件时,实体已经骑乘成功。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:一个实体即将骑乘另外一个实体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "actorId", - "type": "str", + "type": "str", + "name": "actorId", "description": "骑乘者的唯一ID" - }, + }, { - "name": "victimId", - "type": "str", + "type": "str", + "name": "victimId", "description": "被骑乘实体的唯一ID" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "StartRidingClientEvent" + }, { - "type": "event", - "name": "StartRidingServerEvent", - "method": "", - "description": "触发时机:一个实体即将骑乘另外一个实体", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "触发时机:一个实体即将骑乘另外一个实体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否允许触发,默认为False,若设为True,可阻止触发后续的实体交互事件" - }, + }, { - "name": "actorId", - "type": "str", + "type": "str", + "name": "actorId", "description": "骑乘者的唯一ID" - }, + }, { - "name": "victimId", - "type": "str", + "type": "str", + "name": "victimId", "description": "被骑乘实体的唯一ID" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "StartRidingServerEvent" + }, { - "type": "event", - "name": "WillAddEffectServerEvent", - "method": "", - "description": "触发时机:实体即将获得状态效果前", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "", + "return": [], + "description": "触发时机:实体即将获得状态效果前", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "effectName", - "type": "str", + "type": "str", + "name": "effectName", "description": "实体获得状态效果的名字" - }, + }, { - "name": "effectDuration", - "type": "int", + "type": "int", + "name": "effectDuration", "description": "状态效果的持续时间,单位秒" - }, + }, { - "name": "effectAmplifier", - "type": "int", + "type": "int", + "name": "effectAmplifier", "description": "状态效果的放大倍数" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设置为True可以取消" - }, + }, { - "name": "damage", - "type": "float", + "type": "float", + "name": "damage", "description": "状态将会造成的伤害值,如药水;需要注意,该值不一定是最终的伤害值,例如被伤害吸收效果扣除。只有持续时间为0时有用" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "WillAddEffectServerEvent" + }, { - "type": "event", - "name": "WillTeleportToServerEvent", - "method": "", - "description": "实体即将传送或切换维度", - "remark": "- 假如目标维度尚未在内存中创建(即服务器启动之后,到传送之前,没有玩家进入过这个维度),那么此时事件中返回的目标地点坐标是算法生成的,不能保证正确。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "remark": "- 假如目标维度尚未在内存中创建(即服务器启动之后,到传送之前,没有玩家进入过这个维度),那么此时事件中返回的目标地点坐标是算法生成的,不能保证正确。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "实体即将传送或切换维度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/实体.md", + "example": "", "params": [ { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否允许触发,默认为False,若设为True,可阻止触发后续的传送" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体的唯一ID" - }, + }, { - "name": "fromDimensionId", - "type": "int", + "type": "int", + "name": "fromDimensionId", "description": "传送前所在的维度" - }, + }, { - "name": "toDimensionId", - "type": "int", + "type": "int", + "name": "toDimensionId", "description": "传送后的目标维度" - }, + }, { - "name": "fromX", - "type": "int", + "type": "int", + "name": "fromX", "description": "传送前所在的x坐标" - }, + }, { - "name": "fromY", - "type": "int", + "type": "int", + "name": "fromY", "description": "传送前所在的y坐标" - }, + }, { - "name": "fromZ", - "type": "int", + "type": "int", + "name": "fromZ", "description": "传送前所在的z坐标" - }, + }, { - "name": "toX", - "type": "int", + "type": "int", + "name": "toX", "description": "传送目标地点的x坐标" - }, + }, { - "name": "toY", - "type": "int", + "type": "int", + "name": "toY", "description": "传送目标地点的y坐标" - }, + }, { - "name": "toZ", - "type": "int", + "type": "int", + "name": "toZ", "description": "传送目标地点的z坐标" - }, + }, { - "name": "cause", - "type": "str", + "type": "str", + "name": "cause", "description": "传送理由,详情见MinecraftEnum.EntityTeleportCause" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "WillTeleportToServerEvent" + }, { - "type": "event", - "name": "ClientJumpButtonPressDownEvent", - "method": "", - "description": "跳跃按钮按下事件,返回值设置参数只对当次按下事件起作用", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "", + "return": [], + "description": "跳跃按钮按下事件,返回值设置参数只对当次按下事件起作用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "continueJump", - "type": "bool", + "type": "bool", + "name": "continueJump", "description": "设置是否执行跳跃逻辑" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ClientJumpButtonPressDownEvent" + }, { - "type": "event", - "name": "ClientJumpButtonReleaseEvent", - "method": "", - "description": "跳跃按钮按下释放事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "跳跃按钮按下释放事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "ClientJumpButtonReleaseEvent" + }, { - "type": "event", - "name": "GetEntityByCoordEvent", - "method": "", - "description": "玩家点击屏幕时触发,多个手指点在屏幕上时,只有第一个会触发。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "玩家点击屏幕时触发,多个手指点在屏幕上时,只有第一个会触发。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetEntityByCoordEvent" + }, { - "type": "event", - "name": "GetEntityByCoordReleaseClientEvent", - "method": "", - "description": "玩家点击屏幕后松开时触发,多个手指点在屏幕上时,只有最后一个手指松开时触发。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "玩家点击屏幕后松开时触发,多个手指点在屏幕上时,只有最后一个手指松开时触发。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetEntityByCoordReleaseClientEvent" + }, { - "type": "event", - "name": "GyroSensorChangedClientEvent", - "method": "", - "description": "触发时机:陀螺仪传感器姿态发生变化时", - "remark": "- 该事件只适用于移动端", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "- 该事件只适用于移动端", + "return": [], + "description": "触发时机:陀螺仪传感器姿态发生变化时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "xDiff", - "type": "float", + "type": "float", + "name": "xDiff", "description": "x轴角速度,单位为弧度/s" - }, + }, { - "name": "yDiff", - "type": "float", + "type": "float", + "name": "yDiff", "description": "y轴角速度,单位为弧度/s" - }, + }, { - "name": "zDiff", - "type": "float", + "type": "float", + "name": "zDiff", "description": "z轴角速度,单位为弧度/s" - }, + }, { - "name": "orientation", - "type": "int", + "type": "int", + "name": "orientation", "description": "当前屏幕朝向,0竖屏正向 1横屏向左 2竖屏倒置 3横屏向右" - }, + }, { - "name": "timestamp", - "type": "float", + "type": "float", + "name": "timestamp", "description": "触发时间戳,秒" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GyroSensorChangedClientEvent" + }, { - "type": "event", - "name": "HoldBeforeClientEvent", - "method": "", - "description": "玩家长按屏幕,即将响应到游戏内时触发。仅在移动端或pc的F11模式下触发。pc的非F11模式可以监听[RightClickBeforeClientEvent](#rightclickbeforeclientevent)事件", - "remark": "- 玩家长按屏幕的处理顺序为:\r\n 1. 玩家点击屏幕,在长按判定时间内(默认为400毫秒,可通过SetHoldTimeThreshold接口修改)一直没有进行拖动或松手\r\n 2. 触发该事件\r\n 3. 若事件没有cancel,则根据主手上的物品,准心处的物体类型以及与玩家的距离,进行挖方块/使用物品/与实体交互等操作\r\n 即该事件只会在到达长按判定时间的瞬间触发一次,后面一直按住不会连续触发,可以使用[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)监听长按后松手\r\n - 与[TapBeforeClientEvent](#tapbeforeclientevent)事件类似,被ui层捕获,没有穿透到世界的点击不会触发该事件\r\n - 点触流程的图片讲解见[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)事件的备注", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "- 玩家长按屏幕的处理顺序为:\r\n 1. 玩家点击屏幕,在长按判定时间内(默认为400毫秒,可通过SetHoldTimeThreshold接口修改)一直没有进行拖动或松手\r\n 2. 触发该事件\r\n 3. 若事件没有cancel,则根据主手上的物品,准心处的物体类型以及与玩家的距离,进行挖方块/使用物品/与实体交互等操作\r\n 即该事件只会在到达长按判定时间的瞬间触发一次,后面一直按住不会连续触发,可以使用[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)监听长按后松手\r\n - 与[TapBeforeClientEvent](#tapbeforeclientevent)事件类似,被ui层捕获,没有穿透到世界的点击不会触发该事件\r\n - 点触流程的图片讲解见[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)事件的备注", + "return": [], + "description": "玩家长按屏幕,即将响应到游戏内时触发。仅在移动端或pc的F11模式下触发。pc的非F11模式可以监听[RightClickBeforeClientEvent](#rightclickbeforeclientevent)事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设置为True可拦截原版的挖方块/使用物品/与实体交互响应" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HoldBeforeClientEvent" + }, { - "type": "event", - "name": "LeftClickBeforeClientEvent", - "method": "", - "description": "玩家按下攻击/摧毁键时触发,例如鼠标左键、新触控攻击键、手柄右扳机键。鼠标左键仅在pc的普通控制模式(即非F11模式)下触发", - "remark": "- 按键控制流程的图片讲解见[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)事件的备注", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "- 按键控制流程的图片讲解见[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)事件的备注", + "return": [], + "description": "玩家按下攻击/摧毁键时触发,例如鼠标左键、新触控攻击键、手柄右扳机键。鼠标左键仅在pc的普通控制模式(即非F11模式)下触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设置为True可拦截原版的挖方块或攻击响应" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "LeftClickBeforeClientEvent" + }, { - "type": "event", - "name": "LeftClickReleaseClientEvent", - "method": "", - "description": "玩家松开攻击/摧毁键时触发,例如鼠标左键、新触控攻击键、手柄右扳机键。鼠标左键仅在pc的普通控制模式(即非F11模式)下触发", - "remark": "- 按键控制流程的图片讲解见[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)事件的备注", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 按键控制流程的图片讲解见[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)事件的备注", + "return": [], + "description": "玩家松开攻击/摧毁键时触发,例如鼠标左键、新触控攻击键、手柄右扳机键。鼠标左键仅在pc的普通控制模式(即非F11模式)下触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "LeftClickReleaseClientEvent" + }, { - "type": "event", - "name": "MouseWheelClientEvent", - "method": "", - "description": "鼠标滚轮滚动时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "", + "return": [], + "description": "鼠标滚轮滚动时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "direction", - "type": "int", + "type": "int", + "name": "direction", "description": "1为向上滚动,0为向下滚动" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "MouseWheelClientEvent" + }, { - "type": "event", - "name": "OnBackButtonReleaseClientEvent", - "method": "", - "description": "返回按钮(目前特指安卓系统导航中的返回按钮)松开时触发", - "remark": "- 目前仅安卓平台可用", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 目前仅安卓平台可用", + "return": [], + "description": "返回按钮(目前特指安卓系统导航中的返回按钮)松开时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "OnBackButtonReleaseClientEvent" + }, { - "type": "event", - "name": "OnClientPlayerStartMove", - "method": "", - "description": "移动按钮按下触发事件,在按住一个方向键的同时,去按另外一个方向键,不会触发第二次", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "移动按钮按下触发事件,在按住一个方向键的同时,去按另外一个方向键,不会触发第二次", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "OnClientPlayerStartMove" + }, { - "type": "event", - "name": "OnClientPlayerStopMove", - "method": "", - "description": "移动按钮按下释放时触发事件,同时按下多个方向键,需要释放所有的方向键才会触发事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "移动按钮按下释放时触发事件,同时按下多个方向键,需要释放所有的方向键才会触发事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "OnClientPlayerStopMove" + }, { - "type": "event", - "name": "OnGamepadControllerLayoutChangeClientEvent", - "method": "", - "description": "游戏手柄按键映射改变事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "", + "return": [], + "description": "游戏手柄按键映射改变事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "action", - "type": "str", + "type": "str", + "name": "action", "description": "行为" - }, + }, { - "name": "newKey", - "type": "int", + "type": "int", + "name": "newKey", "description": "修改后的键码,详见[GamepadKeyType枚举](../枚举值/GamepadKeyType.md)" - }, + }, { - "name": "oldKey", - "type": "int", + "type": "int", + "name": "oldKey", "description": "修改前的键码,详见[GamepadKeyType枚举](../枚举值/GamepadKeyType.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnGamepadControllerLayoutChangeClientEvent" + }, { - "type": "event", - "name": "OnGamepadKeyPressClientEvent", - "method": "", - "description": "游戏手柄按键事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "", + "return": [], + "description": "游戏手柄按键事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "screenName", - "type": "str", + "type": "str", + "name": "screenName", "description": "当前screenName" - }, + }, { - "name": "key", - "type": "int", + "type": "int", + "name": "key", "description": "键码,详见[GamepadKeyType枚举](../枚举值/GamepadKeyType.md)" - }, + }, { - "name": "isDown", - "type": "str", + "type": "str", + "name": "isDown", "description": "是否按下,按下为1,弹起为0" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnGamepadKeyPressClientEvent" + }, { - "type": "event", - "name": "OnGamepadStickClientEvent", - "method": "", - "description": "游戏手柄摇杆事件", - "remark": "- 触发时机:当摇杆摇动位置发生改变时", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "- 触发时机:当摇杆摇动位置发生改变时", + "return": [], + "description": "游戏手柄摇杆事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "key", - "type": "int", + "type": "int", + "name": "key", "description": "键码,详见[GamepadKeyType枚举](../枚举值/GamepadKeyType.md)" - }, + }, { - "name": "x", - "type": "float", + "type": "float", + "name": "x", "description": "摇杆水平方向的值,从左到右取值为 -1.0 ~ 1.0" - }, + }, { - "name": "y", - "type": "float", + "type": "float", + "name": "y", "description": "摇杆竖直方向的值,从下到上取值为 -1.0 ~ 1.0" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnGamepadStickClientEvent" + }, { - "type": "event", - "name": "OnGamepadTriggerClientEvent", - "method": "", - "description": "游戏手柄扳机事件", - "remark": "- 触发时机:当扣动扳机的力度发生改变时", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "- 触发时机:当扣动扳机的力度发生改变时", + "return": [], + "description": "游戏手柄扳机事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "key", - "type": "int", + "type": "int", + "name": "key", "description": "键码,详见[GamepadKeyType枚举](../枚举值/GamepadKeyType.md)" - }, + }, { - "name": "magnitude", - "type": "float", + "type": "float", + "name": "magnitude", "description": "扣动扳机的力度,取值为 0 ~ 1.0" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnGamepadTriggerClientEvent" + }, { - "type": "event", - "name": "OnKeyPressInGame", - "method": "", - "description": "按键按下或按键释放时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "", + "return": [], + "description": "按键按下或按键释放时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "screenName", - "type": "str", + "type": "str", + "name": "screenName", "description": "当前screenName" - }, + }, { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "键码(注:这里的int型被转成了str型,比如\"1\"对应的就是枚举值文档中的1),详见[KeyBoardType枚举](../枚举值/KeyBoardType.md)" - }, + }, { - "name": "isDown", - "type": "str", + "type": "str", + "name": "isDown", "description": "是否按下,按下为1,弹起为0" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnKeyPressInGame" + }, { - "type": "event", - "name": "OnKeyboardControllerLayoutChangeClientEvent", - "method": "", - "description": "键盘按键映射改变事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "", + "return": [], + "description": "键盘按键映射改变事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "action", - "type": "str", + "type": "str", + "name": "action", "description": "行为" - }, + }, { - "name": "newKey", - "type": "int", + "type": "int", + "name": "newKey", "description": "修改后的键码,详见[KeyBoardType枚举](../枚举值/KeyBoardType.md)" - }, + }, { - "name": "oldKey", - "type": "int", + "type": "int", + "name": "oldKey", "description": "修改前的键码,详见[KeyBoardType枚举](../枚举值/KeyBoardType.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnKeyboardControllerLayoutChangeClientEvent" + }, { - "type": "event", - "name": "OnMouseMiddleDownClientEvent", - "method": "", - "description": "鼠标按下中键时触发", - "remark": "- 仅通过PushScreen创建的界面能够正常返回坐标,开启F11模式的时候,返回最后点击屏幕时的坐标", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "- 仅通过PushScreen创建的界面能够正常返回坐标,开启F11模式的时候,返回最后点击屏幕时的坐标", + "return": [], + "description": "鼠标按下中键时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "isDown", - "type": "int", + "type": "int", + "name": "isDown", "description": "1为按下,0为弹起" - }, + }, { - "name": "mousePositionX", - "type": "float", + "type": "float", + "name": "mousePositionX", "description": "按下时的x坐标" - }, + }, { - "name": "mousePositionY", - "type": "float", + "type": "float", + "name": "mousePositionY", "description": "按下时的y坐标" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnMouseMiddleDownClientEvent" + }, { - "type": "event", - "name": "RightClickBeforeClientEvent", - "method": "", - "description": "玩家按下使用物品/放置方块键时触发,例如鼠标右键、新触控交互键、手柄左扳机键", - "remark": "- 按键控制流程的图片讲解见[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)事件的备注", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "- 按键控制流程的图片讲解见[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)事件的备注", + "return": [], + "description": "玩家按下使用物品/放置方块键时触发,例如鼠标右键、新触控交互键、手柄左扳机键", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设置为True可拦截原版的物品使用/实体交互响应" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "RightClickBeforeClientEvent" + }, { - "type": "event", - "name": "RightClickReleaseClientEvent", - "method": "", - "description": "玩家松开使用物品/放置方块键时触发,例如鼠标右键、新触控交互键、手柄左扳机键", - "remark": "- 按键控制流程的图片讲解见[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)事件的备注", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 按键控制流程的图片讲解见[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)事件的备注", + "return": [], + "description": "玩家松开使用物品/放置方块键时触发,例如鼠标右键、新触控交互键、手柄左扳机键", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "RightClickReleaseClientEvent" + }, { - "type": "event", - "name": "TapBeforeClientEvent", - "method": "", - "description": "玩家点击屏幕并松手,即将响应到游戏内时触发。仅在移动端或pc的F11模式下触发。pc的非F11模式可以监听[LeftClickBeforeClientEvent](#leftclickbeforeclientevent)事件", - "remark": "- 玩家点击屏幕的处理顺序为:\r\n 1. 玩家点击屏幕,没有进行拖动,并在短按判定时间(250毫秒)内松手\r\n 2. 触发该事件\r\n 3. 若事件没有cancel,则根据准心处的物体类型以及与玩家的距离,进行攻击或放置等操作\r\n - 与GetEntityByCoordEvent事件不同的是,被ui层捕获,没有穿透到世界的点击不会触发该事件,例如:\r\n 1. 点击原版的移动/跳跃等按钮\r\n 2. 通过SetIsHud(0)屏蔽了游戏操作\r\n 3. 对按钮使用AddTouchEventHandler接口时isSwallow参数设置为True\r\n - 点触流程的图片讲解见[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)事件的备注", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "remark": "- 玩家点击屏幕的处理顺序为:\r\n 1. 玩家点击屏幕,没有进行拖动,并在短按判定时间(250毫秒)内松手\r\n 2. 触发该事件\r\n 3. 若事件没有cancel,则根据准心处的物体类型以及与玩家的距离,进行攻击或放置等操作\r\n - 与GetEntityByCoordEvent事件不同的是,被ui层捕获,没有穿透到世界的点击不会触发该事件,例如:\r\n 1. 点击原版的移动/跳跃等按钮\r\n 2. 通过SetIsHud(0)屏蔽了游戏操作\r\n 3. 对按钮使用AddTouchEventHandler接口时isSwallow参数设置为True\r\n - 点触流程的图片讲解见[TapOrHoldReleaseClientEvent](#taporholdreleaseclientevent)事件的备注", + "return": [], + "description": "玩家点击屏幕并松手,即将响应到游戏内时触发。仅在移动端或pc的F11模式下触发。pc的非F11模式可以监听[LeftClickBeforeClientEvent](#leftclickbeforeclientevent)事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", "params": [ { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设置为True可拦截原版的攻击或放置响应" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "TapBeforeClientEvent" + }, { - "type": "event", - "name": "TapOrHoldReleaseClientEvent", - "method": "", - "description": "玩家点击屏幕后松手时触发。仅在移动端或pc的F11模式下触发。pc的非F11模式可以使用[LeftClickReleaseClientEvent](#leftclickreleaseclientevent)与[RightClickReleaseClientEvent](#rightclickreleaseclientevent)事件监听鼠标松开", - "remark": "- 短按及长按后松手都会触发该事件\r\n - 一张图读懂点触和按键事件触发流程\r\n ![点触说明](../picture/pe_touch_event.png)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 短按及长按后松手都会触发该事件\r\n - 一张图读懂点触和按键事件触发流程\r\n ![点触说明](../picture/pe_touch_event.png)", + "return": [], + "description": "玩家点击屏幕后松手时触发。仅在移动端或pc的F11模式下触发。pc的非F11模式可以使用[LeftClickReleaseClientEvent](#leftclickreleaseclientevent)与[RightClickReleaseClientEvent](#rightclickreleaseclientevent)事件监听鼠标松开", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "TapOrHoldReleaseClientEvent" + }, { - "type": "event", - "name": "BlockAnimateRandomTickEvent", - "method": "", - "description": "触发时机:以摄像机为中心,随机选取周围的方块触发Tick,触发的数量取决于设备性能。只有添加了netease:block_animate_random_tick的自定义方块才会触发此事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:以摄像机为中心,随机选取周围的方块触发Tick,触发的数量取决于设备性能。只有添加了netease:block_animate_random_tick的自定义方块才会触发此事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "blockPos", "description": "方块坐标" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "BlockAnimateRandomTickEvent" + }, { - "type": "event", - "name": "BlockDestroyByLiquidServerEvent", - "method": "", - "description": "触发时机:方块被水流破坏的事件", - "remark": "- 指令或者接口的设置不会触发该事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 指令或者接口的设置不会触发该事件", + "return": [], + "description": "触发时机:方块被水流破坏的事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" - }, + }, { - "name": "liquidName", - "type": "str", + "type": "str", + "name": "liquidName", "description": "流体方块id" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块id" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块附加值" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "BlockDestroyByLiquidServerEvent" + }, { - "type": "event", - "name": "BlockLiquidStateChangeAfterServerEvent", - "method": "", - "description": "触发时机:方块转为含水或者脱离含水(流体)后触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:方块转为含水或者脱离含水(流体)后触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块附加值" - }, + }, { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "方块维度" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" - }, + }, { - "name": "turnLiquid", - "type": "bool", + "type": "bool", + "name": "turnLiquid", "description": "是否转为含水,true则转为含水,false则脱离含水" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "BlockLiquidStateChangeAfterServerEvent" + }, { - "type": "event", - "name": "BlockLiquidStateChangeServerEvent", - "method": "", - "description": "触发时机:方块转为含水或者脱离含水(流体)前触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:方块转为含水或者脱离含水(流体)前触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块附加值" - }, + }, { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "方块维度" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" - }, + }, { - "name": "turnLiquid", - "type": "bool", + "type": "bool", + "name": "turnLiquid", "description": "是否转为含水,true则转为含水,false则脱离含水" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "BlockLiquidStateChangeServerEvent" + }, { - "type": "event", - "name": "BlockNeighborChangedServerEvent", - "method": "", - "description": "触发时机:自定义方块周围的方块发生变化时,需要配置netease:neighborchanged_sendto_script,详情请查阅《自定义农作物》文档", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:自定义方块周围的方块发生变化时,需要配置netease:neighborchanged_sendto_script,详情请查阅《自定义农作物》文档", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度" - }, + }, { - "name": "posX", - "type": "int", + "type": "int", + "name": "posX", "description": "方块x坐标" - }, + }, { - "name": "posY", - "type": "int", + "type": "int", + "name": "posY", "description": "方块y坐标" - }, + }, { - "name": "posZ", - "type": "int", + "type": "int", + "name": "posZ", "description": "方块z坐标" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块附加值" - }, + }, { - "name": "neighborPosX", - "type": "int", + "type": "int", + "name": "neighborPosX", "description": "变化方块x坐标" - }, + }, { - "name": "neighborPosY", - "type": "int", + "type": "int", + "name": "neighborPosY", "description": "变化方块y坐标" - }, + }, { - "name": "neighborPosZ", - "type": "int", + "type": "int", + "name": "neighborPosZ", "description": "变化方块z坐标" - }, + }, { - "name": "fromBlockName", - "type": "str", + "type": "str", + "name": "fromBlockName", "description": "方块变化前的identifier,包含命名空间及名称" - }, + }, { - "name": "fromBlockAuxValue", - "type": "int", + "type": "int", + "name": "fromBlockAuxValue", "description": "方块变化前附加值" - }, + }, { - "name": "toBlockName", - "type": "str", + "type": "str", + "name": "toBlockName", "description": "方块变化后的identifier,包含命名空间及名称" - }, + }, { - "name": "toAuxValue", - "type": "int", + "type": "int", + "name": "toAuxValue", "description": "方块变化后附加值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "BlockNeighborChangedServerEvent" + }, { - "type": "event", - "name": "BlockRandomTickServerEvent", - "method": "", - "description": "触发时机:自定义方块配置netease:random_tick随机tick时", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:自定义方块配置netease:random_tick随机tick时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "posX", - "type": "int", + "type": "int", + "name": "posX", "description": "方块x坐标" - }, + }, { - "name": "posY", - "type": "int", + "type": "int", + "name": "posY", "description": "方块y坐标" - }, + }, { - "name": "posZ", - "type": "int", + "type": "int", + "name": "posZ", "description": "方块z坐标" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块名称" - }, + }, { - "name": "fullName", - "type": "str", + "type": "str", + "name": "fullName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块附加值" - }, + }, { - "name": "brightness", - "type": "int", + "type": "int", + "name": "brightness", "description": "方块亮度" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "实体维度" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "BlockRandomTickServerEvent" + }, { - "type": "event", - "name": "BlockRemoveServerEvent", - "method": "", - "description": "是否监听方块BlockRemoveServerEvent事件,可以动态修改json组件netease:listen_block_remove的值", - "remark": "- 对于一些特殊的方块,注意要使用对应的方块Id参数(如砖块楼梯,监听的方块Id应该为minecraft:brick_block)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 对于一些特殊的方块,注意要使用对应的方块Id参数(如砖块楼梯,监听的方块Id应该为minecraft:brick_block)", + "return": [], + "description": "是否监听方块BlockRemoveServerEvent事件,可以动态修改json组件netease:listen_block_remove的值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "identifier", - "type": "str", + "type": "str", + "name": "identifier", "description": "方块identifier,如minecraft:wheat" - }, + }, { - "name": "listen", - "type": "bool", + "type": "bool", + "name": "listen", "description": "是否监听" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "BlockRemoveServerEvent" + }, { - "type": "event", - "name": "BlockSnowStateChangeAfterServerEvent", - "method": "", - "description": "触发时机:方块转为含雪或者脱离含雪后触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:方块转为含雪或者脱离含雪后触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "方块维度" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" - }, + }, { - "name": "turnSnow", - "type": "bool", + "type": "bool", + "name": "turnSnow", "description": "是否转为含雪,true则转为含雪,false则脱离含雪" - }, + }, { - "name": "setBlockType", - "type": "int", + "type": "int", + "name": "setBlockType", "description": "方块进入脱离含雪的原因,参考[SetBlockType](../枚举值/SetBlockType.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "BlockSnowStateChangeAfterServerEvent" + }, { - "type": "event", - "name": "BlockSnowStateChangeServerEvent", - "method": "", - "description": "触发时机:方块转为含雪或者脱离含雪前触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:方块转为含雪或者脱离含雪前触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "方块维度" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" - }, + }, { - "name": "turnSnow", - "type": "bool", + "type": "bool", + "name": "turnSnow", "description": "是否转为含雪,true则转为含雪,false则脱离含雪" - }, + }, { - "name": "setBlockType", - "type": "int", + "type": "int", + "name": "setBlockType", "description": "方块进入脱离含雪的原因,参考[SetBlockType](../枚举值/SetBlockType.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "BlockSnowStateChangeServerEvent" + }, { - "type": "event", - "name": "BlockStrengthChangedServerEvent", - "method": "", - "description": "触发时机:自定义机械元件方块红石信号量发生变化时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:自定义机械元件方块红石信号量发生变化时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "posX", - "type": "int", + "type": "int", + "name": "posX", "description": "方块x坐标" - }, + }, { - "name": "posY", - "type": "int", + "type": "int", + "name": "posY", "description": "方块y坐标" - }, + }, { - "name": "posZ", - "type": "int", + "type": "int", + "name": "posZ", "description": "方块z坐标" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块附加值" - }, + }, { - "name": "newStrength", - "type": "int", + "type": "int", + "name": "newStrength", "description": "变化后的红石信号量" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "BlockStrengthChangedServerEvent" + }, { - "type": "event", - "name": "ChestBlockTryPairWithServerEvent", - "method": "", - "description": "触发时机:两个并排的小箱子方块准备组合为一个大箱子方块时", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:两个并排的小箱子方块准备组合为一个大箱子方块时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否允许触发,默认为False,若设为True,可阻止小箱子组合成为一个大箱子" - }, + }, { - "name": "blockX", - "type": "int", + "type": "int", + "name": "blockX", "description": "小箱子方块x坐标" - }, + }, { - "name": "blockY", - "type": "int", + "type": "int", + "name": "blockY", "description": "小箱子方块y坐标" - }, + }, { - "name": "blockZ", - "type": "int", + "type": "int", + "name": "blockZ", "description": "小箱子方块z坐标" - }, + }, { - "name": "otherBlockX", - "type": "int", + "type": "int", + "name": "otherBlockX", "description": "将要与之组合的另外一个小箱子方块x坐标" - }, + }, { - "name": "otherBlockY", - "type": "int", + "type": "int", + "name": "otherBlockY", "description": "将要与之组合的另外一个小箱子方块y坐标" - }, + }, { - "name": "otherBlockZ", - "type": "int", + "type": "int", + "name": "otherBlockZ", "description": "将要与之组合的另外一个小箱子方块z坐标" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ChestBlockTryPairWithServerEvent" + }, { - "type": "event", - "name": "ClientBlockUseEvent", - "method": "", - "description": "清空所有已添加方块对ClientBlockUseEvent事件的脚本层监听", - "remark": "- 有的方块是在ServerBlockUseEvent中设置cancel生效,但是有部分方块是在ClientBlockUseEvent中设置cancel才生效,如有需求建议在两个事件中同时设置cancel以保证生效。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件\r\n\r\n\r\n### 相关接口\r\n\r\n\r\n### AddBlockItemListenForUseEvent\r\n\r\nmethod in mod.client.component.blockUseEventWhiteListCompClient.BlockUseEventWhiteListComponentClient", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 有的方块是在ServerBlockUseEvent中设置cancel生效,但是有部分方块是在ClientBlockUseEvent中设置cancel才生效,如有需求建议在两个事件中同时设置cancel以保证生效。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件\r\n\r\n\r\n### 相关接口\r\n\r\n\r\n### AddBlockItemListenForUseEvent\r\n\r\nmethod in mod.client.component.blockUseEventWhiteListCompClient.BlockUseEventWhiteListComponentClient", + "return": [], + "description": "清空所有已添加方块对ClientBlockUseEvent事件的脚本层监听", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "ClientBlockUseEvent" + }, { - "type": "event", - "name": "CommandBlockContainerOpenEvent", - "method": "", - "description": "触发时机:玩家点击命令方块,尝试打开命令方块的设置界面", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:玩家点击命令方块,尝试打开命令方块的设置界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "isBlock", - "type": "bool", + "type": "bool", + "name": "isBlock", "description": "是否以方块坐标的形式定位命令方块,当为True时下述的blockX/blockY/blockZ有意义,当为False时,下述的victimId有意义" - }, + }, { - "name": "blockX", - "type": "int", + "type": "int", + "name": "blockX", "description": "命令方块位置x,当isBlock为True时有效" - }, + }, { - "name": "blockY", - "type": "int", + "type": "int", + "name": "blockY", "description": "命令方块位置y,当isBlock为True时有效" - }, + }, { - "name": "blockZ", - "type": "int", + "type": "int", + "name": "blockZ", "description": "命令方块位置z,当isBlock为True时有效" - }, + }, { - "name": "victimId", - "type": "str", + "type": "str", + "name": "victimId", "description": "命令方块对应的逻辑实体的唯一id,当isBlock为False时有效" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "修改为True时,可以阻止玩家打开命令方块的设置界面" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "CommandBlockContainerOpenEvent" + }, { - "type": "event", - "name": "CommandBlockUpdateEvent", - "method": "", - "description": "触发时机:玩家尝试修改命令方块的内置命令时", - "remark": "- 当修改的目标为命令方块矿车时(此时isBlock为False),设置cancel为True,依旧可以阻止修改命令方块矿车的内部指令,但是从客户端能够看到命令方块矿车的内部指令变化了,不过这仅仅是假象,重新登录或者其他客户端打开命令方块矿车的设置界面,就会发现其实内部指令没有变化\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 当修改的目标为命令方块矿车时(此时isBlock为False),设置cancel为True,依旧可以阻止修改命令方块矿车的内部指令,但是从客户端能够看到命令方块矿车的内部指令变化了,不过这仅仅是假象,重新登录或者其他客户端打开命令方块矿车的设置界面,就会发现其实内部指令没有变化\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家尝试修改命令方块的内置命令时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "playerUid", - "type": "int/long", + "type": "int/long", + "name": "playerUid", "description": "玩家的uid" - }, + }, { - "name": "command", - "type": "str", + "type": "str", + "name": "command", "description": "企图修改的命令方块中的命令内容字符串" - }, + }, { - "name": "isBlock", - "type": "bool", + "type": "bool", + "name": "isBlock", "description": "是否以方块坐标的形式定位命令方块,当为True时下述的blockX/blockY/blockZ有意义,当为False时,下述的victimId有意义" - }, + }, { - "name": "blockX", - "type": "int", + "type": "int", + "name": "blockX", "description": "命令方块位置x,当isBlock为True时有效" - }, + }, { - "name": "blockY", - "type": "int", + "type": "int", + "name": "blockY", "description": "命令方块位置y,当isBlock为True时有效" - }, + }, { - "name": "blockZ", - "type": "int", + "type": "int", + "name": "blockZ", "description": "命令方块位置z,当isBlock为True时有效" - }, + }, { - "name": "victimId", - "type": "str", + "type": "str", + "name": "victimId", "description": "命令方块对应的逻辑实体的唯一id,当isBlock为False时有效" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "修改为True时,可以阻止玩家修改命令方块的内置命令" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "CommandBlockUpdateEvent" + }, { - "type": "event", - "name": "DestroyBlockEvent", - "method": "", - "description": "触发时机:当方块已经被玩家破坏时触发该事件。", - "remark": "- 在生存模式或创造模式下都会触发\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 在生存模式或创造模式下都会触发\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:当方块已经被玩家破坏时触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" - }, + }, { - "name": "face", - "type": "int", + "type": "int", + "name": "face", "description": "方块被敲击的面向id,参考[Facing枚举](../枚举值/Facing.md)" - }, + }, { - "name": "fullName", - "type": "str", + "type": "str", + "name": "fullName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxData", - "type": "int", + "type": "int", + "name": "auxData", "description": "方块附加值" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "破坏方块的玩家ID" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "dropEntityIds", - "type": "list(str)", + "type": "list(str)", + "name": "dropEntityIds", "description": "掉落物实体id列表" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "DestroyBlockEvent" + }, { - "type": "event", - "name": "DirtBlockToGrassBlockServerEvent", - "method": "", - "description": "触发时机:泥土方块变成草方块时触发", - "remark": "- 指令或者接口的设置不会触发该事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 指令或者接口的设置不会触发该事件", + "return": [], + "description": "触发时机:泥土方块变成草方块时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "方块维度" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "DirtBlockToGrassBlockServerEvent" + }, { - "type": "event", - "name": "EntityPlaceBlockAfterServerEvent", - "method": "", - "description": "触发时机:当生物成功放置方块后触发", - "remark": "- 部分放置后会产生实体的方块、可操作的方块、带有特殊逻辑的方块,不会触发该事件,包括但不限于床、门、告示牌、花盆、红石中继器、船、炼药锅、头部模型、蛋糕、酿造台、盔甲架等。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 部分放置后会产生实体的方块、可操作的方块、带有特殊逻辑的方块,不会触发该事件,包括但不限于床、门、告示牌、花盆、红石中继器、船、炼药锅、头部模型、蛋糕、酿造台、盔甲架等。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:当生物成功放置方块后触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" - }, + }, { - "name": "fullName", - "type": "str", + "type": "str", + "name": "fullName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxData", - "type": "int", + "type": "int", + "name": "auxData", "description": "方块附加值" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "试图放置方块的生物ID" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "face", - "type": "int", + "type": "int", + "name": "face", "description": "点击方块的面,参考[Facing枚举](../枚举值/Facing.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "EntityPlaceBlockAfterServerEvent" + }, { - "type": "event", - "name": "FallingBlockBreakServerEvent", - "method": "", - "description": "触发时机:当下落的方块实体被破坏时,服务端触发该事件", - "remark": "- 不是所有下落的方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义重力方块)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 不是所有下落的方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义重力方块)", + "return": [], + "description": "触发时机:当下落的方块实体被破坏时,服务端触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "fallingBlockId", - "type": "str", + "type": "str", + "name": "fallingBlockId", "description": "下落的方块实体id" - }, + }, { - "name": "fallingBlockX", - "type": "float", + "type": "float", + "name": "fallingBlockX", "description": "下落的方块实体位置x" - }, + }, { - "name": "fallingBlockY", - "type": "float", + "type": "float", + "name": "fallingBlockY", "description": "下落的方块实体位置y" - }, + }, { - "name": "fallingBlockZ", - "type": "float", + "type": "float", + "name": "fallingBlockZ", "description": "下落的方块实体位置z" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "重力方块的identifier,包含命名空间及名称" - }, + }, { - "name": "fallTickAmount", - "type": "int", + "type": "int", + "name": "fallTickAmount", "description": "下落的方块实体持续下落了多少tick" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "下落的方块实体维度id" - }, + }, { - "name": "cancelDrop", - "type": "bool", + "type": "bool", + "name": "cancelDrop", "description": "是否取消方块物品掉落,可以在脚本层中设置" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "FallingBlockBreakServerEvent" + }, { - "type": "event", - "name": "FallingBlockCauseDamageBeforeClientEvent", - "method": "", - "description": "触发时机:当下落的方块开始计算砸到实体的伤害时,客户端触发该事件", - "remark": "- 不是所有下落的方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义重力方块)\r\n - 当该事件的参数数据(fallTickAmount,fallDistance,collidingEntitys,fallDamage)与服务端事件FallingBlockCauseDamageBeforeServerEvent数据有差异时,请以服务端事件数据为准。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 不是所有下落的方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义重力方块)\r\n - 当该事件的参数数据(fallTickAmount,fallDistance,collidingEntitys,fallDamage)与服务端事件FallingBlockCauseDamageBeforeServerEvent数据有差异时,请以服务端事件数据为准。", + "return": [], + "description": "触发时机:当下落的方块开始计算砸到实体的伤害时,客户端触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "fallingBlockId", - "type": "int", + "type": "int", + "name": "fallingBlockId", "description": "下落的方块实体id" - }, + }, { - "name": "fallingBlockX", - "type": "float", + "type": "float", + "name": "fallingBlockX", "description": "下落的方块实体位置x" - }, + }, { - "name": "fallingBlockY", - "type": "float", + "type": "float", + "name": "fallingBlockY", "description": "下落的方块实体位置y" - }, + }, { - "name": "fallingBlockZ", - "type": "float", + "type": "float", + "name": "fallingBlockZ", "description": "下落的方块实体位置z" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "重力方块的identifier,包含命名空间及名称" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "下落的方块实体维度id" - }, + }, { - "name": "collidingEntitys", - "type": "list(str)", + "type": "list(str)", + "name": "collidingEntitys", "description": "当前碰撞到的实体列表id(客户端只能获取到玩家),如果没有的话是None" - }, + }, { - "name": "fallTickAmount", - "type": "int", + "type": "int", + "name": "fallTickAmount", "description": "下落的方块实体持续下落了多少tick" - }, + }, { - "name": "fallDistance", - "type": "float", + "type": "float", + "name": "fallDistance", "description": "下落的方块实体持续下落了多少距离" - }, + }, { - "name": "isHarmful", - "type": "bool", + "type": "bool", + "name": "isHarmful", "description": "客户端始终为false,因为客户端不会计算伤害值" - }, + }, { - "name": "fallDamage", - "type": "int", + "type": "int", + "name": "fallDamage", "description": "对实体的伤害" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "FallingBlockCauseDamageBeforeClientEvent" + }, { - "type": "event", - "name": "FallingBlockCauseDamageBeforeServerEvent", - "method": "", - "description": "触发时机:当下落的方块开始计算砸到实体的伤害时,服务端触发该事件", - "remark": "- 不是所有下落的方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义重力方块)\r\n - 服务端通常触发在客户端之后,而且有时会相差一个tick,这就意味着可能发生以下现象:服务端fallTickAmount比配置强制破坏时间多1tick,下落的距离、下落的伤害计算出来比客户端时间多1tick的误差。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 不是所有下落的方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义重力方块)\r\n - 服务端通常触发在客户端之后,而且有时会相差一个tick,这就意味着可能发生以下现象:服务端fallTickAmount比配置强制破坏时间多1tick,下落的距离、下落的伤害计算出来比客户端时间多1tick的误差。", + "return": [], + "description": "触发时机:当下落的方块开始计算砸到实体的伤害时,服务端触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "fallingBlockId", - "type": "str", + "type": "str", + "name": "fallingBlockId", "description": "下落的方块实体id" - }, + }, { - "name": "fallingBlockX", - "type": "float", + "type": "float", + "name": "fallingBlockX", "description": "下落的方块实体位置x" - }, + }, { - "name": "fallingBlockY", - "type": "float", + "type": "float", + "name": "fallingBlockY", "description": "下落的方块实体位置y" - }, + }, { - "name": "fallingBlockZ", - "type": "float", + "type": "float", + "name": "fallingBlockZ", "description": "下落的方块实体位置z" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "重力方块的identifier,包含命名空间及名称" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "下落的方块实体维度id" - }, + }, { - "name": "collidingEntitys", - "type": "list(str)", + "type": "list(str)", + "name": "collidingEntitys", "description": "当前碰撞到的实体列表id,如果没有的话是None" - }, + }, { - "name": "fallTickAmount", - "type": "int", + "type": "int", + "name": "fallTickAmount", "description": "下落的方块实体持续下落了多少tick" - }, + }, { - "name": "fallDistance", - "type": "float", + "type": "float", + "name": "fallDistance", "description": "下落的方块实体持续下落了多少距离" - }, + }, { - "name": "isHarmful", - "type": "bool", + "type": "bool", + "name": "isHarmful", "description": "是否计算对实体的伤害,引擎传来的值由json配置和伤害是否大于0决定,可在脚本层修改传回引擎" - }, + }, { - "name": "fallDamage", - "type": "int", + "type": "int", + "name": "fallDamage", "description": "对实体的伤害,引擎传来的值距离和json配置决定,可在脚本层修改传回引擎" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "FallingBlockCauseDamageBeforeServerEvent" + }, { - "type": "event", - "name": "FallingBlockReturnHeavyBlockServerEvent", - "method": "", - "description": "触发时机:当下落的方块实体变回普通重力方块时,服务端触发该事件", - "remark": "- 不是所有下落的方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义重力方块)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 不是所有下落的方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义重力方块)", + "return": [], + "description": "触发时机:当下落的方块实体变回普通重力方块时,服务端触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "fallingBlockId", - "type": "int", + "type": "int", + "name": "fallingBlockId", "description": "下落的方块实体id" - }, + }, { - "name": "blockX", - "type": "int", + "type": "int", + "name": "blockX", "description": "方块位置x" - }, + }, { - "name": "blockY", - "type": "int", + "type": "int", + "name": "blockY", "description": "方块位置y" - }, + }, { - "name": "blockZ", - "type": "int", + "type": "int", + "name": "blockZ", "description": "方块位置z" - }, + }, { - "name": "heavyBlockName", - "type": "str", + "type": "str", + "name": "heavyBlockName", "description": "重力方块的identifier,包含命名空间及名称" - }, + }, { - "name": "prevHereBlockName", - "type": "str", + "type": "str", + "name": "prevHereBlockName", "description": "变回重力方块时,原本方块位置的identifier,包含命名空间及名称" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "下落的方块实体维度id" - }, + }, { - "name": "fallTickAmount", - "type": "int", + "type": "int", + "name": "fallTickAmount", "description": "下落的方块实体持续下落了多少tick" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "FallingBlockReturnHeavyBlockServerEvent" + }, { - "type": "event", - "name": "FarmBlockToDirtBlockServerEvent", - "method": "", - "description": "触发时机:耕地退化为泥土时触发", - "remark": "- 指令或者接口的设置不会触发该事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 指令或者接口的设置不会触发该事件", + "return": [], + "description": "触发时机:耕地退化为泥土时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "方块维度" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" - }, + }, { - "name": "setBlockType", - "type": "int", + "type": "int", + "name": "setBlockType", "description": "耕地退化为泥土的原因,参考[SetBlockType](../枚举值/SetBlockType.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "FarmBlockToDirtBlockServerEvent" + }, { - "type": "event", - "name": "GrassBlockToDirtBlockServerEvent", - "method": "", - "description": "触发时机:草方块变成泥土方块时触发", - "remark": "- 指令或者接口的设置不会触发该事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 指令或者接口的设置不会触发该事件", + "return": [], + "description": "触发时机:草方块变成泥土方块时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "方块维度" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "GrassBlockToDirtBlockServerEvent" + }, { - "type": "event", - "name": "HeavyBlockStartFallingServerEvent", - "method": "", - "description": "触发时机:当重力方块变为下落的方块实体后,服务端触发该事件", - "remark": "- 不是所有下落的方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义重力方块)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 不是所有下落的方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义重力方块)", + "return": [], + "description": "触发时机:当重力方块变为下落的方块实体后,服务端触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "fallingBlockId", - "type": "str", + "type": "str", + "name": "fallingBlockId", "description": "下落的方块实体id" - }, + }, { - "name": "blockX", - "type": "int", + "type": "int", + "name": "blockX", "description": "方块位置x" - }, + }, { - "name": "blockY", - "type": "int", + "type": "int", + "name": "blockY", "description": "方块位置y" - }, + }, { - "name": "blockZ", - "type": "int", + "type": "int", + "name": "blockZ", "description": "方块位置z" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "重力方块的identifier,包含命名空间及名称" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "下落的方块实体维度id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "HeavyBlockStartFallingServerEvent" + }, { - "type": "event", - "name": "HopperTryPullInServerEvent", - "method": "", - "description": "触发时机:当漏斗上方连接容器后,容器往漏斗开始输入物品时触发,事件仅触发一次", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:当漏斗上方连接容器后,容器往漏斗开始输入物品时触发,事件仅触发一次", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "漏斗位置x" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "漏斗位置y" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "漏斗位置z" - }, + }, { - "name": "abovePosX", - "type": "int", + "type": "int", + "name": "abovePosX", "description": "交互的容器位置x" - }, + }, { - "name": "abovePosY", - "type": "int", + "type": "int", + "name": "abovePosY", "description": "交互的容器位置y" - }, + }, { - "name": "abovePosZ", - "type": "int", + "type": "int", + "name": "abovePosZ", "description": "交互的容器位置z" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "canHopper", - "type": "bool", + "type": "bool", + "name": "canHopper", "description": "是否允许容器往漏斗加东西(要关闭此交互,需先监听此事件再放置容器)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "HopperTryPullInServerEvent" + }, { - "type": "event", - "name": "HopperTryPullOutServerEvent", - "method": "", - "description": "触发时机:当漏斗以毗邻的方式连接容器时,即从旁边连接容器时,漏斗向容器开始输出物品时触发,事件仅触发一次", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:当漏斗以毗邻的方式连接容器时,即从旁边连接容器时,漏斗向容器开始输出物品时触发,事件仅触发一次", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "漏斗位置x" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "漏斗位置y" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "漏斗位置z" - }, + }, { - "name": "attachedPosX", - "type": "int", + "type": "int", + "name": "attachedPosX", "description": "交互的容器位置x" - }, + }, { - "name": "attachedPosY", - "type": "int", + "type": "int", + "name": "attachedPosY", "description": "交互的容器位置y" - }, + }, { - "name": "attachedPosZ", - "type": "int", + "type": "int", + "name": "attachedPosZ", "description": "交互的容器位置z" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "canHopper", - "type": "bool", + "type": "bool", + "name": "canHopper", "description": "是否允许漏斗往容器加东西(要关闭此交互,需先监听此事件再放置容器)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "HopperTryPullOutServerEvent" + }, { - "type": "event", - "name": "ModBlockEntityLoadedClientEvent", - "method": "", - "description": "客户端自定义方块实体初始化完成时触发", - "remark": "- 只有添加了自定义方块实体扩展功能的自定义方块实体才能触发该事件(见自定义方块实体外观),请用该事件来初始化自定义方块实体的molang,否则方块实体未初始化完成会设置失败。\r\n - 实际触发时机是自定义方块实体第一次出现在玩家视野中时触发,玩家离开后又回来时方块实体会重新加载并初始化。但由于出生点是常加载区域,来回传送不会重复触发此事件。\r\n - 该事件在OnModBlockNeteaseEffectCreatedClientEvent后触发。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 只有添加了自定义方块实体扩展功能的自定义方块实体才能触发该事件(见自定义方块实体外观),请用该事件来初始化自定义方块实体的molang,否则方块实体未初始化完成会设置失败。\r\n - 实际触发时机是自定义方块实体第一次出现在玩家视野中时触发,玩家离开后又回来时方块实体会重新加载并初始化。但由于出生点是常加载区域,来回传送不会重复触发此事件。\r\n - 该事件在OnModBlockNeteaseEffectCreatedClientEvent后触发。", + "return": [], + "description": "客户端自定义方块实体初始化完成时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "posX", - "type": "int", + "type": "int", + "name": "posX", "description": "自定义方块实体的位置X" - }, + }, { - "name": "posY", - "type": "int", + "type": "int", + "name": "posY", "description": "自定义方块实体的位置Y" - }, + }, { - "name": "posZ", - "type": "int", + "type": "int", + "name": "posZ", "description": "自定义方块实体的位置Z" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ModBlockEntityLoadedClientEvent" + }, { - "type": "event", - "name": "ModBlockEntityRemoveClientEvent", - "method": "", - "description": "客户端自定义方块实体卸载时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "客户端自定义方块实体卸载时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "posX", - "type": "int", + "type": "int", + "name": "posX", "description": "自定义方块实体的位置X" - }, + }, { - "name": "posY", - "type": "int", + "type": "int", + "name": "posY", "description": "自定义方块实体的位置Y" - }, + }, { - "name": "posZ", - "type": "int", + "type": "int", + "name": "posZ", "description": "自定义方块实体的位置Z" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ModBlockEntityRemoveClientEvent" + }, { - "type": "event", - "name": "ModBlockEntityTickClientEvent", - "method": "", - "description": "客户端自定义方块实体tick事件", - "remark": "- 只有client_tick字段为true的自定义方块实体才能触发该事件(见自定义方块实体\r\n - 目前客户端实体tick范围为硬编码,范围为玩家为中心的等腰等斜边八边形,其中斜边长度为5,非斜边长度为3", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 只有client_tick字段为true的自定义方块实体才能触发该事件(见自定义方块实体\r\n - 目前客户端实体tick范围为硬编码,范围为玩家为中心的等腰等斜边八边形,其中斜边长度为5,非斜边长度为3", + "return": [], + "description": "客户端自定义方块实体tick事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "posX", - "type": "int", + "type": "int", + "name": "posX", "description": "自定义方块实体的位置X" - }, + }, { - "name": "posY", - "type": "int", + "type": "int", + "name": "posY", "description": "自定义方块实体的位置Y" - }, + }, { - "name": "posZ", - "type": "int", + "type": "int", + "name": "posZ", "description": "自定义方块实体的位置Z" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ModBlockEntityTickClientEvent" + }, { - "type": "event", - "name": "OnAfterFallOnBlockClientEvent", - "method": "", - "description": "触发时机:当实体降落到方块后客户端触发,主要用于力的计算", - "remark": "- 不是所有方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义方块JSON组件)\r\n - 如果要在脚本层修改motion,回传的需要是浮点型,例如需要赋值0.0而不是0\r\n - 如果需要修改实体的力,最好配合服务端事件同步修改,避免产生非预期现象\r\n - 因为引擎最后一定会按照原版方块规则计算力(普通方块置0,床、粘液块等反弹),所以脚本层如果想直接修改当前力需要将calculate设为true取消原版计算,按照传回值计算\r\n - 引擎在落地之后OnAfterFallOnBlockClientEvent会一直触发,因此请在脚本层中做对应的逻辑判断\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 不是所有方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义方块JSON组件)\r\n - 如果要在脚本层修改motion,回传的需要是浮点型,例如需要赋值0.0而不是0\r\n - 如果需要修改实体的力,最好配合服务端事件同步修改,避免产生非预期现象\r\n - 因为引擎最后一定会按照原版方块规则计算力(普通方块置0,床、粘液块等反弹),所以脚本层如果想直接修改当前力需要将calculate设为true取消原版计算,按照传回值计算\r\n - 引擎在落地之后OnAfterFallOnBlockClientEvent会一直触发,因此请在脚本层中做对应的逻辑判断\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:当实体降落到方块后客户端触发,主要用于力的计算", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "posX", - "type": "float", + "type": "float", + "name": "posX", "description": "实体位置x" - }, + }, { - "name": "posY", - "type": "float", + "type": "float", + "name": "posY", "description": "实体位置y" - }, + }, { - "name": "posZ", - "type": "float", + "type": "float", + "name": "posZ", "description": "实体位置z" - }, + }, { - "name": "motionX", - "type": "float", + "type": "float", + "name": "motionX", "description": "瞬时移动X方向的力" - }, + }, { - "name": "motionY", - "type": "float", + "type": "float", + "name": "motionY", "description": "瞬时移动Y方向的力" - }, + }, { - "name": "motionZ", - "type": "float", + "type": "float", + "name": "motionZ", "description": "瞬时移动Z方向的力" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "calculate", - "type": "bool", + "type": "bool", + "name": "calculate", "description": "是否按脚本层传值计算力" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnAfterFallOnBlockClientEvent" + }, { - "type": "event", - "name": "OnAfterFallOnBlockServerEvent", - "method": "", - "description": "触发时机:当实体降落到方块后服务端触发,主要用于力的计算", - "remark": "- 不是所有方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义方块JSON组件)\r\n - 如果要在脚本层修改motion,回传的需要是浮点型,例如需要赋值0.0而不是0\r\n - 如果需要修改实体的力,最好配合客户端事件同步修改,避免产生非预期现象\r\n - 因为引擎最后一定会按照原版方块规则计算力(普通方块置0,床、粘液块等反弹),所以脚本层如果想直接修改当前力需要将calculate设为true取消原版计算,按照传回值计算\r\n - 引擎在落地之后,OnAfterFallOnBlockServerEvent会一直触发,因此请在脚本层中做对应的逻辑判断\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 不是所有方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义方块JSON组件)\r\n - 如果要在脚本层修改motion,回传的需要是浮点型,例如需要赋值0.0而不是0\r\n - 如果需要修改实体的力,最好配合客户端事件同步修改,避免产生非预期现象\r\n - 因为引擎最后一定会按照原版方块规则计算力(普通方块置0,床、粘液块等反弹),所以脚本层如果想直接修改当前力需要将calculate设为true取消原版计算,按照传回值计算\r\n - 引擎在落地之后,OnAfterFallOnBlockServerEvent会一直触发,因此请在脚本层中做对应的逻辑判断\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:当实体降落到方块后服务端触发,主要用于力的计算", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "posX", - "type": "float", + "type": "float", + "name": "posX", "description": "实体位置x" - }, + }, { - "name": "posY", - "type": "float", + "type": "float", + "name": "posY", "description": "实体位置y" - }, + }, { - "name": "posZ", - "type": "float", + "type": "float", + "name": "posZ", "description": "实体位置z" - }, + }, { - "name": "motionX", - "type": "float", + "type": "float", + "name": "motionX", "description": "瞬时移动X方向的力" - }, + }, { - "name": "motionY", - "type": "float", + "type": "float", + "name": "motionY", "description": "瞬时移动Y方向的力" - }, + }, { - "name": "motionZ", - "type": "float", + "type": "float", + "name": "motionZ", "description": "瞬时移动Z方向的力" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "calculate", - "type": "bool", + "type": "bool", + "name": "calculate", "description": "是否按脚本层传值计算力" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnAfterFallOnBlockServerEvent" + }, { - "type": "event", - "name": "OnBeforeFallOnBlockServerEvent", - "method": "", - "description": "触发时机:当实体刚降落到方块上时服务端触发,主要用于伤害计算", - "remark": "- 不是所有方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义方块JSON组件)\r\n - 如果要在脚本层修改fallDistance,回传的一定要是浮点型,例如需要赋值0.0而不是0\r\n - 可能会因为轻微的反弹触发多次,可在脚本层针对fallDistance的值进行判断\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 不是所有方块都会触发该事件,需要在json中先配置触发开关(详情参考:自定义方块JSON组件)\r\n - 如果要在脚本层修改fallDistance,回传的一定要是浮点型,例如需要赋值0.0而不是0\r\n - 可能会因为轻微的反弹触发多次,可在脚本层针对fallDistance的值进行判断\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:当实体刚降落到方块上时服务端触发,主要用于伤害计算", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "blockX", - "type": "int", + "type": "int", + "name": "blockX", "description": "方块位置x" - }, + }, { - "name": "blockY", - "type": "int", + "type": "int", + "name": "blockY", "description": "方块位置y" - }, + }, { - "name": "blockZ", - "type": "int", + "type": "int", + "name": "blockZ", "description": "方块位置z" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "fallDistance", - "type": "float", + "type": "float", + "name": "fallDistance", "description": "实体下降距离,可在脚本层传给引擎" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消引擎对实体下降伤害的计算" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnBeforeFallOnBlockServerEvent" + }, { - "type": "event", - "name": "OnEntityInsideBlockClientEvent", - "method": "", - "description": "可以动态删除netease:on_entity_inside组件", - "remark": "- 目前仅能动态删除原版方块的netease:on_entity_inside组件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 目前仅能动态删除原版方块的netease:on_entity_inside组件", + "return": [], + "description": "可以动态删除netease:on_entity_inside组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块标识符,包含命名空间,如minecraft:grass" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnEntityInsideBlockClientEvent" + }, { - "type": "event", - "name": "OnEntityInsideBlockServerEvent", - "method": "", - "description": "可以动态删除netease:on_entity_inside组件", - "remark": "- 目前仅能动态删除原版方块的netease:on_entity_inside组件\r\n - (非租赁服联机)使用服务端接口注册会影响到房主客户端组件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 目前仅能动态删除原版方块的netease:on_entity_inside组件\r\n - (非租赁服联机)使用服务端接口注册会影响到房主客户端组件", + "return": [], + "description": "可以动态删除netease:on_entity_inside组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块标识符,包含命名空间,如minecraft:grass" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnEntityInsideBlockServerEvent" + }, { - "type": "event", - "name": "OnModBlockNeteaseEffectCreatedClientEvent", - "method": "", - "description": "自定义方块实体绑定的特效创建成功事件,在自定义方块实体中绑定的特效创建成功时触发以及使用接口CreateFrameEffectForBlockEntity或CreateParticleEffectForBlockEntity为自定义方块实体添加特效成功时触发。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "自定义方块实体绑定的特效创建成功事件,在自定义方块实体中绑定的特效创建成功时触发以及使用接口CreateFrameEffectForBlockEntity或CreateParticleEffectForBlockEntity为自定义方块实体添加特效成功时触发。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "effectName", - "type": "str", + "type": "str", + "name": "effectName", "description": "创建成功的特效的自定义键值名称" - }, + }, { - "name": "id", - "type": "int", + "type": "int", + "name": "id", "description": "该特效的id" - }, + }, { - "name": "effectType", - "type": "int", + "type": "int", + "name": "effectType", "description": "该特效的类型,0为粒子特效,1为序列帧特效" - }, + }, { - "name": "blockPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "blockPos", "description": "该特效绑定的自定义方块实体的世界坐标" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnModBlockNeteaseEffectCreatedClientEvent" + }, { - "type": "event", - "name": "OnStandOnBlockClientEvent", - "method": "", - "description": "可以动态删除netease:on_stand_on组件", - "remark": "- 目前仅能动态删除原版方块的netease:on_stand_on组件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 目前仅能动态删除原版方块的netease:on_stand_on组件", + "return": [], + "description": "可以动态删除netease:on_stand_on组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块标识符,包含命名空间,如minecraft:grass" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnStandOnBlockClientEvent" + }, { - "type": "event", - "name": "OnStandOnBlockServerEvent", - "method": "", - "description": "可以动态删除netease:on_stand_on组件", - "remark": "- 目前仅能动态删除原版方块的netease:on_stand_on组件\r\n - (非租赁服联机)使用服务端接口注册会影响到房主客户端组件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 目前仅能动态删除原版方块的netease:on_stand_on组件\r\n - (非租赁服联机)使用服务端接口注册会影响到房主客户端组件", + "return": [], + "description": "可以动态删除netease:on_stand_on组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块标识符,包含命名空间,如minecraft:grass" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnStandOnBlockServerEvent" + }, { - "type": "event", - "name": "PistonActionServerEvent", - "method": "", - "description": "触发时机:活塞或者粘性活塞推送/缩回影响附近方块时", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:活塞或者粘性活塞推送/缩回影响附近方块时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否允许触发,默认为False,若设为True,可阻止触发后续的事件" - }, + }, { - "name": "action", - "type": "str", + "type": "str", + "name": "action", "description": "推送时=expanding;缩回时=retracting" - }, + }, { - "name": "pistonFacing", - "type": "int", + "type": "int", + "name": "pistonFacing", "description": "活塞的朝向,参考[Facing枚举](../枚举值/Facing.md)" - }, + }, { - "name": "pistonMoveFacing", - "type": "int", + "type": "int", + "name": "pistonMoveFacing", "description": "活塞的运动方向,参考[Facing枚举](../枚举值/Facing.md)" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "活塞方块所在的维度" - }, + }, { - "name": "pistonX", - "type": "int", + "type": "int", + "name": "pistonX", "description": "活塞方块的x坐标" - }, + }, { - "name": "pistonY", - "type": "int", + "type": "int", + "name": "pistonY", "description": "活塞方块的y坐标" - }, + }, { - "name": "pistonZ", - "type": "int", + "type": "int", + "name": "pistonZ", "description": "活塞方块的z坐标" - }, + }, { - "name": "blockList", - "type": "list[[x,y,z],...]", + "type": "list[[x,y,z],...]", + "name": "blockList", "description": "活塞运动影响到产生被移动效果的方块坐标[x,y,z],均为int类型" - }, + }, { - "name": "breakBlockList", - "type": "list[[x,y,z],...]", + "type": "list[[x,y,z],...]", + "name": "breakBlockList", "description": "活塞运动影响到产生被破坏效果的方块坐标[x,y,z],均为int类型" - }, + }, { - "name": "entityList", - "type": "list[string,...]", + "type": "list[string,...]", + "name": "entityList", "description": "活塞运动影响到产生被移动或被破坏效果的实体的ID列表" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PistonActionServerEvent" + }, { - "type": "event", - "name": "PlayerTryDestroyBlockClientEvent", - "method": "", - "description": "当玩家即将破坏方块时,客户端线程触发该事件。主要用于床,旗帜,箱子这些根据方块实体数据进行渲染的方块,一般情况下请使用ServerPlayerTryDestroyBlockEvent", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "当玩家即将破坏方块时,客户端线程触发该事件。主要用于床,旗帜,箱子这些根据方块实体数据进行渲染的方块,一般情况下请使用ServerPlayerTryDestroyBlockEvent", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" - }, + }, { - "name": "face", - "type": "int", + "type": "int", + "name": "face", "description": "方块被敲击的面向id,参考[Facing枚举](../枚举值/Facing.md)" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxData", - "type": "int", + "type": "int", + "name": "auxData", "description": "方块附加值" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "试图破坏方块的玩家ID" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "默认为False,在脚本层设置为True就能取消该方块的破坏" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PlayerTryDestroyBlockClientEvent" + }, { - "type": "event", - "name": "ServerBlockEntityTickEvent", - "method": "", - "description": "触发时机:自定义方块配置了netease:block_entity组件并设tick为true,方块在玩家的模拟距离(新建存档时可以设置,默认为4个区块)内,或者在tickingarea内的时候触发", - "remark": "- **方块实体的tick事件频率为每秒钟20次**\r\n - 触发本事件时,若正在退出游戏,将无法获取到抛出本事件的方块实体数据(GetBlockEntityData函数返回None),也无法对其进行操作", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- **方块实体的tick事件频率为每秒钟20次**\r\n - 触发本事件时,若正在退出游戏,将无法获取到抛出本事件的方块实体数据(GetBlockEntityData函数返回None),也无法对其进行操作", + "return": [], + "description": "触发时机:自定义方块配置了netease:block_entity组件并设tick为true,方块在玩家的模拟距离(新建存档时可以设置,默认为4个区块)内,或者在tickingarea内的时候触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "该方块名称" - }, + }, { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "该方块所在的维度" - }, + }, { - "name": "posX", - "type": "int", + "type": "int", + "name": "posX", "description": "该方块的x坐标" - }, + }, { - "name": "posY", - "type": "int", + "type": "int", + "name": "posY", "description": "该方块的y坐标" - }, + }, { - "name": "posZ", - "type": "int", + "type": "int", + "name": "posZ", "description": "该方块的z坐标" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ServerBlockEntityTickEvent" + }, { - "type": "event", - "name": "ServerBlockUseEvent", - "method": "", - "description": "清空所有已添加方块对ServerBlockUseEvent事件的脚本层监听", - "remark": "- 当对原生方块进行使用时,如堆肥桶等类似有 使用 功能的方块使用物品时,会触发该事件,而ServerItemUseOnEvent则不会被触发。对应的客户端事件同理。\r\n - 有的方块是在ServerBlockUseEvent中设置cancel生效,但是有部分方块是在ClientBlockUseEvent中设置cancel才生效,如有需求建议在两个事件中同时设置cancel以保证生效。\r\n - 部分工具对方块的使用效果,如锹犁地,不一定能通过该事件cancel,还需同时使用ItemUseOnServerEvent进行取消\r\n 目前已知有:\r\n 锹犁地相关的方块:草地、泥土、砂土、菌丝体、灰化土、缠根泥土,均需同时通过ServerBlockUseEvent和ItemUseOnServerEvent进行取消\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件\r\n\r\n\r\n### 相关接口\r\n\r\n\r\n### AddBlockItemListenForUseEvent\r\n\r\nmethod in mod.server.component.blockUseEventWhiteListCompServer.BlockUseEventWhiteListComponentServer", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 当对原生方块进行使用时,如堆肥桶等类似有 使用 功能的方块使用物品时,会触发该事件,而ServerItemUseOnEvent则不会被触发。对应的客户端事件同理。\r\n - 有的方块是在ServerBlockUseEvent中设置cancel生效,但是有部分方块是在ClientBlockUseEvent中设置cancel才生效,如有需求建议在两个事件中同时设置cancel以保证生效。\r\n - 部分工具对方块的使用效果,如锹犁地,不一定能通过该事件cancel,还需同时使用ItemUseOnServerEvent进行取消\r\n 目前已知有:\r\n 锹犁地相关的方块:草地、泥土、砂土、菌丝体、灰化土、缠根泥土,均需同时通过ServerBlockUseEvent和ItemUseOnServerEvent进行取消\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件\r\n\r\n\r\n### 相关接口\r\n\r\n\r\n### AddBlockItemListenForUseEvent\r\n\r\nmethod in mod.server.component.blockUseEventWhiteListCompServer.BlockUseEventWhiteListComponentServer", + "return": [], + "description": "清空所有已添加方块对ServerBlockUseEvent事件的脚本层监听", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "ServerBlockUseEvent" + }, { - "type": "event", - "name": "ServerEntityTryPlaceBlockEvent", - "method": "", - "description": "触发时机:当生物试图放置方块时触发该事件。", - "remark": "- 部分放置后会产生实体的方块、可操作的方块、带有特殊逻辑的方块,不会触发该事件,包括但不限于床、门、告示牌、船、头部模型、盔甲架,半台阶方块叠加时等。\r\n - 修改放置方块信息只对一般方块有效,对一些特殊方块无效,会导致放置取消,特殊方块包括:钟、蜡烛、管珊瑚扇、台阶、青蛙卵、脚手架、海泡菜、顶层雪、睡莲\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 部分放置后会产生实体的方块、可操作的方块、带有特殊逻辑的方块,不会触发该事件,包括但不限于床、门、告示牌、船、头部模型、盔甲架,半台阶方块叠加时等。\r\n - 修改放置方块信息只对一般方块有效,对一些特殊方块无效,会导致放置取消,特殊方块包括:钟、蜡烛、管珊瑚扇、台阶、青蛙卵、脚手架、海泡菜、顶层雪、睡莲\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:当生物试图放置方块时触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标,支持修改" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标,支持修改" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标,支持修改" - }, + }, { - "name": "fullName", - "type": "str", + "type": "str", + "name": "fullName", "description": "方块的identifier,包含命名空间及名称,支持修改" - }, + }, { - "name": "auxData", - "type": "int", + "type": "int", + "name": "auxData", "description": "方块附加值,支持修改" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "试图放置方块的生物ID" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "face", - "type": "int", + "type": "int", + "name": "face", "description": "点击方块的面,参考[Facing枚举](../枚举值/Facing.md)" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "默认为False,在脚本层设置为True就能取消该方块的放置" - }, + }, { - "name": "clickX", - "type": "float", + "type": "float", + "name": "clickX", "description": "点击点的x比例位置" - }, + }, { - "name": "clickY", - "type": "float", + "type": "float", + "name": "clickY", "description": "点击点的y比例位置" - }, + }, { - "name": "clickZ", - "type": "float", + "type": "float", + "name": "clickZ", "description": "点击点的z比例位置" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ServerEntityTryPlaceBlockEvent" + }, { - "type": "event", - "name": "ServerPlaceBlockEntityEvent", - "method": "", - "description": "触发时机:手动放置或通过接口创建含自定义方块实体的方块时触发,此时可向该方块实体中存放数据", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "", + "return": [], + "description": "触发时机:手动放置或通过接口创建含自定义方块实体的方块时触发,此时可向该方块实体中存放数据", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "该方块名称" - }, + }, { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "该方块所在的维度" - }, + }, { - "name": "posX", - "type": "int", + "type": "int", + "name": "posX", "description": "该方块的x坐标" - }, + }, { - "name": "posY", - "type": "int", + "type": "int", + "name": "posY", "description": "该方块的y坐标" - }, + }, { - "name": "posZ", - "type": "int", + "type": "int", + "name": "posZ", "description": "该方块的z坐标" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ServerPlaceBlockEntityEvent" + }, { - "type": "event", - "name": "ServerPlayerTryDestroyBlockEvent", - "method": "", - "description": "当玩家即将破坏方块时,服务端线程触发该事件。", - "remark": "- 若需要禁止某些特殊方块的破坏,需要配合PlayerTryDestroyBlockClientEvent一起使用,例如床,旗帜,箱子这些根据方块实体数据进行渲染的方块\r\n - 该服务端事件触发于玩家破坏方块时,当方块为秒破方块时(破坏方块所需时间为0或未设置破坏时间),本事件触发在StartDestroyBlockServerEvent事件之前;当方块为非秒破方块时,本事件触发在StartDestroyBlockServerEvent事件之后。\r\n - 可通过minecraft:destroy_time方块组件来修改方块的破坏时间\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 若需要禁止某些特殊方块的破坏,需要配合PlayerTryDestroyBlockClientEvent一起使用,例如床,旗帜,箱子这些根据方块实体数据进行渲染的方块\r\n - 该服务端事件触发于玩家破坏方块时,当方块为秒破方块时(破坏方块所需时间为0或未设置破坏时间),本事件触发在StartDestroyBlockServerEvent事件之前;当方块为非秒破方块时,本事件触发在StartDestroyBlockServerEvent事件之后。\r\n - 可通过minecraft:destroy_time方块组件来修改方块的破坏时间\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "当玩家即将破坏方块时,服务端线程触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" - }, + }, { - "name": "face", - "type": "int", + "type": "int", + "name": "face", "description": "方块被敲击的面向id,参考[Facing枚举](../枚举值/Facing.md)" - }, + }, { - "name": "fullName", - "type": "str", + "type": "str", + "name": "fullName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxData", - "type": "int", + "type": "int", + "name": "auxData", "description": "方块附加值" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "试图破坏方块的玩家ID" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "默认为False,在脚本层设置为True就能取消该方块的破坏" - }, + }, { - "name": "spawnResources", - "type": "bool", + "type": "bool", + "name": "spawnResources", "description": "是否生成掉落物,默认为True,在脚本层设置为False就能取消生成掉落物" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ServerPlayerTryDestroyBlockEvent" + }, { - "type": "event", - "name": "ShearsDestoryBlockBeforeClientEvent", - "method": "", - "description": "触发时机:玩家手持剪刀破坏方块时,有剪刀特殊效果的方块会在客户端线程触发该事件", - "remark": "- 目前仅绊线会触发,需要取消剪刀效果得配合ShearsDestoryBlockBeforeServerEvent同时使用\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 目前仅绊线会触发,需要取消剪刀效果得配合ShearsDestoryBlockBeforeServerEvent同时使用\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家手持剪刀破坏方块时,有剪刀特殊效果的方块会在客户端线程触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockX", - "type": "int", + "type": "int", + "name": "blockX", "description": "方块位置x" - }, + }, { - "name": "blockY", - "type": "int", + "type": "int", + "name": "blockY", "description": "方块位置y" - }, + }, { - "name": "blockZ", - "type": "int", + "type": "int", + "name": "blockZ", "description": "方块位置z" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxData", - "type": "int", + "type": "int", + "name": "auxData", "description": "方块附加值" - }, + }, { - "name": "dropName", - "type": "str", + "type": "str", + "name": "dropName", "description": "触发剪刀效果的掉落物identifier,包含命名空间及名称" - }, + }, { - "name": "dropCount", - "type": "int", + "type": "int", + "name": "dropCount", "description": "触发剪刀效果的掉落物数量" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "触发剪刀效果的玩家id" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "玩家触发时的维度id" - }, + }, { - "name": "cancelShears", - "type": "bool", + "type": "bool", + "name": "cancelShears", "description": "是否取消剪刀效果" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ShearsDestoryBlockBeforeClientEvent" + }, { - "type": "event", - "name": "ShearsDestoryBlockBeforeServerEvent", - "method": "", - "description": "触发时机:玩家手持剪刀破坏方块时,有剪刀特殊效果的方块会在服务端线程触发该事件", - "remark": "- 该事件触发在ServerPlayerTryDestroyBlockEvent之后,如果在ServerPlayerTryDestroyBlockEvent事件中设置了取消Destory或取消掉落物会导致该事件不触发\r\n - 取消剪刀效果后不掉落任何东西的方块类型:蜘蛛网、枯萎的灌木、草丛、下界苗、树叶、海草、藤蔓\r\n - 绊线取消剪刀效果需要配合ShearsDestoryBlockBeforeClientEvent同时使用,否则在表现上可能展现出来的还是剪刀剪断后的效果。绊线取消剪刀效果后依然会掉落成线。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 该事件触发在ServerPlayerTryDestroyBlockEvent之后,如果在ServerPlayerTryDestroyBlockEvent事件中设置了取消Destory或取消掉落物会导致该事件不触发\r\n - 取消剪刀效果后不掉落任何东西的方块类型:蜘蛛网、枯萎的灌木、草丛、下界苗、树叶、海草、藤蔓\r\n - 绊线取消剪刀效果需要配合ShearsDestoryBlockBeforeClientEvent同时使用,否则在表现上可能展现出来的还是剪刀剪断后的效果。绊线取消剪刀效果后依然会掉落成线。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家手持剪刀破坏方块时,有剪刀特殊效果的方块会在服务端线程触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockX", - "type": "int", + "type": "int", + "name": "blockX", "description": "方块位置x" - }, + }, { - "name": "blockY", - "type": "int", + "type": "int", + "name": "blockY", "description": "方块位置y" - }, + }, { - "name": "blockZ", - "type": "int", + "type": "int", + "name": "blockZ", "description": "方块位置z" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxData", - "type": "int", + "type": "int", + "name": "auxData", "description": "方块附加值" - }, + }, { - "name": "dropName", - "type": "str", + "type": "str", + "name": "dropName", "description": "触发剪刀效果的掉落物identifier,包含命名空间及名称" - }, + }, { - "name": "dropCount", - "type": "int", + "type": "int", + "name": "dropCount", "description": "触发剪刀效果的掉落物数量" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "触发剪刀效果的玩家id" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "玩家触发时的维度id" - }, + }, { - "name": "cancelShears", - "type": "bool", + "type": "bool", + "name": "cancelShears", "description": "是否取消剪刀效果" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ShearsDestoryBlockBeforeServerEvent" + }, { - "type": "event", - "name": "StartDestroyBlockClientEvent", - "method": "", - "description": "玩家开始挖方块时触发。创造模式下不触发。", - "remark": "- 如果是隔着火焰挖方块,即使将该事件cancel掉,火焰也会被扑灭。如果要阻止火焰扑灭,需要配合ExtinguishFireClientEvent使用\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 如果是隔着火焰挖方块,即使将该事件cancel掉,火焰也会被扑灭。如果要阻止火焰扑灭,需要配合ExtinguishFireClientEvent使用\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家开始挖方块时触发。创造模式下不触发。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "方块的坐标" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块的附加值" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "修改为True时,可阻止玩家进入挖方块的状态。需要与StartDestroyBlockServerEvent一起修改。" - }, + }, { - "name": "face", - "type": "int", + "type": "int", + "name": "face", "description": "方块被敲击面,参考[Facing枚举](../枚举值/Facing.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "StartDestroyBlockClientEvent" + }, { - "type": "event", - "name": "StartDestroyBlockServerEvent", - "method": "", - "description": "玩家开始挖方块时触发。创造模式下不触发。", - "remark": "- 如果是隔着火焰挖方块,即使将该事件cancel掉,火焰也会被扑灭。如果要阻止火焰扑灭,需要配合ExtinguishFireServerEvent使用\r\n - 该服务端事件触发于服务端收到玩家破坏操作时,当方块为秒破方块时(破坏方块所需时间为0或未设置破坏时间),ServerPlayerTryDestroyBlockEvent事件触发在本事件之前;当方块为非秒破方块时,ServerPlayerTryDestroyBlockEvent事件触发在本事件之后。\r\n - 秒破方块在本事件触发前已经被服务端删除,此时本事件获取到的blockName为minecraft:air,且无法通过本事件进行取消操作,以下是两个解决方法:\r\n (1)用ServerPlayerTryDestroyBlockEvent获取到正确的方块信息或取消操作。\r\n (2)通过minecraft:destroy_time方块组件来修改方块的破坏时间。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 如果是隔着火焰挖方块,即使将该事件cancel掉,火焰也会被扑灭。如果要阻止火焰扑灭,需要配合ExtinguishFireServerEvent使用\r\n - 该服务端事件触发于服务端收到玩家破坏操作时,当方块为秒破方块时(破坏方块所需时间为0或未设置破坏时间),ServerPlayerTryDestroyBlockEvent事件触发在本事件之前;当方块为非秒破方块时,ServerPlayerTryDestroyBlockEvent事件触发在本事件之后。\r\n - 秒破方块在本事件触发前已经被服务端删除,此时本事件获取到的blockName为minecraft:air,且无法通过本事件进行取消操作,以下是两个解决方法:\r\n (1)用ServerPlayerTryDestroyBlockEvent获取到正确的方块信息或取消操作。\r\n (2)通过minecraft:destroy_time方块组件来修改方块的破坏时间。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家开始挖方块时触发。创造模式下不触发。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "方块的坐标" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块的附加值" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "修改为True时,可阻止玩家进入挖方块的状态。需要与StartDestroyBlockClientEvent一起修改。" - }, + }, { - "name": "face", - "type": "int", + "type": "int", + "name": "face", "description": "方块被敲击面,参考[Facing枚举](../枚举值/Facing.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "StartDestroyBlockServerEvent" + }, { - "type": "event", - "name": "StepOffBlockClientEvent", - "method": "", - "description": "可以动态删除netease:on_step_off组件", - "remark": "- 目前仅能动态删除原版方块的netease:on_step_off组件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 目前仅能动态删除原版方块的netease:on_step_off组件", + "return": [], + "description": "可以动态删除netease:on_step_off组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块标识符,包含命名空间,如minecraft:grass" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "StepOffBlockClientEvent" + }, { - "type": "event", - "name": "StepOffBlockServerEvent", - "method": "", - "description": "可以动态删除netease:on_step_off组件", - "remark": "- 目前仅能动态删除原版方块的netease:on_step_off组件\r\n - (非租赁服联机)使用服务端接口注册会影响到房主客户端组件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 目前仅能动态删除原版方块的netease:on_step_off组件\r\n - (非租赁服联机)使用服务端接口注册会影响到房主客户端组件", + "return": [], + "description": "可以动态删除netease:on_step_off组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块标识符,包含命名空间,如minecraft:grass" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "StepOffBlockServerEvent" + }, { - "type": "event", - "name": "StepOnBlockClientEvent", - "method": "", - "description": "可以动态删除netease:on_step_on组件", - "remark": "- 目前仅能动态删除原版方块的netease:on_step_on组件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 目前仅能动态删除原版方块的netease:on_step_on组件", + "return": [], + "description": "可以动态删除netease:on_step_on组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块标识符,包含命名空间,如minecraft:grass" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "StepOnBlockClientEvent" + }, { - "type": "event", - "name": "StepOnBlockServerEvent", - "method": "", - "description": "可以动态删除netease:on_step_on组件", - "remark": "- 目前仅能动态删除原版方块的netease:on_step_on组件\r\n - (非租赁服联机)使用服务端接口注册会影响到房主客户端组件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "remark": "- 目前仅能动态删除原版方块的netease:on_step_on组件\r\n - (非租赁服联机)使用服务端接口注册会影响到房主客户端组件", + "return": [], + "description": "可以动态删除netease:on_step_on组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/方块.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块标识符,包含命名空间,如minecraft:grass" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "StepOnBlockServerEvent" + }, { - "type": "event", - "name": "AttackAnimBeginClientEvent", - "method": "", - "description": "攻击动作开始时触发", - "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "攻击动作开始时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "AttackAnimBeginClientEvent" + }, { - "type": "event", - "name": "AttackAnimBeginServerEvent", - "method": "", - "description": "当攻击动作开始时触发", - "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "当攻击动作开始时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "AttackAnimBeginServerEvent" + }, { - "type": "event", - "name": "AttackAnimEndClientEvent", - "method": "", - "description": "攻击动作结束时触发", - "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "攻击动作结束时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "AttackAnimEndClientEvent" + }, { - "type": "event", - "name": "AttackAnimEndServerEvent", - "method": "", - "description": "当攻击动作结束时触发", - "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "当攻击动作结束时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "AttackAnimEndServerEvent" + }, { - "type": "event", - "name": "JumpAnimBeginServerEvent", - "method": "", - "description": "当跳跃动作开始时触发", - "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "当跳跃动作开始时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "JumpAnimBeginServerEvent" + }, { - "type": "event", - "name": "WalkAnimBeginClientEvent", - "method": "", - "description": "走路动作开始时触发", - "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "走路动作开始时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "WalkAnimBeginClientEvent" + }, { - "type": "event", - "name": "WalkAnimBeginServerEvent", - "method": "", - "description": "当走路动作开始时触发", - "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "当走路动作开始时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "WalkAnimBeginServerEvent" + }, { - "type": "event", - "name": "WalkAnimEndClientEvent", - "method": "", - "description": "走路动作结束时触发", - "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "走路动作结束时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "WalkAnimEndClientEvent" + }, { - "type": "event", - "name": "WalkAnimEndServerEvent", - "method": "", - "description": "当走路动作结束时触发", - "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "remark": "- 使用SetModel替换骨骼模型后,该事件才生效\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "当走路动作结束时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/模型.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "WalkAnimEndServerEvent" + }, { - "type": "event", - "name": "ActorAcquiredItemClientEvent", - "method": "", - "description": "触发时机:玩家获得物品时客户端抛出的事件(有些获取物品方式只会触发客户端事件,有些获取物品方式只会触发服务端事件,在使用时注意一点。)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "触发时机:玩家获得物品时客户端抛出的事件(有些获取物品方式只会触发客户端事件,有些获取物品方式只会触发服务端事件,在使用时注意一点。)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "actor", - "type": "str", + "type": "str", + "name": "actor", "description": "获得物品玩家实体id" - }, + }, { - "name": "secondaryActor", - "type": "str", + "type": "str", + "name": "secondaryActor", "description": "物品给予者玩家实体id,如果不存在给予者的话,这里为空字符串" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "获取到的物品的物品信息字典" - }, + }, { - "name": "acquireMethod", - "type": "int", + "type": "int", + "name": "acquireMethod", "description": "获得物品的方法,详见[ItemAcquisitionMethod](../枚举值/ItemAcquisitionMethod.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ActorAcquiredItemClientEvent" + }, { - "type": "event", - "name": "ActorAcquiredItemServerEvent", - "method": "", - "description": "触发时机:玩家获得物品时服务端抛出的事件(有些获取物品方式只会触发客户端事件,有些获取物品方式只会触发服务端事件,在使用时注意一点。)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "触发时机:玩家获得物品时服务端抛出的事件(有些获取物品方式只会触发客户端事件,有些获取物品方式只会触发服务端事件,在使用时注意一点。)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "actor", - "type": "str", + "type": "str", + "name": "actor", "description": "获得物品玩家实体id" - }, + }, { - "name": "secondaryActor", - "type": "str", + "type": "str", + "name": "secondaryActor", "description": "物品给予者玩家实体id,如果不存在给予者的话,这里为空字符串" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "获得的物品的物品信息字典" - }, + }, { - "name": "acquireMethod", - "type": "int", + "type": "int", + "name": "acquireMethod", "description": "获得物品的方法,详见[ItemAcquisitionMethod枚举](../枚举值/ItemAcquisitionMethod.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ActorAcquiredItemServerEvent" + }, { - "type": "event", - "name": "ActorUseItemClientEvent", - "method": "", - "description": "触发时机:玩家使用物品时客户端抛出的事件(比较特殊不走该事件的例子:1)染料对有水的炼药锅使用;2)盔甲架装备盔甲);3)喝牛奶", - "remark": "- 注意,喝牛奶不会触发该事件,但是会触发ActorUseItemServerEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 注意,喝牛奶不会触发该事件,但是会触发ActorUseItemServerEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家使用物品时客户端抛出的事件(比较特殊不走该事件的例子:1)染料对有水的炼药锅使用;2)盔甲架装备盔甲);3)喝牛奶", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "使用的物品的物品信息字典" - }, + }, { - "name": "useMethod", - "type": "int", + "type": "int", + "name": "useMethod", "description": "使用物品的方法,详见[ItemUseMethodEnum枚举](../枚举值/ItemUseMethodEnum.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ActorUseItemClientEvent" + }, { - "type": "event", - "name": "ActorUseItemServerEvent", - "method": "", - "description": "触发时机:玩家使用物品生效之前服务端抛出的事件(比较特殊不走该事件的例子:1)染料对有水的炼药锅使用;2)盔甲架装备盔甲)", - "remark": "- 注意,喝牛奶会触发该事件,但是不会触发ActorUseItemClientEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 注意,喝牛奶会触发该事件,但是不会触发ActorUseItemClientEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家使用物品生效之前服务端抛出的事件(比较特殊不走该事件的例子:1)染料对有水的炼药锅使用;2)盔甲架装备盔甲)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "使用的物品的物品信息字典" - }, + }, { - "name": "useMethod", - "type": "int", + "type": "int", + "name": "useMethod", "description": "使用物品的方法,详见[ItemUseMethodEnum枚举](../枚举值/ItemUseMethodEnum.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ActorUseItemServerEvent" + }, { - "type": "event", - "name": "AnvilCreateResultItemAfterClientEvent", - "method": "", - "description": "玩家点击铁砧合成得到的物品时抛出的事件。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "玩家点击铁砧合成得到的物品时抛出的事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "itemShowName", - "type": "str", + "type": "str", + "name": "itemShowName", "description": "合成后的物品显示名称" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "合成后的物品的物品信息字典" - }, + }, { - "name": "oldItemDict", - "type": "dict", + "type": "dict", + "name": "oldItemDict", "description": "合成前的物品的物品信息字典(铁砧内第一个物品)" - }, + }, { - "name": "materialItemDict", - "type": "dict", + "type": "dict", + "name": "materialItemDict", "description": "合成所使用材料的物品信息字典(铁砧内第二个物品)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "AnvilCreateResultItemAfterClientEvent" + }, { - "type": "event", - "name": "ClientItemTryUseEvent", - "method": "", - "description": "玩家点击右键尝试使用物品时客户端抛出的事件,可以通过设置cancel为True取消使用物品。注:如果需要取消物品的使用需要同时在ClientItemTryUseEvent和ServerItemTryUseEvent中将cancel设置为True才能正确取消。", - "remark": "- ServerItemTryUseEvent/ClientItemTryUseEvent不能取消对方块使用物品的行为,如使用生物蛋,使用桶倒出/收集,使用打火石点燃草等;如果想要取消这种行为,请使用ClientItemUseOnEvent和ServerItemUseOnEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- ServerItemTryUseEvent/ClientItemTryUseEvent不能取消对方块使用物品的行为,如使用生物蛋,使用桶倒出/收集,使用打火石点燃草等;如果想要取消这种行为,请使用ClientItemUseOnEvent和ServerItemUseOnEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家点击右键尝试使用物品时客户端抛出的事件,可以通过设置cancel为True取消使用物品。注:如果需要取消物品的使用需要同时在ClientItemTryUseEvent和ServerItemTryUseEvent中将cancel设置为True才能正确取消。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "使用的物品的物品信息字典" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "取消使用物品" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ClientItemTryUseEvent" + }, { - "type": "event", - "name": "ClientItemUseOnEvent", - "method": "", - "description": "玩家在对方块使用物品时客户端抛出的事件。注:如果需要取消物品的使用需要同时在ClientItemUseOnEvent和ServerItemUseOnEvent中将ret设置为True才能正确取消。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "玩家在对方块使用物品时客户端抛出的事件。注:如果需要取消物品的使用需要同时在ClientItemUseOnEvent和ServerItemUseOnEvent中将ret设置为True才能正确取消。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "玩家实体id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "使用的物品的物品信息字典" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块 x 坐标值" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块 y 坐标值" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块 z 坐标值" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier" - }, + }, { - "name": "blockAuxValue", - "type": "int", + "type": "int", + "name": "blockAuxValue", "description": "方块的附加值" - }, + }, { - "name": "face", - "type": "int", + "type": "int", + "name": "face", "description": "点击方块的面,参考[Facing枚举](../枚举值/Facing.md)" - }, + }, { - "name": "clickX", - "type": "float", + "type": "float", + "name": "clickX", "description": "点击点的x比例位置" - }, + }, { - "name": "clickY", - "type": "float", + "type": "float", + "name": "clickY", "description": "点击点的y比例位置" - }, + }, { - "name": "clickZ", - "type": "float", + "type": "float", + "name": "clickZ", "description": "点击点的z比例位置" - }, + }, { - "name": "ret", - "type": "bool", + "type": "bool", + "name": "ret", "description": "设为True可取消物品的使用" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ClientItemUseOnEvent" + }, { - "type": "event", - "name": "ClientShapedRecipeTriggeredEvent", - "method": "", - "description": "玩家合成物品时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "玩家合成物品时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "recipeId", - "type": "str", + "type": "str", + "name": "recipeId", "description": "配方id,对应配方json文件中的identifier字段" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ClientShapedRecipeTriggeredEvent" + }, { - "type": "event", - "name": "ContainerItemChangedServerEvent", - "method": "", - "description": "容器物品变化事件", - "remark": "- 储物容器(箱子,潜影箱),熔炉,酿造台,发射器,投掷器,漏斗,炼药锅,唱片机,高炉,烟熏炉中物品发生变化会触发此事件\r\n - 工作台、铁砧、附魔台、织布机、砂轮、切石机、制图台、锻造台为合成容器,不会触发此事件,此类容器可通过UIContainerItemChangedServerEvent监听具体生成容器物品变化\r\n - 炼药锅只在使用染料时触发本事件,且slot为2\r\n - 唱片机只在从漏斗放入唱片触发此事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 储物容器(箱子,潜影箱),熔炉,酿造台,发射器,投掷器,漏斗,炼药锅,唱片机,高炉,烟熏炉中物品发生变化会触发此事件\r\n - 工作台、铁砧、附魔台、织布机、砂轮、切石机、制图台、锻造台为合成容器,不会触发此事件,此类容器可通过UIContainerItemChangedServerEvent监听具体生成容器物品变化\r\n - 炼药锅只在使用染料时触发本事件,且slot为2\r\n - 唱片机只在从漏斗放入唱片触发此事件", + "return": [], + "description": "容器物品变化事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)/None", + "type": "tuple(int,int,int)/None", + "name": "pos", "description": "容器坐标" - }, + }, { - "name": "containerType", - "type": "int", + "type": "int", + "name": "containerType", "description": "容器类型,类型含义见:[容器类型枚举](../枚举值/ContainerType.md)" - }, + }, { - "name": "slot", - "type": "int", + "type": "int", + "name": "slot", "description": "容器槽位" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "oldItemDict", - "type": "dict", + "type": "dict", + "name": "oldItemDict", "description": "旧物品,格式参考物品信息字典" - }, + }, { - "name": "newItemDict", - "type": "dict", + "type": "dict", + "name": "newItemDict", "description": "新物品,格式参考物品信息字典" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ContainerItemChangedServerEvent" + }, { - "type": "event", - "name": "CraftItemOutputChangeServerEvent", - "method": "", - "description": "玩家从容器拿出生成物品时触发", - "remark": "- 支持工作台,铁砧,砂轮等工作方块\r\n - screenContainerType = serverApi.GetMinecraftEnum().ContainerType.INVENTORY时,表示从创造模式物品栏中拿出物品,或者从合成栏中拿出合成物品\r\n - 通过cancel参数取消生成物品,可用于禁止外挂刷物品\r\n - cancel=True时无法从创造模式物品栏拿物品\r\n - cancel=True时铁砧无法修复或重命名物品,但仍会扣除经验值", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 支持工作台,铁砧,砂轮等工作方块\r\n - screenContainerType = serverApi.GetMinecraftEnum().ContainerType.INVENTORY时,表示从创造模式物品栏中拿出物品,或者从合成栏中拿出合成物品\r\n - 通过cancel参数取消生成物品,可用于禁止外挂刷物品\r\n - cancel=True时无法从创造模式物品栏拿物品\r\n - cancel=True时铁砧无法修复或重命名物品,但仍会扣除经验值", + "return": [], + "description": "玩家从容器拿出生成物品时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "生成的物品,格式参考物品信息字典" - }, + }, { - "name": "screenContainerType", - "type": "int", + "type": "int", + "name": "screenContainerType", "description": "当前界面类型,类型含义见:[容器类型枚举](../枚举值/ContainerType.md)" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消生成物品" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "CraftItemOutputChangeServerEvent" + }, { - "type": "event", - "name": "CraftUpdateResultItemClientEvent", - "method": "", - "description": "玩家工作台界面更新显示可合成物品时抛出的事件。", - "remark": "- 该事件在打开3×3工作台界面,2×2工作台界面,向工作台放入物品,预览配方时触发。\r\n - 如果无可合成的物品,或预览的配方因材料不足而无法合成,则传递的物品参数为 minecraft:air。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 该事件在打开3×3工作台界面,2×2工作台界面,向工作台放入物品,预览配方时触发。\r\n - 如果无可合成的物品,或预览的配方因材料不足而无法合成,则传递的物品参数为 minecraft:air。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家工作台界面更新显示可合成物品时抛出的事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "合成后的物品的[物品信息字典]" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "CraftUpdateResultItemClientEvent" + }, { - "type": "event", - "name": "FurnaceBurnFinishedServerEvent", - "method": "", - "description": "服务端熔炉烧制触发事件。熔炉, 高炉,烟熏炉烧出物品时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "服务端熔炉烧制触发事件。熔炉, 高炉,烟熏炉烧出物品时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "posX", - "type": "float", + "type": "float", + "name": "posX", "description": "位置x" - }, + }, { - "name": "posY", - "type": "float", + "type": "float", + "name": "posY", "description": "位置y" - }, + }, { - "name": "posZ", - "type": "float", + "type": "float", + "name": "posZ", "description": "位置z" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品的物品信息字典,当新物品为空时,此项属性为None" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "FurnaceBurnFinishedServerEvent" + }, { - "type": "event", - "name": "GrindStoneRemovedEnchantClientEvent", - "method": "", - "description": "玩家点击砂轮合成得到的物品时抛出的事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "玩家点击砂轮合成得到的物品时抛出的事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "oldItemDict", - "type": "dict", + "type": "dict", + "name": "oldItemDict", "description": "合成前的物品物品信息字典(砂轮内第一个物品)" - }, + }, { - "name": "additionalItemDict", - "type": "dict", + "type": "dict", + "name": "additionalItemDict", "description": "作为合成材料的物品物品信息字典(砂轮内第二个物品)" - }, + }, { - "name": "newItemDict", - "type": "dict", + "type": "dict", + "name": "newItemDict", "description": "合成后的物品物品信息字典" - }, + }, { - "name": "exp", - "type": "int", + "type": "int", + "name": "exp", "description": "本次合成返还的经验" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GrindStoneRemovedEnchantClientEvent" + }, { - "type": "event", - "name": "InventoryItemChangedClientEvent", - "method": "", - "description": "玩家背包物品变化时客户端抛出的事件。", - "remark": "- 如果槽位变空,变化后槽位中物品为空气\r\n - 触发时槽位物品仍为变化前物品\r\n - 背包内物品移动,合堆,分堆的操作会分多次事件触发并且顺序不定,编写逻辑时请勿依赖事件触发顺序\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 如果槽位变空,变化后槽位中物品为空气\r\n - 触发时槽位物品仍为变化前物品\r\n - 背包内物品移动,合堆,分堆的操作会分多次事件触发并且顺序不定,编写逻辑时请勿依赖事件触发顺序\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家背包物品变化时客户端抛出的事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "slot", - "type": "int", + "type": "int", + "name": "slot", "description": "背包槽位" - }, + }, { - "name": "oldItemDict", - "type": "dict", + "type": "dict", + "name": "oldItemDict", "description": "变化前槽位中的物品,格式参考物品信息字典" - }, + }, { - "name": "newItemDict", - "type": "dict", + "type": "dict", + "name": "newItemDict", "description": "变化后槽位中的物品,格式参考物品信息字典" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "InventoryItemChangedClientEvent" + }, { - "type": "event", - "name": "InventoryItemChangedServerEvent", - "method": "", - "description": "玩家背包物品变化时服务端抛出的事件。", - "remark": "- 如果槽位变空,变化后槽位中物品为空气\r\n - 触发时槽位物品仍为变化前物品\r\n - 玩家进入游戏时,身上的物品会触发该事件\r\n - 背包内物品移动,合堆,分堆的操作会分多次事件触发并且顺序不定,编写逻辑时请勿依赖事件触发顺序\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 如果槽位变空,变化后槽位中物品为空气\r\n - 触发时槽位物品仍为变化前物品\r\n - 玩家进入游戏时,身上的物品会触发该事件\r\n - 背包内物品移动,合堆,分堆的操作会分多次事件触发并且顺序不定,编写逻辑时请勿依赖事件触发顺序\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家背包物品变化时服务端抛出的事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "slot", - "type": "int", + "type": "int", + "name": "slot", "description": "背包槽位" - }, + }, { - "name": "oldItemDict", - "type": "dict", + "type": "dict", + "name": "oldItemDict", "description": "变化前槽位中的物品,格式参考物品信息字典" - }, + }, { - "name": "newItemDict", - "type": "dict", + "type": "dict", + "name": "newItemDict", "description": "变化后槽位中的物品,格式参考物品信息字典" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "InventoryItemChangedServerEvent" + }, { - "type": "event", - "name": "ItemDurabilityChangedServerEvent", - "method": "", - "description": "物品耐久度变化事件", - "remark": "- 目前只有存在耐久的物品,并且有物主的物品才会触发该事件,存在发射器中发射导致的物品耐久变化不会触发该事件\r\n - 目前铁砧修复、经验修补魔咒、SetItemDurability接口触发的耐久度变化中canChange为false,并且不支持修改变化后耐久度\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 目前只有存在耐久的物品,并且有物主的物品才会触发该事件,存在发射器中发射导致的物品耐久变化不会触发该事件\r\n - 目前铁砧修复、经验修补魔咒、SetItemDurability接口触发的耐久度变化中canChange为false,并且不支持修改变化后耐久度\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "物品耐久度变化事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "物品拥有者的实体id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品的物品信息字典" - }, + }, { - "name": "durabilityBefore", - "type": "int", + "type": "int", + "name": "durabilityBefore", "description": "变化前耐久度" - }, + }, { - "name": "durability", - "type": "int", + "type": "int", + "name": "durability", "description": "变化后耐久度,支持修改。但是请注意修改范围,支持范围为[-32768,32767)" - }, + }, { - "name": "canChange", - "type": "bool", + "type": "bool", + "name": "canChange", "description": "是否支持修改,为true时支持通过durability修改,为false时不支持" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ItemDurabilityChangedServerEvent" + }, { - "type": "event", - "name": "ItemReleaseUsingClientEvent", - "method": "", - "description": "触发时机:释放正在使用的物品", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "触发时机:释放正在使用的物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "durationLeft", - "type": "float", + "type": "float", + "name": "durationLeft", "description": "蓄力剩余时间(当物品缺少\"minecraft:maxduration\"组件时,蓄力剩余时间为负数)" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "使用的物品的物品信息字典" - }, + }, { - "name": "maxUseDuration", - "type": "int", + "type": "int", + "name": "maxUseDuration", "description": "最大蓄力时长" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设置为True可以取消,需要同时取消服务端事件[ItemReleaseUsingServerEvent](#itemreleaseusingserverevent)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ItemReleaseUsingClientEvent" + }, { - "type": "event", - "name": "ItemReleaseUsingServerEvent", - "method": "", - "description": "触发时机:释放正在使用的物品时", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "触发时机:释放正在使用的物品时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "durationLeft", - "type": "float", + "type": "float", + "name": "durationLeft", "description": "蓄力剩余时间(当物品缺少\"minecraft:maxduration\"组件时,蓄力剩余时间为负数)" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "使用的物品的物品信息字典" - }, + }, { - "name": "maxUseDuration", - "type": "int", + "type": "int", + "name": "maxUseDuration", "description": "最大蓄力时长" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设置为True可以取消,需要同时取消客户端事件[ItemReleaseUsingClientEvent](#itemreleaseusingclientevent)" - }, + }, { - "name": "changeItem", - "type": "bool", + "type": "bool", + "name": "changeItem", "description": "如果要在该事件的回调中修改当前使用槽位的物品,需设置这个参数为True,否则将修改物品失败,例如修改耐久度或者替换成新物品" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ItemReleaseUsingServerEvent" + }, { - "type": "event", - "name": "ItemUseAfterServerEvent", - "method": "", - "description": "玩家在使用物品之后服务端抛出的事件。", - "remark": "- 做出使用物品这个动作之后触发,一些需要蓄力的物品使用事件(ActorUseItemServerEvent)会在之后触发。如投掷三叉戟,先触发本事件,投出去之后再触发ActorUseItemServerEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 做出使用物品这个动作之后触发,一些需要蓄力的物品使用事件(ActorUseItemServerEvent)会在之后触发。如投掷三叉戟,先触发本事件,投出去之后再触发ActorUseItemServerEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家在使用物品之后服务端抛出的事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "玩家实体id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "使用的物品的物品信息字典" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ItemUseAfterServerEvent" + }, { - "type": "event", - "name": "ItemUseOnAfterServerEvent", - "method": "", - "description": "玩家在对方块使用物品之后服务端抛出的事件。", - "remark": "- 在ServerItemUseOnEvent和原版物品使用事件(例如StartUsingItemClientEvent)之后触发\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 在ServerItemUseOnEvent和原版物品使用事件(例如StartUsingItemClientEvent)之后触发\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家在对方块使用物品之后服务端抛出的事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "玩家实体id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "使用的物品的物品信息字典" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块 x 坐标值" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块 y 坐标值" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块 z 坐标值" - }, + }, { - "name": "face", - "type": "int", + "type": "int", + "name": "face", "description": "点击方块的面,参考[Facing枚举](../枚举值/Facing.md)" - }, + }, { - "name": "clickX", - "type": "float", + "type": "float", + "name": "clickX", "description": "点击点的x比例位置" - }, + }, { - "name": "clickY", - "type": "float", + "type": "float", + "name": "clickY", "description": "点击点的y比例位置" - }, + }, { - "name": "clickZ", - "type": "float", + "type": "float", + "name": "clickZ", "description": "点击点的z比例位置" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier" - }, + }, { - "name": "blockAuxValue", - "type": "int", + "type": "int", + "name": "blockAuxValue", "description": "方块的附加值" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ItemUseOnAfterServerEvent" + }, { - "type": "event", - "name": "OnCarriedNewItemChangedClientEvent", - "method": "", - "description": "手持物品发生变化时,触发该事件;数量改变不会通知", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "手持物品发生变化时,触发该事件;数量改变不会通知", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "切换后物品的物品信息字典" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnCarriedNewItemChangedClientEvent" + }, { - "type": "event", - "name": "OnCarriedNewItemChangedServerEvent", - "method": "", - "description": "触发时机:玩家切换主手物品时触发该事件", - "remark": "- 切换耐久度不同的相同物品,不会触发该事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 切换耐久度不同的相同物品,不会触发该事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家切换主手物品时触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "oldItemDict", - "type": "dict/None", + "type": "dict/None", + "name": "oldItemDict", "description": "旧物品的物品信息字典,当旧物品为空时,此项属性为None" - }, + }, { - "name": "newItemDict", - "type": "dict/None", + "type": "dict/None", + "name": "newItemDict", "description": "新物品的物品信息字典,当新物品为空时,此项属性为None" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家 entityId" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnCarriedNewItemChangedServerEvent" + }, { - "type": "event", - "name": "OnItemPutInEnchantingModelServerEvent", - "method": "", - "description": "触发时机:玩家将可附魔物品放到附魔台上时", - "remark": "- options为包含三个dict的list,单个dict的格式形如{'cost': 1, 'enchantData': [(1,1)], 'modEnchantData': [('custom_enchant, 1')]},cost为解锁该选项所需的玩家等级,enchantData为该附魔选项包含的原版附魔数据,modEnchantData为该选项包含的自定义附魔数据\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- options为包含三个dict的list,单个dict的格式形如{'cost': 1, 'enchantData': [(1,1)], 'modEnchantData': [('custom_enchant, 1')]},cost为解锁该选项所需的玩家等级,enchantData为该附魔选项包含的原版附魔数据,modEnchantData为该选项包含的自定义附魔数据\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家将可附魔物品放到附魔台上时", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id,参数类型为str" - }, + }, { - "name": "slotType", - "type": "int", + "type": "int", + "name": "slotType", "description": "玩家放入物品的EnchantSlotType" - }, + }, { - "name": "options", - "type": "list", + "type": "list", + "name": "options", "description": "附魔台选项" - }, + }, { - "name": "change", - "type": "bool", + "type": "bool", + "name": "change", "description": "传入True时,附魔台选项会被新传入的options覆盖" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnItemPutInEnchantingModelServerEvent" + }, { - "type": "event", - "name": "OnNewArmorExchangeServerEvent", - "method": "", - "description": "触发时机:玩家切换盔甲时触发该事件", - "remark": "- 当玩家登录时,每个盔甲槽位会触发两次该事件,第一次为None切换到身上的装备,第二次的old和new都为身上装备。如果槽位为空,则是触发两次从None切换到None的事件。\r\n - 注意:避免在该事件回调中对玩家修改盔甲栏装备,如[SetEntityItem](../接口/实体/背包.md#setentityitem)接口,会导致事件循环触发造成堆栈溢出。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 当玩家登录时,每个盔甲槽位会触发两次该事件,第一次为None切换到身上的装备,第二次的old和new都为身上装备。如果槽位为空,则是触发两次从None切换到None的事件。\r\n - 注意:避免在该事件回调中对玩家修改盔甲栏装备,如[SetEntityItem](../接口/实体/背包.md#setentityitem)接口,会导致事件循环触发造成堆栈溢出。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家切换盔甲时触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "slot", - "type": "int", + "type": "int", + "name": "slot", "description": "槽位id" - }, + }, { - "name": "oldArmorDict", - "type": "dict/None", + "type": "dict/None", + "name": "oldArmorDict", "description": "旧装备的物品信息字典,当旧物品为空时,此项属性为None" - }, + }, { - "name": "newArmorDict", - "type": "dict/None", + "type": "dict/None", + "name": "newArmorDict", "description": "新装备的物品信息字典,当新物品为空时,此项属性为None" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家 entityId" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnNewArmorExchangeServerEvent" + }, { - "type": "event", - "name": "OnOffhandItemChangedServerEvent", - "method": "", - "description": "触发时机:玩家切换副手物品时触发该事件", - "remark": "- 当原有的物品槽内容为空时,`oldItemName`值为'minecraft:air',且`oldItem`其余字段不存在
当切换原有物品,且新物品为空时,参数值同理\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 当原有的物品槽内容为空时,`oldItemName`值为'minecraft:air',且`oldItem`其余字段不存在
当切换原有物品,且新物品为空时,参数值同理\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家切换副手物品时触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "oldItemDict", - "type": "dict/None", + "type": "dict/None", + "name": "oldItemDict", "description": "旧物品的物品信息字典,当旧物品为空时,此项属性为None" - }, + }, { - "name": "newItemDict", - "type": "dict/None", + "type": "dict/None", + "name": "newItemDict", "description": "新物品的物品信息字典,当新物品为空时,此项属性为None" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家 entityId" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnOffhandItemChangedServerEvent" + }, { - "type": "event", - "name": "OnPlayerActiveShieldServerEvent", - "method": "", - "description": "触发时机:玩家激活/取消激活盾牌触发的事件。包括玩家持盾进入潜行状态,以及在潜行状态切换盾牌(切换耐久度不同的相同盾牌不会触发)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "触发时机:玩家激活/取消激活盾牌触发的事件。包括玩家持盾进入潜行状态,以及在潜行状态切换盾牌(切换耐久度不同的相同盾牌不会触发)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家Id" - }, + }, { - "name": "isActive", - "type": "bool", + "type": "bool", + "name": "isActive", "description": "True:尝试激活,False:尝试取消激活" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "盾牌物品的物品信息字典" - }, + }, { - "name": "cancelable", - "type": "bool", + "type": "bool", + "name": "cancelable", "description": "是否可以取消。如果玩家在潜行状态切换盾牌,则无法取消" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消这次激活" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnPlayerActiveShieldServerEvent" + }, { - "type": "event", - "name": "OnPlayerBlockedByShieldAfterServerEvent", - "method": "", - "description": "触发时机:玩家使用盾牌抵挡伤害之后触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "触发时机:玩家使用盾牌抵挡伤害之后触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家Id" - }, + }, { - "name": "sourceId", - "type": "str", + "type": "str", + "name": "sourceId", "description": "伤害来源实体Id,没有实体返回\"-1\"" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "盾牌物品字典物品信息字典" - }, + }, { - "name": "damage", - "type": "float", + "type": "float", + "name": "damage", "description": "抵挡的伤害数值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnPlayerBlockedByShieldAfterServerEvent" + }, { - "type": "event", - "name": "OnPlayerBlockedByShieldBeforeServerEvent", - "method": "", - "description": "触发时机:玩家使用盾牌抵挡伤害之前触发", - "remark": "- 盾牌抵挡了所有伤害时,才会触发事件;部分抛射物造成的伤害无法全部抵挡,无法触发事件,例如带有穿透魔咒的弩。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 盾牌抵挡了所有伤害时,才会触发事件;部分抛射物造成的伤害无法全部抵挡,无法触发事件,例如带有穿透魔咒的弩。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家使用盾牌抵挡伤害之前触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家Id" - }, + }, { - "name": "sourceId", - "type": "str", + "type": "str", + "name": "sourceId", "description": "伤害来源实体Id,没有实体返回\"-1\"" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "盾牌物品字典物品信息字典" - }, + }, { - "name": "damage", - "type": "float", + "type": "float", + "name": "damage", "description": "抵挡的伤害数值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnPlayerBlockedByShieldBeforeServerEvent" + }, { - "type": "event", - "name": "PlayerDropItemServerEvent", - "method": "", - "description": "触发时机:玩家丢弃物品时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "触发时机:玩家丢弃物品时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "itemEntityId", - "type": "str", + "type": "str", + "name": "itemEntityId", "description": "物品entityId" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerDropItemServerEvent" + }, { - "type": "event", - "name": "PlayerPickupArrowServerEvent", - "method": "", - "description": "玩家即将捡起抛射物时触发,包括使用\"netease:pick_up\"的自定义抛射物", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "玩家即将捡起抛射物时触发,包括使用\"netease:pick_up\"的自定义抛射物", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家Id" - }, + }, { - "name": "arrowId", - "type": "str", + "type": "str", + "name": "arrowId", "description": "抛射物Id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "触碰的物品的物品信息字典" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设置为True时将取消本次拾取" - }, + }, { - "name": "pickupDelay", - "type": "int", + "type": "int", + "name": "pickupDelay", "description": "取消拾取后重新设置该物品的拾取cd,小于15帧将视作15帧,大于等于97813帧将视作无法拾取,每秒30帧" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerPickupArrowServerEvent" + }, { - "type": "event", - "name": "PlayerTryDropItemClientEvent", - "method": "", - "description": "触发时机:玩家丢弃物品时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "触发时机:玩家丢弃物品时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品dict" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消此次操作" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PlayerTryDropItemClientEvent" + }, { - "type": "event", - "name": "ServerItemTryUseEvent", - "method": "", - "description": "玩家点击右键尝试使用物品时服务端抛出的事件。注:如果需要取消物品的使用需要同时在ClientItemTryUseEvent和ServerItemTryUseEvent中将cancel设置为True才能正确取消。", - "remark": "- ServerItemTryUseEvent/ClientItemTryUseEvent不能取消对方块使用物品的行为,如使用生物蛋,使用桶倒出/收集,使用打火石点燃草等;如果想要取消这种行为,请使用ClientItemUseOnEvent和ServerItemUseOnEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- ServerItemTryUseEvent/ClientItemTryUseEvent不能取消对方块使用物品的行为,如使用生物蛋,使用桶倒出/收集,使用打火石点燃草等;如果想要取消这种行为,请使用ClientItemUseOnEvent和ServerItemUseOnEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家点击右键尝试使用物品时服务端抛出的事件。注:如果需要取消物品的使用需要同时在ClientItemTryUseEvent和ServerItemTryUseEvent中将cancel设置为True才能正确取消。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "使用的物品的物品信息字典" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设为True可取消物品的使用" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ServerItemTryUseEvent" + }, { - "type": "event", - "name": "ServerItemUseOnEvent", - "method": "", - "description": "玩家在对方块使用物品之前服务端抛出的事件。注:如果需要取消物品的使用需要同时在ClientItemUseOnEvent和ServerItemUseOnEvent中将ret设置为True才能正确取消。", - "remark": "- 当对原生方块进行使用时,如堆肥桶等类似有 使用 功能的方块使用物品时,不会触发该事件。而当原生方块加入监听后,ServerBlockUseEvent会触发。当需要获取触发时使用的物品时,可以通过item组件(例如GetPlayerItem接口)获取手中持有的物品,对应的客户端事件同理。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 当对原生方块进行使用时,如堆肥桶等类似有 使用 功能的方块使用物品时,不会触发该事件。而当原生方块加入监听后,ServerBlockUseEvent会触发。当需要获取触发时使用的物品时,可以通过item组件(例如GetPlayerItem接口)获取手中持有的物品,对应的客户端事件同理。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家在对方块使用物品之前服务端抛出的事件。注:如果需要取消物品的使用需要同时在ClientItemUseOnEvent和ServerItemUseOnEvent中将ret设置为True才能正确取消。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "玩家实体id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "使用的物品的物品信息字典" - }, + }, { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块 x 坐标值" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块 y 坐标值" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块 z 坐标值" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier" - }, + }, { - "name": "blockAuxValue", - "type": "int", + "type": "int", + "name": "blockAuxValue", "description": "方块的附加值" - }, + }, { - "name": "face", - "type": "int", + "type": "int", + "name": "face", "description": "点击方块的面,参考[Facing枚举](../枚举值/Facing.md)" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "clickX", - "type": "float", + "type": "float", + "name": "clickX", "description": "点击点的x比例位置" - }, + }, { - "name": "clickY", - "type": "float", + "type": "float", + "name": "clickY", "description": "点击点的y比例位置" - }, + }, { - "name": "clickZ", - "type": "float", + "type": "float", + "name": "clickZ", "description": "点击点的z比例位置" - }, + }, { - "name": "ret", - "type": "bool", + "type": "bool", + "name": "ret", "description": "设为True可取消物品的使用" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ServerItemUseOnEvent" + }, { - "type": "event", - "name": "ServerPlayerTryTouchEvent", - "method": "", - "description": "玩家即将捡起物品时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "玩家即将捡起物品时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家Id" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "物品实体的Id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "触碰的物品的物品信息字典" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设置为True时将取消本次拾取" - }, + }, { - "name": "pickupDelay", - "type": "int", + "type": "int", + "name": "pickupDelay", "description": "取消拾取后重新设置该物品的拾取cd,小于15帧将视作15帧,大于等于97813帧将视作无法拾取" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ServerPlayerTryTouchEvent" + }, { - "type": "event", - "name": "ShearsUseToBlockBeforeServerEvent", - "method": "", - "description": "触发时机:实体手持剪刀对方块使用时,有剪刀特殊效果的方块会在服务端线程触发该事件", - "remark": "- 目前会触发该事件的方块:南瓜、蜂巢\r\n - 该事件触发在ServerItemUseOnEvent之后,如果ServerItemUseOnEvent中取消了物品使用,该事件无法被触发\r\n - 和ServerItemUseOnEvent一样该事件判定在tick执行,意味着如果取消剪刀效果该事件可能会多次触发(取决于玩家按下使用键时长)\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 目前会触发该事件的方块:南瓜、蜂巢\r\n - 该事件触发在ServerItemUseOnEvent之后,如果ServerItemUseOnEvent中取消了物品使用,该事件无法被触发\r\n - 和ServerItemUseOnEvent一样该事件判定在tick执行,意味着如果取消剪刀效果该事件可能会多次触发(取决于玩家按下使用键时长)\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:实体手持剪刀对方块使用时,有剪刀特殊效果的方块会在服务端线程触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "blockX", - "type": "int", + "type": "int", + "name": "blockX", "description": "方块位置x" - }, + }, { - "name": "blockY", - "type": "int", + "type": "int", + "name": "blockY", "description": "方块位置y" - }, + }, { - "name": "blockZ", - "type": "int", + "type": "int", + "name": "blockZ", "description": "方块位置z" - }, + }, { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块的identifier,包含命名空间及名称" - }, + }, { - "name": "auxData", - "type": "int", + "type": "int", + "name": "auxData", "description": "方块附加值" - }, + }, { - "name": "dropName", - "type": "str", + "type": "str", + "name": "dropName", "description": "触发剪刀效果的掉落物identifier,包含命名空间及名称" - }, + }, { - "name": "dropCount", - "type": "int", + "type": "int", + "name": "dropCount", "description": "触发剪刀效果的掉落物数量" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "触发剪刀效果的实体id,目前仅玩家会触发" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "玩家触发时的维度id" - }, + }, { - "name": "cancelShears", - "type": "bool", + "type": "bool", + "name": "cancelShears", "description": "是否取消剪刀效果" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ShearsUseToBlockBeforeServerEvent" + }, { - "type": "event", - "name": "StartUsingItemClientEvent", - "method": "", - "description": "玩家使用物品(目前仅支持Bucket(奶桶)、Trident(三叉戟)、RangedWeapon(弓)、Food(食物)、Potion(药水)、Crossbow(弩))时抛出", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "玩家使用物品(目前仅支持Bucket(奶桶)、Trident(三叉戟)、RangedWeapon(弓)、Food(食物)、Potion(药水)、Crossbow(弩))时抛出", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "使用的物品的物品信息字典" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "StartUsingItemClientEvent" + }, { - "type": "event", - "name": "StopUsingItemClientEvent", - "method": "", - "description": "玩家停止使用物品(目前仅支持Bucket(奶桶)、Trident(三叉戟)、RangedWeapon(弓)、Food(食物)、Potion(药水)、Crossbow(弩))时抛出", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "", + "return": [], + "description": "玩家停止使用物品(目前仅支持Bucket(奶桶)、Trident(三叉戟)、RangedWeapon(弓)、Food(食物)、Potion(药水)、Crossbow(弩))时抛出", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "使用的物品的物品信息字典" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "StopUsingItemClientEvent" + }, { - "type": "event", - "name": "UIContainerItemChangedServerEvent", - "method": "", - "description": "合成容器物品发生变化时触发", - "remark": "- 合成容器包括工作台、铁砧、附魔台、织布机、砂轮、切石机、制图台、锻造台,输入物品发生变化时会触发本事件\r\n - 可通过容器槽位区分不同的生成容器类型\r\n - 合成容器的生成槽位生成物品时不触发本事件,生成物品可通过CraftItemOutputChangeServerEvent监听\r\n - 储物容器(箱子,潜影箱),熔炉,酿造台,发射器,投掷器,漏斗,炼药锅,唱片机,高炉,烟熏炉中物品发生变化不会触发此事件,此类容器可通过ContainerItemChangedServerEvent监听", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "remark": "- 合成容器包括工作台、铁砧、附魔台、织布机、砂轮、切石机、制图台、锻造台,输入物品发生变化时会触发本事件\r\n - 可通过容器槽位区分不同的生成容器类型\r\n - 合成容器的生成槽位生成物品时不触发本事件,生成物品可通过CraftItemOutputChangeServerEvent监听\r\n - 储物容器(箱子,潜影箱),熔炉,酿造台,发射器,投掷器,漏斗,炼药锅,唱片机,高炉,烟熏炉中物品发生变化不会触发此事件,此类容器可通过ContainerItemChangedServerEvent监听", + "return": [], + "description": "合成容器物品发生变化时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物品.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "slot", - "type": "int", + "type": "int", + "name": "slot", "description": "容器槽位,含义见:[容器类型枚举](../枚举值/PlayerUISlot.md)" - }, + }, { - "name": "oldItemDict", - "type": "dict", + "type": "dict", + "name": "oldItemDict", "description": "旧物品,格式参考物品信息字典" - }, + }, { - "name": "newItemDict", - "type": "dict", + "type": "dict", + "name": "newItemDict", "description": "生成的物品,格式参考物品信息字典" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "UIContainerItemChangedServerEvent" + }, { - "type": "event", - "name": "AddExpEvent", - "method": "", - "description": "触发时机:当玩家增加经验时触发该事件。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "触发时机:当玩家增加经验时触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "玩家id" - }, + }, { - "name": "addExp", - "type": "int", + "type": "int", + "name": "addExp", "description": "增加的经验值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "AddExpEvent" + }, { - "type": "event", - "name": "AddLevelEvent", - "method": "", - "description": "触发时机:当玩家升级时触发该事件。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "触发时机:当玩家升级时触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "玩家id" - }, + }, { - "name": "addLevel", - "type": "int", + "type": "int", + "name": "addLevel", "description": "增加的等级值" - }, + }, { - "name": "newLevel", - "type": "int", + "type": "int", + "name": "newLevel", "description": "新的等级" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "AddLevelEvent" + }, { - "type": "event", - "name": "CameraMotionStartClientEvent", - "method": "", - "description": "相机运动器开始事件。相机添加运动器后,运动器开始运行时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "相机运动器开始事件。相机添加运动器后,运动器开始运行时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "运动器id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "CameraMotionStartClientEvent" + }, { - "type": "event", - "name": "CameraMotionStopClientEvent", - "method": "", - "description": "相机运动器停止事件。相机添加运动器并开始运行后,运动器自动停止时触发", - "remark": "- 注意:该事件触发表示运动器播放顺利完成,手动调用的[StopCameraMotion](../接口/玩家/摄像机.md#StopCameraMotion)、[RemoveCameraMotion](../接口/玩家/摄像机.md#RemoveCameraMotion)不会触发该事件。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 注意:该事件触发表示运动器播放顺利完成,手动调用的[StopCameraMotion](../接口/玩家/摄像机.md#StopCameraMotion)、[RemoveCameraMotion](../接口/玩家/摄像机.md#RemoveCameraMotion)不会触发该事件。", + "return": [], + "description": "相机运动器停止事件。相机添加运动器并开始运行后,运动器自动停止时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "运动器id" - }, + }, { - "name": "remove", - "type": "bool", + "type": "bool", + "name": "remove", "description": "是否移除该运动器,设置为False则保留,默认为True,即运动器停止后自动移除" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "CameraMotionStopClientEvent" + }, { - "type": "event", - "name": "ChangeLevelUpCostServerEvent", - "method": "", - "description": "接口用于重置升级经验。使用ChangeLevelUpCostServerEvent事件设置升级经验后,升级经验无法调整。需要调整升级经验时,可使用该接口。使用步骤如下:1、使用ClearDefineLevelUpconst,2、在升级抛出ChangeLevelUpCostServerEvent事件后重新设置经验。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "接口用于重置升级经验。使用ChangeLevelUpCostServerEvent事件设置升级经验后,升级经验无法调整。需要调整升级经验时,可使用该接口。使用步骤如下:1、使用ClearDefineLevelUpconst,2、在升级抛出ChangeLevelUpCostServerEvent事件后重新设置经验。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "level", - "type": "int", + "type": "int", + "name": "level", "description": "指定清理的等级,加入传入的数值小于0,则清理所有等级的升级经验值缓存" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ChangeLevelUpCostServerEvent" + }, { - "type": "event", - "name": "DimensionChangeClientEvent", - "method": "", - "description": "玩家维度改变时客户端抛出", - "remark": "- 当通过传送门从末地回到主世界时,toY值为32767,其他情况一般会比设置值高1.62\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 当通过传送门从末地回到主世界时,toY值为32767,其他情况一般会比设置值高1.62\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家维度改变时客户端抛出", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "fromDimensionId", - "type": "int", + "type": "int", + "name": "fromDimensionId", "description": "维度改变前的维度" - }, + }, { - "name": "toDimensionId", - "type": "int", + "type": "int", + "name": "toDimensionId", "description": "维度改变后的维度" - }, + }, { - "name": "fromX", - "type": "float", + "type": "float", + "name": "fromX", "description": "改变前的位置x" - }, + }, { - "name": "fromY", - "type": "float", + "type": "float", + "name": "fromY", "description": "改变前的位置Y" - }, + }, { - "name": "fromZ", - "type": "float", + "type": "float", + "name": "fromZ", "description": "改变前的位置Z" - }, + }, { - "name": "toX", - "type": "float", + "type": "float", + "name": "toX", "description": "改变后的位置x" - }, + }, { - "name": "toY", - "type": "float", + "type": "float", + "name": "toY", "description": "改变后的位置Y" - }, + }, { - "name": "toZ", - "type": "float", + "type": "float", + "name": "toZ", "description": "改变后的位置Z" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "DimensionChangeClientEvent" + }, { - "type": "event", - "name": "DimensionChangeFinishClientEvent", - "method": "", - "description": "玩家维度改变完成后客户端抛出", - "remark": "- 当通过传送门从末地回到主世界时,toPos的y值为32767,其他情况一般会比设置值高1.62\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 当通过传送门从末地回到主世界时,toPos的y值为32767,其他情况一般会比设置值高1.62\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家维度改变完成后客户端抛出", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "fromDimensionId", - "type": "int", + "type": "int", + "name": "fromDimensionId", "description": "维度改变前的维度" - }, + }, { - "name": "toDimensionId", - "type": "int", + "type": "int", + "name": "toDimensionId", "description": "维度改变后的维度" - }, + }, { - "name": "toPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "toPos", "description": "改变后的位置x,y,z,其中y值为脚底加上角色的身高值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "DimensionChangeFinishClientEvent" + }, { - "type": "event", - "name": "DimensionChangeFinishServerEvent", - "method": "", - "description": "玩家维度改变完成后服务端抛出", - "remark": "- 当通过传送门从末地回到主世界时,toPos的y值为32767,其他情况一般会比设置值高1.62\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 当通过传送门从末地回到主世界时,toPos的y值为32767,其他情况一般会比设置值高1.62\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家维度改变完成后服务端抛出", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "fromDimensionId", - "type": "int", + "type": "int", + "name": "fromDimensionId", "description": "维度改变前的维度" - }, + }, { - "name": "toDimensionId", - "type": "int", + "type": "int", + "name": "toDimensionId", "description": "维度改变后的维度" - }, + }, { - "name": "toPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "toPos", "description": "改变后的位置x,y,z,其中y值为脚底加上角色的身高值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "DimensionChangeFinishServerEvent" + }, { - "type": "event", - "name": "DimensionChangeServerEvent", - "method": "", - "description": "玩家维度改变时服务端抛出", - "remark": "- 当通过传送门从末地回到主世界时,toY值为32767,其他情况一般会比设置值高1.62\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 当通过传送门从末地回到主世界时,toY值为32767,其他情况一般会比设置值高1.62\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家维度改变时服务端抛出", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" - }, + }, { - "name": "fromDimensionId", - "type": "int", + "type": "int", + "name": "fromDimensionId", "description": "维度改变前的维度" - }, + }, { - "name": "toDimensionId", - "type": "int", + "type": "int", + "name": "toDimensionId", "description": "维度改变后的维度" - }, + }, { - "name": "fromX", - "type": "float", + "type": "float", + "name": "fromX", "description": "改变前的位置x" - }, + }, { - "name": "fromY", - "type": "float", + "type": "float", + "name": "fromY", "description": "改变前的位置Y" - }, + }, { - "name": "fromZ", - "type": "float", + "type": "float", + "name": "fromZ", "description": "改变前的位置Z" - }, + }, { - "name": "toX", - "type": "float", + "type": "float", + "name": "toX", "description": "改变后的位置x" - }, + }, { - "name": "toY", - "type": "float", + "type": "float", + "name": "toY", "description": "改变后的位置Y" - }, + }, { - "name": "toZ", - "type": "float", + "type": "float", + "name": "toZ", "description": "改变后的位置Z" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "DimensionChangeServerEvent" + }, { - "type": "event", - "name": "ExtinguishFireClientEvent", - "method": "", - "description": "玩家扑灭火焰时触发。下雨,倒水等方式熄灭火焰不会触发。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "玩家扑灭火焰时触发。下雨,倒水等方式熄灭火焰不会触发。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "火焰方块的坐标" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "修改为True时,可阻止玩家扑灭火焰。需要与ExtinguishFireServerEvent一起修改。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ExtinguishFireClientEvent" + }, { - "type": "event", - "name": "ExtinguishFireServerEvent", - "method": "", - "description": "玩家扑灭火焰时触发。下雨,倒水等方式熄灭火焰不会触发。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "玩家扑灭火焰时触发。下雨,倒水等方式熄灭火焰不会触发。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "火焰方块的坐标" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "修改为True时,可阻止玩家扑灭火焰。需要与ExtinguishFireClientEvent一起修改。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ExtinguishFireServerEvent" + }, { - "type": "event", - "name": "GameTypeChangedClientEvent", - "method": "", - "description": "个人游戏模式发生变化时客户端触发。", - "remark": "- 游戏模式:GetMinecraftEnum().GameType.*:Survival,Creative,Adventure分别为0~2\r\n 默认游戏模式发生变化时最后反映在个人游戏模式之上。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 游戏模式:GetMinecraftEnum().GameType.*:Survival,Creative,Adventure分别为0~2\r\n 默认游戏模式发生变化时最后反映在个人游戏模式之上。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "个人游戏模式发生变化时客户端触发。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家Id" - }, + }, { - "name": "oldGameType", - "type": "int", + "type": "int", + "name": "oldGameType", "description": "切换前的游戏模式" - }, + }, { - "name": "newGameType", - "type": "int", + "type": "int", + "name": "newGameType", "description": "切换后的游戏模式" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GameTypeChangedClientEvent" + }, { - "type": "event", - "name": "GameTypeChangedServerEvent", - "method": "", - "description": "当默认游戏模式或个人游戏模式发生变化时服务端触发,如果个人游戏模式不为默认时,修改默认游戏模式也会同时修改个人游戏模式,此时会触发两次该事件", - "remark": "- 游戏模式:GetMinecraftEnum().GameType.*:Survival,Creative,Adventure分别为0~2,Spectator为6\r\n 默认游戏模式发生变化时最后反映在个人游戏模式之上。\r\n 注意:避免在该事件中调用修改ability相关的接口,比如ChangePlayerFlyState等接口,如确实需要,可加定时器延后调用\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 游戏模式:GetMinecraftEnum().GameType.*:Survival,Creative,Adventure分别为0~2,Spectator为6\r\n 默认游戏模式发生变化时最后反映在个人游戏模式之上。\r\n 注意:避免在该事件中调用修改ability相关的接口,比如ChangePlayerFlyState等接口,如确实需要,可加定时器延后调用\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "当默认游戏模式或个人游戏模式发生变化时服务端触发,如果个人游戏模式不为默认时,修改默认游戏模式也会同时修改个人游戏模式,此时会触发两次该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家Id,[SetDefaultGameType](../接口/世界/游戏规则.md#SetDefaultGameType)接口改变游戏模式时该参数为空字符串" - }, + }, { - "name": "oldGameType", - "type": "int", + "type": "int", + "name": "oldGameType", "description": "切换前的游戏模式" - }, + }, { - "name": "newGameType", - "type": "int", + "type": "int", + "name": "newGameType", "description": "切换后的游戏模式" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "GameTypeChangedServerEvent" + }, { - "type": "event", - "name": "MountTamingEvent", - "method": "", - "description": "玩家通过骑乘驯服生物后触发该事件", - "remark": "- 该事件是检测minecraft:tamemount行为包组件,即玩家通过不断骑乘生物,使其冒出爱心时触发", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 该事件是检测minecraft:tamemount行为包组件,即玩家通过不断骑乘生物,使其冒出爱心时触发", + "return": [], + "description": "玩家通过骑乘驯服生物后触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "eid", - "type": "str", + "type": "str", + "name": "eid", "description": "生物id" - }, + }, { - "name": "pid", - "type": "str", + "type": "str", + "name": "pid", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "MountTamingEvent" + }, { - "type": "event", - "name": "OnLocalPlayerActionClientEvent", - "method": "", - "description": "玩家动作事件,当本地玩家开始/停止某些动作时触发该事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "玩家动作事件,当本地玩家开始/停止某些动作时触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "actionType", - "type": "int", + "type": "int", + "name": "actionType", "description": "动作事件枚举,详见Minecraft枚举值文档的[PlayerActionType](../枚举值/PlayerActionType.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnLocalPlayerActionClientEvent" + }, { - "type": "event", - "name": "OnLocalPlayerStartJumpClientEvent", - "method": "", - "description": "本地玩家开始跳跃时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "本地玩家开始跳跃时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "OnLocalPlayerStartJumpClientEvent" + }, { - "type": "event", - "name": "OnPlayerActionServerEvent", - "method": "", - "description": "玩家动作事件,当玩家开始/停止某些动作时触发该事件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "玩家动作事件,当玩家开始/停止某些动作时触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "actionType", - "type": "int", + "type": "int", + "name": "actionType", "description": "动作事件枚举,详见Minecraft枚举值文档的[PlayerActionType](../枚举值/PlayerActionType.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "OnPlayerActionServerEvent" + }, { - "type": "event", - "name": "OnPlayerHitBlockClientEvent", - "method": "", - "description": "关闭碰撞方块的检测,关闭后将不会触发OnPlayerHitBlockClientEvent事件", - "remark": "- 注:该碰撞检测会屏蔽草、空气、火、高草四种方块", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 注:该碰撞检测会屏蔽草、空气、火、高草四种方块", + "return": [], + "description": "关闭碰撞方块的检测,关闭后将不会触发OnPlayerHitBlockClientEvent事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "OnPlayerHitBlockClientEvent" + }, { - "type": "event", - "name": "OnPlayerHitBlockServerEvent", - "method": "", - "description": "关闭碰撞方块的检测,关闭后将不会触发OnPlayerHitBlockServerEvent事件", - "remark": "- 注:该碰撞检测会屏蔽草、空气、火、高草四种方块", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 注:该碰撞检测会屏蔽草、空气、火、高草四种方块", + "return": [], + "description": "关闭碰撞方块的检测,关闭后将不会触发OnPlayerHitBlockServerEvent事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "OnPlayerHitBlockServerEvent" + }, { - "type": "event", - "name": "PerspChangeClientEvent", - "method": "", - "description": "视角切换时会触发的事件", - "remark": "- 视角数字代表含义\r\n 0: 第一人称\r\n 1: 第三人称背面\r\n 2: 第三人称正面", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 视角数字代表含义\r\n 0: 第一人称\r\n 1: 第三人称背面\r\n 2: 第三人称正面", + "return": [], + "description": "视角切换时会触发的事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "from", - "type": "int", + "type": "int", + "name": "from", "description": "切换前的视角" - }, + }, { - "name": "to", - "type": "int", + "type": "int", + "name": "to", "description": "切换后的视角" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PerspChangeClientEvent" + }, { - "type": "event", - "name": "PlayerAttackEntityEvent", - "method": "", - "description": "触发时机:当本地玩家攻击时触发该事件。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "触发时机:当本地玩家攻击时触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "victimId", - "type": "str", + "type": "str", + "name": "victimId", "description": "受击者id" - }, + }, { - "name": "damage", - "type": "float", + "type": "float", + "name": "damage", "description": "客户端收到的是真实伤害值,且修改无效" - }, + }, { - "name": "isCrit", - "type": "bool", + "type": "bool", + "name": "isCrit", "description": "本次攻击是否产生暴击,不支持修改" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PlayerAttackEntityEvent" + }, { - "type": "event", - "name": "PlayerCheatSpinAttackServerEvent", - "method": "", - "description": "触发时机:玩家开始/结束快速旋转攻击并且不符合发送快速旋转攻击条件时触发(装备激流附魔的三叉戟、在水中或雨中,且未骑乘)", - "remark": "- 假如没有自定义类似三叉戟/激流附魔的物品,那么触发此事件说明此有很大可能此玩家使用了【杀戮光环】外挂\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 假如没有自定义类似三叉戟/激流附魔的物品,那么触发此事件说明此有很大可能此玩家使用了【杀戮光环】外挂\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家开始/结束快速旋转攻击并且不符合发送快速旋转攻击条件时触发(装备激流附魔的三叉戟、在水中或雨中,且未骑乘)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家的entityId" - }, + }, { - "name": "isStart", - "type": "bool", + "type": "bool", + "name": "isStart", "description": "True时代表开始快速旋转攻击;False时代表结束快速旋转攻击" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerCheatSpinAttackServerEvent" + }, { - "type": "event", - "name": "PlayerDieEvent", - "method": "", - "description": "触发时机:当玩家死亡时触发该事件。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "触发时机:当玩家死亡时触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "玩家id" - }, + }, { - "name": "attacker", - "type": "str", + "type": "str", + "name": "attacker", "description": "伤害来源id" - }, + }, { - "name": "customTag", - "type": "str", + "type": "str", + "name": "customTag", "description": "使用[Hurt接口](../接口/实体/行为.md#hurt)传入的自定义伤害类型" - }, + }, { - "name": "cause", - "type": "str", + "type": "str", + "name": "cause", "description": "伤害来源,详见Minecraft枚举值文档的[ActorDamageCause](../枚举值/ActorDamageCause.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerDieEvent" + }, { - "type": "event", - "name": "PlayerDoInteractServerEvent", - "method": "", - "description": "玩家与有minecraft:interact组件的生物交互时触发该事件,例如玩家手持空桶对牛挤奶、玩家手持打火石点燃苦力怕", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "玩家与有minecraft:interact组件的生物交互时触发该事件,例如玩家手持空桶对牛挤奶、玩家手持打火石点燃苦力怕", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "交互时使用物品的物品信息字典" - }, + }, { - "name": "interactEntityId", - "type": "str", + "type": "str", + "name": "interactEntityId", "description": "交互的生物entityId" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerDoInteractServerEvent" + }, { - "type": "event", - "name": "PlayerEatFoodServerEvent", - "method": "", - "description": "触发时机:玩家吃下食物时触发", - "remark": "- 由于牛奶本身并没有饱食度的概念,因此,当喝牛奶触发该事件时,饥饿度、营养价值字段无效并始终为0\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 由于牛奶本身并没有饱食度的概念,因此,当喝牛奶触发该事件时,饥饿度、营养价值字段无效并始终为0\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家吃下食物时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家Id" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "食物物品的物品信息字典" - }, + }, { - "name": "hunger", - "type": "int", + "type": "int", + "name": "hunger", "description": "食物增加的饥饿值,可修改" - }, + }, { - "name": "nutrition", - "type": "float", + "type": "float", + "name": "nutrition", "description": "食物的营养价值,回复饱和度 = 食物增加的饥饿值 * 食物的营养价值 * 2,饱和度最大不超过当前饥饿值,可修改" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerEatFoodServerEvent" + }, { - "type": "event", - "name": "PlayerFeedEntityServerEvent", - "method": "", - "description": "玩家喂养生物时触发,例如玩家手持小麦喂养牛、玩家手持胡萝卜喂养幼年猪。", - "remark": "- 1.对于幼年生物,用对应的物品喂养后就可以触发事件,例如用小麦喂养幼年牛、用生鲑鱼喂养幼年猫;\r\n 2.对于成年生物,用对应的物品喂养后,该生物要进入“求爱模式”(持续散发红心粒子),才可以触发事件。特殊的成年生物列举如下:\r\n a.可骑乘生物,例如马,玩家要驯服马后,再给它喂养食物(例如金苹果、金萝卜),才可以触发事件;已驯服的马受伤后,用金苹果喂养时会治疗马,不触发事件,马的血量回满时,再喂养金苹果,才会触发事件;\r\n b.可驯服生物,例如狼,玩家要用骨头驯服狼后,再给它喂养肉类物品(例如熟猪排),才可以触发事件;\r\n c.需要在特定环境下才能繁殖的生物,例如熊猫,玩家用竹子喂养熊猫时,熊猫的5格内至少要有8根竹子,喂养后才可以触发事件。\r\n 3.该事件中如需调用使用手持物相关的接口,如PlayerUseItemToEntity或其他设置物品数量的接口,会导致接口正常调用但是物品数量计算异常,建议通过timer延迟调用。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 1.对于幼年生物,用对应的物品喂养后就可以触发事件,例如用小麦喂养幼年牛、用生鲑鱼喂养幼年猫;\r\n 2.对于成年生物,用对应的物品喂养后,该生物要进入“求爱模式”(持续散发红心粒子),才可以触发事件。特殊的成年生物列举如下:\r\n a.可骑乘生物,例如马,玩家要驯服马后,再给它喂养食物(例如金苹果、金萝卜),才可以触发事件;已驯服的马受伤后,用金苹果喂养时会治疗马,不触发事件,马的血量回满时,再喂养金苹果,才会触发事件;\r\n b.可驯服生物,例如狼,玩家要用骨头驯服狼后,再给它喂养肉类物品(例如熟猪排),才可以触发事件;\r\n c.需要在特定环境下才能繁殖的生物,例如熊猫,玩家用竹子喂养熊猫时,熊猫的5格内至少要有8根竹子,喂养后才可以触发事件。\r\n 3.该事件中如需调用使用手持物相关的接口,如PlayerUseItemToEntity或其他设置物品数量的接口,会导致接口正常调用但是物品数量计算异常,建议通过timer延迟调用。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家喂养生物时触发,例如玩家手持小麦喂养牛、玩家手持胡萝卜喂养幼年猪。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "主动喂养生物的玩家的唯一ID" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "被喂养生物的唯一ID" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "当前玩家手持物品的物品信息字典" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消触发,默认为False,若设为True,可阻止触发后续的生物喂养逻辑" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerFeedEntityServerEvent" + }, { - "type": "event", - "name": "PlayerHungerChangeServerEvent", - "method": "", - "description": "玩家饥饿度变化时触发该事件", - "remark": "- 当通过setplayerhunger接口设置饥饿度时,不会触发服务端对应的事件\r\n - 当通过/hunger等指令设置饥饿度设置时,hunger字段值可能会超过最大饥饿度\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 当通过setplayerhunger接口设置饥饿度时,不会触发服务端对应的事件\r\n - 当通过/hunger等指令设置饥饿度设置时,hunger字段值可能会超过最大饥饿度\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "玩家饥饿度变化时触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "hungerBefore", - "type": "float", + "type": "float", + "name": "hungerBefore", "description": "变化前的饥饿度" - }, + }, { - "name": "hunger", - "type": "float", + "type": "float", + "name": "hunger", "description": "变化后的饥饿度" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消饥饿度变化" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerHungerChangeServerEvent" + }, { - "type": "event", - "name": "PlayerHurtEvent", - "method": "", - "description": "触发时机:当玩家受伤害前触发该事件。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "触发时机:当玩家受伤害前触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "受击玩家id" - }, + }, { - "name": "attacker", - "type": "str", + "type": "str", + "name": "attacker", "description": "伤害来源实体id,若没有实体攻击,例如高空坠落,id为-1" - }, + }, { - "name": "customTag", - "type": "str", + "type": "str", + "name": "customTag", "description": "使用[Hurt接口](../接口/实体/行为.md#hurt)传入的自定义伤害类型" - }, + }, { - "name": "cause", - "type": "str", + "type": "str", + "name": "cause", "description": "伤害来源,详见Minecraft枚举值文档的[ActorDamageCause](../枚举值/ActorDamageCause.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerHurtEvent" + }, { - "type": "event", - "name": "PlayerInteractServerEvent", - "method": "", - "description": "触发时机:玩家可以与实体交互时。如果是鼠标控制模式,则当准心对着实体时触发。如果是触屏模式,则触发时机与屏幕下方的交互按钮显示的时机相同。玩家真正与实体发生交互的事件见[PlayerDoInteractServerEvent](#playerdointeractserverevent)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "触发时机:玩家可以与实体交互时。如果是鼠标控制模式,则当准心对着实体时触发。如果是触屏模式,则触发时机与屏幕下方的交互按钮显示的时机相同。玩家真正与实体发生交互的事件见[PlayerDoInteractServerEvent](#playerdointeractserverevent)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消触发,默认为False,若设为True,可阻止触发后续的实体交互事件" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "主动与实体互动的玩家的唯一ID" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "当前玩家手持物品的物品信息字典" - }, + }, { - "name": "victimId", - "type": "str", + "type": "str", + "name": "victimId", "description": "被动的实体的唯一ID" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerInteractServerEvent" + }, { - "type": "event", - "name": "PlayerNamedEntityServerEvent", - "method": "", - "description": "玩家用命名牌重命名实体时触发,例如玩家手持命名牌对羊修改名字、玩家手持命名牌对盔甲架修改名字。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "玩家用命名牌重命名实体时触发,例如玩家手持命名牌对羊修改名字、玩家手持命名牌对盔甲架修改名字。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "主动命名实体的玩家的唯一ID" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "被命名实体的唯一ID" - }, + }, { - "name": "preName", - "type": "str", + "type": "str", + "name": "preName", "description": "实体当前的名字" - }, + }, { - "name": "afterName", - "type": "str", + "type": "str", + "name": "afterName", "description": "实体重命名后的名字" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消触发,默认为False,若设为True,可阻止触发后续的实体命名逻辑" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerNamedEntityServerEvent" + }, { - "type": "event", - "name": "PlayerRespawnEvent", - "method": "", - "description": "触发时机:玩家复活时触发该事件。", - "remark": "- 该事件为玩家点击重生按钮时触发,但是触发时玩家可能尚未完成复活,此时请勿对玩家进行切维度或设置生命值等操作\r\n 一般情况下推荐使用PlayerRespawnFinishServerEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 该事件为玩家点击重生按钮时触发,但是触发时玩家可能尚未完成复活,此时请勿对玩家进行切维度或设置生命值等操作\r\n 一般情况下推荐使用PlayerRespawnFinishServerEvent\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家复活时触发该事件。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerRespawnEvent" + }, { - "type": "event", - "name": "PlayerRespawnFinishServerEvent", - "method": "", - "description": "触发时机:玩家复活完毕时触发", - "remark": "- 该事件触发时玩家已重生完毕,可以安全使用切维度等操作\r\n - 通过末地传送门回到主世界时也算重生,同样也会触发该事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- 该事件触发时玩家已重生完毕,可以安全使用切维度等操作\r\n - 通过末地传送门回到主世界时也算重生,同样也会触发该事件\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家复活完毕时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerRespawnFinishServerEvent" + }, { - "type": "event", - "name": "PlayerSleepServerEvent", - "method": "", - "description": "玩家使用床睡觉成功", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "玩家使用床睡觉成功", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerSleepServerEvent" + }, { - "type": "event", - "name": "PlayerSpinAttackServerEvent", - "method": "", - "description": "触发时机:玩家开始/结束快速旋转攻击时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "触发时机:玩家开始/结束快速旋转攻击时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家的entityId" - }, + }, { - "name": "isInWaterOrRain", - "type": "bool", + "type": "bool", + "name": "isInWaterOrRain", "description": "是否在水中或雨中" - }, + }, { - "name": "isRiding", - "type": "bool", + "type": "bool", + "name": "isRiding", "description": "是否骑乘状态" - }, + }, { - "name": "isStart", - "type": "bool", + "type": "bool", + "name": "isStart", "description": "True时代表开始快速旋转攻击;False时代表结束快速旋转攻击" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerSpinAttackServerEvent" + }, { - "type": "event", - "name": "PlayerStopSleepServerEvent", - "method": "", - "description": "玩家停止睡觉", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "玩家停止睡觉", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerStopSleepServerEvent" + }, { - "type": "event", - "name": "PlayerTeleportEvent", - "method": "", - "description": "触发时机:当玩家传送时触发该事件,如:玩家使用末影珍珠或tp指令时。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "触发时机:当玩家传送时触发该事件,如:玩家使用末影珍珠或tp指令时。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "id", - "type": "str", + "type": "str", + "name": "id", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerTeleportEvent" + }, { - "type": "event", - "name": "PlayerTrySleepServerEvent", - "method": "", - "description": "玩家尝试使用床睡觉", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "玩家尝试使用床睡觉", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消(开发者传入)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "PlayerTrySleepServerEvent" + }, { - "type": "event", - "name": "ServerPlayerGetExperienceOrbEvent", - "method": "", - "description": "触发时机:玩家获取经验球时触发的事件", - "remark": "- `cancel`值设为True时,捡起的经验球不会增加经验值,但是经验球一样会消失。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "- `cancel`值设为True时,捡起的经验球不会增加经验值,但是经验球一样会消失。\r\n\r\n在零件中直接声明一个同名函数,即可完成监听,详情参考零件事件", + "return": [], + "description": "触发时机:玩家获取经验球时触发的事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "experienceValue", - "type": "int", + "type": "int", + "name": "experienceValue", "description": "经验球经验值" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "是否取消(开发者传入)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "ServerPlayerGetExperienceOrbEvent" + }, { - "type": "event", - "name": "StoreBuySuccServerEvent", - "method": "", - "description": "触发时机:玩家游戏内购买商品时服务端抛出的事件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "remark": "", + "return": [], + "description": "触发时机:玩家游戏内购买商品时服务端抛出的事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/玩家.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "购买商品的玩家实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "StoreBuySuccServerEvent" + }, { - "type": "event", - "name": "lobbyGoodBuySucServerEvent", - "method": "", - "description": "玩家登录联机大厅服务器,或者联机大厅游戏内购买商品时触发。如果是玩家登录,触发时玩家客户端已经触发了UiInitFinished事件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/事件/联机大厅.md", + "remark": "", + "return": [], + "description": "玩家登录联机大厅服务器,或者联机大厅游戏内购买商品时触发。如果是玩家登录,触发时玩家客户端已经触发了UiInitFinished事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/联机大厅.md", + "example": "", "params": [ { - "name": "eid", - "type": "str", + "type": "str", + "name": "eid", "description": "购买商品的玩家实体id" - }, + }, { - "name": "buyItem", - "type": "bool", + "type": "bool", + "name": "buyItem", "description": "玩家登录时为False,玩家购买了商品时为True" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "lobbyGoodBuySucServerEvent" + }, { - "type": "event", - "name": "OnMusicStopClientEvent", - "method": "", - "description": "音乐停止时,当玩家调用StopCustomMusic来停止自定义背景音乐时,会触发该事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/音效.md", + "remark": "", + "return": [], + "description": "音乐停止时,当玩家调用StopCustomMusic来停止自定义背景音乐时,会触发该事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/音效.md", + "example": "", "params": [ { - "name": "musicName", - "type": "str", + "type": "str", + "name": "musicName", "description": "音乐名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OnMusicStopClientEvent" + }, { - "type": "event", - "name": "PlayMusicClientEvent", - "method": "", - "description": "播放背景音乐时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/音效.md", + "remark": "", + "return": [], + "description": "播放背景音乐时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/音效.md", + "example": "", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "即资源包中sounds/music_definitions.json中的event_name,并且对应sounds/sound_definitions.json中的key" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设为True可屏蔽该次音效播放" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PlayMusicClientEvent" + }, { - "type": "event", - "name": "PlaySoundClientEvent", - "method": "", - "description": "播放场景音效或UI音效时触发", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/事件/音效.md", + "remark": "", + "return": [], + "description": "播放场景音效或UI音效时触发", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/事件/音效.md", + "example": "", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "即资源包中sounds/sound_definitions.json中的key" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "音效播放的位置。UI音效为(0,0,0)" - }, + }, { - "name": "volume", - "type": "float", + "type": "float", + "name": "volume", "description": "音量,范围为0-1" - }, + }, { - "name": "pitch", - "type": "float", + "type": "float", + "name": "pitch", "description": "播放速度,正常速度为1" - }, + }, { - "name": "cancel", - "type": "bool", + "type": "bool", + "name": "cancel", "description": "设为True可屏蔽该次音效播放" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PlaySoundClientEvent" + }, { - "type": "api", - "name": "通用", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "通用" + }, { - "type": "api", - "name": "世界", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "世界" + }, { - "type": "api", - "name": "实体", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "实体" + }, { - "type": "api", - "name": "玩家", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "玩家" + }, { - "type": "api", - "name": "方块", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "方块" + }, { - "type": "api", - "name": "物品", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "物品" + }, { - "type": "api", - "name": "特效", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "特效" + }, { - "type": "api", - "name": "模型", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "模型" + }, { - "type": "api", - "name": "原生UI", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "原生UI" + }, { - "type": "api", - "name": "自定义UI", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "自定义UI" + }, { - "type": "api", - "name": "音效", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "音效" + }, { - "type": "api", - "name": "控制", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "控制" + }, { - "type": "api", - "name": "游戏设置", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "游戏设置" + }, { - "type": "api", - "name": "虚拟世界", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "虚拟世界" + }, { - "type": "api", - "name": "后处理", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "后处理" + }, { - "type": "api", - "name": "联机大厅", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "联机大厅" + }, { - "type": "api", - "name": "成就", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "成就" + }, { - "type": "api", - "name": "商城", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/Api索引表.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "商城" + }, { - "type": "api", - "name": "CanSee", - "method": "", - "description": "判断起始对象是否可看见目标对象,基于对象的Head位置判断", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "判断起始对象是否可看见目标对象,基于对象的Head位置判断", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.CanSee(entityId, targetId, 20.0, True, 180.0, 180.0)", "params": [ { - "name": "fromId", - "type": "str", + "type": "str", + "name": "fromId", "description": "起始对象ID" - }, + }, { - "name": "targetId", - "type": "str", + "type": "str", + "name": "targetId", "description": "目标对象ID" - }, + }, { - "name": "viewRange", - "type": "float", + "type": "float", + "name": "viewRange", "description": "视野距离,默认值8.0" - }, + }, { - "name": "onlySolid", - "type": "bool", + "type": "bool", + "name": "onlySolid", "description": "只判断固体方块遮挡,默认True; False则液体方块也会遮挡" - }, + }, { - "name": "angleX", - "type": "float", + "type": "float", + "name": "angleX", "description": "视野X轴角度,默认值180.0度" - }, + }, { - "name": "angleY", - "type": "float", + "type": "float", + "name": "angleY", "description": "视野Y轴角度,默认值180.0度" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.CanSee(entityId, targetId, 20.0, True, 180.0, 180.0)" - }, + ], + "type": "api", + "side": "client", + "name": "CanSee" + }, { - "type": "api", - "name": "CheckBlockToPos", - "method": "", - "description": "判断位置之间是否有方块", - "remark": "- 支持判断对应维度的常加载区块内位置之间是否有方块\r\n - 返回-1通常是由于传入维度不存在、传入错误参数、传入位置所在区块并未加载等", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 支持判断对应维度的常加载区块内位置之间是否有方块\r\n - 返回-1通常是由于传入维度不存在、传入错误参数、传入位置所在区块并未加载等", + "return": [], + "description": "判断位置之间是否有方块", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\nfrom mod_log import logger as logger\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nif comp.CheckBlockToPos((0, 0, 0), (1, 1, 1), 0):\r\n logger.info(\"(0, 0, 0)与(1, 1, 1)之间有方块\")", "params": [ { - "name": "fromPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "fromPos", "description": "起始位置" - }, + }, { - "name": "toPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "toPos", "description": "终止位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "位置所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nfrom mod_log import logger as logger\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nif comp.CheckBlockToPos((0, 0, 0), (1, 1, 1), 0):\r\n logger.info(\"(0, 0, 0)与(1, 1, 1)之间有方块\")" - }, + ], + "type": "api", + "side": "server", + "name": "CheckBlockToPos" + }, { - "type": "api", - "name": "CheckChunkState", - "method": "", - "description": "判断指定位置的chunk是否加载完成", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "判断指定位置的chunk是否加载完成", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\ncomp.CheckChunkState(0, (0, 0, 0))", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "chunk所在维度" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "指定位置的坐标" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\ncomp.CheckChunkState(0, (0, 0, 0))" - }, + ], + "type": "api", + "side": "server", + "name": "CheckChunkState" + }, { - "type": "api", - "name": "CreateDimension", - "method": "", - "description": "创建新的dimension", - "remark": "- 建议在mod初始化时统一调用\r\n - 与维度相关的接口(SetUseLocalTime,SetDimensionUseLocalWeather等)会影响出生点的生成,如果要用主世界地形生成出生点,需要在mod初始化的时候优先调用一次CreateDimension(0)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 建议在mod初始化时统一调用\r\n - 与维度相关的接口(SetUseLocalTime,SetDimensionUseLocalWeather等)会影响出生点的生成,如果要用主世界地形生成出生点,需要在mod初始化的时候优先调用一次CreateDimension(0)", + "return": [], + "description": "创建新的dimension", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "comp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.CreateDimension(3)", "params": [ { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度,0/1/2维度是不需要创建的。创建大于20的维度,需要在dimension_config.json中注册,注意,维度21是不可用的" } - ], - "return": [], - "example": "comp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.CreateDimension(3)" - }, + ], + "type": "api", + "side": "server", + "name": "CreateDimension" + }, { - "type": "api", - "name": "CreateExplosion", - "method": "", - "description": "用于生成爆炸", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "用于生成爆炸", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExplosion(levelId)\r\ncomp.CreateExplosion((50,50,50),10,True,True,sourceId,playerId)", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "爆炸位置" - }, + }, { - "name": "radius", - "type": "int", + "type": "int", + "name": "radius", "description": "爆炸威力,具体含义可参考[wiki](https://minecraft-zh.gamepedia.com/%E7%88%86%E7%82%B8)对爆炸的解释" - }, + }, { - "name": "fire", - "type": "bool", + "type": "bool", + "name": "fire", "description": "是否带火" - }, + }, { - "name": "breaks", - "type": "bool", + "type": "bool", + "name": "breaks", "description": "是否破坏方块" - }, + }, { - "name": "sourceId", - "type": "str", + "type": "str", + "name": "sourceId", "description": "爆炸伤害源的实体id" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "爆炸创造的实体id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExplosion(levelId)\r\ncomp.CreateExplosion((50,50,50),10,True,True,sourceId,playerId)" - }, + ], + "type": "api", + "side": "server", + "name": "CreateExplosion" + }, { - "type": "api", - "name": "DeleteAllArea", - "method": "", - "description": "删除所有常加载区域", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\ncomp.DeleteAllArea()" - }, + "remark": "", + "return": [], + "description": "删除所有常加载区域", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\ncomp.DeleteAllArea()", + "params": [], + "type": "api", + "side": "server", + "name": "DeleteAllArea" + }, { - "type": "api", - "name": "DeleteArea", - "method": "", - "description": "删除一个常加载区域", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "删除一个常加载区域", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\ncomp.DeleteArea('Area0')", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "常加载区域的名称" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\ncomp.DeleteArea('Area0')" - }, + ], + "type": "api", + "side": "server", + "name": "DeleteArea" + }, { - "type": "api", - "name": "DetectStructure", - "method": "", - "description": "检测自定义门的结构", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "检测自定义门的结构", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "#传送门定义\r\ndefines = {\r\n '#': 'minecraft:glowstone',\r\n '*': 'minecraft:air'\r\n}\r\n#传送门形状\r\npattern = [\r\n '####',\r\n '#**#',\r\n '#**#',\r\n '####',\r\n]\r\n# 最下面中间的两个位置点击激活\r\ntouchPos =[(3,1),(3,2)]\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePortal(levelId)\r\nret = comp.DetectStructure(None, pattern, defines, touchPos, (12, 1, 5), 0)\r\nif ret[0]:\r\n logger.info('自定义传送门构建成功')\r\nelse:\r\n logger.info('自定义传送门构建失败')", "params": [ { - "name": "playerId", - "type": "None", + "type": "None", + "name": "playerId", "description": "该参数未使用,直接传入None即可" - }, + }, { - "name": "pattern", - "type": "list(str)", + "type": "list(str)", + "name": "pattern", "description": "传送门形状" - }, + }, { - "name": "defines", - "type": "dict", + "type": "dict", + "name": "defines", "description": "传送门定义" - }, + }, { - "name": "touchPos", - "type": "list(tuple(int,int))", + "type": "list(tuple(int,int))", + "name": "touchPos", "description": "传送门可激活的位置(相对参数pattern中定义的位置)" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "使用物品坐标" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "传送门所在维度" } - ], - "return": [], - "example": "#传送门定义\r\ndefines = {\r\n '#': 'minecraft:glowstone',\r\n '*': 'minecraft:air'\r\n}\r\n#传送门形状\r\npattern = [\r\n '####',\r\n '#**#',\r\n '#**#',\r\n '####',\r\n]\r\n# 最下面中间的两个位置点击激活\r\ntouchPos =[(3,1),(3,2)]\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePortal(levelId)\r\nret = comp.DetectStructure(None, pattern, defines, touchPos, (12, 1, 5), 0)\r\nif ret[0]:\r\n logger.info('自定义传送门构建成功')\r\nelse:\r\n logger.info('自定义传送门构建失败')" - }, + ], + "type": "api", + "side": "server", + "name": "DetectStructure" + }, { - "type": "api", - "name": "DoTaskOnChunkAsync", - "method": "", - "description": "异步加载指定范围区块,加载完成后调用输入的回调函数。", - "remark": "- 回调函数需要能够接收数据结构为字典的输入参数,即示例中的data。\r\n data = {\r\n 'code':1\r\n }", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 回调函数需要能够接收数据结构为字典的输入参数,即示例中的data。\r\n data = {\r\n 'code':1\r\n }", + "return": [], + "description": "异步加载指定范围区块,加载完成后调用输入的回调函数。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ndef callback(data):\r\n code = data.get('code', 0)\r\n if code == 1:\r\n #区块加载成功\r\n print 'success'\r\n elif code == 0:\r\n #区块加载失败\r\n print 'fail'\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\ncomp.DoTaskOnChunkAsync(0, (0,0,0),(100,100,100),callback)", "params": [ { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "区块所在维度" - }, + }, { - "name": "posMin", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "posMin", "description": "指定范围坐标最小值,y值不会起到限制区块范围的作用。posMin每一项均需小于posMax" - }, + }, { - "name": "posMax", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "posMax", "description": "指定范围坐标最大值,y值不会起到限制区块范围的作用。" - }, + }, { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "加载完成后调用的回调函数" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ndef callback(data):\r\n code = data.get('code', 0)\r\n if code == 1:\r\n #区块加载成功\r\n print 'success'\r\n elif code == 0:\r\n #区块加载失败\r\n print 'fail'\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\ncomp.DoTaskOnChunkAsync(0, (0,0,0),(100,100,100),callback)" - }, + ], + "type": "api", + "side": "server", + "name": "DoTaskOnChunkAsync" + }, { - "type": "api", - "name": "GetAllAreaKeys", - "method": "", - "description": "获取所有常加载区域名称列表", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\ncomp.GetAllAreaKeys()" - }, + "remark": "", + "return": [], + "description": "获取所有常加载区域名称列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\ncomp.GetAllAreaKeys()", + "params": [], + "type": "api", + "side": "server", + "name": "GetAllAreaKeys" + }, { - "type": "api", - "name": "GetBiomeInfo", - "method": "", - "description": "获取群系天气相关参数", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "获取群系天气相关参数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBiome(levelId)\r\ninfo = comp.GetBiomeInfo(\"desert\")", "params": [ { - "name": "biomeName", - "type": "str", + "type": "str", + "name": "biomeName", "description": "群系名字" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBiome(levelId)\r\ninfo = comp.GetBiomeInfo(\"desert\")" - }, + ], + "type": "api", + "side": "server", + "name": "GetBiomeInfo" + }, { - "type": "api", - "name": "GetBiomeName", - "method": "", - "description": "获取客户端当前维度已加载区域某一位置所属的生物群系信息", - "remark": "- 如果该位置区域未加载,则返回None。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 如果该位置区域未加载,则返回None。", + "return": [], + "description": "获取客户端当前维度已加载区域某一位置所属的生物群系信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBiome(levelId)\r\nbiomeName = comp.GetBiomeName((0, 80, 0))", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "指定位置" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBiome(levelId)\r\nbiomeName = comp.GetBiomeName((0, 80, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "GetBiomeName" + }, { - "type": "api", - "name": "GetBlockLightLevel", - "method": "", - "description": "获取方块位置的光照等级", - "remark": "- 仅能获取到已加载区块内方块位置的光照等级,支持获取对应维度的常加载区块内光照等级", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 仅能获取到已加载区块内方块位置的光照等级,支持获取对应维度的常加载区块内光照等级", + "return": [], + "description": "获取方块位置的光照等级", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nlightlevel = comp.GetBlockLightLevel((x,y,z), 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nlightlevel = comp.GetBlockLightLevel((x,y,z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetBlockLightLevel" + }, { - "type": "api", - "name": "GetChunkEntites", - "method": "", - "description": "获取指定位置的区块中,全部的实体和玩家的ID列表", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "获取指定位置的区块中,全部的实体和玩家的ID列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\nentityList = comp.GetChunkEntites(0, (0, 0, 0))\r\nprint \"GetChunkEntites entityList={}\".format(entityList)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "指定位置的坐标" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\nentityList = comp.GetChunkEntites(0, (0, 0, 0))\r\nprint \"GetChunkEntites entityList={}\".format(entityList)" - }, + ], + "type": "api", + "side": "server", + "name": "GetChunkEntites" + }, { - "type": "api", - "name": "GetChunkMaxPos", - "method": "", - "description": "获取某区块最大点的坐标", - "remark": "- 当传入的chunkPos类型不是tuple或者长度不为2时,返回值为None\r\n - 请传入具体实体id来构造comp,此时代表具体实体所在维度的最大坐标值。否则获取到的值有问题", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 当传入的chunkPos类型不是tuple或者长度不为2时,返回值为None\r\n - 请传入具体实体id来构造comp,此时代表具体实体所在维度的最大坐标值。否则获取到的值有问题", + "return": [], + "description": "获取某区块最大点的坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(entityId)\r\nmaxPos = comp.GetChunkMaxPos((1, 3))", "params": [ { - "name": "chunkPos", - "type": "tuple(int,int)", + "type": "tuple(int,int)", + "name": "chunkPos", "description": "指定区块的坐标" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(entityId)\r\nmaxPos = comp.GetChunkMaxPos((1, 3))" - }, + ], + "type": "api", + "side": "server", + "name": "GetChunkMaxPos" + }, { - "type": "api", - "name": "GetChunkMinPos", - "method": "", - "description": "获取某区块最小点的坐标", - "remark": "- 当传入的chunkPos类型不是tuple或者长度不为2时,返回值为None\r\n - 请传入具体实体id来构造comp,此时代表具体实体所在维度的最小坐标值。否则获取到的值有问题", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 当传入的chunkPos类型不是tuple或者长度不为2时,返回值为None\r\n - 请传入具体实体id来构造comp,此时代表具体实体所在维度的最小坐标值。否则获取到的值有问题", + "return": [], + "description": "获取某区块最小点的坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(entityId)\r\nminPos = comp.GetChunkMinPos((1, 3))", "params": [ { - "name": "chunkPos", - "type": "tuple(int,int)", + "type": "tuple(int,int)", + "name": "chunkPos", "description": "指定区块的坐标" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(entityId)\r\nminPos = comp.GetChunkMinPos((1, 3))" - }, + ], + "type": "api", + "side": "server", + "name": "GetChunkMinPos" + }, { - "type": "api", - "name": "GetChunkMobNum", - "method": "", - "description": "获取某区块中的生物数量(不包括玩家,但包括盔甲架)", - "remark": "- 返回值为-1通常是由于该维度未加载、该区块未加载", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 返回值为-1通常是由于该维度未加载、该区块未加载", + "return": [], + "description": "获取某区块中的生物数量(不包括玩家,但包括盔甲架)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\nmobNum = comp.GetChunkMobNum(0, (1, 3))", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "区块所在维度" - }, + }, { - "name": "chunkPos", - "type": "tuple(int,int)", + "type": "tuple(int,int)", + "name": "chunkPos", "description": "指定区块的坐标" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\nmobNum = comp.GetChunkMobNum(0, (1, 3))" - }, + ], + "type": "api", + "side": "server", + "name": "GetChunkMobNum" + }, { - "type": "api", - "name": "GetChunkPosFromBlockPos", - "method": "", - "description": "通过方块坐标获得该方块所在区块坐标", - "remark": "- 当传入的blockPos类型不是tuple或者长度不为3时,返回值为None", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 当传入的blockPos类型不是tuple或者长度不为3时,返回值为None", + "return": [], + "description": "通过方块坐标获得该方块所在区块坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateChunkSource(LevelId)\r\nchunkPos = comp.GetChunkPosFromBlockPos((90, 40, -4))", "params": [ { - "name": "blockPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "blockPos", "description": "方块的坐标" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateChunkSource(LevelId)\r\nchunkPos = comp.GetChunkPosFromBlockPos((90, 40, -4))" - }, + ], + "type": "api", + "side": "client", + "name": "GetChunkPosFromBlockPos" + }, { - "type": "api", - "name": "GetCurrentDimension", - "method": "", - "description": "获取客户端当前维度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ndimId = comp.GetCurrentDimension()" - }, + "remark": "", + "return": [], + "description": "获取客户端当前维度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ndimId = comp.GetCurrentDimension()", + "params": [], + "type": "api", + "side": "client", + "name": "GetCurrentDimension" + }, { - "type": "api", - "name": "GetEntitiesAround", - "method": "", - "description": "获取区域内的entity列表", - "remark": "- 过滤器在对区域内的所有实体进行过滤时,会把每一个实体设置为other,同时把entityId对应的实体设置为self。关于过滤器的详细说明,用户可以查看基岩版wiki:https://bedrock.dev/zh/docs/stable/Entities#Filters\r\n - 过滤器中\"subject\"表示过滤判断的实体类型,\"subject\"=\"self\"表示对每个实体设置的self进行过滤判断,\"subject\"=\"other\"表示对每个实体设置的other进行过滤判断\r\n - 客户端请不要使用is_family过滤,因为客户端并没有相关数据,会导致所有实体被过滤掉", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 过滤器在对区域内的所有实体进行过滤时,会把每一个实体设置为other,同时把entityId对应的实体设置为self。关于过滤器的详细说明,用户可以查看基岩版wiki:https://bedrock.dev/zh/docs/stable/Entities#Filters\r\n - 过滤器中\"subject\"表示过滤判断的实体类型,\"subject\"=\"self\"表示对每个实体设置的self进行过滤判断,\"subject\"=\"other\"表示对每个实体设置的other进行过滤判断\r\n - 客户端请不要使用is_family过滤,因为客户端并没有相关数据,会导致所有实体被过滤掉", + "return": [], + "description": "获取区域内的entity列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "#利用过滤器获取玩家身边的entity\r\n#样例中的过滤器表示“没有头戴南瓜帽”的entity\r\nfilters = {\r\n \"any_of\": [\r\n {\r\n \"test\" : \"has_equipment\",\r\n \"domain\": \"head\",\r\n \"subject\" : \"other\",\r\n \"operator\" : \"not\",\r\n \"value\" : \"carved_pumpkin\"\r\n }\r\n ]\r\n}\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.GetEntitiesAround(entityId, 100, filters)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "某个entityId" - }, + }, { - "name": "radius", - "type": "int", + "type": "int", + "name": "radius", "description": "正方体区域半径" - }, + }, { - "name": "filters", - "type": "dict", + "type": "dict", + "name": "filters", "description": "过滤设置字典" } - ], - "return": [], - "example": "#利用过滤器获取玩家身边的entity\r\n#样例中的过滤器表示“没有头戴南瓜帽”的entity\r\nfilters = {\r\n \"any_of\": [\r\n {\r\n \"test\" : \"has_equipment\",\r\n \"domain\": \"head\",\r\n \"subject\" : \"other\",\r\n \"operator\" : \"not\",\r\n \"value\" : \"carved_pumpkin\"\r\n }\r\n ]\r\n}\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.GetEntitiesAround(entityId, 100, filters)" - }, + ], + "type": "api", + "side": "client", + "name": "GetEntitiesAround" + }, { - "type": "api", - "name": "GetEntitiesAroundByType", - "method": "", - "description": "获取区域内的某类型的entity列表", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "获取区域内的某类型的entity列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# 获取身边10格内的掉落物\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.GetEntitiesAroundByType(entityId, 10, clientApi.GetMinecraftEnum().EntityType.ItemEntity)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "区域中心的entityId,如某个玩家的entityid" - }, + }, { - "name": "radius", - "type": "int", + "type": "int", + "name": "radius", "description": "区域半径" - }, + }, { - "name": "entityType", - "type": "int", + "type": "int", + "name": "entityType", "description": "[EntityType枚举](../../枚举值/EntityType.md)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# 获取身边10格内的掉落物\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.GetEntitiesAroundByType(entityId, 10, clientApi.GetMinecraftEnum().EntityType.ItemEntity)" - }, + ], + "type": "api", + "side": "client", + "name": "GetEntitiesAroundByType" + }, { - "type": "api", - "name": "GetEntitiesInSquareArea", - "method": "", - "description": "获取区域内的entity列表", - "remark": "- 维度为玩家自身所在维度\r\n - 检测的方法是使用分离轴定理,当两个AABB有重合的时候才判断为碰撞,表面相接不视为碰撞\r\n - 计算时请注意,方块的坐标代表顶点坐标,而非方块正中心位置,与实体的位置坐标含义不同。\r\n - 输入的位置为精确坐标,以单个轴举例,如AABB要覆盖坐标为1、2、3三个方块大小的范围,需要startPos为0,endPos为3。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 维度为玩家自身所在维度\r\n - 检测的方法是使用分离轴定理,当两个AABB有重合的时候才判断为碰撞,表面相接不视为碰撞\r\n - 计算时请注意,方块的坐标代表顶点坐标,而非方块正中心位置,与实体的位置坐标含义不同。\r\n - 输入的位置为精确坐标,以单个轴举例,如AABB要覆盖坐标为1、2、3三个方块大小的范围,需要startPos为0,endPos为3。", + "return": [], + "description": "获取区域内的entity列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.GetEntitiesInSquareArea(None, (0,0,0), (100,100,100))", "params": [ { - "name": "entityId", - "type": "None", + "type": "None", + "name": "entityId", "description": "该参数已废弃" - }, + }, { - "name": "startPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "startPos", "description": "初始位置" - }, + }, { - "name": "endPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "endPos", "description": "结束位置,结束位置应大于初始位置,否则会返回空列表" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.GetEntitiesInSquareArea(None, (0,0,0), (100,100,100))" - }, + ], + "type": "api", + "side": "client", + "name": "GetEntitiesInSquareArea" + }, { - "type": "api", - "name": "GetLevelId", - "method": "", - "description": "获取levelId。某些组件需要levelId创建,可以用此接口获取levelId。其中level即为当前地图的游戏。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nClientSystem = clientApi.GetClientSystemCls()\r\nclass FpsClientSystem(ClientSystem):\r\n def CameraCompTest(args):\r\n cameraComp = clientApi.GetComponent(clientApi.GetLevelId(), 'Minecraft', 'camera')\r\n cameraComp.fov = 60" - }, + "remark": "", + "return": [], + "description": "获取levelId。某些组件需要levelId创建,可以用此接口获取levelId。其中level即为当前地图的游戏。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.client.extraClientApi as clientApi\r\nClientSystem = clientApi.GetClientSystemCls()\r\nclass FpsClientSystem(ClientSystem):\r\n def CameraCompTest(args):\r\n cameraComp = clientApi.GetComponent(clientApi.GetLevelId(), 'Minecraft', 'camera')\r\n cameraComp.fov = 60", + "params": [], + "type": "api", + "side": "client", + "name": "GetLevelId" + }, { - "type": "api", - "name": "GetLoadedChunks", - "method": "", - "description": "获取指定维度当前已经加载完毕的全部区块的坐标列表", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "获取指定维度当前已经加载完毕的全部区块的坐标列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\nresult = comp.GetLoadedChunks(0)\r\nprint \"dimension {} has chunk {}\".format(0, result)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\nresult = comp.GetLoadedChunks(0)\r\nprint \"dimension {} has chunk {}\".format(0, result)" - }, + ], + "type": "api", + "side": "server", + "name": "GetLoadedChunks" + }, { - "type": "api", - "name": "GetSpawnDimension", - "method": "", - "description": "获取世界出生维度", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nspawnDimension = gameComp.GetSpawnDimension()" - }, + "remark": "", + "return": [], + "description": "获取世界出生维度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nspawnDimension = gameComp.GetSpawnDimension()", + "params": [], + "type": "api", + "side": "server", + "name": "GetSpawnDimension" + }, { - "type": "api", - "name": "GetSpawnPosition", - "method": "", - "description": "获取世界出生点坐标", - "remark": "- 返回的坐标不一定是精确的出生点坐标,也不一定是安全的出生点,玩家出生时会在该坐标附近随机选取一个满足出生条件的坐标。\r\n - 未使用setworldspawn指令设置过出生点位置时,返回坐标的y轴是32767", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nspawnPos = gameComp.GetSpawnPosition()" - }, + "remark": "- 返回的坐标不一定是精确的出生点坐标,也不一定是安全的出生点,玩家出生时会在该坐标附近随机选取一个满足出生条件的坐标。\r\n - 未使用setworldspawn指令设置过出生点位置时,返回坐标的y轴是32767", + "return": [], + "description": "获取世界出生点坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nspawnPos = gameComp.GetSpawnPosition()", + "params": [], + "type": "api", + "side": "server", + "name": "GetSpawnPosition" + }, { - "type": "api", - "name": "GetStructureSize", - "method": "", - "description": "获取结构体的长宽高", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "获取结构体的长宽高", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.GetStructureSize(\"test:structureName\")", "params": [ { - "name": "structureName", - "type": "str", + "type": "str", + "name": "structureName", "description": "结构名称" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.GetStructureSize(\"test:structureName\")" - }, + ], + "type": "api", + "side": "server", + "name": "GetStructureSize" + }, { - "type": "api", - "name": "IsChunkGenerated", - "method": "", - "description": "获取某个区块是否生成过。", - "remark": "- 玩家探索过(以玩家为中心,模拟距离(在游戏的设置页面内)为半径内的区块),或者使用SetAddArea设置常加载区块附近的区块,都是生成过的区块。这些区块会保存到存档里,再次探索时会从存档读取,不会重新生成。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 玩家探索过(以玩家为中心,模拟距离(在游戏的设置页面内)为半径内的区块),或者使用SetAddArea设置常加载区块附近的区块,都是生成过的区块。这些区块会保存到存档里,再次探索时会从存档读取,不会重新生成。", + "return": [], + "description": "获取某个区块是否生成过。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\n# 获取主世界(10000,0,10000)坐标所在的区块是否生成过\r\nresult = comp.IsChunkGenerated(0, comp.GetChunkPosFromBlockPos((10000, 0, 10000)))", "params": [ { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "区块所在维度" - }, + }, { - "name": "chunkPos", - "type": "tuple(int,int)", + "type": "tuple(int,int)", + "name": "chunkPos", "description": "指定区块的坐标" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\n# 获取主世界(10000,0,10000)坐标所在的区块是否生成过\r\nresult = comp.IsChunkGenerated(0, comp.GetChunkPosFromBlockPos((10000, 0, 10000)))" - }, + ], + "type": "api", + "side": "server", + "name": "IsChunkGenerated" + }, { - "type": "api", - "name": "IsSlimeChunk", - "method": "", - "description": "获取某个区块是否是史莱姆区块。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "获取某个区块是否是史莱姆区块。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\nresult = comp.IsSlimeChunk(0, comp.GetChunkPosFromBlockPos((10000, 0, 10000)))", "params": [ { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "区块所在维度" - }, + }, { - "name": "chunkPos", - "type": "tuple(int,int)", + "type": "tuple(int,int)", + "name": "chunkPos", "description": "指定区块的坐标" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\nresult = comp.IsSlimeChunk(0, comp.GetChunkPosFromBlockPos((10000, 0, 10000)))" - }, + ], + "type": "api", + "side": "server", + "name": "IsSlimeChunk" + }, { - "type": "api", - "name": "LocateNeteaseFeatureRule", - "method": "", - "description": "与[/locate指令](https://minecraft-zh.gamepedia.com/%E5%91%BD%E4%BB%A4/locate)相似,用于定位网易自定义特征规则", - "remark": "- 定位失败通常是由于传入维度不存在、维度未加载、没有满足该自定义特征规则分布条件的坐标、目标坐标距离传入位置过远(以该位置为中心,半径100个区块内无法找到)等\r\n - 若在feature rules中\"conditions\"内的\"minecraft:biome_filter\"中**填写了判断维度以外的过滤规则,将有概率无法定位到满足该自定义特征规则分布条件的坐标**。建议开发者在\"distribution\"的\"iterations\"中使用query.is_biome代替\r\n - 定位原理是根据网易自定义特征规则分布条件寻找可能的位置,因此**有可能会定位到在PlaceNeteaseStructureFeatureEvent事件中被取消生成的结构位置**。开发者应注意甄别,尽量避免对可能在PlaceNeteaseStructureFeatureEvent事件中被取消放置的结构对应特征规则文件调用定位函数", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 定位失败通常是由于传入维度不存在、维度未加载、没有满足该自定义特征规则分布条件的坐标、目标坐标距离传入位置过远(以该位置为中心,半径100个区块内无法找到)等\r\n - 若在feature rules中\"conditions\"内的\"minecraft:biome_filter\"中**填写了判断维度以外的过滤规则,将有概率无法定位到满足该自定义特征规则分布条件的坐标**。建议开发者在\"distribution\"的\"iterations\"中使用query.is_biome代替\r\n - 定位原理是根据网易自定义特征规则分布条件寻找可能的位置,因此**有可能会定位到在PlaceNeteaseStructureFeatureEvent事件中被取消生成的结构位置**。开发者应注意甄别,尽量避免对可能在PlaceNeteaseStructureFeatureEvent事件中被取消放置的结构对应特征规则文件调用定位函数", + "return": [], + "description": "与[/locate指令](https://minecraft-zh.gamepedia.com/%E5%91%BD%E4%BB%A4/locate)相似,用于定位网易自定义特征规则", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateFeature(levelId)\r\npos = comp.LocateNeteaseFeatureRule(\"custombiomes:overworld_pumpkins_feature_rule\", 0, (0, 64, 0), False)", "params": [ { - "name": "ruleName", - "type": "str", + "type": "str", + "name": "ruleName", "description": "特征规则名称,形式为namespace:featureRuleIdentifier,如custombiomes:overworld_pumpkins_feature_rule" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "查找维度,**要求该维度已加载**" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "以该位置为中心来查找满足网易自定义特征规则分布条件的坐标" - }, + }, { - "name": "mustBeInNewChunk", - "type": "bool", + "type": "bool", + "name": "mustBeInNewChunk", "description": "是否只在未加载区块中寻找。默认值为False,表示只在加载过的区块中寻找" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateFeature(levelId)\r\npos = comp.LocateNeteaseFeatureRule(\"custombiomes:overworld_pumpkins_feature_rule\", 0, (0, 64, 0), False)" - }, + ], + "type": "api", + "side": "server", + "name": "LocateNeteaseFeatureRule" + }, { - "type": "api", - "name": "LocateStructureFeature", - "method": "", - "description": "与[/locate指令](https://minecraft-zh.gamepedia.com/%E5%91%BD%E4%BB%A4/locate)相似,用于定位原版的部分结构,如海底神殿、末地城等。", - "remark": "- 定位失败通常是由于该维度不存在、该维度未加载、该维度中不存在该结构、该结构距离传入位置过远等\r\n - 该接口返回值为对应结构所在区块的坐标,与结构实际生成位置可能相距一定距离", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 定位失败通常是由于该维度不存在、该维度未加载、该维度中不存在该结构、该结构距离传入位置过远等\r\n - 该接口返回值为对应结构所在区块的坐标,与结构实际生成位置可能相距一定距离", + "return": [], + "description": "与[/locate指令](https://minecraft-zh.gamepedia.com/%E5%91%BD%E4%BB%A4/locate)相似,用于定位原版的部分结构,如海底神殿、末地城等。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateFeature(levelId)\r\npos = comp.LocateStructureFeature(serverApi.GetMinecraftEnum().StructureFeatureType.Village, 0, (0, 64, 0), False)", "params": [ { - "name": "featureType", - "type": "int", + "type": "int", + "name": "featureType", "description": "原版的结构类型,[StructureFeatureType](../../枚举值/StructureFeatureType.md)枚举" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "结构所在维度,**要求该维度已加载**" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "以该位置为中心来查找最近的结构" - }, + }, { - "name": "useNewChunksOnly", - "type": "bool", + "type": "bool", + "name": "useNewChunksOnly", "description": "是否只在未生成的区块中寻找。默认值为False,表示只在加载过的区块中寻找" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateFeature(levelId)\r\npos = comp.LocateStructureFeature(serverApi.GetMinecraftEnum().StructureFeatureType.Village, 0, (0, 64, 0), False)" - }, + ], + "type": "api", + "side": "server", + "name": "LocateStructureFeature" + }, { - "type": "api", - "name": "MayPlace", - "method": "", - "description": "判断方块是否可以放置", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "判断方块是否可以放置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\npos = (-1, 4, 34)\r\ncanPlace = comp.MayPlace(\"minecraft:wheat\", pos, serverApi.GetMinecraftEnum().Facing.Up, 0)", "params": [ { - "name": "identifier", - "type": "str", + "type": "str", + "name": "identifier", "description": "方块identifier,如minecraft:wheat" - }, + }, { - "name": "blockPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "blockPos", "description": "方块将要放置的坐标" - }, + }, { - "name": "facing", - "type": "int", + "type": "int", + "name": "facing", "description": "朝向,详见[Facing枚举](../../枚举值/Facing.md)" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度,默认为主世界0" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\npos = (-1, 4, 34)\r\ncanPlace = comp.MayPlace(\"minecraft:wheat\", pos, serverApi.GetMinecraftEnum().Facing.Up, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "MayPlace" + }, { - "type": "api", - "name": "MayPlaceOn", - "method": "", - "description": "判断物品是否可以放到指定的位置上", - "remark": "- 不支持常加载区块\r\n - 不支持使用是生成实体的物品,比如船,盔甲架,刷怪蛋", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 不支持常加载区块\r\n - 不支持使用是生成实体的物品,比如船,盔甲架,刷怪蛋", + "return": [], + "description": "判断物品是否可以放到指定的位置上", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.MayPlaceOn(\"minecraft:dye\", 3, (1,2,3), serverApi.GetMinecraftEnum().Facing.Up)", "params": [ { - "name": "identifier", - "type": "str", + "type": "str", + "name": "identifier", "description": "物品标识,如minecraft:dye" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "物品的附加值" - }, + }, { - "name": "blockPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "blockPos", "description": "位置坐标" - }, + }, { - "name": "facing", - "type": "int", + "type": "int", + "name": "facing", "description": "朝向,详见[Facing枚举](../../枚举值/Facing.md)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.MayPlaceOn(\"minecraft:dye\", 3, (1,2,3), serverApi.GetMinecraftEnum().Facing.Up)" - }, + ], + "type": "api", + "side": "server", + "name": "MayPlaceOn" + }, { - "type": "api", - "name": "MirrorDimension", - "method": "", - "description": "复制不同dimension的地形", - "remark": "- 仅复制源维度已经生成的区块信息到新的维度,对于未生成的源维度区块无法完全复制生成逻辑,可能采用部分新维度自己的信息。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 仅复制源维度已经生成的区块信息到新的维度,对于未生成的源维度区块无法完全复制生成逻辑,可能采用部分新维度自己的信息。", + "return": [], + "description": "复制不同dimension的地形", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.MirrorDimension(0, 1)", "params": [ { - "name": "fromId", - "type": "int", + "type": "int", + "name": "fromId", "description": "原dimensionId" - }, + }, { - "name": "toId", - "type": "int", + "type": "int", + "name": "toId", "description": "目标dimensionId" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.MirrorDimension(0, 1)" - }, + ], + "type": "api", + "side": "server", + "name": "MirrorDimension" + }, { - "type": "api", - "name": "OpenClientChunkGeneration", - "method": "", - "description": "开启/关闭客户端区块生成功能,需要在LoadServerAddonScriptsAfter事件触发时调用。开启客户端区块生成功能时,如果使用了netease:structure_feature或修改了大部分地图,会导致客户端和服务端地图不一致的问题。此时可以通过关闭客户端区块生成功能解决该问题。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "开启/关闭客户端区块生成功能,需要在LoadServerAddonScriptsAfter事件触发时调用。开启客户端区块生成功能时,如果使用了netease:structure_feature或修改了大部分地图,会导致客户端和服务端地图不一致的问题。此时可以通过关闭客户端区块生成功能解决该问题。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\nresult = comp.OpenClientChunkGeneration(False) #关闭客户端区块生成功能", "params": [ { - "name": "val", - "type": "bool", + "type": "bool", + "name": "val", "description": "开启/关闭,该功能默认开启。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\nresult = comp.OpenClientChunkGeneration(False) #关闭客户端区块生成功能" - }, + ], + "type": "api", + "side": "server", + "name": "OpenClientChunkGeneration" + }, { - "type": "api", - "name": "PlaceFeature", - "method": "", - "description": "放置特征,与[/placefeature指令](https://minecraft.fandom.com/zh/wiki/%E5%91%BD%E4%BB%A4/placefeature)相似", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "", + "return": [], + "description": "放置特征,与[/placefeature指令](https://minecraft.fandom.com/zh/wiki/%E5%91%BD%E4%BB%A4/placefeature)相似", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.PlaceFeature(\"test:pumpkins\", 0, (0, 64, 0))", "params": [ { - "name": "featureName", - "type": "str", + "type": "str", + "name": "featureName", "description": "特征名称,形式为namespace:featureName,如test:pumpkins" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "特征放置维度" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "放置位置" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.PlaceFeature(\"test:pumpkins\", 0, (0, 64, 0))" - }, + ], + "type": "api", + "side": "server", + "name": "PlaceFeature" + }, { - "type": "api", - "name": "PlaceNeteaseLargeFeature", - "method": "", - "description": "放置网易版大型结构特征", - "remark": "- 放置时需要确保所放置的区块都已加载,否则会放置失败或者部分缺失\r\n - 建议使用[SetAddArea](#setaddarea)接口将大型结构所在的区块都设置为常加载,以保证所有结构可被正常摆放", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 放置时需要确保所放置的区块都已加载,否则会放置失败或者部分缺失\r\n - 建议使用[SetAddArea](#setaddarea)接口将大型结构所在的区块都设置为常加载,以保证所有结构可被正常摆放", + "return": [], + "description": "放置网易版大型结构特征", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.PlaceNeteaseLargeFeature(\"minecraft:centerPool\", 0, (0, 65, 0), 90, 5)", "params": [ { - "name": "poolName", - "type": "str", + "type": "str", + "name": "poolName", "description": "中心池identifier,请参考大型特征结构池注册规则" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "大型结构放置维度(仅支持主世界类型维度)" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "放置位置" - }, + }, { - "name": "rotation", - "type": "int", + "type": "int", + "name": "rotation", "description": "中心结构旋转角度(0:顺时针旋转0°;90:顺时针旋转90°;180:顺时针旋转180°;270:顺时针旋转270°)" - }, + }, { - "name": "maxDepth", - "type": "int", + "type": "int", + "name": "maxDepth", "description": "大型结构递归最大深度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.PlaceNeteaseLargeFeature(\"minecraft:centerPool\", 0, (0, 65, 0), 90, 5)" - }, + ], + "type": "api", + "side": "server", + "name": "PlaceNeteaseLargeFeature" + }, { - "type": "api", - "name": "PlaceStructure", - "method": "", - "description": "放置结构", - "remark": "- 放置时需要确保所放置的区块都已加载,否则会放置失败或者部分缺失\r\n - 该接口是同步执行的,请勿在一帧内放置大量结构,会造成游戏卡顿", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 放置时需要确保所放置的区块都已加载,否则会放置失败或者部分缺失\r\n - 该接口是同步执行的,请勿在一帧内放置大量结构,会造成游戏卡顿", + "return": [], + "description": "放置结构", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.PlaceStructure(None, (100, 70, 100), \"test:structureName\", 0, 0)", "params": [ { - "name": "playerId", - "type": "None", + "type": "None", + "name": "playerId", "description": "该参数已废弃" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "放置结构的位置" - }, + }, { - "name": "structureName", - "type": "str", + "type": "str", + "name": "structureName", "description": "结构名称" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "希望放置结构的维度,可在对应维度的常加载区块放置结构,默认为-1" - }, + }, { - "name": "rotation", - "type": "int", + "type": "int", + "name": "rotation", "description": "放置结构的旋转角度,默认为0(只可旋转90,180,270度)" - }, + }, { - "name": "animationMode", - "type": "int", + "type": "int", + "name": "animationMode", "description": "动画模式,详见[AnimationModeType](../../枚举值/AnimationModeType.md),默认值为0,即不使用动画" - }, + }, { - "name": "animationTime", - "type": "float", + "type": "float", + "name": "animationTime", "description": "动画时间,默认为0" - }, + }, { - "name": "inculdeEntity", - "type": "bool", + "type": "bool", + "name": "inculdeEntity", "description": "是否包含实体,默认为True" - }, + }, { - "name": "removeBlock", - "type": "bool", + "type": "bool", + "name": "removeBlock", "description": "是否移除方块,默认为False" - }, + }, { - "name": "mirrorMode", - "type": "int", + "type": "int", + "name": "mirrorMode", "description": "镜像模式,详见[MirrorModeType](../../枚举值/MirrorModeType.md),默认值为0,即不使用镜像放置" - }, + }, { - "name": "integrity", - "type": "float", + "type": "float", + "name": "integrity", "description": "完整性,默认为100" - }, + }, { - "name": "seed", - "type": "int", + "type": "int", + "name": "seed", "description": "随机种子,默认为-1" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.PlaceStructure(None, (100, 70, 100), \"test:structureName\", 0, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "PlaceStructure" + }, { - "type": "api", - "name": "SetAddArea", - "method": "", - "description": "设置区块的常加载", - "remark": "- key必须唯一,若添加区域时key已存在将添加失败。\r\n - 该方式创建的常加载区域不会tick,即实体,方块实体,随机刻都不会进行更新。若需要区域被tick,请使用原版[tickingarea指令](https://minecraft-zh.gamepedia.com/%E5%91%BD%E4%BB%A4/tickingarea)。\r\n - 将当前未加载的区块设置为常加载区块时,不会从存档加载生物。但如果是当前已加载的区块,则玩家远离区块后,区块内的实体会一直保持加载。\r\n - 常加载区块内可以使用api创建实体、放置方块、放置结构、修改方块实体数据。\r\n - 由于区块加载算法的特性,不保证最小到最大坐标的区块完全加载并可用(即CheckChunkState接口返回True),建议将操作位置的四周外延80格的区域都设置为常加载,例如需要在(0,5,0)的位置生成生物/放置方块,需要将(-80,0,-80)到(80,0,80)的区域设置为常加载。\r\n - 通过本接口添加的区块不被tick时,无法使用fill指令在区块内填充方块", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- key必须唯一,若添加区域时key已存在将添加失败。\r\n - 该方式创建的常加载区域不会tick,即实体,方块实体,随机刻都不会进行更新。若需要区域被tick,请使用原版[tickingarea指令](https://minecraft-zh.gamepedia.com/%E5%91%BD%E4%BB%A4/tickingarea)。\r\n - 将当前未加载的区块设置为常加载区块时,不会从存档加载生物。但如果是当前已加载的区块,则玩家远离区块后,区块内的实体会一直保持加载。\r\n - 常加载区块内可以使用api创建实体、放置方块、放置结构、修改方块实体数据。\r\n - 由于区块加载算法的特性,不保证最小到最大坐标的区块完全加载并可用(即CheckChunkState接口返回True),建议将操作位置的四周外延80格的区域都设置为常加载,例如需要在(0,5,0)的位置生成生物/放置方块,需要将(-80,0,-80)到(80,0,80)的区域设置为常加载。\r\n - 通过本接口添加的区块不被tick时,无法使用fill指令在区块内填充方块", + "return": [], + "description": "设置区块的常加载", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\ncomp.SetAddArea('Area0', 0, (-80,0,-80), (80,0,80))", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "常加载区域的名称" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "区块所在的维度" - }, + }, { - "name": "minPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "minPos", "description": "加载区域的最小坐标" - }, + }, { - "name": "maxPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "maxPos", "description": "加载区域的最大坐标" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChunkSource(levelId)\r\ncomp.SetAddArea('Area0', 0, (-80,0,-80), (80,0,80))" - }, + ], + "type": "api", + "side": "server", + "name": "SetAddArea" + }, { - "type": "api", - "name": "SetBiomeByPos", - "method": "", - "description": "设置某一位置所属的生物群系信息", - "remark": "- 只支持设置已加载的坐标,支持设置2D和3D群系,3D群系有特殊规则(详情参考:3D群系是特殊)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 只支持设置已加载的坐标,支持设置2D和3D群系,3D群系有特殊规则(详情参考:3D群系是特殊)", + "return": [], + "description": "设置某一位置所属的生物群系信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBiome(levelId)\r\nsetState = comp.SetBiomeByPos((0, 80, 0), \"desert\", 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "指定位置" - }, + }, { - "name": "biomeName", - "type": "str", + "type": "str", + "name": "biomeName", "description": "指定生物群系名称" - }, + }, { - "name": "dimId", - "type": "int", + "type": "int", + "name": "dimId", "description": "维度id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBiome(levelId)\r\nsetState = comp.SetBiomeByPos((0, 80, 0), \"desert\", 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBiomeByPos" + }, { - "type": "api", - "name": "SetBiomeByPosList", - "method": "", - "description": "设置所有列表中位置所属的生物群系信息", - "remark": "- 只支持设置已加载的坐标,支持设置2D和3D群系,3D群系有特殊规则(详情参考:3D群系是特殊)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 只支持设置已加载的坐标,支持设置2D和3D群系,3D群系有特殊规则(详情参考:3D群系是特殊)", + "return": [], + "description": "设置所有列表中位置所属的生物群系信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBiome(levelId)\r\nposList = [(0, 80, 0)]\r\nsetPosListState = comp.SetBiomeByPosList(posList, \"desert\", 0)\r\n#返回字典中 \"Update\"表示整体设置是否成功,类型bool,有任何一个坐标设置失败 Update就会被设置为False\r\nsetAllState = setPosListState[\"Update\"]\r\n#返回字典中 \"BlockList\"表示设置失败的坐标列表,类型list,list中的Python Object和传入的list中的Python Object是同一个,比如传入非法的字符串\"a\",那么\"BlockList\"中也会返回\"a\"\r\nsetFailList = setPosListState[\"BlockList\"]", "params": [ { - "name": "posList", - "type": "list(tuple(int,int,int))", + "type": "list(tuple(int,int,int))", + "name": "posList", "description": "要设置的位置列表" - }, + }, { - "name": "biomeName", - "type": "str", + "type": "str", + "name": "biomeName", "description": "指定生物群系名称" - }, + }, { - "name": "dimId", - "type": "int", + "type": "int", + "name": "dimId", "description": "维度id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBiome(levelId)\r\nposList = [(0, 80, 0)]\r\nsetPosListState = comp.SetBiomeByPosList(posList, \"desert\", 0)\r\n#返回字典中 \"Update\"表示整体设置是否成功,类型bool,有任何一个坐标设置失败 Update就会被设置为False\r\nsetAllState = setPosListState[\"Update\"]\r\n#返回字典中 \"BlockList\"表示设置失败的坐标列表,类型list,list中的Python Object和传入的list中的Python Object是同一个,比如传入非法的字符串\"a\",那么\"BlockList\"中也会返回\"a\"\r\nsetFailList = setPosListState[\"BlockList\"]" - }, + ], + "type": "api", + "side": "server", + "name": "SetBiomeByPosList" + }, { - "type": "api", - "name": "SetBiomeByVolume", - "method": "", - "description": "设置长方体空间中所属的生物群系信息", - "remark": "- 只支持设置已加载的区块,设置超出维度范围的空间会被忽视掉,支持设置2D和3D群系,3D群系有特殊规则(详情参考:3D群系是特殊)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 只支持设置已加载的区块,设置超出维度范围的空间会被忽视掉,支持设置2D和3D群系,3D群系有特殊规则(详情参考:3D群系是特殊)", + "return": [], + "description": "设置长方体空间中所属的生物群系信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBiome(levelId)\r\nminPos = (0, 0, 0)\r\nmaxPos = (31,31,31)\r\nsetState = comp.SetBiomeByVolume(minPos, maxPos, \"desert\", 0)", "params": [ { - "name": "minPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "minPos", "description": "长方体中最小的位置坐标" - }, + }, { - "name": "maxPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "maxPos", "description": "长方体中最大的位置坐标" - }, + }, { - "name": "biomeName", - "type": "str", + "type": "str", + "name": "biomeName", "description": "指定生物群系名称" - }, + }, { - "name": "dimId", - "type": "int", + "type": "int", + "name": "dimId", "description": "维度id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBiome(levelId)\r\nminPos = (0, 0, 0)\r\nmaxPos = (31,31,31)\r\nsetState = comp.SetBiomeByVolume(minPos, maxPos, \"desert\", 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBiomeByVolume" + }, { - "type": "api", - "name": "SetBiomeInfo", - "method": "", - "description": "设置群系天气相关参数", - "remark": "- 此接口设置的值退出游戏时无法被保存,每次进入游戏后,需要重新设置", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 此接口设置的值退出游戏时无法被保存,每次进入游戏后,需要重新设置", + "return": [], + "description": "设置群系天气相关参数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBiome(levelId)\r\nresult = comp.SetBiomeInfo(\"desert\", (0.125, 1), 0.15, 1, True)", "params": [ { - "name": "biomeName", - "type": "str", + "type": "str", + "name": "biomeName", "description": "群系名字" - }, + }, { - "name": "snowAccumulation", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "snowAccumulation", "description": "积雪堆积量的最小值和最大值,最小值必须小于最大值" - }, + }, { - "name": "temperature", - "type": "float", + "type": "float", + "name": "temperature", "description": "温度,小于等于0.15时将会下雪,大于1没有特殊意义" - }, + }, { - "name": "downfall", - "type": "float", + "type": "float", + "name": "downfall", "description": "降雨(雪)强度,会影响湿度" - }, + }, { - "name": "isRain", - "type": "bool", + "type": "bool", + "name": "isRain", "description": "是否降雨(雪),只有为True时才会下雨(雪)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBiome(levelId)\r\nresult = comp.SetBiomeInfo(\"desert\", (0.125, 1), 0.15, 1, True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBiomeInfo" + }, { - "type": "api", - "name": "SetMergeSpawnItemRadius", - "method": "", - "description": "设置新生成的物品是否合堆", - "remark": "- 该接口主要应用于优化会一次性大量生成掉落物品的场景,使用此方式后生成结果就是一堆物品,不会先生成多个物品再进行合堆检测,可大大减少掉落物品实体数量,大幅提升性能。\r\n - 该接口不会影响游戏本身的每帧合堆检测逻辑,手中丢弃的物品不受上述合堆逻辑影响。\r\n - 合堆范围是AABB(方形),而不是一个圆。例子:在(0,100,0)初始掉落物品,在(5,100,0,)和(0,100,5)的掉落物能合堆,在生成(5,100,5)的掉落物也能合堆。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 该接口主要应用于优化会一次性大量生成掉落物品的场景,使用此方式后生成结果就是一堆物品,不会先生成多个物品再进行合堆检测,可大大减少掉落物品实体数量,大幅提升性能。\r\n - 该接口不会影响游戏本身的每帧合堆检测逻辑,手中丢弃的物品不受上述合堆逻辑影响。\r\n - 合堆范围是AABB(方形),而不是一个圆。例子:在(0,100,0)初始掉落物品,在(5,100,0,)和(0,100,5)的掉落物能合堆,在生成(5,100,5)的掉落物也能合堆。", + "return": [], + "description": "设置新生成的物品是否合堆", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ngameComp.SetMergeSpawnItemRadius(5.0)", "params": [ { - "name": "radius", - "type": "float", + "type": "float", + "name": "radius", "description": "合堆检测半径,范围可设置为0到5,初始为0。若为0代表不合堆,若大于0,则地图中生成一个物品时,会检测这个半径内是否有相同物品,若有且未达到堆叠上限,则不生成新物品,而是使地图上该物品的数量增加。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ngameComp.SetMergeSpawnItemRadius(5.0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetMergeSpawnItemRadius" + }, { - "type": "api", - "name": "SetSpawnDimensionAndPosition", - "method": "", - "description": "设置世界出生点维度与坐标", - "remark": "- 同时设置dimensionId与pos时,出生点被设置在对应维度的对应坐标。\r\n 只设置dimensionId,而pos为None时,出生点设置为对应维度,而坐标将通过[基岩版世界生成搜索](https://minecraft.fandom.com/zh/wiki/%E7%94%9F%E6%88%90#.E5.9F.BA.E5.B2.A9.E7.89.88.E4.B8.96.E7.95.8C.E7.94.9F.E6.88.90.E6.90.9C.E7.B4.A2)决定。\r\n 只设置pos,而dimensionId为None,则出生点设置为当前出生维度的对应坐标,与setworldspawn指令相同。\r\n - 将pos的y轴设置为65535,表示出生到xz坐标轴的最高实心方块上。\r\n - 当出生维度的类型是地狱和末地时,不会像主世界一样寻找一个安全的位置出生。\r\n - 关于世界出生点与个人出生点的规则,详见[玩家的生成](https://minecraft.fandom.com/zh/wiki/%E7%94%9F%E6%88%90#.E7.8E.A9.E5.AE.B6.E7.9A.84.E7.94.9F.E6.88.90)\r\n - 注意:如果和/spawnpoint一起使用,则/spawnpoint的优先级更高,SetSpawnDimensionAndPosition将失效", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 同时设置dimensionId与pos时,出生点被设置在对应维度的对应坐标。\r\n 只设置dimensionId,而pos为None时,出生点设置为对应维度,而坐标将通过[基岩版世界生成搜索](https://minecraft.fandom.com/zh/wiki/%E7%94%9F%E6%88%90#.E5.9F.BA.E5.B2.A9.E7.89.88.E4.B8.96.E7.95.8C.E7.94.9F.E6.88.90.E6.90.9C.E7.B4.A2)决定。\r\n 只设置pos,而dimensionId为None,则出生点设置为当前出生维度的对应坐标,与setworldspawn指令相同。\r\n - 将pos的y轴设置为65535,表示出生到xz坐标轴的最高实心方块上。\r\n - 当出生维度的类型是地狱和末地时,不会像主世界一样寻找一个安全的位置出生。\r\n - 关于世界出生点与个人出生点的规则,详见[玩家的生成](https://minecraft.fandom.com/zh/wiki/%E7%94%9F%E6%88%90#.E7.8E.A9.E5.AE.B6.E7.9A.84.E7.94.9F.E6.88.90)\r\n - 注意:如果和/spawnpoint一起使用,则/spawnpoint的优先级更高,SetSpawnDimensionAndPosition将失效", + "return": [], + "description": "设置世界出生点维度与坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\n# 设置世界出生点到dm3维度的某个坐标\r\ngameComp.SetSpawnDimensionAndPosition(3, (0, 60, 0))", "params": [ { - "name": "dimensionId", - "type": "int或None", + "type": "int或None", + "name": "dimensionId", "description": "维度id" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)或None", + "type": "tuple(int,int,int)或None", + "name": "pos", "description": "出生点坐标" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\n# 设置世界出生点到dm3维度的某个坐标\r\ngameComp.SetSpawnDimensionAndPosition(3, (0, 60, 0))" - }, + ], + "type": "api", + "side": "server", + "name": "SetSpawnDimensionAndPosition" + }, { - "type": "api", - "name": "UpgradeMapDimensionVersion", - "method": "", - "description": "提升指定地图维度的版本号,版本号不符的维度,地图存档信息将被废弃。使用后存档的地图版本均会同步提升至最新版本,假如希望使用此接口清理指定维度的地图存档,需要在保证该维度区块都没有被加载时调用。", - "remark": "- 对于本地游戏来说,由于引擎加载时机比mod早,因此可能出现区块加载比mod加载更早的情况,此时在初始化时使用该接口升级当前维度会出现失效的情况,建议本地游戏中先将玩家移出需要升级的维度,等区块卸载完成(可以使用CheckChunkState判断玩家离开前位置)后再升级该维度。\r\n - 对于网络服游戏来说,因为服务端加载mod总是比玩家登录要早,因此可以在mod初始化时调用该接口升级指定维度。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "remark": "- 对于本地游戏来说,由于引擎加载时机比mod早,因此可能出现区块加载比mod加载更早的情况,此时在初始化时使用该接口升级当前维度会出现失效的情况,建议本地游戏中先将玩家移出需要升级的维度,等区块卸载完成(可以使用CheckChunkState判断玩家离开前位置)后再升级该维度。\r\n - 对于网络服游戏来说,因为服务端加载mod总是比玩家登录要早,因此可以在mod初始化时调用该接口升级指定维度。", + "return": [], + "description": "提升指定地图维度的版本号,版本号不符的维度,地图存档信息将被废弃。使用后存档的地图版本均会同步提升至最新版本,假如希望使用此接口清理指定维度的地图存档,需要在保证该维度区块都没有被加载时调用。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/地图.md", + "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuccess = gameComp.UpgradeMapDimensionVersion(0, 10)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度的数字ID,0代表主世界" - }, + }, { - "name": "version", - "type": "int", + "type": "int", + "name": "version", "description": "维度地图的版本号,取值范围为1-999" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuccess = gameComp.UpgradeMapDimensionVersion(0, 10)" - }, + ], + "type": "api", + "side": "server", + "name": "UpgradeMapDimensionVersion" + }, { - "type": "api", - "name": "GetDimensionLocalWeatherInfo", - "method": "", - "description": "获取独立维度天气信息(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "remark": "", + "return": [], + "description": "获取独立维度天气信息(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.GetDimensionLocalWeatherInfo(0)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.GetDimensionLocalWeatherInfo(0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetDimensionLocalWeatherInfo" + }, { - "type": "api", - "name": "GetDimensionUseLocalWeather", - "method": "", - "description": "获取某个维度是否拥有自己的天气规则", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "remark": "", + "return": [], + "description": "获取某个维度是否拥有自己的天气规则", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.GetDimensionUseLocalWeather(0)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.GetDimensionUseLocalWeather(0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetDimensionUseLocalWeather" + }, { - "type": "api", - "name": "IsRaining", - "method": "", - "description": "获取是否下雨", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.IsRaining()" - }, + "remark": "", + "return": [], + "description": "获取是否下雨", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.IsRaining()", + "params": [], + "type": "api", + "side": "server", + "name": "IsRaining" + }, { - "type": "api", - "name": "IsThunder", - "method": "", - "description": "获取是否打雷", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.IsThunder()" - }, + "remark": "", + "return": [], + "description": "获取是否打雷", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.IsThunder()", + "params": [], + "type": "api", + "side": "server", + "name": "IsThunder" + }, { - "type": "api", - "name": "SetDimensionLocalDoWeatherCycle", - "method": "", - "description": "设置某个维度是否开启天气循环(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "remark": "", + "return": [], + "description": "设置某个维度是否开启天气循环(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.SetDimensionLocalDoWeatherCycle(0, True)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" - }, + }, { - "name": "value", - "type": "bool", + "type": "bool", + "name": "value", "description": "是否开启天气循环" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.SetDimensionLocalDoWeatherCycle(0, True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetDimensionLocalDoWeatherCycle" + }, { - "type": "api", - "name": "SetDimensionLocalRain", - "method": "", - "description": "设置某个维度下雨(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "remark": "", + "return": [], + "description": "设置某个维度下雨(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.SetDimensionLocalRain(0, 0.5, 180)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" - }, + }, { - "name": "rainLevel", - "type": "float", + "type": "float", + "name": "rainLevel", "description": "下雨强度,范围0-1" - }, + }, { - "name": "rainTime", - "type": "int", + "type": "int", + "name": "rainTime", "description": "下雨的持续时间,单位为帧,一秒20帧。持续时间结束后会自动转换为相反的天气" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.SetDimensionLocalRain(0, 0.5, 180)" - }, + ], + "type": "api", + "side": "server", + "name": "SetDimensionLocalRain" + }, { - "type": "api", - "name": "SetDimensionLocalThunder", - "method": "", - "description": "设置某个维度打雷(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "remark": "", + "return": [], + "description": "设置某个维度打雷(必须先使用SetDimensionUseLocalWeather接口设置此维度拥有自己的独立天气)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.SetDimensionLocalThunder(0, 0.5, 180)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" - }, + }, { - "name": "thunderLevel", - "type": "float", + "type": "float", + "name": "thunderLevel", "description": "打雷强度,范围0-1" - }, + }, { - "name": "thunderTime", - "type": "int", + "type": "int", + "name": "thunderTime", "description": "打雷的持续时间,单位为帧,一秒20帧。持续时间结束后会自动转换为相反的天气" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.SetDimensionLocalThunder(0, 0.5, 180)" - }, + ], + "type": "api", + "side": "server", + "name": "SetDimensionLocalThunder" + }, { - "type": "api", - "name": "SetDimensionUseLocalWeather", - "method": "", - "description": "设置某个维度拥有自己的天气规则,开启后该维度可以拥有与其他维度不同的天气和天气更替的规则", - "remark": "- 我们对主世界以及自定义维度新增了“局部天气”的概念。在此之前,所有的维度会共享一个“全局天气”,即设置天气或天气循环规则时,会对所有维度生效。\r\n 现在,我们可以将某个维度使用局部天气规则,并且单独设置它的下雨强度,下雨时间,打雷强度,打雷时间,是否开启天气循环(见[SetDimensionLocalRain](#setdimensionlocalrain)、[SetDimensionLocalThunder](#setdimensionlocalthunder)、[SetDimensionLocalDoWeatherCycle](#setdimensionlocaldoweathercycle))。\r\n 在下文中,我们会将使用局部天气规则的维度称为“局部维度”,而使用全局天气的维度称为“全局维度”。默认情况下,维度都是全局维度。\r\n 原版的weather指令,接口[SetRaining](#setraining)、[SetThunder](#setthunder)均不会对局部维度产生影响\r\n - 启用局部天气规则时,默认继承全局的天气强度和时间,局部维度天气循环默认开启\r\n - 天气规则对原版的下界与末地无效,这两个维度并没有天气系统\r\n - 建议统一在游戏启动时调用", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "remark": "- 我们对主世界以及自定义维度新增了“局部天气”的概念。在此之前,所有的维度会共享一个“全局天气”,即设置天气或天气循环规则时,会对所有维度生效。\r\n 现在,我们可以将某个维度使用局部天气规则,并且单独设置它的下雨强度,下雨时间,打雷强度,打雷时间,是否开启天气循环(见[SetDimensionLocalRain](#setdimensionlocalrain)、[SetDimensionLocalThunder](#setdimensionlocalthunder)、[SetDimensionLocalDoWeatherCycle](#setdimensionlocaldoweathercycle))。\r\n 在下文中,我们会将使用局部天气规则的维度称为“局部维度”,而使用全局天气的维度称为“全局维度”。默认情况下,维度都是全局维度。\r\n 原版的weather指令,接口[SetRaining](#setraining)、[SetThunder](#setthunder)均不会对局部维度产生影响\r\n - 启用局部天气规则时,默认继承全局的天气强度和时间,局部维度天气循环默认开启\r\n - 天气规则对原版的下界与末地无效,这两个维度并没有天气系统\r\n - 建议统一在游戏启动时调用", + "return": [], + "description": "设置某个维度拥有自己的天气规则,开启后该维度可以拥有与其他维度不同的天气和天气更替的规则", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.SetDimensionUseLocalWeather(0, True)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" - }, + }, { - "name": "value", - "type": "bool", + "type": "bool", + "name": "value", "description": "是否开启独立天气" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.SetDimensionUseLocalWeather(0, True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetDimensionUseLocalWeather" + }, { - "type": "api", - "name": "SetRaining", - "method": "", - "description": "设置是否下雨", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "remark": "", + "return": [], + "description": "设置是否下雨", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.SetRaining(0.5,1000)", "params": [ { - "name": "level", - "type": "float", + "type": "float", + "name": "level", "description": "下雨强度,范围为0-1" - }, + }, { - "name": "time", - "type": "int", + "type": "int", + "name": "time", "description": "天气的持续时间,单位为帧,一秒20帧。持续时间结束后会自动转换为相反的天气。注意,需要在游戏设置中开启天气更替后该参数才会生效。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.SetRaining(0.5,1000)" - }, + ], + "type": "api", + "side": "server", + "name": "SetRaining" + }, { - "type": "api", - "name": "SetThunder", - "method": "", - "description": "设置是否打雷", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "remark": "", + "return": [], + "description": "设置是否打雷", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/天气.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.SetThunder(0.5,1000)set_lightning", "params": [ { - "name": "level", - "type": "float", + "type": "float", + "name": "level", "description": "打雷强度,范围为0-1" - }, + }, { - "name": "time", - "type": "int", + "type": "int", + "name": "time", "description": "打雷持续时间,单位为帧,一秒20帧。注意,需要在游戏设置中开启天气更替后该参数才会生效。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateWeather(levelId)\r\ncomp.SetThunder(0.5,1000)set_lightning" - }, + ], + "type": "api", + "side": "server", + "name": "SetThunder" + }, { - "type": "api", - "name": "CreateClientEntityByTypeStr", - "method": "", - "description": "创建客户端实体", - "remark": "- 切换维度时,会自动清除全部客户端实体.退出游戏时,不会存档\r\n - 暂不支持的微软原版模型:minecraft:shulker(潜影贝),minecraft:tropicalfish(热带鱼),minecraft:iron_golem(铁傀儡)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 切换维度时,会自动清除全部客户端实体.退出游戏时,不会存档\r\n - 暂不支持的微软原版模型:minecraft:shulker(潜影贝),minecraft:tropicalfish(热带鱼),minecraft:iron_golem(铁傀儡)", + "return": [], + "description": "创建客户端实体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\nClientSystem = clientApi.GetClientSystemCls()\r\nclass MyClientSystem(ClientSystem):\r\n def createClientEntity(self):\r\n entityId = self.CreateClientEntityByTypeStr('minecraft:husk', (0, 5, 0), (0, 0))", "params": [ { - "name": "engineTypeStr", - "type": "str", + "type": "str", + "name": "engineTypeStr", "description": "实体identifier,例如'minecraft:husk'" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "生成坐标" - }, + }, { - "name": "rot", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "rot", "description": "生物面向" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nClientSystem = clientApi.GetClientSystemCls()\r\nclass MyClientSystem(ClientSystem):\r\n def createClientEntity(self):\r\n entityId = self.CreateClientEntityByTypeStr('minecraft:husk', (0, 5, 0), (0, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "CreateClientEntityByTypeStr" + }, { - "type": "api", - "name": "CreateEngineEntityByNBT", - "method": "", - "description": "根据nbt数据创建实体", - "remark": "- 无法创建玩家实体,因为玩家是一个特殊的实体\r\n - 如果要直接通过nbtDict[\"Rotation\"]修改旋转,需要注意nbt中y分量在第一位,x分量在第二位", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 无法创建玩家实体,因为玩家是一个特殊的实体\r\n - 如果要直接通过nbtDict[\"Rotation\"]修改旋转,需要注意nbt中y分量在第一位,x分量在第二位", + "return": [], + "description": "根据nbt数据创建实体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nnbt = comp.GetEntityNBTTags()\r\nnewEntityId = self.CreateEngineEntityByNBT(nbt)", "params": [ { - "name": "nbtDict", - "type": "dict", + "type": "dict", + "name": "nbtDict", "description": "实体nbt数据,可以通过EntityDefinitionsCompServer.GetEntityNBTTags获取" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)或None", + "type": "tuple(float,float,float)或None", + "name": "pos", "description": "生成坐标,如果为空,则读取nbt中的Pos" - }, + }, { - "name": "rot", - "type": "tuple(float,float)或None", + "type": "tuple(float,float)或None", + "name": "rot", "description": "生成旋转,如果为空,则读取nbt中的Rotation" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "生成维度,默认为0" - }, + }, { - "name": "isNpc", - "type": "bool", + "type": "bool", + "name": "isNpc", "description": "是否为npc,默认值为False。npc不会移动、转向、存盘。" - }, + }, { - "name": "isGlobal", - "type": "None或bool", + "type": "None或bool", + "name": "isGlobal", "description": "是否创建为全局实体,默认为None。None表示沿用nbt中是否为全局实体。设置为True或False表示覆盖nbt中的属性。全局实体不会因为玩家视野、加载范围限制而被卸载,行为与tick会一直跑,但不代表会一直存在,依然会受[清除](https://minecraft.fandom.com/zh/wiki/%E7%94%9F%E6%88%90#.E5.9F.BA.E5.B2.A9.E7.89.88_2)等原生逻辑影响,比如如果对有minecraft:despawn组件的生物创建全局实体,则还需要设置SetPersistent,否则离远后实体仍然会消失。全局实体会影响游戏性能,建议整个存档内同时存在的数量不超过10个。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nnbt = comp.GetEntityNBTTags()\r\nnewEntityId = self.CreateEngineEntityByNBT(nbt)" - }, + ], + "type": "api", + "side": "server", + "name": "CreateEngineEntityByNBT" + }, { - "type": "api", - "name": "CreateEngineEntityByTypeStr", - "method": "", - "description": "创建指定identifier的实体", - "remark": "- 在未加载的chunk无法创建\r\n 生成村民请使用\"minecraft:villager_v2\"", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 在未加载的chunk无法创建\r\n 生成村民请使用\"minecraft:villager_v2\"", + "return": [], + "description": "创建指定identifier的实体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\nServerSystem = serverApi.GetServerSystemCls()\r\nclass MyServerSystem(ServerSystem):\r\n def createMob(self):\r\n # 在主世界(0,5,0)的位置创建一个朝向为(0, 0)的尸壳\r\n entityId = self.CreateEngineEntityByTypeStr('minecraft:husk', (0, 5, 0), (0, 0), 0)", "params": [ { - "name": "engineTypeStr", - "type": "str", + "type": "str", + "name": "engineTypeStr", "description": "实体identifier,例如'minecraft:husk'" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "生成坐标" - }, + }, { - "name": "rot", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "rot", "description": "(上下角度,左右角度)实体水平方向的俯仰角度和竖直方向的旋转角度,单位是角度而不是弧度。MC坐标系说明" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "生成的维度,默认值为0(0为主世界,1为地狱,2为末地)" - }, + }, { - "name": "isNpc", - "type": "bool", + "type": "bool", + "name": "isNpc", "description": "是否为npc,默认值为False。npc不会移动、转向、存盘。" - }, + }, { - "name": "isGlobal", - "type": "bool", + "type": "bool", + "name": "isGlobal", "description": "是否创建为全局实体,默认为False。全局实体不会因为玩家视野、加载范围限制而被卸载,行为与tick会一直跑,但不代表会一直存在,依然会受[清除](https://minecraft.fandom.com/zh/wiki/%E7%94%9F%E6%88%90#.E5.9F.BA.E5.B2.A9.E7.89.88_2)等原生逻辑影响,比如如果对有minecraft:despawn组件的生物创建全局实体,则还需要设置SetPersistent,否则离远后实体仍然会消失。全局实体会影响游戏性能,建议整个存档内同时存在的数量不超过10个。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nServerSystem = serverApi.GetServerSystemCls()\r\nclass MyServerSystem(ServerSystem):\r\n def createMob(self):\r\n # 在主世界(0,5,0)的位置创建一个朝向为(0, 0)的尸壳\r\n entityId = self.CreateEngineEntityByTypeStr('minecraft:husk', (0, 5, 0), (0, 0), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "CreateEngineEntityByTypeStr" + }, { - "type": "api", - "name": "CreateEngineItemEntity", - "method": "", - "description": "用于创建物品实体(即掉落物),返回物品实体的entityId", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "", + "return": [], + "description": "用于创建物品实体(即掉落物),返回物品实体的entityId", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { 'color': { '__type__':8, '__value__':'gray'} },\r\n}\r\nitemEntityId = self.CreateEngineItemEntity(itemDict, 0, (0, 5, 0))", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "设置dimension,默认为主世界" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "生成坐标" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { 'color': { '__type__':8, '__value__':'gray'} },\r\n}\r\nitemEntityId = self.CreateEngineItemEntity(itemDict, 0, (0, 5, 0))" - }, + ], + "type": "api", + "side": "server", + "name": "CreateEngineItemEntity" + }, { - "type": "api", - "name": "CreateEntityAOI", - "method": "", - "description": "注册感应区域,有实体进入时和离开时会触发回调函数func", - "remark": "- 每个实体都会触发一次func,第一次创建感应区时会检测一次区域内原有的生物并触发func\r\n - 不支持长或宽大于2000格的区域。对于大范围区域,建议在脚本中每隔一段时间获取实体坐标判断来实现。\r\n - 回调函数传入的参数dict\r\n | 参数名 | 类型 | 解释 |\r\n | --------------------------| ------------------- | ------------------- |\r\n | AOIName | str | 注册时传入的感应区域名 |\r\n | entityType | int | 详见[EntityType枚举](../../枚举值/EntityType.md) |\r\n | pos | tuple(float,float,float) | 实体位置,只有进入的时候有 |\r\n | dimension | int | 维度 |\r\n | entityId | str | 实体Id |\r\n | identifier | str | 实体identifier |\r\n | isEnter | bool | 是否进入AOI,进入为True,退出为False |", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 每个实体都会触发一次func,第一次创建感应区时会检测一次区域内原有的生物并触发func\r\n - 不支持长或宽大于2000格的区域。对于大范围区域,建议在脚本中每隔一段时间获取实体坐标判断来实现。\r\n - 回调函数传入的参数dict\r\n | 参数名 | 类型 | 解释 |\r\n | --------------------------| ------------------- | ------------------- |\r\n | AOIName | str | 注册时传入的感应区域名 |\r\n | entityType | int | 详见[EntityType枚举](../../枚举值/EntityType.md) |\r\n | pos | tuple(float,float,float) | 实体位置,只有进入的时候有 |\r\n | dimension | int | 维度 |\r\n | entityId | str | 实体Id |\r\n | identifier | str | 实体identifier |\r\n | isEnter | bool | 是否进入AOI,进入为True,退出为False |", + "return": [], + "description": "注册感应区域,有实体进入时和离开时会触发回调函数func", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ndef fun(args):\r\n print \"entitiy trigger AOI:{}\".format(args)\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.CreateEntityAOI(0, \"myTest\", (0, 0, 0, 1, 1, 1), fun)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" - }, + }, { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "注册的感应区域名" - }, + }, { - "name": "aabb", - "type": "tuple(float,float,float,float,float,float)", + "type": "tuple(float,float,float,float,float,float)", + "name": "aabb", "description": "感应区域的坐标范围,依次为minX, minY, minZ, maxX, maxY, maxZ" - }, + }, { - "name": "func", - "type": "function", + "type": "function", + "name": "func", "description": "回调函数,参数dict请看备注" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ndef fun(args):\r\n print \"entitiy trigger AOI:{}\".format(args)\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.CreateEntityAOI(0, \"myTest\", (0, 0, 0, 1, 1, 1), fun)" - }, + ], + "type": "api", + "side": "server", + "name": "CreateEntityAOI" + }, { - "type": "api", - "name": "CreateExperienceOrb", - "method": "", - "description": "创建专属经验球", - "remark": "- 设置经验球经验,entityId是玩家的entityId。专属的经验球只有对应entityId的玩家才能拾取", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 设置经验球经验,entityId是玩家的entityId。专属的经验球只有对应entityId的玩家才能拾取", + "return": [], + "description": "创建专属经验球", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExp(entityId)\r\ncomp.CreateExperienceOrb(25,(10,10,10),False)", "params": [ { - "name": "exp", - "type": "int", + "type": "int", + "name": "exp", "description": "经验球经验" - }, + }, { - "name": "position", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "position", "description": "创建的位置" - }, + }, { - "name": "isSpecial", - "type": "bool", + "type": "bool", + "name": "isSpecial", "description": "是否专属经验球" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExp(entityId)\r\ncomp.CreateExperienceOrb(25,(10,10,10),False)" - }, + ], + "type": "api", + "side": "server", + "name": "CreateExperienceOrb" + }, { - "type": "api", - "name": "CreateProjectileEntity", - "method": "", - "description": "创建抛射物(直接发射)", - "remark": "- param参数解释如下:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | position | tuple(float,float,float) | 初始位置 |\r\n | direction | tuple(float,float,float) | 初始朝向 |\r\n | power | float | 投掷的力量值 |\r\n | gravity | float | 抛射物重力因子,默认为json配置中的值 |\r\n | damage | float | 抛射物伤害值,默认为json配置中的值 |\r\n | targetId | str | 抛射物目标(指定了target之后,会和潜影贝生物发射的跟踪导弹的那个投掷物是一个效果),默认不指定 |\r\n | isDamageOwner | bool | 对创建者是否造成伤害,默认不造成伤害 |\r\n | auxValue | int | 抛射物auxValue(目前只对原生弓箭、喷溅药水有效) |", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- param参数解释如下:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | position | tuple(float,float,float) | 初始位置 |\r\n | direction | tuple(float,float,float) | 初始朝向 |\r\n | power | float | 投掷的力量值 |\r\n | gravity | float | 抛射物重力因子,默认为json配置中的值 |\r\n | damage | float | 抛射物伤害值,默认为json配置中的值 |\r\n | targetId | str | 抛射物目标(指定了target之后,会和潜影贝生物发射的跟踪导弹的那个投掷物是一个效果),默认不指定 |\r\n | isDamageOwner | bool | 对创建者是否造成伤害,默认不造成伤害 |\r\n | auxValue | int | 抛射物auxValue(目前只对原生弓箭、喷溅药水有效) |", + "return": [], + "description": "创建抛射物(直接发射)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateProjectile(levelId)\r\nparam = {\r\n 'position': (1,1,1),\r\n 'direction': (1,1,1)\r\n}\r\ncomp.CreateProjectileEntity(playerId, \"minecraft:snowball\", param)", "params": [ { - "name": "spawnerId", - "type": "str", + "type": "str", + "name": "spawnerId", "description": "创建者Id" - }, + }, { - "name": "entityIdentifier", - "type": "str", + "type": "str", + "name": "entityIdentifier", "description": "创建抛射物的identifier,如minecraft:snowball" - }, + }, { - "name": "param", - "type": "dict", + "type": "dict", + "name": "param", "description": "默认为None,详细说明请见备注" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateProjectile(levelId)\r\nparam = {\r\n 'position': (1,1,1),\r\n 'direction': (1,1,1)\r\n}\r\ncomp.CreateProjectileEntity(playerId, \"minecraft:snowball\", param)" - }, + ], + "type": "api", + "side": "server", + "name": "CreateProjectileEntity" + }, { - "type": "api", - "name": "DeleteEntityAOI", - "method": "", - "description": "删除使用[CreateEntityAOI](#createentityaoi)注册的感应区", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "", + "return": [], + "description": "删除使用[CreateEntityAOI](#createentityaoi)注册的感应区", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.DeleteEntityAOI(0, \"myTest\")", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" - }, + }, { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "需要删除的感应区域名" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.DeleteEntityAOI(0, \"myTest\")" - }, + ], + "type": "api", + "side": "server", + "name": "DeleteEntityAOI" + }, { - "type": "api", - "name": "DestroyClientEntity", - "method": "", - "description": "销毁客户端实体", - "remark": "- 仅能销毁通过CreateClientEntityByTypeStr创建的客户端实体", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 仅能销毁通过CreateClientEntityByTypeStr创建的客户端实体", + "return": [], + "description": "销毁客户端实体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\nClientSystem = clientApi.GetClientSystemCls()\r\nclass MyClientSystem(ClientSystem):\r\n def createClientEntity(self):\r\n entityId = self.CreateClientEntityByTypeStr('minecraft:husk', (0, 5, 0), (0, 0))\r\n self.DestroyClientEntity(entityId)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "客户端实体Id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nClientSystem = clientApi.GetClientSystemCls()\r\nclass MyClientSystem(ClientSystem):\r\n def createClientEntity(self):\r\n entityId = self.CreateClientEntityByTypeStr('minecraft:husk', (0, 5, 0), (0, 0))\r\n self.DestroyClientEntity(entityId)" - }, + ], + "type": "api", + "side": "client", + "name": "DestroyClientEntity" + }, { - "type": "api", - "name": "DestroyEntity", - "method": "", - "description": "销毁实体", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "", + "return": [], + "description": "销毁实体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\nServerSystem = serverApi.GetServerSystemCls()\r\nclass FpsServerSystem(ServerSystem):\r\n def testDestroyEntity(self, entityId):\r\n self.DestroyEntity(entityId)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "销毁的实体ID" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nServerSystem = serverApi.GetServerSystemCls()\r\nclass FpsServerSystem(ServerSystem):\r\n def testDestroyEntity(self, entityId):\r\n self.DestroyEntity(entityId)" - }, + ], + "type": "api", + "side": "server", + "name": "DestroyEntity" + }, { - "type": "api", - "name": "GetDroppedItem", - "method": "", - "description": "获取掉落物的物品信息", - "remark": "- 如果掉落物实体不存在,返回值为None", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 如果掉落物实体不存在,返回值为None", + "return": [], + "description": "获取掉落物的物品信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(levelId)\r\ncomp.GetDroppedItem(entityId)", "params": [ { - "name": "itemEntityId", - "type": "str", + "type": "str", + "name": "itemEntityId", "description": "掉落物的entityId" - }, + }, { - "name": "getUserData", - "type": "bool", + "type": "bool", + "name": "getUserData", "description": "是否获取userData,默认为False" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(levelId)\r\ncomp.GetDroppedItem(entityId)" - }, + ], + "type": "api", + "side": "server", + "name": "GetDroppedItem" + }, { - "type": "api", - "name": "GetEngineActor", - "method": "", - "description": "获取客户端当前维度中已加载的所有实体(不包含玩家)。", - "remark": "- 实体信息字典 entityDict\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | dimensionId | int | 维度id |\r\n | identifier | str | 实体identifier |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nentityDicts = clientApi.GetEngineActor()" - }, + "remark": "- 实体信息字典 entityDict\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | dimensionId | int | 维度id |\r\n | identifier | str | 实体identifier |", + "return": [], + "description": "获取客户端当前维度中已加载的所有实体(不包含玩家)。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\nentityDicts = clientApi.GetEngineActor()", + "params": [], + "type": "api", + "side": "client", + "name": "GetEngineActor" + }, { - "type": "api", - "name": "GetLocalPlayerId", - "method": "", - "description": "获取本地玩家的id", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nlocalId = clientApi.GetLocalPlayerId()" - }, + "remark": "", + "return": [], + "description": "获取本地玩家的id", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\nlocalId = clientApi.GetLocalPlayerId()", + "params": [], + "type": "api", + "side": "client", + "name": "GetLocalPlayerId" + }, { - "type": "api", - "name": "GetLootItems", - "method": "", - "description": "指定战利品表获取一次战利品,返回的物品与json定义的概率有关", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "", + "return": [], + "description": "指定战利品表获取一次战利品,返回的物品与json定义的概率有关", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateLoot(playerId)\r\nresult = comp.GetLootItems(\"loot_tables/entities/zombie.json\")", "params": [ { - "name": "lootPath", - "type": "str", + "type": "str", + "name": "lootPath", "description": "战利品表的路径" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "模拟被击杀的实体ID,默认为\"-1\"" - }, + }, { - "name": "killerId", - "type": "str", + "type": "str", + "name": "killerId", "description": "模拟击杀该实体的实体ID,默认为\"-1\"" - }, + }, { - "name": "luck", - "type": "float", + "type": "float", + "name": "luck", "description": "模拟击杀该实体的玩家的幸运值,默认为0.0" - }, + }, { - "name": "getUserData", - "type": "bool", + "type": "bool", + "name": "getUserData", "description": "是否获取UserData,默认为False" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateLoot(playerId)\r\nresult = comp.GetLootItems(\"loot_tables/entities/zombie.json\")" - }, + ], + "type": "api", + "side": "server", + "name": "GetLootItems" + }, { - "type": "api", - "name": "GetPlayerList", - "method": "", - "description": "获取所有维度中的全部玩家的id列表", - "remark": "- 由于引擎中的玩家id是无序存储的,所以该接口返回列表的先后顺序没有实际意义,仅为在多平台下表现一致。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nprint clientApi.GetPlayerList()" - }, + "remark": "- 由于引擎中的玩家id是无序存储的,所以该接口返回列表的先后顺序没有实际意义,仅为在多平台下表现一致。", + "return": [], + "description": "获取所有维度中的全部玩家的id列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\nprint clientApi.GetPlayerList()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPlayerList" + }, { - "type": "api", - "name": "HasEntity", - "method": "", - "description": "判断 entity 是否存在", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "", + "return": [], + "description": "判断 entity 是否存在", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nexist = comp.HasEntity(entityId)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nexist = comp.HasEntity(entityId)" - }, + ], + "type": "api", + "side": "client", + "name": "HasEntity" + }, { - "type": "api", - "name": "IsEntityAlive", - "method": "", - "description": "判断生物实体是否存活或非生物实体是否存在", - "remark": "- 注意,如果检测的实体所在的区块被卸载,则该接口返回False。因此,需要注意实体所在的区块是否被加载。\r\n - 区块卸载:游戏只会加载玩家周围的区块,玩家移动到别的区域时,原来所在区域的区块会被卸载,参考[区块介绍](https://minecraft-zh.gamepedia.com/%E5%8C%BA%E5%9D%97)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 注意,如果检测的实体所在的区块被卸载,则该接口返回False。因此,需要注意实体所在的区块是否被加载。\r\n - 区块卸载:游戏只会加载玩家周围的区块,玩家移动到别的区域时,原来所在区域的区块会被卸载,参考[区块介绍](https://minecraft-zh.gamepedia.com/%E5%8C%BA%E5%9D%97)", + "return": [], + "description": "判断生物实体是否存活或非生物实体是否存在", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nalive = comp.IsEntityAlive(entityId)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nalive = comp.IsEntityAlive(entityId)" - }, + ], + "type": "api", + "side": "client", + "name": "IsEntityAlive" + }, { - "type": "api", - "name": "KillEntity", - "method": "", - "description": "杀死某个Entity", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "", + "return": [], + "description": "杀死某个Entity", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.KillEntity(entityId)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "要杀死的目标的entityId" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.KillEntity(entityId)" - }, + ], + "type": "api", + "side": "server", + "name": "KillEntity" + }, { - "type": "api", - "name": "SpawnLootTable", - "method": "", - "description": "使用生物类型模拟一次随机掉落,生成的物品与json定义的概率有关", - "remark": "- 需要在对应的player实体附近生成,否则会生成失败。对于某些特殊的生物,如minecraft:sheep,需要使用SpawnLootTableWithActor接口来模拟随机掉落。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 需要在对应的player实体附近生成,否则会生成失败。对于某些特殊的生物,如minecraft:sheep,需要使用SpawnLootTableWithActor接口来模拟随机掉落。", + "return": [], + "description": "使用生物类型模拟一次随机掉落,生成的物品与json定义的概率有关", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateActorLoot(playerId)\r\nresult = comp.SpawnLootTable((1, 4, 5), 'minecraft:guardian')", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "掉落位置" - }, + }, { - "name": "identifier", - "type": "str", + "type": "str", + "name": "identifier", "description": "实体identifier,如minecraft:guardian" - }, + }, { - "name": "playerKillerId", - "type": "str", + "type": "str", + "name": "playerKillerId", "description": "玩家杀手(只能是玩家),默认None" - }, + }, { - "name": "damageCauseEntityId", - "type": "str", + "type": "str", + "name": "damageCauseEntityId", "description": "伤害来源实体Id(掉落与该实体手持物品的抢夺附魔等级有关),默认None" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateActorLoot(playerId)\r\nresult = comp.SpawnLootTable((1, 4, 5), 'minecraft:guardian')" - }, + ], + "type": "api", + "side": "server", + "name": "SpawnLootTable" + }, { - "type": "api", - "name": "SpawnLootTableWithActor", - "method": "", - "description": "使用生物实例模拟一次随机掉落,生成的物品与json定义的概率有关", - "remark": "- 需要在对应的player实体附近生成,否则会生成失败", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 需要在对应的player实体附近生成,否则会生成失败", + "return": [], + "description": "使用生物实例模拟一次随机掉落,生成的物品与json定义的概率有关", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateActorLoot(playerId)\r\nresult = comp.SpawnLootTableWithActor((1, 4, 5), '-335007449086')", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "掉落位置" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "模拟生物的生物Id" - }, + }, { - "name": "playerKillerId", - "type": "str", + "type": "str", + "name": "playerKillerId", "description": "玩家杀手(只能是玩家),默认None" - }, + }, { - "name": "damageCauseEntityId", - "type": "str", + "type": "str", + "name": "damageCauseEntityId", "description": "伤害来源实体Id(掉落与该实体手持物品的抢夺附魔等级有关),默认None" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateActorLoot(playerId)\r\nresult = comp.SpawnLootTableWithActor((1, 4, 5), '-335007449086')" - }, + ], + "type": "api", + "side": "server", + "name": "SpawnLootTableWithActor" + }, { - "type": "api", - "name": "SpawnResources", - "method": "", - "description": "产生方块随机掉落(该方法不适用于实体方块)", - "remark": "- 时运等级[bonusLootLevel]只对部分方块生效\r\n 掉落概率[probability]对部分农作物树叶不生效\r\n - 可在对应维度的常加载区块产生掉落", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 时运等级[bonusLootLevel]只对部分方块生效\r\n 掉落概率[probability]对部分农作物树叶不生效\r\n - 可在对应维度的常加载区块产生掉落", + "return": [], + "description": "产生方块随机掉落(该方法不适用于实体方块)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 金矿石掉落\r\nresult = comp.SpawnResources('minecraft:gold_ore', (1,1,1), 7, 1.0, 10)\r\n# 指定维度产生掉落\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nresult = comp.SpawnResources('minecraft:gold_ore', (1,1,1), 7, 1.0, 10, 0)", "params": [ { - "name": "identifier", - "type": "str", + "type": "str", + "name": "identifier", "description": "方块的identifier,如minecraft:wool" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "掉落位置" - }, + }, { - "name": "aux", - "type": "int", + "type": "int", + "name": "aux", "description": "方块的附加值" - }, + }, { - "name": "probability", - "type": "float", + "type": "float", + "name": "probability", "description": "掉落概率,范围为[0, 1],0为不掉落,1为100%掉落" - }, + }, { - "name": "bonusLootLevel", - "type": "int", + "type": "int", + "name": "bonusLootLevel", "description": "[时运等级](https://minecraft-zh.gamepedia.com/时运),默认为0" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "掉落方块的维度,默认值为-1,传入非负值时用于获取产生方块掉落的维度;否则将随机挑选一个存在玩家的维度产生掉落" - }, + }, { - "name": "allowRandomness", - "type": "bool", + "type": "bool", + "name": "allowRandomness", "description": "是否允许随机采集,默认为True,如果为False,掉落概率probability无效" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 金矿石掉落\r\nresult = comp.SpawnResources('minecraft:gold_ore', (1,1,1), 7, 1.0, 10)\r\n# 指定维度产生掉落\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nresult = comp.SpawnResources('minecraft:gold_ore', (1,1,1), 7, 1.0, 10, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SpawnResources" + }, { - "type": "api", - "name": "SpawnResourcesSilkTouched", - "method": "", - "description": "模拟方块精准采集掉落", - "remark": "- 如果指定方块不属于精准采集方块,返回False", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 如果指定方块不属于精准采集方块,返回False", + "return": [], + "description": "模拟方块精准采集掉落", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nresult = comp.SpawnResourcesSilkTouched('minecraft:gold_ore', (1,1,1), 7)", "params": [ { - "name": "identifier", - "type": "str", + "type": "str", + "name": "identifier", "description": "方块的identifier,如minecraft:wool" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "掉落位置" - }, + }, { - "name": "aux", - "type": "int", + "type": "int", + "name": "aux", "description": "方块的附加值" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "掉落方块的维度,默认值为-1,传入非负值时用于获取产生方块掉落的维度;否则将随机挑选一个存在玩家的维度产生掉落" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nresult = comp.SpawnResourcesSilkTouched('minecraft:gold_ore', (1,1,1), 7)" - }, + ], + "type": "api", + "side": "server", + "name": "SpawnResourcesSilkTouched" + }, { - "type": "api", - "name": "getEntitiesOrBlockFromRay", - "method": "", - "description": "从指定位置发射一条射线,获取与射线相交的实体和方块", - "remark": "- 选中目标为实体时,返回值为:\r\n ```python\r\n [{\r\n \"type\": \"Entity\",\r\n \"entityId\": entityId,\r\n \"identifier\": identifier,\r\n \"hitPos\" : (x, y, z) #精准碰撞坐标,类型为tuple(float,float,float)\r\n },\r\n {\r\n ...\r\n }]\r\n ```\r\n - 选中目标为方块时,返回值为:\r\n ```python\r\n [{\r\n \"type\": \"Block\",\r\n \"pos\" : (0, 1, 0),\r\n \"identifier\": identifier,\r\n \"hitPos\" : (x, y, z) #精准碰撞坐标,类型为tuple(float,float,float)\r\n },\r\n {\r\n ...\r\n }]\r\n ```\r\n - 没有选中目标时,返回值为:None\r\n - 假设方块的clip(计算射线检测时用的碰撞盒)没有体积时,射线检测将会无视这个方块,例如原版的火焰,灵魂火等;自定义方块的clip可以在netease:aabb中进行设置", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "remark": "- 选中目标为实体时,返回值为:\r\n ```python\r\n [{\r\n \"type\": \"Entity\",\r\n \"entityId\": entityId,\r\n \"identifier\": identifier,\r\n \"hitPos\" : (x, y, z) #精准碰撞坐标,类型为tuple(float,float,float)\r\n },\r\n {\r\n ...\r\n }]\r\n ```\r\n - 选中目标为方块时,返回值为:\r\n ```python\r\n [{\r\n \"type\": \"Block\",\r\n \"pos\" : (0, 1, 0),\r\n \"identifier\": identifier,\r\n \"hitPos\" : (x, y, z) #精准碰撞坐标,类型为tuple(float,float,float)\r\n },\r\n {\r\n ...\r\n }]\r\n ```\r\n - 没有选中目标时,返回值为:None\r\n - 假设方块的clip(计算射线检测时用的碰撞盒)没有体积时,射线检测将会无视这个方块,例如原版的火焰,灵魂火等;自定义方块的clip可以在netease:aabb中进行设置", + "return": [], + "description": "从指定位置发射一条射线,获取与射线相交的实体和方块", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/实体管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\nentityDicts = clientApi.getEntitiesOrBlockFromRay((0, 0, 0), (1, 0, 0), 16, False, clientApi.GetMinecraftEnum().RayFilterType.OnlyEntities)", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "指定位置坐标(必填)" - }, + }, { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "射线方向单位向量(必填)" - }, + }, { - "name": "distance", - "type": "int", + "type": "int", + "name": "distance", "description": "射线长度(一个方块长度为1)(选填,默认16)" - }, + }, { - "name": "isThrough", - "type": "bool", + "type": "bool", + "name": "isThrough", "description": "是否穿透,如穿透,则返回所有射线穿过的实体或方块,如不穿透,则返回第一个碰撞到的实体或方块(选填,默认为False)" - }, + }, { - "name": "filterType", - "type": "minecraftEnum", + "type": "minecraftEnum", + "name": "filterType", "description": "[RayFilterType枚举](../../枚举值/RayFilterType.md)(选填,默认为serverApi.GetMinecraftEnum().RayFilterType.OnlyEntities)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nentityDicts = clientApi.getEntitiesOrBlockFromRay((0, 0, 0), (1, 0, 0), 16, False, clientApi.GetMinecraftEnum().RayFilterType.OnlyEntities)" - }, + ], + "type": "api", + "side": "client", + "name": "getEntitiesOrBlockFromRay" + }, { - "type": "api", - "name": "GetCommandPermissionLevel", - "method": "", - "description": "返回设定使用/op命令时OP的权限等级(对应server.properties中的op-permission-level配置)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/指令.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateCommand(levelId)\r\nopLevel = comp.GetCommandPermissionLevel()\r\nprint \"GetCommandPermissionLevel oplevel={}\".format(opLevel)" - }, + "remark": "", + "return": [], + "description": "返回设定使用/op命令时OP的权限等级(对应server.properties中的op-permission-level配置)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/指令.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateCommand(levelId)\r\nopLevel = comp.GetCommandPermissionLevel()\r\nprint \"GetCommandPermissionLevel oplevel={}\".format(opLevel)", + "params": [], + "type": "api", + "side": "server", + "name": "GetCommandPermissionLevel" + }, { - "type": "api", - "name": "GetDefaultPlayerPermissionLevel", - "method": "", - "description": "返回新玩家加入时的权限身份(对应server.properties中的default-player-permission-level配置)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/指令.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateCommand(levelId)\r\nopLevel = comp.GetDefaultPlayerPermissionLevel()\r\nprint \"GetDefaultPlayerPermissionLevel oplevel={}\".format(opLevel)" - }, + "remark": "", + "return": [], + "description": "返回新玩家加入时的权限身份(对应server.properties中的default-player-permission-level配置)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/指令.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateCommand(levelId)\r\nopLevel = comp.GetDefaultPlayerPermissionLevel()\r\nprint \"GetDefaultPlayerPermissionLevel oplevel={}\".format(opLevel)", + "params": [], + "type": "api", + "side": "server", + "name": "GetDefaultPlayerPermissionLevel" + }, { - "type": "api", - "name": "SetCommand", - "method": "", - "description": "使用游戏内指令", - "remark": "- entityId 为非玩家时,即使showOutput为true,也不会输出到聊天窗口,且OnCommandOutputClientEvent 事件不会被触发", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/指令.md", + "remark": "- entityId 为非玩家时,即使showOutput为true,也不会输出到聊天窗口,且OnCommandOutputClientEvent 事件不会被触发", + "return": [], + "description": "使用游戏内指令", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/指令.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateCommand(levelId)\r\ncomp.SetCommand(\"/tp @p 100 5 100\")#传送指令", "params": [ { - "name": "cmdStr", - "type": "str", + "type": "str", + "name": "cmdStr", "description": "指令" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体Id:可选,如果不设置,则随机选择玩家" - }, + }, { - "name": "showOutput", - "type": "bool", + "type": "bool", + "name": "showOutput", "description": "是否输出到聊天窗口:可选,默认False,如果为True的话,指令正确时,才会和聊天框输入原生指令一样输出返回信息。只有当该参数为True的时候会触发OnCommandOutputServerEvent与OnCommandOutputClientEvent" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateCommand(levelId)\r\ncomp.SetCommand(\"/tp @p 100 5 100\")#传送指令" - }, + ], + "type": "api", + "side": "server", + "name": "SetCommand" + }, { - "type": "api", - "name": "SetCommandPermissionLevel", - "method": "", - "description": "设置当玩家使用/op命令时OP的权限等级(对应server.properties中的op-permission-level配置)", - "remark": "- 此API不会修改已经获取了op的玩家的权限等级,仅影响调用API之后才获取op的玩家,建议在游戏初始化时调用此API", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/指令.md", + "remark": "- 此API不会修改已经获取了op的玩家的权限等级,仅影响调用API之后才获取op的玩家,建议在游戏初始化时调用此API", + "return": [], + "description": "设置当玩家使用/op命令时OP的权限等级(对应server.properties中的op-permission-level配置)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/指令.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateCommand(levelId)\r\nopLevel = 4\r\nsuc = comp.SetCommandPermissionLevel(opLevel)\r\nprint \"SetCommandPermissionLevel to {} suc={}\".format(opLevel, suc)", "params": [ { - "name": "opLevel", - "type": "int", + "type": "int", + "name": "opLevel", "description": "权限等级:1-OP可以绕过重生点保护;2-OP可以使用所有单人游戏作弊命令;3-OP可以使用大多数多人游戏中独有的命令;4-OP可以使用所有命令" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateCommand(levelId)\r\nopLevel = 4\r\nsuc = comp.SetCommandPermissionLevel(opLevel)\r\nprint \"SetCommandPermissionLevel to {} suc={}\".format(opLevel, suc)" - }, + ], + "type": "api", + "side": "server", + "name": "SetCommandPermissionLevel" + }, { - "type": "api", - "name": "SetDefaultPlayerPermissionLevel", - "method": "", - "description": "设置新玩家加入时的权限身份(对应server.properties中的default-player-permission-level配置)", - "remark": "- 此API不会修改已经加入过游戏的玩家的权限身份,仅影响调用API之后才新加入的玩家,建议在游戏初始化时调用此API", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/指令.md", + "remark": "- 此API不会修改已经加入过游戏的玩家的权限身份,仅影响调用API之后才新加入的玩家,建议在游戏初始化时调用此API", + "return": [], + "description": "设置新玩家加入时的权限身份(对应server.properties中的default-player-permission-level配置)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/指令.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateCommand(levelId)\r\nopLevel = 1\r\nsuc = comp.SetDefaultPlayerPermissionLevel(opLevel)\r\nprint \"SetDefaultPlayerPermissionLevel to {} suc={}\".format(opLevel, suc)", "params": [ { - "name": "opLevel", - "type": "int", + "type": "int", + "name": "opLevel", "description": "权限身份:0-Visitor;1-Member;2-Operator;3-自定义" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateCommand(levelId)\r\nopLevel = 1\r\nsuc = comp.SetDefaultPlayerPermissionLevel(opLevel)\r\nprint \"SetDefaultPlayerPermissionLevel to {} suc={}\".format(opLevel, suc)" - }, + ], + "type": "api", + "side": "server", + "name": "SetDefaultPlayerPermissionLevel" + }, { - "type": "api", - "name": "GetBlock", - "method": "", - "description": "获取某一位置的block", - "remark": "- 已经加载的地形才设置、获取方块信息", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "remark": "- 已经加载的地形才设置、获取方块信息", + "return": [], + "description": "获取某一位置的block", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.GetBlock((x,y,z))", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "方块位置" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.GetBlock((x,y,z))" - }, + ], + "type": "api", + "side": "client", + "name": "GetBlock" + }, { - "type": "api", - "name": "GetBlockClip", - "method": "", - "description": "获取指定位置方块当前clip的aabb", - "remark": "- 由于方块的碰撞盒可以随临近方块改变而改变,因此该接口返回的是调用时方块clip的aabb", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "remark": "- 由于方块的碰撞盒可以随临近方块改变而改变,因此该接口返回的是调用时方块clip的aabb", + "return": [], + "description": "获取指定位置方块当前clip的aabb", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.GetBlockClip((x,y,z))", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.GetBlockClip((x,y,z))" - }, + ], + "type": "api", + "side": "client", + "name": "GetBlockClip" + }, { - "type": "api", - "name": "GetBlockCollision", - "method": "", - "description": "获取指定位置方块当前collision的aabb", - "remark": "- 由于方块的碰撞盒可以随临近方块改变而改变,因此该接口返回的是调用时方块collision的aabb", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "remark": "- 由于方块的碰撞盒可以随临近方块改变而改变,因此该接口返回的是调用时方块collision的aabb", + "return": [], + "description": "获取指定位置方块当前collision的aabb", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.GetBlockCollision((x,y,z))", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.GetBlockCollision((x,y,z))" - }, + ], + "type": "api", + "side": "client", + "name": "GetBlockCollision" + }, { - "type": "api", - "name": "GetBlockNew", - "method": "", - "description": "获取某一位置的block", - "remark": "- 已经加载的地形才能获取方块信息,支持获取对应维度的常加载区块内方块信息\r\n - 对于有多种状态的方块,aux计算比较复杂,推荐使用GetBlockStates获取方块状态字典", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "remark": "- 已经加载的地形才能获取方块信息,支持获取对应维度的常加载区块内方块信息\r\n - 对于有多种状态的方块,aux计算比较复杂,推荐使用GetBlockStates获取方块状态字典", + "return": [], + "description": "获取某一位置的block", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nblockDict = comp.GetBlockNew((0, 5, 0), 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nblockDict = comp.GetBlockNew((0, 5, 0), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetBlockNew" + }, { - "type": "api", - "name": "GetDestroyTotalTime", - "method": "", - "description": "获取使用物品破坏方块需要的时间", - "remark": "- 挖掘参数 miningArgs\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | haste | int | 急迫等级,模拟玩家获得急迫状态效果 |\r\n | conduit_power | int | 潮涌能量等级,模拟玩家获得潮涌能量状态效果 |\r\n | mining_fatigue | int | 挖掘疲劳等级,模拟玩家获得挖掘疲劳状态效果 |\r\n | mining_efficiency | int | 挖掘效率等级,模拟工具获得效率附魔 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "remark": "- 挖掘参数 miningArgs\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | haste | int | 急迫等级,模拟玩家获得急迫状态效果 |\r\n | conduit_power | int | 潮涌能量等级,模拟玩家获得潮涌能量状态效果 |\r\n | mining_fatigue | int | 挖掘疲劳等级,模拟玩家获得挖掘疲劳状态效果 |\r\n | mining_efficiency | int | 挖掘效率等级,模拟工具获得效率附魔 |", + "return": [], + "description": "获取使用物品破坏方块需要的时间", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nargs = {\r\n \"haste\": 1,\r\n \"conduit_power\": 1,\r\n \"mining_fatigue\": 1,\r\n \"mining_efficiency\": 1\r\n}\r\ncomp.GetDestroyTotalTime(\"minecraft:diamond_block\", \"minecraft:stone_pickaxe\", args)", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块标识符,格式[namespace:name:auxvalue],auxvalue默认为0" - }, + }, { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "物品标识符,格式[namespace:name:auxvalue],auxvalue默认为0,默认为None(不使用物品)" - }, + }, { - "name": "miningArgs", - "type": "dict", + "type": "dict", + "name": "miningArgs", "description": "挖掘参数,包含以下字段:急迫等级haste、潮涌能量等级conduit_power、挖掘疲劳mining_fatigue以及挖掘效率等级mining_efficiency,默认为None(所有参数为0)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nargs = {\r\n \"haste\": 1,\r\n \"conduit_power\": 1,\r\n \"mining_fatigue\": 1,\r\n \"mining_efficiency\": 1\r\n}\r\ncomp.GetDestroyTotalTime(\"minecraft:diamond_block\", \"minecraft:stone_pickaxe\", args)" - }, + ], + "type": "api", + "side": "client", + "name": "GetDestroyTotalTime" + }, { - "type": "api", - "name": "GetLiquidBlock", - "method": "", - "description": "获取某个位置的方块所含流体的信息", - "remark": "- 已经加载的地形才能获取方块信息,支持获取对应维度的常加载区块内方块信息\r\n - 对于不含水或者不是流体的方块,则返回None。对于一个含水的方块,如含水的橡木栅栏,GetLiquidBlock会返回其含有的流体的信息(包括自定义流体),GetBlockNew则会返回橡木栅栏的信息。而对于一般的水方块(包括自定义流体),GetLiquidBlock和GetBlockNew则都会返回水的信息(包括自定义流体)。因此可以用GetLiquidBlock和GetBlockNew判断某个方块是否流体", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "remark": "- 已经加载的地形才能获取方块信息,支持获取对应维度的常加载区块内方块信息\r\n - 对于不含水或者不是流体的方块,则返回None。对于一个含水的方块,如含水的橡木栅栏,GetLiquidBlock会返回其含有的流体的信息(包括自定义流体),GetBlockNew则会返回橡木栅栏的信息。而对于一般的水方块(包括自定义流体),GetLiquidBlock和GetBlockNew则都会返回水的信息(包括自定义流体)。因此可以用GetLiquidBlock和GetBlockNew判断某个方块是否流体", + "return": [], + "description": "获取某个位置的方块所含流体的信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nliquidBlockDict = comp.GetLiquidBlock((0, 5, 0), 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nliquidBlockDict = comp.GetLiquidBlock((0, 5, 0), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetLiquidBlock" + }, { - "type": "api", - "name": "GetTopBlockHeight", - "method": "", - "description": "获取当前维度某一位置最高的非空气方块的高度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "remark": "", + "return": [], + "description": "获取当前维度某一位置最高的非空气方块的高度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nheight = comp.GetTopBlockHeight((5, 5))", "params": [ { - "name": "pos", - "type": "tuple(int,int)", + "type": "tuple(int,int)", + "name": "pos", "description": "x轴与z轴位置" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nheight = comp.GetTopBlockHeight((5, 5))" - }, + ], + "type": "api", + "side": "client", + "name": "GetTopBlockHeight" + }, { - "type": "api", - "name": "SetBlockNew", - "method": "", - "description": "设置某一位置的方块", - "remark": "- 已经加载的地形才能设置方块,支持在对应维度的常加载区块内设置方块\r\n - 若设置前后为同一个方块(方块名和附加值都相同),则接口返回False\r\n - 若设置前后方块实体类型相同时(方块名相同),箱子、熔炉等容器内的物品将被清空(尽管前后附加值也相同时接口会返回False),而告示牌、物品展示框、自定义方块实体的内容会被保留(如果希望清空,可以先设置为空气再设置相应方块)。\r\n - 随着版本更新,aux值对应的方块state会发生改变,对于有多种状态的方块,aux计算方式比较复杂,推荐先通过GetBlockAuxValueFromStates获取传统aux值再进行设置。\r\n - 若调用SetBlockNew接口后立即调用其它会影响客户端表现的服务端接口,并且这个表现和此方块有关系(比如使用SetBlockNew放置一个箱子,并立即调用PlayerUseItemToPos接口打开这个箱子),可能会出现异常表现,如有类似需求,建议在下一帧对方块进行操作", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "remark": "- 已经加载的地形才能设置方块,支持在对应维度的常加载区块内设置方块\r\n - 若设置前后为同一个方块(方块名和附加值都相同),则接口返回False\r\n - 若设置前后方块实体类型相同时(方块名相同),箱子、熔炉等容器内的物品将被清空(尽管前后附加值也相同时接口会返回False),而告示牌、物品展示框、自定义方块实体的内容会被保留(如果希望清空,可以先设置为空气再设置相应方块)。\r\n - 随着版本更新,aux值对应的方块state会发生改变,对于有多种状态的方块,aux计算方式比较复杂,推荐先通过GetBlockAuxValueFromStates获取传统aux值再进行设置。\r\n - 若调用SetBlockNew接口后立即调用其它会影响客户端表现的服务端接口,并且这个表现和此方块有关系(比如使用SetBlockNew放置一个箱子,并立即调用PlayerUseItemToPos接口打开这个箱子),可能会出现异常表现,如有类似需求,建议在下一帧对方块进行操作", + "return": [], + "description": "设置某一位置的方块", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\n\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockState(levelId)\r\n# GetBlockAuxValueFromStates 只需要调用一次,得到的auxValue可以缓存以来以供后续使用\r\nauxValue = comp.GetBlockAuxValueFromStates(\"minecraft:wool\", { 'color': 'orange' })\r\n\r\nblockDict = {\r\n 'name': 'minecraft:wool',\r\n 'aux': auxValue\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.SetBlockNew((0, 5, 0), blockDict, 0, 0, True)\r\n# updateNeighbors置为False,则不会触发相邻方块的更新。例如将耕地替换成泥土,其上方的小麦不会掉落。\r\ncomp.SetBlockNew((0, 6, 0), blockDict, 0, 0, True, False)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "blockDict", - "type": "dict", + "type": "dict", + "name": "blockDict", "description": "方块信息字典" - }, + }, { - "name": "oldBlockHandling", - "type": "int", + "type": "int", + "name": "oldBlockHandling", "description": "0:替换,1:销毁,2:保留,默认为0" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度,必需参数" - }, + }, { - "name": "isLegacy", - "type": "bool", + "type": "bool", + "name": "isLegacy", "description": "是否设置为传统的aux,建议设置为True,即aux对应的state不随着版本迭代而变化。默认为False" - }, + }, { - "name": "updateNeighbors", - "type": "bool", + "type": "bool", + "name": "updateNeighbors", "description": "是否给相邻的方块触发[方块更新](https://minecraft.fandom.com/zh/wiki/%E6%96%B9%E5%9D%97%E6%9B%B4%E6%96%B0?variant=zh)以及BlockNeighborChangedServerEvent事件。默认为True触发。若选择不触发可节省约30%的性能消耗。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\n\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockState(levelId)\r\n# GetBlockAuxValueFromStates 只需要调用一次,得到的auxValue可以缓存以来以供后续使用\r\nauxValue = comp.GetBlockAuxValueFromStates(\"minecraft:wool\", { 'color': 'orange' })\r\n\r\nblockDict = {\r\n 'name': 'minecraft:wool',\r\n 'aux': auxValue\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.SetBlockNew((0, 5, 0), blockDict, 0, 0, True)\r\n# updateNeighbors置为False,则不会触发相邻方块的更新。例如将耕地替换成泥土,其上方的小麦不会掉落。\r\ncomp.SetBlockNew((0, 6, 0), blockDict, 0, 0, True, False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBlockNew" + }, { - "type": "api", - "name": "SetJigsawBlock", - "method": "", - "description": "在某一位置放置拼图方块", - "remark": "- 已经加载的地形才能设置方块,支持在对应维度的常加载区块内设置方块", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "remark": "- 已经加载的地形才能设置方块,支持在对应维度的常加载区块内设置方块", + "return": [], + "description": "在某一位置放置拼图方块", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\n\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockState(serverApi.GetLevelId())\r\n# GetBlockAuxValueFromStates 只需要调用一次,得到的auxValue可以缓存以来以供后续使用\r\nauxValue = comp.GetBlockAuxValueFromStates(\"minecraft:jigsaw\", { \"facing_direction\":1 })\r\n\r\nprint auxValue\r\nblockDict = {\r\n 'name': 'minecraft:jigsaw',\r\n 'aux': auxValue,\r\n 'jigsaw_name':\"minecraft:empty\",\r\n 'jigsaw_target_name' : \"minecraft:empty\",\r\n 'jigsaw_target_pool' : \"minecraft:empty\",\r\n 'jigsaw_final_block' : 'minecraft:empty',\r\n 'jigsaw_join_type' : 0 #\"jigsaw_join_type\"的值只能为0或1(0表示设置拼图方块的接点类型为\"可滚动\";1表示设置拼图方块的接点类型为\"一致\")\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(serverApi.GetLevelId())\r\nprint comp.SetJigsawBlock((0, 100, 0), blockDict, 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "blockDict", - "type": "dict", + "type": "dict", + "name": "blockDict", "description": "拼图方块的方块信息字典" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度,必需参数" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\n\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockState(serverApi.GetLevelId())\r\n# GetBlockAuxValueFromStates 只需要调用一次,得到的auxValue可以缓存以来以供后续使用\r\nauxValue = comp.GetBlockAuxValueFromStates(\"minecraft:jigsaw\", { \"facing_direction\":1 })\r\n\r\nprint auxValue\r\nblockDict = {\r\n 'name': 'minecraft:jigsaw',\r\n 'aux': auxValue,\r\n 'jigsaw_name':\"minecraft:empty\",\r\n 'jigsaw_target_name' : \"minecraft:empty\",\r\n 'jigsaw_target_pool' : \"minecraft:empty\",\r\n 'jigsaw_final_block' : 'minecraft:empty',\r\n 'jigsaw_join_type' : 0 #\"jigsaw_join_type\"的值只能为0或1(0表示设置拼图方块的接点类型为\"可滚动\";1表示设置拼图方块的接点类型为\"一致\")\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(serverApi.GetLevelId())\r\nprint comp.SetJigsawBlock((0, 100, 0), blockDict, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetJigsawBlock" + }, { - "type": "api", - "name": "SetLiquidBlock", - "method": "", - "description": "设置某一位置的方块的extraBlock,可在此设置方块含水等", - "remark": "- 已经加载的地形才能设置方块,支持在对应维度的常加载区块内设置方块\r\n - dimensionId需要是playerId对应玩家所在的维度;如果dimensionId是-1则默认使用playerId对应玩家所在的维度", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "remark": "- 已经加载的地形才能设置方块,支持在对应维度的常加载区块内设置方块\r\n - dimensionId需要是playerId对应玩家所在的维度;如果dimensionId是-1则默认使用playerId对应玩家所在的维度", + "return": [], + "description": "设置某一位置的方块的extraBlock,可在此设置方块含水等", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\nblockDict = {\r\n 'name': 'minecraft:water',\r\n 'aux': 5\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\ncomp.SetLiquidBlock((0, 5, 0), blockDict, 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "blockDict", - "type": "dict", + "type": "dict", + "name": "blockDict", "description": "流体方块的方块信息字典" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度,必需参数" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nblockDict = {\r\n 'name': 'minecraft:water',\r\n 'aux': 5\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\ncomp.SetLiquidBlock((0, 5, 0), blockDict, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetLiquidBlock" + }, { - "type": "api", - "name": "SetSnowBlock", - "method": "", - "description": "设置某一位置的方块含雪", - "remark": "- 已经加载的地形才能设置方块,支持在对应维度的常加载区块内设置方块\r\n - dimensionId需要是playerId对应玩家所在的维度;如果dimensionId是-1则默认使用playerId对应玩家所在的维度", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "remark": "- 已经加载的地形才能设置方块,支持在对应维度的常加载区块内设置方块\r\n - dimensionId需要是playerId对应玩家所在的维度;如果dimensionId是-1则默认使用playerId对应玩家所在的维度", + "return": [], + "description": "设置某一位置的方块含雪", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块管理.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\ncomp.SetSnowBlock((0, 5, 0), 0, 1)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度,必需参数" - }, + }, { - "name": "height", - "type": "int", + "type": "int", + "name": "height", "description": "雪块的高度,默认是1" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\ncomp.SetSnowBlock((0, 5, 0), 0, 1)" - }, + ], + "type": "api", + "side": "server", + "name": "SetSnowBlock" + }, { - "type": "api", - "name": "CreateMicroBlockResStr", - "method": "", - "description": "生成微缩方块资源Json字符串", - "remark": "- 联机大厅不支持", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块组合.md", + "remark": "- 联机大厅不支持", + "return": [], + "description": "生成微缩方块资源Json字符串", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块组合.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\nresult = comp.CreateMicroBlockResStr(\"x\", (12, 60, 12), (26, 76, 26), colorMap={'minecraft:grass': [12, 22, 123, 255]}, isMerge=True, icon=\"micro_block_datiangou\")\r\nwith open(\"micro_block_x.json\", \"w+\") as f:\r\n f.write(result)\r\n#该例子中,方块将以 (12 60 12) 为起点,以 (26 76 26) 为终点进行微缩,最终微缩方块里所有草方块的颜色为 rgba(12,22,123,255),实际显示颜色会依据环境光照微调,物品栏里的图标为 terrain_texture.json 里 micro_block_datiangou 对应的图片。", "params": [ { - "name": "identifier", - "type": "str", + "type": "str", + "name": "identifier", "description": "微缩方块唯一标识" - }, + }, { - "name": "start", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "start", "description": "微缩起始坐标" - }, + }, { - "name": "end", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "end", "description": "微缩结束坐标" - }, + }, { - "name": "colorMap", - "type": "dict", + "type": "dict", + "name": "colorMap", "description": "默认为None,微缩方块颜色对应表" - }, + }, { - "name": "isMerge", - "type": "bool", + "type": "bool", + "name": "isMerge", "description": "默认为False,是否合并同类型方块" - }, + }, { - "name": "icon", - "type": "str", + "type": "str", + "name": "icon", "description": "默认为空字符串,微缩方块图标,需要定义在 terrain_texture.json 中" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\nresult = comp.CreateMicroBlockResStr(\"x\", (12, 60, 12), (26, 76, 26), colorMap={'minecraft:grass': [12, 22, 123, 255]}, isMerge=True, icon=\"micro_block_datiangou\")\r\nwith open(\"micro_block_x.json\", \"w+\") as f:\r\n f.write(result)\r\n#该例子中,方块将以 (12 60 12) 为起点,以 (26 76 26) 为终点进行微缩,最终微缩方块里所有草方块的颜色为 rgba(12,22,123,255),实际显示颜色会依据环境光照微调,物品栏里的图标为 terrain_texture.json 里 micro_block_datiangou 对应的图片。" - }, + ], + "type": "api", + "side": "server", + "name": "CreateMicroBlockResStr" + }, { - "type": "api", - "name": "GetBlankBlockPalette", - "method": "", - "description": "获取一个空白的方块调色板。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块组合.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\nblankPalette = comp.GetBlankBlockPalette()" - }, + "remark": "", + "return": [], + "description": "获取一个空白的方块调色板。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块组合.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\nblankPalette = comp.GetBlankBlockPalette()", + "params": [], + "type": "api", + "side": "client", + "name": "GetBlankBlockPalette" + }, { - "type": "api", - "name": "GetBlockPaletteBetweenPos", - "method": "", - "description": "根据输入的两个位置创建并获取一个方块调色板,该接口会搜索这两个位置之间的所有方块创建方块调色板,方块调色板用于描述和记录世界中的多个方块的组合。这个方块调色板包含了这两个位置之间的所有方块及其相对位置。", - "remark": "- 对于床方块,方块调色板获取床方块时,只会添加床头的方块,床尾方块会进行忽略。对于门方块,则只会添加门的下半部分的方块,门的上半部分会进行忽略。\r\n - 需要等区域内的方块完全加载才能正确获取调色板", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块组合.md", + "remark": "- 对于床方块,方块调色板获取床方块时,只会添加床头的方块,床尾方块会进行忽略。对于门方块,则只会添加门的下半部分的方块,门的上半部分会进行忽略。\r\n - 需要等区域内的方块完全加载才能正确获取调色板", + "return": [], + "description": "根据输入的两个位置创建并获取一个方块调色板,该接口会搜索这两个位置之间的所有方块创建方块调色板,方块调色板用于描述和记录世界中的多个方块的组合。这个方块调色板包含了这两个位置之间的所有方块及其相对位置。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块组合.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))", "params": [ { - "name": "startPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "startPos", "description": "起始位置" - }, + }, { - "name": "endPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "endPos", "description": "终点位置" - }, + }, { - "name": "eliminateAir", - "type": "bool", + "type": "bool", + "name": "eliminateAir", "description": "生成的方块调色板中是否剔除起始位置和终点位置之间多余的空气方块,默认True。值为True时,方块调色板中不记录这两个位置范围内多余的空气方块;值为False时,方块调色板中将记录这两个位置范围内多余的空气方块。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))" - }, + ], + "type": "api", + "side": "client", + "name": "GetBlockPaletteBetweenPos" + }, { - "type": "api", - "name": "GetBlockPaletteFromPosList", - "method": "", - "description": "根据输入的方块位置列表创建并获取一个方块调色板,方块调色板用于描述和记录世界中的多个方块的组合。创建的方块调色板包含了这个位置列表中的所有方块及其相对位置。", - "remark": "- 对于床方块,方块调色板获取床方块时,只会添加床头的方块,床尾方块会进行忽略。对于门方块,则只会添加门的下半部分的方块,门的上半部分会进行忽略。\r\n - 需要等列表内的方块完全加载才能正确获取调色板", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块组合.md", + "remark": "- 对于床方块,方块调色板获取床方块时,只会添加床头的方块,床尾方块会进行忽略。对于门方块,则只会添加门的下半部分的方块,门的上半部分会进行忽略。\r\n - 需要等列表内的方块完全加载才能正确获取调色板", + "return": [], + "description": "根据输入的方块位置列表创建并获取一个方块调色板,方块调色板用于描述和记录世界中的多个方块的组合。创建的方块调色板包含了这个位置列表中的所有方块及其相对位置。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块组合.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteFromPosList([\r\n(200,64,200),\r\n(201,64,200)\r\n(202,64,200)\r\n])", "params": [ { - "name": "posList", - "type": "list(tuple(int,int,int))", + "type": "list(tuple(int,int,int))", + "name": "posList", "description": "方块位置列表" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteFromPosList([\r\n(200,64,200),\r\n(201,64,200)\r\n(202,64,200)\r\n])" - }, + ], + "type": "api", + "side": "client", + "name": "GetBlockPaletteFromPosList" + }, { - "type": "api", - "name": "RegisterBlockPatterns", - "method": "", - "description": "注册特殊方块组合", - "remark": "- 注意:该pattern不限定方向,只要能在任一平面上组合成功就能合成对应的实体。\r\n - 如示例代码所示,不需要放方块的位置需要显式定义为空气方块\r\n - 当引擎中已注册过相同的pattern和defines时,该接口不会更新result_actor_name,并返回False\r\n - namespace:name:aux_value,当aux_value不填或者填*时为通配,如果有具体aux_value时只匹配特定方块\r\n 如'minecraft:wood'、'minecraft:wood:*'均通配木头,而'minecraft:wood:0'只匹配橡木。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块组合.md", + "remark": "- 注意:该pattern不限定方向,只要能在任一平面上组合成功就能合成对应的实体。\r\n - 如示例代码所示,不需要放方块的位置需要显式定义为空气方块\r\n - 当引擎中已注册过相同的pattern和defines时,该接口不会更新result_actor_name,并返回False\r\n - namespace:name:aux_value,当aux_value不填或者填*时为通配,如果有具体aux_value时只匹配特定方块\r\n 如'minecraft:wood'、'minecraft:wood:*'均通配木头,而'minecraft:wood:0'只匹配橡木。", + "return": [], + "description": "注册特殊方块组合", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块组合.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npattern = [\r\n 'A#A',\r\n 'XXX',\r\n 'AXA'\r\n ]\r\ndefines ={\r\n '#': 'minecraft:gold_block',\r\n 'X': 'minecraft:iron_block',\r\n 'A': 'minecraft:air',\r\n}\r\ncomp.RegisterBlockPatterns(pattern,defines,'minecraft:chicken')\r\n#该例子左中右下放铁块,上面放金块,会生成一只鸡", "params": [ { - "name": "pattern", - "type": "list(str)", + "type": "list(str)", + "name": "pattern", "description": "方块组合位置" - }, + }, { - "name": "defines", - "type": "dict", + "type": "dict", + "name": "defines", "description": "方块组合类型" - }, + }, { - "name": "result_actor_name", - "type": "str", + "type": "str", + "name": "result_actor_name", "description": "合成结果" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npattern = [\r\n 'A#A',\r\n 'XXX',\r\n 'AXA'\r\n ]\r\ndefines ={\r\n '#': 'minecraft:gold_block',\r\n 'X': 'minecraft:iron_block',\r\n 'A': 'minecraft:air',\r\n}\r\ncomp.RegisterBlockPatterns(pattern,defines,'minecraft:chicken')\r\n#该例子左中右下放铁块,上面放金块,会生成一只鸡" - }, + ], + "type": "api", + "side": "server", + "name": "RegisterBlockPatterns" + }, { - "type": "api", - "name": "SetBlockByBlockPalette", - "method": "", - "description": "根据输入的方块调色板内容,将调色板内记录的所有方块设置为实际的方块。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块组合.md", + "remark": "", + "return": [], + "description": "根据输入的方块调色板内容,将调色板内记录的所有方块设置为实际的方块。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/方块组合.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(entityId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\n# 将方块以(205,64,200)为原点设置palette中的方块,旋转90度,冲突模式为0,即替代地图中的方块\r\ncomp.SetBlockByBlockPalette(palette, 0, (205,64,200),90,0)", "params": [ { - "name": "blockPalette", - "type": "BlockPaletteComponent", + "type": "BlockPaletteComponent", + "name": "blockPalette", "description": "方块调色板,由GetBlockPaletteBetweenPos以及GetBlockPaletteFromPosList接口获取" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度。如果输入的数值小于0,则使用entityId获取设置方块的区块。" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "设置方块的原点位置,将以这个位置作为原点设置方块" - }, + }, { - "name": "rotation", - "type": "int", + "type": "int", + "name": "rotation", "description": "方块组合体的旋转,旋转方向为绕设置方块的原点位置所在的y轴进行旋转,旋转角度仅支持-270,-180,-90,0,90,180,270。如果传入的不是这些值,将取其中最接近输入值的数值。" - }, + }, { - "name": "conflictMode", - "type": "int", + "type": "int", + "name": "conflictMode", "description": "冲突模式枚举,可选参数,默认为0。在生成过程中,遇到生成的位置有其他方块的情况时,那么将会根据冲突模式来进行处理。可以输入的值为:0,1,2, 分别代表: 0: 替换地图中的方块,1: 跳过这个方块,2: 放弃之后的生成过程。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(entityId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\n# 将方块以(205,64,200)为原点设置palette中的方块,旋转90度,冲突模式为0,即替代地图中的方块\r\ncomp.SetBlockByBlockPalette(palette, 0, (205,64,200),90,0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBlockByBlockPalette" + }, { - "type": "api", - "name": "GetLocalDoDayNightCycle", - "method": "", - "description": "获取维度是否打开昼夜更替", - "remark": "- 维度使用局部时间规则时,返回维度自身的昼夜更替规则;没有使用时返回全局的昼夜更替规则\r\n - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "remark": "- 维度使用局部时间规则时,返回维度自身的昼夜更替规则;没有使用时返回全局的昼夜更替规则\r\n - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)", + "return": [], + "description": "获取维度是否打开昼夜更替", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.GetLocalDoDayNightCycle(3)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.GetLocalDoDayNightCycle(3)" - }, + ], + "type": "api", + "side": "server", + "name": "GetLocalDoDayNightCycle" + }, { - "type": "api", - "name": "GetLocalTime", - "method": "", - "description": "获取当前维度的时间", - "remark": "- 维度使用局部时间规则时,返回局部时间;没有使用时返回全局时间\r\n - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateDimension(levelId)\r\n# 从游戏开始经过的总帧数\r\npassedTime = comp.GetLocalTime()\r\n# 当前游戏天内的帧数\r\ntimeOfDay = passedTime % 24000\r\n# 从游戏开始经过的游戏天数\r\nday = passedTime / 24000" - }, + "remark": "- 维度使用局部时间规则时,返回局部时间;没有使用时返回全局时间\r\n - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)", + "return": [], + "description": "获取当前维度的时间", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateDimension(levelId)\r\n# 从游戏开始经过的总帧数\r\npassedTime = comp.GetLocalTime()\r\n# 当前游戏天内的帧数\r\ntimeOfDay = passedTime % 24000\r\n# 从游戏开始经过的游戏天数\r\nday = passedTime / 24000", + "params": [], + "type": "api", + "side": "client", + "name": "GetLocalTime" + }, { - "type": "api", - "name": "GetTime", - "method": "", - "description": "获取当前世界时间", - "remark": "- 注意关闭昼夜更替后当前世界的时间会暂停", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTime(levelId)\r\n# 从游戏开始经过的总帧数\r\npassedTime = comp.GetTime()\r\n# 当前游戏天内的帧数\r\ntimeOfDay = passedTime % 24000\r\n# 从游戏开始经过的游戏天数\r\nday = passedTime / 24000" - }, + "remark": "- 注意关闭昼夜更替后当前世界的时间会暂停", + "return": [], + "description": "获取当前世界时间", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTime(levelId)\r\n# 从游戏开始经过的总帧数\r\npassedTime = comp.GetTime()\r\n# 当前游戏天内的帧数\r\ntimeOfDay = passedTime % 24000\r\n# 从游戏开始经过的游戏天数\r\nday = passedTime / 24000", + "params": [], + "type": "api", + "side": "client", + "name": "GetTime" + }, { - "type": "api", - "name": "GetUseLocalTime", - "method": "", - "description": "获取某个维度是否设置了使用局部时间规则", - "remark": "- 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "remark": "- 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)", + "return": [], + "description": "获取某个维度是否设置了使用局部时间规则", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.GetUseLocalTime(3)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.GetUseLocalTime(3)" - }, + ], + "type": "api", + "side": "server", + "name": "GetUseLocalTime" + }, { - "type": "api", - "name": "SetLocalDoDayNightCycle", - "method": "", - "description": "设置使用局部时间规则的维度是否打开昼夜更替", - "remark": "- 只有使用局部时间规则维度才能设置\r\n - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)\r\n - 在pc开发包下,可以在聊天栏键入`dmtime cycle on`或`dmtime cycle off`来测试开启与关闭当前维度的昼夜更替", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "remark": "- 只有使用局部时间规则维度才能设置\r\n - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)\r\n - 在pc开发包下,可以在聊天栏键入`dmtime cycle on`或`dmtime cycle off`来测试开启与关闭当前维度的昼夜更替", + "return": [], + "description": "设置使用局部时间规则的维度是否打开昼夜更替", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.SetLocalDoDayNightCycle(3, False)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" - }, + }, { - "name": "value", - "type": "bool", + "type": "bool", + "name": "value", "description": "是否打开昼夜更替" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.SetLocalDoDayNightCycle(3, False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetLocalDoDayNightCycle" + }, { - "type": "api", - "name": "SetLocalTime", - "method": "", - "description": "设置使用局部时间规则维度的时间", - "remark": "- 游戏有天数的概念,使用时需要进行考虑。您也可以直接使用[SetLocalTimeOfDay](#setlocaltimeofday)设置一天内所在的时间而不用计算天数。\r\n - 只有使用局部时间规则维度才能设置\r\n - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "remark": "- 游戏有天数的概念,使用时需要进行考虑。您也可以直接使用[SetLocalTimeOfDay](#setlocaltimeofday)设置一天内所在的时间而不用计算天数。\r\n - 只有使用局部时间规则维度才能设置\r\n - 关于“局部时间规则”,见[SetUseLocalTime](#setuselocaltime)", + "return": [], + "description": "设置使用局部时间规则维度的时间", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\n# 获取当前的时间\r\npassedTime = comp.GetLocalTime(3)\r\n# 获取当前的天数\r\nday = passedTime / 24000\r\n# 设置为当天的正午\r\ncomp.SetLocalTime(3, day * 24000 + 6000)\r\n# 设置为次日的日出\r\ncomp.SetLocalTime(3, (day + 1) * 24000 + 0)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" - }, + }, { - "name": "time", - "type": "int", + "type": "int", + "name": "time", "description": "时间,单位为帧数。表示该存档从新建起经过的时间,而非当前游戏天内的时间。mc中一个游戏天相当于现实的20分钟,即24000帧" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\n# 获取当前的时间\r\npassedTime = comp.GetLocalTime(3)\r\n# 获取当前的天数\r\nday = passedTime / 24000\r\n# 设置为当天的正午\r\ncomp.SetLocalTime(3, day * 24000 + 6000)\r\n# 设置为次日的日出\r\ncomp.SetLocalTime(3, (day + 1) * 24000 + 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetLocalTime" + }, { - "type": "api", - "name": "SetLocalTimeOfDay", - "method": "", - "description": "设置使用局部时间规则维度在一天内所在的时间", - "remark": "- 具体的逻辑与time指令相同,若timeOfDay比当前时间晚,则设置到当天的timeOfDay;若timeOfDay比当前时间早,则设置到次日的timeOfDay\r\n - 在pc开发包下,可以在聊天栏键入`dmtime time `来测试设置当前维度的局部时间", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "remark": "- 具体的逻辑与time指令相同,若timeOfDay比当前时间晚,则设置到当天的timeOfDay;若timeOfDay比当前时间早,则设置到次日的timeOfDay\r\n - 在pc开发包下,可以在聊天栏键入`dmtime time `来测试设置当前维度的局部时间", + "return": [], + "description": "设置使用局部时间规则维度在一天内所在的时间", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\n# 设置为正午\r\ncomp.SetLocalTimeOfDay(3, 6000)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" - }, + }, { - "name": "timeOfDay", - "type": "int", + "type": "int", + "name": "timeOfDay", "description": "时间,单位为帧数,表示游戏天内的时间,范围为0到24000。mc中一个游戏天相当于现实的20分钟,即24000帧" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\n# 设置为正午\r\ncomp.SetLocalTimeOfDay(3, 6000)" - }, + ], + "type": "api", + "side": "server", + "name": "SetLocalTimeOfDay" + }, { - "type": "api", - "name": "SetTime", - "method": "", - "description": "设置当前世界时间", - "remark": "- 游戏有天数的概念,使用时需要进行考虑。您也可以直接使用[SetTimeOfDay](#settimeofday)设置一天内所在的时间而不用计算天数。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "remark": "- 游戏有天数的概念,使用时需要进行考虑。您也可以直接使用[SetTimeOfDay](#settimeofday)设置一天内所在的时间而不用计算天数。", + "return": [], + "description": "设置当前世界时间", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateTime(levelId)\r\n# 获取当前的时间\r\npassedTime = comp.GetTime()\r\n# 获取当前的天数\r\nday = passedTime / 24000\r\n# 设置为当天的正午\r\ncomp.SetTime(day * 24000 + 6000)\r\n# 设置为次日的日出\r\ncomp.SetTime((day + 1) * 24000 + 0)", "params": [ { - "name": "time", - "type": "int", + "type": "int", + "name": "time", "description": "时间,单位为帧数,表示该存档从新建起经过的时间,而非当前游戏天内的时间。mc中一个游戏天相当于现实的20分钟,即24000帧" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateTime(levelId)\r\n# 获取当前的时间\r\npassedTime = comp.GetTime()\r\n# 获取当前的天数\r\nday = passedTime / 24000\r\n# 设置为当天的正午\r\ncomp.SetTime(day * 24000 + 6000)\r\n# 设置为次日的日出\r\ncomp.SetTime((day + 1) * 24000 + 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetTime" + }, { - "type": "api", - "name": "SetTimeOfDay", - "method": "", - "description": "设置当前世界在一天内所在的时间", - "remark": "- 具体的逻辑与time指令相同,若timeOfDay比当前时间晚,则设置到当天的timeOfDay;若timeOfDay比当前时间早,则设置到次日的timeOfDay", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "remark": "- 具体的逻辑与time指令相同,若timeOfDay比当前时间晚,则设置到当天的timeOfDay;若timeOfDay比当前时间早,则设置到次日的timeOfDay", + "return": [], + "description": "设置当前世界在一天内所在的时间", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateTime(levelId)\r\n# 设置为正午\r\ncomp.SetTimeOfDay(6000)", "params": [ { - "name": "timeOfDay", - "type": "int", + "type": "int", + "name": "timeOfDay", "description": "时间,单位为帧数,表示游戏天内的时间,范围为0到24000。mc中一个游戏天相当于现实的20分钟,即24000帧" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateTime(levelId)\r\n# 设置为正午\r\ncomp.SetTimeOfDay(6000)" - }, + ], + "type": "api", + "side": "server", + "name": "SetTimeOfDay" + }, { - "type": "api", - "name": "SetUseLocalTime", - "method": "", - "description": "让某个维度拥有自己的局部时间规则,开启后该维度可以拥有与其他维度不同的时间与是否昼夜更替的规则", - "remark": "- 我们对主世界以及自定义维度新增了“局部时间规则”的概念。在此之前,所有的维度会共享一个“全局时间”,即设置时间或dodaynightcycle规则时,会对所有维度生效。\r\n 现在,我们可以将某个维度使用局部时间规则,并且单独设置他的时间(见[SetLocalTime](#setlocaltime))与dodaynightcycle规则(见[SetLocalDoDayNightCycle](#setlocaldodaynightcycle))。\r\n 在下文中,我们会将使用局部时间规则的维度称为“局部维度”,而使用全局时间的维度称为“全局维度”。默认情况下,维度都是全局维度。\r\n 原版的time指令,gamerule dodaylightcycle指令与开启昼夜更替的设置,daylock指令与终为白日的设置,均不会对局部维度生效。\r\n 当世界上同时存在局部维度与全局维度时,只有以下两种情况可以睡觉来跳过黑夜:\r\n 1. 所有玩家都在全局维度睡觉。这时会将全局时间跳到第二天早上。\r\n 2. 所有玩家都在同一个局部维度睡觉。这时会将该局部维度的时间跳到第二天早上。\r\n - 启用局部时间规则时,默认继承全局的时间与昼夜更替规则\r\n - 时间规则对原版的下界与末地无效,这两个维度永远为黑夜且没有昼夜更替\r\n - 建议统一在游戏启动时调用\r\n - 在pc开发包下,可以在聊天栏键入`dmtime on`或`dmtime off`来测试开启与关闭当前维度的局部时间", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "remark": "- 我们对主世界以及自定义维度新增了“局部时间规则”的概念。在此之前,所有的维度会共享一个“全局时间”,即设置时间或dodaynightcycle规则时,会对所有维度生效。\r\n 现在,我们可以将某个维度使用局部时间规则,并且单独设置他的时间(见[SetLocalTime](#setlocaltime))与dodaynightcycle规则(见[SetLocalDoDayNightCycle](#setlocaldodaynightcycle))。\r\n 在下文中,我们会将使用局部时间规则的维度称为“局部维度”,而使用全局时间的维度称为“全局维度”。默认情况下,维度都是全局维度。\r\n 原版的time指令,gamerule dodaylightcycle指令与开启昼夜更替的设置,daylock指令与终为白日的设置,均不会对局部维度生效。\r\n 当世界上同时存在局部维度与全局维度时,只有以下两种情况可以睡觉来跳过黑夜:\r\n 1. 所有玩家都在全局维度睡觉。这时会将全局时间跳到第二天早上。\r\n 2. 所有玩家都在同一个局部维度睡觉。这时会将该局部维度的时间跳到第二天早上。\r\n - 启用局部时间规则时,默认继承全局的时间与昼夜更替规则\r\n - 时间规则对原版的下界与末地无效,这两个维度永远为黑夜且没有昼夜更替\r\n - 建议统一在游戏启动时调用\r\n - 在pc开发包下,可以在聊天栏键入`dmtime on`或`dmtime off`来测试开启与关闭当前维度的局部时间", + "return": [], + "description": "让某个维度拥有自己的局部时间规则,开启后该维度可以拥有与其他维度不同的时间与是否昼夜更替的规则", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/时间.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.SetUseLocalTime(3, True)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" - }, + }, { - "name": "value", - "type": "bool", + "type": "bool", + "name": "value", "description": "是否开启局部时间规则" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(levelId)\r\ncomp.SetUseLocalTime(3, True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetUseLocalTime" + }, { - "type": "api", - "name": "NotifyOneMessage", - "method": "", - "description": "给指定玩家发送聊天框消息", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "remark": "", + "return": [], + "description": "给指定玩家发送聊天框消息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateMsg(playerId)\r\ncomp.NotifyOneMessage(playerId, \"test\", \"§c\")", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "指定玩家id" - }, + }, { - "name": "msg", - "type": "str", + "type": "str", + "name": "msg", "description": "消息内容" - }, + }, { - "name": "color", - "type": "str", + "type": "str", + "name": "color", "description": "颜色样式代码字符串,可参考wiki[样式代码](https://minecraft-zh.gamepedia.com/%E6%A0%B7%E5%BC%8F%E4%BB%A3%E7%A0%81),默认为白色" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateMsg(playerId)\r\ncomp.NotifyOneMessage(playerId, \"test\", \"§c\")" - }, + ], + "type": "api", + "side": "server", + "name": "NotifyOneMessage" + }, { - "type": "api", - "name": "SendMsg", - "method": "", - "description": "模拟玩家给所有人发送聊天栏消息", - "remark": "- name参数需要设置玩家的名字(可通过name组件的GetName接口获取),如果设置的玩家名字不存在,则随机找一个玩家发出该消息", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "remark": "- name参数需要设置玩家的名字(可通过name组件的GetName接口获取),如果设置的玩家名字不存在,则随机找一个玩家发出该消息", + "return": [], + "description": "模拟玩家给所有人发送聊天栏消息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateMsg(levelId)\r\ncomp.SendMsg(\"playerName\",\"test\")", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "发送者玩家的名字" - }, + }, { - "name": "msg", - "type": "str", + "type": "str", + "name": "msg", "description": "消息内容" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateMsg(levelId)\r\ncomp.SendMsg(\"playerName\",\"test\")" - }, + ], + "type": "api", + "side": "server", + "name": "SendMsg" + }, { - "type": "api", - "name": "SendMsgToPlayer", - "method": "", - "description": "模拟玩家给另一个玩家发送聊天栏消息", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "remark": "", + "return": [], + "description": "模拟玩家给另一个玩家发送聊天栏消息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "example": "comp = serverApi.GetEngineCompFactory().CreateMsg(levelId)\r\ncomp.SendMsgToPlayer(fromPlayerId, toPlayerId, \"test\")", "params": [ { - "name": "fromEntityId", - "type": "str", + "type": "str", + "name": "fromEntityId", "description": "发送者玩家ID" - }, + }, { - "name": "toEntityId", - "type": "str", + "type": "str", + "name": "toEntityId", "description": "接受者玩家ID" - }, + }, { - "name": "msg", - "type": "str", + "type": "str", + "name": "msg", "description": "消息内容" } - ], - "return": [], - "example": "comp = serverApi.GetEngineCompFactory().CreateMsg(levelId)\r\ncomp.SendMsgToPlayer(fromPlayerId, toPlayerId, \"test\")" - }, + ], + "type": "api", + "side": "server", + "name": "SendMsgToPlayer" + }, { - "type": "api", - "name": "SetLeftCornerNotify", - "method": "", - "description": "客户端设置左上角通知信息", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "remark": "", + "return": [], + "description": "客户端设置左上角通知信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextNotifyClient(levelId)\r\ncomp.SetLeftCornerNotify(\"做好准备\")", "params": [ { - "name": "textMsg", - "type": "str", + "type": "str", + "name": "textMsg", "description": "通知内容" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextNotifyClient(levelId)\r\ncomp.SetLeftCornerNotify(\"做好准备\")" - }, + ], + "type": "api", + "side": "client", + "name": "SetLeftCornerNotify" + }, { - "type": "api", - "name": "SetNotifyMsg", - "method": "", - "description": "设置消息通知", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "remark": "", + "return": [], + "description": "设置消息通知", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.SetNotifyMsg(\"消息通知\", serverApi.GenerateColor('BLUE'))", "params": [ { - "name": "msg", - "type": "str", + "type": "str", + "name": "msg", "description": "消息内容" - }, + }, { - "name": "color", - "type": "str", + "type": "str", + "name": "color", "description": "使用GenerateColor接口获取的颜色,默认为白色" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.SetNotifyMsg(\"消息通知\", serverApi.GenerateColor('BLUE'))" - }, + ], + "type": "api", + "side": "server", + "name": "SetNotifyMsg" + }, { - "type": "api", - "name": "SetOnePopupNotice", - "method": "", - "description": "在具体某个玩家的物品栏上方弹出popup类型通知,位置位于tip类型消息下方,此功能更建议客户端使用game组件的对应接口SetPopupNotice", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "remark": "", + "return": [], + "description": "在具体某个玩家的物品栏上方弹出popup类型通知,位置位于tip类型消息下方,此功能更建议客户端使用game组件的对应接口SetPopupNotice", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(playerId)\r\n# playerId 变量改为具体的玩家Id\r\ncomp.SetOnePopupNotice(playerId, serverApi.GenerateColor(\"RED\") + \"消息通知\", \"消息子标题\")", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "具体玩家Id" - }, + }, { - "name": "message", - "type": "str", + "type": "str", + "name": "message", "description": "消息内容,可以在消息前增加extraServerApi.GenerateColor(\"RED\")字符来设置颜色,具体参考样例" - }, + }, { - "name": "subtitle", - "type": "str", + "type": "str", + "name": "subtitle", "description": "消息子标题内容,效果同message,也可设置颜色,位置位于message上方" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(playerId)\r\n# playerId 变量改为具体的玩家Id\r\ncomp.SetOnePopupNotice(playerId, serverApi.GenerateColor(\"RED\") + \"消息通知\", \"消息子标题\")" - }, + ], + "type": "api", + "side": "server", + "name": "SetOnePopupNotice" + }, { - "type": "api", - "name": "SetOneTipMessage", - "method": "", - "description": "在具体某个玩家的物品栏上方弹出tip类型通知,位置位于popup类型通知上方,此功能更建议在客户端使用game组件的对应接口SetTipMessage", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "remark": "", + "return": [], + "description": "在具体某个玩家的物品栏上方弹出tip类型通知,位置位于popup类型通知上方,此功能更建议在客户端使用game组件的对应接口SetTipMessage", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(playerId)\r\n# playerId 变量改为具体的玩家Id\r\ncomp.SetOneTipMessage(playerId, serverApi.GenerateColor(\"RED\") + \"tip提示\")", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "具体玩家Id" - }, + }, { - "name": "message", - "type": "str", + "type": "str", + "name": "message", "description": "消息内容,可以在消息前增加extraServerApi.GenerateColor(\"RED\")字符来设置颜色,具体参考样例" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(playerId)\r\n# playerId 变量改为具体的玩家Id\r\ncomp.SetOneTipMessage(playerId, serverApi.GenerateColor(\"RED\") + \"tip提示\")" - }, + ], + "type": "api", + "side": "server", + "name": "SetOneTipMessage" + }, { - "type": "api", - "name": "SetPopupNotice", - "method": "", - "description": "在本地玩家的物品栏上方弹出popup类型通知,位置位于tip类型消息下方", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "remark": "", + "return": [], + "description": "在本地玩家的物品栏上方弹出popup类型通知,位置位于tip类型消息下方", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.SetPopupNotice(clientApi.GenerateColor(\"RED\") + \"消息通知\", \"消息子标题\")", "params": [ { - "name": "message", - "type": "str", + "type": "str", + "name": "message", "description": "消息内容,可以在消息前增加extraClientApi.GenerateColor(\"RED\")字符来设置颜色,具体参考样例" - }, + }, { - "name": "subtitle", - "type": "str", + "type": "str", + "name": "subtitle", "description": "消息子标题内容,效果同message,也可设置颜色,位置位于message上方" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.SetPopupNotice(clientApi.GenerateColor(\"RED\") + \"消息通知\", \"消息子标题\")" - }, + ], + "type": "api", + "side": "client", + "name": "SetPopupNotice" + }, { - "type": "api", - "name": "SetPopupState", - "method": "", - "description": "设置Popup消息栏状态", - "remark": "- 注意:该设置不会存档,如果是配在json里面的custom_tips组件中的内容,使用2模式是无法显示的,只有使用物品dict相关的接口设置的customTips才能生效、", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "remark": "- 注意:该设置不会存档,如果是配在json里面的custom_tips组件中的内容,使用2模式是无法显示的,只有使用物品dict相关的接口设置的customTips才能生效、", + "return": [], + "description": "设置Popup消息栏状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.SetPopupState(2)", "params": [ { - "name": "state", - "type": "int", + "type": "int", + "name": "state", "description": "状态值,0为原版开启状态,1为关闭,2为使用接口设置的物品dict中customTips的第一行作为弹出信息" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.SetPopupState(2)" - }, + ], + "type": "api", + "side": "client", + "name": "SetPopupState" + }, { - "type": "api", - "name": "SetTipMessage", - "method": "", - "description": "在本地玩家的物品栏上方弹出tip类型通知,位置位于popup类型通知上方", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "remark": "", + "return": [], + "description": "在本地玩家的物品栏上方弹出tip类型通知,位置位于popup类型通知上方", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/消息.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.SetTipMessage(clientApi.GenerateColor(\"RED\") + \"tip提示\")", "params": [ { - "name": "message", - "type": "str", + "type": "str", + "name": "message", "description": "消息内容,可以在消息前增加extraClientApi.GenerateColor(\"RED\")字符来设置颜色,具体参考样例" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.SetTipMessage(clientApi.GenerateColor(\"RED\") + \"tip提示\")" - }, + ], + "type": "api", + "side": "client", + "name": "SetTipMessage" + }, { - "type": "api", - "name": "AddTerrainDestroyParticleEffect", - "method": "", - "description": "在指定位置播放指定方块被开始破坏时的粒子效果(如果有)。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "", + "return": [], + "description": "在指定位置播放指定方块被开始破坏时的粒子效果(如果有)。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 在(30,66,30)这个位置播放石头被开始破坏时的粒子效果\r\ncomp.AddTerrainDestroyParticleEffect(\"minecraft:stone\", 0, (30, 66, 30))", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "需要播放的粒子效果所属的方块名称(identifier),例如minecraft:stone。" - }, + }, { - "name": "aux", - "type": "int", + "type": "int", + "name": "aux", "description": "方块附加值" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "需要播放特效的位置。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 在(30,66,30)这个位置播放石头被开始破坏时的粒子效果\r\ncomp.AddTerrainDestroyParticleEffect(\"minecraft:stone\", 0, (30, 66, 30))" - }, + ], + "type": "api", + "side": "client", + "name": "AddTerrainDestroyParticleEffect" + }, { - "type": "api", - "name": "AddUseItemParticleEffect", - "method": "", - "description": "在指定位置播放指定物品被开始使用时的粒子效果(如果有)。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "", + "return": [], + "description": "在指定位置播放指定物品被开始使用时的粒子效果(如果有)。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(levelId)\r\ncomp.AddUseItemParticleEffect(\"minecraft:apple\", 0, (30, 66, 30))", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "需要播放的粒子效果所属的物品名称(identifier),例如minecraft:apple。" - }, + }, { - "name": "aux", - "type": "int", + "type": "int", + "name": "aux", "description": "物品附加值" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "需要播放特效的位置。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(levelId)\r\ncomp.AddUseItemParticleEffect(\"minecraft:apple\", 0, (30, 66, 30))" - }, + ], + "type": "api", + "side": "client", + "name": "AddUseItemParticleEffect" + }, { - "type": "api", - "name": "GetAmbientBrightness", - "method": "", - "description": "获取环境光亮度,影响天空亮度,不影响实体与方块光照", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nambineBrightness = comp.GetAmbientBrightness()" - }, + "remark": "", + "return": [], + "description": "获取环境光亮度,影响天空亮度,不影响实体与方块光照", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nambineBrightness = comp.GetAmbientBrightness()", + "params": [], + "type": "api", + "side": "client", + "name": "GetAmbientBrightness" + }, { - "type": "api", - "name": "GetFogColor", - "method": "", - "description": "获取当前雾效颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\n# 获取雾效颜色\r\nfogColor = comp.GetFogColor()" - }, + "remark": "", + "return": [], + "description": "获取当前雾效颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\n# 获取雾效颜色\r\nfogColor = comp.GetFogColor()", + "params": [], + "type": "api", + "side": "client", + "name": "GetFogColor" + }, { - "type": "api", - "name": "GetFogLength", - "method": "", - "description": "获取雾效范围", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\nstart,end = comp.GetFogLength()" - }, + "remark": "", + "return": [], + "description": "获取雾效范围", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\nstart,end = comp.GetFogLength()", + "params": [], + "type": "api", + "side": "client", + "name": "GetFogLength" + }, { - "type": "api", - "name": "GetMoonRot", - "method": "", - "description": "获取月亮角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nrot = comp.GetMoonRot()" - }, + "remark": "", + "return": [], + "description": "获取月亮角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nrot = comp.GetMoonRot()", + "params": [], + "type": "api", + "side": "client", + "name": "GetMoonRot" + }, { - "type": "api", - "name": "GetSkyColor", - "method": "", - "description": "获取天空颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncolor = comp.GetSkyColor()" - }, + "remark": "", + "return": [], + "description": "获取天空颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncolor = comp.GetSkyColor()", + "params": [], + "type": "api", + "side": "client", + "name": "GetSkyColor" + }, { - "type": "api", - "name": "GetSkyTextures", - "method": "", - "description": "获取当前维度天空盒贴图,天空盒共6张贴图", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "# 贴图列表按顺序分别对应世界坐标的 负Z轴方向, 正X轴方向,正Z轴方向,负X轴方向,正Y轴方向,负Y轴方向。 其中正Y轴即为上方(采用右手坐标系)。\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ntextureList = comp.GetSkyTextures()" - }, + "remark": "", + "return": [], + "description": "获取当前维度天空盒贴图,天空盒共6张贴图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "# 贴图列表按顺序分别对应世界坐标的 负Z轴方向, 正X轴方向,正Z轴方向,负X轴方向,正Y轴方向,负Y轴方向。 其中正Y轴即为上方(采用右手坐标系)。\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ntextureList = comp.GetSkyTextures()", + "params": [], + "type": "api", + "side": "client", + "name": "GetSkyTextures" + }, { - "type": "api", - "name": "GetStarBrightness", - "method": "", - "description": "获取星星亮度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nstarBrightness = comp.GetStarBrightness()" - }, + "remark": "", + "return": [], + "description": "获取星星亮度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nstarBrightness = comp.GetStarBrightness()", + "params": [], + "type": "api", + "side": "client", + "name": "GetStarBrightness" + }, { - "type": "api", - "name": "GetSunRot", - "method": "", - "description": "获取太阳角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nrot = comp.GetSunRot()" - }, + "remark": "", + "return": [], + "description": "获取太阳角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nrot = comp.GetSunRot()", + "params": [], + "type": "api", + "side": "client", + "name": "GetSunRot" + }, { - "type": "api", - "name": "GetUseAmbientBrightness", - "method": "", - "description": "判断是否在mod设置了环境光亮度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nuseAmbientBrightness = comp.GetUseAmbientBrightness()" - }, + "remark": "", + "return": [], + "description": "判断是否在mod设置了环境光亮度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nuseAmbientBrightness = comp.GetUseAmbientBrightness()", + "params": [], + "type": "api", + "side": "client", + "name": "GetUseAmbientBrightness" + }, { - "type": "api", - "name": "GetUseFogColor", - "method": "", - "description": "判断当前是否开启设置雾效颜色,该值默认为False,使用mod传入的颜色值后为True", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\n# 获取是否开启设置雾效颜色\r\nuseFogColor = comp.GetUseFogColor()" - }, + "remark": "", + "return": [], + "description": "判断当前是否开启设置雾效颜色,该值默认为False,使用mod传入的颜色值后为True", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\n# 获取是否开启设置雾效颜色\r\nuseFogColor = comp.GetUseFogColor()", + "params": [], + "type": "api", + "side": "client", + "name": "GetUseFogColor" + }, { - "type": "api", - "name": "GetUseFogLength", - "method": "", - "description": "判断当前是否开启设置雾效范围,该值默认为False,使用mod传入的范围值后为True", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\n# 获取是否开启设置雾效范围\r\nuseFogLength = comp.GetUseFogLength()" - }, + "remark": "", + "return": [], + "description": "判断当前是否开启设置雾效范围,该值默认为False,使用mod传入的范围值后为True", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\n# 获取是否开启设置雾效范围\r\nuseFogLength = comp.GetUseFogLength()", + "params": [], + "type": "api", + "side": "client", + "name": "GetUseFogLength" + }, { - "type": "api", - "name": "GetUseMoonRot", - "method": "", - "description": "判断是否在mod设置了月亮角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nuseMoonRot = comp.GetUseMoonRot()" - }, + "remark": "", + "return": [], + "description": "判断是否在mod设置了月亮角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nuseMoonRot = comp.GetUseMoonRot()", + "params": [], + "type": "api", + "side": "client", + "name": "GetUseMoonRot" + }, { - "type": "api", - "name": "GetUseSkyColor", - "method": "", - "description": "判断是否在mod设置了天空颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nuseSkyColor = comp.GetUseSkyColor()" - }, + "remark": "", + "return": [], + "description": "判断是否在mod设置了天空颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nuseSkyColor = comp.GetUseSkyColor()", + "params": [], + "type": "api", + "side": "client", + "name": "GetUseSkyColor" + }, { - "type": "api", - "name": "GetUseStarBrightness", - "method": "", - "description": "判断是否在mod设置了星星亮度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nuseStarBrightness = comp.GetUseStarBrightness()" - }, + "remark": "", + "return": [], + "description": "判断是否在mod设置了星星亮度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nuseStarBrightness = comp.GetUseStarBrightness()", + "params": [], + "type": "api", + "side": "client", + "name": "GetUseStarBrightness" + }, { - "type": "api", - "name": "GetUseSunRot", - "method": "", - "description": "判断是否在mod设置了太阳角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nuseSunRot = comp.GetUseSunRot()" - }, + "remark": "", + "return": [], + "description": "判断是否在mod设置了太阳角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\nuseSunRot = comp.GetUseSunRot()", + "params": [], + "type": "api", + "side": "client", + "name": "GetUseSunRot" + }, { - "type": "api", - "name": "HideNameTag", - "method": "", - "description": "隐藏场景内所有名字,包括玩家名字,生物的自定义名称,物品展示框与命令方块的悬浮文本等", - "remark": "- 该接口用于隐藏或显示所有实体名字,实体名字显示与否还会受到实体本身的名字显示与否影响,详见接口SetShowName", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "- 该接口用于隐藏或显示所有实体名字,实体名字显示与否还会受到实体本身的名字显示与否影响,详见接口SetShowName", + "return": [], + "description": "隐藏场景内所有名字,包括玩家名字,生物的自定义名称,物品展示框与命令方块的悬浮文本等", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.HideNameTag(True)", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.HideNameTag(True)" - }, + ], + "type": "api", + "side": "client", + "name": "HideNameTag" + }, { - "type": "api", - "name": "IsHideNameTag", - "method": "", - "description": "获取是否隐藏场景内所有名字", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.IsHideNameTag()" - }, + "remark": "", + "return": [], + "description": "获取是否隐藏场景内所有名字", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.IsHideNameTag()", + "params": [], + "type": "api", + "side": "client", + "name": "IsHideNameTag" + }, { - "type": "api", - "name": "RemoveTerrainDestroyParticleEffect", - "method": "", - "description": "停止指定位置播放的方块被开始破坏时的粒子效果。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "", + "return": [], + "description": "停止指定位置播放的方块被开始破坏时的粒子效果。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 在(30,66,30)这个位置播放石头被开始破坏时的粒子效果\r\ncomp.AddTerrainDestroyParticleEffect(\"minecraft:stone\", 0, (30, 66, 30))\r\n# 停止这个位置里石头被开始破坏时的粒子效果\r\ncomp.RemoveTerrainDestroyParticleEffect(\"minecraft:stone\", 0, (30, 66, 30))", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "需要停止的粒子效果所属的方块名称(identifier),例如minecraft:stone。" - }, + }, { - "name": "aux", - "type": "int", + "type": "int", + "name": "aux", "description": "方块附加值" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "需要停止的特效的位置。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 在(30,66,30)这个位置播放石头被开始破坏时的粒子效果\r\ncomp.AddTerrainDestroyParticleEffect(\"minecraft:stone\", 0, (30, 66, 30))\r\n# 停止这个位置里石头被开始破坏时的粒子效果\r\ncomp.RemoveTerrainDestroyParticleEffect(\"minecraft:stone\", 0, (30, 66, 30))" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveTerrainDestroyParticleEffect" + }, { - "type": "api", - "name": "RemoveUseItemParticleEffect", - "method": "", - "description": "停止指定位置播放的物品被开始使用时的粒子效果。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "", + "return": [], + "description": "停止指定位置播放的物品被开始使用时的粒子效果。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(levelId)\r\n# 在(30,66,30)这个位置播放苹果被开始吃时的粒子效果\r\ncomp.AddUseItemParticleEffect(\"minecraft:apple\", 0, (30, 66, 30))\r\n# 停止这个位置里苹果被开始吃时的粒子效果\r\ncomp.RemoveUseItemParticleEffect(\"minecraft:apple\", 0, (30, 66, 30))", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "需要停止的粒子效果所属的物品名称(identifier),例如minecraft:apple。" - }, + }, { - "name": "aux", - "type": "int", + "type": "int", + "name": "aux", "description": "物品附加值" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "需要停止的特效的位置。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(levelId)\r\n# 在(30,66,30)这个位置播放苹果被开始吃时的粒子效果\r\ncomp.AddUseItemParticleEffect(\"minecraft:apple\", 0, (30, 66, 30))\r\n# 停止这个位置里苹果被开始吃时的粒子效果\r\ncomp.RemoveUseItemParticleEffect(\"minecraft:apple\", 0, (30, 66, 30))" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveUseItemParticleEffect" + }, { - "type": "api", - "name": "ResetAmbientBrightness", - "method": "", - "description": "重置环境光亮度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.ResetAmbientBrightness()" - }, + "remark": "", + "return": [], + "description": "重置环境光亮度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.ResetAmbientBrightness()", + "params": [], + "type": "api", + "side": "client", + "name": "ResetAmbientBrightness" + }, { - "type": "api", - "name": "ResetFogColor", - "method": "", - "description": "重置雾效颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\ncomp.ResetFogColor()" - }, + "remark": "", + "return": [], + "description": "重置雾效颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\ncomp.ResetFogColor()", + "params": [], + "type": "api", + "side": "client", + "name": "ResetFogColor" + }, { - "type": "api", - "name": "ResetFogLength", - "method": "", - "description": "重置雾效范围", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\ncomp.ResetFogLength()" - }, + "remark": "", + "return": [], + "description": "重置雾效范围", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\ncomp.ResetFogLength()", + "params": [], + "type": "api", + "side": "client", + "name": "ResetFogLength" + }, { - "type": "api", - "name": "ResetMoonRot", - "method": "", - "description": "重置月亮角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.ResetMoonRot()" - }, + "remark": "", + "return": [], + "description": "重置月亮角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.ResetMoonRot()", + "params": [], + "type": "api", + "side": "client", + "name": "ResetMoonRot" + }, { - "type": "api", - "name": "ResetSkyColor", - "method": "", - "description": "重置天空颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.ResetSkyColor()" - }, + "remark": "", + "return": [], + "description": "重置天空颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.ResetSkyColor()", + "params": [], + "type": "api", + "side": "client", + "name": "ResetSkyColor" + }, { - "type": "api", - "name": "ResetSkyTextures", - "method": "", - "description": "重置当前维度天空盒贴图。如果有使用addon配置贴图则会使用配置的贴图,否则为游戏内默认无贴图的情况", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.ResetSkyTextures()" - }, + "remark": "", + "return": [], + "description": "重置当前维度天空盒贴图。如果有使用addon配置贴图则会使用配置的贴图,否则为游戏内默认无贴图的情况", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.ResetSkyTextures()", + "params": [], + "type": "api", + "side": "client", + "name": "ResetSkyTextures" + }, { - "type": "api", - "name": "ResetStarBrightness", - "method": "", - "description": "重置星星亮度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.ResetStarBrightness()" - }, + "remark": "", + "return": [], + "description": "重置星星亮度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.ResetStarBrightness()", + "params": [], + "type": "api", + "side": "client", + "name": "ResetStarBrightness" + }, { - "type": "api", - "name": "ResetSunRot", - "method": "", - "description": "重置太阳角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.ResetSunRot()" - }, + "remark": "", + "return": [], + "description": "重置太阳角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.ResetSunRot()", + "params": [], + "type": "api", + "side": "client", + "name": "ResetSunRot" + }, { - "type": "api", - "name": "SetAmbientBrightness", - "method": "", - "description": "设置环境光亮度,影响天空亮度,不影响实体与方块光照", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "", + "return": [], + "description": "设置环境光亮度,影响天空亮度,不影响实体与方块光照", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.SetAmbientBrightness(0.1)", "params": [ { - "name": "brightness", - "type": "float", + "type": "float", + "name": "brightness", "description": "范围0到1之间" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.SetAmbientBrightness(0.1)" - }, + ], + "type": "api", + "side": "client", + "name": "SetAmbientBrightness" + }, { - "type": "api", - "name": "SetFogColor", - "method": "", - "description": "设置雾效颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "", + "return": [], + "description": "设置雾效颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\n# 雾效设置为全白色\r\ncomp.SetFogColor((1.0,1.0,1.0,1.0))", "params": [ { - "name": "color", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "color", "description": "颜色RGBA,范围0到1之间,a值主要用于水下效果" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\n# 雾效设置为全白色\r\ncomp.SetFogColor((1.0,1.0,1.0,1.0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetFogColor" + }, { - "type": "api", - "name": "SetFogLength", - "method": "", - "description": "设置雾效范围", - "remark": "- start和end的单位长度为一个方块的距离\r\n - 最终渲染出的雾的效果会受能见度的影响,例如能见度设置为10,此时调用SetFogLength(0,160),然后将能见度设置为5,由于能见度降低,雾的end值也会拉近,此时雾的效果将会变得更厚。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "- start和end的单位长度为一个方块的距离\r\n - 最终渲染出的雾的效果会受能见度的影响,例如能见度设置为10,此时调用SetFogLength(0,160),然后将能见度设置为5,由于能见度降低,雾的end值也会拉近,此时雾的效果将会变得更厚。", + "return": [], + "description": "设置雾效范围", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\ncomp.SetFogLength(10, 50)", "params": [ { - "name": "start", - "type": "float", + "type": "float", + "name": "start", "description": "雾效起始距离" - }, + }, { - "name": "end", - "type": "float", + "type": "float", + "name": "end", "description": "雾效终点范围" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFog(levelId)\r\ncomp.SetFogLength(10, 50)" - }, + ], + "type": "api", + "side": "client", + "name": "SetFogLength" + }, { - "type": "api", - "name": "SetMoonRot", - "method": "", - "description": "设置月亮所在角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "", + "return": [], + "description": "设置月亮所在角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.SetMoonRot((10, 0, 10))", "params": [ { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "第一个float表示南北偏移,第二个float表示月亮的自旋角度,第三个float表示月升月落。单位为角度" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.SetMoonRot((10, 0, 10))" - }, + ], + "type": "api", + "side": "client", + "name": "SetMoonRot" + }, { - "type": "api", - "name": "SetSkyColor", - "method": "", - "description": "设置天空颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "", + "return": [], + "description": "设置天空颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.SetSkyColor((0.5, 0.5, 0.8, 1.0))", "params": [ { - "name": "color", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "color", "description": "颜色RGBA,0到1之间,目前a值暂时没用" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.SetSkyColor((0.5, 0.5, 0.8, 1.0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetSkyColor" + }, { - "type": "api", - "name": "SetSkyTextures", - "method": "", - "description": "设置当前维度天空盒贴图,天空盒需要6张贴图", - "remark": "- 游戏内切dimension的时候会重设天空盒贴图,因此开发者需要监听对应的切换维度完成事件(DimensionChangeFinishClientEvent)进行贴图的处理。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "- 游戏内切dimension的时候会重设天空盒贴图,因此开发者需要监听对应的切换维度完成事件(DimensionChangeFinishClientEvent)进行贴图的处理。", + "return": [], + "description": "设置当前维度天空盒贴图,天空盒需要6张贴图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "# 贴图列表按顺序分别对应世界坐标的 负Z轴方向, 正X轴方向,正Z轴方向,负X轴方向,正Y轴方向,负Y轴方向。 其中正Y轴即为上方(采用右手坐标系)。\r\ntextureList = ['', 'textures/environment/positiveX','textures/environment/positiveZ', '', 'textures/environment/positiveY', '']\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.SetSkyTextures(textureList)", "params": [ { - "name": "textureList", - "type": "list(str)", + "type": "list(str)", + "name": "textureList", "description": "需要为6张贴图的路径,路径为从textures目录开始的绝对路径,如果天空盒某个方向不需要设置,则传空字符串" } - ], - "return": [], - "example": "# 贴图列表按顺序分别对应世界坐标的 负Z轴方向, 正X轴方向,正Z轴方向,负X轴方向,正Y轴方向,负Y轴方向。 其中正Y轴即为上方(采用右手坐标系)。\r\ntextureList = ['', 'textures/environment/positiveX','textures/environment/positiveZ', '', 'textures/environment/positiveY', '']\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.SetSkyTextures(textureList)" - }, + ], + "type": "api", + "side": "client", + "name": "SetSkyTextures" + }, { - "type": "api", - "name": "SetStarBrightness", - "method": "", - "description": "设置星星亮度,白天也可以显示星星", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "", + "return": [], + "description": "设置星星亮度,白天也可以显示星星", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.SetStarBrightness(0.1)", "params": [ { - "name": "brightness", - "type": "float", + "type": "float", + "name": "brightness", "description": "范围0到1之间" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.SetStarBrightness(0.1)" - }, + ], + "type": "api", + "side": "client", + "name": "SetStarBrightness" + }, { - "type": "api", - "name": "SetSunRot", - "method": "", - "description": "设置太阳所在角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "remark": "", + "return": [], + "description": "设置太阳所在角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.SetSunRot((10, 0, 10))", "params": [ { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "第一个float表示南北偏移,第二个float表示太阳的自旋角度,第三个float表示日升日落。单位为角度" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateSkyRender(levelId)\r\ncomp.SetSunRot((10, 0, 10))" - }, + ], + "type": "api", + "side": "client", + "name": "SetSunRot" + }, { - "type": "api", - "name": "SkyTextures", - "method": "", - "description": "修改太阳、月亮、云层分布、天空盒的贴图。使用addon配置,非python接口。", - "remark": "- 游戏提供了重载贴图的方式来修改太阳、月亮、云层分布、天空盒的贴图。\r\n **末地和下界没有太阳月亮和云层,另外末地的天空是用一张贴图end_sky.png而不是天空盒贴图,end_sky.png要结合雾效颜色使用。下界暂不支持此功能**。\r\n 具体路径为:\r\n | 贴图 | 路径 |\r\n | ------------ | ------------------------------------------------------------ |\r\n | 太阳贴图 | modResource目录/textures/environment/{dimName}_sun.png |\r\n | 月亮贴图 | modResource目录/textures/environment/{dimName}_moon_phases.png |\r\n | 云层分布贴图 | modResource目录/textures/environment/{dimName}_clouds.png |\r\n | 天空盒贴图 | modResource目录/textures/environment/{dimName}_cubemap/cubemap_0.png |\r\n \r\n 其中:天空盒贴图需要放6张图,即最后需要包含```cubemap_0.png```到```cubemap_5.png```,而```{dimName}```表示dimension的名称,各个dimension名称如下:\r\n | dimension | 名称 |\r\n | --------------------------- | --------------- |\r\n | 末地 | theend |\r\n | 下界 | nether |\r\n | 上界 | overworld |\r\n | 其他复制出来的dimension镜像 | 从3到20的数字id |\r\n \r\n 示例:\r\n ```json\r\n modResource/textures/environment/4_sun.png\r\n modResource/textures/environment/overworld_moon_phases.png\r\n modResource/textures/environment/3_clouds.png\r\n modResource/textures/environment/overworld_cubemap/cubemap_0.png # -z方向\r\n modResource/textures/environment/overworld_cubemap/cubemap_1.png # x方向\r\n modResource/textures/environment/overworld_cubemap/cubemap_2.png # z方向\r\n modResource/textures/environment/overworld_cubemap/cubemap_3.png # -x方向\r\n modResource/textures/environment/overworld_cubemap/cubemap_4.png # y方向\r\n modResource/textures/environment/overworld_cubemap/cubemap_5.png # -y方向\r\n modResource/textures/environment/end_sky.png #末地天空渲染贴图\r\n ```", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 游戏提供了重载贴图的方式来修改太阳、月亮、云层分布、天空盒的贴图。\r\n **末地和下界没有太阳月亮和云层,另外末地的天空是用一张贴图end_sky.png而不是天空盒贴图,end_sky.png要结合雾效颜色使用。下界暂不支持此功能**。\r\n 具体路径为:\r\n | 贴图 | 路径 |\r\n | ------------ | ------------------------------------------------------------ |\r\n | 太阳贴图 | modResource目录/textures/environment/{dimName}_sun.png |\r\n | 月亮贴图 | modResource目录/textures/environment/{dimName}_moon_phases.png |\r\n | 云层分布贴图 | modResource目录/textures/environment/{dimName}_clouds.png |\r\n | 天空盒贴图 | modResource目录/textures/environment/{dimName}_cubemap/cubemap_0.png |\r\n \r\n 其中:天空盒贴图需要放6张图,即最后需要包含```cubemap_0.png```到```cubemap_5.png```,而```{dimName}```表示dimension的名称,各个dimension名称如下:\r\n | dimension | 名称 |\r\n | --------------------------- | --------------- |\r\n | 末地 | theend |\r\n | 下界 | nether |\r\n | 上界 | overworld |\r\n | 其他复制出来的dimension镜像 | 从3到20的数字id |\r\n \r\n 示例:\r\n ```json\r\n modResource/textures/environment/4_sun.png\r\n modResource/textures/environment/overworld_moon_phases.png\r\n modResource/textures/environment/3_clouds.png\r\n modResource/textures/environment/overworld_cubemap/cubemap_0.png # -z方向\r\n modResource/textures/environment/overworld_cubemap/cubemap_1.png # x方向\r\n modResource/textures/environment/overworld_cubemap/cubemap_2.png # z方向\r\n modResource/textures/environment/overworld_cubemap/cubemap_3.png # -x方向\r\n modResource/textures/environment/overworld_cubemap/cubemap_4.png # y方向\r\n modResource/textures/environment/overworld_cubemap/cubemap_5.png # -y方向\r\n modResource/textures/environment/end_sky.png #末地天空渲染贴图\r\n ```", + "return": [], + "description": "修改太阳、月亮、云层分布、天空盒的贴图。使用addon配置,非python接口。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/渲染.md", + "example": "", + "params": [], + "type": "api", + "side": "client", + "name": "SkyTextures" + }, { - "type": "api", - "name": "AddBannedItem", - "method": "", - "description": "增加禁用物品", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "增加禁用物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItemBanned(levelId)\r\ncomp.AddBannedItem(\"minecraft:egg\")", "params": [ { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "物品标识符,格式[namespace:name:auxvalue],auxvalue默认为0,auxvalue为*时候匹配任意auxvalue值。例如:minecraft:egg(也可以通过填写配置文件config/banned_items.json进行启动禁用)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItemBanned(levelId)\r\ncomp.AddBannedItem(\"minecraft:egg\")" - }, + ], + "type": "api", + "side": "server", + "name": "AddBannedItem" + }, { - "type": "api", - "name": "AddBlockProtectField", - "method": "", - "description": "设置一个方块无法被玩家/实体破坏的区域", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "设置一个方块无法被玩家/实体破坏的区域", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nfield = gameComp.AddBlockProtectField(0, (-20, 0, -20), (20, 255, 20))\r\nif field > 0:\r\n print \"AddBlockProtectField success field={}\".format(field)\r\nelse:\r\n print \"AddBlockProtectField fail\"", "params": [ { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "不可破坏区域所在维度" - }, + }, { - "name": "startPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "startPos", "description": "初始位置,不可破坏区域AABB包围盒的最小点" - }, + }, { - "name": "endPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "endPos", "description": "结束位置,不可破坏区域AABB包围盒的最大点" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nfield = gameComp.AddBlockProtectField(0, (-20, 0, -20), (20, 255, 20))\r\nif field > 0:\r\n print \"AddBlockProtectField success field={}\".format(field)\r\nelse:\r\n print \"AddBlockProtectField fail\"" - }, + ], + "type": "api", + "side": "server", + "name": "AddBlockProtectField" + }, { - "type": "api", - "name": "CleanBlockProtectField", - "method": "", - "description": "取消全部已设置的方块无法被玩家/实体破坏的区域", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuc = gameComp.CleanBlockProtectField()\r\nprint \"CleanBlockProtectField suc={}\".format(suc)" - }, + "remark": "", + "return": [], + "description": "取消全部已设置的方块无法被玩家/实体破坏的区域", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuc = gameComp.CleanBlockProtectField()\r\nprint \"CleanBlockProtectField suc={}\".format(suc)", + "params": [], + "type": "api", + "side": "server", + "name": "CleanBlockProtectField" + }, { - "type": "api", - "name": "ClearBannedItems", - "method": "", - "description": "清空禁用物品", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItemBanned(levelId)\r\ncomp.ClearBannedItems()" - }, + "remark": "", + "return": [], + "description": "清空禁用物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItemBanned(levelId)\r\ncomp.ClearBannedItems()", + "params": [], + "type": "api", + "side": "server", + "name": "ClearBannedItems" + }, { - "type": "api", - "name": "DisableVineBlockSpread", - "method": "", - "description": "设置是否禁用藤曼蔓延生长", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "设置是否禁用藤曼蔓延生长", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.DisableVineBlockSpread(disable)", "params": [ { - "name": "disable", - "type": "bool", + "type": "bool", + "name": "disable", "description": "True:禁用 False:非禁用" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.DisableVineBlockSpread(disable)" - }, + ], + "type": "api", + "side": "server", + "name": "DisableVineBlockSpread" + }, { - "type": "api", - "name": "ForbidLiquidFlow", - "method": "", - "description": "禁止/允许地图中的流体流动", - "remark": "- 禁止流动后的流体,在重新允许流动之后,不会立刻向四周流动,直到受到方块更新(如相邻的方块发生改变)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "- 禁止流动后的流体,在重新允许流动之后,不会立刻向四周流动,直到受到方块更新(如相邻的方块发生改变)", + "return": [], + "description": "禁止/允许地图中的流体流动", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuccess = gameComp.ForbidLiquidFlow(True)", "params": [ { - "name": "forbid", - "type": "bool", + "type": "bool", + "name": "forbid", "description": "True为禁止流体流动 False为允许流体流动" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuccess = gameComp.ForbidLiquidFlow(True)" - }, + ], + "type": "api", + "side": "server", + "name": "ForbidLiquidFlow" + }, { - "type": "api", - "name": "GetBannedItemList", - "method": "", - "description": "获取禁用物品列表", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItemBanned(levelId)\r\ncomp.GetBannedItemList()" - }, + "remark": "", + "return": [], + "description": "获取禁用物品列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItemBanned(levelId)\r\ncomp.GetBannedItemList()", + "params": [], + "type": "api", + "side": "server", + "name": "GetBannedItemList" + }, { - "type": "api", - "name": "GetGameDiffculty", - "method": "", - "description": "获取游戏难度", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(entityId)\r\ndifficulty = comp.GetGameDiffculty()" - }, + "remark": "", + "return": [], + "description": "获取游戏难度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(entityId)\r\ndifficulty = comp.GetGameDiffculty()", + "params": [], + "type": "api", + "side": "server", + "name": "GetGameDiffculty" + }, { - "type": "api", - "name": "GetGameRulesInfoServer", - "method": "", - "description": "获取游戏规则", - "remark": "- 游戏规则字典 gameRule见代码注释", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ntype = comp.GetGameRulesInfoServer()\r\n#返回值如下\r\n{\r\n'option_info': {\r\n 'pvp': bool, #玩家间伤害\r\n 'show_coordinates': bool, #显示坐标\r\n 'fire_spreads': bool, #火焰蔓延\r\n 'tnt_explodes': bool, #TNT爆炸\r\n 'mob_loot': bool, #生物战利品\r\n 'natural_regeneration': bool, #自然生命恢复\r\n 'respawn_block_explosion': bool, #重生方块爆炸\r\n 'respawn_radius': int, #重生半径,请注意范围,目前支持[0,128]\r\n 'tile_drops': bool, #方块掉落\r\n 'immediate_respawn':bool #立即重生\r\n 'experimental_biomes': bool, # 自定义生物群系\r\n 'experimental_modding': bool, # 即将推出的创作者功能\r\n 'experimental_holiday': bool, # 假日创造者功能\r\n },\r\n'cheat_info': {\r\n 'enable': bool, #激活作弊\r\n 'always_day': bool, #终为白日\r\n 'mob_griefing': bool, #生物破坏\r\n 'keep_inventory': bool, #保留物品栏\r\n 'weather_cycle': bool, #天气更替\r\n 'mob_spawn': bool, #生物生成\r\n 'entities_drop_loot': bool, #实体掉落战利品\r\n 'daylight_cycle': bool, #开启昼夜更替\r\n 'command_blocks_enabled': bool, #启用命令方块\r\n 'random_tick_speed': int,#随机刻速度\r\n }\r\n}" - }, + "remark": "- 游戏规则字典 gameRule见代码注释", + "return": [], + "description": "获取游戏规则", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ntype = comp.GetGameRulesInfoServer()\r\n#返回值如下\r\n{\r\n'option_info': {\r\n 'pvp': bool, #玩家间伤害\r\n 'show_coordinates': bool, #显示坐标\r\n 'fire_spreads': bool, #火焰蔓延\r\n 'tnt_explodes': bool, #TNT爆炸\r\n 'mob_loot': bool, #生物战利品\r\n 'natural_regeneration': bool, #自然生命恢复\r\n 'respawn_block_explosion': bool, #重生方块爆炸\r\n 'respawn_radius': int, #重生半径,请注意范围,目前支持[0,128]\r\n 'tile_drops': bool, #方块掉落\r\n 'immediate_respawn':bool #立即重生\r\n 'experimental_biomes': bool, # 自定义生物群系\r\n 'experimental_modding': bool, # 即将推出的创作者功能\r\n 'experimental_holiday': bool, # 假日创造者功能\r\n },\r\n'cheat_info': {\r\n 'enable': bool, #激活作弊\r\n 'always_day': bool, #终为白日\r\n 'mob_griefing': bool, #生物破坏\r\n 'keep_inventory': bool, #保留物品栏\r\n 'weather_cycle': bool, #天气更替\r\n 'mob_spawn': bool, #生物生成\r\n 'entities_drop_loot': bool, #实体掉落战利品\r\n 'daylight_cycle': bool, #开启昼夜更替\r\n 'command_blocks_enabled': bool, #启用命令方块\r\n 'random_tick_speed': int,#随机刻速度\r\n }\r\n}", + "params": [], + "type": "api", + "side": "server", + "name": "GetGameRulesInfoServer" + }, { - "type": "api", - "name": "GetGameType", - "method": "", - "description": "获取默认游戏模式", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(entityId)\r\ntype = comp.GetGameType()" - }, + "remark": "", + "return": [], + "description": "获取默认游戏模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(entityId)\r\ntype = comp.GetGameType()", + "params": [], + "type": "api", + "side": "server", + "name": "GetGameType" + }, { - "type": "api", - "name": "GetLevelGravity", - "method": "", - "description": "获取重力因子", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.GetLevelGravity()" - }, + "remark": "", + "return": [], + "description": "获取重力因子", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.GetLevelGravity()", + "params": [], + "type": "api", + "side": "server", + "name": "GetLevelGravity" + }, { - "type": "api", - "name": "GetPistonMaxInteractionCount", - "method": "", - "description": "获取活塞/粘性活塞最多推动的方块数量,默认为12个方块,可能被其他开发者修改。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetPistonMaxInteractionCount())" - }, + "remark": "", + "return": [], + "description": "获取活塞/粘性活塞最多推动的方块数量,默认为12个方块,可能被其他开发者修改。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetPistonMaxInteractionCount())", + "params": [], + "type": "api", + "side": "client", + "name": "GetPistonMaxInteractionCount" + }, { - "type": "api", - "name": "GetSeed", - "method": "", - "description": "获取存档种子", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nseed = comp.GetSeed()" - }, + "remark": "", + "return": [], + "description": "获取存档种子", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nseed = comp.GetSeed()", + "params": [], + "type": "api", + "side": "server", + "name": "GetSeed" + }, { - "type": "api", - "name": "IsDisableCommandMinecart", - "method": "", - "description": "获取当前是否允许运行命令方块矿车内置逻辑指令,当前仅Apollo网络服可用", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nisDisable = comp.IsDisableCommandMinecart()" - }, + "remark": "", + "return": [], + "description": "获取当前是否允许运行命令方块矿车内置逻辑指令,当前仅Apollo网络服可用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nisDisable = comp.IsDisableCommandMinecart()", + "params": [], + "type": "api", + "side": "server", + "name": "IsDisableCommandMinecart" + }, { - "type": "api", - "name": "IsLockDifficulty", - "method": "", - "description": "获取当前世界的游戏难度是否被锁定", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nisLock = comp.IsLockDifficulty()" - }, + "remark": "", + "return": [], + "description": "获取当前世界的游戏难度是否被锁定", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nisLock = comp.IsLockDifficulty()", + "params": [], + "type": "api", + "side": "server", + "name": "IsLockDifficulty" + }, { - "type": "api", - "name": "IsLockGameRulesInfo", - "method": "", - "description": "获取当前世界的游戏规则是否被锁定", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nisLock = comp.IsLockGameRulesInfo()" - }, + "remark": "", + "return": [], + "description": "获取当前世界的游戏规则是否被锁定", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nisLock = comp.IsLockGameRulesInfo()", + "params": [], + "type": "api", + "side": "server", + "name": "IsLockGameRulesInfo" + }, { - "type": "api", - "name": "IsLockGameType", - "method": "", - "description": "获取当前世界的游戏类型是否被锁定,包括默认游戏类型和个人游戏类型", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nisLock = comp.IsLockGameType()" - }, + "remark": "", + "return": [], + "description": "获取当前世界的游戏类型是否被锁定,包括默认游戏类型和个人游戏类型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nisLock = comp.IsLockGameType()", + "params": [], + "type": "api", + "side": "server", + "name": "IsLockGameType" + }, { - "type": "api", - "name": "LockDifficulty", - "method": "", - "description": "锁定当前世界游戏难度(仅本次游戏有效),锁定后任何玩家在游戏内都无法通过指令或暂停菜单修改游戏难度", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "锁定当前世界游戏难度(仅本次游戏有效),锁定后任何玩家在游戏内都无法通过指令或暂停菜单修改游戏难度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.LockDifficulty(True)", "params": [ { - "name": "lock", - "type": "bool", + "type": "bool", + "name": "lock", "description": "True:锁定 False:解锁" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.LockDifficulty(True)" - }, + ], + "type": "api", + "side": "server", + "name": "LockDifficulty" + }, { - "type": "api", - "name": "LockGameRulesInfo", - "method": "", - "description": "锁定当前世界游戏规则(仅本次游戏有效),玩家无法通过指令、游戏菜单或api修改游戏规则(包括[SetGameRulesInfoServer](#setgamerulesinfoserver)示例中列举的规则)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "锁定当前世界游戏规则(仅本次游戏有效),玩家无法通过指令、游戏菜单或api修改游戏规则(包括[SetGameRulesInfoServer](#setgamerulesinfoserver)示例中列举的规则)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.LockGameRulesInfo(True)", "params": [ { - "name": "lock", - "type": "bool", + "type": "bool", + "name": "lock", "description": "True:锁定 False:解锁" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.LockGameRulesInfo(True)" - }, + ], + "type": "api", + "side": "server", + "name": "LockGameRulesInfo" + }, { - "type": "api", - "name": "LockGameType", - "method": "", - "description": "锁定当前世界游戏类型(仅本次游戏有效),玩家无法通过指令、游戏菜单或相关api如[SetPlayerGameType](../玩家/游戏模式.md#setplayergametype)和[SetDefaultGameType](#setdefaultgametype)修改游戏类型,包括默认游戏类型和个人游戏类型", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "锁定当前世界游戏类型(仅本次游戏有效),玩家无法通过指令、游戏菜单或相关api如[SetPlayerGameType](../玩家/游戏模式.md#setplayergametype)和[SetDefaultGameType](#setdefaultgametype)修改游戏类型,包括默认游戏类型和个人游戏类型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.LockGameType(True)", "params": [ { - "name": "lock", - "type": "bool", + "type": "bool", + "name": "lock", "description": "True:锁定 False:解锁" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.LockGameType(True)" - }, + ], + "type": "api", + "side": "server", + "name": "LockGameType" + }, { - "type": "api", - "name": "OpenCityProtect", - "method": "", - "description": "开启城市保护,包括禁止破坏方块,禁止对方块使用物品,禁止怪物攻击玩家,禁止玩家之间互相攻击,禁止日夜切换,禁止天气变化,禁止怪物群落刷新", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuccess = gameComp.OpenCityProtect()" - }, + "remark": "", + "return": [], + "description": "开启城市保护,包括禁止破坏方块,禁止对方块使用物品,禁止怪物攻击玩家,禁止玩家之间互相攻击,禁止日夜切换,禁止天气变化,禁止怪物群落刷新", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuccess = gameComp.OpenCityProtect()", + "params": [], + "type": "api", + "side": "server", + "name": "OpenCityProtect" + }, { - "type": "api", - "name": "RemoveBannedItem", - "method": "", - "description": "移除禁用物品", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "移除禁用物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItemBanned(levelId)\r\ncomp.RemoveBannedItem(\"minecraft:stained_glass:2\")", "params": [ { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "物品标识符,格式[namespace:name:auxvalue],auxvalue默认为0,auxvalue为*时候匹配任意auxvalue值。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItemBanned(levelId)\r\ncomp.RemoveBannedItem(\"minecraft:stained_glass:2\")" - }, + ], + "type": "api", + "side": "server", + "name": "RemoveBannedItem" + }, { - "type": "api", - "name": "RemoveBlockProtectField", - "method": "", - "description": "取消一个方块无法被玩家/实体破坏的区域", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "取消一个方块无法被玩家/实体破坏的区域", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nfield = gameComp.AddBlockProtectField(0, (-20, 0, -20), (20, 255, 20))\r\nif field > 0:\r\n print \"AddBlockProtectField success field={}\".format(field)\r\n suc = gameComp.RemoveBlockProtectField(field)\r\n print \"RemoveBlockProtectField field={} suc={}\".format(field, suc)", "params": [ { - "name": "field", - "type": "int", + "type": "int", + "name": "field", "description": "不可破坏区域的唯一ID,AddBlockProtectField的返回值" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nfield = gameComp.AddBlockProtectField(0, (-20, 0, -20), (20, 255, 20))\r\nif field > 0:\r\n print \"AddBlockProtectField success field={}\".format(field)\r\n suc = gameComp.RemoveBlockProtectField(field)\r\n print \"RemoveBlockProtectField field={} suc={}\".format(field, suc)" - }, + ], + "type": "api", + "side": "server", + "name": "RemoveBlockProtectField" + }, { - "type": "api", - "name": "SetCanActorSetOnFireByLightning", - "method": "", - "description": "禁止/允许闪电点燃实体", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "禁止/允许闪电点燃实体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuccess = gameComp.SetCanActorSetOnFireByLightning(False)", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "True为允许闪电点燃实体 False为禁止闪电点燃实体" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuccess = gameComp.SetCanActorSetOnFireByLightning(False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetCanActorSetOnFireByLightning" + }, { - "type": "api", - "name": "SetCanBlockSetOnFireByLightning", - "method": "", - "description": "禁止/允许闪电点燃方块", - "remark": "- 只有当游戏难度为普通及以上,并且开启了火焰蔓延,闪电才会点燃方块", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "- 只有当游戏难度为普通及以上,并且开启了火焰蔓延,闪电才会点燃方块", + "return": [], + "description": "禁止/允许闪电点燃方块", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuccess = gameComp.SetCanBlockSetOnFireByLightning(False)", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "True为允许闪电点燃方块 False为禁止闪电点燃方块" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ngameComp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuccess = gameComp.SetCanBlockSetOnFireByLightning(False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetCanBlockSetOnFireByLightning" + }, { - "type": "api", - "name": "SetDefaultGameType", - "method": "", - "description": "设置默认游戏模式", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "设置默认游戏模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(playerId)\r\n# 设置创造模式为默认游戏模式\r\ncomp.SetDefaultGameType(1)", "params": [ { - "name": "gameType", - "type": "int", + "type": "int", + "name": "gameType", "description": "GetMinecraftEnum().GameType.*:Survival,Creative,Adventure分别为0~2" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(playerId)\r\n# 设置创造模式为默认游戏模式\r\ncomp.SetDefaultGameType(1)" - }, + ], + "type": "api", + "side": "server", + "name": "SetDefaultGameType" + }, { - "type": "api", - "name": "SetDisableCommandMinecart", - "method": "", - "description": "设置停止/开启运行命令方块矿车内置逻辑指令,当前仅Apollo网络服可用", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "设置停止/开启运行命令方块矿车内置逻辑指令,当前仅Apollo网络服可用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuc = comp.SetDisableCommandMinecart(True)", "params": [ { - "name": "isDisable", - "type": "bool", + "type": "bool", + "name": "isDisable", "description": "True:停止运行命令方块矿车内置逻辑指令;False:开启运行命令方块矿车内置逻辑指令" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nsuc = comp.SetDisableCommandMinecart(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetDisableCommandMinecart" + }, { - "type": "api", - "name": "SetDisableContainers", - "method": "", - "description": "禁止所有容器界面的打开,包括玩家背包,各种包含背包界面的容器方块如工作台与箱子,以及包含背包界面的实体交互如马背包与村民交易", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "禁止所有容器界面的打开,包括玩家背包,各种包含背包界面的容器方块如工作台与箱子,以及包含背包界面的实体交互如马背包与村民交易", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.SetDisableContainers(True)", "params": [ { - "name": "isDisable", - "type": "bool", + "type": "bool", + "name": "isDisable", "description": "是否禁止容器界面" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.SetDisableContainers(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetDisableContainers" + }, { - "type": "api", - "name": "SetDisableDropItem", - "method": "", - "description": "设置禁止丢弃物品", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "设置禁止丢弃物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "# 1、开启开关后,玩家死亡会所有物品消失;如需保证物品不掉落,可以配合/gamerule keepInventory true 使用\r\n# 2、创造模式下物品依然能丢弃。\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.SetDisableDropItem(True)", "params": [ { - "name": "isDisable", - "type": "bool", + "type": "bool", + "name": "isDisable", "description": "是否禁止丢弃物品" } - ], - "return": [], - "example": "# 1、开启开关后,玩家死亡会所有物品消失;如需保证物品不掉落,可以配合/gamerule keepInventory true 使用\r\n# 2、创造模式下物品依然能丢弃。\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.SetDisableDropItem(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetDisableDropItem" + }, { - "type": "api", - "name": "SetDisableGravityInLiquid", - "method": "", - "description": "是否屏蔽所有实体在液体(水、岩浆)中的重力", - "remark": "- 设置屏蔽实体在液体中的重力后,实体将不能上浮也不能下潜。**对玩家而言,当水/岩浆淹没腰部及以上时(约在水面/岩浆表面0.7格及以下),将无法上岸。**", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "- 设置屏蔽实体在液体中的重力后,实体将不能上浮也不能下潜。**对玩家而言,当水/岩浆淹没腰部及以上时(约在水面/岩浆表面0.7格及以下),将无法上岸。**", + "return": [], + "description": "是否屏蔽所有实体在液体(水、岩浆)中的重力", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.SetDisableGravityInLiquid(True)", "params": [ { - "name": "isDisable", - "type": "bool", + "type": "bool", + "name": "isDisable", "description": "True:屏蔽 False:取消屏蔽" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.SetDisableGravityInLiquid(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetDisableGravityInLiquid" + }, { - "type": "api", - "name": "SetDisableHunger", - "method": "", - "description": "设置是否屏蔽饥饿度", - "remark": "- 如需隐藏饥饿度请使用extraClientApi的HideHungerGui", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "- 如需隐藏饥饿度请使用extraClientApi的HideHungerGui", + "return": [], + "description": "设置是否屏蔽饥饿度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.SetDisableHunger(True)", "params": [ { - "name": "isDisable", - "type": "bool", + "type": "bool", + "name": "isDisable", "description": "是否屏蔽饥饿度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(entityId)\r\ncomp.SetDisableHunger(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetDisableHunger" + }, { - "type": "api", - "name": "SetGameDifficulty", - "method": "", - "description": "设置游戏难度", - "remark": "- 若已经锁定了游戏难度,除非调用LockDifficulty解锁游戏难度,否则将无法成功修改游戏难度", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "- 若已经锁定了游戏难度,除非调用LockDifficulty解锁游戏难度,否则将无法成功修改游戏难度", + "return": [], + "description": "设置游戏难度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nresult = comp.SetGameDifficulty(0)", "params": [ { - "name": "difficulty", - "type": "int", + "type": "int", + "name": "difficulty", "description": "GetMinecraftEnum().GameDiffculty.*:Peaceful,Easy,Normal,Hard分别为0~3" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nresult = comp.SetGameDifficulty(0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetGameDifficulty" + }, { - "type": "api", - "name": "SetGameRulesInfoServer", - "method": "", - "description": "设置游戏规则。所有参数均可选。", - "remark": "- 其中游戏规则字典中每一项都为可选参数,但是设置option_info或者cheat_info其中一项子项后,必须加上option_info或者cheat_info", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "- 其中游戏规则字典中每一项都为可选参数,但是设置option_info或者cheat_info其中一项子项后,必须加上option_info或者cheat_info", + "return": [], + "description": "设置游戏规则。所有参数均可选。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "###游戏规则字典说明\r\ngameRuleDict ={\r\n'option_info': {\r\n 'pvp': bool, #玩家间伤害\r\n 'show_coordinates': bool, #显示坐标\r\n 'fire_spreads': bool, #火焰蔓延\r\n 'tnt_explodes': bool, #TNT爆炸\r\n 'mob_loot': bool, #生物战利品\r\n 'natural_regeneration': bool, #自然生命恢复\r\n 'respawn_block_explosion': bool, #重生方块爆炸\r\n 'respawn_radius': int, #重生半径,请注意范围,目前支持[0,128]\r\n 'tile_drops': bool, #方块掉落\r\n 'immediate_respawn':bool #立即重生\r\n },\r\n'cheat_info': {\r\n 'enable': bool, #激活作弊\r\n 'always_day': bool, #终为白日\r\n 'mob_griefing': bool, #生物破坏\r\n 'keep_inventory': bool, #保留物品栏\r\n 'weather_cycle': bool, #天气更替\r\n 'mob_spawn': bool, #生物生成\r\n 'entities_drop_loot': bool, #实体掉落战利品\r\n 'daylight_cycle': bool, #开启昼夜更替\r\n 'command_blocks_enabled': bool, #启用命令方块\r\n 'random_tick_speed': int,#随机刻速度\r\n }\r\n}\r\n###\r\nruleDict ={\r\n 'cheat_info': {\r\n 'enable': True,\r\n 'always_day': True,\r\n\r\n }\r\n}\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.SetGameRulesInfoServer(ruleDict)", "params": [ { - "name": "gameRuleDict", - "type": "dict", + "type": "dict", + "name": "gameRuleDict", "description": "游戏规则字典" } - ], - "return": [], - "example": "###游戏规则字典说明\r\ngameRuleDict ={\r\n'option_info': {\r\n 'pvp': bool, #玩家间伤害\r\n 'show_coordinates': bool, #显示坐标\r\n 'fire_spreads': bool, #火焰蔓延\r\n 'tnt_explodes': bool, #TNT爆炸\r\n 'mob_loot': bool, #生物战利品\r\n 'natural_regeneration': bool, #自然生命恢复\r\n 'respawn_block_explosion': bool, #重生方块爆炸\r\n 'respawn_radius': int, #重生半径,请注意范围,目前支持[0,128]\r\n 'tile_drops': bool, #方块掉落\r\n 'immediate_respawn':bool #立即重生\r\n },\r\n'cheat_info': {\r\n 'enable': bool, #激活作弊\r\n 'always_day': bool, #终为白日\r\n 'mob_griefing': bool, #生物破坏\r\n 'keep_inventory': bool, #保留物品栏\r\n 'weather_cycle': bool, #天气更替\r\n 'mob_spawn': bool, #生物生成\r\n 'entities_drop_loot': bool, #实体掉落战利品\r\n 'daylight_cycle': bool, #开启昼夜更替\r\n 'command_blocks_enabled': bool, #启用命令方块\r\n 'random_tick_speed': int,#随机刻速度\r\n }\r\n}\r\n###\r\nruleDict ={\r\n 'cheat_info': {\r\n 'enable': True,\r\n 'always_day': True,\r\n\r\n }\r\n}\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.SetGameRulesInfoServer(ruleDict)" - }, + ], + "type": "api", + "side": "server", + "name": "SetGameRulesInfoServer" + }, { - "type": "api", - "name": "SetHurtCD", - "method": "", - "description": "设置全局受击间隔CD", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "设置全局受击间隔CD", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.SetHurtCD(1)", "params": [ { - "name": "cdTime", - "type": "int", + "type": "int", + "name": "cdTime", "description": "单位帧数" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.SetHurtCD(1)" - }, + ], + "type": "api", + "side": "server", + "name": "SetHurtCD" + }, { - "type": "api", - "name": "SetLevelGravity", - "method": "", - "description": "设置重力因子", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "设置重力因子", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\n#生物可单独设置重力因子,当生物的重力因子非0时则该生物单独有自己的重力因子,具体参见实体重力组件\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.SetLevelGravity(-0.08)", "params": [ { - "name": "data", - "type": "float", + "type": "float", + "name": "data", "description": "重力因子" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\n#生物可单独设置重力因子,当生物的重力因子非0时则该生物单独有自己的重力因子,具体参见实体重力组件\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.SetLevelGravity(-0.08)" - }, + ], + "type": "api", + "side": "server", + "name": "SetLevelGravity" + }, { - "type": "api", - "name": "SetPistonMaxInteractionCount", - "method": "", - "description": "设置活塞/粘性活塞最多推动的方块数量,默认为12个方块。该设置不存档。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "remark": "", + "return": [], + "description": "设置活塞/粘性活塞最多推动的方块数量,默认为12个方块。该设置不存档。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/游戏规则.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.SetPistonMaxInteractionCount(1))", "params": [ { - "name": "value", - "type": "int", + "type": "int", + "name": "value", "description": "最大推动的方块数量,取值范围为1至1024" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.SetPistonMaxInteractionCount(1))" - }, + ], + "type": "api", + "side": "server", + "name": "SetPistonMaxInteractionCount" + }, { - "type": "api", - "name": "GetEntityLimit", - "method": "", - "description": "获取世界最大可生成实体数量上限。可生成实体的含义见[SetEntityLimit](#setentitylimit)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/生物生成.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nprint serverApi.GetEntityLimit()" - }, + "remark": "", + "return": [], + "description": "获取世界最大可生成实体数量上限。可生成实体的含义见[SetEntityLimit](#setentitylimit)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/生物生成.md", + "example": "import mod.server.extraServerApi as serverApi\r\nprint serverApi.GetEntityLimit()", + "params": [], + "type": "api", + "side": "server", + "name": "GetEntityLimit" + }, { - "type": "api", - "name": "SetEntityLimit", - "method": "", - "description": "设置世界最大可生成实体数量上限。可生成实体指具有spawnrule的实体。当前世界上被加载的可生成实体数量超过这个上限时,生物就不会再通过spawnrule刷出。", - "remark": "- 该上限与生物json文件中配置的种群密度共同作用,比如上限是200,但种群密度是10,那么该生物随机生成不会超过10个。此外生物上限还和适合生成的区块容量相关,设置上限过高的话可能因其他限制条件而不能达到该高度。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/生物生成.md", + "remark": "- 该上限与生物json文件中配置的种群密度共同作用,比如上限是200,但种群密度是10,那么该生物随机生成不会超过10个。此外生物上限还和适合生成的区块容量相关,设置上限过高的话可能因其他限制条件而不能达到该高度。", + "return": [], + "description": "设置世界最大可生成实体数量上限。可生成实体指具有spawnrule的实体。当前世界上被加载的可生成实体数量超过这个上限时,生物就不会再通过spawnrule刷出。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/生物生成.md", + "example": "import mod.server.extraServerApi as serverApi\r\nprint serverApi.SetEntityLimit(300)", "params": [ { - "name": "num", - "type": "int", + "type": "int", + "name": "num", "description": "最大可生成实体数量上限" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nprint serverApi.SetEntityLimit(300)" - }, + ], + "type": "api", + "side": "server", + "name": "SetEntityLimit" + }, { - "type": "api", - "name": "SpawnCustomModule", - "method": "", - "description": "设置自定义刷怪", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/生物生成.md", + "remark": "", + "return": [], + "description": "设置自定义刷怪", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/生物生成.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateMobSpawn(levelId)\r\ncomp.SpawnCustomModule(BiomeType.river,Change.Add,EntityType.Dolphin,10,1,10,2)", "params": [ { - "name": "biomeType", - "type": "int", + "type": "int", + "name": "biomeType", "description": "[BiomeType枚举](../../枚举值/BiomeType.md)" - }, + }, { - "name": "change", - "type": "int", + "type": "int", + "name": "change", "description": "[Change枚举](../../枚举值/Change.md)" - }, + }, { - "name": "entityType", - "type": "int", + "type": "int", + "name": "entityType", "description": "[EntityType枚举](../../枚举值/EntityType.md)" - }, + }, { - "name": "probability", - "type": "int", + "type": "int", + "name": "probability", "description": "生成的权重[1, 10]" - }, + }, { - "name": "minCount", - "type": "int", + "type": "int", + "name": "minCount", "description": "最小生成数量[0, 10]" - }, + }, { - "name": "maxCount", - "type": "int", + "type": "int", + "name": "maxCount", "description": "最大生成数量[0, 10]" - }, + }, { - "name": "environment", - "type": "int", + "type": "int", + "name": "environment", "description": "1:生成在表面;2:生成在水里" - }, + }, { - "name": "minBrightness", - "type": "int", + "type": "int", + "name": "minBrightness", "description": "生成该生物时的最小光照[1, 15],不设置时使用默认值" - }, + }, { - "name": "maxBrightness", - "type": "int", + "type": "int", + "name": "maxBrightness", "description": "生成该生物时的最大光照[1, 15],不设置时使用默认值" - }, + }, { - "name": "minHeight", - "type": "int", + "type": "int", + "name": "minHeight", "description": "生成该生物时最小的海拔高度[0, 256],不设置时使用默认值" - }, + }, { - "name": "maxHeight", - "type": "int", + "type": "int", + "name": "maxHeight", "description": "生成该生物时最大的海拔高度[0, 256],不设置时使用默认值" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateMobSpawn(levelId)\r\ncomp.SpawnCustomModule(BiomeType.river,Change.Add,EntityType.Dolphin,10,1,10,2)" - }, + ], + "type": "api", + "side": "server", + "name": "SpawnCustomModule" + }, { - "type": "api", - "name": "CleanExtraData", - "method": "", - "description": "清除实体的自定义数据或者世界的自定义数据,清除实体数据时使用对应实体id创建组件,清除世界数据时使用levelId创建组件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/自定义数据.md", + "remark": "", + "return": [], + "description": "清除实体的自定义数据或者世界的自定义数据,清除实体数据时使用对应实体id创建组件,清除世界数据时使用levelId创建组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/自定义数据.md", + "example": "import mod.server.extraServerApi as serverApi\r\n# 清除实体数据\r\nentitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nsuc = entitycomp.CleanExtraData(\"nickname\")\r\nprint \"CleanExtraData entity=%s suc=%s\" % (entityId, suc)\r\n# 清除全局数据\r\nlevelcomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\nsuc = levelcomp.CleanExtraData(\"globalMsg\")\r\nprint \"CleanExtraData for level suc=%s\" % suc", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "自定义key" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\n# 清除实体数据\r\nentitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nsuc = entitycomp.CleanExtraData(\"nickname\")\r\nprint \"CleanExtraData entity=%s suc=%s\" % (entityId, suc)\r\n# 清除全局数据\r\nlevelcomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\nsuc = levelcomp.CleanExtraData(\"globalMsg\")\r\nprint \"CleanExtraData for level suc=%s\" % suc" - }, + ], + "type": "api", + "side": "server", + "name": "CleanExtraData" + }, { - "type": "api", - "name": "GetExtraData", - "method": "", - "description": "获取实体的自定义数据或者世界的自定义数据,某个键所对应的值。获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/自定义数据.md", + "remark": "", + "return": [], + "description": "获取实体的自定义数据或者世界的自定义数据,某个键所对应的值。获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/自定义数据.md", + "example": "# 获取全局数据\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\nlevelExData = comp.GetExtraData(\"globalMsg\")\r\n# 获取\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nnickName = comp.GetExtraData(\"nickName\")", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "自定义key" } - ], - "return": [], - "example": "# 获取全局数据\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\nlevelExData = comp.GetExtraData(\"globalMsg\")\r\n# 获取\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nnickName = comp.GetExtraData(\"nickName\")" - }, + ], + "type": "api", + "side": "server", + "name": "GetExtraData" + }, { - "type": "api", - "name": "GetWholeExtraData", - "method": "", - "description": "获取完整的实体的自定义数据或者世界的自定义数据,获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/自定义数据.md", - "params": [], - "return": [], - "example": "#获取实体数据字典\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\ndataDict = comp.GetWholeExtraData()\r\nif dataDict:\r\n for key, value in dataDict.iteritems():\r\n print \"key=%s value=%s\" % (key, str(value))\r\n#获取全局数据字典\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\ndataDict = comp.GetWholeExtraData()\r\nif dataDict:\r\n for key, value in dataDict.iteritems():\r\n print \"key=%s value=%s\" % (key, str(value))" - }, + "remark": "", + "return": [], + "description": "获取完整的实体的自定义数据或者世界的自定义数据,获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/自定义数据.md", + "example": "#获取实体数据字典\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\ndataDict = comp.GetWholeExtraData()\r\nif dataDict:\r\n for key, value in dataDict.iteritems():\r\n print \"key=%s value=%s\" % (key, str(value))\r\n#获取全局数据字典\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\ndataDict = comp.GetWholeExtraData()\r\nif dataDict:\r\n for key, value in dataDict.iteritems():\r\n print \"key=%s value=%s\" % (key, str(value))", + "params": [], + "type": "api", + "side": "server", + "name": "GetWholeExtraData" + }, { - "type": "api", - "name": "SaveExtraData", - "method": "", - "description": "用于保存实体的自定义数据或者世界的自定义数据", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/自定义数据.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\n# 设置实体的自定义数据\r\nentitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nentitycomp.SetExtraData(\"nickname\", \"steve\", False)\r\nentitycomp.SetExtraData(\"score\", 256, False)\r\n# more data to set\r\nentitycomp.SaveExtraData()" - }, + "remark": "", + "return": [], + "description": "用于保存实体的自定义数据或者世界的自定义数据", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/自定义数据.md", + "example": "import mod.server.extraServerApi as serverApi\r\n# 设置实体的自定义数据\r\nentitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nentitycomp.SetExtraData(\"nickname\", \"steve\", False)\r\nentitycomp.SetExtraData(\"score\", 256, False)\r\n# more data to set\r\nentitycomp.SaveExtraData()", + "params": [], + "type": "api", + "side": "server", + "name": "SaveExtraData" + }, { - "type": "api", - "name": "SetExtraData", - "method": "", - "description": "用于设置实体的自定义数据或者世界的自定义数据,数据以键值对的形式保存。设置实体数据时使用对应实体id创建组件,设置世界数据时使用levelId创建组件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/自定义数据.md", + "remark": "", + "return": [], + "description": "用于设置实体的自定义数据或者世界的自定义数据,数据以键值对的形式保存。设置实体数据时使用对应实体id创建组件,设置世界数据时使用levelId创建组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/自定义数据.md", + "example": "import mod.server.extraServerApi as serverApi\r\n# 设置实体的自定义数据\r\nentitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nentitycomp.SetExtraData(\"nickname\",\"steve\")\r\nentitycomp.SetExtraData(\"score\",256)\r\n# 设置世界的自定义数据\r\nlevelcomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\nlevelcomp.SetExtraData(\"globalMsg\",\"helloWorld\")", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "自定义key" - }, + }, { - "name": "value", - "type": "any", + "type": "any", + "name": "value", "description": "key对应的值,支持python基本数据类型" - }, + }, { - "name": "autoSave", - "type": "bool", + "type": "bool", + "name": "autoSave", "description": "默认自动保存,默认为True,如果批量设置数据,请将该参数设置为False,同时在设置数据完毕时调用SaveExtraData接口" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\n# 设置实体的自定义数据\r\nentitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nentitycomp.SetExtraData(\"nickname\",\"steve\")\r\nentitycomp.SetExtraData(\"score\",256)\r\n# 设置世界的自定义数据\r\nlevelcomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\nlevelcomp.SetExtraData(\"globalMsg\",\"helloWorld\")" - }, + ], + "type": "api", + "side": "server", + "name": "SetExtraData" + }, { - "type": "api", - "name": "GetAllPlayerScoreboardObjects", - "method": "", - "description": "获取玩家记分项", - "remark": "- 注意,只有使用命令 /scoreboard objectives setdisplay sidebar xxx 设置显示后的记分项才能在客户端侧获取到", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/记分板.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetAllPlayerScoreboardObjects())" - }, + "remark": "- 注意,只有使用命令 /scoreboard objectives setdisplay sidebar xxx 设置显示后的记分项才能在客户端侧获取到", + "return": [], + "description": "获取玩家记分项", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/记分板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetAllPlayerScoreboardObjects())", + "params": [], + "type": "api", + "side": "client", + "name": "GetAllPlayerScoreboardObjects" + }, { - "type": "api", - "name": "GetAllScoreboardObjects", - "method": "", - "description": "获取所有记分板项", - "remark": "- 注意,只有使用命令 /scoreboard objectives setdisplay sidebar xxx 设置显示后的记分项才能在客户端侧获取到", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/记分板.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetAllScoreboardObjects())" - }, + "remark": "- 注意,只有使用命令 /scoreboard objectives setdisplay sidebar xxx 设置显示后的记分项才能在客户端侧获取到", + "return": [], + "description": "获取所有记分板项", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/记分板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetAllScoreboardObjects())", + "params": [], + "type": "api", + "side": "client", + "name": "GetAllScoreboardObjects" + }, { - "type": "api", - "name": "AddBrewingRecipes", - "method": "", - "description": "添加酿造台配方的接口", - "remark": "- 输出的物品无法和原来的物品堆叠一起\r\n - 对于已有的配方会返回False", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/配方.md", + "remark": "- 输出的物品无法和原来的物品堆叠一起\r\n - 对于已有的配方会返回False", + "return": [], + "description": "添加酿造台配方的接口", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/配方.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRecipe(serverApi.GetLevelId())\r\nprint(comp.AddBrewingRecipes(\"recipe_brewing_container\", \"minecraft:potion\", \"minecraft:gunpowder\", \"minecraft:splash_potion\"))", "params": [ { - "name": "brewType", - "type": "str", + "type": "str", + "name": "brewType", "description": "recipe_brewing_mix或者recipe_brewing_container,recipe_brewing_mix代表混合酿造配方,recipe_brewing_container代表换容酿造配方" - }, + }, { - "name": "inputName", - "type": "str", + "type": "str", + "name": "inputName", "description": "该配方接受的物品" - }, + }, { - "name": "reagentName", - "type": "str", + "type": "str", + "name": "reagentName", "description": "酿造所需要的额外物品" - }, + }, { - "name": "outputName", - "type": "str", + "type": "str", + "name": "outputName", "description": "该配方输出的物品" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRecipe(serverApi.GetLevelId())\r\nprint(comp.AddBrewingRecipes(\"recipe_brewing_container\", \"minecraft:potion\", \"minecraft:gunpowder\", \"minecraft:splash_potion\"))" - }, + ], + "type": "api", + "side": "server", + "name": "AddBrewingRecipes" + }, { - "type": "api", - "name": "AddRecipe", - "method": "", - "description": "动态注册配方,支持配方类型详见[配方类型说明]", - "remark": "- 注意,按照基岩版1.20的酿造台特性,每个药水槽内一次只能放进一个物品,无法一次放入两个及以上的数量的物品。目前该接口无法在联机大厅生效,后续会修复", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/配方.md", + "remark": "- 注意,按照基岩版1.20的酿造台特性,每个药水槽内一次只能放进一个物品,无法一次放入两个及以上的数量的物品。目前该接口无法在联机大厅生效,后续会修复", + "return": [], + "description": "动态注册配方,支持配方类型详见[配方类型说明]", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/配方.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRecipe(serverApi.GetLevelId())\r\ndictData = {\r\n\"minecraft:recipe_brewing_container\": {\r\n \"description\": {\r\n \"identifier\": \"netease:splash_to_normal\"\r\n },\r\n \"tags\": [\"brewing_stand\"],\r\n \"input\": \"minecraft:splash_potion\",\r\n \"reagent\": \"minecraft:apple\",\r\n \"output\": \"minecraft:potion\"\r\n}\r\n}\r\n\r\njsonData = '{\r\n\"minecraft:recipe_furnace\": {\r\n \"description\": {\r\n \"identifier\": \"netease:diamond_to_apple\"\r\n },\r\n \"tags\": [\"furnace\"],\r\n \"input\": {\r\n \"item\": \"minecraft:diamond\",\r\n \"count\": 1\r\n },\r\n \"output\": {\r\n \"item\": \"minecraft:apple\"\r\n }\r\n}\r\n}'\r\nprint \"dictionary data:\", comp.AddRecipe(dictData)\r\nprint \"json str data:\", comp.AddRecipe(jsonData)", "params": [ { - "name": "rcp", - "type": "str或dict", + "type": "str或dict", + "name": "rcp", "description": "配方json数据或者配方字典" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRecipe(serverApi.GetLevelId())\r\ndictData = {\r\n\"minecraft:recipe_brewing_container\": {\r\n \"description\": {\r\n \"identifier\": \"netease:splash_to_normal\"\r\n },\r\n \"tags\": [\"brewing_stand\"],\r\n \"input\": \"minecraft:splash_potion\",\r\n \"reagent\": \"minecraft:apple\",\r\n \"output\": \"minecraft:potion\"\r\n}\r\n}\r\n\r\njsonData = '{\r\n\"minecraft:recipe_furnace\": {\r\n \"description\": {\r\n \"identifier\": \"netease:diamond_to_apple\"\r\n },\r\n \"tags\": [\"furnace\"],\r\n \"input\": {\r\n \"item\": \"minecraft:diamond\",\r\n \"count\": 1\r\n },\r\n \"output\": {\r\n \"item\": \"minecraft:apple\"\r\n }\r\n}\r\n}'\r\nprint \"dictionary data:\", comp.AddRecipe(dictData)\r\nprint \"json str data:\", comp.AddRecipe(jsonData)" - }, + ], + "type": "api", + "side": "server", + "name": "AddRecipe" + }, { - "type": "api", - "name": "GetRecipeResult", - "method": "", - "description": "根据配方id获取配方结果。仅支持合成配方", - "remark": "- resultDict字典内容如下\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | fullItemName | str | 物品的identifier |\r\n |auxValue| int | 物品附加值 |\r\n |num| int | 物品数目 |\r\n - 在基岩版1.20更新后,配方里的部分物品不再是对应单一物品,而是对应某种类型的物品。即'item‘字段所对应的物品有可能是列表类型(list),也可能为字符串类型(str)。如果是字符串类型,则为这个物品的identifier,如果为列表类型,则包含了符合同种类型的所有物品的identifier。例如,木板类型的物品,’item'则会返回包含'minecraft:mangrove_planks', 'minecraft:planks', 'minecraft:warped_planks'等木板在内的列表。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/配方.md", + "remark": "- resultDict字典内容如下\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | fullItemName | str | 物品的identifier |\r\n |auxValue| int | 物品附加值 |\r\n |num| int | 物品数目 |\r\n - 在基岩版1.20更新后,配方里的部分物品不再是对应单一物品,而是对应某种类型的物品。即'item‘字段所对应的物品有可能是列表类型(list),也可能为字符串类型(str)。如果是字符串类型,则为这个物品的identifier,如果为列表类型,则包含了符合同种类型的所有物品的identifier。例如,木板类型的物品,’item'则会返回包含'minecraft:mangrove_planks', 'minecraft:planks', 'minecraft:warped_planks'等木板在内的列表。", + "return": [], + "description": "根据配方id获取配方结果。仅支持合成配方", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/配方.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRecipe(serverApi.GetLevelId())\r\ncomp.GetRecipeResult(\"minecraft:boat\")", "params": [ { - "name": "recipeId", - "type": "str", + "type": "str", + "name": "recipeId", "description": "配方id,对应配方json文件中的identifier字段" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRecipe(serverApi.GetLevelId())\r\ncomp.GetRecipeResult(\"minecraft:boat\")" - }, + ], + "type": "api", + "side": "server", + "name": "GetRecipeResult" + }, { - "type": "api", - "name": "GetRecipesByInput", - "method": "", - "description": "通过输入物品查询配方", - "remark": "- 获取熔炉配方时,若输出物品数量为1时,output使用字符串表示物品identifier及附加值;若输出物品数量大于1时,output为一个dict\r\n - 在获取酿造台配方时,不匹配tag标签与aux值,药水的identifier需要输入全称,例如:minecraft:potion_type:long_turtle_master,否则无法获取正确的配方。\r\n - 需要遍历较多数据,不建议频繁调用\r\n - 在基岩版1.20更新后,配方里的部分物品不再是对应单一物品,而是对应某种类型的物品。即'item‘字段所对应的物品有可能是列表类型(list),也可能为字符串类型(str)。如果是字符串类型,则为这个物品的identifier,如果为列表类型,则包含了符合同种类型的所有物品的identifier。例如,木板类型的物品,’item'则会返回包含'minecraft:mangrove_planks', 'minecraft:planks', 'minecraft:warped_planks'等木板在内的列表。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/配方.md", + "remark": "- 获取熔炉配方时,若输出物品数量为1时,output使用字符串表示物品identifier及附加值;若输出物品数量大于1时,output为一个dict\r\n - 在获取酿造台配方时,不匹配tag标签与aux值,药水的identifier需要输入全称,例如:minecraft:potion_type:long_turtle_master,否则无法获取正确的配方。\r\n - 需要遍历较多数据,不建议频繁调用\r\n - 在基岩版1.20更新后,配方里的部分物品不再是对应单一物品,而是对应某种类型的物品。即'item‘字段所对应的物品有可能是列表类型(list),也可能为字符串类型(str)。如果是字符串类型,则为这个物品的identifier,如果为列表类型,则包含了符合同种类型的所有物品的identifier。例如,木板类型的物品,’item'则会返回包含'minecraft:mangrove_planks', 'minecraft:planks', 'minecraft:warped_planks'等木板在内的列表。", + "return": [], + "description": "通过输入物品查询配方", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/配方.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRecipe(clientApi.GetLevelId())\r\nprint(comp.GetRecipesByInput(\"minecraft:log\", \"crafting_table\", 0, -1))", "params": [ { - "name": "inputIdentifier", - "type": "str", + "type": "str", + "name": "inputIdentifier", "description": "输入物品的标识符" - }, + }, { - "name": "tag", - "type": "str", + "type": "str", + "name": "tag", "description": "对应配方json中的tags字段里面的值" - }, + }, { - "name": "aux", - "type": "int", + "type": "int", + "name": "aux", "description": "输出物品的附加值, 不传参的话默认为0" - }, + }, { - "name": "maxResultNum", - "type": "int", + "type": "int", + "name": "maxResultNum", "description": "最大输出条目数,若大于等于0时,结果超过maxResultNum,则只返回maxResultNum条。默认-1,表示返回全部" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRecipe(clientApi.GetLevelId())\r\nprint(comp.GetRecipesByInput(\"minecraft:log\", \"crafting_table\", 0, -1))" - }, + ], + "type": "api", + "side": "client", + "name": "GetRecipesByInput" + }, { - "type": "api", - "name": "GetRecipesByResult", - "method": "", - "description": "通过输出物品查询配方所需要的输入材料", - "remark": "- 获取熔炉配方时,若输出物品数量为1时,output使用字符串表示物品identifier及附加值;若输出物品数量大于1时,output为一个dict\r\n - 在获取酿造台配方时,不匹配tag标签与aux值,药水的identifier需要输入全称,例如:minecraft:potion_type:long_turtle_master,否则无法获取正确的配方。\r\n - 在基岩版1.20更新后,配方里的部分物品不再是对应单一物品,而是对应某种类型的物品。即'item‘字段所对应的物品有可能是列表类型(list),也可能为字符串类型(str)。如果是字符串类型,则为这个物品的identifier,如果为列表类型,则包含了符合同种类型的所有物品的identifier。例如,木板类型的物品,’item'则会返回包含'minecraft:mangrove_planks', 'minecraft:planks', 'minecraft:warped_planks'等木板在内的列表。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/配方.md", + "remark": "- 获取熔炉配方时,若输出物品数量为1时,output使用字符串表示物品identifier及附加值;若输出物品数量大于1时,output为一个dict\r\n - 在获取酿造台配方时,不匹配tag标签与aux值,药水的identifier需要输入全称,例如:minecraft:potion_type:long_turtle_master,否则无法获取正确的配方。\r\n - 在基岩版1.20更新后,配方里的部分物品不再是对应单一物品,而是对应某种类型的物品。即'item‘字段所对应的物品有可能是列表类型(list),也可能为字符串类型(str)。如果是字符串类型,则为这个物品的identifier,如果为列表类型,则包含了符合同种类型的所有物品的identifier。例如,木板类型的物品,’item'则会返回包含'minecraft:mangrove_planks', 'minecraft:planks', 'minecraft:warped_planks'等木板在内的列表。", + "return": [], + "description": "通过输出物品查询配方所需要的输入材料", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/配方.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRecipe(clientApi.GetLevelId())\r\nprint(comp.GetRecipesByResult(\"minecraft:boat\", \"crafting_table\", 4, -1))", "params": [ { - "name": "resultIdentifier", - "type": "str", + "type": "str", + "name": "resultIdentifier", "description": "输出物品的标识符" - }, + }, { - "name": "tag", - "type": "str", + "type": "str", + "name": "tag", "description": "对应配方json中的tags字段里面的值" - }, + }, { - "name": "aux", - "type": "int", + "type": "int", + "name": "aux", "description": "输出物品的附加值, 不传参的话默认为0" - }, + }, { - "name": "maxResultNum", - "type": "int", + "type": "int", + "name": "maxResultNum", "description": "最大输出条目数,若大于等于0时,结果超过maxResultNum,则只返回maxResultNum条。默认-1,表示返回全部" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRecipe(clientApi.GetLevelId())\r\nprint(comp.GetRecipesByResult(\"minecraft:boat\", \"crafting_table\", 4, -1))" - }, + ], + "type": "api", + "side": "client", + "name": "GetRecipesByResult" + }, { - "type": "api", - "name": "RemoveRecipe", - "method": "", - "description": "动态禁用配方", - "remark": "- 目前动态移除配方接口不支持移除原生配方", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/世界/配方.md", + "remark": "- 目前动态移除配方接口不支持移除原生配方", + "return": [], + "description": "动态禁用配方", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/世界/配方.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRecipe(serverApi.GetLevelId())\r\ncomp.RemoveRecipe(\"netease:splash_to_normal\", \"recipe_brewing_container\")\r\ncomp.RemoveRecipe(\"netease:diamond_to_apple\", \"recipe_furnace\")", "params": [ { - "name": "rcpIdentifier", - "type": "str", + "type": "str", + "name": "rcpIdentifier", "description": "配方identifier" - }, + }, { - "name": "rcpTypeStr", - "type": "str", + "type": "str", + "name": "rcpTypeStr", "description": "配方类型,省略前缀\"minecraft\"。详见[配方类型说明]" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRecipe(serverApi.GetLevelId())\r\ncomp.RemoveRecipe(\"netease:splash_to_normal\", \"recipe_brewing_container\")\r\ncomp.RemoveRecipe(\"netease:diamond_to_apple\", \"recipe_furnace\")" - }, + ], + "type": "api", + "side": "server", + "name": "RemoveRecipe" + }, { - "type": "event", - "name": "ChangeSneakState", - "method": "", - "description": "切换潜行状态", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "切换潜行状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "ChangeSneakState" + }, { - "type": "event", - "name": "ClickInteractGUI", - "method": "", - "description": "模拟点击交互按钮,交互按钮指的在喂食、钓鱼、交易等交互场景出现的按钮", - "remark": "- 交互行为\r\n | 条件 | 交互按钮 |\r\n | ---- | ----- |\r\n | 玩家站在坐骑附近 |【骑乘】|\r\n | 玩家手持打火石 |【点燃】|\r\n | 玩家给羊驼、驴、骡连接箱子 |【连接箱子】|\r\n | 玩家和村民交易 |【交易】|\r\n | 玩家拿着栓绳对实体 |【拴住】/【解开】|\r\n | 玩家手持钓竿钓鱼 |【钓鱼】|\r\n | 玩家站在矿车附近 |【乘坐】|\r\n | 玩家在船附近 |【上船】/【下船】|\r\n | 玩家手持装备,或站在盔甲架附近 |【装备】|\r\n | 玩家站在动物附近 |【喂养】|", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 交互行为\r\n | 条件 | 交互按钮 |\r\n | ---- | ----- |\r\n | 玩家站在坐骑附近 |【骑乘】|\r\n | 玩家手持打火石 |【点燃】|\r\n | 玩家给羊驼、驴、骡连接箱子 |【连接箱子】|\r\n | 玩家和村民交易 |【交易】|\r\n | 玩家拿着栓绳对实体 |【拴住】/【解开】|\r\n | 玩家手持钓竿钓鱼 |【钓鱼】|\r\n | 玩家站在矿车附近 |【乘坐】|\r\n | 玩家在船附近 |【上船】/【下船】|\r\n | 玩家手持装备,或站在盔甲架附近 |【装备】|\r\n | 玩家站在动物附近 |【喂养】|", + "return": [], + "description": "模拟点击交互按钮,交互按钮指的在喂食、钓鱼、交易等交互场景出现的按钮", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "ClickInteractGUI" + }, { - "type": "event", - "name": "GetOriginAreaOffset", - "method": "", - "description": "获取指定原生UI的offset,包括左上角和右下角", - "remark": "- 部分情况下获取的area值返回(0,0,0,0),如开启了聊天插件后,聊天按钮不再支持获取,默认返回(0,0,0,0)\r\n - 以屏幕左上角为原点,由于原版UI使用基类画布,因此坐标为基类画布下的坐标,在适配时需要注意异形屏的情况。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "- 部分情况下获取的area值返回(0,0,0,0),如开启了聊天插件后,聊天按钮不再支持获取,默认返回(0,0,0,0)\r\n - 以屏幕左上角为原点,由于原版UI使用基类画布,因此坐标为基类画布下的坐标,在适配时需要注意异形屏的情况。", + "return": [], + "description": "获取指定原生UI的offset,包括左上角和右下角", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "areaEnum", - "type": "str", + "type": "str", + "name": "areaEnum", "description": "原生UI枚举([原生UI枚举](../枚举值/OriginGUIName.md))" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetOriginAreaOffset" + }, { - "type": "event", - "name": "GetScreenSize", - "method": "", - "description": "获取游戏分辨率", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取游戏分辨率", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetScreenSize" + }, { - "type": "event", - "name": "GetScreenViewInfo", - "method": "", - "description": "获取游戏视角信息。首先获得当前分辨率下UI放大倍数,计算方式可参考《我的世界》界面适配方法。则当前游戏视角的宽度的计算方式为:若当前分辨率的宽度能被该放大倍数整除,则等于当前分辨率,若不能,则等于当前分辨率加放大倍数再减去当前分辨率对放大倍数求余的结果,当前游戏视角的高度计算方法类似。例:以分辨率为1792,828的手机计算,画布是分辨率的3倍,所以x = 1792 + 3 - 1 = 1794;y = 828,该接口返回的结果为(1794.0, 828.0, 0.0, 0.0)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取游戏视角信息。首先获得当前分辨率下UI放大倍数,计算方式可参考《我的世界》界面适配方法。则当前游戏视角的宽度的计算方式为:若当前分辨率的宽度能被该放大倍数整除,则等于当前分辨率,若不能,则等于当前分辨率加放大倍数再减去当前分辨率对放大倍数求余的结果,当前游戏视角的高度计算方法类似。例:以分辨率为1792,828的手机计算,画布是分辨率的3倍,所以x = 1792 + 3 - 1 = 1794;y = 828,该接口返回的结果为(1794.0, 828.0, 0.0, 0.0)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetScreenViewInfo" + }, { - "type": "event", - "name": "GetWalkState", - "method": "", - "description": "获取玩家行走/潜行/跑步状态", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家行走/潜行/跑步状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetWalkState" + }, { - "type": "event", - "name": "HideAirSupplyGUI", - "method": "", - "description": "隐藏玩家氧气值界面", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏玩家氧气值界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideAirSupplyGUI" + }, { - "type": "event", - "name": "HideArmorGui", - "method": "", - "description": "隐藏hud界面的护甲值显示", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏hud界面的护甲值显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideArmorGui" + }, { - "type": "event", - "name": "HideChangePersonGui", - "method": "", - "description": "隐藏切换人称的按钮。隐藏后点击相应位置不会响应", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏切换人称的按钮。隐藏后点击相应位置不会响应", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideChangePersonGui" + }, { - "type": "event", - "name": "HideChatGUI", - "method": "", - "description": "隐藏聊天按钮原生UI。该接口在开启新版聊天时不生效", - "remark": "- 该接口只对原版聊天的聊天按钮生效,如需隐藏新版聊天拓展按钮,建议使用官方聊天拓展的Disable接口,关闭新版聊天拓展功能\r\n 如需在关闭新版聊天拓展功能后仍隐藏原版聊天的聊天按钮,需要在ClientLoadAddonsFinishServerEvent后的事件调用该接口,如OnLocalPlayerStopLoading、UiInitFinished事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "- 该接口只对原版聊天的聊天按钮生效,如需隐藏新版聊天拓展按钮,建议使用官方聊天拓展的Disable接口,关闭新版聊天拓展功能\r\n 如需在关闭新版聊天拓展功能后仍隐藏原版聊天的聊天按钮,需要在ClientLoadAddonsFinishServerEvent后的事件调用该接口,如OnLocalPlayerStopLoading、UiInitFinished事件", + "return": [], + "description": "隐藏聊天按钮原生UI。该接口在开启新版聊天时不生效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideChatGUI" + }, { - "type": "event", - "name": "HideCrossHairGUI", - "method": "", - "description": "隐藏hud界面的十字准心显示", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏hud界面的十字准心显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideCrossHairGUI" + }, { - "type": "event", - "name": "HideEmoteGUI", - "method": "", - "description": "设置是否开启表情功能,默认PC端关闭,手机端开启,且该接口只能在手机端使用。该接口在开启新版聊天时不生效", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "设置是否开启表情功能,默认PC端关闭,手机端开启,且该接口只能在手机端使用。该接口在开启新版聊天时不生效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideEmoteGUI" + }, { - "type": "event", - "name": "HideExpGui", - "method": "", - "description": "非创造者模式下隐藏经验条显示", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "非创造者模式下隐藏经验条显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideExpGui" + }, { - "type": "event", - "name": "HideFoldGUI", - "method": "", - "description": "隐藏下拉按钮原生UI。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏下拉按钮原生UI。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideFoldGUI" + }, { - "type": "event", - "name": "HideHealthGui", - "method": "", - "description": "隐藏hud界面的血量显示", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏hud界面的血量显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideHealthGui" + }, { - "type": "event", - "name": "HideHorseHealthGui", - "method": "", - "description": "隐藏hud界面的坐骑的血量显示", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏hud界面的坐骑的血量显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideHorseHealthGui" + }, { - "type": "event", - "name": "HideHudGUI", - "method": "", - "description": "隐藏HUD游戏界面的游戏原生UI。与原版F1按钮效果一致,只隐藏显示,但点击跳跃键等位置依然会响应", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏HUD游戏界面的游戏原生UI。与原版F1按钮效果一致,只隐藏显示,但点击跳跃键等位置依然会响应", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "True为隐藏原生HUD,False为恢复显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideHudGUI" + }, { - "type": "event", - "name": "HideHungerGui", - "method": "", - "description": "隐藏hud界面的饥饿值显示", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏hud界面的饥饿值显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideHungerGui" + }, { - "type": "event", - "name": "HideInteractGui", - "method": "", - "description": "隐藏交互按钮。隐藏后点击相应位置不会响应", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏交互按钮。隐藏后点击相应位置不会响应", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideInteractGui" + }, { - "type": "event", - "name": "HideJumpGui", - "method": "", - "description": "隐藏游戏中右下角的跳跃按钮。隐藏后点击相应位置不会响应", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏游戏中右下角的跳跃按钮。隐藏后点击相应位置不会响应", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideJumpGui" + }, { - "type": "event", - "name": "HideMoveGui", - "method": "", - "description": "隐藏游戏中左下角的移动按钮。隐藏后点击相应位置不会响应", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏游戏中左下角的移动按钮。隐藏后点击相应位置不会响应", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideMoveGui" + }, { - "type": "event", - "name": "HideNeteaseStoreGui", - "method": "", - "description": "隐藏游戏中的网易商店按钮。隐藏后点击相应位置不会响应", - "remark": "- 由于目前商店本身的实现,短期内无法实现纳入UIStack中管理的流程中\r\n - 如果需要额外操作商店界面,可考虑使用GetUI获取UINode后进行后续操作.下述UINode的namespace均为\"Minecraft\"\r\n | uiKey | 解释 |\r\n | --------------------------| ------------------- |\r\n | newUIShopAsking | 余额不足界面 |\r\n | newUIShopConfirm | 购买确认界面 |\r\n | newUIShopFlying | 小图标飞入物品栏界面 |\r\n | newUIShopWaiting | 购买等待界面 |\r\n | newUIShopSingleItem | 物品购买界面 |\r\n | newUIShopMain | 商店主界面 |\r\n | newUIShopRecoModel1 | 推荐商品1 |\r\n | newUIShopRecoModel2 | 推荐商品2 |\r\n | newUIShopDesk | 商店入口按钮界面 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "- 由于目前商店本身的实现,短期内无法实现纳入UIStack中管理的流程中\r\n - 如果需要额外操作商店界面,可考虑使用GetUI获取UINode后进行后续操作.下述UINode的namespace均为\"Minecraft\"\r\n | uiKey | 解释 |\r\n | --------------------------| ------------------- |\r\n | newUIShopAsking | 余额不足界面 |\r\n | newUIShopConfirm | 购买确认界面 |\r\n | newUIShopFlying | 小图标飞入物品栏界面 |\r\n | newUIShopWaiting | 购买等待界面 |\r\n | newUIShopSingleItem | 物品购买界面 |\r\n | newUIShopMain | 商店主界面 |\r\n | newUIShopRecoModel1 | 推荐商品1 |\r\n | newUIShopRecoModel2 | 推荐商品2 |\r\n | newUIShopDesk | 商店入口按钮界面 |", + "return": [], + "description": "隐藏游戏中的网易商店按钮。隐藏后点击相应位置不会响应", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideNeteaseStoreGui" + }, { - "type": "event", - "name": "HidePauseGUI", - "method": "", - "description": "隐藏暂停按钮原生UI。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏暂停按钮原生UI。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HidePauseGUI" + }, { - "type": "event", - "name": "HideReportGUI", - "method": "", - "description": "隐藏举报按钮原生UI。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏举报按钮原生UI。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideReportGUI" + }, { - "type": "event", - "name": "HideSlotBarGui", - "method": "", - "description": "隐藏游戏中底部中间的物品栏界面", - "remark": "- 受限于MC主界面结构控制,不能实现在保留经验条的情况下隐藏slotbar", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "- 受限于MC主界面结构控制,不能实现在保留经验条的情况下隐藏slotbar", + "return": [], + "description": "隐藏游戏中底部中间的物品栏界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideSlotBarGui" + }, { - "type": "event", - "name": "HideSneakGui", - "method": "", - "description": "隐藏游戏中左下角方向键的中心处潜行按钮。隐藏后点击相应位置不会响应", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏游戏中左下角方向键的中心处潜行按钮。隐藏后点击相应位置不会响应", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideSneakGui" + }, { - "type": "event", - "name": "HideSwimGui", - "method": "", - "description": "隐藏游戏中的浮潜按钮。隐藏后点击相应位置不会响应。仅影响十字键操作下的浮潜按钮,摇杆模式上浮=跳跃,下潜=潜行,需要通过HideJumpGui和HideSneakGui来隐藏", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏游戏中的浮潜按钮。隐藏后点击相应位置不会响应。仅影响十字键操作下的浮潜按钮,摇杆模式上浮=跳跃,下潜=潜行,需要通过HideJumpGui和HideSneakGui来隐藏", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideSwimGui" + }, { - "type": "event", - "name": "HideVoiceGUI", - "method": "", - "description": "隐藏语音按钮原生UI。该接口在开启新版聊天时不生效", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏语音按钮原生UI。该接口在开启新版聊天时不生效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideVoiceGUI" + }, { - "type": "event", - "name": "HideWalkGui", - "method": "", - "description": "隐藏游戏中跑/走按钮。隐藏后点击相应位置不会响应", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "隐藏游戏中跑/走按钮。隐藏后点击相应位置不会响应", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isHide", - "type": "bool", + "type": "bool", + "name": "isHide", "description": "是否隐藏,True为隐藏,False为显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideWalkGui" + }, { - "type": "event", - "name": "OpenChatGui", - "method": "", - "description": "打开原版聊天栏", - "remark": "- 当已经打开is_showing_menu为true的ui时,需要设置isForce为True才能打开\r\n - 该接口同时会触发PlayerChatButtonClickClientEvent事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "- 当已经打开is_showing_menu为true的ui时,需要设置isForce为True才能打开\r\n - 该接口同时会触发PlayerChatButtonClickClientEvent事件", + "return": [], + "description": "打开原版聊天栏", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isForce", - "type": "bool", + "type": "bool", + "name": "isForce", "description": "是否强制打开,默认False,当已经打开is_showing_menu为true的ui时,无法打开" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OpenChatGui" + }, { - "type": "event", - "name": "OpenEmoteGui", - "method": "", - "description": "打开表情界面", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "打开表情界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "OpenEmoteGui" + }, { - "type": "event", - "name": "OpenFoldGui", - "method": "", - "description": "打开原版下拉界面", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "打开原版下拉界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "OpenFoldGui" + }, { - "type": "event", - "name": "OpenInventoryGui", - "method": "", - "description": "打开原版背包界面,并支持选中某个分页(支持自定义分页名称)", - "remark": "- 当已经打开is_showing_menu为true的ui时,需要设置isForce为True才能打开", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "- 当已经打开is_showing_menu为true的ui时,需要设置isForce为True才能打开", + "return": [], + "description": "打开原版背包界面,并支持选中某个分页(支持自定义分页名称)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "categoryName", - "type": "str", + "type": "str", + "name": "categoryName", "description": "分页名称([原版分页名称枚举](../枚举值/InventoryType.md))" - }, + }, { - "name": "isForce", - "type": "bool", + "type": "bool", + "name": "isForce", "description": "是否强制打开,默认False,当已经打开is_showing_menu为true的ui时,无法打开" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OpenInventoryGui" + }, { - "type": "event", - "name": "OpenNeteaseStoreGui", - "method": "", - "description": "打开游戏中的网易商店购买商品界面", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "打开游戏中的网易商店购买商品界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "categoryName", - "type": "str", + "type": "str", + "name": "categoryName", "description": "商品分类名称" - }, + }, { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "商品名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OpenNeteaseStoreGui" + }, { - "type": "event", - "name": "OpenPauseGui", - "method": "", - "description": "打开原版暂停界面", - "remark": "- 当已经打开is_showing_menu为true的ui时,需要设置isForce为True才能打开", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "- 当已经打开is_showing_menu为true的ui时,需要设置isForce为True才能打开", + "return": [], + "description": "打开原版暂停界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "isForce", - "type": "bool", + "type": "bool", + "name": "isForce", "description": "是否强制打开,默认False,当已经打开is_showing_menu为true的ui时,无法打开" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OpenPauseGui" + }, { - "type": "event", - "name": "OpenReportGui", - "method": "", - "description": "打开原版举报界面", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "打开原版举报界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "OpenReportGui" + }, { - "type": "event", - "name": "OpenVoiceGui", - "method": "", - "description": "打开原版语音界面", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "打开原版语音界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "OpenVoiceGui" + }, { - "type": "event", - "name": "PlayHudHeartBlinkAnim", - "method": "", - "description": "播放原版受伤时血量变化的动效", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "播放原版受伤时血量变化的动效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "PlayHudHeartBlinkAnim" + }, { - "type": "event", - "name": "SetCrossHair", - "method": "", - "description": "设置是否使用“准星瞄准”", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "设置是否使用“准星瞄准”", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "visible", - "type": "bool", + "type": "bool", + "name": "visible", "description": "十字模式下True为开启“准星瞄准”,False为关闭,摇杆模式下True为点击互动、False为瞄准十字线" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCrossHair" + }, { - "type": "event", - "name": "SetEmoteSwitch", - "method": "", - "description": "设置是否开启表情功能,默认PC端关闭,手机端开启,且该接口只能在手机端使用,在原生UI初始化前调用设置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "设置是否开启表情功能,默认PC端关闭,手机端开启,且该接口只能在手机端使用,在原生UI初始化前调用设置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "flag", - "type": "bool", + "type": "bool", + "name": "flag", "description": "是否开启表情" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetEmoteSwitch" + }, { - "type": "event", - "name": "SetHudChatStackPosition", - "method": "", - "description": "设置HUD界面左上小聊天窗口位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "设置HUD界面左上小聊天窗口位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "pos", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "pos", "description": "该界面的目标坐标,第一项为横轴,第二项为纵轴,(0,0)点在Hud界面左上角,玩家纸娃娃下方" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetHudChatStackPosition" + }, { - "type": "event", - "name": "SetHudChatStackVisible", - "method": "", - "description": "设置HUD界面左上小聊天窗口可见性", - "remark": "- 需要在UiInitFinished事件触发后调用", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "- 需要在UiInitFinished事件触发后调用", + "return": [], + "description": "设置HUD界面左上小聊天窗口可见性", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "visible", - "type": "bool", + "type": "bool", + "name": "visible", "description": "是否可见" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetHudChatStackVisible" + }, { - "type": "event", - "name": "SetResponse", - "method": "", - "description": "设置原生UI是否响应", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "remark": "", + "return": [], + "description": "设置原生UI是否响应", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", "params": [ { - "name": "response", - "type": "bool", + "type": "bool", + "name": "response", "description": "是否响应原生UI,True为响应原生UI,即点击屏幕时可以敲击方块/攻击实体,False为不响应原生UI" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetResponse" + }, { - "type": "event", - "name": "SimulateJump", - "method": "", - "description": "模拟跳跃", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "模拟跳跃", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/原生UI.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "SimulateJump" + }, { - "type": "api", - "name": "CheckGaussianBlurEnabled", - "method": "", - "description": "检测是否开启了高斯模糊效果。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/模糊.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.CheckGaussianBlurEnabled()" - }, + "remark": "", + "return": [], + "description": "检测是否开启了高斯模糊效果。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/模糊.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.CheckGaussianBlurEnabled()", + "params": [], + "type": "api", + "side": "client", + "name": "CheckGaussianBlurEnabled" + }, { - "type": "api", - "name": "SetEnableGaussianBlur", - "method": "", - "description": "设置是否开启高斯模糊效果,开启后玩家屏幕周围被模糊,可通过高斯模糊其他接口设置效果参数。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/模糊.md", + "remark": "", + "return": [], + "description": "设置是否开启高斯模糊效果,开启后玩家屏幕周围被模糊,可通过高斯模糊其他接口设置效果参数。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/模糊.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.SetEnableGaussianBlur(True)", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否开启高斯模糊效果,True为开启,False为关闭。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.SetEnableGaussianBlur(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetEnableGaussianBlur" + }, { - "type": "api", - "name": "SetGaussianBlurRadius", - "method": "", - "description": "设置高斯模糊效果的模糊半径,半径越大,模糊程度越大,反之则模糊程度越小。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/模糊.md", + "remark": "", + "return": [], + "description": "设置高斯模糊效果的模糊半径,半径越大,模糊程度越大,反之则模糊程度越小。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/模糊.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整高斯模糊半径为3\r\ncomp.SetGaussianBlurRadius(3)", "params": [ { - "name": "radius", - "type": "float", + "type": "float", + "name": "radius", "description": "模糊半径大小,值的范围为[0,10],小于或大于这个范围的值将被截取为边界值0或10" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整高斯模糊半径为3\r\ncomp.SetGaussianBlurRadius(3)" - }, + ], + "type": "api", + "side": "client", + "name": "SetGaussianBlurRadius" + }, { - "type": "api", - "name": "CheckVignetteEnabled", - "method": "", - "description": "检测是否开启了屏幕渐晕(Vignette)效果。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/渐晕.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.CheckVignetteEnabled()" - }, + "remark": "", + "return": [], + "description": "检测是否开启了屏幕渐晕(Vignette)效果。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/渐晕.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.CheckVignetteEnabled()", + "params": [], + "type": "api", + "side": "client", + "name": "CheckVignetteEnabled" + }, { - "type": "api", - "name": "SetEnableVignette", - "method": "", - "description": "设置是否开启屏幕渐晕(Vignette)效果,开启后玩家屏幕周围将出现渐晕,可通过Vignette其他接口设置效果参数。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/渐晕.md", + "remark": "", + "return": [], + "description": "设置是否开启屏幕渐晕(Vignette)效果,开启后玩家屏幕周围将出现渐晕,可通过Vignette其他接口设置效果参数。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/渐晕.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.SetEnableVignette(True)", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否开启Vignette效果,True为开启,False为关闭。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.SetEnableVignette(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetEnableVignette" + }, { - "type": "api", - "name": "SetVignetteCenter", - "method": "", - "description": "设置渐晕(Vignette)的渐晕中心位置,可改变屏幕渐晕的位置。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/渐晕.md", + "remark": "", + "return": [], + "description": "设置渐晕(Vignette)的渐晕中心位置,可改变屏幕渐晕的位置。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/渐晕.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整渐晕中心位置为屏幕中心\r\ncomp.SetVignetteCenter((0.5,0.5))", "params": [ { - "name": "center", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "center", "description": "按顺序分别为屏幕位置的x及y值。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整渐晕中心位置为屏幕中心\r\ncomp.SetVignetteCenter((0.5,0.5))" - }, + ], + "type": "api", + "side": "client", + "name": "SetVignetteCenter" + }, { - "type": "api", - "name": "SetVignetteRGB", - "method": "", - "description": "设置渐晕(Vignette)的渐晕颜色,可改变屏幕渐晕的颜色。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/渐晕.md", + "remark": "", + "return": [], + "description": "设置渐晕(Vignette)的渐晕颜色,可改变屏幕渐晕的颜色。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/渐晕.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 设置颜色的值为红色。\r\ncomp.SetVignetteRGB((255,0,0))", "params": [ { - "name": "color", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "color", "description": "按顺序分别为颜色的RGB值,值的范围为[0,255],小于或大于这个范围的值将被截取为边界值0或255" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 设置颜色的值为红色。\r\ncomp.SetVignetteRGB((255,0,0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetVignetteRGB" + }, { - "type": "api", - "name": "SetVignetteRadius", - "method": "", - "description": "设置渐晕(Vignette)的渐晕半径,半径越大,渐晕越小,玩家的视野范围越大。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/渐晕.md", + "remark": "", + "return": [], + "description": "设置渐晕(Vignette)的渐晕半径,半径越大,渐晕越小,玩家的视野范围越大。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/渐晕.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整渐晕半径为0.5\r\ncomp.SetVignetteRadius(0.5)", "params": [ { - "name": "radius", - "type": "float", + "type": "float", + "name": "radius", "description": "渐晕半径大小,值的范围为[0,1],小于或大于这个范围的值将被截取为边界值0或1" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整渐晕半径为0.5\r\ncomp.SetVignetteRadius(0.5)" - }, + ], + "type": "api", + "side": "client", + "name": "SetVignetteRadius" + }, { - "type": "api", - "name": "SetVignetteSmoothness", - "method": "", - "description": "设置渐晕(Vignette)的渐晕模糊系数,模糊系数越大,则渐晕边缘越模糊,模糊的范围也越大", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/渐晕.md", + "remark": "", + "return": [], + "description": "设置渐晕(Vignette)的渐晕模糊系数,模糊系数越大,则渐晕边缘越模糊,模糊的范围也越大", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/渐晕.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整渐晕模糊系数为0.5\r\ncomp.SetVignetteSmoothness(0.5)", "params": [ { - "name": "radius", - "type": "float", + "type": "float", + "name": "radius", "description": "渐晕模糊系数,值的范围为[0,1],小于或大于这个范围的值将被截取为边界值0或1" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整渐晕模糊系数为0.5\r\ncomp.SetVignetteSmoothness(0.5)" - }, + ], + "type": "api", + "side": "client", + "name": "SetVignetteSmoothness" + }, { - "type": "api", - "name": "AddPostProcess", - "method": "", - "description": "添加后处理效果,与graphics_settings/post_process.json定义的process等效", - "remark": "- 调用这个接口的时候会启动后处理", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "remark": "- 调用这个接口的时候会启动后处理", + "return": [], + "description": "添加后处理效果,与graphics_settings/post_process.json定义的process等效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "example": "test = {\r\n \"name\": \"oldtv\",\r\n \"enable\": False,\r\n \"paras\": [\r\n { \"name\": \"density\", \"value\": 0.1, \"range\": [0.0, 1.0] },\r\n { \"name\": \"strength\", \"value\": 1.0, \"range\": [0.0, 1.0] },\r\n { \"name\": \"snow_size\", \"value\": 2.0, \"range\": [0.5, 16.0] },\r\n { \"name\": \"noise_fps\", \"value\": 6.0, \"range\": [0.01, 64.0] },\r\n { \"name\": \"black_zone\", \"value\": 0.2, \"range\": [0.0, 1.0] }\r\n ],\r\n \"pass_array\":[\r\n {\r\n \"render_target\":{\r\n \"width\":1.0,\r\n \"height\":1.0\r\n },\r\n \"material\":\"old_tv\"\r\n }\r\n ]\r\n}\r\nimport mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\nprint postComp.AddPostProcess(test, 5)", "params": [ { - "name": "processDict", - "type": "dict", + "type": "dict", + "name": "processDict", "description": "process的定义字典,格式参考graphics_settings/post_process.json" - }, + }, { - "name": "index", - "type": "int", + "type": "int", + "name": "index", "description": "插入位置下标,从0开始计数。可通过[GetPostProcessOrder接口](#getpostprocessorder)获取,缺省或负值则默认添加到最后。" } - ], - "return": [], - "example": "test = {\r\n \"name\": \"oldtv\",\r\n \"enable\": False,\r\n \"paras\": [\r\n { \"name\": \"density\", \"value\": 0.1, \"range\": [0.0, 1.0] },\r\n { \"name\": \"strength\", \"value\": 1.0, \"range\": [0.0, 1.0] },\r\n { \"name\": \"snow_size\", \"value\": 2.0, \"range\": [0.5, 16.0] },\r\n { \"name\": \"noise_fps\", \"value\": 6.0, \"range\": [0.01, 64.0] },\r\n { \"name\": \"black_zone\", \"value\": 0.2, \"range\": [0.0, 1.0] }\r\n ],\r\n \"pass_array\":[\r\n {\r\n \"render_target\":{\r\n \"width\":1.0,\r\n \"height\":1.0\r\n },\r\n \"material\":\"old_tv\"\r\n }\r\n ]\r\n}\r\nimport mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\nprint postComp.AddPostProcess(test, 5)" - }, + ], + "type": "api", + "side": "client", + "name": "AddPostProcess" + }, { - "type": "api", - "name": "CheckEnabledByName", - "method": "", - "description": "查询是否开启了自定义后处理效果", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "remark": "", + "return": [], + "description": "查询是否开启了自定义后处理效果", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 查询名为\"my_custom_postprocess\"的自定义后处理效果是否已经开启\r\nprint postComp.CheckEnabledByName(\"my_custom_postprocess\")", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "需要查询的后处理效果名,名称为graphics_settings/post_process.json中定义的后处理效果名" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 查询名为\"my_custom_postprocess\"的自定义后处理效果是否已经开启\r\nprint postComp.CheckEnabledByName(\"my_custom_postprocess\")" - }, + ], + "type": "api", + "side": "client", + "name": "CheckEnabledByName" + }, { - "type": "api", - "name": "GetParameter", - "method": "", - "description": "获取指定自定义后处理参数的值", - "remark": "- 该接口仅支持获取自定义后处理的参数。获取参数时,需要先开启过一次后处理才能成功获取。否则获取失败返回None。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "remark": "- 该接口仅支持获取自定义后处理的参数。获取参数时,需要先开启过一次后处理才能成功获取。否则获取失败返回None。", + "return": [], + "description": "获取指定自定义后处理参数的值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 获取自定义后处理\"my_custom_postprocess\"中名为“radius”的参数的值\r\nprint postComp.GetParameter(\"my_custom_postprocess\", \"radius\")", "params": [ { - "name": "postName", - "type": "str", + "type": "str", + "name": "postName", "description": "需要获取的后处理效果名,名称为graphics_settings/post_process.json中定义的后处理效果名" - }, + }, { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "需要的参数名,名称来自后处理效果定义中的paras字段" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 获取自定义后处理\"my_custom_postprocess\"中名为“radius”的参数的值\r\nprint postComp.GetParameter(\"my_custom_postprocess\", \"radius\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetParameter" + }, { - "type": "api", - "name": "GetPostProcessOrder", - "method": "", - "description": "获取后处理效果的渲染顺序", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\nprint postComp.GetPostProcessOrder()" - }, + "remark": "", + "return": [], + "description": "获取后处理效果的渲染顺序", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\nprint postComp.GetPostProcessOrder()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPostProcessOrder" + }, { - "type": "api", - "name": "InsertPassToPostprocess", - "method": "", - "description": "往自定义后处理的多pass中的指定位置插入自定义pass。多pass指定的是graphics_settings/post_process.json中的\"pass_array\"渲染pass数组。这个后处理会按照这个数组所定义的pass来逐个渲染,每个pass之间的像素输入输出相互连接,即pass数组中第一个pass所使用的fragment shader中的TEXTURE_0为游戏原始输出到屏幕的像素信息。下一个pass所使用的fragment shader中的TEXTURE_0为上一个Pass的fragment shader的输出。最后一个pass的fragment shader的输出即为输出到游戏屏幕的像素信息。", - "remark": "- 该接口仅支持对自定义后处理进行操作。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "remark": "- 该接口仅支持对自定义后处理进行操作。", + "return": [], + "description": "往自定义后处理的多pass中的指定位置插入自定义pass。多pass指定的是graphics_settings/post_process.json中的\"pass_array\"渲染pass数组。这个后处理会按照这个数组所定义的pass来逐个渲染,每个pass之间的像素输入输出相互连接,即pass数组中第一个pass所使用的fragment shader中的TEXTURE_0为游戏原始输出到屏幕的像素信息。下一个pass所使用的fragment shader中的TEXTURE_0为上一个Pass的fragment shader的输出。最后一个pass的fragment shader的输出即为输出到游戏屏幕的像素信息。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 自定义pass字典\r\npassDict = {\r\n # 渲染目标的分辨率大小,值范围为(0,1]。1.0表示全屏幕。\r\n \"render_target\":{\r\n \"width\":1.0,\r\n \"height\":1.0\r\n },\r\n # 这个自定义pass所使用的材质,定义在materials/postprocess.material中\r\n \"material\":\"scan_map\",\r\n # 可选,是否启动深度图。开启后可以在片元着色器中的使用TEXTURE_2拿到深度图。\r\n \"depth_enable\": True\r\n}\r\n# 往自定义后处理\"my_custom_postprocess\"中增加一个自定义pass,插入位置为第一个。\r\nprint postComp.InsertPassToPostprocess(\"my_custom_postprocess\", 0, passDict)", "params": [ { - "name": "postName", - "type": "str", + "type": "str", + "name": "postName", "description": "需要增加自定义pass的后处理效果名,名称为graphics_settings/post_process.json中定义的后处理效果名" - }, + }, { - "name": "index", - "type": "int", + "type": "int", + "name": "index", "description": "自定义pass插入的位置下标。下标的范围不能超过该自定义后处理目前包含的pass数组的大小,同时必须大于等于0。" - }, + }, { - "name": "passDict", - "type": "dict", + "type": "dict", + "name": "passDict", "description": "自定义pass的定义字典。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 自定义pass字典\r\npassDict = {\r\n # 渲染目标的分辨率大小,值范围为(0,1]。1.0表示全屏幕。\r\n \"render_target\":{\r\n \"width\":1.0,\r\n \"height\":1.0\r\n },\r\n # 这个自定义pass所使用的材质,定义在materials/postprocess.material中\r\n \"material\":\"scan_map\",\r\n # 可选,是否启动深度图。开启后可以在片元着色器中的使用TEXTURE_2拿到深度图。\r\n \"depth_enable\": True\r\n}\r\n# 往自定义后处理\"my_custom_postprocess\"中增加一个自定义pass,插入位置为第一个。\r\nprint postComp.InsertPassToPostprocess(\"my_custom_postprocess\", 0, passDict)" - }, + ], + "type": "api", + "side": "client", + "name": "InsertPassToPostprocess" + }, { - "type": "api", - "name": "PopBackPassInPostprocess", - "method": "", - "description": "删除自定义后处理的多pass的最末尾的pass。多pass指定的是graphics_settings/post_process.json中的\"pass_array\"渲染pass数组。这个后处理会按照这个数组所定义的pass来逐个渲染,每个pass之间的像素输入输出相互连接,即pass数组中第一个pass所使用的fragment shader中的TEXTURE_0为游戏原始输出到屏幕的像素信息。下一个pass所使用的fragment shader中的TEXTURE_0为上一个Pass的fragment shader的输出。最后一个pass的fragment shader的输出即为输出到游戏屏幕的像素信息。", - "remark": "- 该接口仅支持对自定义后处理进行操作。另外,由于python浮点数值精度问题,返回的数据字典中的浮点数可能会带有小数点后多位的现象,例如width的值原本为0.1,则返回的数据字典中width的值可能会变为0.10000000149,请注意。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "remark": "- 该接口仅支持对自定义后处理进行操作。另外,由于python浮点数值精度问题,返回的数据字典中的浮点数可能会带有小数点后多位的现象,例如width的值原本为0.1,则返回的数据字典中width的值可能会变为0.10000000149,请注意。", + "return": [], + "description": "删除自定义后处理的多pass的最末尾的pass。多pass指定的是graphics_settings/post_process.json中的\"pass_array\"渲染pass数组。这个后处理会按照这个数组所定义的pass来逐个渲染,每个pass之间的像素输入输出相互连接,即pass数组中第一个pass所使用的fragment shader中的TEXTURE_0为游戏原始输出到屏幕的像素信息。下一个pass所使用的fragment shader中的TEXTURE_0为上一个Pass的fragment shader的输出。最后一个pass的fragment shader的输出即为输出到游戏屏幕的像素信息。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 删除自定义后处理\"my_custom_postprocess\"中包含的多pass最末尾的自定义pass。\r\nprint postComp.PopBackPassInPostprocess(\"my_custom_postprocess\")", "params": [ { - "name": "postName", - "type": "str", + "type": "str", + "name": "postName", "description": "需要删除自定义pass的后处理效果名,名称为graphics_settings/post_process.json中定义的后处理效果名" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 删除自定义后处理\"my_custom_postprocess\"中包含的多pass最末尾的自定义pass。\r\nprint postComp.PopBackPassInPostprocess(\"my_custom_postprocess\")" - }, + ], + "type": "api", + "side": "client", + "name": "PopBackPassInPostprocess" + }, { - "type": "api", - "name": "PostPassResultToOtherPass", - "method": "", - "description": "将自定义pass的纹理结果传递到其他自定义pass的fragmentShader指定纹理单元槽位", - "remark": "- sourceProcessName的pass执行顺序必须在destProcessName的pass之前执行。sourceProcessName和destProcessName可相同", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "remark": "- sourceProcessName的pass执行顺序必须在destProcessName的pass之前执行。sourceProcessName和destProcessName可相同", + "return": [], + "description": "将自定义pass的纹理结果传递到其他自定义pass的fragmentShader指定纹理单元槽位", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 将名为test1的后处理效果中第一个pass处理完的纹理单元,发送给名为test2的后处理效果中第二个pass的fragmentShader中的纹理单元槽位3。\r\nprint postComp.PostPassResultToOtherPass(\"test1\", 0, \"test2\", 1, 3)\r\n# 将名为test1的后处理效果中第一个pass处理完的纹理单元,发送给名为test1的后处理效果中第二个pass的fragmentShader中的纹理单元槽位5。\r\nprint postComp.PostPassResultToOtherPass(\"test1\", 0, \"test1\", 1, 5)", "params": [ { - "name": "sourceProcessName", - "type": "str", + "type": "str", + "name": "sourceProcessName", "description": "发送纹理单元的自定义pass的后处理效果名,名称为graphics_settings/post_process.json中定义的后处理效果名" - }, + }, { - "name": "sourcePassIndex", - "type": "int", + "type": "int", + "name": "sourcePassIndex", "description": "源process中需要传递的自定义pass在process中的下标,从0开始计数。" - }, + }, { - "name": "destProcessName", - "type": "str", + "type": "str", + "name": "destProcessName", "description": "接收纹理单元的自定义pass的后处理效果名,名称为graphics_settings/post_process.json中定义的后处理效果名" - }, + }, { - "name": "destPassIndex", - "type": "int", + "type": "int", + "name": "destPassIndex", "description": "接收的process中自定义pass在process中的下标,从0开始计数。" - }, + }, { - "name": "glTextureIndex", - "type": "int", + "type": "int", + "name": "glTextureIndex", "description": "接收pass中framentShader中的纹理单元槽位,取值范围3~7,0~2已被占用,0为上个pass处理后的颜色缓冲,1为未做后处理的原始颜色缓冲,2为深度缓冲。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 将名为test1的后处理效果中第一个pass处理完的纹理单元,发送给名为test2的后处理效果中第二个pass的fragmentShader中的纹理单元槽位3。\r\nprint postComp.PostPassResultToOtherPass(\"test1\", 0, \"test2\", 1, 3)\r\n# 将名为test1的后处理效果中第一个pass处理完的纹理单元,发送给名为test1的后处理效果中第二个pass的fragmentShader中的纹理单元槽位5。\r\nprint postComp.PostPassResultToOtherPass(\"test1\", 0, \"test1\", 1, 5)" - }, + ], + "type": "api", + "side": "client", + "name": "PostPassResultToOtherPass" + }, { - "type": "api", - "name": "PushBackPassToPostprocess", - "method": "", - "description": "往自定义后处理的多pass最末尾插入自定义pass。多pass指定的是graphics_settings/post_process.json中的\"pass_array\"渲染pass数组。这个后处理会按照这个数组所定义的pass来逐个渲染,每个pass之间的像素输入输出相互连接,即pass数组中第一个pass所使用的fragment shader中的TEXTURE_0为游戏原始输出到屏幕的像素信息。下一个pass所使用的fragment shader中的TEXTURE_0为上一个Pass的fragment shader的输出。最后一个pass的fragment shader的输出即为输出到游戏屏幕的像素信息。", - "remark": "- 该接口仅支持对自定义后处理进行操作。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "remark": "- 该接口仅支持对自定义后处理进行操作。", + "return": [], + "description": "往自定义后处理的多pass最末尾插入自定义pass。多pass指定的是graphics_settings/post_process.json中的\"pass_array\"渲染pass数组。这个后处理会按照这个数组所定义的pass来逐个渲染,每个pass之间的像素输入输出相互连接,即pass数组中第一个pass所使用的fragment shader中的TEXTURE_0为游戏原始输出到屏幕的像素信息。下一个pass所使用的fragment shader中的TEXTURE_0为上一个Pass的fragment shader的输出。最后一个pass的fragment shader的输出即为输出到游戏屏幕的像素信息。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 自定义pass字典\r\npassDict = {\r\n # 渲染目标的分辨率大小,值范围为(0,1]。1.0表示全屏幕。\r\n \"render_target\":{\r\n \"width\":1.0,\r\n \"height\":1.0\r\n },\r\n # 这个自定义pass所使用的材质,定义在materials/postprocess.material中\r\n \"material\":\"scan_map\",\r\n # 可选,是否启动深度图。开启后可以在片元着色器中的使用TEXTURE_2拿到深度图。\r\n \"depth_enable\": true\r\n}\r\n# 往自定义后处理\"my_custom_postprocess\"中的包含的多pass最末尾增加一个自定义pass。\r\nprint postComp.PushBackPassToPostprocess(\"my_custom_postprocess\", passDict)", "params": [ { - "name": "postName", - "type": "str", + "type": "str", + "name": "postName", "description": "需要增加自定义pass的后处理效果名,名称为graphics_settings/post_process.json中定义的后处理效果名" - }, + }, { - "name": "passDict", - "type": "dict", + "type": "dict", + "name": "passDict", "description": "自定义pass的定义字典。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 自定义pass字典\r\npassDict = {\r\n # 渲染目标的分辨率大小,值范围为(0,1]。1.0表示全屏幕。\r\n \"render_target\":{\r\n \"width\":1.0,\r\n \"height\":1.0\r\n },\r\n # 这个自定义pass所使用的材质,定义在materials/postprocess.material中\r\n \"material\":\"scan_map\",\r\n # 可选,是否启动深度图。开启后可以在片元着色器中的使用TEXTURE_2拿到深度图。\r\n \"depth_enable\": true\r\n}\r\n# 往自定义后处理\"my_custom_postprocess\"中的包含的多pass最末尾增加一个自定义pass。\r\nprint postComp.PushBackPassToPostprocess(\"my_custom_postprocess\", passDict)" - }, + ], + "type": "api", + "side": "client", + "name": "PushBackPassToPostprocess" + }, { - "type": "api", - "name": "RemovePassInPostprocess", - "method": "", - "description": "删除自定义后处理的多pass中指定位置的pass。多pass指定的是graphics_settings/post_process.json中的\"pass_array\"渲染pass数组。这个后处理会按照这个数组所定义的pass来逐个渲染,每个pass之间的像素输入输出相互连接,即pass数组中第一个pass所使用的fragment shader中的TEXTURE_0为游戏原始输出到屏幕的像素信息。下一个pass所使用的fragment shader中的TEXTURE_0为上一个Pass的fragment shader的输出。最后一个pass的fragment shader的输出即为输出到游戏屏幕的像素信息。", - "remark": "- 该接口仅支持对自定义后处理进行操作。另外,由于python浮点数值精度问题,返回的数据字典中的浮点数可能会带有小数点后多位的现象,例如width的值原本为0.1,则返回的数据字典中width的值可能会变为0.10000000149,请注意。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "remark": "- 该接口仅支持对自定义后处理进行操作。另外,由于python浮点数值精度问题,返回的数据字典中的浮点数可能会带有小数点后多位的现象,例如width的值原本为0.1,则返回的数据字典中width的值可能会变为0.10000000149,请注意。", + "return": [], + "description": "删除自定义后处理的多pass中指定位置的pass。多pass指定的是graphics_settings/post_process.json中的\"pass_array\"渲染pass数组。这个后处理会按照这个数组所定义的pass来逐个渲染,每个pass之间的像素输入输出相互连接,即pass数组中第一个pass所使用的fragment shader中的TEXTURE_0为游戏原始输出到屏幕的像素信息。下一个pass所使用的fragment shader中的TEXTURE_0为上一个Pass的fragment shader的输出。最后一个pass的fragment shader的输出即为输出到游戏屏幕的像素信息。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 删除自定义后处理\"my_custom_postprocess\"中包含的多pass中第二个自定义pass。\r\nprint postComp.RemovePassInPostprocess(\"my_custom_postprocess\", 1)", "params": [ { - "name": "postName", - "type": "str", + "type": "str", + "name": "postName", "description": "需要删除自定义pass的后处理效果名,名称为graphics_settings/post_process.json中定义的后处理效果名" - }, + }, { - "name": "index", - "type": "int", + "type": "int", + "name": "index", "description": "需要删除的自定义pass的位置下标。下标的范围不能大于或等于该自定义后处理目前包含的pass数组的大小,同时必须大于等于0。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 删除自定义后处理\"my_custom_postprocess\"中包含的多pass中第二个自定义pass。\r\nprint postComp.RemovePassInPostprocess(\"my_custom_postprocess\", 1)" - }, + ], + "type": "api", + "side": "client", + "name": "RemovePassInPostprocess" + }, { - "type": "api", - "name": "SetEnableByName", - "method": "", - "description": "设置是否开启自定义后处理效果", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "remark": "", + "return": [], + "description": "设置是否开启自定义后处理效果", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\npostComp.SetEnableByName(myPostName, True)", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "后处理效果名,名称为graphics_settings/post_process.json中定义的后处理效果名" - }, + }, { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否开启自定义效果,True为开启,False为关闭。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\npostComp.SetEnableByName(myPostName, True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetEnableByName" + }, { - "type": "api", - "name": "SetParameter", - "method": "", - "description": "设置自定义后处理shader的自定义参数值", - "remark": "- 该接口仅支持修改自定义后处理的参数", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "remark": "- 该接口仅支持修改自定义后处理的参数", + "return": [], + "description": "设置自定义后处理shader的自定义参数值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/自定义.md", + "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\npostComp.SetParameter(myPostName, paramName, [0.0, 0.0, 0.0]) # 设置某个三维参数值为全0向量", "params": [ { - "name": "postName", - "type": "str", + "type": "str", + "name": "postName", "description": "要修改的后处理效果名,名称为graphics_settings/post_process.json中定义的后处理效果名" - }, + }, { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "要修改的参数名,名称来自后处理效果定义中的paras字段" - }, + }, { - "name": "paramValue", - "type": "any", + "type": "any", + "name": "paramValue", "description": "修改后的后处理参数值,长度必须与post_process.json中对应的参数定义一致(float/list/tuple)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npostComp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\npostComp.SetParameter(myPostName, paramName, [0.0, 0.0, 0.0]) # 设置某个三维参数值为全0向量" - }, + ], + "type": "api", + "side": "client", + "name": "SetParameter" + }, { - "type": "api", - "name": "CheckColorAdjustmentEnabled", - "method": "", - "description": "检测是否开启了色彩校正效果。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/色彩.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.CheckColorAdjustmentEnabled()" - }, + "remark": "", + "return": [], + "description": "检测是否开启了色彩校正效果。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/色彩.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.CheckColorAdjustmentEnabled()", + "params": [], + "type": "api", + "side": "client", + "name": "CheckColorAdjustmentEnabled" + }, { - "type": "api", - "name": "SetColorAdjustmentBrightness", - "method": "", - "description": "调整屏幕色彩亮度,亮度值越大,屏幕越亮,反之则越暗。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/色彩.md", + "remark": "", + "return": [], + "description": "调整屏幕色彩亮度,亮度值越大,屏幕越亮,反之则越暗。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/色彩.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整亮度值为3\r\ncomp.SetColorAdjustmentBrightness(3)", "params": [ { - "name": "brightness", - "type": "float", + "type": "float", + "name": "brightness", "description": "亮度值大小,值的范围为[0,5],小于或大于这个范围的值将被截取为边界值0或5" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整亮度值为3\r\ncomp.SetColorAdjustmentBrightness(3)" - }, + ], + "type": "api", + "side": "client", + "name": "SetColorAdjustmentBrightness" + }, { - "type": "api", - "name": "SetColorAdjustmentContrast", - "method": "", - "description": "调整屏幕色彩对比度,屏幕对比度值越大,色彩差异则越明显,反之则色彩差异越小。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/色彩.md", + "remark": "", + "return": [], + "description": "调整屏幕色彩对比度,屏幕对比度值越大,色彩差异则越明显,反之则色彩差异越小。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/色彩.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整对比度值为3\r\ncomp.SetColorAdjustmentContrast(3)", "params": [ { - "name": "contrast", - "type": "float", + "type": "float", + "name": "contrast", "description": "对比度值大小,值的范围为[0,5],小于或大于这个范围的值将被截取为边界值0或5" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整对比度值为3\r\ncomp.SetColorAdjustmentContrast(3)" - }, + ], + "type": "api", + "side": "client", + "name": "SetColorAdjustmentContrast" + }, { - "type": "api", - "name": "SetColorAdjustmentSaturation", - "method": "", - "description": "调整屏幕色彩饱和度,屏幕饱和度值越大,色彩则越明显,反之则越灰暗。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/色彩.md", + "remark": "", + "return": [], + "description": "调整屏幕色彩饱和度,屏幕饱和度值越大,色彩则越明显,反之则越灰暗。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/色彩.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整饱和度值为3\r\ncomp.SetColorAdjustmentSaturation(3)", "params": [ { - "name": "saturation", - "type": "float", + "type": "float", + "name": "saturation", "description": "饱和度值大小,值的范围为[0,5],小于或大于这个范围的值将被截取为边界值0或5" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整饱和度值为3\r\ncomp.SetColorAdjustmentSaturation(3)" - }, + ], + "type": "api", + "side": "client", + "name": "SetColorAdjustmentSaturation" + }, { - "type": "api", - "name": "SetColorAdjustmentTint", - "method": "", - "description": "调整屏幕色彩的色调,根据输入的色调和强度来调整屏幕色彩,当强度越大时,屏幕整体颜色越偏向输入的色调。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/色彩.md", + "remark": "", + "return": [], + "description": "调整屏幕色彩的色调,根据输入的色调和强度来调整屏幕色彩,当强度越大时,屏幕整体颜色越偏向输入的色调。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/色彩.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整屏幕色调为偏红色,强度为0.3\r\ncomp.SetColorAdjustmentTint(0.3, (255,0,0))", "params": [ { - "name": "intensity", - "type": "float", + "type": "float", + "name": "intensity", "description": "色调强度,值的范围为[0,1],小于或大于这个范围的值将被截取为边界值0或1" - }, + }, { - "name": "color", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "color", "description": "色调值,按顺序分别为颜色的RGB值,值的范围为[0,255],小于或大于这个范围的值将被截取为边界值0或255" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整屏幕色调为偏红色,强度为0.3\r\ncomp.SetColorAdjustmentTint(0.3, (255,0,0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetColorAdjustmentTint" + }, { - "type": "api", - "name": "SetEnableColorAdjustment", - "method": "", - "description": "设置是否开启色彩校正效果,开启后可进行屏幕色彩调整,可通过色彩校正效果其他接口设置效果参数。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/色彩.md", + "remark": "", + "return": [], + "description": "设置是否开启色彩校正效果,开启后可进行屏幕色彩调整,可通过色彩校正效果其他接口设置效果参数。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/色彩.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.SetEnableColorAdjustment(True)", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否开启色彩校正效果,True为开启,False为关闭。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.SetEnableColorAdjustment(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetEnableColorAdjustment" + }, { - "type": "api", - "name": "CheckDepthOfFieldEnabled", - "method": "", - "description": "检测是否开启了景深效果。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.CheckDepthOfFieldEnabled()" - }, + "remark": "", + "return": [], + "description": "检测是否开启了景深效果。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.CheckDepthOfFieldEnabled()", + "params": [], + "type": "api", + "side": "client", + "name": "CheckDepthOfFieldEnabled" + }, { - "type": "api", - "name": "CheckLensStainEnabled", - "method": "", - "description": "检测是否开启了镜头污迹效果。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.CheckLensStainEnabled()" - }, + "remark": "", + "return": [], + "description": "检测是否开启了镜头污迹效果。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.CheckLensStainEnabled()", + "params": [], + "type": "api", + "side": "client", + "name": "CheckLensStainEnabled" + }, { - "type": "api", - "name": "ResetLensStainTexture", - "method": "", - "description": "重置污迹效果使用的贴图为系统默认贴图。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.ResetLensStainTexture()" - }, + "remark": "", + "return": [], + "description": "重置污迹效果使用的贴图为系统默认贴图。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.ResetLensStainTexture()", + "params": [], + "type": "api", + "side": "client", + "name": "ResetLensStainTexture" + }, { - "type": "api", - "name": "SetDepthOfFieldBlurRadius", - "method": "", - "description": "调整景深效果模糊半径,模糊半径越大,模糊程度越大,反之则越小。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "remark": "", + "return": [], + "description": "调整景深效果模糊半径,模糊半径越大,模糊程度越大,反之则越小。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整模糊半径值为0.3\r\ncomp.SetDepthOfFieldBlurRadius(0.3)", "params": [ { - "name": "radius", - "type": "float", + "type": "float", + "name": "radius", "description": "模糊半径值大小,值的范围为[0,5],小于或大于这个范围的值将被截取为边界值0或5" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整模糊半径值为0.3\r\ncomp.SetDepthOfFieldBlurRadius(0.3)" - }, + ], + "type": "api", + "side": "client", + "name": "SetDepthOfFieldBlurRadius" + }, { - "type": "api", - "name": "SetDepthOfFieldFarBlurScale", - "method": "", - "description": "调整景深效果远景模糊大小,远景模糊大小越大,远景的模糊程度越大,反之则越小。注意,远景模糊程度的调节依赖于焦点距离,如果焦点处于较近的距离,那么此时远景处于较清晰的状态,模糊程度大小调节不会很明显。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "remark": "", + "return": [], + "description": "调整景深效果远景模糊大小,远景模糊大小越大,远景的模糊程度越大,反之则越小。注意,远景模糊程度的调节依赖于焦点距离,如果焦点处于较近的距离,那么此时远景处于较清晰的状态,模糊程度大小调节不会很明显。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整远景模糊大小值为1.0\r\ncomp.SetDepthOfFieldFarBlurScale(1.0)", "params": [ { - "name": "scale", - "type": "float", + "type": "float", + "name": "scale", "description": "远景模糊大小,值的范围为[0,15],小于或大于这个范围的值将被截取为边界值0或15" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整远景模糊大小值为1.0\r\ncomp.SetDepthOfFieldFarBlurScale(1.0)" - }, + ], + "type": "api", + "side": "client", + "name": "SetDepthOfFieldFarBlurScale" + }, { - "type": "api", - "name": "SetDepthOfFieldFocusDistance", - "method": "", - "description": "调整景深效果焦点距离,距离越小,则远处模糊,近处清晰;距离越大,则远处清晰,近处模糊。该距离为实际距离,即以玩家相机为起点的世界坐标距离。", - "remark": "- 如果想要较好地确认聚焦平面的位置,可以先使用SetDepthOfFieldNearBlurScale以及SetDepthOfFieldFarBlurScale将近景模糊大小和远景模糊大小均设置到最大值,此时只有聚焦平面所在的区域显得清晰,这样可以较为直观的看到聚焦平面的位置,从而方便地调节聚焦平面距离。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "remark": "- 如果想要较好地确认聚焦平面的位置,可以先使用SetDepthOfFieldNearBlurScale以及SetDepthOfFieldFarBlurScale将近景模糊大小和远景模糊大小均设置到最大值,此时只有聚焦平面所在的区域显得清晰,这样可以较为直观的看到聚焦平面的位置,从而方便地调节聚焦平面距离。", + "return": [], + "description": "调整景深效果焦点距离,距离越小,则远处模糊,近处清晰;距离越大,则远处清晰,近处模糊。该距离为实际距离,即以玩家相机为起点的世界坐标距离。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整焦点距离值为4,即聚焦在距离玩家4个方块边长的位置上\r\ncomp.SetDepthOfFieldFocusDistance(4)", "params": [ { - "name": "distance", - "type": "float", + "type": "float", + "name": "distance", "description": "焦点距离值大小,值的范围为[0,100],小于或大于这个范围的值将被截取为边界值0或100。距离值接近100时将被视为无限远的远景。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整焦点距离值为4,即聚焦在距离玩家4个方块边长的位置上\r\ncomp.SetDepthOfFieldFocusDistance(4)" - }, + ], + "type": "api", + "side": "client", + "name": "SetDepthOfFieldFocusDistance" + }, { - "type": "api", - "name": "SetDepthOfFieldNearBlurScale", - "method": "", - "description": "调整景深效果近景模糊大小,近景模糊大小越大,近景的模糊程度越大,反之则越小。注意,近景模糊程度的调节依赖于焦点距离,如果焦点处于较近的距离,那么此时近景处于较清晰的状态,模糊程度大小调节不会很明显。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "remark": "", + "return": [], + "description": "调整景深效果近景模糊大小,近景模糊大小越大,近景的模糊程度越大,反之则越小。注意,近景模糊程度的调节依赖于焦点距离,如果焦点处于较近的距离,那么此时近景处于较清晰的状态,模糊程度大小调节不会很明显。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整近景模糊大小值为1.0\r\ncomp.SetDepthOfFieldNearBlurScale(1.0)", "params": [ { - "name": "scale", - "type": "float", + "type": "float", + "name": "scale", "description": "近景模糊大小,值的范围为[0,15],小于或大于这个范围的值将被截取为边界值0或15" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整近景模糊大小值为1.0\r\ncomp.SetDepthOfFieldNearBlurScale(1.0)" - }, + ], + "type": "api", + "side": "client", + "name": "SetDepthOfFieldNearBlurScale" + }, { - "type": "api", - "name": "SetDepthOfFieldUseCenterFocus", - "method": "", - "description": "设置景深效果是否开启屏幕中心聚焦模式,开启后聚焦距离将被自动设置为屏幕中心所对应的物体所在的距离。在第一人称视角下,聚焦距离将被自动设置为屏幕准心所对应的物体与相机的距离,即自动聚焦准心所对应的物体。在第三人称视角下,由于屏幕中心总是对应着玩家,因此聚焦距离将被自动设置为玩家与相机的距离,即自动聚焦在玩家自己。", - "remark": "- 同样,如果想要较好地确认聚焦点所在的位置,可以先使用SetDepthOfFieldNearBlurScale以及SetDepthOfFieldFarBlurScale将近景模糊大小和远景模糊大小均设置到最大值,此时只有聚焦平面所在的区域显得清晰,这样可以较为直观的看到聚焦平面的位置,从而方便地调节聚焦平面距离。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "remark": "- 同样,如果想要较好地确认聚焦点所在的位置,可以先使用SetDepthOfFieldNearBlurScale以及SetDepthOfFieldFarBlurScale将近景模糊大小和远景模糊大小均设置到最大值,此时只有聚焦平面所在的区域显得清晰,这样可以较为直观的看到聚焦平面的位置,从而方便地调节聚焦平面距离。", + "return": [], + "description": "设置景深效果是否开启屏幕中心聚焦模式,开启后聚焦距离将被自动设置为屏幕中心所对应的物体所在的距离。在第一人称视角下,聚焦距离将被自动设置为屏幕准心所对应的物体与相机的距离,即自动聚焦准心所对应的物体。在第三人称视角下,由于屏幕中心总是对应着玩家,因此聚焦距离将被自动设置为玩家与相机的距离,即自动聚焦在玩家自己。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 开启屏幕中心聚焦模式\r\ncomp.SetDepthOfFieldUseCenterFocus(True)", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否开启景深效果屏幕中心聚焦模式,True为开启,False为关闭。开启后,原有的焦点距离设置将不再有效,接口SetDepthOfFieldFocusDistance也将失效。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 开启屏幕中心聚焦模式\r\ncomp.SetDepthOfFieldUseCenterFocus(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetDepthOfFieldUseCenterFocus" + }, { - "type": "api", - "name": "SetEnableDepthOfField", - "method": "", - "description": "设置是否开启景深效果,开启后屏幕出现景深效果,根据焦点距离呈现远处模糊近处清晰或者近处模糊远处清晰的效果。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "remark": "", + "return": [], + "description": "设置是否开启景深效果,开启后屏幕出现景深效果,根据焦点距离呈现远处模糊近处清晰或者近处模糊远处清晰的效果。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.SetEnableDepthOfField(True)", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否开启景深效果,True为开启,False为关闭。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.SetEnableDepthOfField(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetEnableDepthOfField" + }, { - "type": "api", - "name": "SetEnableLensStain", - "method": "", - "description": "设置是否开启镜头污迹效果,开启后镜头出现污迹效果,可改变使用的污迹贴图及污迹颜色。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "remark": "", + "return": [], + "description": "设置是否开启镜头污迹效果,开启后镜头出现污迹效果,可改变使用的污迹贴图及污迹颜色。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.SetEnableLensStain(True)", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否开启镜头污迹效果,True为开启,False为关闭。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\ncomp.SetEnableLensStain(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetEnableLensStain" + }, { - "type": "api", - "name": "SetLensStainColor", - "method": "", - "description": "调整镜头污迹颜色,根据输入的颜色和强度来调整污迹色彩,当强度越大时,污迹颜色越偏向输入的颜色。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "remark": "", + "return": [], + "description": "调整镜头污迹颜色,根据输入的颜色和强度来调整污迹色彩,当强度越大时,污迹颜色越偏向输入的颜色。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整镜头污迹颜色为偏红色,强度为0.3\r\ncomp.SetLensStainColor(0.3, (255,0,0))", "params": [ { - "name": "intensity", - "type": "float", + "type": "float", + "name": "intensity", "description": "颜色强度,值的范围为[0,1],小于或大于这个范围的值将被截取为边界值0或1" - }, + }, { - "name": "color", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "color", "description": "颜色值,按顺序分别为颜色的RGB值,值的范围为[0,255],小于或大于这个范围的值将被截取为边界值0或255" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整镜头污迹颜色为偏红色,强度为0.3\r\ncomp.SetLensStainColor(0.3, (255,0,0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetLensStainColor" + }, { - "type": "api", - "name": "SetLensStainIntensity", - "method": "", - "description": "调整镜头污迹强度,强度越大,污迹越明显,反之则越透明。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "remark": "", + "return": [], + "description": "调整镜头污迹强度,强度越大,污迹越明显,反之则越透明。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整污迹强度值为0.4\r\ncomp.SetLensStainIntensity(0.4)", "params": [ { - "name": "intensity", - "type": "float", + "type": "float", + "name": "intensity", "description": "镜头污迹强度值大小,值的范围为[0,1],小于或大于这个范围的值将被截取为边界值0或1" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 调整污迹强度值为0.4\r\ncomp.SetLensStainIntensity(0.4)" - }, + ], + "type": "api", + "side": "client", + "name": "SetLensStainIntensity" + }, { - "type": "api", - "name": "SetLensStainTexture", - "method": "", - "description": "开启镜头污迹效果后,污迹效果使用的为系统默认贴图。该接口可改变镜头污迹所使用的贴图。注意贴图最好使用透明背景,否则屏幕将被贴图覆盖。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "remark": "", + "return": [], + "description": "开启镜头污迹效果后,污迹效果使用的为系统默认贴图。该接口可改变镜头污迹所使用的贴图。注意贴图最好使用透明背景,否则屏幕将被贴图覆盖。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/后处理/镜头效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 改变污迹贴图为textures/postprocess目录下的my_dirtiness.png。\r\ncomp.SetLensStainTexture(\"textures/postprocess/my_dirtiness\")", "params": [ { - "name": "texturePath", - "type": "str", + "type": "str", + "name": "texturePath", "description": "贴图的相对路径,以“textures/\"开头,不需要后缀名" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePostProcess(levelId)\r\n# 改变污迹贴图为textures/postprocess目录下的my_dirtiness.png。\r\ncomp.SetLensStainTexture(\"textures/postprocess/my_dirtiness\")" - }, + ], + "type": "api", + "side": "client", + "name": "SetLensStainTexture" + }, { - "type": "event", - "name": "CloseShopWindow", - "method": "", - "description": "关闭网易商城窗口", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/商城.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "关闭网易商城窗口", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/商城.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "CloseShopWindow" + }, { - "type": "event", - "name": "HideShopGate", - "method": "", - "description": "隐藏网易商城入口", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/商城.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "隐藏网易商城入口", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/商城.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "HideShopGate" + }, { - "type": "event", - "name": "OpenItemDetailWindow", - "method": "", - "description": "打开特定商品的详情界面", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/商城.md", + "remark": "", + "return": [], + "description": "打开特定商品的详情界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/商城.md", + "example": "", "params": [ { - "name": "categoryName", - "type": "str", + "type": "str", + "name": "categoryName", "description": "商品分类名称" - }, + }, { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "商品名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "OpenItemDetailWindow" + }, { - "type": "event", - "name": "OpenShopWindow", - "method": "", - "description": "打开网易商城窗口。PC端无效(Apollo的PC端请使用商城插件)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/商城.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "打开网易商城窗口。PC端无效(Apollo的PC端请使用商城插件)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/商城.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "OpenShopWindow" + }, { - "type": "event", - "name": "ShowShopGate", - "method": "", - "description": "显示网易商城入口", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/商城.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "显示网易商城入口", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/商城.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "ShowShopGate" + }, { - "type": "api", - "name": "EvalMolangExpression", - "method": "", - "description": "在实体上下文上执行molang表达式", - "remark": "- 本接口执行时没有渲染上下文,某些molang无法通过该种方式获取到正确的值,如query.actor_count【获取最近一帧渲染实体数量】 会永远返回0。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "remark": "- 本接口执行时没有渲染上下文,某些molang无法通过该种方式获取到正确的值,如query.actor_count【获取最近一帧渲染实体数量】 会永远返回0。", + "return": [], + "description": "在实体上下文上执行molang表达式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(entityId)\r\nresult = comp.EvalMolangExpression('query.can_fly')", "params": [ { - "name": "expression", - "type": "str", + "type": "str", + "name": "expression", "description": "molang表达式" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(entityId)\r\nresult = comp.EvalMolangExpression('query.can_fly')" - }, + ], + "type": "api", + "side": "client", + "name": "EvalMolangExpression" + }, { - "type": "api", - "name": "Get", - "method": "", - "description": "获取某一个实体计算节点的值,如果不存在返回注册时的默认值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "remark": "", + "return": [], + "description": "获取某一个实体计算节点的值,如果不存在返回注册时的默认值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(entityId)\r\nresult = comp.Get('query.mod.state')", "params": [ { - "name": "variableName", - "type": "str", + "type": "str", + "name": "variableName", "description": "节点名称,必须以\"query.mod.\"开头" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(entityId)\r\nresult = comp.Get('query.mod.state')" - }, + ], + "type": "api", + "side": "client", + "name": "Get" + }, { - "type": "api", - "name": "GetMolangValue", - "method": "", - "description": "获取实体molang变量的值", - "remark": "- 因为没有渲染上下文,某些molang无法通过该种方式获取到正确的值,如query.is_first_person、variable.is_first_person等。\r\n - 当molangName传入query.get_name或者query.owner_identifier等需要返回字符串的变量值时,返回其hash64,类型是个long,可以用于与GetStringHash64获取的值比较。query.get_name:返回生物的名字;query.owner_identifier:返回其owner的identifier\r\n - 该接口无法进行molang运算,例如无法计算query.average_frame_time(20)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "remark": "- 因为没有渲染上下文,某些molang无法通过该种方式获取到正确的值,如query.is_first_person、variable.is_first_person等。\r\n - 当molangName传入query.get_name或者query.owner_identifier等需要返回字符串的变量值时,返回其hash64,类型是个long,可以用于与GetStringHash64获取的值比较。query.get_name:返回生物的名字;query.owner_identifier:返回其owner的identifier\r\n - 该接口无法进行molang运算,例如无法计算query.average_frame_time(20)", + "return": [], + "description": "获取实体molang变量的值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(entityId)\r\nresult = comp.GetMolangValue('query.can_fly')", "params": [ { - "name": "molangName", - "type": "str", + "type": "str", + "name": "molangName", "description": "molang变量名称,如query.can_fly" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(entityId)\r\nresult = comp.GetMolangValue('query.can_fly')" - }, + ], + "type": "api", + "side": "client", + "name": "GetMolangValue" + }, { - "type": "api", - "name": "GetStringHash64", - "method": "", - "description": "返回字符串变量的hash64", - "remark": "- 可以配合GetMolangValue使用,可以获取query.get_name或者query.owner_identifier等返回hash64的是不是等于某个值", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "remark": "- 可以配合GetMolangValue使用,可以获取query.get_name或者query.owner_identifier等返回hash64的是不是等于某个值", + "return": [], + "description": "返回字符串变量的hash64", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(levelId)\r\nresult = comp.GetStringHash64('steve')", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "需要计算的字符串变量,如“steve\"" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(levelId)\r\nresult = comp.GetStringHash64('steve')" - }, + ], + "type": "api", + "side": "client", + "name": "GetStringHash64" + }, { - "type": "api", - "name": "Register", - "method": "", - "description": "注册实体计算节点", - "remark": "- 注意节点的值使用单精度浮点数存储,如果用来设置整数,那么值大于16777216(或小于-16777216)时就会有误差", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "remark": "- 注意节点的值使用单精度浮点数存储,如果用来设置整数,那么值大于16777216(或小于-16777216)时就会有误差", + "return": [], + "description": "注册实体计算节点", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(levelId)\r\nresult = comp.Register('query.mod.state', 0.0)", "params": [ { - "name": "variableName", - "type": "str", + "type": "str", + "name": "variableName", "description": "节点名称,必须以\"query.mod.\"开头" - }, + }, { - "name": "defalutValue", - "type": "float", + "type": "float", + "name": "defalutValue", "description": "默认值" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(levelId)\r\nresult = comp.Register('query.mod.state', 0.0)" - }, + ], + "type": "api", + "side": "client", + "name": "Register" + }, { - "type": "api", - "name": "Set", - "method": "", - "description": "设置某一个实体计算节点的值", - "remark": "- 注意节点的值使用单精度浮点数存储,如果用来设置整数,那么值大于16777216(或小于-16777216)时就会有误差", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "remark": "- 注意节点的值使用单精度浮点数存储,如果用来设置整数,那么值大于16777216(或小于-16777216)时就会有误差", + "return": [], + "description": "设置某一个实体计算节点的值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(entityId)\r\nresult = comp.Set('query.mod.state', 1.0)", "params": [ { - "name": "variableName", - "type": "str", + "type": "str", + "name": "variableName", "description": "节点名称,必须以\"query.mod.\"开头" - }, + }, { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "计算节点的值" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(entityId)\r\nresult = comp.Set('query.mod.state', 1.0)" - }, + ], + "type": "api", + "side": "client", + "name": "Set" + }, { - "type": "api", - "name": "UnRegister", - "method": "", - "description": "注销实体计算节点", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "remark": "", + "return": [], + "description": "注销实体计算节点", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/molang.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(levelId)\r\nresult = comp.UnRegister('query.mod.state')", "params": [ { - "name": "variableName", - "type": "str", + "type": "str", + "name": "variableName", "description": "节点名称,必须以\"query.mod.\"开头" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateQueryVariable(levelId)\r\nresult = comp.UnRegister('query.mod.state')" - }, + ], + "type": "api", + "side": "client", + "name": "UnRegister" + }, { - "type": "api", - "name": "Disable", - "method": "", - "description": "关闭官方伙伴功能,单人游戏以及本地联机不支持该接口", - "remark": "- 请在mod初始化时调用", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方伙伴.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePet(levelId)\r\ncomp.Disable()" - }, + "remark": "- 请在mod初始化时调用", + "return": [], + "description": "关闭官方伙伴功能,单人游戏以及本地联机不支持该接口", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方伙伴.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePet(levelId)\r\ncomp.Disable()", + "params": [], + "type": "api", + "side": "server", + "name": "Disable" + }, { - "type": "api", - "name": "Enable", - "method": "", - "description": "启用官方伙伴功能,单人游戏以及本地联机不支持该接口", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方伙伴.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePet(levelId)\r\ncomp.Enable()" - }, + "remark": "", + "return": [], + "description": "启用官方伙伴功能,单人游戏以及本地联机不支持该接口", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方伙伴.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePet(levelId)\r\ncomp.Enable()", + "params": [], + "type": "api", + "side": "server", + "name": "Enable" + }, { - "type": "api", - "name": "AddCommonPhrases", - "method": "", - "description": "为官方聊天扩展功能添加常用短语。单人模式下单个模组最多添加12条,联机大厅和网络服无条数限制。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", + "remark": "", + "return": [], + "description": "为官方聊天扩展功能添加常用短语。单人模式下单个模组最多添加12条,联机大厅和网络服无条数限制。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.AddCommonPhrases(1001, \"大家一起合作吧\")", "params": [ { - "name": "id", - "type": "int", + "type": "int", + "name": "id", "description": "聊天短语的唯一id,若使用了相同的id会覆盖原有文本内容" - }, + }, { - "name": "content", - "type": "str", + "type": "str", + "name": "content", "description": "聊天短语的文本内容,文本字数限制20,超出时添加失败" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.AddCommonPhrases(1001, \"大家一起合作吧\")" - }, + ], + "type": "api", + "side": "server", + "name": "AddCommonPhrases" + }, { - "type": "api", - "name": "Disable", - "method": "", - "description": "关闭官方聊天扩展功能。需要在ClientLoadAddonsFinishServerEvent事件中调用。仅在联机大厅和网络服中生效。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.Disable()" - }, + "remark": "", + "return": [], + "description": "关闭官方聊天扩展功能。需要在ClientLoadAddonsFinishServerEvent事件中调用。仅在联机大厅和网络服中生效。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.Disable()", + "params": [], + "type": "api", + "side": "server", + "name": "Disable" + }, { - "type": "api", - "name": "Enable", - "method": "", - "description": "启用官方聊天扩展功能。需要在ClientLoadAddonsFinishServerEvent事件中调用。仅在联机大厅和网络服中生效。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.Enable()" - }, + "remark": "", + "return": [], + "description": "启用官方聊天扩展功能。需要在ClientLoadAddonsFinishServerEvent事件中调用。仅在联机大厅和网络服中生效。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.Enable()", + "params": [], + "type": "api", + "side": "server", + "name": "Enable" + }, { - "type": "api", - "name": "RegisterChatPrefix", - "method": "", - "description": "为游戏内指定玩家注册聊天前缀。仅在主界面消息框和聊天界面游戏频道生效。建议在AddServerPlayerEvent事件中调用,为新玩家添加前缀。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", + "remark": "", + "return": [], + "description": "为游戏内指定玩家注册聊天前缀。仅在主界面消息框和聊天界面游戏频道生效。建议在AddServerPlayerEvent事件中调用,为新玩家添加前缀。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.RegisterChatPrefix(\"魔王\", serverApi.GenerateColor('RED'))", "params": [ { - "name": "prefix", - "type": "str", + "type": "str", + "name": "prefix", "description": "聊天前缀文本。字数限制10,超出部分舍弃尾部字符。若在前缀文本中额外使用颜色代码会导致prefixColor参数失效,颜色代码同样占用字数限制。" - }, + }, { - "name": "prefixColor", - "type": "str", + "type": "str", + "name": "prefixColor", "description": "聊天前缀文本颜色代码。可以使用GenerateColor接口传入参数" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.RegisterChatPrefix(\"魔王\", serverApi.GenerateColor('RED'))" - }, + ], + "type": "api", + "side": "server", + "name": "RegisterChatPrefix" + }, { - "type": "api", - "name": "RemoveCommonPhrases", - "method": "", - "description": "为官方聊天扩展功能移除常用短语。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", + "remark": "", + "return": [], + "description": "为官方聊天扩展功能移除常用短语。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.RemoveCommonPhrases(1001)", "params": [ { - "name": "id", - "type": "int", + "type": "int", + "name": "id", "description": "聊天短语的唯一id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.RemoveCommonPhrases(1001)" - }, + ], + "type": "api", + "side": "server", + "name": "RemoveCommonPhrases" + }, { - "type": "api", - "name": "SetShowOfficialPhrases", - "method": "", - "description": "设置是否显示官方的常用聊天短语。仅在联机大厅和网络服中生效。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", + "remark": "", + "return": [], + "description": "设置是否显示官方的常用聊天短语。仅在联机大厅和网络服中生效。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.SetShowOfficialPhrases(False) # 不显示", "params": [ { - "name": "show", - "type": "bool", + "type": "bool", + "name": "show", "description": "是否显示" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.SetShowOfficialPhrases(False) # 不显示" - }, + ], + "type": "api", + "side": "server", + "name": "SetShowOfficialPhrases" + }, { - "type": "api", - "name": "SetShowSocialNearbyInfo", - "method": "", - "description": "设置是否显示官方聊天社交界面中同一游戏玩家是否在附近信息。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", + "remark": "", + "return": [], + "description": "设置是否显示官方聊天社交界面中同一游戏玩家是否在附近信息。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/官方聊天扩展.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.SetShowSocialNearbyInfo(False) # 不显示", "params": [ { - "name": "show", - "type": "bool", + "type": "bool", + "name": "show", "description": "是否显示" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId)\r\ncomp.SetShowSocialNearbyInfo(False) # 不显示" - }, + ], + "type": "api", + "side": "server", + "name": "SetShowSocialNearbyInfo" + }, { - "type": "api", - "name": "GetEngineType", - "method": "", - "description": "获取实体类型,主要用于判断实体是否属于某一类型的生物。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/实体类型.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nfrom mod_log import logger as logger\r\ncomp = clientApi.GetEngineCompFactory().CreateEngineType(entityId)\r\nentityType = comp.GetEngineType()\r\nEntityTypeEnum = clientApi.GetMinecraftEnum().EntityType\r\n# 判断是否是生物(Mob)\r\nif entityType & EntityTypeEnum.Mob == EntityTypeEnum.Mob:\r\n logger.info(\"{} is Mob\".format(comp.GetEngineTypeStr()))\r\n# 判断是否是弹射物(Projectile)\r\nif entityType & EntityTypeEnum.Projectile == EntityTypeEnum.Projectile:\r\n logger.info(\"{} is Projectile\".format(comp.GetEngineTypeStr()))" - }, + "remark": "", + "return": [], + "description": "获取实体类型,主要用于判断实体是否属于某一类型的生物。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/实体类型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nfrom mod_log import logger as logger\r\ncomp = clientApi.GetEngineCompFactory().CreateEngineType(entityId)\r\nentityType = comp.GetEngineType()\r\nEntityTypeEnum = clientApi.GetMinecraftEnum().EntityType\r\n# 判断是否是生物(Mob)\r\nif entityType & EntityTypeEnum.Mob == EntityTypeEnum.Mob:\r\n logger.info(\"{} is Mob\".format(comp.GetEngineTypeStr()))\r\n# 判断是否是弹射物(Projectile)\r\nif entityType & EntityTypeEnum.Projectile == EntityTypeEnum.Projectile:\r\n logger.info(\"{} is Projectile\".format(comp.GetEngineTypeStr()))", + "params": [], + "type": "api", + "side": "client", + "name": "GetEngineType" + }, { - "type": "api", - "name": "GetEngineTypeStr", - "method": "", - "description": "获取实体的类型名称", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/实体类型.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateEngineType(entityId)\r\nstrType = comp.GetEngineTypeStr()" - }, + "remark": "", + "return": [], + "description": "获取实体的类型名称", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/实体类型.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateEngineType(entityId)\r\nstrType = comp.GetEngineTypeStr()", + "params": [], + "type": "api", + "side": "client", + "name": "GetEngineTypeStr" + }, { - "type": "api", - "name": "GetEntityDefinitions", - "method": "", - "description": "获取实体的命名空间ID及其当前和之前的定义组件群", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/实体类型.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetEntityDefinitions()" - }, + "remark": "", + "return": [], + "description": "获取实体的命名空间ID及其当前和之前的定义组件群", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/实体类型.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetEntityDefinitions()", + "params": [], + "type": "api", + "side": "server", + "name": "GetEntityDefinitions" + }, { - "type": "api", - "name": "GetEntityNBTTags", - "method": "", - "description": "获取实体的NBT标签", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/实体类型.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetEntityNBTTags()" - }, + "remark": "", + "return": [], + "description": "获取实体的NBT标签", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/实体类型.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetEntityNBTTags()", + "params": [], + "type": "api", + "side": "server", + "name": "GetEntityNBTTags" + }, { - "type": "api", - "name": "ChangeEntityDimension", - "method": "", - "description": "传送实体", - "remark": "- 该接口无法对玩家使用,玩家请使用ChangePlayerDimension\r\n - 该接口只能传送到另一个维度,如果实体已经在这个维度会返回False", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 该接口无法对玩家使用,玩家请使用ChangePlayerDimension\r\n - 该接口只能传送到另一个维度,如果实体已经在这个维度会返回False", + "return": [], + "description": "传送实体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(entityId)\r\ncomp.ChangeEntityDimension(0, (0,4,0))", "params": [ { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度id,0-主世界; 1-下界; 2-末地; 或其他自定义维度" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "传送的坐标,假如输入None,那么就优先选择目标维度的传送门作为目的地,其次使用维度坐标映射逻辑确定目的地" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(entityId)\r\ncomp.ChangeEntityDimension(0, (0,4,0))" - }, + ], + "type": "api", + "side": "server", + "name": "ChangeEntityDimension" + }, { - "type": "api", - "name": "GetAllComponentsName", - "method": "", - "description": "获取实体所拥有的原版组件list", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityComponent(entityId)\r\nprint comp.GetAllComponentsName()" - }, + "remark": "", + "return": [], + "description": "获取实体所拥有的原版组件list", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityComponent(entityId)\r\nprint comp.GetAllComponentsName()", + "params": [], + "type": "api", + "side": "server", + "name": "GetAllComponentsName" + }, { - "type": "api", - "name": "GetAttrMaxValue", - "method": "", - "description": "获取属性最大值,包括生命值,饥饿度,移速等", - "remark": "- attack_damage,knockback_resistance,jump_strength这三个值目前实现中并不会同步给客户端,因此这几个值通过客户端获取的为默认值。只有通过服务端的GetAttr才能获取到准确值\r\n - 因为护甲为身上盔甲总防御值,因此目前不支持获取护甲的最大值", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- attack_damage,knockback_resistance,jump_strength这三个值目前实现中并不会同步给客户端,因此这几个值通过客户端获取的为默认值。只有通过服务端的GetAttr才能获取到准确值\r\n - 因为护甲为身上盔甲总防御值,因此目前不支持获取护甲的最大值", + "return": [], + "description": "获取属性最大值,包括生命值,饥饿度,移速等", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.GetAttrMaxValue(clientApi.GetMinecraftEnum().AttrType.HEALTH)", "params": [ { - "name": "type", - "type": "int", + "type": "int", + "name": "type", "description": "[AttrType枚举](../../枚举值/AttrType.md)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.GetAttrMaxValue(clientApi.GetMinecraftEnum().AttrType.HEALTH)" - }, + ], + "type": "api", + "side": "client", + "name": "GetAttrMaxValue" + }, { - "type": "api", - "name": "GetAttrValue", - "method": "", - "description": "获取属性值,包括生命值,饥饿度,移速", - "remark": "- damage,knockback_resistance,jump_strength这三个值目前实现中并不会同步给客户端,因此这几个值通过客户端获取的为默认值。只有通过服务端的GetAttr才能获取到准确值\r\n - 当生物不存在该属性时,返回-1。部分属性的最大值默认为1,可通过entity的json配置来设置,详见attrType连接\r\n - 护甲值,取决于身上穿戴的护甲总防御量和接口增加的额外护甲值。客户端无法获取接口增加的护甲值,建议开发者自行同步", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- damage,knockback_resistance,jump_strength这三个值目前实现中并不会同步给客户端,因此这几个值通过客户端获取的为默认值。只有通过服务端的GetAttr才能获取到准确值\r\n - 当生物不存在该属性时,返回-1。部分属性的最大值默认为1,可通过entity的json配置来设置,详见attrType连接\r\n - 护甲值,取决于身上穿戴的护甲总防御量和接口增加的额外护甲值。客户端无法获取接口增加的护甲值,建议开发者自行同步", + "return": [], + "description": "获取属性值,包括生命值,饥饿度,移速", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.GetAttrValue(clientApi.GetMinecraftEnum().AttrType.HEALTH)", "params": [ { - "name": "attrType", - "type": "int", + "type": "int", + "name": "attrType", "description": "[AttrType枚举](../../枚举值/AttrType.md)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.GetAttrValue(clientApi.GetMinecraftEnum().AttrType.HEALTH)" - }, + ], + "type": "api", + "side": "client", + "name": "GetAttrValue" + }, { - "type": "api", - "name": "GetBodyRot", - "method": "", - "description": "获取实体的身体的角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRot(entityId)\r\ny = comp.GetBodyRot()" - }, + "remark": "", + "return": [], + "description": "获取实体的身体的角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRot(entityId)\r\ny = comp.GetBodyRot()", + "params": [], + "type": "api", + "side": "client", + "name": "GetBodyRot" + }, { - "type": "api", - "name": "GetCurrentAirSupply", - "method": "", - "description": "玩家当前氧气储备值", - "remark": "- 注意:该值返回的是当前氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 注意:该值返回的是当前氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数)", + "return": [], + "description": "玩家当前氧气储备值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetCurrentAirSupply(entityId))", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "玩家id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetCurrentAirSupply(entityId))" - }, + ], + "type": "api", + "side": "client", + "name": "GetCurrentAirSupply" + }, { - "type": "api", - "name": "GetDeathTime", - "method": "", - "description": "获取生物死亡后持续的时间(刻,1秒20刻),用于控制死亡动画。0表示生物未死亡。", - "remark": "- 凋零的死亡动画有特殊逻辑,无法通过该接口获取", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetDeathTime()" - }, + "remark": "- 凋零的死亡动画有特殊逻辑,无法通过该接口获取", + "return": [], + "description": "获取生物死亡后持续的时间(刻,1秒20刻),用于控制死亡动画。0表示生物未死亡。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetDeathTime()", + "params": [], + "type": "api", + "side": "server", + "name": "GetDeathTime" + }, { - "type": "api", - "name": "GetEntitiesBySelector", - "method": "", - "description": "传入目标选择器,获取对应实体id (最大范围是所有已加载的实体)", - "remark": "- 要使用范围进行筛选时,需要在创建Component时传入作为中心的entityId。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 要使用范围进行筛选时,需要在创建Component时传入作为中心的entityId。", + "return": [], + "description": "传入目标选择器,获取对应实体id (最大范围是所有已加载的实体)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityComponent(entityId)\r\nprint(comp.GetEntitiesBySelector(\"@e[type=rabbit]\"))", "params": [ { - "name": "command", - "type": "str", + "type": "str", + "name": "command", "description": "目标选择器指令" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityComponent(entityId)\r\nprint(comp.GetEntitiesBySelector(\"@e[type=rabbit]\"))" - }, + ], + "type": "api", + "side": "server", + "name": "GetEntitiesBySelector" + }, { - "type": "api", - "name": "GetEntityDamage", - "method": "", - "description": "获取生物(包括玩家)的攻击力", - "remark": "- 注:该接口获取的是生物的基础攻击力,手持武器,buff效果,附魔效果的总和,抛射物不在计算范围内,使用技能或者抛射物攻击的敌对生物的攻击力不在计算范围内,例如骷髅、恶魂、唤魔者、掠夺者、流浪者、凋灵等。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 注:该接口获取的是生物的基础攻击力,手持武器,buff效果,附魔效果的总和,抛射物不在计算范围内,使用技能或者抛射物攻击的敌对生物的攻击力不在计算范围内,例如骷髅、恶魂、唤魔者、掠夺者、流浪者、凋灵等。", + "return": [], + "description": "获取生物(包括玩家)的攻击力", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetEntityDamage(entityId,targetEntityId))", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物的实体Id" - }, + }, { - "name": "targetEntityId", - "type": "str", + "type": "str", + "name": "targetEntityId", "description": "可选参数,攻击目标的实体Id(部分附魔的武器,会针对不同的生物产生伤害的加成,例如“节肢克星”附魔,对节肢生物有伤害加成)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetEntityDamage(entityId,targetEntityId))" - }, + ], + "type": "api", + "side": "server", + "name": "GetEntityDamage" + }, { - "type": "api", - "name": "GetEntityDimensionId", - "method": "", - "description": "获取实体所在维度", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(entityId)\r\ncomp.GetEntityDimensionId()" - }, + "remark": "", + "return": [], + "description": "获取实体所在维度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(entityId)\r\ncomp.GetEntityDimensionId()", + "params": [], + "type": "api", + "side": "server", + "name": "GetEntityDimensionId" + }, { - "type": "api", - "name": "GetEntityFallDistance", - "method": "", - "description": "获取实体的坠落高度,越大的值会给予实体更大的坠落伤害,建议在[OnGroundServerEvent](../../事件/实体.md#ongroundserverevent)事件中调用", - "remark": "- 该接口不支持抛射物", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetEntityFallDistance()" - }, + "remark": "- 该接口不支持抛射物", + "return": [], + "description": "获取实体的坠落高度,越大的值会给予实体更大的坠落伤害,建议在[OnGroundServerEvent](../../事件/实体.md#ongroundserverevent)事件中调用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetEntityFallDistance()", + "params": [], + "type": "api", + "side": "server", + "name": "GetEntityFallDistance" + }, { - "type": "api", - "name": "GetEntityLinksTag", - "method": "", - "description": "获取实体相连接的实体,如获取entityId为马,会返回骑乘者的信息", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetEntityLinksTag()" - }, + "remark": "", + "return": [], + "description": "获取实体相连接的实体,如获取entityId为马,会返回骑乘者的信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetEntityLinksTag()", + "params": [], + "type": "api", + "side": "server", + "name": "GetEntityLinksTag" + }, { - "type": "api", - "name": "GetEntityOwner", - "method": "", - "description": "获取实体的属主(包括可驯服生物的主人,或者掉落物的丢弃者,弹射物的发射者等)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateActorOwner(entityId)\r\nownerId = comp.GetEntityOwner()" - }, + "remark": "", + "return": [], + "description": "获取实体的属主(包括可驯服生物的主人,或者掉落物的丢弃者,弹射物的发射者等)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateActorOwner(entityId)\r\nownerId = comp.GetEntityOwner()", + "params": [], + "type": "api", + "side": "server", + "name": "GetEntityOwner" + }, { - "type": "api", - "name": "GetFootPos", - "method": "", - "description": "获取实体脚所在的位置", - "remark": "- 获取实体脚底的位置(除了睡觉时)\r\n - 类似接口参见[获取实体位置](#getpos)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePos(entityId)\r\n#获取位置:\r\nentityFootPos = comp.GetFootPos()" - }, + "remark": "- 获取实体脚底的位置(除了睡觉时)\r\n - 类似接口参见[获取实体位置](#getpos)", + "return": [], + "description": "获取实体脚所在的位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePos(entityId)\r\n#获取位置:\r\nentityFootPos = comp.GetFootPos()", + "params": [], + "type": "api", + "side": "client", + "name": "GetFootPos" + }, { - "type": "api", - "name": "GetGravity", - "method": "", - "description": "获取实体的重力因子,当生物重力因子为0时则应用世界的重力因子", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGravity(entityId)\r\ncomp.GetGravity()" - }, + "remark": "", + "return": [], + "description": "获取实体的重力因子,当生物重力因子为0时则应用世界的重力因子", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGravity(entityId)\r\ncomp.GetGravity()", + "params": [], + "type": "api", + "side": "server", + "name": "GetGravity" + }, { - "type": "api", - "name": "GetLoadActors", - "method": "", - "description": "获取已加载的实体id", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetLoadActors())" - }, + "remark": "", + "return": [], + "description": "获取已加载的实体id", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetLoadActors())", + "params": [], + "type": "api", + "side": "server", + "name": "GetLoadActors" + }, { - "type": "api", - "name": "GetMarkVariant", - "method": "", - "description": "获取实体的标记变种属性值", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetMarkVariant()" - }, + "remark": "", + "return": [], + "description": "获取实体的标记变种属性值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetMarkVariant()", + "params": [], + "type": "api", + "side": "server", + "name": "GetMarkVariant" + }, { - "type": "api", - "name": "GetMaxAirSupply", - "method": "", - "description": "玩家最大氧气储备值", - "remark": "- 注意:该值返回的是最大氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 注意:该值返回的是最大氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数)", + "return": [], + "description": "玩家最大氧气储备值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetMaxAirSupply(entityId))", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetMaxAirSupply(entityId))" - }, + ], + "type": "api", + "side": "client", + "name": "GetMaxAirSupply" + }, { - "type": "api", - "name": "GetMobColor", - "method": "", - "description": "获取生物的颜色,截止至网易2.9版本,只对羊和热带鱼有效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetMobColor()" - }, + "remark": "", + "return": [], + "description": "获取生物的颜色,截止至网易2.9版本,只对羊和热带鱼有效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetMobColor()", + "params": [], + "type": "api", + "side": "server", + "name": "GetMobColor" + }, { - "type": "api", - "name": "GetMobStrength", - "method": "", - "description": "获取生物的强度,截止至网易2.9版本,只对羊驼有效,强度越大羊驼驮运的箱子时格子数量越多", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetMobStrength()" - }, + "remark": "", + "return": [], + "description": "获取生物的强度,截止至网易2.9版本,只对羊驼有效,强度越大羊驼驮运的箱子时格子数量越多", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetMobStrength()", + "params": [], + "type": "api", + "side": "server", + "name": "GetMobStrength" + }, { - "type": "api", - "name": "GetMobStrengthMax", - "method": "", - "description": "获取生物强度的最大值,截止至网易2.9版本,只对羊驼有效,强度越大羊驼驮运的箱子时格子数量越多,[SetMobStrength](#setstrength)无法超过SetMobStrengthMax的值", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetMobStrengthMax()" - }, + "remark": "", + "return": [], + "description": "获取生物强度的最大值,截止至网易2.9版本,只对羊驼有效,强度越大羊驼驮运的箱子时格子数量越多,[SetMobStrength](#setstrength)无法超过SetMobStrengthMax的值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetMobStrengthMax()", + "params": [], + "type": "api", + "side": "server", + "name": "GetMobStrengthMax" + }, { - "type": "api", - "name": "GetName", - "method": "", - "description": "获取生物的自定义名称(即使用命名牌或者SetName接口设置的名称),或者玩家的名字。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateName(entityId)\r\ncomp.GetName()" - }, + "remark": "", + "return": [], + "description": "获取生物的自定义名称(即使用命名牌或者SetName接口设置的名称),或者玩家的名字。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateName(entityId)\r\ncomp.GetName()", + "params": [], + "type": "api", + "side": "client", + "name": "GetName" + }, { - "type": "api", - "name": "GetPos", - "method": "", - "description": "获取实体位置", - "remark": "- 对于非玩家,获取到的是脚底部位的位置\r\n - 对于玩家,如果处于行走,站立,游泳,潜行,滑翔状态,获得的位置比脚底位置高1.62,如果处于睡觉状态,获得的位置比最低位置高0.2\r\n - 类似接口有[GetFootPos](#getfootpos),对任何实体都是获取脚底部位的位置", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePos(entityId)\r\n#获取位置:\r\nentityPos = comp.GetPos()" - }, + "remark": "- 对于非玩家,获取到的是脚底部位的位置\r\n - 对于玩家,如果处于行走,站立,游泳,潜行,滑翔状态,获得的位置比脚底位置高1.62,如果处于睡觉状态,获得的位置比最低位置高0.2\r\n - 类似接口有[GetFootPos](#getfootpos),对任何实体都是获取脚底部位的位置", + "return": [], + "description": "获取实体位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePos(entityId)\r\n#获取位置:\r\nentityPos = comp.GetPos()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPos" + }, { - "type": "api", - "name": "GetRiderId", - "method": "", - "description": "获取玩家坐骑entityid", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "", + "return": [], + "description": "获取玩家坐骑entityid", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetRiderId(playerId))", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetRiderId(playerId))" - }, + ], + "type": "api", + "side": "client", + "name": "GetRiderId" + }, { - "type": "api", - "name": "GetRot", - "method": "", - "description": "获取实体头与水平方向的俯仰角度和竖直方向的旋转角度,获得角度后可用GetDirFromRot接口转换为朝向的单位向量 MC坐标系说明", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRot(entityId)\r\nx, y = comp.GetRot()" - }, + "remark": "", + "return": [], + "description": "获取实体头与水平方向的俯仰角度和竖直方向的旋转角度,获得角度后可用GetDirFromRot接口转换为朝向的单位向量 MC坐标系说明", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRot(entityId)\r\nx, y = comp.GetRot()", + "params": [], + "type": "api", + "side": "client", + "name": "GetRot" + }, { - "type": "api", - "name": "GetSize", - "method": "", - "description": "获取实体的包围盒", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCollisionBox(entityId)\r\ncomp.GetSize()" - }, + "remark": "", + "return": [], + "description": "获取实体的包围盒", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCollisionBox(entityId)\r\ncomp.GetSize()", + "params": [], + "type": "api", + "side": "client", + "name": "GetSize" + }, { - "type": "api", - "name": "GetTradeLevel", - "method": "", - "description": "获取村民的交易等级", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetTradeLevel()" - }, + "remark": "", + "return": [], + "description": "获取村民的交易等级", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetTradeLevel()", + "params": [], + "type": "api", + "side": "server", + "name": "GetTradeLevel" + }, { - "type": "api", - "name": "GetTypeFamily", - "method": "", - "description": "获取生物行为包字段 type_family", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.GetTypeFamily()" - }, + "remark": "", + "return": [], + "description": "获取生物行为包字段 type_family", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.GetTypeFamily()", + "params": [], + "type": "api", + "side": "server", + "name": "GetTypeFamily" + }, { - "type": "api", - "name": "GetUnitBubbleAirSupply", - "method": "", - "description": "单位气泡数对应的氧气储备值", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBreath(levelId)\r\ncomp.GetUnitBubbleAirSupply()" - }, + "remark": "", + "return": [], + "description": "单位气泡数对应的氧气储备值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBreath(levelId)\r\ncomp.GetUnitBubbleAirSupply()", + "params": [], + "type": "api", + "side": "server", + "name": "GetUnitBubbleAirSupply" + }, { - "type": "api", - "name": "GetVariant", - "method": "", - "description": "获取实体的变种属性值", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetVariant()" - }, + "remark": "", + "return": [], + "description": "获取实体的变种属性值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetVariant()", + "params": [], + "type": "api", + "side": "server", + "name": "GetVariant" + }, { - "type": "api", - "name": "HasChest", - "method": "", - "description": "判断生物是否背负了箱子,截止至网易2.9版本,只对羊驼、驴、骡生效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.HasChest()" - }, + "remark": "", + "return": [], + "description": "判断生物是否背负了箱子,截止至网易2.9版本,只对羊驼、驴、骡生效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.HasChest()", + "params": [], + "type": "api", + "side": "server", + "name": "HasChest" + }, { - "type": "api", - "name": "HasComponent", - "method": "", - "description": "判断实体是否有原版组件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "", + "return": [], + "description": "判断实体是否有原版组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityComponent(entityId)\r\nprint comp.HasComponent(serverApi.GetMinecraftEnum().EntityComponentType.attack)", "params": [ { - "name": "attrType", - "type": "int", + "type": "int", + "name": "attrType", "description": "[EntityComponentType枚举](../../枚举值/EntityComponentType.md)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityComponent(entityId)\r\nprint comp.HasComponent(serverApi.GetMinecraftEnum().EntityComponentType.attack)" - }, + ], + "type": "api", + "side": "server", + "name": "HasComponent" + }, { - "type": "api", - "name": "HasSaddle", - "method": "", - "description": "判断实体是否装备了鞍", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.HasSaddle()" - }, + "remark": "", + "return": [], + "description": "判断实体是否装备了鞍", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.HasSaddle()", + "params": [], + "type": "api", + "side": "server", + "name": "HasSaddle" + }, { - "type": "api", - "name": "IsAngry", - "method": "", - "description": "判断实体是否处于激怒状态", - "remark": "- 该接口对铁傀儡无效,友好型生物如羊、猪没有激怒状态,可通过生物行为包中的json确定。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsAngry()" - }, + "remark": "- 该接口对铁傀儡无效,友好型生物如羊、猪没有激怒状态,可通过生物行为包中的json确定。", + "return": [], + "description": "判断实体是否处于激怒状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsAngry()", + "params": [], + "type": "api", + "side": "server", + "name": "IsAngry" + }, { - "type": "api", - "name": "IsBaby", - "method": "", - "description": "判断实体是否为幼年", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsBaby()" - }, + "remark": "", + "return": [], + "description": "判断实体是否为幼年", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsBaby()", + "params": [], + "type": "api", + "side": "server", + "name": "IsBaby" + }, { - "type": "api", - "name": "IsConsumingAirSupply", - "method": "", - "description": "获取生物当前是否在消耗氧气", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBreath(entityId)\r\ncomp.IsConsumingAirSupply()" - }, + "remark": "", + "return": [], + "description": "获取生物当前是否在消耗氧气", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBreath(entityId)\r\ncomp.IsConsumingAirSupply()", + "params": [], + "type": "api", + "side": "server", + "name": "IsConsumingAirSupply" + }, { - "type": "api", - "name": "IsIllagerCaptain", - "method": "", - "description": "判断实体是否为袭击队长,截止至网易2.9版本,只对掠夺者和卫道士有效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsIllagerCaptain()" - }, + "remark": "", + "return": [], + "description": "判断实体是否为袭击队长,截止至网易2.9版本,只对掠夺者和卫道士有效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsIllagerCaptain()", + "params": [], + "type": "api", + "side": "server", + "name": "IsIllagerCaptain" + }, { - "type": "api", - "name": "IsNaturallySpawned", - "method": "", - "description": "获取生物是否为自然生成的", - "remark": "- 一些自然生成的生物拥有持久性(例如末影龙、随大型结构生成的生物),则IsNaturallySpawned会返回False,详见基岩版持久性生物介绍", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsNaturallySpawned()" - }, + "remark": "- 一些自然生成的生物拥有持久性(例如末影龙、随大型结构生成的生物),则IsNaturallySpawned会返回False,详见基岩版持久性生物介绍", + "return": [], + "description": "获取生物是否为自然生成的", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsNaturallySpawned()", + "params": [], + "type": "api", + "side": "server", + "name": "IsNaturallySpawned" + }, { - "type": "api", - "name": "IsOutOfControl", - "method": "", - "description": "判断实体是否处于失控状态,截止至网易2.9版本,只对船有效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsOutOfControl()" - }, + "remark": "", + "return": [], + "description": "判断实体是否处于失控状态,截止至网易2.9版本,只对船有效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsOutOfControl()", + "params": [], + "type": "api", + "side": "server", + "name": "IsOutOfControl" + }, { - "type": "api", - "name": "IsPregnant", - "method": "", - "description": "获取生物是否怀孕,截止至网易2.9版本,只对海龟有效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsPregnant()" - }, + "remark": "", + "return": [], + "description": "获取生物是否怀孕,截止至网易2.9版本,只对海龟有效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsPregnant()", + "params": [], + "type": "api", + "side": "server", + "name": "IsPregnant" + }, { - "type": "api", - "name": "IsSheared", - "method": "", - "description": "判断实体是否被剃毛,截止至网易2.9版本,只对羊有效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsSheared()" - }, + "remark": "", + "return": [], + "description": "判断实体是否被剃毛,截止至网易2.9版本,只对羊有效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsSheared()", + "params": [], + "type": "api", + "side": "server", + "name": "IsSheared" + }, { - "type": "api", - "name": "IsSitting", - "method": "", - "description": "判断实体是否处于坐下状态", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsSitting()" - }, + "remark": "", + "return": [], + "description": "判断实体是否处于坐下状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsSitting()", + "params": [], + "type": "api", + "side": "server", + "name": "IsSitting" + }, { - "type": "api", - "name": "IsTamed", - "method": "", - "description": "判断实体是否被驯服", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsTamed()" - }, + "remark": "", + "return": [], + "description": "判断实体是否被驯服", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsTamed()", + "params": [], + "type": "api", + "side": "server", + "name": "IsTamed" + }, { - "type": "api", - "name": "LockLocalPlayerRot", - "method": "", - "description": "在分离摄像机时,锁定本地玩家的头部角度", - "remark": "- 只能设置localplayer,即本地玩家自己\r\n - 玩家重生、切换维度时会重置头部角度\r\n - 锁定本地玩家头部角度时第一人称视角下可以旋转镜头,但玩家头部角度不会发生改变,下次切换到第一人称视角时镜头角度仍为锁定时的角度\r\n - 锁定本地玩家头部角度后,玩家划船时头部角度会尽量靠近锁定时的角度,若无法转到该角度,则会向左或向右看(视哪边距离目标角度更近而定)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 只能设置localplayer,即本地玩家自己\r\n - 玩家重生、切换维度时会重置头部角度\r\n - 锁定本地玩家头部角度时第一人称视角下可以旋转镜头,但玩家头部角度不会发生改变,下次切换到第一人称视角时镜头角度仍为锁定时的角度\r\n - 锁定本地玩家头部角度后,玩家划船时头部角度会尽量靠近锁定时的角度,若无法转到该角度,则会向左或向右看(视哪边距离目标角度更近而定)", + "return": [], + "description": "在分离摄像机时,锁定本地玩家的头部角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# 分离摄像机\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.DepartCamera()\r\n# 锁定本地玩家的头部角度\r\ncomp = clientApi.GetEngineCompFactory().CreateRot(entityId)\r\ncomp.LockLocalPlayerRot(True)", "params": [ { - "name": "lock", - "type": "bool", + "type": "bool", + "name": "lock", "description": "传入True为锁定本地玩家头部角度
传入False为解锁本地玩家头部角度" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# 分离摄像机\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.DepartCamera()\r\n# 锁定本地玩家的头部角度\r\ncomp = clientApi.GetEngineCompFactory().CreateRot(entityId)\r\ncomp.LockLocalPlayerRot(True)" - }, + ], + "type": "api", + "side": "client", + "name": "LockLocalPlayerRot" + }, { - "type": "api", - "name": "PromoteToIllagerCaptain", - "method": "", - "description": "晋升实体为袭击队长,截止至网易2.9版本,只对掠夺者和卫道士有效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.PromoteToIllagerCaptain()" - }, + "remark": "", + "return": [], + "description": "晋升实体为袭击队长,截止至网易2.9版本,只对掠夺者和卫道士有效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.PromoteToIllagerCaptain()", + "params": [], + "type": "api", + "side": "server", + "name": "PromoteToIllagerCaptain" + }, { - "type": "api", - "name": "ResetToDefaultValue", - "method": "", - "description": "重置实体引擎属性到默认值", - "remark": "- 本接口对伤害吸收生命值ABSORPTION、护甲ARMOR属性无效\r\n - 由于SetAttrValue接口旧有实现多数情况下会同时修改默认值,因此配合使用本接口时,请在SetAttrValue时指定参数setDefault=0", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 本接口对伤害吸收生命值ABSORPTION、护甲ARMOR属性无效\r\n - 由于SetAttrValue接口旧有实现多数情况下会同时修改默认值,因此配合使用本接口时,请在SetAttrValue时指定参数setDefault=0", + "return": [], + "description": "重置实体引擎属性到默认值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.ResetToDefaultValue(serverApi.GetMinecraftEnum().AttrType.HEALTH)\r\n# 在同类型属性的相关事件触发过程中,调用此接口可能会被相关事件覆盖无效,如受伤时,自动恢复到默认血量\r\n# 解决方案是通过定时器在下一帧再执行相应的Reset操作\r\ndef ResetToDefaultHealth(self, entityId):\r\n comp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\n comp.ResetToDefaultValue(serverApi.GetMinecraftEnum().AttrType.HEALTH)\r\n\r\ndef ActorHurtServerEvent(self, args):\r\n entityId = args.get(\"entityId\")\r\n # 无效,调用后会被ActorHurtServerEvent覆盖\r\n ResetToDefaultHealth(entityId)\r\n # 有效,下一帧恢复\r\n gameComp = serverApi.GetEngineCompFactory().CreateGame(serverApi.GetLevelId())\r\n gameComp.AddTimer(0, self.ResetToDefaultHealth, entityId)", "params": [ { - "name": "type", - "type": "int", + "type": "int", + "name": "type", "description": "[AttrType枚举](../../枚举值/AttrType.md)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.ResetToDefaultValue(serverApi.GetMinecraftEnum().AttrType.HEALTH)\r\n# 在同类型属性的相关事件触发过程中,调用此接口可能会被相关事件覆盖无效,如受伤时,自动恢复到默认血量\r\n# 解决方案是通过定时器在下一帧再执行相应的Reset操作\r\ndef ResetToDefaultHealth(self, entityId):\r\n comp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\n comp.ResetToDefaultValue(serverApi.GetMinecraftEnum().AttrType.HEALTH)\r\n\r\ndef ActorHurtServerEvent(self, args):\r\n entityId = args.get(\"entityId\")\r\n # 无效,调用后会被ActorHurtServerEvent覆盖\r\n ResetToDefaultHealth(entityId)\r\n # 有效,下一帧恢复\r\n gameComp = serverApi.GetEngineCompFactory().CreateGame(serverApi.GetLevelId())\r\n gameComp.AddTimer(0, self.ResetToDefaultHealth, entityId)" - }, + ], + "type": "api", + "side": "server", + "name": "ResetToDefaultValue" + }, { - "type": "api", - "name": "ResetToMaxValue", - "method": "", - "description": "重置实体引擎属性到最大值", - "remark": "- 本接口对伤害吸收生命值ABSORPTION、护甲ARMOR属性无效", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 本接口对伤害吸收生命值ABSORPTION、护甲ARMOR属性无效", + "return": [], + "description": "重置实体引擎属性到最大值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.ResetToMaxValue(serverApi.GetMinecraftEnum().AttrType.HEALTH)\r\n# 在同类型属性的相关事件触发过程中,调用此接口可能会被相关事件覆盖导致无效,如受伤时,自动恢复满血\r\n# 解决方案是通过定时器在下一帧再执行相应的Reset操作\r\ndef ResetToMaxHealth(self, entityId):\r\n comp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\n comp.ResetToMaxValue(serverApi.GetMinecraftEnum().AttrType.HEALTH)\r\n\r\ndef ActorHurtServerEvent(self, args):\r\n entityId = args.get(\"entityId\")\r\n # 无效,调用后会被ActorHurtServerEvent覆盖\r\n ResetToMaxHealth(entityId)\r\n # 有效,下一帧恢复\r\n gameComp = serverApi.GetEngineCompFactory().CreateGame(serverApi.GetLevelId())\r\n gameComp.AddTimer(0, self.ResetToMaxHealth, entityId)", "params": [ { - "name": "type", - "type": "int", + "type": "int", + "name": "type", "description": "[AttrType枚举](../../枚举值/AttrType.md)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.ResetToMaxValue(serverApi.GetMinecraftEnum().AttrType.HEALTH)\r\n# 在同类型属性的相关事件触发过程中,调用此接口可能会被相关事件覆盖导致无效,如受伤时,自动恢复满血\r\n# 解决方案是通过定时器在下一帧再执行相应的Reset操作\r\ndef ResetToMaxHealth(self, entityId):\r\n comp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\n comp.ResetToMaxValue(serverApi.GetMinecraftEnum().AttrType.HEALTH)\r\n\r\ndef ActorHurtServerEvent(self, args):\r\n entityId = args.get(\"entityId\")\r\n # 无效,调用后会被ActorHurtServerEvent覆盖\r\n ResetToMaxHealth(entityId)\r\n # 有效,下一帧恢复\r\n gameComp = serverApi.GetEngineCompFactory().CreateGame(serverApi.GetLevelId())\r\n gameComp.AddTimer(0, self.ResetToMaxHealth, entityId)" - }, + ], + "type": "api", + "side": "server", + "name": "ResetToMaxValue" + }, { - "type": "api", - "name": "SetAngry", - "method": "", - "description": "设置实体是否处于激怒状态", - "remark": "- target必须在被激怒的生物的可见范围内,否则无法正常生效\r\n - 友好型生物如羊、猪没有激怒状态,可通过生物行为包中的json确定。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- target必须在被激怒的生物的可见范围内,否则无法正常生效\r\n - 友好型生物如羊、猪没有激怒状态,可通过生物行为包中的json确定。", + "return": [], + "description": "设置实体是否处于激怒状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetAngry(True, playerId)", "params": [ { - "name": "isAngry", - "type": "bool", + "type": "bool", + "name": "isAngry", "description": "是否设置为激怒状态" - }, + }, { - "name": "targerId", - "type": "str", + "type": "str", + "name": "targerId", "description": "攻击的目标id,设置为True时必须设置目标,设置为isAngry为False的时候不用填" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetAngry(True, playerId)" - }, + ], + "type": "api", + "side": "server", + "name": "SetAngry" + }, { - "type": "api", - "name": "SetAsAdult", - "method": "", - "description": "设置实体为成年体", - "remark": "- 该接口只对定义有 \"minecraft:ageable_grow_up\" 事件的实体生效。\r\n 如果有需要,可自行添加,例如实现僵尸实体添加如下事件到events:\r\n '''json\r\n \"minecraft:ageable_grow_up\": {\r\n \"add\": {\r\n \"component_groups\": [\r\n \"minecraft:zombie_adult\"\r\n ]\r\n },\r\n \"remove\": {\r\n \"component_groups\": [\r\n \"minecraft:zombie_baby\"\r\n ]\r\n }\r\n },\r\n '''", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetAsAdult()" - }, + "remark": "- 该接口只对定义有 \"minecraft:ageable_grow_up\" 事件的实体生效。\r\n 如果有需要,可自行添加,例如实现僵尸实体添加如下事件到events:\r\n '''json\r\n \"minecraft:ageable_grow_up\": {\r\n \"add\": {\r\n \"component_groups\": [\r\n \"minecraft:zombie_adult\"\r\n ]\r\n },\r\n \"remove\": {\r\n \"component_groups\": [\r\n \"minecraft:zombie_baby\"\r\n ]\r\n }\r\n },\r\n '''", + "return": [], + "description": "设置实体为成年体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetAsAdult()", + "params": [], + "type": "api", + "side": "server", + "name": "SetAsAdult" + }, { - "type": "api", - "name": "SetAttrMaxValue", - "method": "", - "description": "设置实体的引擎属性的最大值", - "remark": "- 在设置属性的时候,需要注意判断是否超过原版的值范围,如果设置的数值超过原版值的范围,则返回False。\r\n - 设置的最大饱和度不能超过当前的饥饿值; 食用食物后,最大饱和度会被原版游戏机制修改\r\n - 需要注意的是护甲值由身上的护甲累计计算所得,并不能通过该接口直接修改\r\n - 对于饥饿度,SetAttrMaxValue总是同时修改最大值与默认值,对于其他属性,它只修改最大值不修改默认值", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 在设置属性的时候,需要注意判断是否超过原版的值范围,如果设置的数值超过原版值的范围,则返回False。\r\n - 设置的最大饱和度不能超过当前的饥饿值; 食用食物后,最大饱和度会被原版游戏机制修改\r\n - 需要注意的是护甲值由身上的护甲累计计算所得,并不能通过该接口直接修改\r\n - 对于饥饿度,SetAttrMaxValue总是同时修改最大值与默认值,对于其他属性,它只修改最大值不修改默认值", + "return": [], + "description": "设置实体的引擎属性的最大值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.SetAttrMaxValue(serverApi.GetMinecraftEnum().AttrType.SPEED,0.2)", "params": [ { - "name": "type", - "type": "int", + "type": "int", + "name": "type", "description": "[AttrType枚举](../../枚举值/AttrType.md)" - }, + }, { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "属性值" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.SetAttrMaxValue(serverApi.GetMinecraftEnum().AttrType.SPEED,0.2)" - }, + ], + "type": "api", + "side": "server", + "name": "SetAttrMaxValue" + }, { - "type": "api", - "name": "SetAttrValue", - "method": "", - "description": "设置实体的引擎属性", - "remark": "- 在设置属性的时候,需要注意判断是否超过原版的值范围或是当前属性的值范围,如果设置的数值超过原版值的范围,则返回False。\r\n - 如果超过当前属性的最大值,则需要先调用SetAttrMaxValue接口来扩充该属性的最大值,否则设置的值过大时会由于超过该属性的最大值而被截取成该最大值。如果设置的值低于当前属性的最小值,则会被设置成原版的最小值。\r\n - 关于基础属性的原版最大值或最小值限制,可查看[AttrType枚举](../../枚举值/AttrType.md)\r\n - 设置的护甲值属于额外的,会与装备带来的护甲值叠加,只能为非负整数,会覆盖掉原有生物(除潜影贝和岩浆怪)自带的护甲值,以下生物的护甲值最高为20:僵尸,僵尸村民,僵尸猪人,尸壳,溺尸,唤魔者,凋灵\r\n - setDefault参数对于饥饿度与饱和度属性无效,只会修改当前值,不会修改默认值", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 在设置属性的时候,需要注意判断是否超过原版的值范围或是当前属性的值范围,如果设置的数值超过原版值的范围,则返回False。\r\n - 如果超过当前属性的最大值,则需要先调用SetAttrMaxValue接口来扩充该属性的最大值,否则设置的值过大时会由于超过该属性的最大值而被截取成该最大值。如果设置的值低于当前属性的最小值,则会被设置成原版的最小值。\r\n - 关于基础属性的原版最大值或最小值限制,可查看[AttrType枚举](../../枚举值/AttrType.md)\r\n - 设置的护甲值属于额外的,会与装备带来的护甲值叠加,只能为非负整数,会覆盖掉原有生物(除潜影贝和岩浆怪)自带的护甲值,以下生物的护甲值最高为20:僵尸,僵尸村民,僵尸猪人,尸壳,溺尸,唤魔者,凋灵\r\n - setDefault参数对于饥饿度与饱和度属性无效,只会修改当前值,不会修改默认值", + "return": [], + "description": "设置实体的引擎属性", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\n# 如果设置的值超过属性当前的最大值,需要先扩充该属性的最大值,否则不生效。\r\ncomp.SetAttrMaxValue(serverApi.GetMinecraftEnum().AttrType.HEALTH, 30)\r\ncomp.SetAttrValue(serverApi.GetMinecraftEnum().AttrType.HEALTH, 30)", "params": [ { - "name": "attrType", - "type": "int", + "type": "int", + "name": "attrType", "description": "[AttrType枚举](../../枚举值/AttrType.md)" - }, + }, { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "属性值" - }, + }, { - "name": "setDefault", - "type": "int", + "type": "int", + "name": "setDefault", "description": "是否同时设置默认值,1会同时设置默认值,0则不会,缺省时默认为1" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\n# 如果设置的值超过属性当前的最大值,需要先扩充该属性的最大值,否则不生效。\r\ncomp.SetAttrMaxValue(serverApi.GetMinecraftEnum().AttrType.HEALTH, 30)\r\ncomp.SetAttrValue(serverApi.GetMinecraftEnum().AttrType.HEALTH, 30)" - }, + ], + "type": "api", + "side": "server", + "name": "SetAttrValue" + }, { - "type": "api", - "name": "SetChest", - "method": "", - "description": "设置生物是否背负了箱子,截止至网易2.9版本,只对羊驼、驴、骡生效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "", + "return": [], + "description": "设置生物是否背负了箱子,截止至网易2.9版本,只对羊驼、驴、骡生效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetChest(True)", "params": [ { - "name": "hasChest", - "type": "bool", + "type": "bool", + "name": "hasChest", "description": "是否背负箱子" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetChest(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetChest" + }, { - "type": "api", - "name": "SetCurrentAirSupply", - "method": "", - "description": "设置生物氧气储备值", - "remark": "- 注意:该值设置的是当前氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 注意:该值设置的是当前氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数)", + "return": [], + "description": "设置生物氧气储备值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBreath(entityId)\r\ncomp.SetCurrentAirSupply(300)", "params": [ { - "name": "data", - "type": "int", + "type": "int", + "name": "data", "description": "设置生物当前氧气值" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBreath(entityId)\r\ncomp.SetCurrentAirSupply(300)" - }, + ], + "type": "api", + "side": "server", + "name": "SetCurrentAirSupply" + }, { - "type": "api", - "name": "SetEntityLookAtPos", - "method": "", - "description": "设置非玩家的实体看向某个位置", - "remark": "- 调用本接口会打断该生物正在进行的行为,且该生物不会立刻看向目标位置,而是逐渐看向目标位置\r\n - 对部分不会转向的实体调用此接口,可能会返回失败或返回成功但实际无表现", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 调用本接口会打断该生物正在进行的行为,且该生物不会立刻看向目标位置,而是逐渐看向目标位置\r\n - 对部分不会转向的实体调用此接口,可能会返回失败或返回成功但实际无表现", + "return": [], + "description": "设置非玩家的实体看向某个位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRot(entityId)\r\n# 设置该实体看向(0,78,0)这个位置,该凝视行为最少持续2秒,最多持续3秒,凝视过程中禁止触发其他行为\r\ncomp.SetEntityLookAtPos((0,78,0), 2, 3, True)", "params": [ { - "name": "targetPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "targetPos", "description": "要看向的目标位置" - }, + }, { - "name": "minTime", - "type": "float", + "type": "float", + "name": "minTime", "description": "凝视行为最短维持时间,单位为秒" - }, + }, { - "name": "maxTime", - "type": "float", + "type": "float", + "name": "maxTime", "description": "凝视行为最长维持时间,单位为秒,最大值为60
实际行为维持时间将在minTime和maxTime之间取随机值" - }, + }, { - "name": "reject", - "type": "bool", + "type": "bool", + "name": "reject", "description": "在进行凝视行为时,是否禁止触发其他行为
True为禁止其他行为
False为允许其他行为(此时凝视行为可能表现不明显)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRot(entityId)\r\n# 设置该实体看向(0,78,0)这个位置,该凝视行为最少持续2秒,最多持续3秒,凝视过程中禁止触发其他行为\r\ncomp.SetEntityLookAtPos((0,78,0), 2, 3, True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetEntityLookAtPos" + }, { - "type": "api", - "name": "SetEntityOwner", - "method": "", - "description": "设置实体的属主(包括可驯服生物的主人,或者掉落物的丢弃者,弹射物的发射者等)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "", + "return": [], + "description": "设置实体的属主(包括可驯服生物的主人,或者掉落物的丢弃者,弹射物的发射者等)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateActorOwner(entityId)\r\nresult = comp.SetEntityOwner(targetId)", "params": [ { - "name": "targetId", - "type": "str", + "type": "str", + "name": "targetId", "description": "属主实体id,为None时设置实体的属主为空" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateActorOwner(entityId)\r\nresult = comp.SetEntityOwner(targetId)" - }, + ], + "type": "api", + "side": "server", + "name": "SetEntityOwner" + }, { - "type": "api", - "name": "SetFootPos", - "method": "", - "description": "设置实体脚底所在的位置", - "remark": "- 行为与使用tp命令一致,实体会瞬移到目标点\r\n - 在床上时调用该接口会返回False", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 行为与使用tp命令一致,实体会瞬移到目标点\r\n - 在床上时调用该接口会返回False", + "return": [], + "description": "设置实体脚底所在的位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePos(entityId)\r\ncomp.SetFootPos((0, 4, 0))", "params": [ { - "name": "footPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "footPos", "description": "实体脚所在的位置" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePos(entityId)\r\ncomp.SetFootPos((0, 4, 0))" - }, + ], + "type": "api", + "side": "server", + "name": "SetFootPos" + }, { - "type": "api", - "name": "SetGravity", - "method": "", - "description": "设置实体的重力因子,当生物重力因子为0时则应用世界的重力因子", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "", + "return": [], + "description": "设置实体的重力因子,当生物重力因子为0时则应用世界的重力因子", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGravity(entityId)\r\ncomp.SetGravity(-0.08)", "params": [ { - "name": "gravity", - "type": "float", + "type": "float", + "name": "gravity", "description": "负数,表示每帧向下的速度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGravity(entityId)\r\ncomp.SetGravity(-0.08)" - }, + ], + "type": "api", + "side": "server", + "name": "SetGravity" + }, { - "type": "api", - "name": "SetMarkVariant", - "method": "", - "description": "设置实体的标记变种属性值", - "remark": "- 如果想设置其他生物的变种属性,可以直接查看behavior_packs中各个版本的entities文件下对应种类json中的\"minecraft:mark_variant\"属性", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 如果想设置其他生物的变种属性,可以直接查看behavior_packs中各个版本的entities文件下对应种类json中的\"minecraft:mark_variant\"属性", + "return": [], + "description": "设置实体的标记变种属性值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetMarkVariant(1)", "params": [ { - "name": "variantType", - "type": "int", + "type": "int", + "name": "variantType", "description": "变种枚举值,详见[马的标记变种枚举](../../枚举值/HorseSpotType.md)、[V2版村民服装枚举](../../枚举值/VillagerClothingType.md)." } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetMarkVariant(1)" - }, + ], + "type": "api", + "side": "server", + "name": "SetMarkVariant" + }, { - "type": "api", - "name": "SetMaxAirSupply", - "method": "", - "description": "设置生物最大氧气储备值", - "remark": "- 注意:该值设置的是最大氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 注意:该值设置的是最大氧气储备的支持的逻辑帧数 = 氧气储备值 * 逻辑帧数(每秒20帧数)", + "return": [], + "description": "设置生物最大氧气储备值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBreath(entityId)\r\ncomp.SetMaxAirSupply(400)", "params": [ { - "name": "data", - "type": "int", + "type": "int", + "name": "data", "description": "设置生物最大氧气值" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBreath(entityId)\r\ncomp.SetMaxAirSupply(400)" - }, + ], + "type": "api", + "side": "server", + "name": "SetMaxAirSupply" + }, { - "type": "api", - "name": "SetMobColor", - "method": "", - "description": "设置生物的颜色,截止至网易2.9版本,只对羊和热带鱼有效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "", + "return": [], + "description": "设置生物的颜色,截止至网易2.9版本,只对羊和热带鱼有效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\nimport common.minecraftEnum as minecraftEnum\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetMobColor(minecraftEnum.EntityColorType.LightGreen)", "params": [ { - "name": "colorType", - "type": "int", + "type": "int", + "name": "colorType", "description": "颜色枚举值,详见[EntityColorType枚举](../../枚举值/EntityColorType.md)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nimport common.minecraftEnum as minecraftEnum\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetMobColor(minecraftEnum.EntityColorType.LightGreen)" - }, + ], + "type": "api", + "side": "server", + "name": "SetMobColor" + }, { - "type": "api", - "name": "SetMobStrength", - "method": "", - "description": "设置生物的强度,截止至网易2.9版本,只对羊驼有效,强度越大羊驼驮运的箱子时格子数量越多", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "", + "return": [], + "description": "设置生物的强度,截止至网易2.9版本,只对羊驼有效,强度越大羊驼驮运的箱子时格子数量越多", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetMobStrength(5)", "params": [ { - "name": "strength", - "type": "int", + "type": "int", + "name": "strength", "description": "强度值,取值范围为 1~5,如果设置值大于[GetMobStrengthMax](#getmobstrengthmax)的值,将被设置为[GetMobStrengthMax](#getmobstrengthmax)的值" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetMobStrength(5)" - }, + ], + "type": "api", + "side": "server", + "name": "SetMobStrength" + }, { - "type": "api", - "name": "SetMobStrengthMax", - "method": "", - "description": "设置生物强度的最大值,截止至网易2.9版本,只对羊驼有效,强度越大羊驼驮运的箱子时格子数量越多,[SetMobStrength](#setmobstrength)无法超过SetMobStrengthMax的值。由于引擎限制,在羊驼被打时候会reload组件,strengthMax会恢复成llama.json中的配置值(minecraft:strength)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "", + "return": [], + "description": "设置生物强度的最大值,截止至网易2.9版本,只对羊驼有效,强度越大羊驼驮运的箱子时格子数量越多,[SetMobStrength](#setmobstrength)无法超过SetMobStrengthMax的值。由于引擎限制,在羊驼被打时候会reload组件,strengthMax会恢复成llama.json中的配置值(minecraft:strength)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetMobStrengthMax(5)", "params": [ { - "name": "strength", - "type": "int", + "type": "int", + "name": "strength", "description": "强度值,取值范围为 1~5,原版默认值为5" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetMobStrengthMax(5)" - }, + ], + "type": "api", + "side": "server", + "name": "SetMobStrengthMax" + }, { - "type": "api", - "name": "SetName", - "method": "", - "description": "用于设置生物的自定义名称,跟原版命名牌作用相同,玩家和新版流浪商人暂不支持", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "", + "return": [], + "description": "用于设置生物的自定义名称,跟原版命名牌作用相同,玩家和新版流浪商人暂不支持", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateName(entityId)\r\ncomp.SetName(\"new Name\")", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "名称" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateName(entityId)\r\ncomp.SetName(\"new Name\")" - }, + ], + "type": "api", + "side": "server", + "name": "SetName" + }, { - "type": "api", - "name": "SetOutOfControl", - "method": "", - "description": "设置实体是否处于失控状态,截止至网易2.9版本,只对船有效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "", + "return": [], + "description": "设置实体是否处于失控状态,截止至网易2.9版本,只对船有效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetOutOfControl(True)", "params": [ { - "name": "isOutOfControl", - "type": "bool", + "type": "bool", + "name": "isOutOfControl", "description": "是否处于失控状态" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetOutOfControl(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetOutOfControl" + }, { - "type": "api", - "name": "SetPersistent", - "method": "", - "description": "设置实体不会因为离玩家太远而被[清除](https://minecraft.fandom.com/zh/wiki/%E7%94%9F%E6%88%90#.E5.9F.BA.E5.B2.A9.E7.89.88_2)", - "remark": "- 使用CreateEngineEntityByTypeStr创建isNpc为True的实体时,默认不会被清除", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 使用CreateEngineEntityByTypeStr创建isNpc为True的实体时,默认不会被清除", + "return": [], + "description": "设置实体不会因为离玩家太远而被[清除](https://minecraft.fandom.com/zh/wiki/%E7%94%9F%E6%88%90#.E5.9F.BA.E5.B2.A9.E7.89.88_2)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.SetPersistent(True)", "params": [ { - "name": "persistent", - "type": "bool", + "type": "bool", + "name": "persistent", "description": "设置为True时,则实体不会被清除" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.SetPersistent(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPersistent" + }, { - "type": "api", - "name": "SetPlayerLookAtPos", - "method": "", - "description": "设置本地玩家看向某个位置", - "remark": "- 当本地玩家未与摄像机分离时,调用本接口会导致摄像机一同看向指定位置
当本地玩家与摄像机分离时,调用本接口将只改变本地玩家模型的朝向", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 当本地玩家未与摄像机分离时,调用本接口会导致摄像机一同看向指定位置
当本地玩家与摄像机分离时,调用本接口将只改变本地玩家模型的朝向", + "return": [], + "description": "设置本地玩家看向某个位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRot(localPlayerId)\r\n# 设置本地玩家以0.2度每帧的俯仰角速度、1度每帧的偏航角速度看向(0,78,0)这个位置,转向过程中屏蔽玩家操作\r\ncomp.SetPlayerLookAtPos((0,78,0), 0.2, 1, True)", "params": [ { - "name": "targetPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "targetPos", "description": "要看向的目标位置" - }, + }, { - "name": "pitchStep", - "type": "float", + "type": "float", + "name": "pitchStep", "description": "俯仰角方向旋转的角速度(每帧),最小为0.2" - }, + }, { - "name": "yawStep", - "type": "float", + "type": "float", + "name": "yawStep", "description": "偏航角方向旋转的角速度(每帧),最小为0.2" - }, + }, { - "name": "blockInput", - "type": "bool", + "type": "bool", + "name": "blockInput", "description": "转向目标角度时是否屏蔽玩家操作,默认为True
True:屏蔽玩家操作,此时玩家无法转向、移动
False:不屏蔽玩家操作,此时如果玩家有移动、镜头转向操作将会打断通过本接口设置的转向" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRot(localPlayerId)\r\n# 设置本地玩家以0.2度每帧的俯仰角速度、1度每帧的偏航角速度看向(0,78,0)这个位置,转向过程中屏蔽玩家操作\r\ncomp.SetPlayerLookAtPos((0,78,0), 0.2, 1, True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetPlayerLookAtPos" + }, { - "type": "api", - "name": "SetPos", - "method": "", - "description": "设置实体位置", - "remark": "- 行为与使用tp命令一致,实体会瞬移到目标点\r\n - 对于所有类型的实体都是设置脚底位置,与[SetFootPos](#setfootpos)等价\r\n - 在床上时调用该接口会返回False", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 行为与使用tp命令一致,实体会瞬移到目标点\r\n - 对于所有类型的实体都是设置脚底位置,与[SetFootPos](#setfootpos)等价\r\n - 在床上时调用该接口会返回False", + "return": [], + "description": "设置实体位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePos(entityId)\r\ncomp.SetPos((1,2,3))", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "xyz值" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePos(entityId)\r\ncomp.SetPos((1,2,3))" - }, + ], + "type": "api", + "side": "server", + "name": "SetPos" + }, { - "type": "api", - "name": "SetRecoverTotalAirSupplyTime", - "method": "", - "description": "设置恢复最大氧气量的时间,单位秒", - "remark": "- 注意:当设置的最大氧气值小于(timeSec*10)时,生物每帧恢复氧气量的值为0", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 注意:当设置的最大氧气值小于(timeSec*10)时,生物每帧恢复氧气量的值为0", + "return": [], + "description": "设置恢复最大氧气量的时间,单位秒", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBreath(entityId)\r\ncomp.SetRecoverTotalAirSupplyTime(10)", "params": [ { - "name": "timeSec", - "type": "float", + "type": "float", + "name": "timeSec", "description": "恢复生物最大氧气值" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBreath(entityId)\r\ncomp.SetRecoverTotalAirSupplyTime(10)" - }, + ], + "type": "api", + "side": "server", + "name": "SetRecoverTotalAirSupplyTime" + }, { - "type": "api", - "name": "SetRot", - "method": "", - "description": "设置实体头与水平方向的俯仰角度和竖直方向的旋转角度 MC坐标系说明", - "remark": "- 建议只用来设置本地玩家。如果设置其他生物,会被生物自身行为覆盖。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 建议只用来设置本地玩家。如果设置其他生物,会被生物自身行为覆盖。", + "return": [], + "description": "设置实体头与水平方向的俯仰角度和竖直方向的旋转角度 MC坐标系说明", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRot(entityId)\r\n# 设为向上仰视45度,并朝向世界z轴正方向\r\ncomp.SetRot((-45, 0))", "params": [ { - "name": "rot", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "rot", "description": "俯仰角度及绕竖直方向旋转的角度,单位是角度" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRot(entityId)\r\n# 设为向上仰视45度,并朝向世界z轴正方向\r\ncomp.SetRot((-45, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetRot" + }, { - "type": "api", - "name": "SetSheared", - "method": "", - "description": "设置实体是否被剃毛,截止至网易2.9版本,只对羊有效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "", + "return": [], + "description": "设置实体是否被剃毛,截止至网易2.9版本,只对羊有效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetSheared(True)", "params": [ { - "name": "isSheared", - "type": "bool", + "type": "bool", + "name": "isSheared", "description": "是否剃毛" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetSheared(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetSheared" + }, { - "type": "api", - "name": "SetSitting", - "method": "", - "description": "设置生物是否坐下", - "remark": "- 该接口对熊猫无效,熊猫坐下有特殊游戏逻辑", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 该接口对熊猫无效,熊猫坐下有特殊游戏逻辑", + "return": [], + "description": "设置生物是否坐下", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetSitting()", "params": [ { - "name": "shouldSitDown", - "type": "bool", + "type": "bool", + "name": "shouldSitDown", "description": "是否坐下" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetSitting()" - }, + ], + "type": "api", + "side": "server", + "name": "SetSitting" + }, { - "type": "api", - "name": "SetSize", - "method": "", - "description": "设置实体的包围盒", - "remark": "- 对新生产的实体需要经过5帧之后再设置包围盒的大小才会生效", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 对新生产的实体需要经过5帧之后再设置包围盒的大小才会生效", + "return": [], + "description": "设置实体的包围盒", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateCollisionBox(entityId)\r\ncomp.SetSize((2,3))", "params": [ { - "name": "size", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "size", "description": "第一位表示宽度和长度,第二位表示高度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateCollisionBox(entityId)\r\ncomp.SetSize((2,3))" - }, + ], + "type": "api", + "side": "server", + "name": "SetSize" + }, { - "type": "api", - "name": "SetTradeLevel", - "method": "", - "description": "设置村民的交易等级", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "", + "return": [], + "description": "设置村民的交易等级", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\nimport common.minecraftEnum as minecraftEnum\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetTradeLevel(minecraftEnum.TradeLevelType.Master)", "params": [ { - "name": "holderId", - "type": "int", + "type": "int", + "name": "holderId", "description": "村民的交易等级,详见[TradeLevelType](../../枚举值/TradeLevelType.md)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nimport common.minecraftEnum as minecraftEnum\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetTradeLevel(minecraftEnum.TradeLevelType.Master)" - }, + ], + "type": "api", + "side": "server", + "name": "SetTradeLevel" + }, { - "type": "api", - "name": "SetVariant", - "method": "", - "description": "设置实体的变种属性值", - "remark": "- 如果想设置其他生物的变种属性,可以直接查看behavior_packs中各个版本的entities文件下对应种类json中的\"minecraft:variant\"属性", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "remark": "- 如果想设置其他生物的变种属性,可以直接查看behavior_packs中各个版本的entities文件下对应种类json中的\"minecraft:variant\"属性", + "return": [], + "description": "设置实体的变种属性值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetVariant(1)", "params": [ { - "name": "variantType", - "type": "int", + "type": "int", + "name": "variantType", "description": "变种枚举值,详见[猫变种枚举](../../枚举值/CatVariantType.md)、[马变种枚举](../../枚举值/HorseType.md)、[狐狸变种枚举](../../枚举值/FoxType.md)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetVariant(1)" - }, + ], + "type": "api", + "side": "server", + "name": "SetVariant" + }, { - "type": "api", - "name": "isEntityInLava", - "method": "", - "description": "实体是否在岩浆中", - "remark": "- 只能获取到本地客户端已加载的实体是否在岩浆中,若实体在其他维度或未加载(距离本地玩家太远),将获取失败", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreateAttr(entityId)\r\nisInLava = comp.isEntityInLava()" - }, + "remark": "- 只能获取到本地客户端已加载的实体是否在岩浆中,若实体在其他维度或未加载(距离本地玩家太远),将获取失败", + "return": [], + "description": "实体是否在岩浆中", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "comp = clientApi.GetEngineCompFactory().CreateAttr(entityId)\r\nisInLava = comp.isEntityInLava()", + "params": [], + "type": "api", + "side": "client", + "name": "isEntityInLava" + }, { - "type": "api", - "name": "isEntityOnGround", - "method": "", - "description": "实体是否触地", - "remark": "- 客户端实体刚创建时引擎计算还没完成,此时获取该实体是否着地将返回默认值True,需要延迟一帧进行获取才能获取到正确的数据\r\n - 生物处于骑乘状态时,如玩家骑在猪身上,也视作触地\r\n - 只能获取到本地客户端已加载的实体是否触地,若实体在其他维度或未加载(距离本地玩家太远),将获取失败", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreateAttr(entityId)\r\nisOnGound = comp.isEntityOnGround()" - }, + "remark": "- 客户端实体刚创建时引擎计算还没完成,此时获取该实体是否着地将返回默认值True,需要延迟一帧进行获取才能获取到正确的数据\r\n - 生物处于骑乘状态时,如玩家骑在猪身上,也视作触地\r\n - 只能获取到本地客户端已加载的实体是否触地,若实体在其他维度或未加载(距离本地玩家太远),将获取失败", + "return": [], + "description": "实体是否触地", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/属性.md", + "example": "comp = clientApi.GetEngineCompFactory().CreateAttr(entityId)\r\nisOnGound = comp.isEntityOnGround()", + "params": [], + "type": "api", + "side": "client", + "name": "isEntityOnGround" + }, { - "type": "api", - "name": "GetSourceEntityId", - "method": "", - "description": "获取抛射物发射者实体id", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/抛射物.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBulletAttributes(entityId)\r\ncomp.GetSourceEntityId()" - }, + "remark": "", + "return": [], + "description": "获取抛射物发射者实体id", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/抛射物.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBulletAttributes(entityId)\r\ncomp.GetSourceEntityId()", + "params": [], + "type": "api", + "side": "server", + "name": "GetSourceEntityId" + }, { - "type": "api", - "name": "AddEntityTag", - "method": "", - "description": "增加实体标签", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/标签.md", + "remark": "", + "return": [], + "description": "增加实体标签", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/标签.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateTag(entityId)\r\ncomp.AddEntityTag(\"AAA\")", "params": [ { - "name": "tag", - "type": "str", + "type": "str", + "name": "tag", "description": "标签名" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateTag(entityId)\r\ncomp.AddEntityTag(\"AAA\")" - }, + ], + "type": "api", + "side": "server", + "name": "AddEntityTag" + }, { - "type": "api", - "name": "EntityHasTag", - "method": "", - "description": "判断实体是否存在某个指定的标签", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/标签.md", + "remark": "", + "return": [], + "description": "判断实体是否存在某个指定的标签", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/标签.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateTag(entityId)\r\ncomp.EntityHasTag(\"AAA\")", "params": [ { - "name": "tag", - "type": "str", + "type": "str", + "name": "tag", "description": "标签名" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateTag(entityId)\r\ncomp.EntityHasTag(\"AAA\")" - }, + ], + "type": "api", + "side": "server", + "name": "EntityHasTag" + }, { - "type": "api", - "name": "GetEntityTags", - "method": "", - "description": "获取实体标签列表", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/标签.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateTag(entityId)\r\ncomp.GetEntityTags()" - }, + "remark": "", + "return": [], + "description": "获取实体标签列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/标签.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateTag(entityId)\r\ncomp.GetEntityTags()", + "params": [], + "type": "api", + "side": "server", + "name": "GetEntityTags" + }, { - "type": "api", - "name": "RemoveEntityTag", - "method": "", - "description": "移除实体某个指定的标签", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/标签.md", + "remark": "", + "return": [], + "description": "移除实体某个指定的标签", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/标签.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateTag(entityId)\r\ncomp.RemoveEntityTag(\"AAA\")", "params": [ { - "name": "tag", - "type": "str", + "type": "str", + "name": "tag", "description": "标签名" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateTag(entityId)\r\ncomp.RemoveEntityTag(\"AAA\")" - }, + ], + "type": "api", + "side": "server", + "name": "RemoveEntityTag" + }, { - "type": "api", - "name": "AddActorAnimation", - "method": "", - "description": "增加生物渲染动画", - "remark": "- 某些动画资源可能用到了molang表达式,在添加动画时请务必确保这些molang表达式也存在。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 某些动画资源可能用到了molang表达式,在添加动画时请务必确保这些molang表达式也存在。", + "return": [], + "description": "增加生物渲染动画", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorAnimation(\"minecraft:pig\", \"custom_move\", \"animation.pig.custom_move\")", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "实体identifier" - }, + }, { - "name": "animationKey", - "type": "str", + "type": "str", + "name": "animationKey", "description": "动画键" - }, + }, { - "name": "animationName", - "type": "str", + "type": "str", + "name": "animationName", "description": "动画名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorAnimation(\"minecraft:pig\", \"custom_move\", \"animation.pig.custom_move\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddActorAnimation" + }, { - "type": "api", - "name": "AddActorAnimationController", - "method": "", - "description": "增加生物渲染动画控制器", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "增加生物渲染动画控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.AddActorAnimationController(\"minecraft:skeleton\", \"controller__use_item_progress\", \"controller.animation.humanoid.use_item_progress\")", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "生物的identifier" - }, + }, { - "name": "animationControllerKey", - "type": "str", + "type": "str", + "name": "animationControllerKey", "description": "动画控制器键" - }, + }, { - "name": "animationControllerName", - "type": "str", + "type": "str", + "name": "animationControllerName", "description": "动画控制器名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.AddActorAnimationController(\"minecraft:skeleton\", \"controller__use_item_progress\", \"controller.animation.humanoid.use_item_progress\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddActorAnimationController" + }, { - "type": "api", - "name": "AddActorBlockGeometry", - "method": "", - "description": "为实体添加方块几何体模型。", - "remark": "- 请在确保世界已经初始化完成后(例如,监听UiInitFinished事件)再调用该接口,否则过早调用会导致接口执行失败。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 请在确保世界已经初始化完成后(例如,监听UiInitFinished事件)再调用该接口,否则过早调用会导致接口执行失败。", + "return": [], + "description": "为实体添加方块几何体模型。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 合并方块并转换为名叫\"my_block_geometry\"的方块几何体模型\r\ngeometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],\"my_block_geometry\")\r\n# 添加到实体id为-4294967295的实体中\r\nprint actorRenderComp.AddActorBlockGeometry(geometryName)", "params": [ { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "方块几何体模型相对实体的位置偏移值,可选参数,默认为(0, 0, 0)。" - }, + }, { - "name": "rotation", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rotation", "description": "方块几何体模型相对实体的旋转角度,可选参数,默认为(0, 0, 0),分别表示绕x,y,z轴的旋转角度,旋转顺序按z,x,y顺序旋转。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 合并方块并转换为名叫\"my_block_geometry\"的方块几何体模型\r\ngeometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],\"my_block_geometry\")\r\n# 添加到实体id为-4294967295的实体中\r\nprint actorRenderComp.AddActorBlockGeometry(geometryName)" - }, + ], + "type": "api", + "side": "client", + "name": "AddActorBlockGeometry" + }, { - "type": "api", - "name": "AddActorGeometry", - "method": "", - "description": "增加生物渲染几何体", - "remark": "- 调用该接口后需要调用RebuildActorRender才会生效\r\n 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图。建议先修改生物的动画以及动画控制器后再修改生物的几何。\r\n - 某些生物受初始动画影响,几何体会有初始偏移,会导致修改几何体后表现异常。若修改后的几何体没有当前动画需要的骨骼时,会触发报错。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用RebuildActorRender才会生效\r\n 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图。建议先修改生物的动画以及动画控制器后再修改生物的几何。\r\n - 某些生物受初始动画影响,几何体会有初始偏移,会导致修改几何体后表现异常。若修改后的几何体没有当前动画需要的骨骼时,会触发报错。", + "return": [], + "description": "增加生物渲染几何体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorGeometry(\"minecraft:sheep\", \"default\", \"geometry.panda\")", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "生物实体identifier" - }, + }, { - "name": "geometryKey", - "type": "str", + "type": "str", + "name": "geometryKey", "description": "渲染几何体的键,如default" - }, + }, { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "渲染几何体名称,如熊猫几何体geometry.panda" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorGeometry(\"minecraft:sheep\", \"default\", \"geometry.panda\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddActorGeometry" + }, { - "type": "api", - "name": "AddActorParticleEffect", - "method": "", - "description": "增加生物特效资源", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "增加生物特效资源", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorParticleEffect(\"minecraft:villager\", \"nectar_dripping\", \"minecraft:nectar_drip_particle\")", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "实体identifier" - }, + }, { - "name": "effectKey", - "type": "str", + "type": "str", + "name": "effectKey", "description": "特效资源Key,如bee.entity.json中的nectar_dripping" - }, + }, { - "name": "effectName", - "type": "str", + "type": "str", + "name": "effectName", "description": "特效资源名称,如minecraft:nectar_drip_particle" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorParticleEffect(\"minecraft:villager\", \"nectar_dripping\", \"minecraft:nectar_drip_particle\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddActorParticleEffect" + }, { - "type": "api", - "name": "AddActorRenderController", - "method": "", - "description": "增加生物渲染控制器", - "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", + "return": [], + "description": "增加生物渲染控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorRenderController('minecraft:villager', 'custom_render_controller_name', 'query.mod.condition')", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "生物identifier" - }, + }, { - "name": "renderControllerName", - "type": "str", + "type": "str", + "name": "renderControllerName", "description": "渲染控制器名称" - }, + }, { - "name": "condition", - "type": "str", + "type": "str", + "name": "condition", "description": "渲染控制器条件,当该条件成立时,renderControllerName指向的渲染控制器才会生效" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorRenderController('minecraft:villager', 'custom_render_controller_name', 'query.mod.condition')" - }, + ], + "type": "api", + "side": "client", + "name": "AddActorRenderController" + }, { - "type": "api", - "name": "AddActorRenderControllerArray", - "method": "", - "description": "增加生物渲染控制器列表中字典arrays元素", - "remark": "- 该接口增加render_controller->arrays—>materials/textures/geometries->array.***中的元素\r\n - 调用该接口后需要调用RebuildActorRender才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 该接口增加render_controller->arrays—>materials/textures/geometries->array.***中的元素\r\n - 调用该接口后需要调用RebuildActorRender才会生效", + "return": [], + "description": "增加生物渲染控制器列表中字典arrays元素", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.AddActorRenderControllerArray(\"minecraft:pig\", \"controller.render.pig\", clientApi.GetMinecraftEnum().RenderControllerArrayType.Texture, \"Array.skins\", \"Texture.test\")", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "实体identifier" - }, + }, { - "name": "renderControllerName", - "type": "str", + "type": "str", + "name": "renderControllerName", "description": "实体生物渲染控制器名称" - }, + }, { - "name": "arrayType", - "type": "int", + "type": "int", + "name": "arrayType", "description": "渲染控制器arrays类型([渲染控制器arrays类型枚举](../../枚举值/RenderControllerArrayType.md))" - }, + }, { - "name": "arrayName", - "type": "str", + "type": "str", + "name": "arrayName", "description": "数组名称" - }, + }, { - "name": "expression", - "type": "str", + "type": "str", + "name": "expression", "description": "待添加元素表达式" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.AddActorRenderControllerArray(\"minecraft:pig\", \"controller.render.pig\", clientApi.GetMinecraftEnum().RenderControllerArrayType.Texture, \"Array.skins\", \"Texture.test\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddActorRenderControllerArray" + }, { - "type": "api", - "name": "AddActorRenderMaterial", - "method": "", - "description": "增加生物渲染需要的材质", - "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", + "return": [], + "description": "增加生物渲染需要的材质", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorRenderMaterial('minecraft:villager', 'custom_material_key', 'custom_material_name')", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "生物的identifier" - }, + }, { - "name": "materialKey", - "type": "str", + "type": "str", + "name": "materialKey", "description": "材质的键" - }, + }, { - "name": "materialName", - "type": "str", + "type": "str", + "name": "materialName", "description": "材质名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorRenderMaterial('minecraft:villager', 'custom_material_key', 'custom_material_name')" - }, + ], + "type": "api", + "side": "client", + "name": "AddActorRenderMaterial" + }, { - "type": "api", - "name": "AddActorScriptAnimate", - "method": "", - "description": "在生物的客户端实体定义(minecraft:client_entity)json中的scripts/animate节点添加动画/动画控制器", - "remark": "- 对于已经存在的生物,在调用CreateActorRender时需要传生物Id才能马上生效,对于不存在的生物,直接传levelId即可。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 对于已经存在的生物,在调用CreateActorRender时需要传生物Id才能马上生效,对于不存在的生物,直接传levelId即可。", + "return": [], + "description": "在生物的客户端实体定义(minecraft:client_entity)json中的scripts/animate节点添加动画/动画控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.AddActorAnimationController(\"minecraft:pig\", \"animation_controller_short_name\", \"controller.animation.pig.custom_animation_controller\")\r\ncomp.AddActorScriptAnimate(\"minecraft:pig\", \"animation_controller_short_name\", \"query.mod.index > 0\")", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "实体identifier" - }, + }, { - "name": "animateName", - "type": "str", + "type": "str", + "name": "animateName", "description": "动画/动画控制器名称,如look_at_target" - }, + }, { - "name": "condition", - "type": "str", + "type": "str", + "name": "condition", "description": "动画/动画控制器控制表达式,默认为空,如query.mod.index > 0" - }, + }, { - "name": "autoReplace", - "type": "bool", + "type": "bool", + "name": "autoReplace", "description": "是否覆盖已存在的动画/动画控制器,默认值为False" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.AddActorAnimationController(\"minecraft:pig\", \"animation_controller_short_name\", \"controller.animation.pig.custom_animation_controller\")\r\ncomp.AddActorScriptAnimate(\"minecraft:pig\", \"animation_controller_short_name\", \"query.mod.index > 0\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddActorScriptAnimate" + }, { - "type": "api", - "name": "AddActorSoundEffect", - "method": "", - "description": "增加生物音效资源", - "remark": "- 目前只支持在动作(animation)中播放音效,不支持在动作控制器(animation controller)中播放音效。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 目前只支持在动作(animation)中播放音效,不支持在动作控制器(animation controller)中播放音效。", + "return": [], + "description": "增加生物音效资源", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorSoundEffect(\"minecraft:villager\", \"sound_thunder\", \"ambient.weather.thunder\")", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "实体identifier" - }, + }, { - "name": "soundKey", - "type": "str", + "type": "str", + "name": "soundKey", "description": "音效资源Key" - }, + }, { - "name": "soundName", - "type": "str", + "type": "str", + "name": "soundName", "description": "音效资源名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorSoundEffect(\"minecraft:villager\", \"sound_thunder\", \"ambient.weather.thunder\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddActorSoundEffect" + }, { - "type": "api", - "name": "AddActorTexture", - "method": "", - "description": "增加生物渲染贴图", - "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", + "return": [], + "description": "增加生物渲染贴图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorTexture(\"minecraft:sheep\", \"default\", \"textures/entity/panda/panda\")", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "生物实体identifier" - }, + }, { - "name": "textureKey", - "type": "str", + "type": "str", + "name": "textureKey", "description": "贴图键" - }, + }, { - "name": "texturePath", - "type": "str", + "type": "str", + "name": "texturePath", "description": "贴图路径" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddActorTexture(\"minecraft:sheep\", \"default\", \"textures/entity/panda/panda\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddActorTexture" + }, { - "type": "api", - "name": "AddAnimationControllerToOneActor", - "method": "", - "description": "增加单个生物渲染动画控制器", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "增加单个生物渲染动画控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.AddAnimationControllerToOneActor(entityId, \"controller__use_item_progress\", \"controller.animation.humanoid.use_item_progress\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物的entityId" - }, + }, { - "name": "animationControllerKey", - "type": "str", + "type": "str", + "name": "animationControllerKey", "description": "动画控制器键" - }, + }, { - "name": "animationControllerName", - "type": "str", + "type": "str", + "name": "animationControllerName", "description": "动画控制器名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.AddAnimationControllerToOneActor(entityId, \"controller__use_item_progress\", \"controller.animation.humanoid.use_item_progress\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddAnimationControllerToOneActor" + }, { - "type": "api", - "name": "AddAnimationToOneActor", - "method": "", - "description": "增加单个生物渲染动画", - "remark": "- 某些动画资源可能用到了molang表达式,在添加动画时请务必确保这些molang表达式也存在。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 某些动画资源可能用到了molang表达式,在添加动画时请务必确保这些molang表达式也存在。", + "return": [], + "description": "增加单个生物渲染动画", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddAnimationToOneActor(entityId, \"custom_move\", \"animation.armor_stand.default_pose\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体entityId" - }, + }, { - "name": "animationKey", - "type": "str", + "type": "str", + "name": "animationKey", "description": "动画键" - }, + }, { - "name": "animationName", - "type": "str", + "type": "str", + "name": "animationName", "description": "动画名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddAnimationToOneActor(entityId, \"custom_move\", \"animation.armor_stand.default_pose\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddAnimationToOneActor" + }, { - "type": "api", - "name": "AddGeometryToOneActor", - "method": "", - "description": "增加单个生物渲染几何体", - "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效\r\n 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图。建议先修改生物的动画以及动画控制器后再修改生物的几何。\r\n - 某些生物受初始动画影响,几何体会有初始偏移,会导致修改几何体后表现异常。若修改后的几何体没有当前动画需要的骨骼时,会触发报错。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效\r\n 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图。建议先修改生物的动画以及动画控制器后再修改生物的几何。\r\n - 某些生物受初始动画影响,几何体会有初始偏移,会导致修改几何体后表现异常。若修改后的几何体没有当前动画需要的骨骼时,会触发报错。", + "return": [], + "description": "增加单个生物渲染几何体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddGeometryToOneActor(entityId, \"default\", \"geometry.panda\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物实体entityId" - }, + }, { - "name": "geometryKey", - "type": "str", + "type": "str", + "name": "geometryKey", "description": "渲染几何体的键,如default" - }, + }, { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "渲染几何体名称,如熊猫几何体geometry.panda" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddGeometryToOneActor(entityId, \"default\", \"geometry.panda\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddGeometryToOneActor" + }, { - "type": "api", - "name": "AddParticleEffectToOneActor", - "method": "", - "description": "增加生物特效资源", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "增加生物特效资源", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddParticleEffectToOneActor(entityId, \"nectar_dripping\", \"minecraft:nectar_drip_particle\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体entityId" - }, + }, { - "name": "effectKey", - "type": "str", + "type": "str", + "name": "effectKey", "description": "特效资源Key,如bee.entity.json中的nectar_dripping" - }, + }, { - "name": "effectName", - "type": "str", + "type": "str", + "name": "effectName", "description": "特效资源名称,如minecraft:nectar_drip_particle" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddParticleEffectToOneActor(entityId, \"nectar_dripping\", \"minecraft:nectar_drip_particle\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddParticleEffectToOneActor" + }, { - "type": "api", - "name": "AddRenderControllerToOneActor", - "method": "", - "description": "增加单个生物的渲染控制器", - "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效", + "return": [], + "description": "增加单个生物的渲染控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddRenderControllerToOneActor(entityId, 'controller.render.llama', 'query.mod.condition')", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物entityId" - }, + }, { - "name": "renderControllerName", - "type": "str", + "type": "str", + "name": "renderControllerName", "description": "渲染控制器名称" - }, + }, { - "name": "condition", - "type": "str", + "type": "str", + "name": "condition", "description": "渲染控制器条件,当该条件成立时,renderControllerName指向的渲染控制器才会生效" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddRenderControllerToOneActor(entityId, 'controller.render.llama', 'query.mod.condition')" - }, + ], + "type": "api", + "side": "client", + "name": "AddRenderControllerToOneActor" + }, { - "type": "api", - "name": "AddRenderMaterialToOneActor", - "method": "", - "description": "增加单个生物渲染需要的材质", - "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效", + "return": [], + "description": "增加单个生物渲染需要的材质", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddRenderMaterialToOneActor(entityId, 'custom_material_key', 'custom_material_name')", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物的entityId" - }, + }, { - "name": "materialKey", - "type": "str", + "type": "str", + "name": "materialKey", "description": "材质的键" - }, + }, { - "name": "materialName", - "type": "str", + "type": "str", + "name": "materialName", "description": "材质名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddRenderMaterialToOneActor(entityId, 'custom_material_key', 'custom_material_name')" - }, + ], + "type": "api", + "side": "client", + "name": "AddRenderMaterialToOneActor" + }, { - "type": "api", - "name": "AddScriptAnimateToOneActor", - "method": "", - "description": "在单个生物的客户端实体定义(minecraft:client_entity)json中的scripts/animate节点添加动画/动画控制器", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "在单个生物的客户端实体定义(minecraft:client_entity)json中的scripts/animate节点添加动画/动画控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.AddAnimationControllerToOneActor(entityId, animation_controller_short_name\", \"controller.animation.pig.custom_animation_controller\")\r\ncomp.AddScriptAnimateToOneActor(entityId, \"animation_controller_short_name\", \"query.mod.index > 0\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体entityId" - }, + }, { - "name": "animateName", - "type": "str", + "type": "str", + "name": "animateName", "description": "动画/动画控制器名称,如look_at_target" - }, + }, { - "name": "condition", - "type": "str", + "type": "str", + "name": "condition", "description": "动画/动画控制器控制表达式,默认为空,如query.mod.index > 0" - }, + }, { - "name": "autoReplace", - "type": "bool", + "type": "bool", + "name": "autoReplace", "description": "是否覆盖已存在的动画/动画控制器,默认值为False" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.AddAnimationControllerToOneActor(entityId, animation_controller_short_name\", \"controller.animation.pig.custom_animation_controller\")\r\ncomp.AddScriptAnimateToOneActor(entityId, \"animation_controller_short_name\", \"query.mod.index > 0\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddScriptAnimateToOneActor" + }, { - "type": "api", - "name": "AddSoundEffectToOneActor", - "method": "", - "description": "增加单个生物的音效资源", - "remark": "- 目前只支持在动作(animation)中播放音效,不支持在动作控制器(animation controller)中播放音效。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 目前只支持在动作(animation)中播放音效,不支持在动作控制器(animation controller)中播放音效。", + "return": [], + "description": "增加单个生物的音效资源", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddSoundEffectToOneActor(entityId, \"sound_thunder\", \"ambient.weather.thunder\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体entityId" - }, + }, { - "name": "soundKey", - "type": "str", + "type": "str", + "name": "soundKey", "description": "音效资源Key" - }, + }, { - "name": "soundName", - "type": "str", + "type": "str", + "name": "soundName", "description": "音效资源名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddSoundEffectToOneActor(entityId, \"sound_thunder\", \"ambient.weather.thunder\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddSoundEffectToOneActor" + }, { - "type": "api", - "name": "AddTextureToOneActor", - "method": "", - "description": "增加单个生物的渲染贴图", - "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效", + "return": [], + "description": "增加单个生物的渲染贴图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddTextureToOneActor(entityId, \"default\", \"textures/entity/panda/panda\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物实体entityId" - }, + }, { - "name": "textureKey", - "type": "str", + "type": "str", + "name": "textureKey", "description": "贴图键" - }, + }, { - "name": "texturePath", - "type": "str", + "type": "str", + "name": "texturePath", "description": "贴图路径" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.AddTextureToOneActor(entityId, \"default\", \"textures/entity/panda/panda\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddTextureToOneActor" + }, { - "type": "api", - "name": "BindEntityToEntity", - "method": "", - "description": "绑定骨骼模型跟随其他entity,如果当前entity是本地玩家,摄像机也跟随其他entity", - "remark": "- 本接口只实现视觉效果,本质上实体还是在原地,因此需要调用接口设置实体的位置到其他entity的位置上,否则当实体本身不在摄像机范围内的时候就会不进行渲染了。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 本接口只实现视觉效果,本质上实体还是在原地,因此需要调用接口设置实体的位置到其他entity的位置上,否则当实体本身不在摄像机范围内的时候就会不进行渲染了。", + "return": [], + "description": "绑定骨骼模型跟随其他entity,如果当前entity是本地玩家,摄像机也跟随其他entity", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# 将entityId的实体绑定至bindEntityId的实体\r\ncomp = clientApi.GetEngineCompFactory().CreateModel(entityId)\r\ncomp.BindEntityToEntity(bindEntityId)", "params": [ { - "name": "bindEntityId", - "type": "str", + "type": "str", + "name": "bindEntityId", "description": "绑定跟随的实体Id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# 将entityId的实体绑定至bindEntityId的实体\r\ncomp = clientApi.GetEngineCompFactory().CreateModel(entityId)\r\ncomp.BindEntityToEntity(bindEntityId)" - }, + ], + "type": "api", + "side": "client", + "name": "BindEntityToEntity" + }, { - "type": "api", - "name": "ClearActorBlockGeometry", - "method": "", - "description": "删除实体中所有的方块几何体模型。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 合并方块并转换为名叫\"my_block_geometry\"的方块几何体模型\r\ngeometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],\"my_block_geometry\")\r\n# 添加到实体id为-4294967295的实体中\r\nprint actorRenderComp.AddActorBlockGeometry(geometryName)\r\n# 清空实体中所有的方块几何体\r\nprint actorRenderComp.ClearActorBlockGeometry()" - }, + "remark": "", + "return": [], + "description": "删除实体中所有的方块几何体模型。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 合并方块并转换为名叫\"my_block_geometry\"的方块几何体模型\r\ngeometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],\"my_block_geometry\")\r\n# 添加到实体id为-4294967295的实体中\r\nprint actorRenderComp.AddActorBlockGeometry(geometryName)\r\n# 清空实体中所有的方块几何体\r\nprint actorRenderComp.ClearActorBlockGeometry()", + "params": [], + "type": "api", + "side": "client", + "name": "ClearActorBlockGeometry" + }, { - "type": "api", - "name": "CopyActorGeometryFromPlayer", - "method": "", - "description": "将渲染几何体从某个玩家拷贝到某类生物identifier上", - "remark": "- 调用该接口后需要调用RebuildActorRender才会生效\r\n 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图。建议先修改生物的动画以及动画控制器后再修改生物的几何。\r\n - 某些生物受初始动画影响,几何体会有初始偏移,会导致修改几何体后表现异常。若修改后的几何体没有当前动画需要的骨骼时,会触发报错。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用RebuildActorRender才会生效\r\n 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图。建议先修改生物的动画以及动画控制器后再修改生物的几何。\r\n - 某些生物受初始动画影响,几何体会有初始偏移,会导致修改几何体后表现异常。若修改后的几何体没有当前动画需要的骨骼时,会触发报错。", + "return": [], + "description": "将渲染几何体从某个玩家拷贝到某类生物identifier上", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.CopyActorGeometryFromPlayer(playerId, \"minecraft:sheep\", \"default\", \"default\")", "params": [ { - "name": "fromPlayerId", - "type": "str", + "type": "str", + "name": "fromPlayerId", "description": "源玩家id" - }, + }, { - "name": "toActorIdentifier", - "type": "str", + "type": "str", + "name": "toActorIdentifier", "description": "拷贝到的生物identifier" - }, + }, { - "name": "fromGeometryKey", - "type": "str", + "type": "str", + "name": "fromGeometryKey", "description": "源渲染几何体的键" - }, + }, { - "name": "newGeometryKey", - "type": "str", + "type": "str", + "name": "newGeometryKey", "description": "拷贝后新渲染几何体的键" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.CopyActorGeometryFromPlayer(playerId, \"minecraft:sheep\", \"default\", \"default\")" - }, + ], + "type": "api", + "side": "client", + "name": "CopyActorGeometryFromPlayer" + }, { - "type": "api", - "name": "CopyActorRenderMaterialFromPlayer", - "method": "", - "description": "将渲染材质从某个玩家拷贝到某类生物identifier上", - "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", + "return": [], + "description": "将渲染材质从某个玩家拷贝到某类生物identifier上", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.CopyActorRenderMaterialFromPlayer(playerId, 'minecraft:sheep', 'default', 'default')", "params": [ { - "name": "fromPlayerId", - "type": "str", + "type": "str", + "name": "fromPlayerId", "description": "源玩家id" - }, + }, { - "name": "toActorIdentifier", - "type": "str", + "type": "str", + "name": "toActorIdentifier", "description": "拷贝到的生物identifier" - }, + }, { - "name": "fromMaterialKey", - "type": "str", + "type": "str", + "name": "fromMaterialKey", "description": "源材质的键" - }, + }, { - "name": "newMaterialKey", - "type": "str", + "type": "str", + "name": "newMaterialKey", "description": "拷贝后新材质的键" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.CopyActorRenderMaterialFromPlayer(playerId, 'minecraft:sheep', 'default', 'default')" - }, + ], + "type": "api", + "side": "client", + "name": "CopyActorRenderMaterialFromPlayer" + }, { - "type": "api", - "name": "CopyActorTextureFromPlayer", - "method": "", - "description": "将贴图从某个玩家拷贝到某类生物identifier上", - "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", + "return": [], + "description": "将贴图从某个玩家拷贝到某类生物identifier上", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.CopyActorTextureFromPlayer(playerId, \"minecraft:sheep\", \"default\", \"default\")", "params": [ { - "name": "fromPlayerId", - "type": "str", + "type": "str", + "name": "fromPlayerId", "description": "源玩家id" - }, + }, { - "name": "toActorIdentifier", - "type": "str", + "type": "str", + "name": "toActorIdentifier", "description": "拷贝到的生物identifier" - }, + }, { - "name": "fromTextureKey", - "type": "str", + "type": "str", + "name": "fromTextureKey", "description": "贴图键" - }, + }, { - "name": "newTextureKey", - "type": "str", + "type": "str", + "name": "newTextureKey", "description": "拷贝后新贴图的键" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.CopyActorTextureFromPlayer(playerId, \"minecraft:sheep\", \"default\", \"default\")" - }, + ], + "type": "api", + "side": "client", + "name": "CopyActorTextureFromPlayer" + }, { - "type": "api", - "name": "CopyPlayerGeometryToOneActor", - "method": "", - "description": "将渲染几何体从某个玩家拷贝到某个生物上", - "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效\r\n 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图。建议先修改生物的动画以及动画控制器后再修改生物的几何。\r\n - 该接口使用时,会将这类生物当前的客户端数据拷贝一份,独立给这个实体使用(如果这个实体已经独自持有客户端数据则不会再次拷贝)\r\n - 当生物离开再出现在视野时,不会恢复oneActor类渲染接口的设置,需要开发者监听[AddEntityClientEvent](../../事件/世界.md#addentityclientevent)再次设置entity类渲染接口进行恢复\r\n - 某些生物受初始动画影响,几何体会有初始偏移,会导致修改几何体后表现异常。若修改后的几何体没有当前动画需要的骨骼时,会触发报错。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效\r\n 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图。建议先修改生物的动画以及动画控制器后再修改生物的几何。\r\n - 该接口使用时,会将这类生物当前的客户端数据拷贝一份,独立给这个实体使用(如果这个实体已经独自持有客户端数据则不会再次拷贝)\r\n - 当生物离开再出现在视野时,不会恢复oneActor类渲染接口的设置,需要开发者监听[AddEntityClientEvent](../../事件/世界.md#addentityclientevent)再次设置entity类渲染接口进行恢复\r\n - 某些生物受初始动画影响,几何体会有初始偏移,会导致修改几何体后表现异常。若修改后的几何体没有当前动画需要的骨骼时,会触发报错。", + "return": [], + "description": "将渲染几何体从某个玩家拷贝到某个生物上", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.CopyPlayerGeometryToOneActor(playerId, \"default\", \"default\")", "params": [ { - "name": "fromPlayerId", - "type": "str", + "type": "str", + "name": "fromPlayerId", "description": "源玩家id" - }, + }, { - "name": "fromGeometryKey", - "type": "str", + "type": "str", + "name": "fromGeometryKey", "description": "源渲染几何体的键" - }, + }, { - "name": "newGeometryKey", - "type": "str", + "type": "str", + "name": "newGeometryKey", "description": "拷贝后新渲染几何体的键" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.CopyPlayerGeometryToOneActor(playerId, \"default\", \"default\")" - }, + ], + "type": "api", + "side": "client", + "name": "CopyPlayerGeometryToOneActor" + }, { - "type": "api", - "name": "CopyPlayerRenderMaterialToOneActor", - "method": "", - "description": "将渲染材质从某个玩家拷贝到某个生物上", - "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效\r\n - 该接口使用时,会将这类生物当前的客户端数据拷贝一份,独立给这个实体使用(如果这个实体已经独自持有客户端数据则不会再次拷贝)\r\n - 当生物离开再出现在视野时,不会恢复oneActor类渲染接口的设置,需要开发者监听[AddEntityClientEvent](../../事件/世界.md#addentityclientevent)再次设置entity类渲染接口进行恢复", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效\r\n - 该接口使用时,会将这类生物当前的客户端数据拷贝一份,独立给这个实体使用(如果这个实体已经独自持有客户端数据则不会再次拷贝)\r\n - 当生物离开再出现在视野时,不会恢复oneActor类渲染接口的设置,需要开发者监听[AddEntityClientEvent](../../事件/世界.md#addentityclientevent)再次设置entity类渲染接口进行恢复", + "return": [], + "description": "将渲染材质从某个玩家拷贝到某个生物上", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.CopyPlayerRenderMaterialToOneActor(playerId, 'default', 'default')", "params": [ { - "name": "fromPlayerId", - "type": "str", + "type": "str", + "name": "fromPlayerId", "description": "源玩家id" - }, + }, { - "name": "fromMaterialKey", - "type": "str", + "type": "str", + "name": "fromMaterialKey", "description": "源材质的键" - }, + }, { - "name": "newMaterialKey", - "type": "str", + "type": "str", + "name": "newMaterialKey", "description": "拷贝后新材质的键" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.CopyPlayerRenderMaterialToOneActor(playerId, 'default', 'default')" - }, + ], + "type": "api", + "side": "client", + "name": "CopyPlayerRenderMaterialToOneActor" + }, { - "type": "api", - "name": "CopyPlayerTextureToOneActor", - "method": "", - "description": "将贴图从某个玩家拷贝到某个生物上", - "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效\r\n - 该接口使用时,会将这类生物当前的客户端数据拷贝一份,独立给这个实体使用(如果这个实体已经独自持有客户端数据则不会再次拷贝)\r\n - 当生物离开再出现在视野时,不会恢复oneActor类渲染接口的设置,需要开发者监听[AddEntityClientEvent](../../事件/世界.md#addentityclientevent)再次设置entity类渲染接口进行恢复", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效\r\n - 该接口使用时,会将这类生物当前的客户端数据拷贝一份,独立给这个实体使用(如果这个实体已经独自持有客户端数据则不会再次拷贝)\r\n - 当生物离开再出现在视野时,不会恢复oneActor类渲染接口的设置,需要开发者监听[AddEntityClientEvent](../../事件/世界.md#addentityclientevent)再次设置entity类渲染接口进行恢复", + "return": [], + "description": "将贴图从某个玩家拷贝到某个生物上", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.CopyPlayerTextureToOneActor(playerId, \"default\", \"default\")", "params": [ { - "name": "fromPlayerId", - "type": "str", + "type": "str", + "name": "fromPlayerId", "description": "源玩家id" - }, + }, { - "name": "fromTextureKey", - "type": "str", + "type": "str", + "name": "fromTextureKey", "description": "贴图键" - }, + }, { - "name": "newTextureKey", - "type": "str", + "type": "str", + "name": "newTextureKey", "description": "拷贝后新贴图的键" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.CopyPlayerTextureToOneActor(playerId, \"default\", \"default\")" - }, + ], + "type": "api", + "side": "client", + "name": "CopyPlayerTextureToOneActor" + }, { - "type": "api", - "name": "DeleteActorBlockGeometry", - "method": "", - "description": "删除实体中指定方块几何体模型。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "删除实体中指定方块几何体模型。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 合并方块并转换为名叫\"my_block_geometry\"的方块几何体模型\r\ngeometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],\"my_block_geometry\")\r\n# 添加到实体id为-4294967295的实体中\r\nprint actorRenderComp.AddActorBlockGeometry(geometryName)\r\n# 删除刚才添加的方块几何体\r\nprint actorRenderComp.DeleteActorBlockGeometry(geometryName)", "params": [ { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 合并方块并转换为名叫\"my_block_geometry\"的方块几何体模型\r\ngeometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],\"my_block_geometry\")\r\n# 添加到实体id为-4294967295的实体中\r\nprint actorRenderComp.AddActorBlockGeometry(geometryName)\r\n# 删除刚才添加的方块几何体\r\nprint actorRenderComp.DeleteActorBlockGeometry(geometryName)" - }, + ], + "type": "api", + "side": "client", + "name": "DeleteActorBlockGeometry" + }, { - "type": "api", - "name": "GetActorRenderParams", - "method": "", - "description": "获取实体(包括玩家)渲染参数", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "获取实体(包括玩家)渲染参数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ntextureKeys = comp.GetActorRenderParams(entityId, \"textures\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体Id" - }, + }, { - "name": "paramTypeStr", - "type": "str", + "type": "str", + "name": "paramTypeStr", "description": "渲染参数类型,可选类型有\"textures\",\"geometry\",\"materials\",\"animations\",\"render_controllers\",\"particle_effects\",\"sound_effects\"" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ntextureKeys = comp.GetActorRenderParams(entityId, \"textures\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetActorRenderParams" + }, { - "type": "api", - "name": "GetEntityExtraUniforms", - "method": "", - "description": "获取在实体shader当中使用的自定义变量的值。该自定义变量包含EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量。", - "remark": "- 此接口是针对使用了原版BB模型的实体,使用了骨骼模型的实体和玩家请使用SetExtraUniformValue接口进行动态设置。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 此接口是针对使用了原版BB模型的实体,使用了骨骼模型的实体和玩家请使用SetExtraUniformValue接口进行动态设置。", + "return": [], + "description": "获取在实体shader当中使用的自定义变量的值。该自定义变量包含EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\n# 获取实体id为entityId的实体正在使用的自定义变量EXTRA_ACTOR_UNIFORM2的值\r\nprint actorRenderComp.GetEntityExtraUniforms(2)\r\n# 获取实体id为entityId的实体正在使用的自定义变量EXTRA_ACTOR_UNIFORM4的值\r\nprint actorRenderComp.GetEntityExtraUniforms(4)", "params": [ { - "name": "uniformIndex", - "type": "int", + "type": "int", + "name": "uniformIndex", "description": "需要设置的自定义变量的下标,值范围为1~4。分别对应EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\n# 获取实体id为entityId的实体正在使用的自定义变量EXTRA_ACTOR_UNIFORM2的值\r\nprint actorRenderComp.GetEntityExtraUniforms(2)\r\n# 获取实体id为entityId的实体正在使用的自定义变量EXTRA_ACTOR_UNIFORM4的值\r\nprint actorRenderComp.GetEntityExtraUniforms(4)" - }, + ], + "type": "api", + "side": "client", + "name": "GetEntityExtraUniforms" + }, { - "type": "api", - "name": "GetEntityRenderDistance", - "method": "", - "description": "获取玩家的实体可渲染距离。玩家周围的实体指这个区块内的实体,也包含玩家自身。实体的渲染距离指,实体的位置到玩家相机位置的距离。可渲染距离指,如果实体的渲染距离在可渲染距离之内,则实体会被渲染出来,如果在距离以外,则实体不会被渲染出来。仅对本地玩家有效。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\n# 获取当前玩家的实体可渲染距离\r\nprint actorRenderComp.GetEntityRenderDistance()" - }, + "remark": "", + "return": [], + "description": "获取玩家的实体可渲染距离。玩家周围的实体指这个区块内的实体,也包含玩家自身。实体的渲染距离指,实体的位置到玩家相机位置的距离。可渲染距离指,如果实体的渲染距离在可渲染距离之内,则实体会被渲染出来,如果在距离以外,则实体不会被渲染出来。仅对本地玩家有效。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\n# 获取当前玩家的实体可渲染距离\r\nprint actorRenderComp.GetEntityRenderDistance()", + "params": [], + "type": "api", + "side": "client", + "name": "GetEntityRenderDistance" + }, { - "type": "api", - "name": "GetEntityUIExtraUniforms", - "method": "", - "description": "获取在实体shader当中使用的UI自定义变量的值,该变量可在微软UI纸娃娃(paperdoll)及网易版纸娃娃(neteasepaperdoll)上使用identifier渲染某一类生物实体时使用。该自定义变量包含EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量。", - "remark": "- 此接口是针对使用了原版BB模型的实体,使用了骨骼模型的实体和玩家请使用SetExtraUniformValue接口进行动态设置。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 此接口是针对使用了原版BB模型的实体,使用了骨骼模型的实体和玩家请使用SetExtraUniformValue接口进行动态设置。", + "return": [], + "description": "获取在实体shader当中使用的UI自定义变量的值,该变量可在微软UI纸娃娃(paperdoll)及网易版纸娃娃(neteasepaperdoll)上使用identifier渲染某一类生物实体时使用。该自定义变量包含EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(None)\r\n# 获取苦力怕正在使用的UI自定义变量EXTRA_ACTOR_UNIFORM2的值\r\nprint actorRenderComp.GetEntityUIExtraUniforms(\"minecraft:creeper\", 2)\r\n# 获取玩家正在使用的UI自定义变量EXTRA_ACTOR_UNIFORM4的值\r\nprint actorRenderComp.GetEntityUIExtraUniforms(\"minecraft:player\",4)", "params": [ { - "name": "entityIdentifier", - "type": "str", + "type": "str", + "name": "entityIdentifier", "description": "需要设置的实体identifier。如果获取玩家,则填写minecraft:player。" - }, + }, { - "name": "uniformIndex", - "type": "int", + "type": "int", + "name": "uniformIndex", "description": "需要设置的自定义变量的下标,值范围为1~4。分别对应EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(None)\r\n# 获取苦力怕正在使用的UI自定义变量EXTRA_ACTOR_UNIFORM2的值\r\nprint actorRenderComp.GetEntityUIExtraUniforms(\"minecraft:creeper\", 2)\r\n# 获取玩家正在使用的UI自定义变量EXTRA_ACTOR_UNIFORM4的值\r\nprint actorRenderComp.GetEntityUIExtraUniforms(\"minecraft:player\",4)" - }, + ], + "type": "api", + "side": "client", + "name": "GetEntityUIExtraUniforms" + }, { - "type": "api", - "name": "GetNotRenderAtAll", - "method": "", - "description": "获取实体是否不渲染", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\nnotRender = comp.GetNotRenderAtAll()" - }, + "remark": "", + "return": [], + "description": "获取实体是否不渲染", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\nnotRender = comp.GetNotRenderAtAll()", + "params": [], + "type": "api", + "side": "client", + "name": "GetNotRenderAtAll" + }, { - "type": "api", - "name": "IsShowName", - "method": "", - "description": "获取生物名字是否按照默认游戏逻辑显示(包括玩家)", - "remark": "- 获取的值仅代表实体名字是否显示,但是最终是否显示还会受到全局名字是否显示影响,详见接口HideNameTag", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateName(entityId)\r\ncomp.IsShowName()" - }, + "remark": "- 获取的值仅代表实体名字是否显示,但是最终是否显示还会受到全局名字是否显示影响,详见接口HideNameTag", + "return": [], + "description": "获取生物名字是否按照默认游戏逻辑显示(包括玩家)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateName(entityId)\r\ncomp.IsShowName()", + "params": [], + "type": "api", + "side": "client", + "name": "IsShowName" + }, { - "type": "api", - "name": "RebuildActorRender", - "method": "", - "description": "重建生物的数据渲染器(该接口不支持玩家,玩家请使用RebuildPlayerRender)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "重建生物的数据渲染器(该接口不支持玩家,玩家请使用RebuildPlayerRender)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RebuildActorRender('minecraft:villager')", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "实体identifier" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RebuildActorRender('minecraft:villager')" - }, + ], + "type": "api", + "side": "client", + "name": "RebuildActorRender" + }, { - "type": "api", - "name": "RebuildRenderForOneActor", - "method": "", - "description": "使用完entity类渲染接口后,重建单个生物渲染控制器(该接口不支持玩家,玩家请使用RebuildPlayerRender)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.RebuildRenderForOneActor()" - }, + "remark": "", + "return": [], + "description": "使用完entity类渲染接口后,重建单个生物渲染控制器(该接口不支持玩家,玩家请使用RebuildPlayerRender)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.RebuildRenderForOneActor()", + "params": [], + "type": "api", + "side": "client", + "name": "RebuildRenderForOneActor" + }, { - "type": "api", - "name": "RemoveActorAnimationController", - "method": "", - "description": "移除生物渲染动画控制器", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "移除生物渲染动画控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.RemoveActorAnimationController(\"minecraft:villager\", \"controller__use_item_progress\")", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "生物的identifier" - }, + }, { - "name": "animationControllKey", - "type": "str", + "type": "str", + "name": "animationControllKey", "description": "动画控制器键,注意,该值需要在json中动画控制器键加上前缀“controller__”" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.RemoveActorAnimationController(\"minecraft:villager\", \"controller__use_item_progress\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveActorAnimationController" + }, { - "type": "api", - "name": "RemoveActorGeometry", - "method": "", - "description": "删除生物渲染几何体", - "remark": "- 调用该接口后需要调用RebuildActorRender才会生效\r\n 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用RebuildActorRender才会生效\r\n 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图", + "return": [], + "description": "删除生物渲染几何体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# geometry definition in panda.entity.json\r\n# \"geometry\": {\r\n# \"default\": \"geometry.panda\"\r\n# },\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RemoveActorGeometry(\"minecraft:panda\", \"default\")", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "生物实体identifier" - }, + }, { - "name": "geometryKey", - "type": "str", + "type": "str", + "name": "geometryKey", "description": "渲染几何体名称,如熊猫几何体geometry.panda" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# geometry definition in panda.entity.json\r\n# \"geometry\": {\r\n# \"default\": \"geometry.panda\"\r\n# },\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RemoveActorGeometry(\"minecraft:panda\", \"default\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveActorGeometry" + }, { - "type": "api", - "name": "RemoveActorRenderController", - "method": "", - "description": "删除生物渲染控制器", - "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", + "return": [], + "description": "删除生物渲染控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RemoveActorRenderController('minecraft:villager', 'custom_render_controller_name')", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "生物identifier" - }, + }, { - "name": "renderControllerName", - "type": "str", + "type": "str", + "name": "renderControllerName", "description": "渲染控制器名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RemoveActorRenderController('minecraft:villager', 'custom_render_controller_name')" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveActorRenderController" + }, { - "type": "api", - "name": "RemoveActorTexture", - "method": "", - "description": "删除生物渲染贴图", - "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用RebuildActorRender才会生效", + "return": [], + "description": "删除生物渲染贴图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# texture definition in panda.entity.json\r\n# \"textures\": {\r\n# \"default\": \"textures/entity/panda/panda\",\r\n# \"lazy\": \"textures/entity/panda/panda_lazy\",\r\n# \"worried\": \"textures/entity/panda/panda_worried\",\r\n# \"playful\": \"textures/entity/panda/panda_playful\",\r\n# \"brown\": \"textures/entity/panda/panda_brown\",\r\n# \"weak\": \"textures/entity/panda/panda_sneezy\",\r\n# \"aggressive\": \"textures/entity/panda/panda_aggressive\"\r\n# }\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RemoveActorTexture(\"minecraft:panda\", \"default\")", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "生物实体identifier" - }, + }, { - "name": "textureKey", - "type": "str", + "type": "str", + "name": "textureKey", "description": "贴图键,如default" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# texture definition in panda.entity.json\r\n# \"textures\": {\r\n# \"default\": \"textures/entity/panda/panda\",\r\n# \"lazy\": \"textures/entity/panda/panda_lazy\",\r\n# \"worried\": \"textures/entity/panda/panda_worried\",\r\n# \"playful\": \"textures/entity/panda/panda_playful\",\r\n# \"brown\": \"textures/entity/panda/panda_brown\",\r\n# \"weak\": \"textures/entity/panda/panda_sneezy\",\r\n# \"aggressive\": \"textures/entity/panda/panda_aggressive\"\r\n# }\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RemoveActorTexture(\"minecraft:panda\", \"default\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveActorTexture" + }, { - "type": "api", - "name": "RemoveAnimationControllerForOneActor", - "method": "", - "description": "移除单个生物渲染动画控制器", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "移除单个生物渲染动画控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.RemoveAnimationControllerForOneActor(entityId, \"controller__use_item_progress\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物的entityId" - }, + }, { - "name": "animationControllKey", - "type": "str", + "type": "str", + "name": "animationControllKey", "description": "动画控制器键,注意,该值需要在json中动画控制器键加上前缀“controller__”" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.RemoveAnimationControllerForOneActor(entityId, \"controller__use_item_progress\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveAnimationControllerForOneActor" + }, { - "type": "api", - "name": "RemoveGeometryForOneActor", - "method": "", - "description": "删除单个生物的渲染几何体", - "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效\r\n 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效\r\n 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图", + "return": [], + "description": "删除单个生物的渲染几何体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# geometry definition in panda.entity.json\r\n# \"geometry\": {\r\n# \"default\": \"geometry.panda\"\r\n# },\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RemoveGeometryForOneActor(\"0\", \"default\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物实体entityId" - }, + }, { - "name": "geometryKey", - "type": "str", + "type": "str", + "name": "geometryKey", "description": "渲染几何体名称,如熊猫几何体geometry.panda" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# geometry definition in panda.entity.json\r\n# \"geometry\": {\r\n# \"default\": \"geometry.panda\"\r\n# },\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RemoveGeometryForOneActor(\"0\", \"default\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveGeometryForOneActor" + }, { - "type": "api", - "name": "RemoveRenderControllerForOneActor", - "method": "", - "description": "删除单个生物的渲染控制器", - "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效", + "return": [], + "description": "删除单个生物的渲染控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RemoveRenderControllerForOneActor('0', 'custom_render_controller_name')", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物entityId" - }, + }, { - "name": "renderControllerName", - "type": "str", + "type": "str", + "name": "renderControllerName", "description": "渲染控制器名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RemoveRenderControllerForOneActor('0', 'custom_render_controller_name')" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveRenderControllerForOneActor" + }, { - "type": "api", - "name": "RemoveTextureForOneActor", - "method": "", - "description": "删除单个生物的渲染贴图", - "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效", + "return": [], + "description": "删除单个生物的渲染贴图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RemoveTextureForOneActor(\"0\", \"default\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物实体entityId" - }, + }, { - "name": "textureKey", - "type": "str", + "type": "str", + "name": "textureKey", "description": "贴图键,如default" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.RemoveTextureForOneActor(\"0\", \"default\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveTextureForOneActor" + }, { - "type": "api", - "name": "ResetActorRender", - "method": "", - "description": "重置实体渲染接口,包括动画、动画控制器、渲染控制器、贴图、材质、特效资源、音效资源等。", - "remark": "- 该接口目前只对生物生效,无法对玩家实体生效。只有修改过的实体才能reset成功,并且reset后在有新修改前,都无法reset成功。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 该接口目前只对生物生效,无法对玩家实体生效。只有修改过的实体才能reset成功,并且reset后在有新修改前,都无法reset成功。", + "return": [], + "description": "重置实体渲染接口,包括动画、动画控制器、渲染控制器、贴图、材质、特效资源、音效资源等。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.ResetActorRender(\"minecraft:sheep\")", "params": [ { - "name": "actorIdentifier", - "type": "str", + "type": "str", + "name": "actorIdentifier", "description": "生物的identifier" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)\r\ncomp.ResetActorRender(\"minecraft:sheep\")" - }, + ], + "type": "api", + "side": "client", + "name": "ResetActorRender" + }, { - "type": "api", - "name": "ResetBindEntity", - "method": "", - "description": "取消目标entity的绑定实体,取消后不再跟随任何其他entity", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateModel(entityId)\r\ncomp.ResetBindEntity()" - }, + "remark": "", + "return": [], + "description": "取消目标entity的绑定实体,取消后不再跟随任何其他entity", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateModel(entityId)\r\ncomp.ResetBindEntity()", + "params": [], + "type": "api", + "side": "client", + "name": "ResetBindEntity" + }, { - "type": "api", - "name": "ResetRenderForOneActor", - "method": "", - "description": "将调用OneActor类渲染接口(CopyPlayerTextureToOneActor、CopyPlayerRenderMaterialToOneActor等)的生物重置回种群", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.ResetRenderForOneActor()" - }, + "remark": "", + "return": [], + "description": "将调用OneActor类渲染接口(CopyPlayerTextureToOneActor、CopyPlayerRenderMaterialToOneActor等)的生物重置回种群", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.ResetRenderForOneActor()", + "params": [], + "type": "api", + "side": "client", + "name": "ResetRenderForOneActor" + }, { - "type": "api", - "name": "SetActorAllBlockGeometryVisible", - "method": "", - "description": "设置实体中所有的方块几何体模型是否显示。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "设置实体中所有的方块几何体模型是否显示。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 合并方块并转换为名叫\"my_block_geometry\"的方块几何体模型\r\ngeometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],\"my_block_geometry\")\r\n# 添加到实体id为-4294967295的实体中\r\nprint actorRenderComp.AddActorBlockGeometry(geometryName)\r\n# 隐藏所有的方块几何体\r\nprint actorRenderComp.SetActorAllBlockGeometryVisible(False)", "params": [ { - "name": "visible", - "type": "bool", + "type": "bool", + "name": "visible", "description": "设置是否显示或隐藏,True表示显示,False表示隐藏" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 合并方块并转换为名叫\"my_block_geometry\"的方块几何体模型\r\ngeometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],\"my_block_geometry\")\r\n# 添加到实体id为-4294967295的实体中\r\nprint actorRenderComp.AddActorBlockGeometry(geometryName)\r\n# 隐藏所有的方块几何体\r\nprint actorRenderComp.SetActorAllBlockGeometryVisible(False)" - }, + ], + "type": "api", + "side": "client", + "name": "SetActorAllBlockGeometryVisible" + }, { - "type": "api", - "name": "SetActorBlockGeometryVisible", - "method": "", - "description": "设置实体中指定的方块几何体模型是否显示。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "设置实体中指定的方块几何体模型是否显示。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 合并方块并转换为名叫\"my_block_geometry\"的方块几何体模型\r\ngeometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],\"my_block_geometry\")\r\n# 添加到实体id为-4294967295的实体中\r\nprint actorRenderComp.AddActorBlockGeometry(geometryName)\r\n# 隐藏刚才添加的方块几何体\r\nprint actorRenderComp.SetActorBlockGeometryVisible(geometryName, False)", "params": [ { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id" - }, + }, { - "name": "visible", - "type": "bool", + "type": "bool", + "name": "visible", "description": "设置是否显示或隐藏,True表示显示,False表示隐藏" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 合并方块并转换为名叫\"my_block_geometry\"的方块几何体模型\r\ngeometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],\"my_block_geometry\")\r\n# 添加到实体id为-4294967295的实体中\r\nprint actorRenderComp.AddActorBlockGeometry(geometryName)\r\n# 隐藏刚才添加的方块几何体\r\nprint actorRenderComp.SetActorBlockGeometryVisible(geometryName, False)" - }, + ], + "type": "api", + "side": "client", + "name": "SetActorBlockGeometryVisible" + }, { - "type": "api", - "name": "SetAlwaysShowName", - "method": "", - "description": "设置生物名字是否一直显示,瞄准点不指向生物时也能显示", - "remark": "- 该接口只对普通生物生效,对玩家设置不起作用", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 该接口只对普通生物生效,对玩家设置不起作用", + "return": [], + "description": "设置生物名字是否一直显示,瞄准点不指向生物时也能显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateName(entityId)\r\n# 不显示头上的名字\r\ncomp.SetAlwaysShowName(False)", "params": [ { - "name": "show", - "type": "bool", + "type": "bool", + "name": "show", "description": "True为显示" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateName(entityId)\r\n# 不显示头上的名字\r\ncomp.SetAlwaysShowName(False)" - }, + ], + "type": "api", + "side": "client", + "name": "SetAlwaysShowName" + }, { - "type": "api", - "name": "SetColor", - "method": "", - "description": "设置血条的颜色及背景色", - "remark": "- 必须用game组件设置ShowHealthBar时才能显示血条!!", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 必须用game组件设置ShowHealthBar时才能显示血条!!", + "return": [], + "description": "设置血条的颜色及背景色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateHealth(entityId)\r\ncomp.SetColor((0, 0, 0, 1), (1, 1, 1, 1))", "params": [ { - "name": "front", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "front", "description": "血条颜色的RGBA值,范围0-1" - }, + }, { - "name": "back", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "back", "description": "背景颜色的RGBA值,范围0-1" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateHealth(entityId)\r\ncomp.SetColor((0, 0, 0, 1), (1, 1, 1, 1))" - }, + ], + "type": "api", + "side": "client", + "name": "SetColor" + }, { - "type": "api", - "name": "SetEntityExtraUniforms", - "method": "", - "description": "设置可在实体shader当中使用的自定义变量的值。该自定义变量总共可设置EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量,向量的默认值为(1.0,1.0,1.0,1.0)。", - "remark": "- 此接口是针对使用了原版BB模型的实体,使用了骨骼模型的实体和玩家请使用SetExtraUniformValue接口进行动态设置。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 此接口是针对使用了原版BB模型的实体,使用了骨骼模型的实体和玩家请使用SetExtraUniformValue接口进行动态设置。", + "return": [], + "description": "设置可在实体shader当中使用的自定义变量的值。该自定义变量总共可设置EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量,向量的默认值为(1.0,1.0,1.0,1.0)。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\n# 对实体id为entityId的实体设置自定义变量EXTRA_ACTOR_UNIFORM1的值\r\nprint actorRenderComp.SetEntityExtraUniforms(1, (2.5,2.5,2.5,2.5))\r\n# 对实体id为entityId的实体设置自定义变量EXTRA_ACTOR_UNIFORM3的值\r\nprint actorRenderComp.SetEntityExtraUniforms(3, (3.0,3.0,3.0,3.0))\r\n# 接下来,我们在实体的vertex shader或是fragment shader中做如下声明及使用:\r\n#\r\n# // .. 省略其他代码\r\n# // 声明这两个自定义变量\r\n# uniform vec4 EXTRA_ACTOR_UNIFORM1;\r\n# uniform vec4 EXTRA_ACTOR_UNIFORM3;\r\n#\r\n# void main() {\r\n# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM1;\r\n# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM3;\r\n# // .. do what you want ..\r\n# }", "params": [ { - "name": "uniformIndex", - "type": "int", + "type": "int", + "name": "uniformIndex", "description": "需要设置的自定义变量的下标,值范围为1~4。分别对应EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4。" - }, + }, { - "name": "data", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "data", "description": "需要设置的自定义变量的值。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\n# 对实体id为entityId的实体设置自定义变量EXTRA_ACTOR_UNIFORM1的值\r\nprint actorRenderComp.SetEntityExtraUniforms(1, (2.5,2.5,2.5,2.5))\r\n# 对实体id为entityId的实体设置自定义变量EXTRA_ACTOR_UNIFORM3的值\r\nprint actorRenderComp.SetEntityExtraUniforms(3, (3.0,3.0,3.0,3.0))\r\n# 接下来,我们在实体的vertex shader或是fragment shader中做如下声明及使用:\r\n#\r\n# // .. 省略其他代码\r\n# // 声明这两个自定义变量\r\n# uniform vec4 EXTRA_ACTOR_UNIFORM1;\r\n# uniform vec4 EXTRA_ACTOR_UNIFORM3;\r\n#\r\n# void main() {\r\n# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM1;\r\n# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM3;\r\n# // .. do what you want ..\r\n# }" - }, + ], + "type": "api", + "side": "client", + "name": "SetEntityExtraUniforms" + }, { - "type": "api", - "name": "SetEntityRenderDistance", - "method": "", - "description": "设置玩家周围的实体的可渲染距离。玩家周围的实体指这个区块内的实体,也包含玩家自身。实体的渲染距离指,实体的位置到玩家相机位置的距离。可渲染距离指,如果实体的渲染距离在可渲染距离之内,则实体会被渲染出来,如果在距离以外,则实体不会被渲染出来。仅对本地玩家有效。", - "remark": "- 需要特别注意,该渲染距离指的是实体的位置到玩家相机的位置,而非玩家的位置。当玩家相机视觉上下转动或是左右转动时,玩家相机的位置是绕以相机中心为球心的球形表面进行旋转。因此视觉转动时,玩家相机位置与实体之间距离也会进行改变,导致该实体的渲染距离改变。一些玩法会改变相机位置制作来超远或者超过视角的,可能会出现看不到玩家自身模型的问题。此时可以调用该接口来调整渲染距离,从而使得玩家自身可见或不可见。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 需要特别注意,该渲染距离指的是实体的位置到玩家相机的位置,而非玩家的位置。当玩家相机视觉上下转动或是左右转动时,玩家相机的位置是绕以相机中心为球心的球形表面进行旋转。因此视觉转动时,玩家相机位置与实体之间距离也会进行改变,导致该实体的渲染距离改变。一些玩法会改变相机位置制作来超远或者超过视角的,可能会出现看不到玩家自身模型的问题。此时可以调用该接口来调整渲染距离,从而使得玩家自身可见或不可见。", + "return": [], + "description": "设置玩家周围的实体的可渲染距离。玩家周围的实体指这个区块内的实体,也包含玩家自身。实体的渲染距离指,实体的位置到玩家相机位置的距离。可渲染距离指,如果实体的渲染距离在可渲染距离之内,则实体会被渲染出来,如果在距离以外,则实体不会被渲染出来。仅对本地玩家有效。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\n# 设置实体的可渲染距离为48\r\nprint actorRenderComp.SetEntityRenderDistance(48)", "params": [ { - "name": "distance", - "type": "float", + "type": "float", + "name": "distance", "description": "实体的可渲染距离,有效值范围为大于等于0。如果小于0,则使用原版游戏内的默认可渲染距离。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\n# 设置实体的可渲染距离为48\r\nprint actorRenderComp.SetEntityRenderDistance(48)" - }, + ], + "type": "api", + "side": "client", + "name": "SetEntityRenderDistance" + }, { - "type": "api", - "name": "SetEntityUIExtraUniforms", - "method": "", - "description": "设置可在实体shader当中使用的UI自定义变量的值,可在微软UI纸娃娃(paperdoll)及网易版纸娃娃(neteasepaperdoll)上使用identifier渲染某一类生物实体时使用。该自定义变量总共可设置EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量,向量的默认值为(1.0,1.0,1.0,1.0)。", - "remark": "- 此接口是针对使用了原版BB模型的实体,使用了骨骼模型的实体和玩家请使用SetExtraUniformValue接口进行动态设置。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 此接口是针对使用了原版BB模型的实体,使用了骨骼模型的实体和玩家请使用SetExtraUniformValue接口进行动态设置。", + "return": [], + "description": "设置可在实体shader当中使用的UI自定义变量的值,可在微软UI纸娃娃(paperdoll)及网易版纸娃娃(neteasepaperdoll)上使用identifier渲染某一类生物实体时使用。该自定义变量总共可设置EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量,向量的默认值为(1.0,1.0,1.0,1.0)。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(None)\r\n# 对苦力怕设置自定义变量EXTRA_ACTOR_UNIFORM1的值\r\nprint actorRenderComp.SetEntityUIExtraUniforms(\"minecraft:creeper\", 1, (2.5,2.5,2.5,2.5))\r\n# 对玩家实体设置自定义变量EXTRA_ACTOR_UNIFORM3的值\r\nprint actorRenderComp.SetEntityUIExtraUniforms(\"minecraft:player\", 3, (3.0,3.0,3.0,3.0))\r\n# 接下来,我们在实体的vertex shader或是fragment shader中做如下声明及使用:\r\n#\r\n# // .. 省略其他代码\r\n# // 声明这两个自定义变量\r\n# uniform vec4 EXTRA_ACTOR_UNIFORM1;\r\n# uniform vec4 EXTRA_ACTOR_UNIFORM3;\r\n#\r\n# void main() {\r\n# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM1;\r\n# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM3;\r\n# // .. do what you want ..\r\n# }", "params": [ { - "name": "entityIdentifier", - "type": "str", + "type": "str", + "name": "entityIdentifier", "description": "需要设置的实体identifier。如果需要对玩家设置,则填写minecraft:player。" - }, + }, { - "name": "uniformIndex", - "type": "int", + "type": "int", + "name": "uniformIndex", "description": "需要设置的自定义变量的下标,值范围为1~4。分别对应EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4。" - }, + }, { - "name": "data", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "data", "description": "需要设置的自定义变量的值。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(None)\r\n# 对苦力怕设置自定义变量EXTRA_ACTOR_UNIFORM1的值\r\nprint actorRenderComp.SetEntityUIExtraUniforms(\"minecraft:creeper\", 1, (2.5,2.5,2.5,2.5))\r\n# 对玩家实体设置自定义变量EXTRA_ACTOR_UNIFORM3的值\r\nprint actorRenderComp.SetEntityUIExtraUniforms(\"minecraft:player\", 3, (3.0,3.0,3.0,3.0))\r\n# 接下来,我们在实体的vertex shader或是fragment shader中做如下声明及使用:\r\n#\r\n# // .. 省略其他代码\r\n# // 声明这两个自定义变量\r\n# uniform vec4 EXTRA_ACTOR_UNIFORM1;\r\n# uniform vec4 EXTRA_ACTOR_UNIFORM3;\r\n#\r\n# void main() {\r\n# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM1;\r\n# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM3;\r\n# // .. do what you want ..\r\n# }" - }, + ], + "type": "api", + "side": "client", + "name": "SetEntityUIExtraUniforms" + }, { - "type": "api", - "name": "SetHealthBarDeviation", - "method": "", - "description": "设置某个entity血条的相对高度", - "remark": "- 必须用game组件设置ShowHealthBar时才能显示血条;血条默认在生物AABB上方1.5高度处", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 必须用game组件设置ShowHealthBar时才能显示血条;血条默认在生物AABB上方1.5高度处", + "return": [], + "description": "设置某个entity血条的相对高度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateHealth(entityId)\r\n# 设置血条的相对高度\r\ncomp.SetHealthBarDeviation(1.0)", "params": [ { - "name": "health_bar_deviation", - "type": "float", + "type": "float", + "name": "health_bar_deviation", "description": "血条的相对高度" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateHealth(entityId)\r\n# 设置血条的相对高度\r\ncomp.SetHealthBarDeviation(1.0)" - }, + ], + "type": "api", + "side": "client", + "name": "SetHealthBarDeviation" + }, { - "type": "api", - "name": "SetNameDeeptest", - "method": "", - "description": "设置名字是否透视", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "设置名字是否透视", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\n# 设置为不透视\r\ncomp.SetNameDeeptest(True)", "params": [ { - "name": "deeptest", - "type": "bool", + "type": "bool", + "name": "deeptest", "description": "True为不透视。默认情况下为透视" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\n# 设置为不透视\r\ncomp.SetNameDeeptest(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetNameDeeptest" + }, { - "type": "api", - "name": "SetNotRenderAtAll", - "method": "", - "description": "设置是否关闭实体渲染", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "设置是否关闭实体渲染", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# 不渲染单个实体 entityId\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.SetNotRenderAtAll(True)\r\n# 重新开始渲染该实体\r\ncomp.SetNotRenderAtAll(False)", "params": [ { - "name": "notRender", - "type": "bool", + "type": "bool", + "name": "notRender", "description": "True表示不渲染该实体" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# 不渲染单个实体 entityId\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)\r\ncomp.SetNotRenderAtAll(True)\r\n# 重新开始渲染该实体\r\ncomp.SetNotRenderAtAll(False)" - }, + ], + "type": "api", + "side": "client", + "name": "SetNotRenderAtAll" + }, { - "type": "api", - "name": "SetRenderLocalPlayer", - "method": "", - "description": "设置本地玩家是否渲染", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "设置本地玩家是否渲染", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\n# 不渲染本地玩家\r\ncomp.SetRenderLocalPlayer(False)", "params": [ { - "name": "render", - "type": "bool", + "type": "bool", + "name": "render", "description": "True为渲染" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\n# 不渲染本地玩家\r\ncomp.SetRenderLocalPlayer(False)" - }, + ], + "type": "api", + "side": "client", + "name": "SetRenderLocalPlayer" + }, { - "type": "api", - "name": "SetShowName", - "method": "", - "description": "设置生物名字是否按照默认游戏逻辑显示(包括玩家)", - "remark": "- 1. 当设置为True时,生物的名字显示遵循游戏默认的渲染逻辑,即普通生物需要中心点指向生物才显示名字,玩家则是会一直显示名字\r\n 2. 但设置为False时,生物名字不再显示。\r\n 3. 生物名字显示与否还会受到全局名字显示与否影响,详见接口HideNameTag", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 1. 当设置为True时,生物的名字显示遵循游戏默认的渲染逻辑,即普通生物需要中心点指向生物才显示名字,玩家则是会一直显示名字\r\n 2. 但设置为False时,生物名字不再显示。\r\n 3. 生物名字显示与否还会受到全局名字显示与否影响,详见接口HideNameTag", + "return": [], + "description": "设置生物名字是否按照默认游戏逻辑显示(包括玩家)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateName(entityId)\r\n# 不显示头上的名字\r\ncomp.SetShowName(False)", "params": [ { - "name": "show", - "type": "bool", + "type": "bool", + "name": "show", "description": "True为显示" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateName(entityId)\r\n# 不显示头上的名字\r\ncomp.SetShowName(False)" - }, + ], + "type": "api", + "side": "client", + "name": "SetShowName" + }, { - "type": "api", - "name": "ShowHealth", - "method": "", - "description": "设置某个entity是否显示血条,默认为显示", - "remark": "- 必须用game组件设置ShowHealthBar时才能显示血条!!", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "- 必须用game组件设置ShowHealthBar时才能显示血条!!", + "return": [], + "description": "设置某个entity是否显示血条,默认为显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateHealth(entityId)\r\n# 设置该entity不显示血条\r\ncomp.ShowHealth(False)", "params": [ { - "name": "show", - "type": "bool", + "type": "bool", + "name": "show", "description": "设置是否显示" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateHealth(entityId)\r\n# 设置该entity不显示血条\r\ncomp.ShowHealth(False)" - }, + ], + "type": "api", + "side": "client", + "name": "ShowHealth" + }, { - "type": "api", - "name": "ShowHealthBar", - "method": "", - "description": "设置是否显示血条", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "remark": "", + "return": [], + "description": "设置是否显示血条", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.ShowHealthBar(True)", "params": [ { - "name": "show", - "type": "bool", + "type": "bool", + "name": "show", "description": "True为显示。开启后可用health组件的SetColor、ShowHealth接口,单独设置某个实体的血条颜色及是否显示" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.ShowHealthBar(True)" - }, + ], + "type": "api", + "side": "client", + "name": "ShowHealthBar" + }, { - "type": "api", - "name": "AddEffectToEntity", - "method": "", - "description": "为实体添加指定状态效果,如果添加的状态已存在则有以下集中情况:1、等级大于已存在则更新状态等级及持续时间;2、状态等级相等且剩余时间duration大于已存在则刷新剩余时间;3、等级小于已存在则不做修改;4、粒子效果以新的为准", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/状态效果.md", + "remark": "", + "return": [], + "description": "为实体添加指定状态效果,如果添加的状态已存在则有以下集中情况:1、等级大于已存在则更新状态等级及持续时间;2、状态等级相等且剩余时间duration大于已存在则刷新剩余时间;3、等级小于已存在则不做修改;4、粒子效果以新的为准", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/状态效果.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEffect(entityId)\r\nres = comp.AddEffectToEntity(\"speed\", 30, 2, True)", "params": [ { - "name": "effectName", - "type": "str", + "type": "str", + "name": "effectName", "description": "状态效果名称字符串,包括自定义状态效果和原版状态效果,原版状态效果可在wiki查询" - }, + }, { - "name": "duration", - "type": "int", + "type": "int", + "name": "duration", "description": "状态效果持续时间,单位秒" - }, + }, { - "name": "amplifier", - "type": "int", + "type": "int", + "name": "amplifier", "description": "状态效果的额外等级。必须在0至255之间(含)。若未指定,默认为0。注意,状态效果的第一级(如生命恢复 I)对应为0,因此第二级状态效果,如生命回复 II,应指定强度为1。部分效果及自定义状态效果没有强度之分,如夜视" - }, + }, { - "name": "showParticles", - "type": "bool", + "type": "bool", + "name": "showParticles", "description": "是否显示粒子效果,True显示,False不显示" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEffect(entityId)\r\nres = comp.AddEffectToEntity(\"speed\", 30, 2, True)" - }, + ], + "type": "api", + "side": "server", + "name": "AddEffectToEntity" + }, { - "type": "api", - "name": "GetAllEffects", - "method": "", - "description": "获取实体当前所有状态效果", - "remark": "- 状态效果信息字典 effectDict\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | effectName | str | 状态效果名称 |\r\n | duration | int | 状态效果剩余持续时间,单位秒 |\r\n | duration_f | float | 状态效果剩余持续时间(浮点型),单位秒 |\r\n | amplifier | int | 状态效果额外等级 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/状态效果.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateEffect(entityId)\r\neffectDictList = comp.GetAllEffects()" - }, + "remark": "- 状态效果信息字典 effectDict\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | effectName | str | 状态效果名称 |\r\n | duration | int | 状态效果剩余持续时间,单位秒 |\r\n | duration_f | float | 状态效果剩余持续时间(浮点型),单位秒 |\r\n | amplifier | int | 状态效果额外等级 |", + "return": [], + "description": "获取实体当前所有状态效果", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/状态效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateEffect(entityId)\r\neffectDictList = comp.GetAllEffects()", + "params": [], + "type": "api", + "side": "client", + "name": "GetAllEffects" + }, { - "type": "api", - "name": "GetLoadEffects", - "method": "", - "description": "获取所有已加载的状态效果", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/状态效果.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEffect(entityId)\r\neffectList = comp.GetLoadEffects()" - }, + "remark": "", + "return": [], + "description": "获取所有已加载的状态效果", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/状态效果.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEffect(entityId)\r\neffectList = comp.GetLoadEffects()", + "params": [], + "type": "api", + "side": "server", + "name": "GetLoadEffects" + }, { - "type": "api", - "name": "HasEffect", - "method": "", - "description": "获取实体是否存在当前状态效果", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/状态效果.md", + "remark": "", + "return": [], + "description": "获取实体是否存在当前状态效果", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/状态效果.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateEffect(entityId)\r\neffectRes = comp.HasEffect(effectName)", "params": [ { - "name": "effectName", - "type": "str", + "type": "str", + "name": "effectName", "description": "状态效果名称字符串,包括自定义状态效果和原版状态效果,原版状态效果可在wiki查询" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateEffect(entityId)\r\neffectRes = comp.HasEffect(effectName)" - }, + ], + "type": "api", + "side": "client", + "name": "HasEffect" + }, { - "type": "api", - "name": "RemoveEffectFromEntity", - "method": "", - "description": "为实体删除指定状态效果", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/状态效果.md", + "remark": "", + "return": [], + "description": "为实体删除指定状态效果", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/状态效果.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEffect(entityId)\r\nres = comp.RemoveEffectFromEntity(\"speed\")", "params": [ { - "name": "effectName", - "type": "str", + "type": "str", + "name": "effectName", "description": "状态效果名称字符串,包括自定义状态效果和原版状态效果,原版状态效果可在wiki查询" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEffect(entityId)\r\nres = comp.RemoveEffectFromEntity(\"speed\")" - }, + ], + "type": "api", + "side": "server", + "name": "RemoveEffectFromEntity" + }, { - "type": "api", - "name": "GetOrbExperience", - "method": "", - "description": "获取经验球的经验", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/经验球.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExp(entityId)\r\nprint(comp.GetOrbExperience())" - }, + "remark": "", + "return": [], + "description": "获取经验球的经验", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/经验球.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExp(entityId)\r\nprint(comp.GetOrbExperience())", + "params": [], + "type": "api", + "side": "server", + "name": "GetOrbExperience" + }, { - "type": "api", - "name": "SetOrbExperience", - "method": "", - "description": "设置经验球经验", - "remark": "- 设置经验球经验,entityId是经验球的entityId,如果经验小于等于0,拾取后不再加经验", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/经验球.md", + "remark": "- 设置经验球经验,entityId是经验球的entityId,如果经验小于等于0,拾取后不再加经验", + "return": [], + "description": "设置经验球经验", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/经验球.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExp(entityId)\r\ncomp.SetOrbExperience(25)", "params": [ { - "name": "exp", - "type": "int", + "type": "int", + "name": "exp", "description": "经验球经验" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExp(entityId)\r\ncomp.SetOrbExperience(25)" - }, + ], + "type": "api", + "side": "server", + "name": "SetOrbExperience" + }, { - "type": "api", - "name": "GetEntityItem", - "method": "", - "description": "获取生物物品,支持获取背包,盔甲栏,副手以及主手物品", - "remark": "- 左右手及装备可以替代GetPlayerItem接口获取玩家的物品,但背包不行。获取生物背包目前支持驴、骡、羊驼以及其他带背包的自定义生物", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/背包.md", + "remark": "- 左右手及装备可以替代GetPlayerItem接口获取玩家的物品,但背包不行。获取生物背包目前支持驴、骡、羊驼以及其他带背包的自定义生物", + "return": [], + "description": "获取生物物品,支持获取背包,盔甲栏,副手以及主手物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(entityId)\r\ncomp.GetEntityItem(serverApi.GetMinecraftEnum().ItemPosType.INVENTORY, 0)", "params": [ { - "name": "posType", - "type": "int", + "type": "int", + "name": "posType", "description": "[ItemPosType枚举](../../枚举值/ItemPosType.md)" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "槽位,获取INVENTORY及ARMOR时需要设置,其他情况写0即可" - }, + }, { - "name": "getUserData", - "type": "bool", + "type": "bool", + "name": "getUserData", "description": "是否获取userData,默认为False" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(entityId)\r\ncomp.GetEntityItem(serverApi.GetMinecraftEnum().ItemPosType.INVENTORY, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetEntityItem" + }, { - "type": "api", - "name": "GetEquItemEnchant", - "method": "", - "description": "获取装备槽位中盔甲的附魔", - "remark": "- 如果物品不存在,或者没有附魔值,返回None。如果存在返回tuple数组,每个tuple由附魔类型([EnchantType枚举](../../枚举值/EnchantType.md))和附魔等级组成", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/背包.md", + "remark": "- 如果物品不存在,或者没有附魔值,返回None。如果存在返回tuple数组,每个tuple由附魔类型([EnchantType枚举](../../枚举值/EnchantType.md))和附魔等级组成", + "return": [], + "description": "获取装备槽位中盔甲的附魔", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetEquItemEnchant(serverApi.GetMinecraftEnum().ArmorSlotType.HEAD)", "params": [ { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "[ArmorSlotType枚举](../../枚举值/ArmorSlotType.md)枚举" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetEquItemEnchant(serverApi.GetMinecraftEnum().ArmorSlotType.HEAD)" - }, + ], + "type": "api", + "side": "server", + "name": "GetEquItemEnchant" + }, { - "type": "api", - "name": "GetEquItemModEnchant", - "method": "", - "description": "获取装备槽位中盔甲的自定义附魔", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/背包.md", + "remark": "", + "return": [], + "description": "获取装备槽位中盔甲的自定义附魔", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetEquItemModEnchant(serverApi.GetMinecraftEnum().ArmorSlotType.HEAD)", "params": [ { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "[ArmorSlotType枚举](../../枚举值/ArmorSlotType.md)枚举" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetEquItemModEnchant(serverApi.GetMinecraftEnum().ArmorSlotType.HEAD)" - }, + ], + "type": "api", + "side": "server", + "name": "GetEquItemModEnchant" + }, { - "type": "api", - "name": "SetEntityItem", - "method": "", - "description": "设置生物物品,建议开发者根据生物特性来进行设置,部分生物设置装备后可能不显示但是死亡后仍然会掉落所设置的装备", - "remark": "- 设置生物背包目前支持驴、骡、羊驼以及其他带背包的自定义生物。该接口与spawnTo系列接口相比多了槽位限制,只能设置对应槽位的装备、左手物品,并且右手不能设置装备。溺尸暂不支持设置自定义装备。如果传入的itemDict为None或{},itemName为minecraft:air,count为0,均可以达到清除物品的效果。玩家背包请使用SpawnItemToPlayerInv来生成物品,使用SetInvItemNum设置0来清除物品,其他部位也可以用该接口设置。\r\n - posType设置成serverApi.GetMinecraftEnum().ItemPosType.OFFHAND,itemDict设置成None可替代ClearPlayerOffHand", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/背包.md", + "remark": "- 设置生物背包目前支持驴、骡、羊驼以及其他带背包的自定义生物。该接口与spawnTo系列接口相比多了槽位限制,只能设置对应槽位的装备、左手物品,并且右手不能设置装备。溺尸暂不支持设置自定义装备。如果传入的itemDict为None或{},itemName为minecraft:air,count为0,均可以达到清除物品的效果。玩家背包请使用SpawnItemToPlayerInv来生成物品,使用SetInvItemNum设置0来清除物品,其他部位也可以用该接口设置。\r\n - posType设置成serverApi.GetMinecraftEnum().ItemPosType.OFFHAND,itemDict设置成None可替代ClearPlayerOffHand", + "return": [], + "description": "设置生物物品,建议开发者根据生物特性来进行设置,部分生物设置装备后可能不显示但是死亡后仍然会掉落所设置的装备", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(entityId)\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': {},\r\n}\r\ncomp.SetEntityItem(serverApi.GetMinecraftEnum().ItemPosType.INVENTORY, itemDict, 0)\r\n\r\n#替代ClearPlayerOffHand接口的做法\r\ncomp.SetEntityItem(serverApi.GetMinecraftEnum().ItemPosType.OFFHAND, None, 0)", "params": [ { - "name": "posType", - "type": "int", + "type": "int", + "name": "posType", "description": "[ItemPosType枚举](../../枚举值/ItemPosType.md)" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "生物身上不同位置的物品信息字典列表,如果传入None将清除当前位置的物品/装备" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "容器槽位,如果ItemPosType为左右手可不传,如果ItemPosType为背包则对应背包槽位,如果ItemPosType为armor则对应装备位置,具体请看[ArmorSlotType枚举](../../枚举值/ArmorSlotType.md)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(entityId)\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': {},\r\n}\r\ncomp.SetEntityItem(serverApi.GetMinecraftEnum().ItemPosType.INVENTORY, itemDict, 0)\r\n\r\n#替代ClearPlayerOffHand接口的做法\r\ncomp.SetEntityItem(serverApi.GetMinecraftEnum().ItemPosType.OFFHAND, None, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetEntityItem" + }, { - "type": "api", - "name": "GetAttr", - "method": "", - "description": "获取SetAttr设置的属性值", - "remark": "- defaultValue不传的时候默认为None", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义属性.md", + "remark": "- defaultValue不传的时候默认为None", + "return": [], + "description": "获取SetAttr设置的属性值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateModAttr(entityId)\r\ncomp.GetAttr('health')", "params": [ { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "属性名称,str的名称建议以mod命名为前缀,避免多个mod之间冲突" - }, + }, { - "name": "defaultValue", - "type": "any", + "type": "any", + "name": "defaultValue", "description": "属性默认值,属性不存在时返回该默认值,此时属性值依然未设置" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateModAttr(entityId)\r\ncomp.GetAttr('health')" - }, + ], + "type": "api", + "side": "client", + "name": "GetAttr" + }, { - "type": "api", - "name": "RegisterUpdateFunc", - "method": "", - "description": "注册属性值变换时的回调函数,当属性变化时会调用该函数", - "remark": "- 回调函数需要接受一个参数,参数是dict,具体数据示例:{'oldValue': 0, 'newValue': 1, 'entityId': ’-433231231231‘}", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义属性.md", + "remark": "- 回调函数需要接受一个参数,参数是dict,具体数据示例:{'oldValue': 0, 'newValue': 1, 'entityId': ’-433231231231‘}", + "return": [], + "description": "注册属性值变换时的回调函数,当属性变化时会调用该函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# 这个entityId传的是所需要监听的对象的Id\r\ncomp = clientApi.GetEngineCompFactory().CreateModAttr(entityId)\r\ncomp.RegisterUpdateFunc('health', self.jumpingText)\r\n# 当脚本层的health属性变化时则会调用self.jumpingText\r\ndef jumpingText(self, data):\r\n entityId = data['entityId']\r\n oldValue = data['oldValue']\r\n newValue = data['newValue']", "params": [ { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "监听的属性名称" - }, + }, { - "name": "func", - "type": "function", + "type": "function", + "name": "func", "description": "监听的回调函数" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# 这个entityId传的是所需要监听的对象的Id\r\ncomp = clientApi.GetEngineCompFactory().CreateModAttr(entityId)\r\ncomp.RegisterUpdateFunc('health', self.jumpingText)\r\n# 当脚本层的health属性变化时则会调用self.jumpingText\r\ndef jumpingText(self, data):\r\n entityId = data['entityId']\r\n oldValue = data['oldValue']\r\n newValue = data['newValue']" - }, + ], + "type": "api", + "side": "client", + "name": "RegisterUpdateFunc" + }, { - "type": "api", - "name": "SaveAttr", - "method": "", - "description": "保存SetAttr设置的属性值", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateModAttr(entityId)\r\n#SetAttr第三个参数标记属性需要存储,第四个参数设置为不立刻存储\r\ncomp.SetAttr('health', 1, True, False)\r\ncomp.SetAttr('test', 123, True, False)\r\n#此时调用SaveAttr会将'health'和'test'进行存储\r\ncomp.SaveAttr()" - }, + "remark": "", + "return": [], + "description": "保存SetAttr设置的属性值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateModAttr(entityId)\r\n#SetAttr第三个参数标记属性需要存储,第四个参数设置为不立刻存储\r\ncomp.SetAttr('health', 1, True, False)\r\ncomp.SetAttr('test', 123, True, False)\r\n#此时调用SaveAttr会将'health'和'test'进行存储\r\ncomp.SaveAttr()", + "params": [], + "type": "api", + "side": "server", + "name": "SaveAttr" + }, { - "type": "api", - "name": "SetAttr", - "method": "", - "description": "设置客户端属性值", - "remark": "- 注意:这里设置了只在本地有效,并不会同步到服务端和其他客户端", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义属性.md", + "remark": "- 注意:这里设置了只在本地有效,并不会同步到服务端和其他客户端", + "return": [], + "description": "设置客户端属性值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateModAttr(entityId)\r\ncomp.SetAttr('health', 1)", "params": [ { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "属性名称,str的名称建议以mod命名为前缀,避免多个mod之间冲突" - }, + }, { - "name": "paramValue", - "type": "any", + "type": "any", + "name": "paramValue", "description": "属性值,支持python基础数据" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateModAttr(entityId)\r\ncomp.SetAttr('health', 1)" - }, + ], + "type": "api", + "side": "client", + "name": "SetAttr" + }, { - "type": "api", - "name": "UnRegisterUpdateFunc", - "method": "", - "description": "反注册属性值变换时的回调函数", - "remark": "- 需要传注册时的同一个函数作为参数", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义属性.md", + "remark": "- 需要传注册时的同一个函数作为参数", + "return": [], + "description": "反注册属性值变换时的回调函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateModAttr(entityId)\r\ncomp.UnRegisterUpdateFunc('health', self.jumpingText)", "params": [ { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "监听的属性名称" - }, + }, { - "name": "func", - "type": "function", + "type": "function", + "name": "func", "description": "监听的回调函数" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateModAttr(entityId)\r\ncomp.UnRegisterUpdateFunc('health', self.jumpingText)" - }, + ], + "type": "api", + "side": "client", + "name": "UnRegisterUpdateFunc" + }, { - "type": "api", - "name": "CleanExtraData", - "method": "", - "description": "清除实体的自定义数据或者世界的自定义数据,清除实体数据时使用对应实体id创建组件,清除世界数据时使用levelId创建组件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义数据.md", + "remark": "", + "return": [], + "description": "清除实体的自定义数据或者世界的自定义数据,清除实体数据时使用对应实体id创建组件,清除世界数据时使用levelId创建组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义数据.md", + "example": "import mod.server.extraServerApi as serverApi\r\n# 清除实体数据\r\nentitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nsuc = entitycomp.CleanExtraData(\"nickname\")\r\nprint \"CleanExtraData entity=%s suc=%s\" % (entityId, suc)\r\n# 清除全局数据\r\nlevelcomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\nsuc = levelcomp.CleanExtraData(\"globalMsg\")\r\nprint \"CleanExtraData for level suc=%s\" % suc", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "自定义key" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\n# 清除实体数据\r\nentitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nsuc = entitycomp.CleanExtraData(\"nickname\")\r\nprint \"CleanExtraData entity=%s suc=%s\" % (entityId, suc)\r\n# 清除全局数据\r\nlevelcomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\nsuc = levelcomp.CleanExtraData(\"globalMsg\")\r\nprint \"CleanExtraData for level suc=%s\" % suc" - }, + ], + "type": "api", + "side": "server", + "name": "CleanExtraData" + }, { - "type": "api", - "name": "GetExtraData", - "method": "", - "description": "获取实体的自定义数据或者世界的自定义数据,某个键所对应的值。获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义数据.md", + "remark": "", + "return": [], + "description": "获取实体的自定义数据或者世界的自定义数据,某个键所对应的值。获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义数据.md", + "example": "# 获取全局数据\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\nlevelExData = comp.GetExtraData(\"globalMsg\")\r\n# 获取\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nnickName = comp.GetExtraData(\"nickName\")", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "自定义key" } - ], - "return": [], - "example": "# 获取全局数据\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\nlevelExData = comp.GetExtraData(\"globalMsg\")\r\n# 获取\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nnickName = comp.GetExtraData(\"nickName\")" - }, + ], + "type": "api", + "side": "server", + "name": "GetExtraData" + }, { - "type": "api", - "name": "GetWholeExtraData", - "method": "", - "description": "获取完整的实体的自定义数据或者世界的自定义数据,获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义数据.md", - "params": [], - "return": [], - "example": "#获取实体数据字典\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\ndataDict = comp.GetWholeExtraData()\r\nif dataDict:\r\n for key, value in dataDict.iteritems():\r\n print \"key=%s value=%s\" % (key, str(value))\r\n#获取全局数据字典\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\ndataDict = comp.GetWholeExtraData()\r\nif dataDict:\r\n for key, value in dataDict.iteritems():\r\n print \"key=%s value=%s\" % (key, str(value))" - }, + "remark": "", + "return": [], + "description": "获取完整的实体的自定义数据或者世界的自定义数据,获取实体数据时使用对应实体id创建组件,获取世界数据时使用levelId创建组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义数据.md", + "example": "#获取实体数据字典\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\ndataDict = comp.GetWholeExtraData()\r\nif dataDict:\r\n for key, value in dataDict.iteritems():\r\n print \"key=%s value=%s\" % (key, str(value))\r\n#获取全局数据字典\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\ndataDict = comp.GetWholeExtraData()\r\nif dataDict:\r\n for key, value in dataDict.iteritems():\r\n print \"key=%s value=%s\" % (key, str(value))", + "params": [], + "type": "api", + "side": "server", + "name": "GetWholeExtraData" + }, { - "type": "api", - "name": "SaveExtraData", - "method": "", - "description": "用于保存实体的自定义数据或者世界的自定义数据", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义数据.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\n# 设置实体的自定义数据\r\nentitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nentitycomp.SetExtraData(\"nickname\", \"steve\", False)\r\nentitycomp.SetExtraData(\"score\", 256, False)\r\n# more data to set\r\nentitycomp.SaveExtraData()" - }, + "remark": "", + "return": [], + "description": "用于保存实体的自定义数据或者世界的自定义数据", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义数据.md", + "example": "import mod.server.extraServerApi as serverApi\r\n# 设置实体的自定义数据\r\nentitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nentitycomp.SetExtraData(\"nickname\", \"steve\", False)\r\nentitycomp.SetExtraData(\"score\", 256, False)\r\n# more data to set\r\nentitycomp.SaveExtraData()", + "params": [], + "type": "api", + "side": "server", + "name": "SaveExtraData" + }, { - "type": "api", - "name": "SetExtraData", - "method": "", - "description": "用于设置实体的自定义数据或者世界的自定义数据,数据以键值对的形式保存。设置实体数据时使用对应实体id创建组件,设置世界数据时使用levelId创建组件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义数据.md", + "remark": "", + "return": [], + "description": "用于设置实体的自定义数据或者世界的自定义数据,数据以键值对的形式保存。设置实体数据时使用对应实体id创建组件,设置世界数据时使用levelId创建组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/自定义数据.md", + "example": "import mod.server.extraServerApi as serverApi\r\n# 设置实体的自定义数据\r\nentitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nentitycomp.SetExtraData(\"nickname\",\"steve\")\r\nentitycomp.SetExtraData(\"score\",256)\r\n# 设置世界的自定义数据\r\nlevelcomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\nlevelcomp.SetExtraData(\"globalMsg\",\"helloWorld\")", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "自定义key" - }, + }, { - "name": "value", - "type": "any", + "type": "any", + "name": "value", "description": "key对应的值,支持python基本数据类型" - }, + }, { - "name": "autoSave", - "type": "bool", + "type": "bool", + "name": "autoSave", "description": "默认自动保存,默认为True,如果批量设置数据,请将该参数设置为False,同时在设置数据完毕时调用SaveExtraData接口" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\n# 设置实体的自定义数据\r\nentitycomp = serverApi.GetEngineCompFactory().CreateExtraData(entityId)\r\nentitycomp.SetExtraData(\"nickname\",\"steve\")\r\nentitycomp.SetExtraData(\"score\",256)\r\n# 设置世界的自定义数据\r\nlevelcomp = serverApi.GetEngineCompFactory().CreateExtraData(levelId)\r\nlevelcomp.SetExtraData(\"globalMsg\",\"helloWorld\")" - }, + ], + "type": "api", + "side": "server", + "name": "SetExtraData" + }, { - "type": "api", - "name": "AddActorComponent", - "method": "", - "description": "给指定实体自定义添加实体Component", - "remark": "- 该接口不会判断生物的json是否具有传入的Component,返回值的结果只代表指令是否正常发出\r\n - 重复添加component,会覆盖原有的值(包括AddActorComponentGroup)\r\n - AddActorComponent、AddActorComponentGroup、RemoveActorComponent、RemoveActorComponentGroup之间会互相影响,结果依据执行顺序而定", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 该接口不会判断生物的json是否具有传入的Component,返回值的结果只代表指令是否正常发出\r\n - 重复添加component,会覆盖原有的值(包括AddActorComponentGroup)\r\n - AddActorComponent、AddActorComponentGroup、RemoveActorComponent、RemoveActorComponentGroup之间会互相影响,结果依据执行顺序而定", + "return": [], + "description": "给指定实体自定义添加实体Component", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "#将实体攻击改成99\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityEvent(entityId)\r\ncomp.AddActorComponent(\"minecraft:attack\", '{\"damage\": 99}')", "params": [ { - "name": "componentName", - "type": "str", + "type": "str", + "name": "componentName", "description": "实体行为包中定义的component的键名" - }, + }, { - "name": "componentValue", - "type": "str", + "type": "str", + "name": "componentValue", "description": "实体行为包中定义的component的值的json" } - ], - "return": [], - "example": "#将实体攻击改成99\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityEvent(entityId)\r\ncomp.AddActorComponent(\"minecraft:attack\", '{\"damage\": 99}')" - }, + ], + "type": "api", + "side": "server", + "name": "AddActorComponent" + }, { - "type": "api", - "name": "AddActorComponentGroup", - "method": "", - "description": "给指定实体添加实体json中配置的ComponentGroup", - "remark": "- 该接口不会判断生物的json是否具有传入的groupName,返回值的结果只代表指令是否正常发出\r\n - 在羊的entity json文件中`component_groups`字段下配置羊的颜色:\r\n ```json\r\n \"component_groups\": {\r\n \"minecraft:sheep_white\": {\r\n \"minecraft:color\": {\r\n \"value\": 0\r\n }\r\n },\r\n \"minecraft:sheep_brown\": {\r\n \"minecraft:color\": {\r\n \"value\": 12\r\n }\r\n },\r\n \"minecraft:sheep_black\": {\r\n \"minecraft:color\": {\r\n \"value\": 15\r\n }\r\n },\r\n ......\r\n \"minecraft:sheep_red\": {\r\n \"minecraft:color\": {\r\n \"value\": 14\r\n }\r\n }\r\n }\r\n ```", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 该接口不会判断生物的json是否具有传入的groupName,返回值的结果只代表指令是否正常发出\r\n - 在羊的entity json文件中`component_groups`字段下配置羊的颜色:\r\n ```json\r\n \"component_groups\": {\r\n \"minecraft:sheep_white\": {\r\n \"minecraft:color\": {\r\n \"value\": 0\r\n }\r\n },\r\n \"minecraft:sheep_brown\": {\r\n \"minecraft:color\": {\r\n \"value\": 12\r\n }\r\n },\r\n \"minecraft:sheep_black\": {\r\n \"minecraft:color\": {\r\n \"value\": 15\r\n }\r\n },\r\n ......\r\n \"minecraft:sheep_red\": {\r\n \"minecraft:color\": {\r\n \"value\": 14\r\n }\r\n }\r\n }\r\n ```", + "return": [], + "description": "给指定实体添加实体json中配置的ComponentGroup", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "#将羊变为红色\r\nimport mod.server.extraServerApi as serverApi\r\ngroupName = \"minecraft:sheep_red\"\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityEvent(entityId)\r\ncomp.AddActorComponentGroup(groupName)", "params": [ { - "name": "groupName", - "type": "str", + "type": "str", + "name": "groupName", "description": "实体行为包中定义的component_group的键名" } - ], - "return": [], - "example": "#将羊变为红色\r\nimport mod.server.extraServerApi as serverApi\r\ngroupName = \"minecraft:sheep_red\"\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityEvent(entityId)\r\ncomp.AddActorComponentGroup(groupName)" - }, + ], + "type": "api", + "side": "server", + "name": "AddActorComponentGroup" + }, { - "type": "api", - "name": "AddEntityAroundEntityMotion", - "method": "", - "description": "给实体(不含玩家)添加对实体环绕运动器", - "remark": "- 该接口不屏蔽生物本身的AI运动以及重力作用,当有AI运动发生时,最终的表现结果可能与预期有差异。\r\n - 环绕运动器可叠加多个,且可与速度运动器互相叠加,每一帧的最终效果为各个运动器计算出的瞬时向量之和。\r\n - 由于引擎中在加载的区块以外的实体时会停止一切活动,建议将实体的运动范围控制在玩家位置±100内。\r\n - 参数中环绕半径radius和角速度angularVelocity需要配合调整,避免最后得出的线速度过大造成运动不平滑。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 该接口不屏蔽生物本身的AI运动以及重力作用,当有AI运动发生时,最终的表现结果可能与预期有差异。\r\n - 环绕运动器可叠加多个,且可与速度运动器互相叠加,每一帧的最终效果为各个运动器计算出的瞬时向量之和。\r\n - 由于引擎中在加载的区块以外的实体时会停止一切活动,建议将实体的运动范围控制在玩家位置±100内。\r\n - 参数中环绕半径radius和角速度angularVelocity需要配合调整,避免最后得出的线速度过大造成运动不平滑。", + "return": [], + "description": "给实体(不含玩家)添加对实体环绕运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\naxis=(-1, 1, 1)\r\nmID = motionComp.AddEntityAroundEntityMotion(eID, 1.0, axis, lockDir=False, stopRad=0, radius=2.0)\r\n#启动该运动器\r\nmotionComp.StartEntityMotion(mID)", "params": [ { - "name": "eID", - "type": "str", + "type": "str", + "name": "eID", "description": "要环绕的某个实体的ID" - }, + }, { - "name": "angularVelocity", - "type": "float", + "type": "float", + "name": "angularVelocity", "description": "圆周运动的角速度(弧度/秒)" - }, + }, { - "name": "axis", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "axis", "description": "圆周运动的轴,决定了在哪个平面上做圆周运动,默认为(0, 1, 0)" - }, + }, { - "name": "lockDir", - "type": "bool", + "type": "bool", + "name": "lockDir", "description": "是否在运动器生效时锁定实体的朝向,不锁定则实体的朝向会随着运动而改变,默认为False。" - }, + }, { - "name": "stopRad", - "type": "float", + "type": "float", + "name": "stopRad", "description": "停止该运动器所需要的弧度,当stopRad为0时,该运动器会一直运行,默认为0" - }, + }, { - "name": "radius", - "type": "float", + "type": "float", + "name": "radius", "description": "环绕半径,当设置为-1时环绕运动器使用启动时与目标的距离作为半径,当设置为非负数时表示按设定的值作为环绕半径,默认为-1" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\naxis=(-1, 1, 1)\r\nmID = motionComp.AddEntityAroundEntityMotion(eID, 1.0, axis, lockDir=False, stopRad=0, radius=2.0)\r\n#启动该运动器\r\nmotionComp.StartEntityMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "AddEntityAroundEntityMotion" + }, { - "type": "api", - "name": "AddEntityAroundPointMotion", - "method": "", - "description": "给实体(不含玩家)添加对点环绕运动器", - "remark": "- 该接口不屏蔽生物本身的AI运动以及重力作用,当有AI运动发生时,最终的表现结果可能与预期有差异。\r\n - 环绕运动器可叠加多个,且可与速度运动器互相叠加,每一帧的最终效果为各个运动器计算出的瞬时向量之和。\r\n - 由于引擎中在加载的区块以外的实体时会停止一切活动,建议将实体的运动范围控制在玩家位置±100内,同时避免线速度过大造成运动不平滑的现象。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 该接口不屏蔽生物本身的AI运动以及重力作用,当有AI运动发生时,最终的表现结果可能与预期有差异。\r\n - 环绕运动器可叠加多个,且可与速度运动器互相叠加,每一帧的最终效果为各个运动器计算出的瞬时向量之和。\r\n - 由于引擎中在加载的区块以外的实体时会停止一切活动,建议将实体的运动范围控制在玩家位置±100内,同时避免线速度过大造成运动不平滑的现象。", + "return": [], + "description": "给实体(不含玩家)添加对点环绕运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\ncenter = (0, 8, 0)\r\naxis=(-1, 1, 1)\r\nmID = motionComp.AddEntityAroundPointMotion(center, 1.0, axis, lockDir=False, stopRad=0)\r\n#启动该运动器\r\nmotionComp.StartEntityMotion(mID)", "params": [ { - "name": "center", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "center", "description": "要环绕的圆心点坐标" - }, + }, { - "name": "angularVelocity", - "type": "float", + "type": "float", + "name": "angularVelocity", "description": "圆周运动的角速度(弧度/秒)" - }, + }, { - "name": "axis", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "axis", "description": "圆周运动的轴,决定了在哪个平面上做圆周运动,默认为(0, 1, 0)" - }, + }, { - "name": "lockDir", - "type": "bool", + "type": "bool", + "name": "lockDir", "description": "是否在运动器生效时锁定实体的朝向,不锁定则实体的朝向会随着运动而改变,默认为False。" - }, + }, { - "name": "stopRad", - "type": "float", + "type": "float", + "name": "stopRad", "description": "停止该运动器所需要的弧度,当stopRad为0时,该运动器会一直运行,默认为0" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\ncenter = (0, 8, 0)\r\naxis=(-1, 1, 1)\r\nmID = motionComp.AddEntityAroundPointMotion(center, 1.0, axis, lockDir=False, stopRad=0)\r\n#启动该运动器\r\nmotionComp.StartEntityMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "AddEntityAroundPointMotion" + }, { - "type": "api", - "name": "AddEntitySeat", - "method": "", - "description": "增加坐骑座位", - "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型。\r\n - 非玩家实体即使所处座位的lock_rot参数为默认值,也不可360度旋转。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型。\r\n - 非玩家实体即使所处座位的lock_rot参数为默认值,也不可360度旋转。", + "return": [], + "description": "增加坐骑座位", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\nseatIndex = comp.AddEntitySeat((1.0, 1.0, 1.0), 90.0, 90.0)", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "座位位置" - }, + }, { - "name": "rot", - "type": "float", + "type": "float", + "name": "rot", "description": "座位旋转,默认为0" - }, + }, { - "name": "lock_rot", - "type": "float", + "type": "float", + "name": "lock_rot", "description": "骑乘者允许旋转角度范围,默认不限制" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\nseatIndex = comp.AddEntitySeat((1.0, 1.0, 1.0), 90.0, 90.0)" - }, + ], + "type": "api", + "side": "server", + "name": "AddEntitySeat" + }, { - "type": "api", - "name": "AddEntityTrackMotion", - "method": "", - "description": "给实体(不含玩家)添加轨迹运动器", - "remark": "- 该接口不屏蔽生物本身的AI运动,并且生物在空中时会受到跌落伤害,当有AI运动发生时,最终的表现结果可能与预期有差异,建议将生物设置为NPC。\r\n - 轨迹运动器不可叠加,仅能添加一个。\r\n - 由于引擎中在加载的区块以外的实体时会停止一切活动,建议将运动范围控制在玩家位置±100内。\r\n - 设置朝向后会根据相应的参数计算出最终朝向,若此时的targetRot > startRot,则会顺时针旋转,反之逆时针旋转。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 该接口不屏蔽生物本身的AI运动,并且生物在空中时会受到跌落伤害,当有AI运动发生时,最终的表现结果可能与预期有差异,建议将生物设置为NPC。\r\n - 轨迹运动器不可叠加,仅能添加一个。\r\n - 由于引擎中在加载的区块以外的实体时会停止一切活动,建议将运动范围控制在玩家位置±100内。\r\n - 设置朝向后会根据相应的参数计算出最终朝向,若此时的targetRot > startRot,则会顺时针旋转,反之逆时针旋转。", + "return": [], + "description": "给实体(不含玩家)添加轨迹运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\ntarget = (5, 0, 0)\r\nrot1 = (0, 0)\r\nrot2 = (0, 360)\r\nmID = motionComp.AddEntityTrackMotion(target, 3.0, startPos=None, relativeCoord=True, isLoop=False, targetRot=rot1, startRot=rot2, useVelocityDir=True, ease = serverApi.GetMinecraftEnum().TimeEaseType.linear)", "params": [ { - "name": "targetPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "targetPos", "description": "轨迹终点" - }, + }, { - "name": "duraTime", - "type": "float", + "type": "float", + "name": "duraTime", "description": "到达终点所需要的时间" - }, + }, { - "name": "startPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "startPos", "description": "轨迹起点,默认为None,表示以调用[StartEntityMotion](#StartEntityMotion)的位置作为起点。" - }, + }, { - "name": "relativeCoord", - "type": "bool", + "type": "bool", + "name": "relativeCoord", "description": "是否使用相对坐标设置起点和终点的位置以及朝向,默认为False。" - }, + }, { - "name": "isLoop", - "type": "bool", + "type": "bool", + "name": "isLoop", "description": "是否循环,若设为True,则实体会在起点和终点之间往复运动,默认为False。" - }, + }, { - "name": "targetRot", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "targetRot", "description": "实体到达targetPos时的朝向,受参数relativeCoord影响,默认为None,表示使用调用[StartEntityMotion](#StartEntityMotion)时的朝向。" - }, + }, { - "name": "startRot", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "startRot", "description": "实体到达startPos时的朝向,受参数relativeCoord影响,默认为None,表示使用调用[StartEntityMotion](#StartEntityMotion)时的朝向。" - }, + }, { - "name": "useVelocityDir", - "type": "bool", + "type": "bool", + "name": "useVelocityDir", "description": "是否使用运动中的速度方向作为朝向,默认为False,若为True,则参数targetRot和startRot无效" - }, + }, { - "name": "ease", - "type": "TimeEaseType", + "type": "TimeEaseType", + "name": "ease", "description": "时间变化函数, 默认值为serverApi.GetMinecraftEnum().TimeEaseType.linear, 参数不在枚举值中也当作linear" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\ntarget = (5, 0, 0)\r\nrot1 = (0, 0)\r\nrot2 = (0, 360)\r\nmID = motionComp.AddEntityTrackMotion(target, 3.0, startPos=None, relativeCoord=True, isLoop=False, targetRot=rot1, startRot=rot2, useVelocityDir=True, ease = serverApi.GetMinecraftEnum().TimeEaseType.linear)" - }, + ], + "type": "api", + "side": "server", + "name": "AddEntityTrackMotion" + }, { - "type": "api", - "name": "AddEntityVelocityMotion", - "method": "", - "description": "给实体(不含玩家)添加速度运动器", - "remark": "- 该接口不屏蔽生物本身的AI运动以及重力作用,当有AI运动发生时,最终的表现结果可能与预期有差异。\r\n - 速度运动器可叠加多个,且可与环绕运动器互相叠加。\r\n - 由于引擎中在加载的区块以外的实体时会停止一切活动,建议将实体的运动范围控制在玩家位置±100内。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 该接口不屏蔽生物本身的AI运动以及重力作用,当有AI运动发生时,最终的表现结果可能与预期有差异。\r\n - 速度运动器可叠加多个,且可与环绕运动器互相叠加。\r\n - 由于引擎中在加载的区块以外的实体时会停止一切活动,建议将实体的运动范围控制在玩家位置±100内。", + "return": [], + "description": "给实体(不含玩家)添加速度运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nvelocity = (0, 0, 1)\r\naccelerate = (0, 0, -1)\r\nmID = motionComp.AddEntityVelocityMotion(velocity, accelerate, useVelocityDir=True)\r\n#启动该运动器\r\nmotionComp.StartEntityMotion(mID)", "params": [ { - "name": "velocity", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "velocity", "description": "速度,包含大小、方向" - }, + }, { - "name": "accelerate", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "accelerate", "description": "加速度,包含大小、方向,默认为None,表示没有加速度" - }, + }, { - "name": "useVelocityDir", - "type": "bool", + "type": "bool", + "name": "useVelocityDir", "description": "是否使用当前速度的方向作为此刻实体的朝向,默认为True" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nvelocity = (0, 0, 1)\r\naccelerate = (0, 0, -1)\r\nmID = motionComp.AddEntityVelocityMotion(velocity, accelerate, useVelocityDir=True)\r\n#启动该运动器\r\nmotionComp.StartEntityMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "AddEntityVelocityMotion" + }, { - "type": "api", - "name": "ChangeRiderSeat", - "method": "", - "description": "设置骑乘者在当前坐骑上的序号", - "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型。\r\n - 未通过SetEntityLockRider锁定的实体,退出存档重进或有新的骑乘者时会遵循原版逻辑重置实体上的骑乘者。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型。\r\n - 未通过SetEntityLockRider锁定的实体,退出存档重进或有新的骑乘者时会遵循原版逻辑重置实体上的骑乘者。", + "return": [], + "description": "设置骑乘者在当前坐骑上的序号", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.ChangeRiderSeat(1)", "params": [ { - "name": "riderIndex", - "type": "int", + "type": "int", + "name": "riderIndex", "description": "指定实体成为第n个骑乘者,范围为0~SeatCount-1" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.ChangeRiderSeat(1)" - }, + ], + "type": "api", + "side": "server", + "name": "ChangeRiderSeat" + }, { - "type": "api", - "name": "DeleteEntitySeat", - "method": "", - "description": "删除坐骑座位", - "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型。\r\n - 只能删除通过接口AddEntitySeat添加的座位。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型。\r\n - 只能删除通过接口AddEntitySeat添加的座位。", + "return": [], + "description": "删除坐骑座位", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.DeleteEntitySeat(1)", "params": [ { - "name": "seatIndex", - "type": "int", + "type": "int", + "name": "seatIndex", "description": "座位序号,范围为0~最大座位序号" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.DeleteEntitySeat(1)" - }, + ], + "type": "api", + "side": "server", + "name": "DeleteEntitySeat" + }, { - "type": "api", - "name": "GetAttackTarget", - "method": "", - "description": "获取仇恨目标", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateAction(entityId)\r\ncomp.GetAttackTarget()" - }, + "remark": "", + "return": [], + "description": "获取仇恨目标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateAction(entityId)\r\ncomp.GetAttackTarget()", + "params": [], + "type": "api", + "side": "client", + "name": "GetAttackTarget" + }, { - "type": "api", - "name": "GetBlockControlAi", - "method": "", - "description": "获取生物原生AI是否被屏蔽", - "remark": "- 屏蔽AI后的生物无法行动,不受重力且不会被推动。但是可以受到伤害,也可以被玩家交互(例如马被骑或村民被交易)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateControlAi(entityId)\r\ncomp.GetBlockControlAi()" - }, + "remark": "- 屏蔽AI后的生物无法行动,不受重力且不会被推动。但是可以受到伤害,也可以被玩家交互(例如马被骑或村民被交易)", + "return": [], + "description": "获取生物原生AI是否被屏蔽", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateControlAi(entityId)\r\ncomp.GetBlockControlAi()", + "params": [], + "type": "api", + "side": "server", + "name": "GetBlockControlAi" + }, { - "type": "api", - "name": "GetComponents", - "method": "", - "description": "获取指定实体的生效Components", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityEvent(entityId)\r\nprint(comp.GetComponents())" - }, + "remark": "", + "return": [], + "description": "获取指定实体的生效Components", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityEvent(entityId)\r\nprint(comp.GetComponents())", + "params": [], + "type": "api", + "side": "server", + "name": "GetComponents" + }, { - "type": "api", - "name": "GetCustomGoalCls", - "method": "", - "description": "用于获取服务器自定义行为节点的基类。实现新的行为节点时,需要继承该接口返回的类", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nCustomGoal = serverApi.GetCustomGoalCls()\r\nclass CustomGoalDemo(CustomGoal):\r\n def __init__(self, entityId, argsJson):\r\n CustomGoalCls.__init__(self, entityId, argsJson)" - }, + "remark": "", + "return": [], + "description": "用于获取服务器自定义行为节点的基类。实现新的行为节点时,需要继承该接口返回的类", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nCustomGoal = serverApi.GetCustomGoalCls()\r\nclass CustomGoalDemo(CustomGoal):\r\n def __init__(self, entityId, argsJson):\r\n CustomGoalCls.__init__(self, entityId, argsJson)", + "params": [], + "type": "api", + "side": "server", + "name": "GetCustomGoalCls" + }, { - "type": "api", - "name": "GetEntityMotions", - "method": "", - "description": "获取实体(不含玩家)身上的所有运动器", - "remark": "- 运动器非人为停止后会被移除。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotions = motionComp.GetEntityMotions()\r\n# motions = {\r\n# 0:1,\r\n# 1:2\r\n# }" - }, + "remark": "- 运动器非人为停止后会被移除。", + "return": [], + "description": "获取实体(不含玩家)身上的所有运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotions = motionComp.GetEntityMotions()\r\n# motions = {\r\n# 0:1,\r\n# 1:2\r\n# }", + "params": [], + "type": "api", + "side": "server", + "name": "GetEntityMotions" + }, { - "type": "api", - "name": "GetJumpPower", - "method": "", - "description": "获取生物跳跃力度,0.42表示正常水平", - "remark": "- 生物跳跃力度影响生物跳跃高度。\r\n - 由于python浮点数值精度问题,返回的数据字典中的浮点数可能会带有小数点后多位的现象,例如跳跃力度原本为0.2,则返回的的值可能会变为0.20000000298,请注意。\r\n - 兔子无法在外部通过SetJumpPower设置跳跃力度,因此调用此接口时,获取到的为实际兔子的跳跃力度,而不是SetJumpPower设置的值\r\n - 使用指令,跳跃药水,跳跃箭等改变能跳跃高度,但并不影响jumpPower的值", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGravity(entityId)\r\ncomp.GetJumpPower()" - }, + "remark": "- 生物跳跃力度影响生物跳跃高度。\r\n - 由于python浮点数值精度问题,返回的数据字典中的浮点数可能会带有小数点后多位的现象,例如跳跃力度原本为0.2,则返回的的值可能会变为0.20000000298,请注意。\r\n - 兔子无法在外部通过SetJumpPower设置跳跃力度,因此调用此接口时,获取到的为实际兔子的跳跃力度,而不是SetJumpPower设置的值\r\n - 使用指令,跳跃药水,跳跃箭等改变能跳跃高度,但并不影响jumpPower的值", + "return": [], + "description": "获取生物跳跃力度,0.42表示正常水平", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGravity(entityId)\r\ncomp.GetJumpPower()", + "params": [], + "type": "api", + "side": "server", + "name": "GetJumpPower" + }, { - "type": "api", - "name": "GetLeashHolder", - "method": "", - "description": "获取实体被使用拴绳牵引时牵引者的ID", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetLeashHolder()" - }, + "remark": "", + "return": [], + "description": "获取实体被使用拴绳牵引时牵引者的ID", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.GetLeashHolder()", + "params": [], + "type": "api", + "side": "server", + "name": "GetLeashHolder" + }, { - "type": "api", - "name": "GetMotion", - "method": "", - "description": "获取生物的瞬时移动方向向量。与服务端不同,客户端不会计算摩擦等因素,获取到的是上一帧的向量,与服务器获取到的值会不相等", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nmotionComp = clientApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotionComp.GetMotion()" - }, + "remark": "", + "return": [], + "description": "获取生物的瞬时移动方向向量。与服务端不同,客户端不会计算摩擦等因素,获取到的是上一帧的向量,与服务器获取到的值会不相等", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\nmotionComp = clientApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotionComp.GetMotion()", + "params": [], + "type": "api", + "side": "client", + "name": "GetMotion" + }, { - "type": "api", - "name": "GetOwnerId", - "method": "", - "description": "获取驯服生物的主人id", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTame(entityId)\r\noid = comp.GetOwnerId()" - }, + "remark": "", + "return": [], + "description": "获取驯服生物的主人id", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTame(entityId)\r\noid = comp.GetOwnerId()", + "params": [], + "type": "api", + "side": "client", + "name": "GetOwnerId" + }, { - "type": "api", - "name": "GetRiders", - "method": "", - "description": "获取坐骑上的骑乘者信息", - "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\nriders = comp.GetRiders()" - }, + "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型。", + "return": [], + "description": "获取坐骑上的骑乘者信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\nriders = comp.GetRiders()", + "params": [], + "type": "api", + "side": "server", + "name": "GetRiders" + }, { - "type": "api", - "name": "GetStepHeight", - "method": "", - "description": "返回玩家前进非跳跃状态下能上的最大台阶高度", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\nprint(comp.GetStepHeight())" - }, + "remark": "", + "return": [], + "description": "返回玩家前进非跳跃状态下能上的最大台阶高度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\nprint(comp.GetStepHeight())", + "params": [], + "type": "api", + "side": "server", + "name": "GetStepHeight" + }, { - "type": "api", - "name": "Hurt", - "method": "", - "description": "设置实体伤害", - "remark": "- 当knocked设为True时,必须同时设置伤害源attackerId,knocked才会生效,击退方向根据攻击源与实体的位置计算。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 当knocked设为True时,必须同时设置伤害源attackerId,knocked才会生效,击退方向根据攻击源与实体的位置计算。", + "return": [], + "description": "设置实体伤害", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateHurt(playerId)\r\ncomp.Hurt(10, serverApi.GetMinecraftEnum().ActorDamageCause.EntityAttack, attackerId, None, False)", "params": [ { - "name": "damage", - "type": "float", + "type": "float", + "name": "damage", "description": "伤害值SetHurtByEntityNew" - }, + }, { - "name": "cause", - "type": "str", + "type": "str", + "name": "cause", "description": "伤害来源,详见Minecraft枚举值文档的[ActorDamageCause枚举](../../枚举值/ActorDamageCause.md)" - }, + }, { - "name": "attackerId", - "type": "str", + "type": "str", + "name": "attackerId", "description": "伤害来源的实体id,默认为None" - }, + }, { - "name": "childAttackerId", - "type": "str", + "type": "str", + "name": "childAttackerId", "description": "伤害来源的子实体id,默认为None,比如玩家使用抛射物对实体造成伤害,该值应为抛射物Id" - }, + }, { - "name": "knocked", - "type": "bool", + "type": "bool", + "name": "knocked", "description": "实体是否被击退,默认值为True" - }, + }, { - "name": "customTag", - "type": "str", + "type": "str", + "name": "customTag", "description": "标识自定义伤害来源,只在cause为Custom生效,可在ActorHurtServerEvent、ActuallyHurtServerEvent、DamageEvent、PlayerHurtEvent、PlayerDieEvent、MobDieEvent监听到标识" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateHurt(playerId)\r\ncomp.Hurt(10, serverApi.GetMinecraftEnum().ActorDamageCause.EntityAttack, attackerId, None, False)" - }, + ], + "type": "api", + "side": "server", + "name": "Hurt" + }, { - "type": "api", - "name": "ImmuneDamage", - "method": "", - "description": "设置实体是否免疫伤害(该属性存档)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "", + "return": [], + "description": "设置实体是否免疫伤害(该属性存档)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateHurt(entityId)\r\ncomp.ImmuneDamage(True)", "params": [ { - "name": "immune", - "type": "bool", + "type": "bool", + "name": "immune", "description": "是否免疫伤害" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateHurt(entityId)\r\ncomp.ImmuneDamage(True)" - }, + ], + "type": "api", + "side": "server", + "name": "ImmuneDamage" + }, { - "type": "api", - "name": "IsEating", - "method": "", - "description": "判断非玩家实体是否在进食", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsEating()" - }, + "remark": "", + "return": [], + "description": "判断非玩家实体是否在进食", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsEating()", + "params": [], + "type": "api", + "side": "server", + "name": "IsEating" + }, { - "type": "api", - "name": "IsEntityOnFire", - "method": "", - "description": "获取实体是否着火", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\nisOnFire = comp.IsEntityOnFire()" - }, + "remark": "", + "return": [], + "description": "获取实体是否着火", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\nisOnFire = comp.IsEntityOnFire()", + "params": [], + "type": "api", + "side": "server", + "name": "IsEntityOnFire" + }, { - "type": "api", - "name": "IsLootDropped", - "method": "", - "description": "获取生物是否生成掉落物", - "remark": "- 仅在开启战利品生成效果下生效", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsLootDropped()" - }, + "remark": "- 仅在开启战利品生成效果下生效", + "return": [], + "description": "获取生物是否生成掉落物", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsLootDropped()", + "params": [], + "type": "api", + "side": "server", + "name": "IsLootDropped" + }, { - "type": "api", - "name": "IsPersistent", - "method": "", - "description": "判断是否为持久性生物", - "remark": "- 当前几乎所有自然生成的生物在模拟距离为4时都会在距离玩家44格或更远时被清除。模拟距离为6或更高时,生物会在模拟距离边界处(距最近的玩家至多128格)被清除。\r\n - 所有鱼都会在距离玩家至少40格时被清除,无论模拟距离为何。\r\n - 如果生物在距最近的玩家32至44格处,其必须在30秒内没有受伤,然后就会有八百分之一的概率被清除。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsPersistent()" - }, + "remark": "- 当前几乎所有自然生成的生物在模拟距离为4时都会在距离玩家44格或更远时被清除。模拟距离为6或更高时,生物会在模拟距离边界处(距最近的玩家至多128格)被清除。\r\n - 所有鱼都会在距离玩家至少40格时被清除,无论模拟距离为何。\r\n - 如果生物在距最近的玩家32至44格处,其必须在30秒内没有受伤,然后就会有八百分之一的概率被清除。", + "return": [], + "description": "判断是否为持久性生物", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsPersistent()", + "params": [], + "type": "api", + "side": "server", + "name": "IsPersistent" + }, { - "type": "api", - "name": "IsRoaring", - "method": "", - "description": "判断是否处于咆哮状态,截止至网易2.9版本,仅对劫掠兽有效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsRoaring()" - }, + "remark": "", + "return": [], + "description": "判断是否处于咆哮状态,截止至网易2.9版本,仅对劫掠兽有效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsRoaring()", + "params": [], + "type": "api", + "side": "server", + "name": "IsRoaring" + }, { - "type": "api", - "name": "IsStunned", - "method": "", - "description": "判断是否处于眩晕状态,截止至网易2.9版本,仅对劫掠兽有效", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsStunned()" - }, + "remark": "", + "return": [], + "description": "判断是否处于眩晕状态,截止至网易2.9版本,仅对劫掠兽有效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.IsStunned()", + "params": [], + "type": "api", + "side": "server", + "name": "IsStunned" + }, { - "type": "api", - "name": "RemoveActorComponent", - "method": "", - "description": "删除指定实体的指定Component", - "remark": "- 该接口不会判断生物的json是否具有传入的Component,返回值的结果只代表指令是否正常发出\r\n - AddActorComponent、AddActorComponentGroup、RemoveActorComponent、RemoveActorComponentGroup之间会互相影响,结果依据执行顺序而定", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 该接口不会判断生物的json是否具有传入的Component,返回值的结果只代表指令是否正常发出\r\n - AddActorComponent、AddActorComponentGroup、RemoveActorComponent、RemoveActorComponentGroup之间会互相影响,结果依据执行顺序而定", + "return": [], + "description": "删除指定实体的指定Component", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityEvent(entityId)\r\ncomp.RemoveActorComponent(\"minecraft:attack\")", "params": [ { - "name": "componentName", - "type": "str", + "type": "str", + "name": "componentName", "description": "实体行为包中定义的component的键名" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityEvent(entityId)\r\ncomp.RemoveActorComponent(\"minecraft:attack\")" - }, + ], + "type": "api", + "side": "server", + "name": "RemoveActorComponent" + }, { - "type": "api", - "name": "RemoveActorComponentGroup", - "method": "", - "description": "移除指定实体在实体json中配置的ComponentGroup", - "remark": "- 该接口不会判断生物的json是否具有传入的groupName,返回值的结果只代表指令是否正常发出\r\n - 在羊的entity json文件中`component_groups`字段下配置羊的大小:\r\n ```json\r\n \"component_groups\": {\r\n \"minecraft:sheep_baby\": {\r\n \"minecraft:is_baby\": {\r\n },\r\n \"minecraft:scale\": {\r\n \"value\": 0.5\r\n },\r\n \"minecraft:ageable\": {\r\n \"duration\": 1200,\r\n \"feed_items\": \"wheat\",\r\n \"grow_up\": {\r\n \"event\": \"minecraft:ageable_grow_up\",\r\n \"target\": \"self\"\r\n }\r\n },\r\n \"minecraft:behavior.follow_parent\": {\r\n \"priority\": 6,\r\n \"speed_multiplier\": 1.1\r\n }\r\n },\r\n \"minecraft:sheep_adult\": {\r\n \"minecraft:experience_reward\": {\r\n \"on_bred\": \"Math.Random(1,7)\",\r\n \"on_death\": \"query.last_hit_by_player ? Math.Random(1,3) : 0\"\r\n },\r\n \"minecraft:behavior.breed\": {\r\n \"priority\": 3,\r\n \"speed_multiplier\": 1.0\r\n },\r\n \"minecraft:breedable\": {\r\n \"require_tame\": false,\r\n \"breeds_with\": {\r\n \"mate_type\": \"minecraft:sheep\",\r\n \"baby_type\": \"minecraft:sheep\"\r\n },\r\n \"breed_items\": \"wheat\"\r\n }\r\n }\r\n }\r\n ```", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 该接口不会判断生物的json是否具有传入的groupName,返回值的结果只代表指令是否正常发出\r\n - 在羊的entity json文件中`component_groups`字段下配置羊的大小:\r\n ```json\r\n \"component_groups\": {\r\n \"minecraft:sheep_baby\": {\r\n \"minecraft:is_baby\": {\r\n },\r\n \"minecraft:scale\": {\r\n \"value\": 0.5\r\n },\r\n \"minecraft:ageable\": {\r\n \"duration\": 1200,\r\n \"feed_items\": \"wheat\",\r\n \"grow_up\": {\r\n \"event\": \"minecraft:ageable_grow_up\",\r\n \"target\": \"self\"\r\n }\r\n },\r\n \"minecraft:behavior.follow_parent\": {\r\n \"priority\": 6,\r\n \"speed_multiplier\": 1.1\r\n }\r\n },\r\n \"minecraft:sheep_adult\": {\r\n \"minecraft:experience_reward\": {\r\n \"on_bred\": \"Math.Random(1,7)\",\r\n \"on_death\": \"query.last_hit_by_player ? Math.Random(1,3) : 0\"\r\n },\r\n \"minecraft:behavior.breed\": {\r\n \"priority\": 3,\r\n \"speed_multiplier\": 1.0\r\n },\r\n \"minecraft:breedable\": {\r\n \"require_tame\": false,\r\n \"breeds_with\": {\r\n \"mate_type\": \"minecraft:sheep\",\r\n \"baby_type\": \"minecraft:sheep\"\r\n },\r\n \"breed_items\": \"wheat\"\r\n }\r\n }\r\n }\r\n ```", + "return": [], + "description": "移除指定实体在实体json中配置的ComponentGroup", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "#移除小羊group,添加大羊group\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityEvent(entityId)\r\ncomp.RemoveActorComponentGroup(\"minecraft:sheep_baby\")\r\ncomp.AddActorComponentGroup(\"minecraft:sheep_adult\")", "params": [ { - "name": "groupName", - "type": "str", + "type": "str", + "name": "groupName", "description": "实体行为包中定义的component_group的键名" } - ], - "return": [], - "example": "#移除小羊group,添加大羊group\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityEvent(entityId)\r\ncomp.RemoveActorComponentGroup(\"minecraft:sheep_baby\")\r\ncomp.AddActorComponentGroup(\"minecraft:sheep_adult\")" - }, + ], + "type": "api", + "side": "server", + "name": "RemoveActorComponentGroup" + }, { - "type": "api", - "name": "RemoveEntityMotion", - "method": "", - "description": "移除实体(不含玩家)身上的运动器", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "", + "return": [], + "description": "移除实体(不含玩家)身上的运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotionComp.RemoveEntityMotion(mID)", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "要移除的某个运动器的ID" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotionComp.RemoveEntityMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "RemoveEntityMotion" + }, { - "type": "api", - "name": "ResetAttackTarget", - "method": "", - "description": "清除仇恨目标", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAction(entityId)\r\ncomp.ResetAttackTarget()" - }, + "remark": "", + "return": [], + "description": "清除仇恨目标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAction(entityId)\r\ncomp.ResetAttackTarget()", + "params": [], + "type": "api", + "side": "server", + "name": "ResetAttackTarget" + }, { - "type": "api", - "name": "ResetMotion", - "method": "", - "description": "重置生物(不含玩家)的瞬时移动方向向量", - "remark": "- 该接口只能重置SetMotion所设置的瞬时移动方向向量,无法影响由生物本身的AI所产生的运动。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotionComp.ResetMotion()" - }, + "remark": "- 该接口只能重置SetMotion所设置的瞬时移动方向向量,无法影响由生物本身的AI所产生的运动。", + "return": [], + "description": "重置生物(不含玩家)的瞬时移动方向向量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotionComp.ResetMotion()", + "params": [], + "type": "api", + "side": "server", + "name": "ResetMotion" + }, { - "type": "api", - "name": "ResetStepHeight", - "method": "", - "description": "恢复引擎默认玩家前进非跳跃状态下能上的最大台阶高度", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.ResetStepHeight()" - }, + "remark": "", + "return": [], + "description": "恢复引擎默认玩家前进非跳跃状态下能上的最大台阶高度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.ResetStepHeight()", + "params": [], + "type": "api", + "side": "server", + "name": "ResetStepHeight" + }, { - "type": "api", - "name": "SetActorCollidable", - "method": "", - "description": "设置实体是否可碰撞", - "remark": "- 碰撞是指生物碰撞盒重叠\r\n - 参数isCollidable是由bool控制的所以传入其它非0的int时等同于传入1", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 碰撞是指生物碰撞盒重叠\r\n - 参数isCollidable是由bool控制的所以传入其它非0的int时等同于传入1", + "return": [], + "description": "设置实体是否可碰撞", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateActorCollidable(entityId)\r\nsuccess = comp.SetActorCollidable(1)", "params": [ { - "name": "isCollidable", - "type": "int", + "type": "int", + "name": "isCollidable", "description": "0:可碰撞 1:不可碰撞" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateActorCollidable(entityId)\r\nsuccess = comp.SetActorCollidable(1)" - }, + ], + "type": "api", + "side": "server", + "name": "SetActorCollidable" + }, { - "type": "api", - "name": "SetActorPushable", - "method": "", - "description": "设置实体是否可推动", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "", + "return": [], + "description": "设置实体是否可推动", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateActorPushable(entityId)\r\nsuccess = comp.SetActorPushable(1)", "params": [ { - "name": "isPushable", - "type": "int", + "type": "int", + "name": "isPushable", "description": "0:不可推动 1:可推动" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateActorPushable(entityId)\r\nsuccess = comp.SetActorPushable(1)" - }, + ], + "type": "api", + "side": "server", + "name": "SetActorPushable" + }, { - "type": "api", - "name": "SetAttackTarget", - "method": "", - "description": "设置仇恨目标", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "", + "return": [], + "description": "设置仇恨目标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAction(entityId)\r\ncomp.SetAttackTarget(targetId)", "params": [ { - "name": "targetId", - "type": "str", + "type": "str", + "name": "targetId", "description": "目标实体id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAction(entityId)\r\ncomp.SetAttackTarget(targetId)" - }, + ], + "type": "api", + "side": "server", + "name": "SetAttackTarget" + }, { - "type": "api", - "name": "SetBlockControlAi", - "method": "", - "description": "设置屏蔽生物原生AI", - "remark": "- 屏蔽AI后的生物无法行动,不受重力且不会被推动,但是可以受到伤害,也可以被玩家交互(例如马被骑或村民被交易)\r\n - 对玩家无效", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 屏蔽AI后的生物无法行动,不受重力且不会被推动,但是可以受到伤害,也可以被玩家交互(例如马被骑或村民被交易)\r\n - 对玩家无效", + "return": [], + "description": "设置屏蔽生物原生AI", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateControlAi(entityId)\r\ncomp.SetBlockControlAi(False, True)", "params": [ { - "name": "isBlock", - "type": "bool", + "type": "bool", + "name": "isBlock", "description": "是否保留AI,False为屏蔽" - }, + }, { - "name": "freezeAnim", - "type": "bool", + "type": "bool", + "name": "freezeAnim", "description": "屏蔽AI时是否冻结动作,默认为False,仅当isBlock为False时生效。重进世界会恢复成初始动作" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateControlAi(entityId)\r\ncomp.SetBlockControlAi(False, True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBlockControlAi" + }, { - "type": "api", - "name": "SetCanOtherPlayerRide", - "method": "", - "description": "设置其他玩家是否有权限骑乘,True表示每个玩家都能骑乘,False只有驯服者才能骑乘", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "", + "return": [], + "description": "设置其他玩家是否有权限骑乘,True表示每个玩家都能骑乘,False只有驯服者才能骑乘", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "# 驯服生物\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetCanOtherPlayerRide(entityId,False)", "params": [ { - "name": "tamedEntityId", - "type": "str", + "type": "str", + "name": "tamedEntityId", "description": "可骑乘生物id" - }, + }, { - "name": "canRide", - "type": "bool", + "type": "bool", + "name": "canRide", "description": "是否控制" } - ], - "return": [], - "example": "# 驯服生物\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetCanOtherPlayerRide(entityId,False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetCanOtherPlayerRide" + }, { - "type": "api", - "name": "SetControl", - "method": "", - "description": "设置该生物无需装备鞍就可以控制行走跳跃", - "remark": "- 该接口仅对已被驯服的可骑乘生物生效。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 该接口仅对已被驯服的可骑乘生物生效。", + "return": [], + "description": "设置该生物无需装备鞍就可以控制行走跳跃", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetControl(entityId,True)", "params": [ { - "name": "tamedEntityId", - "type": "str", + "type": "str", + "name": "tamedEntityId", "description": "可骑乘生物id" - }, + }, { - "name": "isControl", - "type": "bool", + "type": "bool", + "name": "isControl", "description": "是否控制" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetControl(entityId,True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetControl" + }, { - "type": "api", - "name": "SetEntityInteractFilter", - "method": "", - "description": "设置与生物可交互的条件", - "remark": "- 该接口修改minecraft:interact->on_interact中的filters的定义\r\n - 仅当生物存在minecraft:interact组件时才能调用该接口,例如牛、羊驼、猪灵等", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 该接口修改minecraft:interact->on_interact中的filters的定义\r\n - 仅当生物存在minecraft:interact组件时才能调用该接口,例如牛、羊驼、猪灵等", + "return": [], + "description": "设置与生物可交互的条件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nimport json\r\ncomp = serverApi.GetEngineCompFactory().CreateInteract(entityId)\r\nfilterDict = {\r\n \"filters\": {\r\n \"all_of\": [\r\n { \"test\": \"is_family\", \"subject\" : \"other\", \"value\" : \"player\"},\r\n { \"test\": \"has_equipment\", \"domain\": \"hand\", \"subject\": \"other\", \"value\": \"bucket:0\"}\r\n ]\r\n }\r\n}\r\nfilterStr = json.dumps(filterDict)\r\ncomp.SetEntityInteractFilter(0, filterStr)", "params": [ { - "name": "index", - "type": "int", + "type": "int", + "name": "index", "description": "交互列表下标" - }, + }, { - "name": "interactFilter", - "type": "str", + "type": "str", + "name": "interactFilter", "description": "可交互的条件" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nimport json\r\ncomp = serverApi.GetEngineCompFactory().CreateInteract(entityId)\r\nfilterDict = {\r\n \"filters\": {\r\n \"all_of\": [\r\n { \"test\": \"is_family\", \"subject\" : \"other\", \"value\" : \"player\"},\r\n { \"test\": \"has_equipment\", \"domain\": \"hand\", \"subject\": \"other\", \"value\": \"bucket:0\"}\r\n ]\r\n }\r\n}\r\nfilterStr = json.dumps(filterDict)\r\ncomp.SetEntityInteractFilter(0, filterStr)" - }, + ], + "type": "api", + "side": "server", + "name": "SetEntityInteractFilter" + }, { - "type": "api", - "name": "SetEntityLockRider", - "method": "", - "description": "设置坐骑上的实体是否锁定序号", - "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型。\r\n - 锁定以后,该坐骑上某个实体停止骑乘后不会改变坐骑上其他实体当前所处的座位。\r\n - 解除锁定后,不会立刻改变坐骑上骑乘者的位置。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型。\r\n - 锁定以后,该坐骑上某个实体停止骑乘后不会改变坐骑上其他实体当前所处的座位。\r\n - 解除锁定后,不会立刻改变坐骑上骑乘者的位置。", + "return": [], + "description": "设置坐骑上的实体是否锁定序号", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "# 锁定骑乘者序号\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetEntityLockRider(True)", "params": [ { - "name": "isLock", - "type": "bool", + "type": "bool", + "name": "isLock", "description": "是否锁定实体当前所处的序号" } - ], - "return": [], - "example": "# 锁定骑乘者序号\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetEntityLockRider(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetEntityLockRider" + }, { - "type": "api", - "name": "SetEntityOnFire", - "method": "", - "description": "设置实体着火", - "remark": "- 在水中或者雨中不会生效,着火时间受生物装备、生物的状态影响。burn_damage取值范围是0~1000,小于0将取0,大于1000将取1000", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 在水中或者雨中不会生效,着火时间受生物装备、生物的状态影响。burn_damage取值范围是0~1000,小于0将取0,大于1000将取1000", + "return": [], + "description": "设置实体着火", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.SetEntityOnFire(1, 2)", "params": [ { - "name": "seconds", - "type": "int", + "type": "int", + "name": "seconds", "description": "着火时间(单位:秒),当传入参数seconds小于等于0时,将让着火的实体灭火" - }, + }, { - "name": "burn_damage", - "type": "int", + "type": "int", + "name": "burn_damage", "description": "着火状态下每秒扣的血量,不传的话默认是1" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\ncomp.SetEntityOnFire(1, 2)" - }, + ], + "type": "api", + "side": "server", + "name": "SetEntityOnFire" + }, { - "type": "api", - "name": "SetEntityRide", - "method": "", - "description": "驯服可骑乘生物", - "remark": "- 驯服信息会被存盘", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 驯服信息会被存盘", + "return": [], + "description": "驯服可骑乘生物", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "# 驯服生物\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetEntityRide(playerId,entityId)", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "tamedEntityId", - "type": "str", + "type": "str", + "name": "tamedEntityId", "description": "要驯服的可骑乘生物id" } - ], - "return": [], - "example": "# 驯服生物\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetEntityRide(playerId,entityId)" - }, + ], + "type": "api", + "side": "server", + "name": "SetEntityRide" + }, { - "type": "api", - "name": "SetEntitySeat", - "method": "", - "description": "设置坐骑座位的位置、旋转以及允许实体旋转范围", - "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型。\r\n - 只能修改通过接口AddEntitySeat添加的座位。\r\n - 非玩家实体即使所处座位的lock_rot参数为默认值,也不可360度旋转。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型。\r\n - 只能修改通过接口AddEntitySeat添加的座位。\r\n - 非玩家实体即使所处座位的lock_rot参数为默认值,也不可360度旋转。", + "return": [], + "description": "设置坐骑座位的位置、旋转以及允许实体旋转范围", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetEntitySeat(0, (1.0, 1.0, 1.0), 90.0, 90.0)", "params": [ { - "name": "seatIndex", - "type": "int", + "type": "int", + "name": "seatIndex", "description": "座位序号,范围为0~最大座位序号" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "座位位置" - }, + }, { - "name": "rot", - "type": "float", + "type": "float", + "name": "rot", "description": "座位旋转,默认为0" - }, + }, { - "name": "lock_rot", - "type": "float", + "type": "float", + "name": "lock_rot", "description": "骑乘者允许旋转角度范围,默认不限制" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetEntitySeat(0, (1.0, 1.0, 1.0), 90.0, 90.0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetEntitySeat" + }, { - "type": "api", - "name": "SetEntityShareablesItems", - "method": "", - "description": "设置生物可分享/可拾取的物品列表", - "remark": "- 该接口修改minecraft:shareables的items定义\r\n - 仅当生物存在minecraft:shareables组件时才能调用该接口,例如狐狸、尸壳、猪灵等。若admire为True,则生物还需要有minecraft:admire_item组件。若barter为True,则生物还需有minecraft:behavior.barter行为。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 该接口修改minecraft:shareables的items定义\r\n - 仅当生物存在minecraft:shareables组件时才能调用该接口,例如狐狸、尸壳、猪灵等。若admire为True,则生物还需要有minecraft:admire_item组件。若barter为True,则生物还需有minecraft:behavior.barter行为。", + "return": [], + "description": "设置生物可分享/可拾取的物品列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateShareables(entityId)\r\nshareableItems = []\r\nshareableItems.append({\r\n \"item\": \"minecraft:golden_sword\",\r\n \"auxValue\": 0,\r\n \"priority\": 1,\r\n \"pickupLimit\": 1,\r\n \"barter\": True,\r\n \"admire\": True,\r\n})\r\ncomp.SetEntityShareablesItems(shareableItems)", "params": [ { - "name": "items", - "type": "list(dict)", + "type": "list(dict)", + "name": "items", "description": "可分享/可拾取的物品列表" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateShareables(entityId)\r\nshareableItems = []\r\nshareableItems.append({\r\n \"item\": \"minecraft:golden_sword\",\r\n \"auxValue\": 0,\r\n \"priority\": 1,\r\n \"pickupLimit\": 1,\r\n \"barter\": True,\r\n \"admire\": True,\r\n})\r\ncomp.SetEntityShareablesItems(shareableItems)" - }, + ], + "type": "api", + "side": "server", + "name": "SetEntityShareablesItems" + }, { - "type": "api", - "name": "SetEntityTamed", - "method": "", - "description": "设置生物驯服,需要配合 entityEvent组件使用。该类驯服不包含骑乘功能。", - "remark": "- 驯服一个生物,需要按以下步骤:\r\n 1. 搭配修改生物json文件,使其能够被驯服:\r\n - 添加minecraft:tameable组件\r\n - 添加一个component group,包含minecraft:is_tamed组件,以及其他驯服后的行为\r\n - 添加一个event,添加刚刚添加的component group,并移除不需要的component group\r\n 2. 使用SetEntityTamed使目标生物被驯服\r\n 3. 使用TriggerCustomEvent触发驯服event\r\n 如果是对原版可驯服生物使用,则无需按照第一步修改json,而是找到已有的event,在第三步中触发即可\r\n - 如修改苦力怕可被驯服,json做如下修改:\r\n ```json\r\n {\r\n \"format_version\": \"1.8.0\",\r\n \"minecraft:entity\": {\r\n \"description\": {\r\n \"identifier\": \"minecraft:creeper\",\r\n \"is_spawnable\": true,\r\n \"is_summonable\": true,\r\n \"is_experimental\": false\r\n },\r\n \"component_groups\": {\r\n ...\r\n //增加驯服状态\r\n \"netease:creeper_tame\":{\r\n \"minecraft:is_tamed\": {\r\n },\r\n //跟随主人\r\n \"minecraft:behavior.follow_owner\": {\r\n \"priority\": 4, //优先级要高于其他移动行为\r\n \"speed_multiplier\": 1.0,\r\n \"start_distance\": 10,\r\n \"stop_distance\": 2\r\n }\r\n }\r\n },\r\n \r\n \"components\": {\r\n ...\r\n //增加驯服组件,使用骨头驯服\r\n \"minecraft:tameable\": {\r\n \"probability\": 0.33,\r\n \"tameItems\": \"bone\",\r\n \"tame_event\": {\r\n \"event\": \"netease:on_tame\",\r\n \"target\": \"self\"\r\n }\r\n }\r\n },\r\n \r\n \"events\": {\r\n ...\r\n //增加驯服事件\r\n \"netease:on_tame\": {\r\n //移除掉所有跟爆炸有关的逻辑\r\n \"remove\": {\r\n \"component_groups\": [\r\n \"minecraft:exploding\",\r\n \"minecraft:charged_exploding\",\r\n \"minecraft:forced_exploding\",\r\n \"minecraft:forced_charged_exploding\",\r\n \"minecraft:charged_creeper\"\r\n ]\r\n },\r\n //添加netease:creeper_tame\r\n \"add\": {\r\n \"component_groups\": [\r\n \"netease:creeper_tame\"\r\n ]\r\n }\r\n }\r\n }\r\n }\r\n }\r\n ```", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 驯服一个生物,需要按以下步骤:\r\n 1. 搭配修改生物json文件,使其能够被驯服:\r\n - 添加minecraft:tameable组件\r\n - 添加一个component group,包含minecraft:is_tamed组件,以及其他驯服后的行为\r\n - 添加一个event,添加刚刚添加的component group,并移除不需要的component group\r\n 2. 使用SetEntityTamed使目标生物被驯服\r\n 3. 使用TriggerCustomEvent触发驯服event\r\n 如果是对原版可驯服生物使用,则无需按照第一步修改json,而是找到已有的event,在第三步中触发即可\r\n - 如修改苦力怕可被驯服,json做如下修改:\r\n ```json\r\n {\r\n \"format_version\": \"1.8.0\",\r\n \"minecraft:entity\": {\r\n \"description\": {\r\n \"identifier\": \"minecraft:creeper\",\r\n \"is_spawnable\": true,\r\n \"is_summonable\": true,\r\n \"is_experimental\": false\r\n },\r\n \"component_groups\": {\r\n ...\r\n //增加驯服状态\r\n \"netease:creeper_tame\":{\r\n \"minecraft:is_tamed\": {\r\n },\r\n //跟随主人\r\n \"minecraft:behavior.follow_owner\": {\r\n \"priority\": 4, //优先级要高于其他移动行为\r\n \"speed_multiplier\": 1.0,\r\n \"start_distance\": 10,\r\n \"stop_distance\": 2\r\n }\r\n }\r\n },\r\n \r\n \"components\": {\r\n ...\r\n //增加驯服组件,使用骨头驯服\r\n \"minecraft:tameable\": {\r\n \"probability\": 0.33,\r\n \"tameItems\": \"bone\",\r\n \"tame_event\": {\r\n \"event\": \"netease:on_tame\",\r\n \"target\": \"self\"\r\n }\r\n }\r\n },\r\n \r\n \"events\": {\r\n ...\r\n //增加驯服事件\r\n \"netease:on_tame\": {\r\n //移除掉所有跟爆炸有关的逻辑\r\n \"remove\": {\r\n \"component_groups\": [\r\n \"minecraft:exploding\",\r\n \"minecraft:charged_exploding\",\r\n \"minecraft:forced_exploding\",\r\n \"minecraft:forced_charged_exploding\",\r\n \"minecraft:charged_creeper\"\r\n ]\r\n },\r\n //添加netease:creeper_tame\r\n \"add\": {\r\n \"component_groups\": [\r\n \"netease:creeper_tame\"\r\n ]\r\n }\r\n }\r\n }\r\n }\r\n }\r\n ```", + "return": [], + "description": "设置生物驯服,需要配合 entityEvent组件使用。该类驯服不包含骑乘功能。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\n# 使tamedId被playerId驯服\r\ntameComp = serverApi.GetEngineCompFactory().CreateTame(tamedId)\r\ntameComp.SetEntityTamed(playerId,tamedId)\r\n# 触发tamedId的netease:on_tame自定义event\r\nenvComp = serverApi.GetEngineCompFactory().CreateEntityEvent(tamedId)\r\nenvComp.TriggerCustomEvent(tamedId,'netease:on_tame')", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "驯服玩家Id" - }, + }, { - "name": "tamedId", - "type": "str", + "type": "str", + "name": "tamedId", "description": "被驯服的生物Id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\n# 使tamedId被playerId驯服\r\ntameComp = serverApi.GetEngineCompFactory().CreateTame(tamedId)\r\ntameComp.SetEntityTamed(playerId,tamedId)\r\n# 触发tamedId的netease:on_tame自定义event\r\nenvComp = serverApi.GetEngineCompFactory().CreateEntityEvent(tamedId)\r\nenvComp.TriggerCustomEvent(tamedId,'netease:on_tame')" - }, + ], + "type": "api", + "side": "server", + "name": "SetEntityTamed" + }, { - "type": "api", - "name": "SetJumpPower", - "method": "", - "description": "设置生物跳跃力度,0.42表示正常水平", - "remark": "- 生物跳跃力度影响生物跳跃高度;本接口调用时需要客户端加载完成,如在AddServerPlayer中,客户端还没加载完成,要延后执行才能生效\r\n - 兔子跳跃高度是内置的,无法通过SetJumpPower设置跳跃力度。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 生物跳跃力度影响生物跳跃高度;本接口调用时需要客户端加载完成,如在AddServerPlayer中,客户端还没加载完成,要延后执行才能生效\r\n - 兔子跳跃高度是内置的,无法通过SetJumpPower设置跳跃力度。", + "return": [], + "description": "设置生物跳跃力度,0.42表示正常水平", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGravity(entityId)\r\ncomp.SetJumpPower(0.84)", "params": [ { - "name": "jumpPower", - "type": "float", + "type": "float", + "name": "jumpPower", "description": "跳跃力度,正常是0.42" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGravity(entityId)\r\ncomp.SetJumpPower(0.84)" - }, + ], + "type": "api", + "side": "server", + "name": "SetJumpPower" + }, { - "type": "api", - "name": "SetLeashHolder", - "method": "", - "description": "为实体添加牵引者,与原版拴绳的作用相同,详见基岩版栓绳介绍", - "remark": "- 如果牵引者和被牵者距离太远将会瞬间断开", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 如果牵引者和被牵者距离太远将会瞬间断开", + "return": [], + "description": "为实体添加牵引者,与原版拴绳的作用相同,详见基岩版栓绳介绍", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetLeashHolder(playerId)", "params": [ { - "name": "holderId", - "type": "str", + "type": "str", + "name": "holderId", "description": "牵引者Id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetLeashHolder(playerId)" - }, + ], + "type": "api", + "side": "server", + "name": "SetLeashHolder" + }, { - "type": "api", - "name": "SetLootDropped", - "method": "", - "description": "设置生物是否生成掉落物", - "remark": "- 仅在开启战利品生成效果下生效,对玩家不生效,玩家可在设置界面设置死亡不掉", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 仅在开启战利品生成效果下生效,对玩家不生效,玩家可在设置界面设置死亡不掉", + "return": [], + "description": "设置生物是否生成掉落物", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetLootDropped(True)", "params": [ { - "name": "isLootDropped", - "type": "bool", + "type": "bool", + "name": "isLootDropped", "description": "设置生物是否生成掉落物" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId)\r\nresult = comp.SetLootDropped(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetLootDropped" + }, { - "type": "api", - "name": "SetMobKnockback", - "method": "", - "description": "设置击退的初始速度,需要考虑阻力的影响", - "remark": "- 在damageEvent事件里面使用该接口时,需把damageEvent事件回调的knock参数设置为False\r\n - 该接口会触发OnKnockBackServerEvent事件,所以当需要在该事件中使用时,请编写逻辑避免循环调用", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 在damageEvent事件里面使用该接口时,需把damageEvent事件回调的knock参数设置为False\r\n - 该接口会触发OnKnockBackServerEvent事件,所以当需要在该事件中使用时,请编写逻辑避免循环调用", + "return": [], + "description": "设置击退的初始速度,需要考虑阻力的影响", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAction(entityId)\r\ncomp.SetMobKnockback(0.1, 0.1, 1.0, 1.0, 1.0)", "params": [ { - "name": "xd", - "type": "float", + "type": "float", + "name": "xd", "description": "x轴方向,用來控制角度" - }, + }, { - "name": "zd", - "type": "float", + "type": "float", + "name": "zd", "description": "z轴方向,用來控制角度" - }, + }, { - "name": "power", - "type": "float", + "type": "float", + "name": "power", "description": "用来控制水平方向的初速度" - }, + }, { - "name": "height", - "type": "float", + "type": "float", + "name": "height", "description": "竖直方向的初速度" - }, + }, { - "name": "heightCap", - "type": "float", + "type": "float", + "name": "heightCap", "description": "向上速度阈值,当实体本身已经有向上的速度时需要考虑这个值,用来确保最终向上的速度不会超过heightCap" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAction(entityId)\r\ncomp.SetMobKnockback(0.1, 0.1, 1.0, 1.0, 1.0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetMobKnockback" + }, { - "type": "api", - "name": "SetMotion", - "method": "", - "description": "设置瞬时的移动方向向量,用于本地玩家", - "remark": "- 如果频繁快速修改本地玩家的瞬时移动向量,可能会触发引擎服务端的反作弊机制(例如掉落伤害),需要频繁快速修改时最好搭配服务端SetMotion同步修改", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 如果频繁快速修改本地玩家的瞬时移动向量,可能会触发引擎服务端的反作弊机制(例如掉落伤害),需要频繁快速修改时最好搭配服务端SetMotion同步修改", + "return": [], + "description": "设置瞬时的移动方向向量,用于本地玩家", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# 使玩家向准星的方向突进一段距离\r\nlocalPlayerId = clientApi.GetLocalPlayerId()\r\nrotComp = clientApi.GetEngineCompFactory().CreateRot(localPlayerId)\r\nrot = rotComp.GetRot()\r\nx, y, z = clientApi.GetDirFromRot(rot)\r\nmotionComp = clientApi.GetEngineCompFactory().CreateActorMotion(localPlayerId)\r\nmotionComp.SetMotion((x * 5, y * 5, z * 5))\r\n# rot 和 世界坐标系关系\r\n# ^ x -90°\r\n# |\r\n# 180°/-180 ----------> z 0°\r\n# | 90°", "params": [ { - "name": "motion", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "motion", "description": "世界坐标系下的向量,该方向为世界坐标系下的向量,以x,z,y三个轴的正方向为正值,可以通过当前玩家的rot组件判断目前玩家面向的方向,可在开发模式下打开F3观察数值变化。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# 使玩家向准星的方向突进一段距离\r\nlocalPlayerId = clientApi.GetLocalPlayerId()\r\nrotComp = clientApi.GetEngineCompFactory().CreateRot(localPlayerId)\r\nrot = rotComp.GetRot()\r\nx, y, z = clientApi.GetDirFromRot(rot)\r\nmotionComp = clientApi.GetEngineCompFactory().CreateActorMotion(localPlayerId)\r\nmotionComp.SetMotion((x * 5, y * 5, z * 5))\r\n# rot 和 世界坐标系关系\r\n# ^ x -90°\r\n# |\r\n# 180°/-180 ----------> z 0°\r\n# | 90°" - }, + ], + "type": "api", + "side": "client", + "name": "SetMotion" + }, { - "type": "api", - "name": "SetMoveSetting", - "method": "", - "description": "寻路组件", - "remark": "- 使用该接口时,需要在生物中配置有寻路的json组件。配置寻路json组件后,该接口会自动选择相应类型的寻路\r\n 目前支持的寻路json组件包括:\r\n - minecraft:navigation.walk\r\n 陆地寻路,与原版僵尸的寻路相同\r\n - minecraft:navigation.generic\r\n 水陆寻路,支持陆地与水中,与原版溺尸的寻路相同\r\n - minecraft:navigation.climb\r\n 陆地寻路,但是支持爬墙,与原版蜘蛛的寻路相同。这种寻路可能会被头顶方块阻挡,一直无法抵达目的地\r\n - minecraft:navigation.fly\r\n 空中寻路,与原版鹦鹉的寻路相同\r\n 以上的寻路都需要搭配一些其他json组件(例如movement)使用,具体可以参考NavigationMod的示例\r\n 上面没有提到的navigation类型暂不支持,例如minecraft:navigation.float(如原版恶魂),minecraft:navigation.hover(如原版蜜蜂)\r\n - 不同的生物拥有不同的默认最大跟随距离,若要寻路的目标点距离大于此值引擎会拒绝寻路,要修改该距离可以通过在entity的json中配置.\r\n ```json\r\n {\r\n \"format_version\": \"1.8.0\",\r\n \"minecraft:entity\": {\r\n \"components\": {\r\n \"minecraft:follow_range\": {\r\n \"value\": 48,\r\n \"max\": 48\r\n }\r\n }\r\n }\r\n }\r\n ```\r\n - 关于maxIteration参数\r\n 该参数会影响实际寻到路径的长度。若寻路算法迭代一定次数后,未寻到目标点,会返回局部最优解,即生物只会走到半路。\r\n 在无大型障碍物的情况下,参数对应的参考寻路距离如下:该参数默认值200,最大值2000,请开发者根据实际情况选择。\r\n | maxIteration | 与目标点直线距离 |\r\n | ------------ | ---------------- |\r\n | 200 | 13 |\r\n | 500 | 20 |\r\n | 1000 | 30 |\r\n | 2000 | 43 |\r\n - 关于callback函数\r\n 该函数需要接受两个参数,第一个参数为寻路的entityId,类型str,第二个参数为寻路结果,类型int\r\n (玩家获取到的位置比地面会高1.62格,若以玩家位置为目标点需要先把y轴减去1.62,否则callback会一直返回1)\r\n | 结果 | 说明 |\r\n | ---- | ------------------------------------------------------------ |\r\n | -3 | 寻路失败,大于跟随距离,或者生物周围没有可行走位置,或者对正在寻路的飞行系生物使用 |\r\n | -2 | 寻路失败,生物没有寻路组件(指minecraft:navigation) |\r\n | -1 | 寻路失败,参数错误,或生物不存在 |\r\n | 0 | 寻路完成。到达设定的目标点 |\r\n | 1 | 寻路完成,但未到达目标点(可能由于maxIteration参数偏小) |\r\n | 2 | 寻路中断。中途遇到障碍物被阻碍 |\r\n | 3 | 寻路中断。被生物原版寻路行为覆盖,或寻路未结束时重复调用moveTo组件。
若生物的移速太低(真实速度小于0.3格每秒),也会被当成寻路被卡住,返回该错误码 |\r\n - 对于各种类型寻路的生物,还需要满足以下初始条件:\r\n 1. 陆地寻路,水陆寻路与爬墙寻路:需要满足以下任一条件:\r\n - 生物着地\r\n - 生物正在骑乘,并且骑乘物着地\r\n - 生物在液体中\r\n - 生物是凋零\r\n 2. 飞行寻路:需要满足以下任一条件:\r\n - 不在骑乘状态\r\n - 在液体中\r\n - 生物着地\r\n - json配置中的can_path_from_air属性为true\r\n - demo简介:\r\n 聊天栏输入walk/generic/climb/fly会原地生成一个使用对应navigation json组件的生物,然后跑到其他位置,再输入go,会将刚才生成的生物导航到玩家当前位置。\r\n 这4种示例生物的行为json可以在NavigationMod_behavior/entities目录查看。\r\n 4种示例生物的最大寻路距离都设置为了48格。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 使用该接口时,需要在生物中配置有寻路的json组件。配置寻路json组件后,该接口会自动选择相应类型的寻路\r\n 目前支持的寻路json组件包括:\r\n - minecraft:navigation.walk\r\n 陆地寻路,与原版僵尸的寻路相同\r\n - minecraft:navigation.generic\r\n 水陆寻路,支持陆地与水中,与原版溺尸的寻路相同\r\n - minecraft:navigation.climb\r\n 陆地寻路,但是支持爬墙,与原版蜘蛛的寻路相同。这种寻路可能会被头顶方块阻挡,一直无法抵达目的地\r\n - minecraft:navigation.fly\r\n 空中寻路,与原版鹦鹉的寻路相同\r\n 以上的寻路都需要搭配一些其他json组件(例如movement)使用,具体可以参考NavigationMod的示例\r\n 上面没有提到的navigation类型暂不支持,例如minecraft:navigation.float(如原版恶魂),minecraft:navigation.hover(如原版蜜蜂)\r\n - 不同的生物拥有不同的默认最大跟随距离,若要寻路的目标点距离大于此值引擎会拒绝寻路,要修改该距离可以通过在entity的json中配置.\r\n ```json\r\n {\r\n \"format_version\": \"1.8.0\",\r\n \"minecraft:entity\": {\r\n \"components\": {\r\n \"minecraft:follow_range\": {\r\n \"value\": 48,\r\n \"max\": 48\r\n }\r\n }\r\n }\r\n }\r\n ```\r\n - 关于maxIteration参数\r\n 该参数会影响实际寻到路径的长度。若寻路算法迭代一定次数后,未寻到目标点,会返回局部最优解,即生物只会走到半路。\r\n 在无大型障碍物的情况下,参数对应的参考寻路距离如下:该参数默认值200,最大值2000,请开发者根据实际情况选择。\r\n | maxIteration | 与目标点直线距离 |\r\n | ------------ | ---------------- |\r\n | 200 | 13 |\r\n | 500 | 20 |\r\n | 1000 | 30 |\r\n | 2000 | 43 |\r\n - 关于callback函数\r\n 该函数需要接受两个参数,第一个参数为寻路的entityId,类型str,第二个参数为寻路结果,类型int\r\n (玩家获取到的位置比地面会高1.62格,若以玩家位置为目标点需要先把y轴减去1.62,否则callback会一直返回1)\r\n | 结果 | 说明 |\r\n | ---- | ------------------------------------------------------------ |\r\n | -3 | 寻路失败,大于跟随距离,或者生物周围没有可行走位置,或者对正在寻路的飞行系生物使用 |\r\n | -2 | 寻路失败,生物没有寻路组件(指minecraft:navigation) |\r\n | -1 | 寻路失败,参数错误,或生物不存在 |\r\n | 0 | 寻路完成。到达设定的目标点 |\r\n | 1 | 寻路完成,但未到达目标点(可能由于maxIteration参数偏小) |\r\n | 2 | 寻路中断。中途遇到障碍物被阻碍 |\r\n | 3 | 寻路中断。被生物原版寻路行为覆盖,或寻路未结束时重复调用moveTo组件。
若生物的移速太低(真实速度小于0.3格每秒),也会被当成寻路被卡住,返回该错误码 |\r\n - 对于各种类型寻路的生物,还需要满足以下初始条件:\r\n 1. 陆地寻路,水陆寻路与爬墙寻路:需要满足以下任一条件:\r\n - 生物着地\r\n - 生物正在骑乘,并且骑乘物着地\r\n - 生物在液体中\r\n - 生物是凋零\r\n 2. 飞行寻路:需要满足以下任一条件:\r\n - 不在骑乘状态\r\n - 在液体中\r\n - 生物着地\r\n - json配置中的can_path_from_air属性为true\r\n - demo简介:\r\n 聊天栏输入walk/generic/climb/fly会原地生成一个使用对应navigation json组件的生物,然后跑到其他位置,再输入go,会将刚才生成的生物导航到玩家当前位置。\r\n 这4种示例生物的行为json可以在NavigationMod_behavior/entities目录查看。\r\n 4种示例生物的最大寻路距离都设置为了48格。", + "return": [], + "description": "寻路组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "from mod_log import logger as logger\r\ndef myCallback(entityId, result):\r\n if result in (-1,-2,-3):\r\n logger.info('[error] [SetMoveSetting] failed')\r\n elif result==0:\r\n logger.info('[info] [SetMoveSetting] success')\r\n elif result in (1,2,3):\r\n logger.info('[warn] [SetMoveSetting] terminated')\r\n\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateMoveTo(entityId)\r\ncomp.SetMoveSetting((x,y,z),2.0,200,myCallback)", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "寻路目标位置" - }, + }, { - "name": "speed", - "type": "float", + "type": "float", + "name": "speed", "description": "移动速度,指正常移动速度的倍率。如1.0表示正常速度,2.0表示两倍速" - }, + }, { - "name": "maxIteration", - "type": "int", + "type": "int", + "name": "maxIteration", "description": "寻路算法最大迭代次数 默认200" - }, + }, { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "寻路结束回调函数" } - ], - "return": [], - "example": "from mod_log import logger as logger\r\ndef myCallback(entityId, result):\r\n if result in (-1,-2,-3):\r\n logger.info('[error] [SetMoveSetting] failed')\r\n elif result==0:\r\n logger.info('[info] [SetMoveSetting] success')\r\n elif result in (1,2,3):\r\n logger.info('[warn] [SetMoveSetting] terminated')\r\n\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateMoveTo(entityId)\r\ncomp.SetMoveSetting((x,y,z),2.0,200,myCallback)" - }, + ], + "type": "api", + "side": "server", + "name": "SetMoveSetting" + }, { - "type": "api", - "name": "SetPersistence", - "method": "", - "description": "设置实体是否持久化。", - "remark": "- 游戏中,实体默认持久化,若设置不持久化,则实体会在区块卸载和退出存档时被删除,不会存档。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 游戏中,实体默认持久化,若设置不持久化,则实体会在区块卸载和退出存档时被删除,不会存档。", + "return": [], + "description": "设置实体是否持久化。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePersistence(entityId)\r\ncomp.SetPersistence(True)", "params": [ { - "name": "isPersistent", - "type": "bool", + "type": "bool", + "name": "isPersistent", "description": "True为设置实体持久化,False为设置实体不持久化。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePersistence(entityId)\r\ncomp.SetPersistence(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPersistence" + }, { - "type": "api", - "name": "SetRidePos", - "method": "", - "description": "设置生物骑乘位置", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "", + "return": [], + "description": "设置生物骑乘位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetRidePos(entityId,(1,1,1))", "params": [ { - "name": "tamedEntityId", - "type": "str", + "type": "str", + "name": "tamedEntityId", "description": "可骑乘生物id" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "骑乘时挂接点" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetRidePos(entityId,(1,1,1))" - }, + ], + "type": "api", + "side": "server", + "name": "SetRidePos" + }, { - "type": "api", - "name": "SetRiderRideEntity", - "method": "", - "description": "设置实体骑乘生物(或者船与矿车)", - "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型\r\n 当被控制的entity有多个位置时且开发者想要添加多个玩家时,第一个被添加的玩家会被引擎默认设置为控制者(riderIndex参数为默认值时)。\r\n - 当控制位为空,实体设置到控制位时,无论后座是否还有玩家,实体仍为控制者。\r\n - 未通过SetEntityLockRider锁定的实体,退出存档重进或有新的骑乘者时会遵循原版逻辑重置实体上的骑乘者。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 通常需要配合SetEntityRide、SetControl一起使用,需要被骑乘生物json中骑乘组件支持骑乘者的生物类型\r\n 当被控制的entity有多个位置时且开发者想要添加多个玩家时,第一个被添加的玩家会被引擎默认设置为控制者(riderIndex参数为默认值时)。\r\n - 当控制位为空,实体设置到控制位时,无论后座是否还有玩家,实体仍为控制者。\r\n - 未通过SetEntityLockRider锁定的实体,退出存档重进或有新的骑乘者时会遵循原版逻辑重置实体上的骑乘者。", + "return": [], + "description": "设置实体骑乘生物(或者船与矿车)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "# 骑上坐骑\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetRiderRideEntity(playerId,rideEntityId)", "params": [ { - "name": "riderId", - "type": "str", + "type": "str", + "name": "riderId", "description": "骑乘生物id" - }, + }, { - "name": "riddenEntityId", - "type": "str", + "type": "str", + "name": "riddenEntityId", "description": "被骑乘生物id。要求被骑乘生物的定义中具有minecraft:rideable组件,且组件中family_types含有可骑乘者的类型声明" - }, + }, { - "name": "riderIndex", - "type": "int", + "type": "int", + "name": "riderIndex", "description": "指定实体成为第n个骑乘者,范围为0~SeatCount-1,默认不指定" } - ], - "return": [], - "example": "# 骑上坐骑\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\ncomp.SetRiderRideEntity(playerId,rideEntityId)" - }, + ], + "type": "api", + "side": "server", + "name": "SetRiderRideEntity" + }, { - "type": "api", - "name": "SetStepHeight", - "method": "", - "description": "设置玩家前进非跳跃状态下能上的最大台阶高度, 默认值为0.5625,1的话表示能上一个台阶", - "remark": "- 为了避免因浮点数误差导致错误,设置的时候通常会增加1/16个方块大小,即0.0625。所以此处我们设置2.0625。游戏中默认值是0.5625,即半格高度。\r\n - 只对玩家生效,无法修改其它实体该属性\r\n - 修改后不影响跳跃逻辑及跳跃高度,并不会因此而跳到更高,因此在某些特定情况下,你可以走上方块但跳不上去。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 为了避免因浮点数误差导致错误,设置的时候通常会增加1/16个方块大小,即0.0625。所以此处我们设置2.0625。游戏中默认值是0.5625,即半格高度。\r\n - 只对玩家生效,无法修改其它实体该属性\r\n - 修改后不影响跳跃逻辑及跳跃高度,并不会因此而跳到更高,因此在某些特定情况下,你可以走上方块但跳不上去。", + "return": [], + "description": "设置玩家前进非跳跃状态下能上的最大台阶高度, 默认值为0.5625,1的话表示能上一个台阶", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\n#如果前面放置有两格高的方块,玩家按前进能直接上去,无须跳跃\r\ncomp.SetStepHeight(2.0625)", "params": [ { - "name": "stepHeight", - "type": "float", + "type": "float", + "name": "stepHeight", "description": "最大高度,需要大于0" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAttr(entityId)\r\n#如果前面放置有两格高的方块,玩家按前进能直接上去,无须跳跃\r\ncomp.SetStepHeight(2.0625)" - }, + ], + "type": "api", + "side": "server", + "name": "SetStepHeight" + }, { - "type": "api", - "name": "StartEntityMotion", - "method": "", - "description": "启动实体(不含玩家)身上的某个运动器", - "remark": "- 运动器控制的实体会无视原生的碰撞逻辑而穿透方块,若需停止,请自行监听碰撞事件OnMobHitBlockServerEvent然后使用StopEntityMotion停止", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 运动器控制的实体会无视原生的碰撞逻辑而穿透方块,若需停止,请自行监听碰撞事件OnMobHitBlockServerEvent然后使用StopEntityMotion停止", + "return": [], + "description": "启动实体(不含玩家)身上的某个运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotionComp.StartEntityMotion(mID)", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "要启动的某个运动器的ID" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotionComp.StartEntityMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "StartEntityMotion" + }, { - "type": "api", - "name": "StopEntityMotion", - "method": "", - "description": "停止实体(不含玩家)身上的某个运动器", - "remark": "- 调用该接口不会触发事件[EntityMotionStopServerEvent](../../事件/实体.md#EntityMotionStopServerEvent)。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 调用该接口不会触发事件[EntityMotionStopServerEvent](../../事件/实体.md#EntityMotionStopServerEvent)。", + "return": [], + "description": "停止实体(不含玩家)身上的某个运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotionComp.StopEntityMotion(mID)", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "要停止的某个运动器的ID" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotionComp.StopEntityMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "StopEntityMotion" + }, { - "type": "api", - "name": "StopEntityRiding", - "method": "", - "description": "强制骑乘者下坐骑。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\nsuccess = comp.StopEntityRiding()" - }, + "remark": "", + "return": [], + "description": "强制骑乘者下坐骑。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\nsuccess = comp.StopEntityRiding()", + "params": [], + "type": "api", + "side": "server", + "name": "StopEntityRiding" + }, { - "type": "api", - "name": "TriggerCustomEvent", - "method": "", - "description": "触发生物自定义事件", - "remark": "- 触发苦力怕爆炸\r\n 在苦力怕的entity json文件中`events`字段下增加如下事件,然后在mod中运行示例代码:\r\n ```json\r\n \"netease:custom_exploading\":{\r\n \"sequence\": [\r\n {\r\n \"filters\": {\r\n \"test\": \"has_component\",\r\n \"operator\": \"!=\",\r\n \"value\": \"minecraft:is_charged\"\r\n },\r\n \"add\": {\r\n \"component_groups\": [\r\n \"minecraft:forced_exploding\"\r\n ]\r\n }\r\n },\r\n {\r\n \"filters\": {\r\n \"test\": \"has_component\",\r\n \"value\": \"minecraft:is_charged\"\r\n },\r\n \"add\": {\r\n \"component_groups\": [\r\n \"minecraft:forced_charged_exploding\"\r\n ]\r\n }\r\n }\r\n ]\r\n }\r\n ```\r\n - 触发事件所添加或移除的component_groups,会在下一帧才真正生效。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "remark": "- 触发苦力怕爆炸\r\n 在苦力怕的entity json文件中`events`字段下增加如下事件,然后在mod中运行示例代码:\r\n ```json\r\n \"netease:custom_exploading\":{\r\n \"sequence\": [\r\n {\r\n \"filters\": {\r\n \"test\": \"has_component\",\r\n \"operator\": \"!=\",\r\n \"value\": \"minecraft:is_charged\"\r\n },\r\n \"add\": {\r\n \"component_groups\": [\r\n \"minecraft:forced_exploding\"\r\n ]\r\n }\r\n },\r\n {\r\n \"filters\": {\r\n \"test\": \"has_component\",\r\n \"value\": \"minecraft:is_charged\"\r\n },\r\n \"add\": {\r\n \"component_groups\": [\r\n \"minecraft:forced_charged_exploding\"\r\n ]\r\n }\r\n }\r\n ]\r\n }\r\n ```\r\n - 触发事件所添加或移除的component_groups,会在下一帧才真正生效。", + "return": [], + "description": "触发生物自定义事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\n#触发entity自定义event\r\neventName = \"netease:custom_exploading\"\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityEvent(entityId)\r\ncomp.TriggerCustomEvent(entityId,eventName)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物Id" - }, + }, { - "name": "eventName", - "type": "str", + "type": "str", + "name": "eventName", "description": "事件名称" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\n#触发entity自定义event\r\neventName = \"netease:custom_exploading\"\r\ncomp = serverApi.GetEngineCompFactory().CreateEntityEvent(entityId)\r\ncomp.TriggerCustomEvent(entityId,eventName)" - }, + ], + "type": "api", + "side": "server", + "name": "TriggerCustomEvent" + }, { - "type": "api", - "name": "GetAuxValue", - "method": "", - "description": "获取射出的弓箭或投掷出的药水的附加值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/附加值.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateAuxValue(entityId)\r\nauxValue = comp.GetAuxValue()" - }, + "remark": "", + "return": [], + "description": "获取射出的弓箭或投掷出的药水的附加值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/附加值.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateAuxValue(entityId)\r\nauxValue = comp.GetAuxValue()", + "params": [], + "type": "api", + "side": "client", + "name": "GetAuxValue" + }, { - "type": "api", - "name": "Disable", - "method": "", - "description": "关闭官方魔法指令功能。需要在ClientLoadAddonsFinishServerEvent事件中调用。仅在联机大厅中生效。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/魔法指令.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAiCommand(playerId)\r\ncomp.Disable()" - }, + "remark": "", + "return": [], + "description": "关闭官方魔法指令功能。需要在ClientLoadAddonsFinishServerEvent事件中调用。仅在联机大厅中生效。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/魔法指令.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAiCommand(playerId)\r\ncomp.Disable()", + "params": [], + "type": "api", + "side": "server", + "name": "Disable" + }, { - "type": "api", - "name": "Enable", - "method": "", - "description": "启用官方魔法指令功能。需要在ClientLoadAddonsFinishServerEvent事件中调用。仅在联机大厅中生效。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/实体/魔法指令.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAiCommand(playerId)\r\ncomp.Enable()" - }, + "remark": "", + "return": [], + "description": "启用官方魔法指令功能。需要在ClientLoadAddonsFinishServerEvent事件中调用。仅在联机大厅中生效。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/实体/魔法指令.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAiCommand(playerId)\r\ncomp.Enable()", + "params": [], + "type": "api", + "side": "server", + "name": "Enable" + }, { - "type": "event", - "name": "LobbyGetAchievementStorage", - "method": "", - "description": "获取成就节点的存储的数据。", - "remark": "- callback需要接受一个参数,\r\n 当请求**失败**时,参数返回None。\r\n 当请求**成功**时,参数为一个dict,包含返回码,最新数据等信息。\r\n - 当code为0时,表示设置成功。\r\n - 当code为5时,表示数据冲突。\r\n callback参数如下\r\n ```python\r\n {\r\n \"code\": 0,\r\n \"message\": \"正常返回\",\r\n \"details\": \"\",\r\n \"entity\": [\r\n {\r\n \"achievement_id\": \"Node2\",\r\n \"completed_at\": 1652950659,\r\n \"extra\": \"\",\r\n \"max_progress\": 10,\r\n \"progress\": 10,\r\n \"version\": 4\r\n }\r\n ]\r\n }\r\n ```\r\n - 可通过\"completed_at\"判断成就是否完成,非0为完成,请勿使用\"max_progress\"与\"progress\"比较判断是否完成", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/成就.md", + "remark": "- callback需要接受一个参数,\r\n 当请求**失败**时,参数返回None。\r\n 当请求**成功**时,参数为一个dict,包含返回码,最新数据等信息。\r\n - 当code为0时,表示设置成功。\r\n - 当code为5时,表示数据冲突。\r\n callback参数如下\r\n ```python\r\n {\r\n \"code\": 0,\r\n \"message\": \"正常返回\",\r\n \"details\": \"\",\r\n \"entity\": [\r\n {\r\n \"achievement_id\": \"Node2\",\r\n \"completed_at\": 1652950659,\r\n \"extra\": \"\",\r\n \"max_progress\": 10,\r\n \"progress\": 10,\r\n \"version\": 4\r\n }\r\n ]\r\n }\r\n ```\r\n - 可通过\"completed_at\"判断成就是否完成,非0为完成,请勿使用\"max_progress\"与\"progress\"比较判断是否完成", + "return": [], + "description": "获取成就节点的存储的数据。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/成就.md", + "example": "", "params": [ { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "请求回调函数" - }, + }, { - "name": "playerId", - "type": "int", + "type": "int", + "name": "playerId", "description": "玩家playerId" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "LobbyGetAchievementStorage" + }, { - "type": "event", - "name": "LobbySetAchievementStorage", - "method": "", - "description": "添加成就节点的进度。", - "remark": "- callback需要接受一个参数,\r\n 当请求**失败**时,参数返回None。\r\n 当请求**成功**时,参数为一个dict,包含返回码和设置进度前的数据信息。\r\n - 当code为0时,表示设置成功。\r\n - 当code为5时,表示数据冲突。此时系统不会存储此次上传的数据,当开发者通过callback处理完冲突后,必须返回一个Bool值。当callback的返回值为True,系统会自动再自动调用一次getExtra来获取最新的extra数据,并自动存储进度与extra。如果不想系统再自动调用,将callback返回值设置为False,系统将不会再进行一次进度存储\r\n callback参数如下\r\n ```python\r\n {\r\n \"code\": 5,\r\n \"message\": \"操作冲突\",\r\n \"details\": \"\",\r\n \"entity\": {\r\n \"completed_at\": 0,\r\n \"extra\": \"\",\r\n \"progress\": 1,\r\n \"version\": 1\r\n }\r\n }\r\n ```\r\n - 可通过\"completed_at\"判断成就是否完成,非0为完成,请勿使用\"max_progress\"与\"progress\"比较判断是否完成", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/成就.md", + "remark": "- callback需要接受一个参数,\r\n 当请求**失败**时,参数返回None。\r\n 当请求**成功**时,参数为一个dict,包含返回码和设置进度前的数据信息。\r\n - 当code为0时,表示设置成功。\r\n - 当code为5时,表示数据冲突。此时系统不会存储此次上传的数据,当开发者通过callback处理完冲突后,必须返回一个Bool值。当callback的返回值为True,系统会自动再自动调用一次getExtra来获取最新的extra数据,并自动存储进度与extra。如果不想系统再自动调用,将callback返回值设置为False,系统将不会再进行一次进度存储\r\n callback参数如下\r\n ```python\r\n {\r\n \"code\": 5,\r\n \"message\": \"操作冲突\",\r\n \"details\": \"\",\r\n \"entity\": {\r\n \"completed_at\": 0,\r\n \"extra\": \"\",\r\n \"progress\": 1,\r\n \"version\": 1\r\n }\r\n }\r\n ```\r\n - 可通过\"completed_at\"判断成就是否完成,非0为完成,请勿使用\"max_progress\"与\"progress\"比较判断是否完成", + "return": [], + "description": "添加成就节点的进度。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/成就.md", + "example": "", "params": [ { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "请求回调函数" - }, + }, { - "name": "playerId", - "type": "int", + "type": "int", + "name": "playerId", "description": "玩家playerId" - }, + }, { - "name": "nodeId", - "type": "str", + "type": "str", + "name": "nodeId", "description": "成就节点ID" - }, + }, { - "name": "delta", - "type": "int", + "type": "int", + "name": "delta", "description": "进度值的变化量(必须大于0)" - }, + }, { - "name": "getExtraData", - "type": "function", + "type": "function", + "name": "getExtraData", "description": "用于返回存储更新后的数据的函数,返回值必须为str类型,可选" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "LobbySetAchievementStorage" + }, { - "type": "event", - "name": "AddPickBlacklist", - "method": "", - "description": "添加使用camera组件(例如GetChosen接口、PickFacing接口)选取实体时的黑名单,即该实体不会被选取到", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "添加使用camera组件(例如GetChosen接口、PickFacing接口)选取实体时的黑名单,即该实体不会被选取到", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "AddPickBlacklist" + }, { - "type": "event", - "name": "ClearPickBlacklist", - "method": "", - "description": "清除使用camera组件(例如GetChosen接口、PickFacing接口)选取实体的黑名单", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "清除使用camera组件(例如GetChosen接口、PickFacing接口)选取实体的黑名单", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "ClearPickBlacklist" + }, { - "type": "event", - "name": "GetChosen", - "method": "", - "description": "获取屏幕点击位置的实体或方块信息,通常与GetEntityByCoordEvent配合使用", - "remark": "- 目前只有在第一人称视角才能准确获取", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 目前只有在第一人称视角才能准确获取", + "return": [], + "description": "获取屏幕点击位置的实体或方块信息,通常与GetEntityByCoordEvent配合使用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetChosen" + }, { - "type": "event", - "name": "GetChosenEntity", - "method": "", - "description": "获取屏幕点击位置的实体id,通常与GetEntityByCoordEvent配合使用", - "remark": "- 目前只有在第一人称视角才能准确获取", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 目前只有在第一人称视角才能准确获取", + "return": [], + "description": "获取屏幕点击位置的实体id,通常与GetEntityByCoordEvent配合使用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetChosenEntity" + }, { - "type": "event", - "name": "GetHoldTimeThresholdInMs", - "method": "", - "description": "获取长按判定时间,即按着屏幕多长时间会触发长按操作", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取长按判定时间,即按着屏幕多长时间会触发长按操作", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetHoldTimeThresholdInMs" + }, { - "type": "event", - "name": "GetInputVector", - "method": "", - "description": "获取方向键(移动轮盘)的输入", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取方向键(移动轮盘)的输入", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetInputVector" + }, { - "type": "event", - "name": "GetMousePosition", - "method": "", - "description": "获取鼠标位置", - "remark": "- 仅在PC有效果,非PC会返回None。仅在PushScreen时正常获取", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 仅在PC有效果,非PC会返回None。仅在PushScreen时正常获取", + "return": [], + "description": "获取鼠标位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetMousePosition" + }, { - "type": "event", - "name": "GetTouchPos", - "method": "", - "description": "获取点击的屏幕坐标。可以监听TapBeforeClientEvent或TapOrHoldReleaseClientEvent事件,调用本API获取点击坐标。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取点击的屏幕坐标。可以监听TapBeforeClientEvent或TapOrHoldReleaseClientEvent事件,调用本API获取点击坐标。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetTouchPos" + }, { - "type": "event", - "name": "IsCanAttack", - "method": "", - "description": "获取玩家是否响应攻击", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家是否响应攻击", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsCanAttack" + }, { - "type": "event", - "name": "IsCanChat", - "method": "", - "description": "获取玩家是否响应聊天按钮", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家是否响应聊天按钮", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsCanChat" + }, { - "type": "event", - "name": "IsCanDrag", - "method": "", - "description": "获取玩家是否响应屏幕拖动", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家是否响应屏幕拖动", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsCanDrag" + }, { - "type": "event", - "name": "IsCanInair", - "method": "", - "description": "获取玩家是否响应打上升下降按钮", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家是否响应打上升下降按钮", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsCanInair" + }, { - "type": "event", - "name": "IsCanJump", - "method": "", - "description": "获取玩家是否响应跳跃(以及在水中浮起)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家是否响应跳跃(以及在水中浮起)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsCanJump" + }, { - "type": "event", - "name": "IsCanMove", - "method": "", - "description": "获取玩家是否响应移动", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家是否响应移动", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsCanMove" + }, { - "type": "event", - "name": "IsCanOpenInv", - "method": "", - "description": "获取玩家是否响应打开背包按钮", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家是否响应打开背包按钮", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsCanOpenInv" + }, { - "type": "event", - "name": "IsCanPause", - "method": "", - "description": "获取玩家是否响应暂停按钮", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家是否响应暂停按钮", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsCanPause" + }, { - "type": "event", - "name": "IsCanPauseScreen", - "method": "", - "description": "获取玩家是否可以打开暂停界面", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家是否可以打开暂停界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsCanPauseScreen" + }, { - "type": "event", - "name": "IsCanPerspective", - "method": "", - "description": "获取玩家是否响应切换视角", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家是否响应切换视角", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsCanPerspective" + }, { - "type": "event", - "name": "IsCanScreenShot", - "method": "", - "description": "获取玩家是否响应截图按钮", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家是否响应截图按钮", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsCanScreenShot" + }, { - "type": "event", - "name": "IsCanWalkMode", - "method": "", - "description": "获取玩家是否响应切换行走模式", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取玩家是否响应切换行走模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsCanWalkMode" + }, { - "type": "event", - "name": "IsTouchWithMouse", - "method": "", - "description": "获取是否正在使用鼠标点击模拟触屏", - "remark": "- 该接口只适用于PC端", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 该接口只适用于PC端", + "return": [], + "description": "获取是否正在使用鼠标点击模拟触屏", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "IsTouchWithMouse" + }, { - "type": "event", - "name": "LockInputVector", - "method": "", - "description": "锁定本地玩家方向键(移动轮盘)的输入,可使本地玩家持续向指定方向前行,且不会再受玩家输入影响", - "remark": "- 传入的向量会被转化为单位向量,因此传入(10, 0)与传入(0.1, 0)效果相同", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "- 传入的向量会被转化为单位向量,因此传入(10, 0)与传入(0.1, 0)效果相同", + "return": [], + "description": "锁定本地玩家方向键(移动轮盘)的输入,可使本地玩家持续向指定方向前行,且不会再受玩家输入影响", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "inputVector", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "inputVector", "description": "输入向量,第一项控制向左的大小,第二项控制向前的大小。传入(0, 0)时玩家将会被强制固定在原地,不允许移动。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "LockInputVector" + }, { - "type": "event", - "name": "LockVerticalMove", - "method": "", - "description": "模拟上升或下降,调用后一直上升或下降", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "模拟上升或下降,调用后一直上升或下降", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "flag", - "type": "bool", + "type": "bool", + "name": "flag", "description": "True 上升, False 下降" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "LockVerticalMove" + }, { - "type": "event", - "name": "PickFacing", - "method": "", - "description": "获取准星选中的实体或者方块", - "remark": "- 选中目标为实体时,返回值为:\r\n ```python\r\n {\r\n \"type\": \"Entity\",\r\n \"entityId\": entityId,\r\n \"hitPosX\" : x, #精准碰撞点的x轴坐标,类型为float\r\n \"hitPosY\" : y, #精准碰撞点的y轴坐标,类型为float\r\n \"hitPosZ\" : z #精准碰撞点的z轴坐标,类型为float\r\n }\r\n ```\r\n - 选中目标为方块时,返回值为:\r\n ```python\r\n {\r\n \"type\": \"Block\",\r\n \"x\": x,\r\n \"y\": y,\r\n \"z\": z,\r\n \"face\": face,\r\n \"hitPosX\" : x, #精准碰撞点的x轴坐标,类型为float\r\n \"hitPosY\" : y, #精准碰撞点的y轴坐标,类型为float\r\n \"hitPosZ\" : z #精准碰撞点的z轴坐标,类型为float\r\n }\r\n ```\r\n - 没有选中目标时,返回值为:\r\n ```python\r\n {\r\n \"type\": \"None\"\r\n }\r\n ```\r\n - 备注:由于引擎限制,准星指向实体时候的hitPosXYZ依旧是实体脚底中心的坐标,而不是射线与碰撞箱实际的相交坐标。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 选中目标为实体时,返回值为:\r\n ```python\r\n {\r\n \"type\": \"Entity\",\r\n \"entityId\": entityId,\r\n \"hitPosX\" : x, #精准碰撞点的x轴坐标,类型为float\r\n \"hitPosY\" : y, #精准碰撞点的y轴坐标,类型为float\r\n \"hitPosZ\" : z #精准碰撞点的z轴坐标,类型为float\r\n }\r\n ```\r\n - 选中目标为方块时,返回值为:\r\n ```python\r\n {\r\n \"type\": \"Block\",\r\n \"x\": x,\r\n \"y\": y,\r\n \"z\": z,\r\n \"face\": face,\r\n \"hitPosX\" : x, #精准碰撞点的x轴坐标,类型为float\r\n \"hitPosY\" : y, #精准碰撞点的y轴坐标,类型为float\r\n \"hitPosZ\" : z #精准碰撞点的z轴坐标,类型为float\r\n }\r\n ```\r\n - 没有选中目标时,返回值为:\r\n ```python\r\n {\r\n \"type\": \"None\"\r\n }\r\n ```\r\n - 备注:由于引擎限制,准星指向实体时候的hitPosXYZ依旧是实体脚底中心的坐标,而不是射线与碰撞箱实际的相交坐标。", + "return": [], + "description": "获取准星选中的实体或者方块", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "PickFacing" + }, { - "type": "event", - "name": "SetCanAll", - "method": "", - "description": "同时设置SetCanMove,SetCanJump,SetCanAttack,SetCanWalkMode,SetCanPerspective,SetCanPause,SetCanChat,SetCanScreenShot,SetCanOpenInv,SetCanDrag,SetCanInair", - "remark": "- 要在其他属性设置之前设置,不然在all之前设置的会被覆盖掉", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "- 要在其他属性设置之前设置,不然在all之前设置的会被覆盖掉", + "return": [], + "description": "同时设置SetCanMove,SetCanJump,SetCanAttack,SetCanWalkMode,SetCanPerspective,SetCanPause,SetCanChat,SetCanScreenShot,SetCanOpenInv,SetCanDrag,SetCanInair", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "all", - "type": "bool", + "type": "bool", + "name": "all", "description": "True为全部响应" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanAll" + }, { - "type": "event", - "name": "SetCanAttack", - "method": "", - "description": "设置是否响应攻击", - "remark": "- 触屏模式下,设置SetCanAttack(False)后,将屏蔽点击效果。 <攻击实体,放置方块,开关门,拉动拉杆,点击有UI界面的方块(如工作台)> 将失效。注意,不屏蔽点击交互按钮(例如交易、骑乘等按钮),不屏蔽破坏方块。\r\n - PC的键鼠模式下,设置SetCanAttack(False)后, 将屏蔽鼠标左键效果。<攻击实体,破坏方块> 将失效。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "- 触屏模式下,设置SetCanAttack(False)后,将屏蔽点击效果。 <攻击实体,放置方块,开关门,拉动拉杆,点击有UI界面的方块(如工作台)> 将失效。注意,不屏蔽点击交互按钮(例如交易、骑乘等按钮),不屏蔽破坏方块。\r\n - PC的键鼠模式下,设置SetCanAttack(False)后, 将屏蔽鼠标左键效果。<攻击实体,破坏方块> 将失效。", + "return": [], + "description": "设置是否响应攻击", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "attack", - "type": "bool", + "type": "bool", + "name": "attack", "description": "True为可攻击" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanAttack" + }, { - "type": "event", - "name": "SetCanChat", - "method": "", - "description": "设置是否响应聊天按钮", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置是否响应聊天按钮", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "chat", - "type": "bool", + "type": "bool", + "name": "chat", "description": "True为可打开聊天页面" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanChat" + }, { - "type": "event", - "name": "SetCanDrag", - "method": "", - "description": "设置是否响应屏幕拖动", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置是否响应屏幕拖动", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "drag", - "type": "bool", + "type": "bool", + "name": "drag", "description": "True为可拖动屏幕" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanDrag" + }, { - "type": "event", - "name": "SetCanInair", - "method": "", - "description": "设置是否响应上升下降按钮(飞在空中时右下角的三个按钮)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置是否响应上升下降按钮(飞在空中时右下角的三个按钮)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "inair", - "type": "bool", + "type": "bool", + "name": "inair", "description": "True为可点击" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanInair" + }, { - "type": "event", - "name": "SetCanJump", - "method": "", - "description": "设置是否响应跳跃(以及在水中浮起)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置是否响应跳跃(以及在水中浮起)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "jump", - "type": "bool", + "type": "bool", + "name": "jump", "description": "True为可跳跃" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanJump" + }, { - "type": "event", - "name": "SetCanMove", - "method": "", - "description": "设置是否响应移动", - "remark": "- 与SetMoveLock的区别:调用SetCanMove会清除当前Input Vector,例如玩家一直按着前进键,调用SetCanMove(False)会立即停下来,调用SetMoveLock(True)则不会。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "- 与SetMoveLock的区别:调用SetCanMove会清除当前Input Vector,例如玩家一直按着前进键,调用SetCanMove(False)会立即停下来,调用SetMoveLock(True)则不会。", + "return": [], + "description": "设置是否响应移动", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "move", - "type": "bool", + "type": "bool", + "name": "move", "description": "True为可移动" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanMove" + }, { - "type": "event", - "name": "SetCanOpenInv", - "method": "", - "description": "设置是否响应打开背包按钮", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置是否响应打开背包按钮", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "open", - "type": "bool", + "type": "bool", + "name": "open", "description": "True为可打开背包" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanOpenInv" + }, { - "type": "event", - "name": "SetCanPause", - "method": "", - "description": "设置是否响应暂停按钮", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置是否响应暂停按钮", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "pause", - "type": "bool", + "type": "bool", + "name": "pause", "description": "True为可打开暂停页面" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanPause" + }, { - "type": "event", - "name": "SetCanPauseScreen", - "method": "", - "description": "设置是否可以打开暂停界面", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置是否可以打开暂停界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "pause", - "type": "bool", + "type": "bool", + "name": "pause", "description": "True为可打开暂停页面" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanPauseScreen" + }, { - "type": "event", - "name": "SetCanPerspective", - "method": "", - "description": "设置是否响应切换视角", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置是否响应切换视角", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "persp", - "type": "bool", + "type": "bool", + "name": "persp", "description": "True为可切换" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanPerspective" + }, { - "type": "event", - "name": "SetCanScreenShot", - "method": "", - "description": "设置是否响应截图按钮", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置是否响应截图按钮", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "shot", - "type": "bool", + "type": "bool", + "name": "shot", "description": "True为可截图" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanScreenShot" + }, { - "type": "event", - "name": "SetCanWalkMode", - "method": "", - "description": "设置是否响应切换行走模式", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置是否响应切换行走模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "walkmode", - "type": "bool", + "type": "bool", + "name": "walkmode", "description": "True为可切换" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCanWalkMode" + }, { - "type": "event", - "name": "SetControlMode", - "method": "", - "description": "设置控制模式", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置控制模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "mode", - "type": "int", + "type": "int", + "name": "mode", "description": "控制模式,0:摇杆并点击互动, 1:摇杆并瞄准十字线, 2:方向键并点击互动" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetControlMode" + }, { - "type": "event", - "name": "SetControlModeLock", - "method": "", - "description": "设置控制模式是否可以被改变", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置控制模式是否可以被改变", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "lock", - "type": "bool", + "type": "bool", + "name": "lock", "description": "true则控制模式锁定,无法打开对应设置界面,false则控制模式可以被改变" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetControlModeLock" + }, { - "type": "event", - "name": "SetDeviceVibrate", - "method": "", - "description": "设置设备震动", - "remark": "- 部分设备1分钟内累计震动时间过长会导致设置失败,请尽量不要设置过长的震动时间\r\n - 设置震动失败(函数返回False)的可能原因:当前已经处于震动状态、设备不支持震动等\r\n - 即使函数返回值为True,也有可能因为未正确判断设备是否支持震动、设备权限上禁止震动等原因未能真正震动", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "- 部分设备1分钟内累计震动时间过长会导致设置失败,请尽量不要设置过长的震动时间\r\n - 设置震动失败(函数返回False)的可能原因:当前已经处于震动状态、设备不支持震动等\r\n - 即使函数返回值为True,也有可能因为未正确判断设备是否支持震动、设备权限上禁止震动等原因未能真正震动", + "return": [], + "description": "设置设备震动", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "milliSeconds", - "type": "int", + "type": "int", + "name": "milliSeconds", "description": "震动时间(单位:毫秒),iOS设备该参数无效,无论传入多少均只震动一下,替代方案:可以通过高频调用实现长震动,如每秒调用本接口30次。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetDeviceVibrate" + }, { - "type": "event", - "name": "SetGyroSensorReportRate", - "method": "", - "description": "设置陀螺仪传感器(上报/触发)频率", - "remark": "- 注意: 设置的上报频率只是期望频率,由于硬件的实现,实际上的上报频率会比设置值高\r\n - 该接口只适用于移动端", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "- 注意: 设置的上报频率只是期望频率,由于硬件的实现,实际上的上报频率会比设置值高\r\n - 该接口只适用于移动端", + "return": [], + "description": "设置陀螺仪传感器(上报/触发)频率", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "reportRate", - "type": "int", + "type": "int", + "name": "reportRate", "description": "上报/触发频率,默认为1hz,范围为1hz - 200hz" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetGyroSensorReportRate" + }, { - "type": "event", - "name": "SetHoldTimeThreshold", - "method": "", - "description": "设置长按判定时间,即按着屏幕多长时间会触发长按操作", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置长按判定时间,即按着屏幕多长时间会触发长按操作", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "time", - "type": "int", + "type": "int", + "name": "time", "description": "时间,单位毫秒。默认为400" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetHoldTimeThreshold" + }, { - "type": "event", - "name": "SetMoveLock", - "method": "", - "description": "设置是否锁住移动。实际上为是否响应十字键与遥感的操作。", - "remark": "- 与SetCanMove的区别:调用SetCanMove会清除当前Input Vector,例如玩家一直按着前进键,调用SetCanMove(False)会立即停下来,调用SetMoveLock(True)则不会。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "- 与SetCanMove的区别:调用SetCanMove会清除当前Input Vector,例如玩家一直按着前进键,调用SetCanMove(False)会立即停下来,调用SetMoveLock(True)则不会。", + "return": [], + "description": "设置是否锁住移动。实际上为是否响应十字键与遥感的操作。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "movelock", - "type": "bool", + "type": "bool", + "name": "movelock", "description": "True为锁住" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetMoveLock" + }, { - "type": "event", - "name": "SetShowRideUI", - "method": "", - "description": "设置是否显示马匹的UI界面", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "设置是否显示马匹的UI界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "tamedEntityId", - "type": "str", + "type": "str", + "name": "tamedEntityId", "description": "可骑乘生物id" - }, + }, { - "name": "isShowUI", - "type": "bool", + "type": "bool", + "name": "isShowUI", "description": "是否显示UI" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "SetShowRideUI" + }, { - "type": "event", - "name": "SimulateTouchWithMouse", - "method": "", - "description": "模拟使用鼠标控制UI(PC F11快捷键)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "", + "return": [], + "description": "模拟使用鼠标控制UI(PC F11快捷键)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "touch", - "type": "bool", + "type": "bool", + "name": "touch", "description": "True:进入鼠标模式,False:退出鼠标模式" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SimulateTouchWithMouse" + }, { - "type": "event", - "name": "ToggleGyroSensor", - "method": "", - "description": "开启或关闭陀螺仪传感器采集", - "remark": "- 注意: 开启后需要重新设置一次上报频率\r\n - 该接口只适用于移动端", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "remark": "- 注意: 开启后需要重新设置一次上报频率\r\n - 该接口只适用于移动端", + "return": [], + "description": "开启或关闭陀螺仪传感器采集", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", "params": [ { - "name": "isOpen", - "type": "bool", + "type": "bool", + "name": "isOpen", "description": "True开启,False关闭,默认False" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ToggleGyroSensor" + }, { - "type": "event", - "name": "UnLockVerticalMove", - "method": "", - "description": "解除上升或下降状态", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "解除上升或下降状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "UnLockVerticalMove" + }, { - "type": "event", - "name": "UnlockInputVector", - "method": "", - "description": "解锁本地玩家方向键(移动轮盘)的输入", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "解锁本地玩家方向键(移动轮盘)的输入", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/控制.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "UnlockInputVector" + }, { - "type": "api", - "name": "GetSignBlockText", - "method": "", - "description": "获取告示牌(方块)的文本内容", - "remark": "- 当输入的坐标位置的方块不是告示牌的时候,返回None", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/告示牌.md", + "remark": "- 当输入的坐标位置的方块不是告示牌的时候,返回None", + "return": [], + "description": "获取告示牌(方块)的文本内容", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/告示牌.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\ntext = comp.GetSignBlockText(pos, dimensionId)\r\nprint \"GetSignBlockText text={}\".format(text)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "告示牌的位置坐标" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "告示牌所在维度" - }, + }, { - "name": "side", - "type": "int", + "type": "int", + "name": "side", "description": "设置 正/反 面的文本样式,0表示正面,1表示背面,默认为正面" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\ntext = comp.GetSignBlockText(pos, dimensionId)\r\nprint \"GetSignBlockText text={}\".format(text)" - }, + ], + "type": "api", + "side": "server", + "name": "GetSignBlockText" + }, { - "type": "api", - "name": "GetSignTextStyle", - "method": "", - "description": "获取告示牌的文本样式信息", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/告示牌.md", + "remark": "", + "return": [], + "description": "获取告示牌的文本样式信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/告示牌.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.GetSignTextStyle((x, y, z), 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" - }, + }, { - "name": "side", - "type": "int", + "type": "int", + "name": "side", "description": "告示牌正/背面,0表示正面,1表示背面,默认为正面" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.GetSignTextStyle((x, y, z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetSignTextStyle" + }, { - "type": "api", - "name": "SetSignBlockText", - "method": "", - "description": "设置告示牌(方块)的文本内容", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/告示牌.md", + "remark": "", + "return": [], + "description": "设置告示牌(方块)的文本内容", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/告示牌.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\nsuc = comp.SetSignBlockText(pos, \"文本内容\", dimensionId)\r\nprint \"SetSignBlockText suc={}\".format(suc)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "告示牌的位置坐标" - }, + }, { - "name": "text", - "type": "str", + "type": "str", + "name": "text", "description": "想要设置的文本内容" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "告示牌所在维度" - }, + }, { - "name": "side", - "type": "int", + "type": "int", + "name": "side", "description": "设置 正/反 面的文本样式,0表示正面,1表示背面,默认为正面" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\nsuc = comp.SetSignBlockText(pos, \"文本内容\", dimensionId)\r\nprint \"SetSignBlockText suc={}\".format(suc)" - }, + ], + "type": "api", + "side": "server", + "name": "SetSignBlockText" + }, { - "type": "api", - "name": "SetSignTextStyle", - "method": "", - "description": "设置告示牌的文本样式", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/告示牌.md", + "remark": "", + "return": [], + "description": "设置告示牌的文本样式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/告示牌.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.SetSignTextStyle((x, y, z), 0, (0, 1, 0, 0.5), True)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" - }, + }, { - "name": "color", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "color", "description": "颜色通道值(r, g, b, a)" - }, + }, { - "name": "lighting", - "type": "bool", + "type": "bool", + "name": "lighting", "description": "是否发光,即是否显示被发光墨囊染色后的效果" - }, + }, { - "name": "side", - "type": "int", + "type": "int", + "name": "side", "description": "设置 正/反 面的文本样式,0表示正面,1表示背面,默认为正面" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.SetSignTextStyle((x, y, z), 0, (0, 1, 0, 0.5), True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetSignTextStyle" + }, { - "type": "api", - "name": "GetBrewingStandSlotItem", - "method": "", - "description": "获取酿造台指定槽位物品", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "", + "return": [], + "description": "获取酿造台指定槽位物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetBrewingStandSlotItem(serverApi.GetMinecraftEnum().BrewingStandSlotType.SLOT_FUEL, (x, y, z), 0)", "params": [ { - "name": "slot", - "type": "int", + "type": "int", + "name": "slot", "description": "槽位,详见枚举[酿造台槽位](../../枚举值/BrewingStandSlotType.md)" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "容器位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetBrewingStandSlotItem(serverApi.GetMinecraftEnum().BrewingStandSlotType.SLOT_FUEL, (x, y, z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetBrewingStandSlotItem" + }, { - "type": "api", - "name": "GetChestBoxSize", - "method": "", - "description": "获取箱子容量大小", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "", + "return": [], + "description": "获取箱子容量大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChestBlock(levelId)\r\ncomp.GetChestBoxSize(None, (x, y, z), 0)", "params": [ { - "name": "playerId", - "type": "None", + "type": "None", + "name": "playerId", "description": "该参数已废弃" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "箱子位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "箱子所在维度,可获取对应维度的常加载区块内箱子容量" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChestBlock(levelId)\r\ncomp.GetChestBoxSize(None, (x, y, z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetChestBoxSize" + }, { - "type": "api", - "name": "GetChestPairedPosition", - "method": "", - "description": "获取与箱子A合并成一个大箱子的箱子B的坐标", - "remark": "- 如果dimensionId不传或传入负值,该接口使用创建组件时的playerId来定位具体维度,且仅可获取玩家附近的方块,若方块位置离玩家太远,可能无法获取到正确的返回信息。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "- 如果dimensionId不传或传入负值,该接口使用创建组件时的playerId来定位具体维度,且仅可获取玩家附近的方块,若方块位置离玩家太远,可能无法获取到正确的返回信息。", + "return": [], + "description": "获取与箱子A合并成一个大箱子的箱子B的坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\notherPos = comp.GetChestPairedPosition(pos, dimensionId)\r\nif otherPos:\r\n print \"GetChestPairedPosition success pos=%s otherPos=%s\" % (str(pos), str(otherPos))\r\nelse:\r\n print \"GetChestPairedPosition failed pos=%s\" % (str(pos), )", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "箱子A的位置坐标" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "箱子A所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\notherPos = comp.GetChestPairedPosition(pos, dimensionId)\r\nif otherPos:\r\n print \"GetChestPairedPosition success pos=%s otherPos=%s\" % (str(pos), str(otherPos))\r\nelse:\r\n print \"GetChestPairedPosition failed pos=%s\" % (str(pos), )" - }, + ], + "type": "api", + "side": "server", + "name": "GetChestPairedPosition" + }, { - "type": "api", - "name": "GetContainerItem", - "method": "", - "description": "获取容器内的物品", - "remark": "- 容器的具体类型包括:箱子,陷阱箱,潜影盒,漏斗,木桶,投掷器,发射器\r\n - 此接口不支持末影箱。对应的末影箱接口请参考 [GetEnderChestItem](#getenderchestitem)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "- 容器的具体类型包括:箱子,陷阱箱,潜影盒,漏斗,木桶,投掷器,发射器\r\n - 此接口不支持末影箱。对应的末影箱接口请参考 [GetEnderChestItem](#getenderchestitem)", + "return": [], + "description": "获取容器内的物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(levelId)\r\ncomp.GetContainerItem((x,y,z), 0, 2)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "容器位置" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "容器槽位" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" - }, + }, { - "name": "getUserData", - "type": "bool", + "type": "bool", + "name": "getUserData", "description": "是否获取userData,默认为False" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(levelId)\r\ncomp.GetContainerItem((x,y,z), 0, 2)" - }, + ], + "type": "api", + "side": "server", + "name": "GetContainerItem" + }, { - "type": "api", - "name": "GetContainerSize", - "method": "", - "description": "获取容器容量大小", - "remark": "- 此接口不支持末影箱,因为末影箱的size固定为27。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "- 此接口不支持末影箱,因为末影箱的size固定为27。", + "return": [], + "description": "获取容器容量大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(levelId)\r\ncomp.GetContainerSize((x, y, z), 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "箱子位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "容器所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(levelId)\r\ncomp.GetContainerSize((x, y, z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetContainerSize" + }, { - "type": "api", - "name": "GetEnderChestItem", - "method": "", - "description": "获取末影箱内的物品", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "", + "return": [], + "description": "获取末影箱内的物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetEnderChestItem(playerId, 0)", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "容器槽位" - }, + }, { - "name": "getUserData", - "type": "bool", + "type": "bool", + "name": "getUserData", "description": "是否获取userData,默认为False" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetEnderChestItem(playerId, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetEnderChestItem" + }, { - "type": "api", - "name": "GetInputSlotItem", - "method": "", - "description": "获取熔炉输入栏物品, 支持使用下面参数清空特定槽位:itemDict为空,为{}, 或itemName为minecraft:air,或者count为0", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "", + "return": [], + "description": "获取熔炉输入栏物品, 支持使用下面参数清空特定槽位:itemDict为空,为{}, 或itemName为minecraft:air,或者count为0", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(levelId)\r\nitemName = comp.GetInputSlotItem((x, y, z), 1)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "容器位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(levelId)\r\nitemName = comp.GetInputSlotItem((x, y, z), 1)" - }, + ], + "type": "api", + "side": "server", + "name": "GetInputSlotItem" + }, { - "type": "api", - "name": "GetOpenContainerItem", - "method": "", - "description": "获取开放容器的物品", - "remark": "- 需要在事件[CraftItemOutputChangeServerEvent](../../事件/物品.html#CraftItemOutputChangeServerEvent)的监听函数里面才能获取正确的结果\r\n - 开放容器为临时容器,用来保存交互过程中的物品,如铁砧输入位,砂轮输入位", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "- 需要在事件[CraftItemOutputChangeServerEvent](../../事件/物品.html#CraftItemOutputChangeServerEvent)的监听函数里面才能获取正确的结果\r\n - 开放容器为临时容器,用来保存交互过程中的物品,如铁砧输入位,砂轮输入位", + "return": [], + "description": "获取开放容器的物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetOpenContainerItem(playerId,serverApi.GetMinecraftEnum().OpenContainerId.AnvilInputContainer, True)", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "containerId", - "type": "int", + "type": "int", + "name": "containerId", "description": "[开放容器Id枚举](../../枚举值/OpenContainerId.md)" - }, + }, { - "name": "getUserData", - "type": "bool", + "type": "bool", + "name": "getUserData", "description": "是否获取userData,默认为False" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetOpenContainerItem(playerId,serverApi.GetMinecraftEnum().OpenContainerId.AnvilInputContainer, True)" - }, + ], + "type": "api", + "side": "server", + "name": "GetOpenContainerItem" + }, { - "type": "api", - "name": "GetOutputSlotItem", - "method": "", - "description": "获取熔炉输出栏物品", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "", + "return": [], + "description": "获取熔炉输出栏物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(levelId)\r\nitemName = comp.GetOutputSlotItem((x, y, z), 1)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "容器位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(levelId)\r\nitemName = comp.GetOutputSlotItem((x, y, z), 1)" - }, + ], + "type": "api", + "side": "server", + "name": "GetOutputSlotItem" + }, { - "type": "api", - "name": "GetPlayerUIItem", - "method": "", - "description": "获取合成容器的物品", - "remark": "- 合成容器包括工作台、铁砧、附魔台、织布机、砂轮、切石机、制图台、锻造台。\r\n - 所有合成容器槽位共享,不会根据不同容器重新排列", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "- 合成容器包括工作台、铁砧、附魔台、织布机、砂轮、切石机、制图台、锻造台。\r\n - 所有合成容器槽位共享,不会根据不同容器重新排列", + "return": [], + "description": "获取合成容器的物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetPlayerUIItem(playerId, slot, True)", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "slot", - "type": "int", + "type": "int", + "name": "slot", "description": "容器槽位,含义见:[容器类型枚举](../../枚举值/PlayerUISlot.md)" - }, + }, { - "name": "getUserData", - "type": "bool", + "type": "bool", + "name": "getUserData", "description": "是否获取userData,默认为False" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetPlayerUIItem(playerId, slot, True)" - }, + ], + "type": "api", + "side": "server", + "name": "GetPlayerUIItem" + }, { - "type": "api", - "name": "SetBrewingStandSlotItem", - "method": "", - "description": "设置酿造台指定槽位物品", - "remark": "- 该接口仅可设置酿造台支持放入的物品", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "- 该接口仅可设置酿造台支持放入的物品", + "return": [], + "description": "设置酿造台指定槽位物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\nitemDict = {\"itemName\": \"minecraft:blaze_powder\", \"auxValue\": 0, \"count\": 64}\r\ncomp.SetBrewingStandSlotItem(itemDict, serverApi.GetMinecraftEnum().BrewingStandSlotType.SLOT_FUEL, (x, y, z), 0)", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品字典信息, 包含三种key: itemName, auxValue, count" - }, + }, { - "name": "slot", - "type": "int", + "type": "int", + "name": "slot", "description": "槽位,详见枚举[酿造台槽位](../../枚举值/BrewingStandSlotType.md)" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "容器位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\nitemDict = {\"itemName\": \"minecraft:blaze_powder\", \"auxValue\": 0, \"count\": 64}\r\ncomp.SetBrewingStandSlotItem(itemDict, serverApi.GetMinecraftEnum().BrewingStandSlotType.SLOT_FUEL, (x, y, z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBrewingStandSlotItem" + }, { - "type": "api", - "name": "SetChestBoxItemExchange", - "method": "", - "description": "交换箱子里物品的槽位", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "", + "return": [], + "description": "交换箱子里物品的槽位", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChestBlock(playerId)\r\ncomp.SetChestBoxItemExchange(playerId, (x,y,z), 0, 1)", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "箱子位置" - }, + }, { - "name": "slotPos1", - "type": "int", + "type": "int", + "name": "slotPos1", "description": "箱子槽位1" - }, + }, { - "name": "slotPos2", - "type": "int", + "type": "int", + "name": "slotPos2", "description": "箱子槽位2" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChestBlock(playerId)\r\ncomp.SetChestBoxItemExchange(playerId, (x,y,z), 0, 1)" - }, + ], + "type": "api", + "side": "server", + "name": "SetChestBoxItemExchange" + }, { - "type": "api", - "name": "SetChestBoxItemNum", - "method": "", - "description": "设置箱子槽位物品数目", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "", + "return": [], + "description": "设置箱子槽位物品数目", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChestBlock(levelId)\r\ncomp.SetChestBoxItemNum(None, (x,y,z), 0, 10, 0)", "params": [ { - "name": "playerId", - "type": "None", + "type": "None", + "name": "playerId", "description": "该参数已废弃" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "箱子位置" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "箱子槽位" - }, + }, { - "name": "num", - "type": "int", + "type": "int", + "name": "num", "description": "物品数目" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度,可在对应维度的常加载区块设置方块" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateChestBlock(levelId)\r\ncomp.SetChestBoxItemNum(None, (x,y,z), 0, 10, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetChestBoxItemNum" + }, { - "type": "api", - "name": "SetInputSlotItem", - "method": "", - "description": "设置熔炉输入栏物品", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "", + "return": [], + "description": "设置熔炉输入栏物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.SetInputSlotItem({\"itemName\": \"minecraft:iron_ore\", \"auxValue\": 0, \"count\": 1}, (x, y, z), 1)", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品字典信息, 包含三种key: itemName, auxValue, count" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "容器位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.SetInputSlotItem({\"itemName\": \"minecraft:iron_ore\", \"auxValue\": 0, \"count\": 1}, (x, y, z), 1)" - }, + ], + "type": "api", + "side": "server", + "name": "SetInputSlotItem" + }, { - "type": "api", - "name": "SetPlayerUIItem", - "method": "", - "description": "设置合成容器的物品", - "remark": "- 合成容器包括工作台、铁砧、附魔台、织布机、砂轮、切石机、制图台、锻造台。\r\n - 如果原槽位有物品,则会将原有物品放入玩家背包。如果玩家背包已满,则会在世界中玩家当前的位置生成对应的物品掉落物。\r\n - 注意,所有合成容器槽位共享,不会根据不同容器重新排列,没有打开容器或者打开了别的容器,该接口会返回False。\r\n - 下面情况视为清空特定槽位:itemDict为None,为{}, 或itemName为minecraft:air,或者count为0,同时needBack参数为False\r\n - 由于创造输出物品生成位比较特殊,该接口已经屏蔽了slot = 50的情况,即无法设置创造输出位的物品。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "- 合成容器包括工作台、铁砧、附魔台、织布机、砂轮、切石机、制图台、锻造台。\r\n - 如果原槽位有物品,则会将原有物品放入玩家背包。如果玩家背包已满,则会在世界中玩家当前的位置生成对应的物品掉落物。\r\n - 注意,所有合成容器槽位共享,不会根据不同容器重新排列,没有打开容器或者打开了别的容器,该接口会返回False。\r\n - 下面情况视为清空特定槽位:itemDict为None,为{}, 或itemName为minecraft:air,或者count为0,同时needBack参数为False\r\n - 由于创造输出物品生成位比较特殊,该接口已经屏蔽了slot = 50的情况,即无法设置创造输出位的物品。", + "return": [], + "description": "设置合成容器的物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1, # 可填入0达到删除某槽位物品的效果\r\n 'auxValue': 0,\r\n}\r\ncomp.SetPlayerUIItem(playerId, slot, itemDict)\r\n# 也可以直接使用 comp.SetPlayerUIItem(playerId, slot, None, False) 来清空物品", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "slot", - "type": "int", + "type": "int", + "name": "slot", "description": "容器槽位,含义见:[容器类型枚举](../../枚举值/PlayerUISlot.md)" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典,没有物品则返回None" - }, + }, { - "name": "needBack", - "type": "bool", + "type": "bool", + "name": "needBack", "description": "是否将容器槽位的已有物品放回至玩家背包中,默认为True。设置为False时,则会直接用itemDict中的物品覆盖容器槽位的已有物品。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1, # 可填入0达到删除某槽位物品的效果\r\n 'auxValue': 0,\r\n}\r\ncomp.SetPlayerUIItem(playerId, slot, itemDict)\r\n# 也可以直接使用 comp.SetPlayerUIItem(playerId, slot, None, False) 来清空物品" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerUIItem" + }, { - "type": "api", - "name": "SpawnItemToContainer", - "method": "", - "description": "生成物品到容器方块的物品栏", - "remark": "- 此接口不支持末影箱。对应的末影箱接口请参考 [SpawnItemToEnderChest](#spawnitemtoenderchest)\r\n - 下面情况视为清空特定槽位:itemDict为空,为{}, 或itemName为minecraft:air,或者count为0\r\n - 目前该接口支持的容器类型方块:箱子、潜影盒、漏斗、木桶、投掷器、发射器", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "- 此接口不支持末影箱。对应的末影箱接口请参考 [SpawnItemToEnderChest](#spawnitemtoenderchest)\r\n - 下面情况视为清空特定槽位:itemDict为空,为{}, 或itemName为minecraft:air,或者count为0\r\n - 目前该接口支持的容器类型方块:箱子、潜影盒、漏斗、木桶、投掷器、发射器", + "return": [], + "description": "生成物品到容器方块的物品栏", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1, # 可填入0达到删除某槽位物品的效果\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { },\r\n}\r\n# 生成物品到容器的0号槽位,容器位于维度0,坐标为(x,y,z)\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(levelId)\r\ncomp.SpawnItemToContainer(itemDict, 0, (x,y,z), 0)", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "箱子槽位" - }, + }, { - "name": "blockPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "blockPos", "description": "箱子位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "容器所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1, # 可填入0达到删除某槽位物品的效果\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { },\r\n}\r\n# 生成物品到容器的0号槽位,容器位于维度0,坐标为(x,y,z)\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(levelId)\r\ncomp.SpawnItemToContainer(itemDict, 0, (x,y,z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SpawnItemToContainer" + }, { - "type": "api", - "name": "SpawnItemToEnderChest", - "method": "", - "description": "生成物品到末影箱", - "remark": "- 下面情况视为清空特定槽位:itemDict为空,为{}, 或itemName为minecraft:air,或者count为0", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "remark": "- 下面情况视为清空特定槽位:itemDict为空,为{}, 或itemName为minecraft:air,或者count为0", + "return": [], + "description": "生成物品到末影箱", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/容器.md", + "example": "import mod.server.extraServerApi as serverApi\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { },\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.SpawnItemToEnderChest(itemDict, 0)", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "末影箱槽位" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { },\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.SpawnItemToEnderChest(itemDict, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SpawnItemToEnderChest" + }, { - "type": "api", - "name": "GetBlockBasicInfo", - "method": "", - "description": "获取方块基本信息", - "remark": "- 基本信息字典中部分字段只在自定义方块时加上指定组件才会取到数据,具体见方块基本信息字典\r\n - 历史原因,方块基本信息字典中的tier中的digger值类型为int。shovel(铲)为 0, pickaxe(镐)为 1, hatchet(斧)为 2, hoe(锄)为 3。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/属性.md", + "remark": "- 基本信息字典中部分字段只在自定义方块时加上指定组件才会取到数据,具体见方块基本信息字典\r\n - 历史原因,方块基本信息字典中的tier中的digger值类型为int。shovel(铲)为 0, pickaxe(镐)为 1, hatchet(斧)为 2, hoe(锄)为 3。", + "return": [], + "description": "获取方块基本信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nblockDict = comp.GetBlockBasicInfo(\"minecraft:stone\")", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块identifier" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nblockDict = comp.GetBlockBasicInfo(\"minecraft:stone\")" - }, + ], + "type": "api", + "side": "server", + "name": "GetBlockBasicInfo" + }, { - "type": "api", - "name": "GetBlockTags", - "method": "", - "description": "获取方块在tags:*中定义的tags列表", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/属性.md", + "remark": "", + "return": [], + "description": "获取方块在tags:*中定义的tags列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.GetBlockTags(\"minecraft:stone\")", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块identifierge" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.GetBlockTags(\"minecraft:stone\")" - }, + ], + "type": "api", + "side": "server", + "name": "GetBlockTags" + }, { - "type": "api", - "name": "GetLoadBlocks", - "method": "", - "description": "获取已经加载的方块id", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nsuc = comp.GetLoadBlocks()" - }, + "remark": "", + "return": [], + "description": "获取已经加载的方块id", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nsuc = comp.GetLoadBlocks()", + "params": [], + "type": "api", + "side": "server", + "name": "GetLoadBlocks" + }, { - "type": "api", - "name": "SetBlockBasicInfo", - "method": "", - "description": "设置方块基本信息", - "remark": "- 目前本接口支持的属性有 destroyTime:硬度;explosionResistance:爆炸抗性;loot:掉落属性;tier:挖掘属性;solid:是否实心;当方块json配置里有对应的组件才能修改", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/属性.md", + "remark": "- 目前本接口支持的属性有 destroyTime:硬度;explosionResistance:爆炸抗性;loot:掉落属性;tier:挖掘属性;solid:是否实心;当方块json配置里有对应的组件才能修改", + "return": [], + "description": "设置方块基本信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nblockDict = comp.SetBlockBasicInfo(\"minecraft:stone\", {\"blockLightEmission\":1,\r\n\"blockLightAbsorption\":1,\r\n\"solid\":False,\r\n\"tier\":{\"level\":3}})", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块identifier" - }, + }, { - "name": "infoDict", - "type": "dict", + "type": "dict", + "name": "infoDict", "description": "方块的方块基本信息字典" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块附加值,默认是0" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nblockDict = comp.SetBlockBasicInfo(\"minecraft:stone\", {\"blockLightEmission\":1,\r\n\"blockLightAbsorption\":1,\r\n\"solid\":False,\r\n\"tier\":{\"level\":3}})" - }, + ], + "type": "api", + "side": "server", + "name": "SetBlockBasicInfo" + }, { - "type": "api", - "name": "SetChestLootTable", - "method": "", - "description": "设置箱子战利品表", - "remark": "- 仅支持未打开过的箱子,若箱子已经打开过,则设置失败\r\n - 维度需要已经加载。如有玩家在相应维度上,则算维度已加载,若完全没玩家在对应维度上,则维度未加载\r\n - 末影箱仍是箱子的一种,但是末影箱本身并不直接存储物品。因此虽然设置战利品表返回成功,实际在打开末影箱时,并不会用到战利品表!", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/属性.md", + "remark": "- 仅支持未打开过的箱子,若箱子已经打开过,则设置失败\r\n - 维度需要已经加载。如有玩家在相应维度上,则算维度已加载,若完全没玩家在对应维度上,则维度未加载\r\n - 末影箱仍是箱子的一种,但是末影箱本身并不直接存储物品。因此虽然设置战利品表返回成功,实际在打开末影箱时,并不会用到战利品表!", + "return": [], + "description": "设置箱子战利品表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nsuc = comp.SetChestLootTable(blockPos, dimensionId, lootTable)", "params": [ { - "name": "blockPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "blockPos", "description": "方块的坐标" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在的维度" - }, + }, { - "name": "lootTable", - "type": "str", + "type": "str", + "name": "lootTable", "description": "战利品表位置字符串,如\"loot_tables/entities/zombie.json\"" - }, + }, { - "name": "isIgnoreSpilt", - "type": "bool", + "type": "bool", + "name": "isIgnoreSpilt", "description": "是否屏蔽随机分堆,默认为False" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nsuc = comp.SetChestLootTable(blockPos, dimensionId, lootTable)" - }, + ], + "type": "api", + "side": "server", + "name": "SetChestLootTable" + }, { - "type": "api", - "name": "GetBedColor", - "method": "", - "description": "获取床(方块)的颜色", - "remark": "- 当输入的坐标位置的方块不是床的时候,返回-1", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/床.md", + "remark": "- 当输入的坐标位置的方块不是床的时候,返回-1", + "return": [], + "description": "获取床(方块)的颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/床.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\ncolor = comp.GetBedColor(pos, dimensionId)\r\nprint \"GetBedColor color={}\".format(color)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "床的位置坐标(床占地两格,任意一个格子都可以)" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "床所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\ncolor = comp.GetBedColor(pos, dimensionId)\r\nprint \"GetBedColor color={}\".format(color)" - }, + ], + "type": "api", + "side": "server", + "name": "GetBedColor" + }, { - "type": "api", - "name": "SetBedColor", - "method": "", - "description": "设置床(方块)的颜色", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/床.md", + "remark": "", + "return": [], + "description": "设置床(方块)的颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/床.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\nsuc = comp.SetBedColor(pos, serverApi.GetMinecraftEnum().ItemColor.Blue, dimensionId)\r\nprint \"SetBedColor suc={}\".format(suc)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "床的位置坐标(床占地两格,任意一个格子都可以)" - }, + }, { - "name": "color", - "type": "int", + "type": "int", + "name": "color", "description": "[ItemColor枚举](../../枚举值/ItemColor.md)" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "床所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\nsuc = comp.SetBedColor(pos, serverApi.GetMinecraftEnum().ItemColor.Blue, dimensionId)\r\nprint \"SetBedColor suc={}\".format(suc)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBedColor" + }, { - "type": "api", - "name": "CombineBlockBetweenPosToGeometry", - "method": "", - "description": "根据输入的两个位置,搜索这两个位置之间的所有方块,并将这些方块合并和转换为能用于实体的几何体模型。", - "remark": "- 如果之前已经拥有一个相同名称几何体模型,合并出来的新模型会覆盖之前的模型。因此需要注意,每次合并不同外观的模型时geometryName都应该互不相同。\r\n - 如果每次合并的模型都是外观相同的模型,则我们建议使用相同的geometryName,以节省存储模型的内存。当然,最优的情况下是尽量复用之前已经创建的方块几何体模型,而不是重复合并新的模型。\r\n - 目前尚不支持的方块类型有 (后续版本将陆续支持):\r\n 1. 自定义方块实体外观(见开发指南-玩法开发-自定义游戏内容-自定义方块-自定义方块实体外观)\r\n 2. 微缩方块(见开发指南-玩法开发-自定义游戏内容-微缩方块)\r\n 3. 火方块,水方块\r\n 4. 花盆\r\n 5. 钟\r\n 6. 末地传送门,末地折跃门\r\n 7. 屏障\r\n 8. 潮涌核心\r\n 9. 旗帜", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "remark": "- 如果之前已经拥有一个相同名称几何体模型,合并出来的新模型会覆盖之前的模型。因此需要注意,每次合并不同外观的模型时geometryName都应该互不相同。\r\n - 如果每次合并的模型都是外观相同的模型,则我们建议使用相同的geometryName,以节省存储模型的内存。当然,最优的情况下是尽量复用之前已经创建的方块几何体模型,而不是重复合并新的模型。\r\n - 目前尚不支持的方块类型有 (后续版本将陆续支持):\r\n 1. 自定义方块实体外观(见开发指南-玩法开发-自定义游戏内容-自定义方块-自定义方块实体外观)\r\n 2. 微缩方块(见开发指南-玩法开发-自定义游戏内容-微缩方块)\r\n 3. 火方块,水方块\r\n 4. 花盆\r\n 5. 钟\r\n 6. 末地传送门,末地折跃门\r\n 7. 屏障\r\n 8. 潮涌核心\r\n 9. 旗帜", + "return": [], + "description": "根据输入的两个位置,搜索这两个位置之间的所有方块,并将这些方块合并和转换为能用于实体的几何体模型。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\npalette = blockGeometryComp.CombineBlockBetweenPosToGeometry((200,64,200),(201,65,202),\"my_block_geometry\")", "params": [ { - "name": "startPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "startPos", "description": "起始位置" - }, + }, { - "name": "endPos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "endPos", "description": "终点位置" - }, + }, { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id" - }, + }, { - "name": "unsupportedMode", - "type": "int", + "type": "int", + "name": "unsupportedMode", "description": "不支持方块处理方式枚举,可选参数,可输入的值为0、1。默认的值为0。如果方块调色板中有不支持转变为几何体的方块的话,将按以下方式处理:0:跳过不支持的方块继续生成。1:停止生成" - }, + }, { - "name": "useStructureVoid", - "type": "bool", + "type": "bool", + "name": "useStructureVoid", "description": "是否使用结构空位代替空气方块,可选参数,默认值为False。True表示使用结构空位,False表示不使用结构空位。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\npalette = blockGeometryComp.CombineBlockBetweenPosToGeometry((200,64,200),(201,65,202),\"my_block_geometry\")" - }, + ], + "type": "api", + "side": "client", + "name": "CombineBlockBetweenPosToGeometry" + }, { - "type": "api", - "name": "CombineBlockFromPosListToGeometry", - "method": "", - "description": "根据输入的方块位置列表,搜索这些位置的所有方块,并将这些方块合并和转换为能用于实体的几何体模型。", - "remark": "- 如果之前已经拥有一个相同名称几何体模型,合并出来的新模型会覆盖之前的模型。因此需要注意,每次合并不同外观的模型时geometryName都应该互不相同。\r\n - 如果每次合并的模型都是外观相同的模型,则我们建议使用相同的geometryName,以节省存储模型的内存。当然,最优的情况下是尽量复用之前已经创建的方块几何体模型,而不是重复合并新的模型。\r\n - 目前尚不支持的方块类型有 (后续版本将陆续支持):\r\n 1. 自定义方块实体外观(见开发指南-玩法开发-自定义游戏内容-自定义方块-自定义方块实体外观)\r\n 2. 微缩方块(见开发指南-玩法开发-自定义游戏内容-微缩方块)\r\n 3. 火方块,水方块\r\n 4. 花盆\r\n 5. 钟\r\n 6. 末地传送门,末地折跃门\r\n 7. 屏障\r\n 8. 潮涌核心\r\n 9. 旗帜", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "remark": "- 如果之前已经拥有一个相同名称几何体模型,合并出来的新模型会覆盖之前的模型。因此需要注意,每次合并不同外观的模型时geometryName都应该互不相同。\r\n - 如果每次合并的模型都是外观相同的模型,则我们建议使用相同的geometryName,以节省存储模型的内存。当然,最优的情况下是尽量复用之前已经创建的方块几何体模型,而不是重复合并新的模型。\r\n - 目前尚不支持的方块类型有 (后续版本将陆续支持):\r\n 1. 自定义方块实体外观(见开发指南-玩法开发-自定义游戏内容-自定义方块-自定义方块实体外观)\r\n 2. 微缩方块(见开发指南-玩法开发-自定义游戏内容-微缩方块)\r\n 3. 火方块,水方块\r\n 4. 花盆\r\n 5. 钟\r\n 6. 末地传送门,末地折跃门\r\n 7. 屏障\r\n 8. 潮涌核心\r\n 9. 旗帜", + "return": [], + "description": "根据输入的方块位置列表,搜索这些位置的所有方块,并将这些方块合并和转换为能用于实体的几何体模型。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\npalette = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],\"my_block_geometry\")", "params": [ { - "name": "posList", - "type": "list(tuple(int,int,int))", + "type": "list(tuple(int,int,int))", + "name": "posList", "description": "方块位置列表" - }, + }, { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id" - }, + }, { - "name": "unsupportedMode", - "type": "int", + "type": "int", + "name": "unsupportedMode", "description": "不支持方块处理方式枚举,可选参数,可输入的值为0、1。默认的值为0。如果方块调色板中有不支持转变为几何体的方块的话,将按以下方式处理:0:跳过不支持的方块继续生成。1:停止生成" - }, + }, { - "name": "useStructureVoid", - "type": "bool", + "type": "bool", + "name": "useStructureVoid", "description": "是否使用结构空位代替空气方块,可选参数,默认值为False。True表示使用结构空位,False表示不使用结构空位。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\npalette = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],\"my_block_geometry\")" - }, + ], + "type": "api", + "side": "client", + "name": "CombineBlockFromPosListToGeometry" + }, { - "type": "api", - "name": "CombineBlockPaletteToGeometry", - "method": "", - "description": "将BlockPalette中的所有方块合并并转换为能用于实体的几何体模型。", - "remark": "- 如果之前已经拥有一个相同名称几何体模型,合并出来的新模型会覆盖之前的模型。因此需要注意,每次合并不同外观的模型时geometryName都应该互不相同。\r\n - 如果每次合并的模型都是外观相同的模型,则我们建议使用相同的geometryName,以节省存储模型的内存。当然,最优的情况下是尽量复用之前已经创建的方块几何体模型,而不是重复合并新的模型。\r\n - 目前尚不支持的方块类型有 (后续版本将陆续支持):\r\n 1. 自定义方块实体外观(见开发指南-玩法开发-自定义游戏内容-自定义方块-自定义方块实体外观)\r\n 2. 微缩方块(见开发指南-玩法开发-自定义游戏内容-微缩方块)\r\n 3. 火方块,水方块\r\n 4. 花盆\r\n 5. 钟\r\n 6. 末地传送门,末地折跃门\r\n 7. 屏障\r\n 8. 潮涌核心\r\n 9. 旗帜", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "remark": "- 如果之前已经拥有一个相同名称几何体模型,合并出来的新模型会覆盖之前的模型。因此需要注意,每次合并不同外观的模型时geometryName都应该互不相同。\r\n - 如果每次合并的模型都是外观相同的模型,则我们建议使用相同的geometryName,以节省存储模型的内存。当然,最优的情况下是尽量复用之前已经创建的方块几何体模型,而不是重复合并新的模型。\r\n - 目前尚不支持的方块类型有 (后续版本将陆续支持):\r\n 1. 自定义方块实体外观(见开发指南-玩法开发-自定义游戏内容-自定义方块-自定义方块实体外观)\r\n 2. 微缩方块(见开发指南-玩法开发-自定义游戏内容-微缩方块)\r\n 3. 火方块,水方块\r\n 4. 花盆\r\n 5. 钟\r\n 6. 末地传送门,末地折跃门\r\n 7. 屏障\r\n 8. 潮涌核心\r\n 9. 旗帜", + "return": [], + "description": "将BlockPalette中的所有方块合并并转换为能用于实体的几何体模型。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nblockComp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = blockComp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\ngeometryName = blockGeometryComp.CombineBlockPaletteToGeometry(palette,\"my_block_geometry\")\r\nprint geometryName", "params": [ { - "name": "blockPalette", - "type": "BlockPaletteComponent", + "type": "BlockPaletteComponent", + "name": "blockPalette", "description": "方块调色板,由GetBlockPaletteBetweenPos以及GetBlockPaletteFromPosList接口获取" - }, + }, { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id。" - }, + }, { - "name": "unsupportedMode", - "type": "int", + "type": "int", + "name": "unsupportedMode", "description": "不支持方块处理方式枚举,可选参数,可输入的值为0、1。默认的值为0。如果方块调色板中有不支持转变为几何体的方块的话,将按以下方式处理:0:跳过不支持的方块继续生成。1:停止生成" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nblockComp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = blockComp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\nblockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)\r\ngeometryName = blockGeometryComp.CombineBlockPaletteToGeometry(palette,\"my_block_geometry\")\r\nprint geometryName" - }, + ], + "type": "api", + "side": "client", + "name": "CombineBlockPaletteToGeometry" + }, { - "type": "api", - "name": "EnableActorBlockGeometryTransparent", - "method": "", - "description": "设置是否允许实体的方块几何体模型产生透明度,允许开启后通过调节方块几何体的透明度将会使得方块几何体模型变得透明。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "remark": "", + "return": [], + "description": "设置是否允许实体的方块几何体模型产生透明度,允许开启后通过调节方块几何体的透明度将会使得方块几何体模型变得透明。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 允许方块几何体模型产生透明度\r\nprint actorRenderComp.EnableActorBlockGeometryTransparent(\"my_block_geometry\", True)\r\n# 调节方块几何体模型的透明度为0.5\r\nprint actorRenderComp.SetActorBlockGeometryTransparency(\"my_block_geometry\", 0.5)", "params": [ { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id。" - }, + }, { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否允许实体的方块几何体模型产生透明度,True表示允许,False表示不允许。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 允许方块几何体模型产生透明度\r\nprint actorRenderComp.EnableActorBlockGeometryTransparent(\"my_block_geometry\", True)\r\n# 调节方块几何体模型的透明度为0.5\r\nprint actorRenderComp.SetActorBlockGeometryTransparency(\"my_block_geometry\", 0.5)" - }, + ], + "type": "api", + "side": "client", + "name": "EnableActorBlockGeometryTransparent" + }, { - "type": "api", - "name": "GetActorBlockGeometryScale", - "method": "", - "description": "获取实体的方块几何体模型的缩放倍率。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "remark": "", + "return": [], + "description": "获取实体的方块几何体模型的缩放倍率。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\nprint actorRenderComp.GetActorBlockGeometryScale(\"my_block_geometry\")", "params": [ { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\nprint actorRenderComp.GetActorBlockGeometryScale(\"my_block_geometry\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetActorBlockGeometryScale" + }, { - "type": "api", - "name": "SetActorBlockGeometryOffset", - "method": "", - "description": "设置实体的方块几何体模型的位置偏移。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "remark": "", + "return": [], + "description": "设置实体的方块几何体模型的位置偏移。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\nprint actorRenderComp.SetActorBlockGeometryOffset(\"my_block_geometry\", (1,1,1))", "params": [ { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "方块几何体模型相对实体的位置偏移值,默认为(0, 0, 0)。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\nprint actorRenderComp.SetActorBlockGeometryOffset(\"my_block_geometry\", (1,1,1))" - }, + ], + "type": "api", + "side": "client", + "name": "SetActorBlockGeometryOffset" + }, { - "type": "api", - "name": "SetActorBlockGeometryRotation", - "method": "", - "description": "设置实体的方块几何体模型的旋转角度。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "remark": "", + "return": [], + "description": "设置实体的方块几何体模型的旋转角度。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\nprint actorRenderComp.SetActorBlockGeometryRotation(\"my_block_geometry\", (90,0,0))", "params": [ { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id" - }, + }, { - "name": "rotation", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rotation", "description": "方块几何体模型相对实体的旋转角度,默认为(0, 0, 0),分别表示绕x,y,z轴的旋转角度,旋转顺序按z,x,y顺序旋转。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\nprint actorRenderComp.SetActorBlockGeometryRotation(\"my_block_geometry\", (90,0,0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetActorBlockGeometryRotation" + }, { - "type": "api", - "name": "SetActorBlockGeometryScale", - "method": "", - "description": "设置实体的方块几何体模型的缩放倍率。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "remark": "", + "return": [], + "description": "设置实体的方块几何体模型的缩放倍率。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\nprint actorRenderComp.SetActorBlockGeometryScale(\"my_block_geometry\", (0.5, 0.5, 0.5))", "params": [ { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id" - }, + }, { - "name": "scale", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "scale", "description": "方块几何模型在x,y,z各个轴上的缩放值。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\nprint actorRenderComp.SetActorBlockGeometryScale(\"my_block_geometry\", (0.5, 0.5, 0.5))" - }, + ], + "type": "api", + "side": "client", + "name": "SetActorBlockGeometryScale" + }, { - "type": "api", - "name": "SetActorBlockGeometryTransparency", - "method": "", - "description": "设置实体的方块几何体模型的透明度。注意,只有调用接口EnableActorBlockGeometryTransparent开启了方块几何体模型的透明度后该接口才会生效。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "remark": "", + "return": [], + "description": "设置实体的方块几何体模型的透明度。注意,只有调用接口EnableActorBlockGeometryTransparent开启了方块几何体模型的透明度后该接口才会生效。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块几何体模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 允许方块几何体模型产生透明度\r\nprint actorRenderComp.EnableActorBlockGeometryTransparent(\"my_block_geometry\", True)\r\n# 调节方块几何体模型的透明度为0.5\r\nprint actorRenderComp.SetActorBlockGeometryTransparency(\"my_block_geometry\", 0.5)", "params": [ { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id。" - }, + }, { - "name": "transparent", - "type": "float", + "type": "float", + "name": "transparent", "description": "方块几何体模型的透明度,范围值为[0,1],超过这个范围的值将会被截取为0或1。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(\"-4294967295\")\r\n# 允许方块几何体模型产生透明度\r\nprint actorRenderComp.EnableActorBlockGeometryTransparent(\"my_block_geometry\", True)\r\n# 调节方块几何体模型的透明度为0.5\r\nprint actorRenderComp.SetActorBlockGeometryTransparency(\"my_block_geometry\", 0.5)" - }, + ], + "type": "api", + "side": "client", + "name": "SetActorBlockGeometryTransparency" + }, { - "type": "api", - "name": "CleanBlockTileEntityCustomData", - "method": "", - "description": "清空指定位置的特殊方块(箱子、头颅、熔炉、花盆等)绑定的TileEntity内存储的自定义数据。", - "remark": "- 如果dimensionId不传或传入负值,该接口使用创建组件时的playerId来定位具体维度,且仅可获取玩家附近的方块,若方块位置离玩家太远,可能无法获取到正确的返回信息。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "- 如果dimensionId不传或传入负值,该接口使用创建组件时的playerId来定位具体维度,且仅可获取玩家附近的方块,若方块位置离玩家太远,可能无法获取到正确的返回信息。", + "return": [], + "description": "清空指定位置的特殊方块(箱子、头颅、熔炉、花盆等)绑定的TileEntity内存储的自定义数据。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\nsuc = comp.CleanBlockTileEntityCustomData(pos, dimensionId)\r\nprint \"CleanBlockTileEntityCustomData pos=%s suc=%s\" % (str(pos), suc)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "绑定TileEntity的特殊方块的位置坐标" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\nsuc = comp.CleanBlockTileEntityCustomData(pos, dimensionId)\r\nprint \"CleanBlockTileEntityCustomData pos=%s suc=%s\" % (str(pos), suc)" - }, + ], + "type": "api", + "side": "server", + "name": "CleanBlockTileEntityCustomData" + }, { - "type": "api", - "name": "CreateFrameEffectForBlockEntity", - "method": "", - "description": "在自定义方块实体上创建序列帧特效,创建后该接口返回序列帧特效的Id,利用该Id可以使用特效/序列帧中的接口对该序列帧特效进行播放、设置位置、大小等操作。与实体的序列帧特效创建方式类似。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "在自定义方块实体上创建序列帧特效,创建后该接口返回序列帧特效的Id,利用该Id可以使用特效/序列帧中的接口对该序列帧特效进行播放、设置位置、大小等操作。与实体的序列帧特效创建方式类似。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 以自定义方块实体所在的位置为原点,在这个原点上的坐标(1.0, 1.0, 1.0)的位置上使用resource_pack/textures下的资源创建序列帧特效\r\nid1 = comp.CreateFrameEffectForBlockEntity(pos, \"textures/sfxs/snow\", \"my_frame1\", (1.0, 1.0, 1.0))\r\n# 以自定义方块实体所在的位置为原点,在这个原点上的坐标(1.0, 1.0, 1.0)的位置上使用resource_pack/effects下的资源创建序列帧特效\r\nid2 = comp.CreateFrameEffectForBlockEntity(pos, \"effects/sfxs/snow.json\", \"my_frame2\", (1.0, 1.0, 1.0))", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "path", - "type": "str", + "type": "str", + "name": "path", "description": "特效资源路径,不需要后缀名,路径为resource_pack/textures文件夹下或resource_pack/effects下的序列帧资源文件的路径,路径名分别以\"textures/\"开头或\"effects/\"开头。路径名以\"textures/\"开头时不需要加.json后缀名, 路径名以\"effects/\"开头时需要加.json后缀名。" - }, + }, { - "name": "frameKeyName", - "type": "str", + "type": "str", + "name": "frameKeyName", "description": "该序列帧特效的自定义键值名称,创建序列帧特效后可以使用该键值名称通过GetFrameEffectIdInBlockEntity接口来获取序列帧特效的id。" - }, + }, { - "name": "effectPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "effectPos", "description": "特效相对自定义方块实体的位置,即以自定方块实体所在的位置为原点的坐标系下的坐标位置。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 以自定义方块实体所在的位置为原点,在这个原点上的坐标(1.0, 1.0, 1.0)的位置上使用resource_pack/textures下的资源创建序列帧特效\r\nid1 = comp.CreateFrameEffectForBlockEntity(pos, \"textures/sfxs/snow\", \"my_frame1\", (1.0, 1.0, 1.0))\r\n# 以自定义方块实体所在的位置为原点,在这个原点上的坐标(1.0, 1.0, 1.0)的位置上使用resource_pack/effects下的资源创建序列帧特效\r\nid2 = comp.CreateFrameEffectForBlockEntity(pos, \"effects/sfxs/snow.json\", \"my_frame2\", (1.0, 1.0, 1.0))" - }, + ], + "type": "api", + "side": "client", + "name": "CreateFrameEffectForBlockEntity" + }, { - "type": "api", - "name": "CreateParticleEffectForBlockEntity", - "method": "", - "description": "在自定义方块实体上创建粒子特效,创建后该接口返回粒子特效的Id,利用该Id可以使用特效/粒子中的接口对该粒子特效进行播放、设置位置、大小等操作。与实体的粒子特效创建方式类似。若自定义方块实体已存在键值名称相同的特效,则不会创建新的特效,接口返回已有的特效Id。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "在自定义方块实体上创建粒子特效,创建后该接口返回粒子特效的Id,利用该Id可以使用特效/粒子中的接口对该粒子特效进行播放、设置位置、大小等操作。与实体的粒子特效创建方式类似。若自定义方块实体已存在键值名称相同的特效,则不会创建新的特效,接口返回已有的特效Id。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 以自定义方块实体所在的位置为原点,在这个原点上的坐标(1.0, 1.0, 1.0)的位置上创建粒子特效\r\nid = comp.CreateParticleEffectForBlockEntity(pos, \"effects/fire.json\", \"my_particle1\", (1.0, 1.0, 1.0))", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "path", - "type": "str", + "type": "str", + "name": "path", "description": "特效资源路径,需要加上后缀名(一般是json)。路径为resource_pack/effects文件下的粒子特效json文件路径,路径名以\"effects/\"开头。" - }, + }, { - "name": "particleKeyName", - "type": "str", + "type": "str", + "name": "particleKeyName", "description": "该粒子特效的自定义键值名称,创建粒子特效后可以使用该键值名称通过GetParticleEffectIdInBlockEntity接口来获取粒子特效的id。" - }, + }, { - "name": "effectPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "effectPos", "description": "特效相对自定义方块实体的位置,即以自定方块实体所在的位置为原点的坐标系下的坐标位置。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 以自定义方块实体所在的位置为原点,在这个原点上的坐标(1.0, 1.0, 1.0)的位置上创建粒子特效\r\nid = comp.CreateParticleEffectForBlockEntity(pos, \"effects/fire.json\", \"my_particle1\", (1.0, 1.0, 1.0))" - }, + ], + "type": "api", + "side": "client", + "name": "CreateParticleEffectForBlockEntity" + }, { - "type": "api", - "name": "ExecuteCommandBlock", - "method": "", - "description": "执行一次命令方块", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "执行一次命令方块", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.ExecuteCommandBlock((x, y, z), 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.ExecuteCommandBlock((x, y, z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "ExecuteCommandBlock" + }, { - "type": "api", - "name": "GetBlockEntityData", - "method": "", - "description": "用于获取客户端当前维度中方块(包括自定义方块)的数据,数据只读不可写,无法获取箱子内的物品信息。", - "remark": "- 随着版本更迭,方块中包含的数据结构可能被微软团队调整,并且不会公告,使用该接口的开发者需注意版本更新时做好测试和兼容。数据编码为UTF-8\r\n 适用于:[方块实体](https://minecraft-zh.gamepedia.com/%E6%96%B9%E5%9D%97%E5%AE%9E%E4%BD%93)\r\n 特殊情况:末影箱的物品信息不能通过该接口获取\r\n - 需要注意的是,由于该接口获取的是包含原版nbttag及自定义方块的数据,为了兼容原版nbttag,Python对象在获取出来时,会做一定的转换,如:\r\n None -> {\"__type__\" : 1, \"__value__\": 2}\r\n 因此,若不希望有类似转换,并且只需要获取自定义方块实体的数据, 请使用CreateBlockEntityData里的GetBlockEntityData接口", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "- 随着版本更迭,方块中包含的数据结构可能被微软团队调整,并且不会公告,使用该接口的开发者需注意版本更新时做好测试和兼容。数据编码为UTF-8\r\n 适用于:[方块实体](https://minecraft-zh.gamepedia.com/%E6%96%B9%E5%9D%97%E5%AE%9E%E4%BD%93)\r\n 特殊情况:末影箱的物品信息不能通过该接口获取\r\n - 需要注意的是,由于该接口获取的是包含原版nbttag及自定义方块的数据,为了兼容原版nbttag,Python对象在获取出来时,会做一定的转换,如:\r\n None -> {\"__type__\" : 1, \"__value__\": 2}\r\n 因此,若不希望有类似转换,并且只需要获取自定义方块实体的数据, 请使用CreateBlockEntityData里的GetBlockEntityData接口", + "return": [], + "description": "用于获取客户端当前维度中方块(包括自定义方块)的数据,数据只读不可写,无法获取箱子内的物品信息。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.client.extraClientApi as clientApi\r\nblockEntitycomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nblockEntityData = blockEntitycomp.GetBlockEntityData((4, 3, 2))", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nblockEntitycomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nblockEntityData = blockEntitycomp.GetBlockEntityData((4, 3, 2))" - }, + ], + "type": "api", + "side": "client", + "name": "GetBlockEntityData" + }, { - "type": "api", - "name": "GetBlockEntityMolangValue", - "method": "", - "description": "获取自定义方块实体的Molang变量的值。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "获取自定义方块实体的Molang变量的值。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.GetBlockEntityMolangValue(pos, \"query.mod.idle\")", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "variableName", - "type": "str", + "type": "str", + "name": "variableName", "description": "molang变量的名称,以\"variable.\"开头,并且不能包含超过两个\".\"。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.GetBlockEntityMolangValue(pos, \"query.mod.idle\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetBlockEntityMolangValue" + }, { - "type": "api", - "name": "GetBlockTileEntityCustomData", - "method": "", - "description": "读取指定位置的特殊方块(箱子、头颅、熔炉、花盆等)绑定的TileEntity内存储的自定义数据", - "remark": "- 如果dimensionId不传或传入负值,该接口使用创建组件时的playerId来定位具体维度,且仅可获取玩家附近的方块,若方块位置离玩家太远,可能无法获取到正确的返回信息。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "- 如果dimensionId不传或传入负值,该接口使用创建组件时的playerId来定位具体维度,且仅可获取玩家附近的方块,若方块位置离玩家太远,可能无法获取到正确的返回信息。", + "return": [], + "description": "读取指定位置的特殊方块(箱子、头颅、熔炉、花盆等)绑定的TileEntity内存储的自定义数据", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\nkey = \"owner\"\r\nval = comp.GetBlockTileEntityCustomData(pos, key, dimensionId)\r\nprint \"GetBlockTileEntityCustomData pos=%s key=%s value=%s\" % (str(pos), key, val)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "绑定TileEntity的特殊方块的位置坐标" - }, + }, { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "自定义key" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\nkey = \"owner\"\r\nval = comp.GetBlockTileEntityCustomData(pos, key, dimensionId)\r\nprint \"GetBlockTileEntityCustomData pos=%s key=%s value=%s\" % (str(pos), key, val)" - }, + ], + "type": "api", + "side": "server", + "name": "GetBlockTileEntityCustomData" + }, { - "type": "api", - "name": "GetBlockTileEntityWholeCustomData", - "method": "", - "description": "读取指定位置的特殊方块(箱子、头颅、熔炉、花盆等)绑定的TileEntity内存储的自定义数据字典。", - "remark": "- 如果dimensionId不传或传入负值,该接口使用创建组件时的playerId来定位具体维度,且仅可获取玩家附近的方块,若方块位置离玩家太远,可能无法获取到正确的返回信息。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "- 如果dimensionId不传或传入负值,该接口使用创建组件时的playerId来定位具体维度,且仅可获取玩家附近的方块,若方块位置离玩家太远,可能无法获取到正确的返回信息。", + "return": [], + "description": "读取指定位置的特殊方块(箱子、头颅、熔炉、花盆等)绑定的TileEntity内存储的自定义数据字典。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\ndata = comp.GetBlockTileEntityWholeCustomData(pos, dimensionId)\r\nif not data:\r\n print \"GetBlockTileEntityWholeCustomData pos=%s return empty\" % (str(pos), )\r\nelse:\r\n print \"GetBlockTileEntityWholeCustomData pos=%s return success\" % (str(pos), )\r\nif data:\r\n for key, val in data.iteritems():\r\n print \"key=%s val=%s\" % (key, str(val))", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "绑定TileEntity的特殊方块的位置坐标" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\ndata = comp.GetBlockTileEntityWholeCustomData(pos, dimensionId)\r\nif not data:\r\n print \"GetBlockTileEntityWholeCustomData pos=%s return empty\" % (str(pos), )\r\nelse:\r\n print \"GetBlockTileEntityWholeCustomData pos=%s return success\" % (str(pos), )\r\nif data:\r\n for key, val in data.iteritems():\r\n print \"key=%s val=%s\" % (key, str(val))" - }, + ], + "type": "api", + "side": "server", + "name": "GetBlockTileEntityWholeCustomData" + }, { - "type": "api", - "name": "GetCommandBlock", - "method": "", - "description": "获取命令方块的设置内容", - "remark": "- 返回值具体如下:\r\n | 键值 | 类型 | 内容 |\r\n | ----------------| -------------| -------------|\r\n | \"cmd\" | str | 命令输入内容 |\r\n | \"name\" | str | 悬浮文本内容 |\r\n | \"mode\" | int | 命令方块类型,详见枚举[命令方块类型](../../枚举值/CommandBlockType.md) |\r\n | \"isConditional\" | int | 触发条件,详见枚举[命令方块条件类型](../../枚举值/ConditionType.md) |\r\n | \"redstoneMode\" | int | 红石模式,详见枚举[命令方块红石类型](../../枚举值/RedstoneModeType.md) |", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "- 返回值具体如下:\r\n | 键值 | 类型 | 内容 |\r\n | ----------------| -------------| -------------|\r\n | \"cmd\" | str | 命令输入内容 |\r\n | \"name\" | str | 悬浮文本内容 |\r\n | \"mode\" | int | 命令方块类型,详见枚举[命令方块类型](../../枚举值/CommandBlockType.md) |\r\n | \"isConditional\" | int | 触发条件,详见枚举[命令方块条件类型](../../枚举值/ConditionType.md) |\r\n | \"redstoneMode\" | int | 红石模式,详见枚举[命令方块红石类型](../../枚举值/RedstoneModeType.md) |", + "return": [], + "description": "获取命令方块的设置内容", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.GetCommandBlock((x, y, z), 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.GetCommandBlock((x, y, z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetCommandBlock" + }, { - "type": "api", - "name": "GetFrameEffectIdInBlockEntity", - "method": "", - "description": "获取在自定义方块实体中已创建的指定序列帧特效的Id,已创建的特效分为两种:一是通过resource_pack/entity/下的实体json文件中使用“netease_frame_effects”所定义的特效;二是使用接口CreateFrameEffectForBlockEntity创建的特效。 返回的特效Id可以使用特效/序列帧中的接口对该序列帧特效进行播放、设置位置、大小等操作。与实体的序列帧特效创建方式类似。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "获取在自定义方块实体中已创建的指定序列帧特效的Id,已创建的特效分为两种:一是通过resource_pack/entity/下的实体json文件中使用“netease_frame_effects”所定义的特效;二是使用接口CreateFrameEffectForBlockEntity创建的特效。 返回的特效Id可以使用特效/序列帧中的接口对该序列帧特效进行播放、设置位置、大小等操作。与实体的序列帧特效创建方式类似。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "# 假设自定义方块实体定义了以下特效\r\n# \"minecraft:client_entity\": {\r\n# ...\r\n# \"netease_frame_effects\":{\r\n# \"my_frame1\" : { \"path\" : \"textures/sfxs/snow.json\", \"pos\": [1.0 , 1.0 , 1.0]},\r\n# ...\r\n# }\r\n# }\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 获取名为\"my_frame1\"这个预设特效的特效Id\r\nid = comp.GetFrameEffectIdInBlockEntity(pos, \"my_frame1\")", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "frameKeyName", - "type": "str", + "type": "str", + "name": "frameKeyName", "description": "序列帧特效的自定义键值名称,即:netease_frame_effects: { \"keyName\" : {\"path“:“textures/sfxs/xxx.json”, \"pos\": [1.0, 1.0, 1.0f]} } 中的\"keyName\",又或者是通过CreateFrameEffectForBlockEntity创建特效时该接口中填写的frameKeyName参数。" } - ], - "return": [], - "example": "# 假设自定义方块实体定义了以下特效\r\n# \"minecraft:client_entity\": {\r\n# ...\r\n# \"netease_frame_effects\":{\r\n# \"my_frame1\" : { \"path\" : \"textures/sfxs/snow.json\", \"pos\": [1.0 , 1.0 , 1.0]},\r\n# ...\r\n# }\r\n# }\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 获取名为\"my_frame1\"这个预设特效的特效Id\r\nid = comp.GetFrameEffectIdInBlockEntity(pos, \"my_frame1\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetFrameEffectIdInBlockEntity" + }, { - "type": "api", - "name": "GetFrameItem", - "method": "", - "description": "获取物品展示框的物品", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "获取物品展示框的物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.GetFrameItem((x, y, z), 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.GetFrameItem((x, y, z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetFrameItem" + }, { - "type": "api", - "name": "GetFrameItemDropChange", - "method": "", - "description": "获取物品展示框里物品的掉落几率", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "获取物品展示框里物品的掉落几率", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.GetFrameItemDropChange((x, y, z), 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.GetFrameItemDropChange((x, y, z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetFrameItemDropChange" + }, { - "type": "api", - "name": "GetFrameRotation", - "method": "", - "description": "获取物品展示框里物品的顺时针旋转角度", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "获取物品展示框里物品的顺时针旋转角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.GetFrameRotation((x, y, z), 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.GetFrameRotation((x, y, z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetFrameRotation" + }, { - "type": "api", - "name": "GetHopperSpeed", - "method": "", - "description": "获取漏斗运输一个物品所需的时间(单位:刻)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "获取漏斗运输一个物品所需的时间(单位:刻)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.GetHopperSpeed((x, y, z), 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.GetHopperSpeed((x, y, z), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetHopperSpeed" + }, { - "type": "api", - "name": "GetParticleEffectIdInBlockEntity", - "method": "", - "description": "获取在自定义方块实体中已创建的指定粒子特效的Id,已创建的特效分为两种:一是通过resource_pack/entity/下的实体json文件中使用“netease_particle_effects”所定义的特效;二是使用接口CreateParticleEffectForBlockEntity创建的特效。 返回的特效Id可以使用特效/粒子中的接口对该粒子特效进行播放、设置位置、大小等操作。与实体的粒子特效创建方式类似。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "获取在自定义方块实体中已创建的指定粒子特效的Id,已创建的特效分为两种:一是通过resource_pack/entity/下的实体json文件中使用“netease_particle_effects”所定义的特效;二是使用接口CreateParticleEffectForBlockEntity创建的特效。 返回的特效Id可以使用特效/粒子中的接口对该粒子特效进行播放、设置位置、大小等操作。与实体的粒子特效创建方式类似。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "# 需要自定义方块实体的entity.json文件具有如下定义:\r\n# \"minecraft:client_entity\": {\r\n# ...\r\n# \"netease_particle_effects\":{\r\n# \"my_particle1\" : { \"path\" : \"effects/fire.json\", \"pos\": [1.0 , 1.0 , 1.0]},\r\n# ...\r\n# }\r\n# }\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 获取名为\"my_particle1\"这个预设特效的特效Id\r\nid = comp.GetParticleEffectIdInBlockEntity(pos, \"my_particle1\")", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "particleKeyName", - "type": "str", + "type": "str", + "name": "particleKeyName", "description": "粒子特效的自定义键值名称,即:netease_particle_effects: { \"keyName\" : {\"path“:“effects/xxx.json”, \"pos\": [1.0, 1.0, 1.0f]} } 中的\"keyName\",又或者是通过CreateParticleEffectForBlockEntity创建特效时该接口中填写的particleKeyName参数。" } - ], - "return": [], - "example": "# 需要自定义方块实体的entity.json文件具有如下定义:\r\n# \"minecraft:client_entity\": {\r\n# ...\r\n# \"netease_particle_effects\":{\r\n# \"my_particle1\" : { \"path\" : \"effects/fire.json\", \"pos\": [1.0 , 1.0 , 1.0]},\r\n# ...\r\n# }\r\n# }\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 获取名为\"my_particle1\"这个预设特效的特效Id\r\nid = comp.GetParticleEffectIdInBlockEntity(pos, \"my_particle1\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetParticleEffectIdInBlockEntity" + }, { - "type": "api", - "name": "RemoveFrameEffectInBlockEntity", - "method": "", - "description": "移除在自定义方块实体上创建的序列帧特效。移除后的特效Id将会失效。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "移除在自定义方块实体上创建的序列帧特效。移除后的特效Id将会失效。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 移除键值名为\"my_frame1\"的特效\r\ncomp.RemoveFrameEffectInBlockEntity(pos, \"my_frame1\")", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "frameKeyName", - "type": "str", + "type": "str", + "name": "frameKeyName", "description": "该序列帧特效的自定义键值名称。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 移除键值名为\"my_frame1\"的特效\r\ncomp.RemoveFrameEffectInBlockEntity(pos, \"my_frame1\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveFrameEffectInBlockEntity" + }, { - "type": "api", - "name": "RemoveParticleEffectInBlockEntity", - "method": "", - "description": "移除在自定义方块实体上创建的粒子特效。移除后的特效Id将会失效。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "移除在自定义方块实体上创建的粒子特效。移除后的特效Id将会失效。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 移除键值名为\"my_particle1\"的特效\r\ncomp.RemoveParticleEffectInBlockEntity(pos, \"my_particle1\")", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "particleKeyName", - "type": "str", + "type": "str", + "name": "particleKeyName", "description": "该粒子特效的自定义键值名称。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 移除键值名为\"my_particle1\"的特效\r\ncomp.RemoveParticleEffectInBlockEntity(pos, \"my_particle1\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveParticleEffectInBlockEntity" + }, { - "type": "api", - "name": "SetBlockEntityData", - "method": "", - "description": "用于设置方块(包括自定义方块)的数据", - "remark": "- 随着版本更迭,方块中包含的数据结构可能被微软团队调整,并且不会公告,使用该接口的开发者需注意版本更新时做好测试和兼容。数据编码为UTF-8\r\n 适用于:[方块实体](https://minecraft-zh.gamepedia.com/%E6%96%B9%E5%9D%97%E5%AE%9E%E4%BD%93)\r\n 特殊情况:末影箱的物品信息不能通过该接口设置\r\n 注意:面向、状态等数据修改只会影响方块实体的数据,不会影响方块的渲染表现\r\n 切记:如果忽略游戏原有规则随意修改nbt数据,可能会导致bug或游戏崩溃", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "- 随着版本更迭,方块中包含的数据结构可能被微软团队调整,并且不会公告,使用该接口的开发者需注意版本更新时做好测试和兼容。数据编码为UTF-8\r\n 适用于:[方块实体](https://minecraft-zh.gamepedia.com/%E6%96%B9%E5%9D%97%E5%AE%9E%E4%BD%93)\r\n 特殊情况:末影箱的物品信息不能通过该接口设置\r\n 注意:面向、状态等数据修改只会影响方块实体的数据,不会影响方块的渲染表现\r\n 切记:如果忽略游戏原有规则随意修改nbt数据,可能会导致bug或游戏崩溃", + "return": [], + "description": "用于设置方块(包括自定义方块)的数据", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\nblockEntitycomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nblockEntityData = blockEntitycomp.GetBlockEntityData(0, (4, 3, 2))\r\nif blockEntityData:\r\n blockEntityData[\"FrontText\"][\"Text\"][\"__value__\"] = \"test\"\r\n blockEntitycomp.SetBlockEntityData(0, (4, 3, 2), blockEntityData)", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "nbtData", - "type": "dict", + "type": "dict", + "name": "nbtData", "description": "方块实体内数据的对象,可结合GetBlockEntityData使用,获取后修改部分数据后再进行设置。如果传空dict,大部分数据不会被改变,小部分数据会被设置为默认值" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nblockEntitycomp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nblockEntityData = blockEntitycomp.GetBlockEntityData(0, (4, 3, 2))\r\nif blockEntityData:\r\n blockEntityData[\"FrontText\"][\"Text\"][\"__value__\"] = \"test\"\r\n blockEntitycomp.SetBlockEntityData(0, (4, 3, 2), blockEntityData)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBlockEntityData" + }, { - "type": "api", - "name": "SetBlockEntityMolangValue", - "method": "", - "description": "设置自定义方块实体的Molang变量,与实体的molang变量作用相同。目前主要用于控制自定义实体的动画状态转变。Molang变量的定义方式与原版实体的Molang变量定义方法相同。详细可参考自定义方块实体动画的教学文档。", - "remark": "- 注意,自定义方块实体的Molang变量与微软原版的Molang变量定义和使用方式相同, 因此不需要调用实体/molang/中的Register接口及UnRegister接口进行注册和反注册,只需在entity.json中进行定义和初始化即可,这点与微软原版实体的使用方法相同,可参考微软原版实体的entity.json文件。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "- 注意,自定义方块实体的Molang变量与微软原版的Molang变量定义和使用方式相同, 因此不需要调用实体/molang/中的Register接口及UnRegister接口进行注册和反注册,只需在entity.json中进行定义和初始化即可,这点与微软原版实体的使用方法相同,可参考微软原版实体的entity.json文件。", + "return": [], + "description": "设置自定义方块实体的Molang变量,与实体的molang变量作用相同。目前主要用于控制自定义实体的动画状态转变。Molang变量的定义方式与原版实体的Molang变量定义方法相同。详细可参考自定义方块实体动画的教学文档。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "# 需要自定义方块实体的entity.json文件具有如下定义:\r\n# \"minecraft:client_entity\": {\r\n# ...\r\n# \"scripts\":{\r\n# // 注册\"variable.mod_is_moving\"这个molang变量并将其值初始化为1.0\r\n# \"initialize\": [ \"variable.mod_is_moving = 1.0;\" ],\r\n# ...\r\n# }\r\n# }\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 设置molang变量的值来转变动画状态\r\ncomp.SetBlockEntityMolangValue(pos, \"variable.mod_is_moving\", 2.0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "variableName", - "type": "str", + "type": "str", + "name": "variableName", "description": "molang变量的名称,以\"variable.\"开头,并且不能包含超过两个\".\"。" - }, + }, { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "molang变量的值" } - ], - "return": [], - "example": "# 需要自定义方块实体的entity.json文件具有如下定义:\r\n# \"minecraft:client_entity\": {\r\n# ...\r\n# \"scripts\":{\r\n# // 注册\"variable.mod_is_moving\"这个molang变量并将其值初始化为1.0\r\n# \"initialize\": [ \"variable.mod_is_moving = 1.0;\" ],\r\n# ...\r\n# }\r\n# }\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 设置molang变量的值来转变动画状态\r\ncomp.SetBlockEntityMolangValue(pos, \"variable.mod_is_moving\", 2.0)" - }, + ], + "type": "api", + "side": "client", + "name": "SetBlockEntityMolangValue" + }, { - "type": "api", - "name": "SetBlockTileEntityCustomData", - "method": "", - "description": "设置指定位置的特殊方块(箱子、头颅、熔炉、花盆等)绑定的TileEntity内存储的自定义数据。", - "remark": "- 如果dimensionId不传或传入负值,该接口使用创建组件时的playerId来定位具体维度,且仅可获取玩家附近的方块,若方块位置离玩家太远,可能无法获取到正确的返回信息。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "- 如果dimensionId不传或传入负值,该接口使用创建组件时的playerId来定位具体维度,且仅可获取玩家附近的方块,若方块位置离玩家太远,可能无法获取到正确的返回信息。", + "return": [], + "description": "设置指定位置的特殊方块(箱子、头颅、熔炉、花盆等)绑定的TileEntity内存储的自定义数据。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\nsuc = comp.SetBlockTileEntityCustomData(pos, \"owner\", \"Jack\", dimensionId)\r\nprint \"SetBlockTileEntityCustomData pos=%s suc=%s\" % (str(pos), suc)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "绑定TileEntity的特殊方块的位置坐标" - }, + }, { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "自定义key" - }, + }, { - "name": "value", - "type": "any", + "type": "any", + "name": "value", "description": "支持python基本数据类型,tuple不支持" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId)\r\npos = (-1, 4, 34)\r\ndimensionId = 0\r\nsuc = comp.SetBlockTileEntityCustomData(pos, \"owner\", \"Jack\", dimensionId)\r\nprint \"SetBlockTileEntityCustomData pos=%s suc=%s\" % (str(pos), suc)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBlockTileEntityCustomData" + }, { - "type": "api", - "name": "SetCommandBlock", - "method": "", - "description": "对命令方块进行内容设置", - "remark": "- 如果使用该接口时,有玩家处于命令方块的操作界面会存在问题,\r\n (1)如果玩家修改了命令方块内容关闭ui时,客户端会向服务端发包,届时可能出现接口设置被玩家设置覆盖的情况。\r\n (2)如果没做修改,关闭ui会导致客户端命令方块外观不会按照服务端的修改进行改变。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "- 如果使用该接口时,有玩家处于命令方块的操作界面会存在问题,\r\n (1)如果玩家修改了命令方块内容关闭ui时,客户端会向服务端发包,届时可能出现接口设置被玩家设置覆盖的情况。\r\n (2)如果没做修改,关闭ui会导致客户端命令方块外观不会按照服务端的修改进行改变。", + "return": [], + "description": "对命令方块进行内容设置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\ncmd = \"give @p green_candle\"\r\nname = \"hello world\"\r\nmode = serverApi.GetMinecraftEnum().CommandBlockType.CYCLE\r\nisConditional = serverApi.GetMinecraftEnum().ConditionType.UNCONDITIONAL\r\nredstoneMode = serverApi.GetMinecraftEnum().RedstoneModeType.KEEP_ON\r\nprint comp.SetCommandBlock((x, y, z), 0, cmd, name, mode, isConditional, redstoneMode)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" - }, + }, { - "name": "cmd", - "type": "str", + "type": "str", + "name": "cmd", "description": "命令输入" - }, + }, { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "悬浮文本" - }, + }, { - "name": "mode", - "type": "int", + "type": "int", + "name": "mode", "description": "方块类型,详见枚举[命令方块类型](../../枚举值/CommandBlockType.md)" - }, + }, { - "name": "isConditional", - "type": "int", + "type": "int", + "name": "isConditional", "description": "条件,详见枚举[命令方块条件类型](../../枚举值/ConditionType.md)" - }, + }, { - "name": "redstoneMode", - "type": "int", + "type": "int", + "name": "redstoneMode", "description": "红石模式,详见枚举[命令方块红石类型](../../枚举值/RedstoneModeType.md)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\ncmd = \"give @p green_candle\"\r\nname = \"hello world\"\r\nmode = serverApi.GetMinecraftEnum().CommandBlockType.CYCLE\r\nisConditional = serverApi.GetMinecraftEnum().ConditionType.UNCONDITIONAL\r\nredstoneMode = serverApi.GetMinecraftEnum().RedstoneModeType.KEEP_ON\r\nprint comp.SetCommandBlock((x, y, z), 0, cmd, name, mode, isConditional, redstoneMode)" - }, + ], + "type": "api", + "side": "server", + "name": "SetCommandBlock" + }, { - "type": "api", - "name": "SetEnableBlockEntityAnimations", - "method": "", - "description": "设置是否开启自定义方块实体的动画效果,开启之后,自定义实体方块会按照实体文件中animation_controller所定义的动画状态机进行动画播放。关闭之后,则会停止所有动画播放。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "设置是否开启自定义方块实体的动画效果,开启之后,自定义实体方块会按照实体文件中animation_controller所定义的动画状态机进行动画播放。关闭之后,则会停止所有动画播放。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.SetEnableBlockEntityAnimations(pos, True)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否开启自定义方块实体的动画播放" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ncomp.SetEnableBlockEntityAnimations(pos, True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetEnableBlockEntityAnimations" + }, { - "type": "api", - "name": "SetFrameItem", - "method": "", - "description": "设置物品展示框的物品", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "设置物品展示框的物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 15,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { },\r\n}\r\nprint comp.SetFrameItem((x, y, z), 0, itemDict)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" - }, + }, { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "详见物品信息字典" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 15,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { },\r\n}\r\nprint comp.SetFrameItem((x, y, z), 0, itemDict)" - }, + ], + "type": "api", + "side": "server", + "name": "SetFrameItem" + }, { - "type": "api", - "name": "SetFrameItemDropChange", - "method": "", - "description": "设置点击物品展示框时生成掉落的几率,默认为1", - "remark": "- 展示框只在生存模式下会生成掉落物,该设置只有在展示框内有物品的时候才会存档", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "- 展示框只在生存模式下会生成掉落物,该设置只有在展示框内有物品的时候才会存档", + "return": [], + "description": "设置点击物品展示框时生成掉落的几率,默认为1", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.SetFrameItemDropChange((x, y, z), 0, 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" - }, + }, { - "name": "change", - "type": "float", + "type": "float", + "name": "change", "description": "掉落几率,取值范围为[0,1]" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.SetFrameItemDropChange((x, y, z), 0, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetFrameItemDropChange" + }, { - "type": "api", - "name": "SetFrameRotation", - "method": "", - "description": "设置物品展示框里物品的顺时针旋转角度", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "", + "return": [], + "description": "设置物品展示框里物品的顺时针旋转角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.SetFrameRotation((x, y, z), 0, 90)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" - }, + }, { - "name": "rot", - "type": "float", + "type": "float", + "name": "rot", "description": "旋转角度,取值范围[0~360]" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.SetFrameRotation((x, y, z), 0, 90)" - }, + ], + "type": "api", + "side": "server", + "name": "SetFrameRotation" + }, { - "type": "api", - "name": "SetHopperSpeed", - "method": "", - "description": "设置漏斗运输一个物品所需的时间(单位:红石刻,1秒10刻),默认值为4刻,该设置存档", - "remark": "- 该设置会决定漏斗吸取物品和推出物品的速度,即每过一个moveTime,漏斗会从其上方吸取一个物品,同时向连接的容器输送一个物品。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "remark": "- 该设置会决定漏斗吸取物品和推出物品的速度,即每过一个moveTime,漏斗会从其上方吸取一个物品,同时向连接的容器输送一个物品。", + "return": [], + "description": "设置漏斗运输一个物品所需的时间(单位:红石刻,1秒10刻),默认值为4刻,该设置存档", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块实体.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.SetHopperSpeed((x, y, z), 0, 1)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" - }, + }, { - "name": "moveTime", - "type": "int", + "type": "int", + "name": "moveTime", "description": "运输一个物品所需的时间(单位:刻)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockEntity(levelId)\r\nprint comp.SetHopperSpeed((x, y, z), 0, 1)" - }, + ], + "type": "api", + "side": "server", + "name": "SetHopperSpeed" + }, { - "type": "api", - "name": "GetBlockAuxValueFromStates", - "method": "", - "description": "根据方块名称和方块状态获取方块附加值AuxValue", - "remark": "- 基岩版1.19更新后,部分包含多个种类的方块(例如,羊毛类,珊瑚类,栅栏类等类型的方块)被拆分成单独的方块identifier及方块附加值,因此原来的方块附加值及方块状态不再适用。请注意尽量使用新的方块identifier,被拆分出来的这些单独的方块可能不会包含任何方块状态,例如橙色羊毛(minecraft:orange_wool)不会包含\"color\"的方块状态。因此无法使用\"color\"状态进行查询获取附加值。\r\n - 截止至基岩版1.20.10,被拆分的方块种类包含:\r\n 1. 羊毛类方块。根据羊毛颜色拆分成独立方块\r\n 2. 原木类方块。根据原木种类拆分成独立方块\r\n 3. 栅栏类方块。根据栅栏种类拆分成独立方块\r\n 4. 珊瑚类方块。根据珊瑚颜色拆分成独立方块\r\n 5. 地毯类方块。根据地毯颜色拆分成独立方块\r\n 6. 潜影盒类方块。根据潜影盒颜色拆分成独立方块\r\n 7. 混凝土类方块。根据混凝土颜色拆分成独立方块", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块状态与附加值.md", + "remark": "- 基岩版1.19更新后,部分包含多个种类的方块(例如,羊毛类,珊瑚类,栅栏类等类型的方块)被拆分成单独的方块identifier及方块附加值,因此原来的方块附加值及方块状态不再适用。请注意尽量使用新的方块identifier,被拆分出来的这些单独的方块可能不会包含任何方块状态,例如橙色羊毛(minecraft:orange_wool)不会包含\"color\"的方块状态。因此无法使用\"color\"状态进行查询获取附加值。\r\n - 截止至基岩版1.20.10,被拆分的方块种类包含:\r\n 1. 羊毛类方块。根据羊毛颜色拆分成独立方块\r\n 2. 原木类方块。根据原木种类拆分成独立方块\r\n 3. 栅栏类方块。根据栅栏种类拆分成独立方块\r\n 4. 珊瑚类方块。根据珊瑚颜色拆分成独立方块\r\n 5. 地毯类方块。根据地毯颜色拆分成独立方块\r\n 6. 潜影盒类方块。根据潜影盒颜色拆分成独立方块\r\n 7. 混凝土类方块。根据混凝土颜色拆分成独立方块", + "return": [], + "description": "根据方块名称和方块状态获取方块附加值AuxValue", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块状态与附加值.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockState(levelId)\r\nstates = comp.GetBlockAuxValueFromStates(\"minecraft:hopper\", {\"facing_direction\": 0, \"toggle_bit\": 0})", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块名称" - }, + }, { - "name": "states", - "type": "dict", + "type": "dict", + "name": "states", "description": "方块状态" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockState(levelId)\r\nstates = comp.GetBlockAuxValueFromStates(\"minecraft:hopper\", {\"facing_direction\": 0, \"toggle_bit\": 0})" - }, + ], + "type": "api", + "side": "server", + "name": "GetBlockAuxValueFromStates" + }, { - "type": "api", - "name": "GetBlockStates", - "method": "", - "description": "获取方块状态", - "remark": "- 仅可获取到已加载区块内的方块状态,支持获取对应维度的常加载区块内方块状态\r\n - 基岩版1.19更新后,部分包含多个种类的方块(例如,羊毛类,珊瑚类,栅栏类等类型的方块)被拆分成单独的方块identifier及方块附加值,因此原来的方块附加值及方块状态不再适用。请注意尽量使用新的方块identifier,被拆分出来的这些单独的方块可能不会包含任何方块状态,例如橙色羊毛(minecraft:orange_wool)不会包含\"color\"的方块状态。因此会返回空的状态。\r\n - 截止至基岩版1.20.10,被拆分的方块种类包含:\r\n 1. 羊毛类方块。根据羊毛颜色拆分成独立方块\r\n 2. 原木类方块。根据原木种类拆分成独立方块\r\n 3. 栅栏类方块。根据栅栏种类拆分成独立方块\r\n 4. 珊瑚类方块。根据珊瑚颜色拆分成独立方块\r\n 5. 地毯类方块。根据地毯颜色拆分成独立方块\r\n 6. 潜影盒类方块。根据潜影盒颜色拆分成独立方块\r\n 7. 混凝土类方块。根据混凝土颜色拆分成独立方块", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块状态与附加值.md", + "remark": "- 仅可获取到已加载区块内的方块状态,支持获取对应维度的常加载区块内方块状态\r\n - 基岩版1.19更新后,部分包含多个种类的方块(例如,羊毛类,珊瑚类,栅栏类等类型的方块)被拆分成单独的方块identifier及方块附加值,因此原来的方块附加值及方块状态不再适用。请注意尽量使用新的方块identifier,被拆分出来的这些单独的方块可能不会包含任何方块状态,例如橙色羊毛(minecraft:orange_wool)不会包含\"color\"的方块状态。因此会返回空的状态。\r\n - 截止至基岩版1.20.10,被拆分的方块种类包含:\r\n 1. 羊毛类方块。根据羊毛颜色拆分成独立方块\r\n 2. 原木类方块。根据原木种类拆分成独立方块\r\n 3. 栅栏类方块。根据栅栏种类拆分成独立方块\r\n 4. 珊瑚类方块。根据珊瑚颜色拆分成独立方块\r\n 5. 地毯类方块。根据地毯颜色拆分成独立方块\r\n 6. 潜影盒类方块。根据潜影盒颜色拆分成独立方块\r\n 7. 混凝土类方块。根据混凝土颜色拆分成独立方块", + "return": [], + "description": "获取方块状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块状态与附加值.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockState(levelId)\r\ncomp.GetBlockStates((4,4,3), 0)", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockState(levelId)\r\ncomp.GetBlockStates((4,4,3), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetBlockStates" + }, { - "type": "api", - "name": "GetBlockStatesFromAuxValue", - "method": "", - "description": "根据方块名称和方块附加值AuxValue获取方块状态", - "remark": "- 基岩版1.19更新后,部分包含多个种类的方块(例如,羊毛类,珊瑚类,栅栏类等类型的方块)被拆分成单独的方块identifier及方块附加值,因此原来的方块附加值及方块状态不再适用。请注意尽量使用新的方块identifier,被拆分出来的这些单独的方块可能不会包含任何方块状态,例如橙色羊毛(minecraft:orange_wool)不会包含”color\"的方块状态。因此查询橙色羊毛时会返回空的状态。\r\n - 截止至基岩版1.20.10,被拆分的方块种类包含:\r\n 1. 羊毛类方块。根据羊毛颜色拆分成独立方块\r\n 2. 原木类方块。根据原木种类拆分成独立方块\r\n 3. 栅栏类方块。根据栅栏种类拆分成独立方块\r\n 4. 珊瑚类方块。根据珊瑚颜色拆分成独立方块\r\n 5. 地毯类方块。根据地毯颜色拆分成独立方块\r\n 6. 潜影盒类方块。根据潜影盒颜色拆分成独立方块\r\n 7. 混凝土类方块。根据混凝土颜色拆分成独立方块\r\n - 特殊值和方块状态的对应关系见[微软文档](https://learn.microsoft.com/en-us/minecraft/creator/reference/content/blockreference/examples/auxvaluetoblockstatemap?view=minecraft-bedrock-stable)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块状态与附加值.md", + "remark": "- 基岩版1.19更新后,部分包含多个种类的方块(例如,羊毛类,珊瑚类,栅栏类等类型的方块)被拆分成单独的方块identifier及方块附加值,因此原来的方块附加值及方块状态不再适用。请注意尽量使用新的方块identifier,被拆分出来的这些单独的方块可能不会包含任何方块状态,例如橙色羊毛(minecraft:orange_wool)不会包含”color\"的方块状态。因此查询橙色羊毛时会返回空的状态。\r\n - 截止至基岩版1.20.10,被拆分的方块种类包含:\r\n 1. 羊毛类方块。根据羊毛颜色拆分成独立方块\r\n 2. 原木类方块。根据原木种类拆分成独立方块\r\n 3. 栅栏类方块。根据栅栏种类拆分成独立方块\r\n 4. 珊瑚类方块。根据珊瑚颜色拆分成独立方块\r\n 5. 地毯类方块。根据地毯颜色拆分成独立方块\r\n 6. 潜影盒类方块。根据潜影盒颜色拆分成独立方块\r\n 7. 混凝土类方块。根据混凝土颜色拆分成独立方块\r\n - 特殊值和方块状态的对应关系见[微软文档](https://learn.microsoft.com/en-us/minecraft/creator/reference/content/blockreference/examples/auxvaluetoblockstatemap?view=minecraft-bedrock-stable)", + "return": [], + "description": "根据方块名称和方块附加值AuxValue获取方块状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块状态与附加值.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockState(levelId)\r\nstates = comp.GetBlockStatesFromAuxValue('minecraft:sapling', 9)", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块名称" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块附加值AuxValue" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockState(levelId)\r\nstates = comp.GetBlockStatesFromAuxValue('minecraft:sapling', 9)" - }, + ], + "type": "api", + "side": "server", + "name": "GetBlockStatesFromAuxValue" + }, { - "type": "api", - "name": "SetBlockStates", - "method": "", - "description": "设置方块状态", - "remark": "- 仅可设置已加载区块内的方块状态,支持设置对应维度的常加载区块内方块状态\r\n - 基岩版1.19更新后,部分包含多个种类的方块(例如,羊毛类,珊瑚类,栅栏类等类型的方块)被拆分成单独的方块identifier及方块附加值,因此原来的方块附加值及方块状态不再适用。请注意尽量使用新的方块identifier,被拆分出来的这些单独的方块可能不会包含任何方块状态,例如橙色羊毛(minecraft:orange_wool)不会包含\"color\"的方块状态。因此无法设置\"color\"状态。\r\n - 截止至基岩版1.20.10,被拆分的方块种类包含:\r\n 1. 羊毛类方块。根据羊毛颜色拆分成独立方块\r\n 2. 原木类方块。根据原木种类拆分成独立方块\r\n 3. 栅栏类方块。根据栅栏种类拆分成独立方块\r\n 4. 珊瑚类方块。根据珊瑚颜色拆分成独立方块\r\n 5. 地毯类方块。根据地毯颜色拆分成独立方块\r\n 6. 潜影盒类方块。根据潜影盒颜色拆分成独立方块\r\n 7. 混凝土类方块。根据混凝土颜色拆分成独立方块", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块状态与附加值.md", + "remark": "- 仅可设置已加载区块内的方块状态,支持设置对应维度的常加载区块内方块状态\r\n - 基岩版1.19更新后,部分包含多个种类的方块(例如,羊毛类,珊瑚类,栅栏类等类型的方块)被拆分成单独的方块identifier及方块附加值,因此原来的方块附加值及方块状态不再适用。请注意尽量使用新的方块identifier,被拆分出来的这些单独的方块可能不会包含任何方块状态,例如橙色羊毛(minecraft:orange_wool)不会包含\"color\"的方块状态。因此无法设置\"color\"状态。\r\n - 截止至基岩版1.20.10,被拆分的方块种类包含:\r\n 1. 羊毛类方块。根据羊毛颜色拆分成独立方块\r\n 2. 原木类方块。根据原木种类拆分成独立方块\r\n 3. 栅栏类方块。根据栅栏种类拆分成独立方块\r\n 4. 珊瑚类方块。根据珊瑚颜色拆分成独立方块\r\n 5. 地毯类方块。根据地毯颜色拆分成独立方块\r\n 6. 潜影盒类方块。根据潜影盒颜色拆分成独立方块\r\n 7. 混凝土类方块。根据混凝土颜色拆分成独立方块", + "return": [], + "description": "设置方块状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块状态与附加值.md", + "example": "# 将白色羊毛设置为橙色羊毛\r\npos = (4,4,3)\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockState(levelId)\r\nstate = comp.GetBlockStates(pos, 0) # state = { 'color': 'white' }\r\nstate['color'] = 'orange'\r\ncomp.SetBlockStates(pos, state, 0)", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "data", - "type": "dict", + "type": "dict", + "name": "data", "description": "方块状态" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "方块所在维度" } - ], - "return": [], - "example": "# 将白色羊毛设置为橙色羊毛\r\npos = (4,4,3)\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockState(levelId)\r\nstate = comp.GetBlockStates(pos, 0) # state = { 'color': 'white' }\r\nstate['color'] = 'orange'\r\ncomp.SetBlockStates(pos, state, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBlockStates" + }, { - "type": "api", - "name": "DeleteBlockInBlockPalette", - "method": "", - "description": "删除方块调色板BlockPalette中某个类型的方块。", - "remark": "- 在删除门或者床的类型方块时,请使用床头的附加值或者门的下半部分的附加值进行删除。使用床尾及门的上半部分的附加值时删除过程将会无效。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "remark": "- 在删除门或者床的类型方块时,请使用床头的附加值或者门的下半部分的附加值进行删除。使用床尾及门的上半部分的附加值时删除过程将会无效。", + "return": [], + "description": "删除方块调色板BlockPalette中某个类型的方块。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\ncount = palette.DeleteBlockInBlockPalette(\"minecraft:grass\", 0)\r\nprint count\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\ncount = palette.DeleteBlockInBlockPalette(\"minecraft:grass\", 0)\r\nprint count", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块名称。" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块附加值。可选参数,默认值为-1。不填写方块附加值时删除所有符合这个名称的方块。" } - ], - "return": [], - "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\ncount = palette.DeleteBlockInBlockPalette(\"minecraft:grass\", 0)\r\nprint count\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\ncount = palette.DeleteBlockInBlockPalette(\"minecraft:grass\", 0)\r\nprint count" - }, + ], + "type": "api", + "side": "client", + "name": "DeleteBlockInBlockPalette" + }, { - "type": "api", - "name": "DeserializeBlockPalette", - "method": "", - "description": "反序列化方块调色板数据字典中的数据,用于方块调色板在客户端及服务端的事件数据之间传输。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "remark": "", + "return": [], + "description": "反序列化方块调色板数据字典中的数据,用于方块调色板在客户端及服务端的事件数据之间传输。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "example": "# 客户端调用\r\n# 事件回调函数中\r\ndef onGetBlockPalette(self, data):\r\n dataDict = data['data']\r\n comp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\n newPalette = comp.GetBlankBlockPalette()\r\n newPalette.DeserializeBlockPalette(dataDict)\r\n\r\n# 服务端调用\r\n# 事件回调函数中\r\ndef onGetBlockPalette(self, data):\r\n dataDict = data['data']\r\n comp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\n newPalette = comp.GetBlankBlockPalette()\r\n newPalette.DeserializeBlockPalette(dataDict)", "params": [ { - "name": "dataDict", - "type": "dict", + "type": "dict", + "name": "dataDict", "description": "方块调色板数据字典。使用接口SerializeBlockPalette获取。" } - ], - "return": [], - "example": "# 客户端调用\r\n# 事件回调函数中\r\ndef onGetBlockPalette(self, data):\r\n dataDict = data['data']\r\n comp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\n newPalette = comp.GetBlankBlockPalette()\r\n newPalette.DeserializeBlockPalette(dataDict)\r\n\r\n# 服务端调用\r\n# 事件回调函数中\r\ndef onGetBlockPalette(self, data):\r\n dataDict = data['data']\r\n comp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\n newPalette = comp.GetBlankBlockPalette()\r\n newPalette.DeserializeBlockPalette(dataDict)" - }, + ], + "type": "api", + "side": "client", + "name": "DeserializeBlockPalette" + }, { - "type": "api", - "name": "GetBlockCountInBlockPalette", - "method": "", - "description": "获取方块调色板BlockPalette中某个类型的方块的数量。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "remark": "", + "return": [], + "description": "获取方块调色板BlockPalette中某个类型的方块的数量。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\ncount = palette.GetBlockCountInBlockPalette(\"minecraft:grass\", 0)\r\nprint count\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\ncount = palette.GetBlockCountInBlockPalette(\"minecraft:grass\", 0)\r\nprint count", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块名称" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块附加值。可选参数,默认值为-1。不填写方块附加值时获取所有符合这个名称的方块的数量。" } - ], - "return": [], - "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\ncount = palette.GetBlockCountInBlockPalette(\"minecraft:grass\", 0)\r\nprint count\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\ncount = palette.GetBlockCountInBlockPalette(\"minecraft:grass\", 0)\r\nprint count" - }, + ], + "type": "api", + "side": "client", + "name": "GetBlockCountInBlockPalette" + }, { - "type": "api", - "name": "GetLocalPosListOfBlocks", - "method": "", - "description": "获取方块调色板中某种方块的相对位置列表。方块调色板记录了多个方块组成的一个三维空间下的方块组合,而相对位置则指的是,以这些方块中最小坐标的方块所在位置作为原点的坐标轴下的相对位置。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "remark": "", + "return": [], + "description": "获取方块调色板中某种方块的相对位置列表。方块调色板记录了多个方块组成的一个三维空间下的方块组合,而相对位置则指的是,以这些方块中最小坐标的方块所在位置作为原点的坐标轴下的相对位置。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\nresult = palette.GetLocalPosListOfBlocks(\"minecraft:grass\")\r\nprint result\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\nresult = palette.GetLocalPosListOfBlocks(\"minecraft:grass\")\r\nprint result", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块名称。" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "方块附加值。可选参数,默认值为-1。不填写方块附加值时则获取所有符合这个方块名称的方块的相对位置列表。" } - ], - "return": [], - "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\nresult = palette.GetLocalPosListOfBlocks(\"minecraft:grass\")\r\nprint result\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\nresult = palette.GetLocalPosListOfBlocks(\"minecraft:grass\")\r\nprint result" - }, + ], + "type": "api", + "side": "client", + "name": "GetLocalPosListOfBlocks" + }, { - "type": "api", - "name": "GetVolumeOfBlockPalette", - "method": "", - "description": "获取方块调色板BlockPalette所占据的长方体的长宽高。长指的是在方块调色板BlockPalette在世界坐标中占据的x轴方向的长度,宽指的是z轴方向的长度,高指的是y轴方向的长度。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", - "params": [], - "return": [], - "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\nresult = palette.GetVolumeOfBlockPalette()\r\nprint result\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\nresult = palette.GetVolumeOfBlockPalette()\r\nprint result" - }, + "remark": "", + "return": [], + "description": "获取方块调色板BlockPalette所占据的长方体的长宽高。长指的是在方块调色板BlockPalette在世界坐标中占据的x轴方向的长度,宽指的是z轴方向的长度,高指的是y轴方向的长度。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\nresult = palette.GetVolumeOfBlockPalette()\r\nprint result\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\nresult = palette.GetVolumeOfBlockPalette()\r\nprint result", + "params": [], + "type": "api", + "side": "client", + "name": "GetVolumeOfBlockPalette" + }, { - "type": "api", - "name": "ReplaceAirByStructureVoid", - "method": "", - "description": "设置是否将方块调色板BlockPalette中所有空气替换为结构空位。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "remark": "", + "return": [], + "description": "设置是否将方块调色板BlockPalette中所有空气替换为结构空位。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\nprint palette.ReplaceAirByStructureVoid(True)\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\nprint palette.ReplaceAirByStructureVoid(True)", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否将空气方块替换为结构空位。True为替换为结构空位,False为使用空气方块" } - ], - "return": [], - "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\nprint palette.ReplaceAirByStructureVoid(True)\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\nprint palette.ReplaceAirByStructureVoid(True)" - }, + ], + "type": "api", + "side": "client", + "name": "ReplaceAirByStructureVoid" + }, { - "type": "api", - "name": "ReplaceBlockInBlockPalette", - "method": "", - "description": "替换方块调色板BlockPalette中某个类型的方块。", - "remark": "- 注意,在替换方块时,如果新的方块使用的是床方块以及床尾的附加值,或者是门方块以及的门的上半部分方块的附加值时,则该替换过程将会被忽略,请使用床头或门的下半部分的附加值进行替换。同理,被替换的方块也请使用床头或者门的上半部分的附加值。\r\n - 注意,在使用床方块以及床头的附加值,或者是门方块以及门的下半部分的附加值替换其他方块后,使用接口SetBlockByBlockPalette设置该调色板时,如果床尾位置或者门的上半部分存在其他方块调色板中的方块,将会造成冲突,冲突的处理方式会按照接口SetBlockByBlockPalette中的冲突模式参数进行处理。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "remark": "- 注意,在替换方块时,如果新的方块使用的是床方块以及床尾的附加值,或者是门方块以及的门的上半部分方块的附加值时,则该替换过程将会被忽略,请使用床头或门的下半部分的附加值进行替换。同理,被替换的方块也请使用床头或者门的上半部分的附加值。\r\n - 注意,在使用床方块以及床头的附加值,或者是门方块以及门的下半部分的附加值替换其他方块后,使用接口SetBlockByBlockPalette设置该调色板时,如果床尾位置或者门的上半部分存在其他方块调色板中的方块,将会造成冲突,冲突的处理方式会按照接口SetBlockByBlockPalette中的冲突模式参数进行处理。", + "return": [], + "description": "替换方块调色板BlockPalette中某个类型的方块。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\ncount = palette.ReplaceBlockInBlockPalette(\"minecraft:vine\", 4,\"minecraft:grass\", 0)\r\nprint count\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\ncount = palette.ReplaceBlockInBlockPalette(\"minecraft:vine\", 4,\"minecraft:grass\", 0)\r\nprint count", "params": [ { - "name": "newblockName", - "type": "str", + "type": "str", + "name": "newblockName", "description": "新的方块名称。" - }, + }, { - "name": "newBlockAux", - "type": "int", + "type": "int", + "name": "newBlockAux", "description": "新的方块的附加值。" - }, + }, { - "name": "oldBlockName", - "type": "str", + "type": "str", + "name": "oldBlockName", "description": "将要被替换的方块名称。" - }, + }, { - "name": "oldBlockAux", - "type": "int", + "type": "int", + "name": "oldBlockAux", "description": "将要被替换的方块名称的附加值。可选参数。不填写附加值时将替换所有符合这个名称的方块。" } - ], - "return": [], - "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\ncount = palette.ReplaceBlockInBlockPalette(\"minecraft:vine\", 4,\"minecraft:grass\", 0)\r\nprint count\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\npalette = comp.GetBlockPaletteBetweenPos(0, (200,64,200),(201,65,202))\r\ncount = palette.ReplaceBlockInBlockPalette(\"minecraft:vine\", 4,\"minecraft:grass\", 0)\r\nprint count" - }, + ], + "type": "api", + "side": "client", + "name": "ReplaceBlockInBlockPalette" + }, { - "type": "api", - "name": "SerializeBlockPalette", - "method": "", - "description": "序列化方块调色板中的数据,用于方块调色板在客户端及服务端的事件数据之间传输。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", - "params": [], - "return": [], - "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\nsourcePalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\ndataDict = sourcePalette.SerializeBlockPalette()\r\n# 用于在事件中传递方块调色板数据\r\neventData = self.CreateEventData()\r\neventData['data'] = dataDict\r\nself.NotifyToServer(modConfig.GetBlockPaletteEvent, eventData)\r\n\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\nsourcePalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\ndataDict = sourcePalette.SerializeBlockPalette()\r\n# 用于在事件中传递方块调色板数据\r\neventData = self.CreateEventData()\r\neventData['data'] = dataDict\r\nself.NotifyToClient(modConfig.GetBlockPaletteEvent, eventData)" - }, + "remark": "", + "return": [], + "description": "序列化方块调色板中的数据,用于方块调色板在客户端及服务端的事件数据之间传输。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/方块调色板.md", + "example": "# 客户端调用\r\nimport mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlock(levelId)\r\nsourcePalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\ndataDict = sourcePalette.SerializeBlockPalette()\r\n# 用于在事件中传递方块调色板数据\r\neventData = self.CreateEventData()\r\neventData['data'] = dataDict\r\nself.NotifyToServer(modConfig.GetBlockPaletteEvent, eventData)\r\n\r\n# 服务端调用\r\nimport mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlock(levelId)\r\nsourcePalette = comp.GetBlockPaletteBetweenPos((200,64,200),(201,65,202))\r\ndataDict = sourcePalette.SerializeBlockPalette()\r\n# 用于在事件中传递方块调色板数据\r\neventData = self.CreateEventData()\r\neventData['data'] = dataDict\r\nself.NotifyToClient(modConfig.GetBlockPaletteEvent, eventData)", + "params": [], + "type": "api", + "side": "client", + "name": "SerializeBlockPalette" + }, { - "type": "api", - "name": "AddDropItemToWorld", - "method": "", - "description": "在客户端添加一个掉落物渲染", - "remark": "- 当掉落物是可合堆时,若count大于1会渲染已合堆的掉落物", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "remark": "- 当掉落物是可合堆时,若count大于1会渲染已合堆的掉落物", + "return": [], + "description": "在客户端添加一个掉落物渲染", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(clientApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n}\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(levelId)\r\n# 即在维度为0,位置为(10,10,10),生成一个不会上下移动,旋转方向与原版相反,旋转速度为原版两倍的附魔弓\r\ncomp.AddDropItemToWorld(itemDict, 0, (10,10,10), 0, -2)", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "dimension_id", - "type": "int", + "type": "int", + "name": "dimension_id", "description": "生成的掉落物所在维度" - }, + }, { - "name": "position", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "position", "description": "生成的掉落物所在位置" - }, + }, { - "name": "bobSpeed", - "type": "float", + "type": "float", + "name": "bobSpeed", "description": "单位时间上下移动的距离,负数为向下移动,填2即为原版两倍上下移动速度,不填默认为0" - }, + }, { - "name": "spinSpeed", - "type": "float", + "type": "float", + "name": "spinSpeed", "description": "单位时间旋转的速度,负数为反方向,填-2即为原版两倍反方向旋转速度,不填默认为0" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(clientApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n}\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(levelId)\r\n# 即在维度为0,位置为(10,10,10),生成一个不会上下移动,旋转方向与原版相反,旋转速度为原版两倍的附魔弓\r\ncomp.AddDropItemToWorld(itemDict, 0, (10,10,10), 0, -2)" - }, + ], + "type": "api", + "side": "client", + "name": "AddDropItemToWorld" + }, { - "type": "api", - "name": "ChangeBlockTextures", - "method": "", - "description": "替换方块贴图", - "remark": "- 对纹理会动态变化的方块无效\r\n - 调用此接口后tileName不会发生变化,后续如果想恢复设置,依旧需要用这个tileName\r\n - 贴图的分辨率高度需要为宽度的整数倍", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "remark": "- 对纹理会动态变化的方块无效\r\n - 调用此接口后tileName不会发生变化,后续如果想恢复设置,依旧需要用这个tileName\r\n - 贴图的分辨率高度需要为宽度的整数倍", + "return": [], + "description": "替换方块贴图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n#设置朝上的面的贴图为work_block_other\r\nprint(comp.ChangeBlockTextures(\"myblock:work_block:0\", \"myblock:work_block_faceup\", \"textures/blocks/work_block_other\"))\r\n#恢复朝上的面的贴图\r\n#print(comp.ChangeBlockTextures(\"myblock:work_block:0\", \"myblock:work_block_faceup\", \"textures/blocks/work_block_faceup\"))", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块标识符,格式[namespace:name:auxvalue],auxvalue默认为0; 只支持普通的没有特殊渲染逻辑的方形方块,否则可能会显示异常" - }, + }, { - "name": "tileName", - "type": "str", + "type": "str", + "name": "tileName", "description": "原贴图在图集中对应的名字,对应terrain_texture.json中的配置" - }, + }, { - "name": "texturePath", - "type": "str", + "type": "str", + "name": "texturePath", "description": "打算替换成的贴图的路径" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n#设置朝上的面的贴图为work_block_other\r\nprint(comp.ChangeBlockTextures(\"myblock:work_block:0\", \"myblock:work_block_faceup\", \"textures/blocks/work_block_other\"))\r\n#恢复朝上的面的贴图\r\n#print(comp.ChangeBlockTextures(\"myblock:work_block:0\", \"myblock:work_block_faceup\", \"textures/blocks/work_block_faceup\"))" - }, + ], + "type": "api", + "side": "client", + "name": "ChangeBlockTextures" + }, { - "type": "api", - "name": "DeleteClientDropItemEntity", - "method": "", - "description": "删除AddDropItemToWorld创建的客户端掉落物", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "remark": "", + "return": [], + "description": "删除AddDropItemToWorld创建的客户端掉落物", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(levelId)\r\nprint comp.DeleteClientDropItemEntity(entityId)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "掉落物的entityId,entityId可在调用[AddDropItemToWorld](#AddDropItemToWorld)时保存返回值,或者通过[GetClientDropItemEntityIdList](#GetClientDropItemEntityIdList)接口获取list" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(levelId)\r\nprint comp.DeleteClientDropItemEntity(entityId)" - }, + ], + "type": "api", + "side": "client", + "name": "DeleteClientDropItemEntity" + }, { - "type": "api", - "name": "GetBlockEntityExtraUniforms", - "method": "", - "description": "获取在自定义方块实体的shader当中使用的自定义变量的值,该自定义变量总共可设置EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "remark": "", + "return": [], + "description": "获取在自定义方块实体的shader当中使用的自定义变量的值,该自定义变量总共可设置EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 获取坐标位于(100,66,100)的自定义方块实体的自定义变量EXTRA_ACTOR_UNIFORM2的值\r\nprint comp.GetBlockEntityExtraUniforms((100,66,100), 2)\r\n# 获取坐标位于(100,66,101)的自定义方块实体的自定义变量EXTRA_ACTOR_UNIFORM4的值\r\nprint comp.SetBlockEntityExtraUniforms((100,66,101), 4)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块实体所在位置" - }, + }, { - "name": "uniformIndex", - "type": "int", + "type": "int", + "name": "uniformIndex", "description": "需要设置的自定义变量的下标,值范围为1~4。分别对应EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 获取坐标位于(100,66,100)的自定义方块实体的自定义变量EXTRA_ACTOR_UNIFORM2的值\r\nprint comp.GetBlockEntityExtraUniforms((100,66,100), 2)\r\n# 获取坐标位于(100,66,101)的自定义方块实体的自定义变量EXTRA_ACTOR_UNIFORM4的值\r\nprint comp.SetBlockEntityExtraUniforms((100,66,101), 4)" - }, + ], + "type": "api", + "side": "client", + "name": "GetBlockEntityExtraUniforms" + }, { - "type": "api", - "name": "GetBlockRenderDistance", - "method": "", - "description": "获取玩家周围的可渲染距离", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nprint comp.GetBlockRenderDistance()" - }, + "remark": "", + "return": [], + "description": "获取玩家周围的可渲染距离", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\nprint comp.GetBlockRenderDistance()", + "params": [], + "type": "api", + "side": "client", + "name": "GetBlockRenderDistance" + }, { - "type": "api", - "name": "GetBlockTextures", - "method": "", - "description": "获取方块的初始贴图信息", - "remark": "- name为贴图在图集中对应的名字,方块所用的贴图名字见blocks.json\r\n - 每一个贴图名name在terrain_texture.json中可能存在多个路径,因此该接口也会返回同样多的路径。\r\n - 该接口只作为校验用,获取到的贴图信息为游戏加载后的初始信息,ChangeBlockTextures修改后该接口返回的仍是初始信息。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "remark": "- name为贴图在图集中对应的名字,方块所用的贴图名字见blocks.json\r\n - 每一个贴图名name在terrain_texture.json中可能存在多个路径,因此该接口也会返回同样多的路径。\r\n - 该接口只作为校验用,获取到的贴图信息为游戏加载后的初始信息,ChangeBlockTextures修改后该接口返回的仍是初始信息。", + "return": [], + "description": "获取方块的初始贴图信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ntextureInfoDict = comp.GetBlockTextures(\"customblocks:customblocks_test_ore\")\r\n# textureInfoDict 信息如下\r\n# {\r\n# 'North': {'paths': ['textures/blocks/customblocks_ore'], 'name': 'customblocks:customblocks_test_ore'},\r\n# 'West': {'paths': ['textures/blocks/customblocks_ore'],'name': 'customblocks:customblocks_test_ore'},\r\n# 'Up': {'paths': ['textures/blocks/customblocks_ore'], 'name': 'customblocks:customblocks_test_ore'},\r\n# 'Down': {'paths': ['textures/blocks/customblocks_ore'], 'name': 'customblocks:customblocks_test_ore'},\r\n# 'East': {'paths': ['textures/blocks/customblocks_ore'], 'name': 'customblocks:customblocks_test_ore'},\r\n# 'South': {'paths': ['textures/blocks/customblocks_ore'], 'name': 'customblocks:customblocks_test_ore'}\r\n# }", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块标识符,格式[namespace:name]" - }, + }, { - "name": "face", - "type": "int", + "type": "int", + "name": "face", "description": "需要获取的方块面,参考[Facing枚举](../../枚举值/Facing.md),face默认值为6,此时获取方块所有面的贴图信息" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\ntextureInfoDict = comp.GetBlockTextures(\"customblocks:customblocks_test_ore\")\r\n# textureInfoDict 信息如下\r\n# {\r\n# 'North': {'paths': ['textures/blocks/customblocks_ore'], 'name': 'customblocks:customblocks_test_ore'},\r\n# 'West': {'paths': ['textures/blocks/customblocks_ore'],'name': 'customblocks:customblocks_test_ore'},\r\n# 'Up': {'paths': ['textures/blocks/customblocks_ore'], 'name': 'customblocks:customblocks_test_ore'},\r\n# 'Down': {'paths': ['textures/blocks/customblocks_ore'], 'name': 'customblocks:customblocks_test_ore'},\r\n# 'East': {'paths': ['textures/blocks/customblocks_ore'], 'name': 'customblocks:customblocks_test_ore'},\r\n# 'South': {'paths': ['textures/blocks/customblocks_ore'], 'name': 'customblocks:customblocks_test_ore'}\r\n# }" - }, + ], + "type": "api", + "side": "client", + "name": "GetBlockTextures" + }, { - "type": "api", - "name": "GetClientDropItemEntityIdList", - "method": "", - "description": "获得所有通过AddDropItemToWorld创建的entityId的list", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(levelId)\r\nprint comp.GetClientDropItemEntityIdList()" - }, + "remark": "", + "return": [], + "description": "获得所有通过AddDropItemToWorld创建的entityId的list", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(levelId)\r\nprint comp.GetClientDropItemEntityIdList()", + "params": [], + "type": "api", + "side": "client", + "name": "GetClientDropItemEntityIdList" + }, { - "type": "api", - "name": "SetBlockEntityExtraUniforms", - "method": "", - "description": "设置可在自定义方块实体的shader当中使用的自定义变量的值,该自定义变量总共可设置EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量,向量的默认值为(1.0,1.0,1.0,1.0)。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "remark": "", + "return": [], + "description": "设置可在自定义方块实体的shader当中使用的自定义变量的值,该自定义变量总共可设置EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量,向量的默认值为(1.0,1.0,1.0,1.0)。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 对坐标位于(100,66,100)的自定义方块实体设置自定义变量EXTRA_ACTOR_UNIFORM1的值\r\nprint comp.SetBlockEntityExtraUniforms((100,66,100), 1, (2.5,2.5,2.5,2.5))\r\n# 对坐标位于(100,66,101)的自定义方块实体设置自定义变量EXTRA_ACTOR_UNIFORM3的值\r\nprint comp.SetBlockEntityExtraUniforms((100,66,101), 3, (2.5,2.5,2.5,2.5))\r\n# 接下来,我们找到这个自定义方块实体所使用的材质,在其中定义的vertex shader或是fragment shader中做如下声明及使用:\r\n#\r\n# // .. 省略其他代码\r\n# // 声明这两个自定义变量\r\n# uniform vec4 EXTRA_ACTOR_UNIFORM1;\r\n# uniform vec4 EXTRA_ACTOR_UNIFORM3;\r\n#\r\n# void main() {\r\n# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM1;\r\n# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM3;\r\n# // .. do what you want ..\r\n# }", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块实体所在位置" - }, + }, { - "name": "uniformIndex", - "type": "int", + "type": "int", + "name": "uniformIndex", "description": "需要设置的自定义变量的下标,值范围为1~4。分别对应EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4。" - }, + }, { - "name": "data", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "data", "description": "需要设置的自定义变量的值。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 对坐标位于(100,66,100)的自定义方块实体设置自定义变量EXTRA_ACTOR_UNIFORM1的值\r\nprint comp.SetBlockEntityExtraUniforms((100,66,100), 1, (2.5,2.5,2.5,2.5))\r\n# 对坐标位于(100,66,101)的自定义方块实体设置自定义变量EXTRA_ACTOR_UNIFORM3的值\r\nprint comp.SetBlockEntityExtraUniforms((100,66,101), 3, (2.5,2.5,2.5,2.5))\r\n# 接下来,我们找到这个自定义方块实体所使用的材质,在其中定义的vertex shader或是fragment shader中做如下声明及使用:\r\n#\r\n# // .. 省略其他代码\r\n# // 声明这两个自定义变量\r\n# uniform vec4 EXTRA_ACTOR_UNIFORM1;\r\n# uniform vec4 EXTRA_ACTOR_UNIFORM3;\r\n#\r\n# void main() {\r\n# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM1;\r\n# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM3;\r\n# // .. do what you want ..\r\n# }" - }, + ], + "type": "api", + "side": "client", + "name": "SetBlockEntityExtraUniforms" + }, { - "type": "api", - "name": "SetBlockEntityFramePosOffset", - "method": "", - "description": "设置自定义方块实体中序列帧特效位置偏移值,用于调整序列帧特效相对于方块位置的偏移。与特效/序列帧/SetPos接口不同,该接口调整的是相对于方块位置的位置偏移值,而不是世界坐标。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "remark": "", + "return": [], + "description": "设置自定义方块实体中序列帧特效位置偏移值,用于调整序列帧特效相对于方块位置的偏移。与特效/序列帧/SetPos接口不同,该接口调整的是相对于方块位置的位置偏移值,而不是世界坐标。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 调整序列帧特效的位置,在方块的位置上向+x轴方向偏移1, +y轴方向偏移2, +z轴方向偏移1\r\ncomp.SetBlockEntityFramePosOffset(pos, \"my_frame1\", (1,2,1))", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "frameKeyName", - "type": "str", + "type": "str", + "name": "frameKeyName", "description": "该序列帧特效的自定义键值名称。" - }, + }, { - "name": "effectPosOffset", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "effectPosOffset", "description": "序列帧特效相对于方块位置的x,y,z方向的偏移值" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 调整序列帧特效的位置,在方块的位置上向+x轴方向偏移1, +y轴方向偏移2, +z轴方向偏移1\r\ncomp.SetBlockEntityFramePosOffset(pos, \"my_frame1\", (1,2,1))" - }, + ], + "type": "api", + "side": "client", + "name": "SetBlockEntityFramePosOffset" + }, { - "type": "api", - "name": "SetBlockEntityModelPosOffset", - "method": "", - "description": "设置自定义方块实体的实体模型位置偏移值,用于调整实体模型相对于方块位置的偏移。可通过该接口来调整自定义方块实体的实体模型的位置。只有自定义方块实体定义实体模型才生效,实体模型在resource_pack/entity/下定义,详细可参考自定义方块实体动画的教学文档。", - "remark": "- 在调整实体模型的位置时,注意不要设置模型位置离方块实体的位置过远。如果设置过远,在玩家将屏幕移动到其他地方而看不到方块实体时,实体模型会由于玩家屏幕里不存在该方块实体而停止渲染。在这种情况下,每当玩家屏幕里看不到这个方块实体所在的位置时,实体模型都会消失。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "remark": "- 在调整实体模型的位置时,注意不要设置模型位置离方块实体的位置过远。如果设置过远,在玩家将屏幕移动到其他地方而看不到方块实体时,实体模型会由于玩家屏幕里不存在该方块实体而停止渲染。在这种情况下,每当玩家屏幕里看不到这个方块实体所在的位置时,实体模型都会消失。", + "return": [], + "description": "设置自定义方块实体的实体模型位置偏移值,用于调整实体模型相对于方块位置的偏移。可通过该接口来调整自定义方块实体的实体模型的位置。只有自定义方块实体定义实体模型才生效,实体模型在resource_pack/entity/下定义,详细可参考自定义方块实体动画的教学文档。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 调整模型的位置,偏移值为向+x轴方向偏移1, +y轴方向偏移2, +z轴方向偏移1\r\ncomp.SetBlockEntityModelPosOffset(pos, (1,2,1))", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "modelPosOffset", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "modelPosOffset", "description": "实体模型相对于方块位置的x,y,z方向的偏移值" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 调整模型的位置,偏移值为向+x轴方向偏移1, +y轴方向偏移2, +z轴方向偏移1\r\ncomp.SetBlockEntityModelPosOffset(pos, (1,2,1))" - }, + ], + "type": "api", + "side": "client", + "name": "SetBlockEntityModelPosOffset" + }, { - "type": "api", - "name": "SetBlockEntityModelRotation", - "method": "", - "description": "设置自定义方块实体的实体模型在各个轴上的旋转值,可通过该接口来调整自定义方块实体的实体模型的旋转。只有自定义方块实体定义实体模型才生效,实体模型在resource_pack/entity/下定义,详细可参考自定义方块实体动画的教学文档。", - "remark": "- 在调整旋转角度时,注意旋转的顺序和角度的设置,避免出现万向锁的问题。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "remark": "- 在调整旋转角度时,注意旋转的顺序和角度的设置,避免出现万向锁的问题。", + "return": [], + "description": "设置自定义方块实体的实体模型在各个轴上的旋转值,可通过该接口来调整自定义方块实体的实体模型的旋转。只有自定义方块实体定义实体模型才生效,实体模型在resource_pack/entity/下定义,详细可参考自定义方块实体动画的教学文档。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 调整模型旋转,绕x轴旋转30度\r\ncomp.SetBlockEntityModelRotation(pos, 30, \"x\")\r\n# 调整模型旋转,绕y轴旋转30度\r\ncomp.SetBlockEntityModelRotation(pos, 30, \"y\")\r\n# 调整模型旋转,绕z轴旋转30度\r\ncomp.SetBlockEntityModelRotation(pos, 30, \"z\")", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "angles", - "type": "float", + "type": "float", + "name": "angles", "description": "旋转角度,范围为[-360,360]。" - }, + }, { - "name": "rotateAxis", - "type": "str", + "type": "str", + "name": "rotateAxis", "description": "旋转轴,绕该轴进行旋转,该参数仅支持填写以下三个值之一: \"x\", \"y\", \"z\",大小写均可。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 调整模型旋转,绕x轴旋转30度\r\ncomp.SetBlockEntityModelRotation(pos, 30, \"x\")\r\n# 调整模型旋转,绕y轴旋转30度\r\ncomp.SetBlockEntityModelRotation(pos, 30, \"y\")\r\n# 调整模型旋转,绕z轴旋转30度\r\ncomp.SetBlockEntityModelRotation(pos, 30, \"z\")" - }, + ], + "type": "api", + "side": "client", + "name": "SetBlockEntityModelRotation" + }, { - "type": "api", - "name": "SetBlockEntityModelScale", - "method": "", - "description": "设置自定义方块实体的实体模型大小的缩放值,可通过该接口来调整自定义方块实体的实体模型的大小。只有自定义方块实体定义实体模型才生效,实体模型在resource_pack/entity/下定义,详细可参考自定义方块实体动画的教学文档。", - "remark": "- 模型的大小可以通过两个方式来调整:\r\n (1) 在entity.json中scripts字段下定义scale,如下所示\r\n \"minecraft:client_entity\": {\r\n ...\r\n \"scripts\":{\r\n // 整体模型大小缩放值,定义了\"scale\"之后scalex,scaley,scalez将无效\r\n \"scale\" : \"0.9375\",\r\n // 对三个轴方向的缩放值。注释掉上方\"scale\", 以下三个缩放值将生效。\r\n \"scalex\": \"0.9375\",\r\n \"scaley\": \"0.9375\",\r\n \"scalez\": \"0.9375\",\r\n ...\r\n }\r\n }\r\n (2) 使用本接口SetBlockEntityModelScale来设置模型缩放值。\r\n 以上两种方式,第一种方式是对所有的使用这个模型的方块实体生效,第二种方式是对指定的方块实体的模型生效。如果同时使用了第一种方式以及第二种方式来调整模型大小,则模型会先按照第一种方式来进行缩放,再按照第二种方式来进行缩放。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "remark": "- 模型的大小可以通过两个方式来调整:\r\n (1) 在entity.json中scripts字段下定义scale,如下所示\r\n \"minecraft:client_entity\": {\r\n ...\r\n \"scripts\":{\r\n // 整体模型大小缩放值,定义了\"scale\"之后scalex,scaley,scalez将无效\r\n \"scale\" : \"0.9375\",\r\n // 对三个轴方向的缩放值。注释掉上方\"scale\", 以下三个缩放值将生效。\r\n \"scalex\": \"0.9375\",\r\n \"scaley\": \"0.9375\",\r\n \"scalez\": \"0.9375\",\r\n ...\r\n }\r\n }\r\n (2) 使用本接口SetBlockEntityModelScale来设置模型缩放值。\r\n 以上两种方式,第一种方式是对所有的使用这个模型的方块实体生效,第二种方式是对指定的方块实体的模型生效。如果同时使用了第一种方式以及第二种方式来调整模型大小,则模型会先按照第一种方式来进行缩放,再按照第二种方式来进行缩放。", + "return": [], + "description": "设置自定义方块实体的实体模型大小的缩放值,可通过该接口来调整自定义方块实体的实体模型的大小。只有自定义方块实体定义实体模型才生效,实体模型在resource_pack/entity/下定义,详细可参考自定义方块实体动画的教学文档。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 调整模型大小为x轴方向放大为原来的2倍,y轴方向放大为原来的2倍,z轴方向缩小为原来的0.5倍\r\ncomp.SetBlockEntityModelScale(pos, (2,2,0.5))", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "scale", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "scale", "description": "实体模型在x,y,z各个轴上的缩放值。支持负值,当某一轴的缩放值为负值时,表示模型将会在这个轴上进行以另外两个轴为对称平面的镜像变换。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 调整模型大小为x轴方向放大为原来的2倍,y轴方向放大为原来的2倍,z轴方向缩小为原来的0.5倍\r\ncomp.SetBlockEntityModelScale(pos, (2,2,0.5))" - }, + ], + "type": "api", + "side": "client", + "name": "SetBlockEntityModelScale" + }, { - "type": "api", - "name": "SetBlockEntityParticlePosOffset", - "method": "", - "description": "设置自定义方块实体中粒子特效位置偏移值,用于调整粒子特效相对于方块位置的偏移。与特效/粒子/SetPos接口不同,该接口调整的是相对于方块位置的位置偏移值,而不是世界坐标。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "remark": "", + "return": [], + "description": "设置自定义方块实体中粒子特效位置偏移值,用于调整粒子特效相对于方块位置的偏移。与特效/粒子/SetPos接口不同,该接口调整的是相对于方块位置的位置偏移值,而不是世界坐标。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 调整粒子特效的位置,在方块的位置上向+x轴方向偏移1, +y轴方向偏移2, +z轴方向偏移1\r\ncomp.SetBlockEntityParticlePosOffset(pos, \"my_particle1\", (1,2,1))", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块所在位置" - }, + }, { - "name": "particleKeyName", - "type": "str", + "type": "str", + "name": "particleKeyName", "description": "该粒子特效的自定义键值名称。" - }, + }, { - "name": "effectPosOffset", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "effectPosOffset", "description": "粒子特效相对于方块位置的x,y,z方向的偏移值" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 调整粒子特效的位置,在方块的位置上向+x轴方向偏移1, +y轴方向偏移2, +z轴方向偏移1\r\ncomp.SetBlockEntityParticlePosOffset(pos, \"my_particle1\", (1,2,1))" - }, + ], + "type": "api", + "side": "client", + "name": "SetBlockEntityParticlePosOffset" + }, { - "type": "api", - "name": "SetBlockRenderDistance", - "method": "", - "description": "设置玩家周围方块的可渲染距离", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "remark": "", + "return": [], + "description": "设置玩家周围方块的可渲染距离", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 设置方块的可渲染距离为48\r\nprint comp.SetBlockRenderDistance(48)", "params": [ { - "name": "distance", - "type": "float", + "type": "float", + "name": "distance", "description": "区块的可渲染距离,有效值范围为大于等于16,传入无效值则使用原版游戏内的能见度,能见度区块数x与渲染距离dis的换算方法约为dis = x*16 + 13.8564。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId)\r\n# 设置方块的可渲染距离为48\r\nprint comp.SetBlockRenderDistance(48)" - }, + ], + "type": "api", + "side": "client", + "name": "SetBlockRenderDistance" + }, { - "type": "api", - "name": "GetBlockPoweredState", - "method": "", - "description": "获取某个坐标方块的充能状态", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/红石.md", + "remark": "", + "return": [], + "description": "获取某个坐标方块的充能状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/红石.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRedStone(levelId)\r\ncomp.GetBlockPoweredState((1,1,1), 0)", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "方块坐标位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "目标维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRedStone(levelId)\r\ncomp.GetBlockPoweredState((1,1,1), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetBlockPoweredState" + }, { - "type": "api", - "name": "GetStrength", - "method": "", - "description": "获取某个坐标的红石信号强度", - "remark": "- 可获取对应维度的常加载区块内红石信号强度", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/方块/红石.md", + "remark": "- 可获取对应维度的常加载区块内红石信号强度", + "return": [], + "description": "获取某个坐标的红石信号强度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/方块/红石.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRedStone(levelId)\r\ncomp.GetStrength((1,1,1), 0)", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "坐标位置" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "目标维度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRedStone(levelId)\r\ncomp.GetStrength((1,1,1), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetStrength" + }, { - "type": "event", - "name": "BindItemToBone", - "method": "", - "description": "将使用了骨骼模型的玩家的手持物绑定到指定的骨骼上", - "remark": "- 旋转顺序为:先绕z轴的顺时针方向、再绕x轴的顺时针方向、最后绕y轴的逆时针方向\r\n - 如果需要[SetLegacyBindRot](#setlegacybindrot),需先调用SetLegacyBindRot,再调用本接口", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 旋转顺序为:先绕z轴的顺时针方向、再绕x轴的顺时针方向、最后绕y轴的逆时针方向\r\n - 如果需要[SetLegacyBindRot](#setlegacybindrot),需先调用SetLegacyBindRot,再调用本接口", + "return": [], + "description": "将使用了骨骼模型的玩家的手持物绑定到指定的骨骼上", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "指定挂接的骨骼模型id" - }, + }, { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "指定骨骼模型的骨骼名" - }, + }, { - "name": "bindSlot", - "type": "int", + "type": "int", + "name": "bindSlot", "description": "绑定手持物的slot,0为主手,1为副手,默认值为0" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "偏移量,默认值为(0,0,0)" - }, + }, { - "name": "rotation", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rotation", "description": "旋转角度,默认值为(0,0,0)" - }, + }, { - "name": "scale", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "scale", "description": "缩放,默认值为(1,1,1)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "BindItemToBone" + }, { - "type": "event", - "name": "BindModelToEntity", - "method": "", - "description": "实体替换骨骼模型后,再往上挂接其他骨骼模型。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "实体替换骨骼模型后,再往上挂接其他骨骼模型。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "挂接的骨骼名称" - }, + }, { - "name": "modelName", - "type": "str", + "type": "str", + "name": "modelName", "description": "要挂接的骨骼模型名称" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "偏移量" - }, + }, { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "旋转" - }, + }, { - "name": "scale", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "scale", "description": "缩放" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "BindModelToEntity" + }, { - "type": "event", - "name": "BindModelToModel", - "method": "", - "description": "在骨骼模型上挂接其他骨骼模型", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "在骨骼模型上挂接其他骨骼模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "挂接的骨骼名称" - }, + }, { - "name": "modelName", - "type": "str", + "type": "str", + "name": "modelName", "description": "要挂接的骨骼模型名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "BindModelToModel" + }, { - "type": "event", - "name": "CancelAllBoneMask", - "method": "", - "description": "取消动画中的所有骨骼屏蔽。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "取消动画中的所有骨骼屏蔽。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要设置的模型id,包括实体模型以及自由模型" - }, + }, { - "name": "aniName", - "type": "str", + "type": "str", + "name": "aniName", "description": "动画名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "CancelAllBoneMask" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "CreateFreeModel", - "method": "", - "description": "创建自由的模型(无需绑定Entity)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "创建自由的模型(无需绑定Entity)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelName", - "type": "str", + "type": "str", + "name": "modelName", "description": "模型名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "CreateFreeModel" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "GetAllBindModelToEntity", - "method": "", - "description": "获取实体上某个骨骼上挂接的所有骨骼模型的id", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "获取实体上某个骨骼上挂接的所有骨骼模型的id", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "要获取的骨骼名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetAllBindModelToEntity" + }, { - "type": "event", - "name": "GetAnimLength", - "method": "", - "description": "获取某个骨骼动画的长度,单位为秒", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "获取某个骨骼动画的长度,单位为秒", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "aniName", - "type": "str", + "type": "str", + "name": "aniName", "description": "骨骼动画名称" - }, + }, { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要指定的模型id,默认为None,表示使用CreateModel时传入的entityID挂接的模型" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetAnimLength" + }, { - "type": "event", - "name": "GetBonePositionFromMinecraftObject", - "method": "", - "description": "获取原版模型的骨骼世界坐标", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "获取原版模型的骨骼世界坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "骨骼名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetBonePositionFromMinecraftObject" + }, { - "type": "event", - "name": "GetBoneWorldPos", - "method": "", - "description": "获取骨骼的坐标", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "获取骨骼的坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "骨骼名称" - }, + }, { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要指定的模型id,默认为None,表示使用CreateModel时传入的entityID挂接的模型" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetBoneWorldPos" + }, { - "type": "event", - "name": "GetEntityBoneWorldPos", - "method": "", - "description": "获取换了骨骼模型的实体的骨骼坐标", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "获取换了骨骼模型的实体的骨骼坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" - }, + }, { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "骨骼名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetEntityBoneWorldPos" + }, { - "type": "event", - "name": "GetEntityScale", - "method": "", - "description": "获取实体的放缩比例大小", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取实体的放缩比例大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "GetEntityScale" + }, { - "type": "event", - "name": "GetExtraUniformValue", - "method": "", - "description": "获取在骨骼模型shader中使用的自定义变量Uniform的值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "获取在骨骼模型shader中使用的自定义变量Uniform的值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要查询的骨骼模型modelId" - }, + }, { - "name": "uniformIndex", - "type": "int", + "type": "int", + "name": "uniformIndex", "description": "需要设置的自定义变量的下标,值范围为1~4,分别对应Shader中的EXTRA_VECTOR1,EXTRA_VECTOR2,EXTRA_VECTOR3,EXTRA_VECTOR4" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetExtraUniformValue" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "GetModelId", - "method": "", - "description": "获取骨骼模型的Id,主要用于特效绑定骨骼模型", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取骨骼模型的Id,主要用于特效绑定骨骼模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetModelId" + }, { - "type": "event", - "name": "GetModelMaterial", - "method": "", - "description": "获取骨骼模型的正在使用的材质名称,也可获取骨骼模型中指定骨骼所使用的材质名称。如果获取指定骨骼所使用的材质,需要先在netease_model.json下设置\"useSplitMeshes\"字段为true。", - "remark": "- 如果需要查询的骨骼模型开启了骨骼拆分,即在netease_model.json下设置\"useSplitMeshes\"字段为true后,使用该接口查询骨骼模型的材质时,如果不指定boneName,则此时获取的是本体模型正在使用的材质。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 如果需要查询的骨骼模型开启了骨骼拆分,即在netease_model.json下设置\"useSplitMeshes\"字段为true后,使用该接口查询骨骼模型的材质时,如果不指定boneName,则此时获取的是本体模型正在使用的材质。", + "return": [], + "description": "获取骨骼模型的正在使用的材质名称,也可获取骨骼模型中指定骨骼所使用的材质名称。如果获取指定骨骼所使用的材质,需要先在netease_model.json下设置\"useSplitMeshes\"字段为true。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要进行设置材质操作的骨骼模型Id。" - }, + }, { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "骨骼模型中的骨骼名称。默认值为空字符串。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetModelMaterial" + }, { - "type": "event", - "name": "GetModelName", - "method": "", - "description": "获取实体的模型名称", - "remark": "- 在服务端获取,客户端不生效", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 在服务端获取,客户端不生效", + "return": [], + "description": "获取实体的模型名称", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "GetModelName" + }, { - "type": "event", - "name": "GetModelStyle", - "method": "", - "description": "获取模型类型", - "remark": "- 当玩家的模型被个性化皮肤、接口等修改为非Steve、Alex的其他类型后,返回custom。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 当玩家的模型被个性化皮肤、接口等修改为非Steve、Alex的其他类型后,返回custom。", + "return": [], + "description": "获取模型类型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetModelStyle" + }, { - "type": "event", - "name": "GetPlayingAnimList", - "method": "", - "description": "获取指定的骨骼模型中正处于播放状态的骨骼动画名称列表", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "获取指定的骨骼模型中正处于播放状态的骨骼动画名称列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "骨骼模型Id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetPlayingAnimList" + }, { - "type": "event", - "name": "GetTexture", - "method": "", - "description": "获取骨骼模型的贴图路径", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "获取骨骼模型的贴图路径", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要指定的模型id,默认为None,表示使用CreateModel时传入的entityID挂接的模型" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetTexture" + }, { - "type": "event", - "name": "HideModel", - "method": "", - "description": "隐藏纯模型", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "隐藏纯模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "要隐藏的modelId" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HideModel" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "ModelPlayAni", - "method": "", - "description": "纯骨骼播放动作。 支持骨骼动画混合,可参考SetAnimationBoneMask接口以及RegisterAnim1DControlParam接口说明。", - "remark": "- 在动画的层级相同的情况下,动画的优先度播放顺序则首先按照:1.是否与需要其他动画进行混合。2.是否率先播放 这两个因素来先后决定。例如,我们首先对动画A,动画B使用接口RegisterAnim1DControlParam注册1D线性混合参数alpha, 然后对动画A和动画C使用接口RegisterAnim1DControlParam注册线性混合参数beta。接着,先后播放动画A, 动画C,动画B,动画D。这时,由于动画A,动画C具有混合需要,并且率先播放,因此骨骼模型会率先播放动画A和动画C的混合动画(注意,1D线性混合参数的初始值为0,因此此时混合动画的表现还是动画A),如果此时再暂停动画C,则会播放动画A与动画B的混合动画。接着暂停动画B,则会播放动画A,最后再暂停动画A,则才会播放动画D。\r\n - 如动画需要参与混合,必须将isBlended设为True,否则可能会出现调用RegisterAnim1DControlParam或RegisterAnim1DMultiControlParam接口返回值异常或功能失效的情况", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 在动画的层级相同的情况下,动画的优先度播放顺序则首先按照:1.是否与需要其他动画进行混合。2.是否率先播放 这两个因素来先后决定。例如,我们首先对动画A,动画B使用接口RegisterAnim1DControlParam注册1D线性混合参数alpha, 然后对动画A和动画C使用接口RegisterAnim1DControlParam注册线性混合参数beta。接着,先后播放动画A, 动画C,动画B,动画D。这时,由于动画A,动画C具有混合需要,并且率先播放,因此骨骼模型会率先播放动画A和动画C的混合动画(注意,1D线性混合参数的初始值为0,因此此时混合动画的表现还是动画A),如果此时再暂停动画C,则会播放动画A与动画B的混合动画。接着暂停动画B,则会播放动画A,最后再暂停动画A,则才会播放动画D。\r\n - 如动画需要参与混合,必须将isBlended设为True,否则可能会出现调用RegisterAnim1DControlParam或RegisterAnim1DMultiControlParam接口返回值异常或功能失效的情况", + "return": [], + "description": "纯骨骼播放动作。 支持骨骼动画混合,可参考SetAnimationBoneMask接口以及RegisterAnim1DControlParam接口说明。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要设置的模型id,包括实体模型以及自由模型。" - }, + }, { - "name": "aniName", - "type": "str", + "type": "str", + "name": "aniName", "description": "要设置的动画名称" - }, + }, { - "name": "isLoop", - "type": "bool", + "type": "bool", + "name": "isLoop", "description": "是否循环播放,默认为 False" - }, + }, { - "name": "isBlended", - "type": "bool", + "type": "bool", + "name": "isBlended", "description": "播放时是与当前动画混合还是中止当前动画的播放,默认False,即中止当前动画播放。设置为True时,将允许即将播放的动画进行混合。注意,动画混合仅在相同层级的动画之间进行。若当前播放的动画与即将播放的动画层级不一样,则isBlended参数无效。" - }, + }, { - "name": "layer", - "type": "int", + "type": "int", + "name": "layer", "description": "设置骨骼动画的层级,范围为0~255,默认为0。注意,如果播放的动画已经存在,则会将原有的动画层级覆盖。动画层级越大,则优先度越高,骨骼模型的骨骼优先播放优先度最高的动画。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ModelPlayAni" + }, { - "type": "event", - "name": "ModelStopAni", - "method": "", - "description": "暂停指定的骨骼动画", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "暂停指定的骨骼动画", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要设置的模型id,包括实体模型以及自由模型" - }, + }, { - "name": "aniName", - "type": "str", + "type": "str", + "name": "aniName", "description": "动画名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ModelStopAni" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "PlayAnim", - "method": "", - "description": "播放骨骼动画", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "播放骨骼动画", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "aniName", - "type": "str", + "type": "str", + "name": "aniName", "description": "动画名称" - }, + }, { - "name": "isLoop", - "type": "bool", + "type": "bool", + "name": "isLoop", "description": "是否循环播放" - }, + }, { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要指定的模型id,默认为None,表示使用CreateModel时传入的entityID挂接的模型" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PlayAnim" + }, { - "type": "event", - "name": "RegisterAnim1DControlParam", - "method": "", - "description": "当同时播放多个骨骼动画时,新建用于控制动画进行1D线性混合的参数。目前线性混合仅支持对两个动画进行混合。新建的参数值范围为[0,1]。指定的骨骼将会按照这个参数的值对两个动画进行线性混合。", - "remark": "- 注意,如果对某个骨骼使用了骨骼屏蔽,则这个1D线性混合将对该骨骼不会生效。另外,如果在使用该接口时新建一个已经存在的参数名称,则会将原来的参数覆盖。\r\n - 在动画的层级相同的情况下,动画的优先度播放顺序则首先按照:1.是否与需要其他动画进行混合。2.是否率先播放 这两个因素来先后决定。例如,我们首先对动画A,动画B使用接口RegisterAnim1DControlParam注册1D线性混合参数alpha, 然后对动画A和动画C使用接口RegisterAnim1DControlParam注册线性混合参数beta。接着,先后播放动画A, 动画C,动画B,动画D。这时,由于动画A,动画C具有混合需要,并且率先播放,因此骨骼模型会率先播放动画A和动画C的混合动画(注意,由于1D线性混合参数的初始值为0,因此此时混合动画的表现还是动画A),如果此时再暂停动画C,则会播放动画A与动画B的混合动画。接着暂停动画B,则会播放动画A,最后再暂停动画A,则才会播放动画D。\r\n - 另一种需要注意的情况:如果我们首先对动画A,动画B使用接口RegisterAnim1DControlParam注册1D线性混合参数alpha, 然后对动画A和动画C使用接口RegisterAnim1DControlParam注册线性混合参数beta。接着,先后播放动画A, 动画B,动画C。这时,我们调用SetAnim1DControlParam接口设置参数beta的值为0.5。此时模型仍然是播放动画A,这是由于动画A和动画B具有混合需求并且率先播放的,即率先凑齐了参数混合两个动画,因此此时模型实际上是在进行动画A和动画B的混合,但是由于alpha的值为0,因此模型还是表现为动画A,如果此时再用SetAnim1DControlParam接口设置参数alpha的值为0.5,则能够看到动画A和动画B的混合动画了。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 注意,如果对某个骨骼使用了骨骼屏蔽,则这个1D线性混合将对该骨骼不会生效。另外,如果在使用该接口时新建一个已经存在的参数名称,则会将原来的参数覆盖。\r\n - 在动画的层级相同的情况下,动画的优先度播放顺序则首先按照:1.是否与需要其他动画进行混合。2.是否率先播放 这两个因素来先后决定。例如,我们首先对动画A,动画B使用接口RegisterAnim1DControlParam注册1D线性混合参数alpha, 然后对动画A和动画C使用接口RegisterAnim1DControlParam注册线性混合参数beta。接着,先后播放动画A, 动画C,动画B,动画D。这时,由于动画A,动画C具有混合需要,并且率先播放,因此骨骼模型会率先播放动画A和动画C的混合动画(注意,由于1D线性混合参数的初始值为0,因此此时混合动画的表现还是动画A),如果此时再暂停动画C,则会播放动画A与动画B的混合动画。接着暂停动画B,则会播放动画A,最后再暂停动画A,则才会播放动画D。\r\n - 另一种需要注意的情况:如果我们首先对动画A,动画B使用接口RegisterAnim1DControlParam注册1D线性混合参数alpha, 然后对动画A和动画C使用接口RegisterAnim1DControlParam注册线性混合参数beta。接着,先后播放动画A, 动画B,动画C。这时,我们调用SetAnim1DControlParam接口设置参数beta的值为0.5。此时模型仍然是播放动画A,这是由于动画A和动画B具有混合需求并且率先播放的,即率先凑齐了参数混合两个动画,因此此时模型实际上是在进行动画A和动画B的混合,但是由于alpha的值为0,因此模型还是表现为动画A,如果此时再用SetAnim1DControlParam接口设置参数alpha的值为0.5,则能够看到动画A和动画B的混合动画了。", + "return": [], + "description": "当同时播放多个骨骼动画时,新建用于控制动画进行1D线性混合的参数。目前线性混合仅支持对两个动画进行混合。新建的参数值范围为[0,1]。指定的骨骼将会按照这个参数的值对两个动画进行线性混合。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "骨需要设置的模型id,包括实体模型以及自由模型。" - }, + }, { - "name": "leftAniName", - "type": "str", + "type": "str", + "name": "leftAniName", "description": "混合的第一个动画名称,当1D参数的值为0时指定的骨骼仅播放这个动画。" - }, + }, { - "name": "rightAniName", - "type": "str", + "type": "str", + "name": "rightAniName", "description": "混合的第二个动画名称,当1D参数的值为1时指定的骨骼仅播放这个动画。" - }, + }, { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "自定义的1D参数名称。该参数新建后的初始值为0。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "RegisterAnim1DControlParam" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "RegisterAnim1DMultiControlParam", - "method": "", - "description": "当同时播放多个骨骼动画时,注册用于根据权重控制多动画进行混合的参数", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "当同时播放多个骨骼动画时,注册用于根据权重控制多动画进行混合的参数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "模型id" - }, + }, { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "自定义的多动作混合参数名称" - }, + }, { - "name": "animList", - "type": "list(str)", + "type": "list(str)", + "name": "animList", "description": "需要混合的动作列表" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "RegisterAnim1DMultiControlParam" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "RemoveAnim1DMultiControlParam", - "method": "", - "description": "删除用于根据权重控制多动画进行混合的参数", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "删除用于根据权重控制多动画进行混合的参数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "模型id" - }, + }, { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "自定义的多动作混合参数名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "RemoveAnim1DMultiControlParam" + }, { - "type": "event", - "name": "RemoveFreeModel", - "method": "", - "description": "移除自由模型", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "移除自由模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "要移除的modelId" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "RemoveFreeModel" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "ResetModel", - "method": "", - "description": "恢复实体为原版模型", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "恢复实体为原版模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "ResetModel" + }, { - "type": "event", - "name": "SetAnim1DControlParam", - "method": "", - "description": "新建动画的1D控制参数后,使用该接口对相应的参数进行控制。", - "remark": "- 注意,如果对某个骨骼使用了骨骼屏蔽,则这个1D线性混合将对该骨骼不会生效。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 注意,如果对某个骨骼使用了骨骼屏蔽,则这个1D线性混合将对该骨骼不会生效。", + "return": [], + "description": "新建动画的1D控制参数后,使用该接口对相应的参数进行控制。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要设置的模型id,包括实体模型以及自由模型。" - }, + }, { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "使用接口RegisterAnim1DControlParam所新建的自定义1D参数名称。该参数新建后的初始值为0。" - }, + }, { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "参数的值,范围为[0,1]。当1D参数的值为0时仅播放接口RegisterAnim1DControlParam中的leftAniName参数指定的动画,当1D参数的值为1时仅播放接口RegisterAnim1DControlParam中的rightAniName参数指定的动画" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetAnim1DControlParam" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "SetAnim1DMultiControlParam", - "method": "", - "description": "新建动画的1D控制参数后,设置用于根据权重控制多动画进行混合的参数", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "新建动画的1D控制参数后,设置用于根据权重控制多动画进行混合的参数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "模型id" - }, + }, { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "自定义的多动作混合参数名称" - }, + }, { - "name": "animWeightDict", - "type": "dict", + "type": "dict", + "name": "animWeightDict", "description": "动作权重表,可在表中设置每个动作的混合权重" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetAnim1DMultiControlParam" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "SetAnimLayer", - "method": "", - "description": "设置骨骼动画的层级,动画层级越大,则优先度越高,骨骼模型的骨骼优先播放优先度最高的动画,相同层级的动画则优先播放率先播放的动画。", - "remark": "- 注意,设置层级相同的情况下不会改变当前的优先播放序列。举个例子:当前存在动画A及动画B,动画A的层级为1,动画B的层级为0,此时骨骼模型播放的动画为动画A。如果将动画A的层级设置为0,即动画A及动画B的层级相同,则当前仍然会播放动画A,因为层级相同的情况下不会改变目前的优先播放序列。要想让骨骼模型播放动画B,则需要动画B的层级比动画A的层级高。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 注意,设置层级相同的情况下不会改变当前的优先播放序列。举个例子:当前存在动画A及动画B,动画A的层级为1,动画B的层级为0,此时骨骼模型播放的动画为动画A。如果将动画A的层级设置为0,即动画A及动画B的层级相同,则当前仍然会播放动画A,因为层级相同的情况下不会改变目前的优先播放序列。要想让骨骼模型播放动画B,则需要动画B的层级比动画A的层级高。", + "return": [], + "description": "设置骨骼动画的层级,动画层级越大,则优先度越高,骨骼模型的骨骼优先播放优先度最高的动画,相同层级的动画则优先播放率先播放的动画。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要设置的模型id,包括实体模型以及自由模型" - }, + }, { - "name": "aniName", - "type": "str", + "type": "str", + "name": "aniName", "description": "动画名称" - }, + }, { - "name": "layer", - "type": "int", + "type": "int", + "name": "layer", "description": "动画层级, 正整数,范围为0~255" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetAnimLayer" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "SetAnimSpeed", - "method": "", - "description": "设置某个骨骼动画的播放速度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "设置某个骨骼动画的播放速度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "aniName", - "type": "str", + "type": "str", + "name": "aniName", "description": "骨骼动画名称" - }, + }, { - "name": "speed", - "type": "float", + "type": "float", + "name": "speed", "description": "速度倍率" - }, + }, { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要指定的模型id,默认为None,表示使用CreateModel时传入的entityID挂接的模型" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetAnimSpeed" + }, { - "type": "event", - "name": "SetAnimationAllBoneMask", - "method": "", - "description": "设置是否屏蔽动画中所有骨骼的动画,若开启骨骼屏蔽后,该骨骼将不再播放该动画中的动作。该接口会对该动画中所有骨骼生效,可通过参数ignoreBoneList来指定不受影响的骨骼名称。通过屏蔽指定骨骼的动画可实现同一个骨骼模型同时在不同骨骼上播放不同的动作动画,从而实现快捷的动作融合。", - "remark": "- 在使用该接口屏蔽上下半身的动画时,如果骨骼当中存在root骨骼,并且root骨骼的子骨骼包含上下半身的骨骼的话,root骨骼往往会控制整体骨骼模型的移动,要注意root骨骼对其他骨骼的影响。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 在使用该接口屏蔽上下半身的动画时,如果骨骼当中存在root骨骼,并且root骨骼的子骨骼包含上下半身的骨骼的话,root骨骼往往会控制整体骨骼模型的移动,要注意root骨骼对其他骨骼的影响。", + "return": [], + "description": "设置是否屏蔽动画中所有骨骼的动画,若开启骨骼屏蔽后,该骨骼将不再播放该动画中的动作。该接口会对该动画中所有骨骼生效,可通过参数ignoreBoneList来指定不受影响的骨骼名称。通过屏蔽指定骨骼的动画可实现同一个骨骼模型同时在不同骨骼上播放不同的动作动画,从而实现快捷的动作融合。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要设置的模型id,包括实体模型以及自由模型" - }, + }, { - "name": "aniName", - "type": "str", + "type": "str", + "name": "aniName", "description": "动画名称" - }, + }, { - "name": "ignoreBonesList", - "type": "list(str)", + "type": "list(str)", + "name": "ignoreBonesList", "description": "忽视的骨骼名称列表。在这个列表中的骨骼将不会被影响。输入空列表时则对所有骨骼执行这次设置。" - }, + }, { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否启用该骨骼的动画。True为不屏蔽,启动该骨骼的动画。False为屏蔽,不启动该骨骼的动画。" - }, + }, { - "name": "applyToChild", - "type": "bool", + "type": "bool", + "name": "applyToChild", "description": "True为对ignoreBoneList中的骨骼的子骨骼也生效,False为仅对ignoreBoneList中的骨骼生效,默认为True。若ignoreBoneList为空列表,则applyToChild无效果。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetAnimationAllBoneMask" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "SetAnimationBoneMask", - "method": "", - "description": "设置是否屏蔽动画中指定的骨骼的动画,若开启骨骼屏蔽后,该骨骼将不再播放该动画中的动作。通过屏蔽指定骨骼的动画可实现同一个骨骼模型同时在不同骨骼上播放不同的动作动画,从而实现快捷的动作融合。", - "remark": "- 在使用该接口屏蔽上下半身的动画时,如果骨骼当中存在root骨骼,并且root骨骼的子骨骼包含上下半身的骨骼的话,root骨骼往往会控制整体骨骼模型的移动,要注意root骨骼对其他骨骼的影响。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 在使用该接口屏蔽上下半身的动画时,如果骨骼当中存在root骨骼,并且root骨骼的子骨骼包含上下半身的骨骼的话,root骨骼往往会控制整体骨骼模型的移动,要注意root骨骼对其他骨骼的影响。", + "return": [], + "description": "设置是否屏蔽动画中指定的骨骼的动画,若开启骨骼屏蔽后,该骨骼将不再播放该动画中的动作。通过屏蔽指定骨骼的动画可实现同一个骨骼模型同时在不同骨骼上播放不同的动作动画,从而实现快捷的动作融合。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要设置的模型id,包括实体模型以及自由模型" - }, + }, { - "name": "aniName", - "type": "str", + "type": "str", + "name": "aniName", "description": "动画名称" - }, + }, { - "name": "boneNamesList", - "type": "list(str)", + "type": "list(str)", + "name": "boneNamesList", "description": "骨骼名称列表" - }, + }, { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否启用该骨骼的动画。True为不屏蔽,启动该骨骼的动画。False为屏蔽,不启动该骨骼的动画。" - }, + }, { - "name": "applyToChild", - "type": "bool", + "type": "bool", + "name": "applyToChild", "description": "True为对该骨骼及其子骨骼生效,False为仅对该骨骼生效,默认为True" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetAnimationBoneMask" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "SetBrightness", - "method": "", - "description": "设置实体的亮度", - "remark": "- 目前只支持修改替换了骨骼模型的实体亮度,使用游戏原生模型的实体暂不予支持。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 目前只支持修改替换了骨骼模型的实体亮度,使用游戏原生模型的实体暂不予支持。", + "return": [], + "description": "设置实体的亮度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "brightness", - "type": "float", + "type": "float", + "name": "brightness", "description": "0:纯黑
1:正常亮度
1-14:较亮甚至纯白
超过14:通常为纯白,即使数值改变也没有明显变化" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetBrightness" + }, { - "type": "event", - "name": "SetEntityOpacity", - "method": "", - "description": "设置骨骼模型的透明度,只能对骨骼模型生效,如果设置的是原版模型,则模型的影子会被隐藏。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "设置骨骼模型的透明度,只能对骨骼模型生效,如果设置的是原版模型,则模型的影子会被隐藏。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "opacity", - "type": "float", + "type": "float", + "name": "opacity", "description": "透明度值,取值范围为[0, 1],值越小越透明" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetEntityOpacity" + }, { - "type": "event", - "name": "SetEntityScale", - "method": "", - "description": "设置实体的放缩比例大小,设置比例过大会导致游戏卡顿,建议控制在20倍以内", - "remark": "- 该接口支持设置实体替换骨骼模型后的大小,以及受minecraft:scale组件影响的原版模型(如矿车,三叉戟则无效)\r\n - 使用该接口设置大小后,则不再受minecraft:scale组件控制", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 该接口支持设置实体替换骨骼模型后的大小,以及受minecraft:scale组件影响的原版模型(如矿车,三叉戟则无效)\r\n - 使用该接口设置大小后,则不再受minecraft:scale组件控制", + "return": [], + "description": "设置实体的放缩比例大小,设置比例过大会导致游戏卡顿,建议控制在20倍以内", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "要设置的实体" - }, + }, { - "name": "scale", - "type": "float", + "type": "float", + "name": "scale", "description": "比例因子" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "SetEntityScale" + }, { - "type": "event", - "name": "SetEntityShadowShow", - "method": "", - "description": "设置实体打开/关闭影子渲染", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "设置实体打开/关闭影子渲染", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "flag", - "type": "bool", + "type": "bool", + "name": "flag", "description": "True为打开影子渲染,False为关闭影子渲染" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetEntityShadowShow" + }, { - "type": "event", - "name": "SetExtraUniformValue", - "method": "", - "description": "设置shader中特定Uniform的值", - "remark": "- 若在游戏运行过程中修改shader文件,需要调用clientApi.ReloadAllShaders()或者重启游戏才会生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 若在游戏运行过程中修改shader文件,需要调用clientApi.ReloadAllShaders()或者重启游戏才会生效", + "return": [], + "description": "设置shader中特定Uniform的值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "要设置的modelId" - }, + }, { - "name": "uniformIndex", - "type": "int", + "type": "int", + "name": "uniformIndex", "description": "要设置的uniform下标,目前支持4个,范围为1到4。分别对应Shader中的EXTRA_VECTOR1,EXTRA_VECTOR2,EXTRA_VECTOR3,EXTRA_VECTOR4" - }, + }, { - "name": "vec4data", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "vec4data", "description": "要设置的vec4的值。初始值为(0.0, 0.0, 0.0, 0.0)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetExtraUniformValue" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "SetFreeModelAniSpeed", - "method": "", - "description": "设置自由模型动画的播放速度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "设置自由模型动画的播放速度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "要设置的modelId" - }, + }, { - "name": "aniName", - "type": "str", + "type": "str", + "name": "aniName", "description": "要设置的动画名称" - }, + }, { - "name": "speed", - "type": "float", + "type": "float", + "name": "speed", "description": "播放速度,速度上限为动画帧数,正负数效果相同" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetFreeModelAniSpeed" + }, { - "type": "event", - "name": "SetFreeModelBoundingBox", - "method": "", - "description": "设置自由模型的包围盒", - "remark": "- min的元素一定要比对应的max的元素小。\r\n - 模型包围盒用于判断渲染剔除:判断一个模型要不要渲染,要看它在不在视野范围内,也就是看游戏摄像机的视锥体(摄像机拍到的范围)和这个包围盒有没有交集。有则说明在视野范围内,反之则不在视野范围内。进而可以剔除掉该模型,不进行渲染。\r\n 例如创建的自由模型显示上的大小是3x3x3个方块,那么需要将包围盒大小也设置为3x3x3,否则,如果包围盒比较小,例如使用了默认的1x1x1包围盒,那么当模型处于屏幕的边缘,模型就会不渲染。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- min的元素一定要比对应的max的元素小。\r\n - 模型包围盒用于判断渲染剔除:判断一个模型要不要渲染,要看它在不在视野范围内,也就是看游戏摄像机的视锥体(摄像机拍到的范围)和这个包围盒有没有交集。有则说明在视野范围内,反之则不在视野范围内。进而可以剔除掉该模型,不进行渲染。\r\n 例如创建的自由模型显示上的大小是3x3x3个方块,那么需要将包围盒大小也设置为3x3x3,否则,如果包围盒比较小,例如使用了默认的1x1x1包围盒,那么当模型处于屏幕的边缘,模型就会不渲染。", + "return": [], + "description": "设置自由模型的包围盒", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "要设置的modelId" - }, + }, { - "name": "min", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "min", "description": "包围盒最小点" - }, + }, { - "name": "max", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "max", "description": "包围盒最大点" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetFreeModelBoundingBox" + }, { - "type": "event", - "name": "SetFreeModelPos", - "method": "", - "description": "设置自由模型的位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "设置自由模型的位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "要设置的modelId" - }, + }, { - "name": "x", - "type": "float", + "type": "float", + "name": "x", "description": "要设置的位置X轴参数" - }, + }, { - "name": "y", - "type": "float", + "type": "float", + "name": "y", "description": "要设置的位置Y轴参数" - }, + }, { - "name": "z", - "type": "float", + "type": "float", + "name": "z", "description": "要设置的位置Z轴参数" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetFreeModelPos" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "SetFreeModelRot", - "method": "", - "description": "设置自由模型的方向", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "设置自由模型的方向", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "要设置的modelId" - }, + }, { - "name": "x", - "type": "float", + "type": "float", + "name": "x", "description": "沿X方向的旋转参数" - }, + }, { - "name": "y", - "type": "float", + "type": "float", + "name": "y", "description": "沿Y方向的旋转参数" - }, + }, { - "name": "z", - "type": "float", + "type": "float", + "name": "z", "description": "沿Z方向的旋转参数" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetFreeModelRot" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "SetFreeModelScale", - "method": "", - "description": "设置自由模型的大小", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "设置自由模型的大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "要设置的modelId" - }, + }, { - "name": "x", - "type": "float", + "type": "float", + "name": "x", "description": "沿X方向的比例因子" - }, + }, { - "name": "y", - "type": "float", + "type": "float", + "name": "y", "description": "沿Y方向的比例因子" - }, + }, { - "name": "z", - "type": "float", + "type": "float", + "name": "z", "description": "沿Z方向的比例因子" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetFreeModelScale" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "SetLegacyBindRot", - "method": "", - "description": "用于修复特效挂接到骨骼时的方向", - "remark": "- 在挂接特效前调用即可", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 在挂接特效前调用即可", + "return": [], + "description": "用于修复特效挂接到骨骼时的方向", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "设置为False时,可以使特效与骨骼方向一致" - }, + }, { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要指定的模型id,默认为None,表示使用CreateModel时传入的entityID挂接的模型" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetLegacyBindRot" + }, { - "type": "event", - "name": "SetModel", - "method": "", - "description": "替换实体的骨骼模型", - "remark": "- 要恢复原版模型请使用ResetModel接口\r\n - 使用客户端组件更换模型不会同步及存盘,仅是纯客户端表现,如需要同步及存盘,请使用服务器的model组件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 要恢复原版模型请使用ResetModel接口\r\n - 使用客户端组件更换模型不会同步及存盘,仅是纯客户端表现,如需要同步及存盘,请使用服务器的model组件", + "return": [], + "description": "替换实体的骨骼模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelName", - "type": "str", + "type": "str", + "name": "modelName", "description": "骨骼模型的名称" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetModel" + }, { - "type": "event", - "name": "SetModelMaterial", - "method": "", - "description": "设置骨骼模型所使用的的材质,除了可以设置骨骼模型所使用的自定义材质以外,也可对单个骨骼设置所使用的自定义材质。如果需要设置单个骨骼所使用的材质,需要先在netease_model.json下设置\"useSplitMeshes\"字段为true。", - "remark": "- CPU蒙皮材质的说明可看自定义材质,目前大多数设备都不会用到CPU蒙皮材质,仅在部分低端安卓设备中会使用CPU蒙皮材质。如果开发者如无需要,都可以不设置CPU蒙皮材质。如开发者有需要,则可以参考官方骨骼模型材质data/vanilla_netease/materials/entity.material中的”entity_for_skeleton_cpu“制作自己的CPU蒙皮材质。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- CPU蒙皮材质的说明可看自定义材质,目前大多数设备都不会用到CPU蒙皮材质,仅在部分低端安卓设备中会使用CPU蒙皮材质。如果开发者如无需要,都可以不设置CPU蒙皮材质。如开发者有需要,则可以参考官方骨骼模型材质data/vanilla_netease/materials/entity.material中的”entity_for_skeleton_cpu“制作自己的CPU蒙皮材质。", + "return": [], + "description": "设置骨骼模型所使用的的材质,除了可以设置骨骼模型所使用的自定义材质以外,也可对单个骨骼设置所使用的自定义材质。如果需要设置单个骨骼所使用的材质,需要先在netease_model.json下设置\"useSplitMeshes\"字段为true。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要进行设置材质操作的骨骼模型Id。" - }, + }, { - "name": "material", - "type": "str", + "type": "str", + "name": "material", "description": "需要设置的自定义材质的名称。该材质为GPU骨骼渲染下所使用的材质,大多数情况下只会使用到这个材质。" - }, + }, { - "name": "materialcpu", - "type": "str", + "type": "str", + "name": "materialcpu", "description": "需要设置的自定义材质的名称,该材质为针对部分低端机设备所使用的CPU蒙皮材质,大多数情况下不会使用到这个参数,默认值为空字符串。如果该参数为空,或者所填入的CPU材质名称不存在,则会使用GPU材质替代。因此此时如果GPU材质设置成功,则接口也会返回True." - }, + }, { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "骨骼模型中的骨骼名称。默认值为空字符串。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetModelMaterial" + }, { - "type": "event", - "name": "SetModelMultiPassMaterial", - "method": "", - "description": "设置骨骼模型多pass中使用到的材质列表,也可对单个骨骼设置所使用的自定义多Pass材质。如果需要设置单个骨骼所使用的多Pass材质,需要先在netease_model.json下设置\"useSplitMeshes\"字段为true。", - "remark": "- 注意,材质列表中的首个材质将会覆盖骨骼模型原本的默认材质。例如,使用了SetModelMaterial接口设置了自定义材质A,再使用SetModelMultiPassMaterial设置多Pass材质B,C,D,则这个自定义材质A将会被B覆盖。骨骼模型此时生效的材质为B,C,D。\r\n - CPU蒙皮材质的说明可看自定义材质,目前大多数设备都不会用到CPU蒙皮材质,仅在部分低端安卓设备中会使用CPU蒙皮材质。如果开发者如无需要,都可以不设置CPU蒙皮材质。如开发者有需要,则可以参考官方骨骼模型材质data/vanilla_netease/materials/entity.material中的”entity_for_skeleton_cpu“制作自己的CPU蒙皮材质。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 注意,材质列表中的首个材质将会覆盖骨骼模型原本的默认材质。例如,使用了SetModelMaterial接口设置了自定义材质A,再使用SetModelMultiPassMaterial设置多Pass材质B,C,D,则这个自定义材质A将会被B覆盖。骨骼模型此时生效的材质为B,C,D。\r\n - CPU蒙皮材质的说明可看自定义材质,目前大多数设备都不会用到CPU蒙皮材质,仅在部分低端安卓设备中会使用CPU蒙皮材质。如果开发者如无需要,都可以不设置CPU蒙皮材质。如开发者有需要,则可以参考官方骨骼模型材质data/vanilla_netease/materials/entity.material中的”entity_for_skeleton_cpu“制作自己的CPU蒙皮材质。", + "return": [], + "description": "设置骨骼模型多pass中使用到的材质列表,也可对单个骨骼设置所使用的自定义多Pass材质。如果需要设置单个骨骼所使用的多Pass材质,需要先在netease_model.json下设置\"useSplitMeshes\"字段为true。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要进行设置材质操作的骨骼模型Id。" - }, + }, { - "name": "materialList", - "type": "list(str)", + "type": "list(str)", + "name": "materialList", "description": "多pass所使用的材质列表。" - }, + }, { - "name": "materialCpuList", - "type": "list(str)", + "type": "list(str)", + "name": "materialCpuList", "description": "多pass所使用的CPU蒙皮材质列表。这些材质为针对部分低端机设备所使用的CPU蒙皮材质。默认值为None。大多数情况下不会使用到这个参数,如果该参数为None,或者为空列表,或者所填入的CPU材质名称不存在,则会使用GPU材质替代。因此此时如果GPU材质设置成功,则接口也会返回True." - }, + }, { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "骨骼模型中的骨骼名称。默认值为空字符串。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetModelMultiPassMaterial" + }, { - "type": "event", - "name": "SetModelOffset", - "method": "", - "description": "模型增加偏移量", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "模型增加偏移量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "偏移向量" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetModelOffset" + }, { - "type": "event", - "name": "SetModelPartVisible", - "method": "", - "description": "对骨骼模型中指定的骨骼进行渲染屏蔽,屏蔽后该骨骼不会被渲染出来。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "对骨骼模型中指定的骨骼进行渲染屏蔽,屏蔽后该骨骼不会被渲染出来。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要进行屏蔽操作的骨骼模型Id。" - }, + }, { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "骨骼模型中的骨骼名称。" - }, + }, { - "name": "visible", - "type": "bool", + "type": "bool", + "name": "visible", "description": "显示或者屏蔽。True为显示,False为屏蔽" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetModelPartVisible" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "SetModelPerspectiveEffect", - "method": "", - "description": "设置模型透视效果。注:只对自定义骨骼模型生效", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "设置模型透视效果。注:只对自定义骨骼模型生效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "isPerspective", - "type": "bool", + "type": "bool", + "name": "isPerspective", "description": "是否显示透视颜色" - }, + }, { - "name": "color", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "color", "description": "透视颜色的RGBA值,范围0-1" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetModelPerspectiveEffect" + }, { - "type": "event", - "name": "SetModelTexture", - "method": "", - "description": "设置骨骼模型贴图,该接口与SetTexture功能相同,但属于服务端接口。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "设置骨骼模型贴图,该接口与SetTexture功能相同,但属于服务端接口。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "texture", - "type": "str", + "type": "str", + "name": "texture", "description": "贴图路径,以textures\\models为当前路径的相对路径" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "SetModelTexture" + }, { - "type": "event", - "name": "SetShowArmModel", - "method": "", - "description": "设置使用骨骼模型后切换至第一人称时是否显示手部模型。需要先为骨骼模型定义arm_model,arm_model的定义可参考demo示例-AwesomeMod中的resourcePack/models/netease_models.json中的大天狗模型定义", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "设置使用骨骼模型后切换至第一人称时是否显示手部模型。需要先为骨骼模型定义arm_model,arm_model的定义可参考demo示例-AwesomeMod中的resourcePack/models/netease_models.json中的大天狗模型定义", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "模型id" - }, + }, { - "name": "show", - "type": "bool", + "type": "bool", + "name": "show", "description": "是否显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetShowArmModel" + }, { - "type": "event", - "name": "SetTexture", - "method": "", - "description": "设置骨骼模型的贴图,该接口与SetModelTexture功能相同,但属于客户端接口。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "设置骨骼模型的贴图,该接口与SetModelTexture功能相同,但属于客户端接口。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "texture", - "type": "str", + "type": "str", + "name": "texture", "description": "贴图路径,以textures\\models为当前路径的相对路径" - }, + }, { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "需要指定的模型id,默认为None,表示使用CreateModel时传入的entityID挂接的模型" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetTexture" + }, { - "type": "event", - "name": "ShowCommonHurtColor", - "method": "", - "description": "设置挂接骨骼模型的实体是否显示通用的受伤变红效果", - "remark": "- 引擎默认打开该选项,需要改变受伤效果可以关闭之后再进行定制", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "- 引擎默认打开该选项,需要改变受伤效果可以关闭之后再进行定制", + "return": [], + "description": "设置挂接骨骼模型的实体是否显示通用的受伤变红效果", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "show", - "type": "bool", + "type": "bool", + "name": "show", "description": "是否显示" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ShowCommonHurtColor" + }, { - "type": "event", - "name": "ShowModel", - "method": "", - "description": "显示纯模型", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "显示纯模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "要显示的modelId" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ShowModel" + }, { - "type": "event", - "name": "当需要自由模型时,建议使用LevelId", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "当需要自由模型时,建议使用LevelId" + }, { - "type": "event", - "name": "UnBindModelToEntity", - "method": "", - "description": "取消实体上挂接的某个骨骼模型。取消挂接后,这个modelId的模型便会销毁,无法再使用,如果是临时隐藏可以使用HideModel", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "取消实体上挂接的某个骨骼模型。取消挂接后,这个modelId的模型便会销毁,无法再使用,如果是临时隐藏可以使用HideModel", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "要取消挂接的骨骼模型的id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "UnBindModelToEntity" + }, { - "type": "event", - "name": "UnBindModelToModel", - "method": "", - "description": "取消骨骼模型上挂接的某个骨骼模型。取消挂接后,这个modelId的模型便会销毁,无法再使用,如果是临时隐藏可以使用HideModel", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "remark": "", + "return": [], + "description": "取消骨骼模型上挂接的某个骨骼模型。取消挂接后,这个modelId的模型便会销毁,无法再使用,如果是临时隐藏可以使用HideModel", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/模型.md", + "example": "", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "要取消挂接的骨骼模型的id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "UnBindModelToModel" + }, { - "type": "event", - "name": "GetControllerLayout", - "method": "", - "description": "获取玩家控制器绑定映射", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "remark": "", + "return": [], + "description": "获取玩家控制器绑定映射", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "example": "", "params": [ { - "name": "layoutType", - "type": "int", + "type": "int", + "name": "layoutType", "description": "选择获取的控制器映射类型,0为键盘鼠标,1为游戏手柄" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetControllerLayout" + }, { - "type": "event", - "name": "GetSliderOption", - "method": "", - "description": "获得某个滑动条设置选项的值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "remark": "", + "return": [], + "description": "获得某个滑动条设置选项的值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "example": "", "params": [ { - "name": "optionId", - "type": "str", + "type": "str", + "name": "optionId", "description": "[SliderOptionId枚举](../枚举值/SliderOptionId.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetSliderOption" + }, { - "type": "event", - "name": "GetToggleOption", - "method": "", - "description": "获得某个开关设置值的接口", - "remark": "- 选择INPUT_MODE时,返回值为 [InputMode枚举](../枚举值/InputMode.md)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "remark": "- 选择INPUT_MODE时,返回值为 [InputMode枚举](../枚举值/InputMode.md)", + "return": [], + "description": "获得某个开关设置值的接口", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "example": "", "params": [ { - "name": "optionId", - "type": "str", + "type": "str", + "name": "optionId", "description": "[OptionId枚举](../枚举值/OptionId.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetToggleOption" + }, { - "type": "event", - "name": "GetUIProfile", - "method": "", - "description": "获取\"UI 档案\"模式", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取\"UI 档案\"模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetUIProfile" + }, { - "type": "event", - "name": "HighlightBoxSelection", - "method": "", - "description": "镜头移动时高亮当前视角中心所指的方块", - "remark": "- 功能实现上面其实是 设置->视频->轮廓 这一设置的一层代码封装,但不会影响到原本轮廓设置的值,可在开启轮廓选择的情况下,用此接口开关高亮效果,如果在游戏中已经关闭了轮廓选择,则方块只会高亮显示。\r\n - 重启后设置失效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "remark": "- 功能实现上面其实是 设置->视频->轮廓 这一设置的一层代码封装,但不会影响到原本轮廓设置的值,可在开启轮廓选择的情况下,用此接口开关高亮效果,如果在游戏中已经关闭了轮廓选择,则方块只会高亮显示。\r\n - 重启后设置失效", + "return": [], + "description": "镜头移动时高亮当前视角中心所指的方块", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "example": "", "params": [ { - "name": "isHighlight", - "type": "bool", + "type": "bool", + "name": "isHighlight", "description": "是否高亮,True为高亮,False为不高亮,默认为不高亮" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "HighlightBoxSelection" + }, { - "type": "event", - "name": "SetSliderOption", - "method": "", - "description": "设置某个滑动条设置选项的值", - "remark": "- 该设置全局生效,在一个存档中修改此项设置后,进入另一个存档后该设置也会保留生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "remark": "- 该设置全局生效,在一个存档中修改此项设置后,进入另一个存档后该设置也会保留生效", + "return": [], + "description": "设置某个滑动条设置选项的值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "example": "", "params": [ { - "name": "optionId", - "type": "str", + "type": "str", + "name": "optionId", "description": "[SliderOptionId枚举](../枚举值/SliderOptionId.md)" - }, + }, { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "值范围详见[SliderOptionId枚举](../枚举值/SliderOptionId.md)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetSliderOption" + }, { - "type": "event", - "name": "SetSplitControlCanChange", - "method": "", - "description": "设置是否允许使用准星瞄准按钮", - "remark": "- 该设置全局生效,在一个存档中修改此项设置后,进入另一个存档后该设置也会保留生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "remark": "- 该设置全局生效,在一个存档中修改此项设置后,进入另一个存档后该设置也会保留生效", + "return": [], + "description": "设置是否允许使用准星瞄准按钮", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "example": "", "params": [ { - "name": "canChange", - "type": "bool", + "type": "bool", + "name": "canChange", "description": "是否允许" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetSplitControlCanChange" + }, { - "type": "event", - "name": "SetToggleOption", - "method": "", - "description": "修改开关型设置的接口", - "remark": "- INPUT_MODE为控制器模式,不支持设置\r\n - “花俏的树叶”开关修改后,已渲染的树叶并不会立刻变化,需要对应区块变化或者周围方块变化时,树叶方块才会有变化\r\n - “渲染云”开关开启后,需要在“美丽的天空”开关也开启的情况下,天空中才会渲染出云层。\r\n - 该设置全局生效,在一个存档中修改此项设置后,进入另一个存档后该设置也会保留生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "remark": "- INPUT_MODE为控制器模式,不支持设置\r\n - “花俏的树叶”开关修改后,已渲染的树叶并不会立刻变化,需要对应区块变化或者周围方块变化时,树叶方块才会有变化\r\n - “渲染云”开关开启后,需要在“美丽的天空”开关也开启的情况下,天空中才会渲染出云层。\r\n - 该设置全局生效,在一个存档中修改此项设置后,进入另一个存档后该设置也会保留生效", + "return": [], + "description": "修改开关型设置的接口", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "example": "", "params": [ { - "name": "optionId", - "type": "str", + "type": "str", + "name": "optionId", "description": "[OptionId枚举](../枚举值/OptionId.md)" - }, + }, { - "name": "isOn", - "type": "bool", + "type": "bool", + "name": "isOn", "description": "是否打开开关,True为开,False为关" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetToggleOption" + }, { - "type": "event", - "name": "SetUIProfile", - "method": "", - "description": "设置\"UI 档案\"模式", - "remark": "- 该设置全局生效,在一个存档中修改此项设置后,进入另一个存档后该设置也会保留生效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "remark": "- 该设置全局生效,在一个存档中修改此项设置后,进入另一个存档后该设置也会保留生效", + "return": [], + "description": "设置\"UI 档案\"模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/游戏设置.md", + "example": "", "params": [ { - "name": "profileType", - "type": "int", + "type": "int", + "name": "profileType", "description": "0表示经典模式,1表示Pocket模式" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetUIProfile" + }, { - "type": "event", - "name": "CancelShearsDestoryBlockSpeed", - "method": "", - "description": "取消剪刀对某一方块的破坏速度设置", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "取消剪刀对某一方块的破坏速度设置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块名称,包含命名空间" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "CancelShearsDestoryBlockSpeed" + }, { - "type": "event", - "name": "CancelShearsDestoryBlockSpeedAll", - "method": "", - "description": "取消剪刀对全部方块的破坏速度设置", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "取消剪刀对全部方块的破坏速度设置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "CancelShearsDestoryBlockSpeedAll" + }, { - "type": "event", - "name": "ChangeArmorTextures", - "method": "", - "description": "修改盔甲在场景中显示和在UI中显示的贴图", - "remark": "- 无法跟物品的贴图动画同时使用\r\n - 有一定性能消耗,不建议频繁调用", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "- 无法跟物品的贴图动画同时使用\r\n - 有一定性能消耗,不建议频繁调用", + "return": [], + "description": "修改盔甲在场景中显示和在UI中显示的贴图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "armorIdentifier", - "type": "str", + "type": "str", + "name": "armorIdentifier", "description": "盔甲标识符,格式[namespace:name:auxvalue],auxvalue默认为0" - }, + }, { - "name": "texturesDict", - "type": "dict", + "type": "dict", + "name": "texturesDict", "description": "场景中目标贴图的映射表,格式可参考\"definitions/attachables/diamond_helmet.json\"配置" - }, + }, { - "name": "uiIconTexture", - "type": "str", + "type": "str", + "name": "uiIconTexture", "description": "盔甲UI图标的贴图, 为None或者\"\"的话表示不修改UI上的图标" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ChangeArmorTextures" + }, { - "type": "event", - "name": "ChangeItemTexture", - "method": "", - "description": "替换物品的贴图,修改后所有用到该贴图的物品都会被改变,后续创建的此类物品也会被改变。会同时修改物品在UI界面上的显示,手持时候的显示与场景掉落的显示。", - "remark": "- 因为会同时修改用到此贴图的所有物品,所以使用的时候尽量谨慎,不建议改原版的物品,建议只用于修改用到自定义新贴图的物品。\r\n - 序列帧贴图物品暂不支持动态修改贴图\r\n - 部分物品有特殊逻辑无法修改:箱子,旗帜,生物头颅,盾牌,三叉戟,鱼杆", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "- 因为会同时修改用到此贴图的所有物品,所以使用的时候尽量谨慎,不建议改原版的物品,建议只用于修改用到自定义新贴图的物品。\r\n - 序列帧贴图物品暂不支持动态修改贴图\r\n - 部分物品有特殊逻辑无法修改:箱子,旗帜,生物头颅,盾牌,三叉戟,鱼杆", + "return": [], + "description": "替换物品的贴图,修改后所有用到该贴图的物品都会被改变,后续创建的此类物品也会被改变。会同时修改物品在UI界面上的显示,手持时候的显示与场景掉落的显示。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "identifier", - "type": "str", + "type": "str", + "name": "identifier", "description": "物品标识符,格式[namespace:name:auxvalue],auxvalue默认为0" - }, + }, { - "name": "texturePath", - "type": "str", + "type": "str", + "name": "texturePath", "description": "贴图路径" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ChangeItemTexture" + }, { - "type": "event", - "name": "GetAllEnchantsInfo", - "method": "", - "description": "获取目前已注册的所有附魔信息", - "remark": "- 1.目前能获取原生及自定义附魔信息\r\n 2.由于原生附魔的消耗存在不相同的计算规则,目前不提供原生附魔的costs信息", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 1.目前能获取原生及自定义附魔信息\r\n 2.由于原生附魔的消耗存在不相同的计算规则,目前不提供原生附魔的costs信息", + "return": [], + "description": "获取目前已注册的所有附魔信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetAllEnchantsInfo" + }, { - "type": "event", - "name": "GetCustomName", - "method": "", - "description": "获取物品的自定义名称,与铁砧修改的名称一致", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "获取物品的自定义名称,与铁砧修改的名称一致", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典。如果是接口获取的itemDict,应该包含userData,即getUserData应该为True" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "GetCustomName" + }, { - "type": "event", - "name": "GetItemBasicInfo", - "method": "", - "description": "获取物品的基础信息", - "remark": "- auxValue默认值是0,可以不设置。如果物品不存在,返回值为None\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | itemName | str | 本地化的物品名字 |\r\n | maxStackSize |int| 物品最大堆叠数目 |\r\n | maxDurability |int| 物品最大耐久值 |\r\n | id_aux |int| 用于给UI的inventory_item_renderer类型控件绑定#item_id_aux字段,详见备注 |\r\n | tierDict |dict| 自定义方块定义的挖掘相关的属性 netease:tier,没有设置时返回None |\r\n | itemCategory |str| 创造栏分类 |\r\n | itemType |str| 物品类型 |\r\n | customItemType |str| 自定义物品类型 |\r\n | customTips |str| 自定义物品/方块tips |\r\n | itemTierLevel |int| 工具等级 |\r\n | fuelDuration |float| 燃料时长 |\r\n | foodNutrition |int| 食物营养值 |\r\n | foodSaturation |float| 食物饱食度 |\r\n | weaponDamage |int| 武器攻击力 |\r\n | armorDefense |int| 防具防御力 |\r\n | armorSlot |int| 防具槽位 |\r\n | armorToughness |int| 防具韧性 |\r\n | armorKnockbackResistance |float| 防具击退抗性 |\r\n - 部分原版物品较为特殊,获取不到个别字段的返回值\r\n 方块类燃料获取不到燃料时长,弓、弩获取不到武器攻击力,蛋糕获取不到营养值和饱食度,马铠获取不到防具防御力,上述物品获取对应字段返回值为0\r\n - id_aux字段的示例:\r\n 在ui中添加一个inventory_item_renderer控件以及#item_id_aux的绑定\r\n ```json\r\n \"my_item_renderer\": {\r\n \"type\": \"custom\",\r\n \"renderer\": \"inventory_item_renderer\",\r\n \"size\": [ 160, 160 ],\r\n \"bindings\" : [\r\n {\r\n \"binding_condition\" : \"always_when_visible\",\r\n \"binding_name\" : \"#GetItemIdAux\",\r\n \"binding_name_override\" : \"#item_id_aux\"\r\n }\r\n ]\r\n }\r\n ```\r\n \r\n 然后在python中添加绑定回调\r\n ```python\r\n @ViewBinder.binding(ViewBinder.BF_BindInt, \"#GetItemIdAux\")\r\n def OnStarkGridResize(self):\r\n comp = clientApi.GetEngineCompFactory().CreateItem(levelId)\r\n info = comp.GetItemBasicInfo(\"minecraft:bow\", 0, True)\r\n return info['id_aux']\r\n ```\r\n - 创造栏分类说明\r\n | 创造栏分类 | 意义 |\r\n | --------- | -----|\r\n | construction | 建筑 |\r\n | nature | 自然 |\r\n | equipment | 装备 |\r\n | items | 物品 |\r\n | custom | 自定义 |\r\n - 物品类型,值为空字符串或者下列类型名之一:\r\n | 类型名 | 意义 |\r\n | ----- | ----- |\r\n | book | 书 |\r\n | sword | 剑 |\r\n | shears | 剪刀 |\r\n | axe | 斧头 |\r\n | clock | 时钟 |\r\n | bucket | 桶 |\r\n | fishing_rod | 钓鱼竿 |\r\n | hoe | 锄头 |\r\n | shovel | 锹 |\r\n | pickaxe | 镐 |\r\n | dye | 骨粉 |\r\n | food | 食物 |\r\n | block | 方块 |\r\n | armor | 盔甲 |\r\n | custom_ranged_weapon | 自定义远程武器 |\r\n | compass | 指南针 |\r\n | trident | 三叉戟 |\r\n | potion | 药水 |\r\n | crossbow | 弩 |\r\n - 自定义物品类型物品类型,值为行为包里minecraft::item内的custom_item_type字段值\r\n - 工具等级代表不同的材质,没有工具等级时为值-1,工具等级与材质对应关系如下\r\n | 工具等级 | 材质 |\r\n | ------- | ---- |\r\n | 0 | 木制/金制工具 |\r\n | 1 | 石制工具 |\r\n | 2 | 铁制工具 |\r\n | 3 | 钻石工具 |\r\n | 4 | 合金工具 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "- auxValue默认值是0,可以不设置。如果物品不存在,返回值为None\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | itemName | str | 本地化的物品名字 |\r\n | maxStackSize |int| 物品最大堆叠数目 |\r\n | maxDurability |int| 物品最大耐久值 |\r\n | id_aux |int| 用于给UI的inventory_item_renderer类型控件绑定#item_id_aux字段,详见备注 |\r\n | tierDict |dict| 自定义方块定义的挖掘相关的属性 netease:tier,没有设置时返回None |\r\n | itemCategory |str| 创造栏分类 |\r\n | itemType |str| 物品类型 |\r\n | customItemType |str| 自定义物品类型 |\r\n | customTips |str| 自定义物品/方块tips |\r\n | itemTierLevel |int| 工具等级 |\r\n | fuelDuration |float| 燃料时长 |\r\n | foodNutrition |int| 食物营养值 |\r\n | foodSaturation |float| 食物饱食度 |\r\n | weaponDamage |int| 武器攻击力 |\r\n | armorDefense |int| 防具防御力 |\r\n | armorSlot |int| 防具槽位 |\r\n | armorToughness |int| 防具韧性 |\r\n | armorKnockbackResistance |float| 防具击退抗性 |\r\n - 部分原版物品较为特殊,获取不到个别字段的返回值\r\n 方块类燃料获取不到燃料时长,弓、弩获取不到武器攻击力,蛋糕获取不到营养值和饱食度,马铠获取不到防具防御力,上述物品获取对应字段返回值为0\r\n - id_aux字段的示例:\r\n 在ui中添加一个inventory_item_renderer控件以及#item_id_aux的绑定\r\n ```json\r\n \"my_item_renderer\": {\r\n \"type\": \"custom\",\r\n \"renderer\": \"inventory_item_renderer\",\r\n \"size\": [ 160, 160 ],\r\n \"bindings\" : [\r\n {\r\n \"binding_condition\" : \"always_when_visible\",\r\n \"binding_name\" : \"#GetItemIdAux\",\r\n \"binding_name_override\" : \"#item_id_aux\"\r\n }\r\n ]\r\n }\r\n ```\r\n \r\n 然后在python中添加绑定回调\r\n ```python\r\n @ViewBinder.binding(ViewBinder.BF_BindInt, \"#GetItemIdAux\")\r\n def OnStarkGridResize(self):\r\n comp = clientApi.GetEngineCompFactory().CreateItem(levelId)\r\n info = comp.GetItemBasicInfo(\"minecraft:bow\", 0, True)\r\n return info['id_aux']\r\n ```\r\n - 创造栏分类说明\r\n | 创造栏分类 | 意义 |\r\n | --------- | -----|\r\n | construction | 建筑 |\r\n | nature | 自然 |\r\n | equipment | 装备 |\r\n | items | 物品 |\r\n | custom | 自定义 |\r\n - 物品类型,值为空字符串或者下列类型名之一:\r\n | 类型名 | 意义 |\r\n | ----- | ----- |\r\n | book | 书 |\r\n | sword | 剑 |\r\n | shears | 剪刀 |\r\n | axe | 斧头 |\r\n | clock | 时钟 |\r\n | bucket | 桶 |\r\n | fishing_rod | 钓鱼竿 |\r\n | hoe | 锄头 |\r\n | shovel | 锹 |\r\n | pickaxe | 镐 |\r\n | dye | 骨粉 |\r\n | food | 食物 |\r\n | block | 方块 |\r\n | armor | 盔甲 |\r\n | custom_ranged_weapon | 自定义远程武器 |\r\n | compass | 指南针 |\r\n | trident | 三叉戟 |\r\n | potion | 药水 |\r\n | crossbow | 弩 |\r\n - 自定义物品类型物品类型,值为行为包里minecraft::item内的custom_item_type字段值\r\n - 工具等级代表不同的材质,没有工具等级时为值-1,工具等级与材质对应关系如下\r\n | 工具等级 | 材质 |\r\n | ------- | ---- |\r\n | 0 | 木制/金制工具 |\r\n | 1 | 石制工具 |\r\n | 2 | 铁制工具 |\r\n | 3 | 钻石工具 |\r\n | 4 | 合金工具 |", + "return": [], + "description": "获取物品的基础信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "item的identifier" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "物品的附加值auxvalue,默认为0" - }, + }, { - "name": "isEnchanted", - "type": "bool", + "type": "bool", + "name": "isEnchanted", "description": "是否附魔,默认为False。用于返回的id_aux" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetItemBasicInfo" + }, { - "type": "event", - "name": "GetItemDefenceAngle", - "method": "", - "description": "获取盾牌物品的抵挡角度范围", - "remark": "- 当传入的玩家id不正确,玩家手里没手持盾牌,传入不存在的槽位时,会返回空列表", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "- 当传入的玩家id不正确,玩家手里没手持盾牌,传入不存在的槽位时,会返回空列表", + "return": [], + "description": "获取盾牌物品的抵挡角度范围", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "posType", - "type": "int", + "type": "int", + "name": "posType", "description": "[ItemPosType枚举](../枚举值/ItemPosType.md)" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "槽位" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "GetItemDefenceAngle" + }, { - "type": "event", - "name": "GetItemDurability", - "method": "", - "description": "获取指定槽位的物品耐久", - "remark": "- posType设置成serverApi.GetMinecraftEnum().ItemPosType.INVENTORY可替代GetInvItemDurability;posType设置成serverApi.GetMinecraftEnum().ItemPosType.ARMOR可替代GetEquItemDurability;", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "- posType设置成serverApi.GetMinecraftEnum().ItemPosType.INVENTORY可替代GetInvItemDurability;posType设置成serverApi.GetMinecraftEnum().ItemPosType.ARMOR可替代GetEquItemDurability;", + "return": [], + "description": "获取指定槽位的物品耐久", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "posType", - "type": "int", + "type": "int", + "name": "posType", "description": "[ItemPosType枚举](../枚举值/ItemPosType.md)" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "槽位,当posType为ItemPosType.INVENTORY或ItemPosType.ARMOR时才有意义" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "GetItemDurability" + }, { - "type": "event", - "name": "GetItemEffectName", - "method": "", - "description": "获取物品的状态描述,如:§7保护 0§r", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "获取物品的状态描述,如:§7保护 0§r", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "item的identifier" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "物品的附加值auxValue,默认为不指定auxValue(0)" - }, + }, { - "name": "userData", - "type": "dict", + "type": "dict", + "name": "userData", "description": "物品userData,默认为None" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetItemEffectName" + }, { - "type": "event", - "name": "GetItemFormattedHoverText", - "method": "", - "description": "获取物品的格式化hover文本,如:§f灾厄旗帜§r", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "获取物品的格式化hover文本,如:§f灾厄旗帜§r", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "item的identifier" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "物品的附加值auxValue,默认为不指定auxValue(0)" - }, + }, { - "name": "showCategory", - "type": "bool", + "type": "bool", + "name": "showCategory", "description": "是否包括item的类别信息,默认False" - }, + }, { - "name": "userData", - "type": "dict", + "type": "dict", + "name": "userData", "description": "物品userData,默认为None" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetItemFormattedHoverText" + }, { - "type": "event", - "name": "GetItemHoverName", - "method": "", - "description": "获取物品的hover名称,如:灾厄旗帜§r", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "获取物品的hover名称,如:灾厄旗帜§r", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "item的identifier" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "物品的附加值auxValue,默认为不指定auxValue(0)" - }, + }, { - "name": "userData", - "type": "dict", + "type": "dict", + "name": "userData", "description": "物品userData,默认为None" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetItemHoverName" + }, { - "type": "event", - "name": "GetItemInfoByBlockName", - "method": "", - "description": "通过方块名称及aux值获取物品信息", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "通过方块名称及aux值获取物品信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块identifier" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "aux值" - }, + }, { - "name": "isLegacy", - "type": "bool", + "type": "bool", + "name": "isLegacy", "description": "方块是否为原生方块,默认为True,即使用旧版aux对应的state" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "GetItemInfoByBlockName" + }, { - "type": "event", - "name": "GetItemLayer", - "method": "", - "description": "获取物品的叠加贴图。物品叠加贴图详见SetItemLayer", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "获取物品的叠加贴图。物品叠加贴图详见SetItemLayer", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "layer", - "type": "int", + "type": "int", + "name": "layer", "description": "贴图的层级。可以为-2,-1,1,2,3。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "GetItemLayer" + }, { - "type": "event", - "name": "GetItemMaxDurability", - "method": "", - "description": "获取指定槽位的物品耐最大耐久", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "获取指定槽位的物品耐最大耐久", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "posType", - "type": "int", + "type": "int", + "name": "posType", "description": "[ItemPosType枚举](../枚举值/ItemPosType.md)" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "槽位,当posType为ItemPosType.INVENTORY或ItemPosType.ARMOR时才有意义" - }, + }, { - "name": "isUserData", - "type": "bool", + "type": "bool", + "name": "isUserData", "description": "如果为True,则只尝试获取该物品userData特殊设置的值,没有特殊设置过则返回0。如果为False,则会先尝试获取userData中的值,没有的话获取该类物品通用值。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "GetItemMaxDurability" + }, { - "type": "event", - "name": "GetItemTags", - "method": "", - "description": "获取物品在minecraft:tags中定义的tags列表", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "获取物品在minecraft:tags中定义的tags列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "item的identifier" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "物品的附加值auxValue,默认为不指定auxValue(0)" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetItemTags" + }, { - "type": "event", - "name": "GetItemTexture", - "method": "", - "description": "获取item_texture.json中物品的贴图路径。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "获取item_texture.json中物品的贴图路径。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "identifier", - "type": "str", + "type": "str", + "name": "identifier", "description": "物品标识符,格式[namespace:name:auxvalue],auxvalue默认为0" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetItemTexture" + }, { - "type": "event", - "name": "GetLoadItems", - "method": "", - "description": "获取已经加载的物品id", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "获取已经加载的物品id", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "flag", - "type": "bool", + "type": "bool", + "name": "flag", "description": "True获取所有物品,False仅获取注册到创造栏的物品,默认为True" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "GetLoadItems" + }, { - "type": "event", - "name": "GetUserDataInEvent", - "method": "", - "description": "使物品相关客户端事件的物品信息字典参数带有userData。在mod初始化时调用即可", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "使物品相关客户端事件的物品信息字典参数带有userData。在mod初始化时调用即可", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "eventName", - "type": "str", + "type": "str", + "name": "eventName", "description": "引擎事件名" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "GetUserDataInEvent" + }, { - "type": "event", - "name": "LookupItemByName", - "method": "", - "description": "判定指定identifier的物品是否存在", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "判定指定identifier的物品是否存在", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "物品的identifier。类似\"minecraft:bed\",支持自定义物品" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "LookupItemByName" + }, { - "type": "event", - "name": "RemoveItemLayer", - "method": "", - "description": "移除物品的叠加贴图。物品叠加贴图详见SetItemLayer", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "移除物品的叠加贴图。物品叠加贴图详见SetItemLayer", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "layer", - "type": "int", + "type": "int", + "name": "layer", "description": "贴图的层级。可以为-2,-1,1,2,3。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "RemoveItemLayer" + }, { - "type": "event", - "name": "SetAttackDamage", - "method": "", - "description": "设置物品的攻击伤害值", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "设置物品的攻击伤害值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "attackDamage", - "type": "int", + "type": "int", + "name": "attackDamage", "description": "攻击伤害值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "SetAttackDamage" + }, { - "type": "event", - "name": "SetCompassEntity", - "method": "", - "description": "设置指南针朝向的实体", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "设置指南针朝向的实体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCompassEntity" + }, { - "type": "event", - "name": "SetCompassTarget", - "method": "", - "description": "设置指南针的朝向位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "设置指南针的朝向位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "方块x坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "方块y坐标" - }, + }, { - "name": "z", - "type": "int", + "type": "int", + "name": "z", "description": "方块z坐标" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCompassTarget" + }, { - "type": "event", - "name": "SetCustomName", - "method": "", - "description": "设置物品的自定义名称,与使用铁砧重命名一致", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "设置物品的自定义名称,与使用铁砧重命名一致", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "物品名称。支持unicode" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "SetCustomName" + }, { - "type": "event", - "name": "SetItemDefenceAngle", - "method": "", - "description": "设置盾牌物品的抵挡角度范围", - "remark": "- 当设置的物品不是盾牌物品时,返回False;原生盾牌会返回True但是仍然走原生的逻辑", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "- 当设置的物品不是盾牌物品时,返回False;原生盾牌会返回True但是仍然走原生的逻辑", + "return": [], + "description": "设置盾牌物品的抵挡角度范围", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "posType", - "type": "int", + "type": "int", + "name": "posType", "description": "[ItemPosType枚举](../枚举值/ItemPosType.md)" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "槽位" - }, + }, { - "name": "angleLeft", - "type": "float", + "type": "float", + "name": "angleLeft", "description": "左边的范围,不想设置左范围传None,取值范围是[-180,180]" - }, + }, { - "name": "angleRight", - "type": "float", + "type": "float", + "name": "angleRight", "description": "右边的范围,不想设置右范围传None,取值范围是[-180,180],且angleLeft物品信息字典" - }, + }, { - "name": "layer", - "type": "int", + "type": "int", + "name": "layer", "description": "贴图的层级。可以为-2,-1,1,2,3。负数层级显示在物品下方,正数的层级显示在物品上方。层级大的显示在层级小的上方。" - }, + }, { - "name": "texture", - "type": "str", + "type": "str", + "name": "texture", "description": "贴图的名字,对应item_texture.json中的key。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "SetItemLayer" + }, { - "type": "event", - "name": "SetItemMaxDurability", - "method": "", - "description": "设置物品的最大耐久值", - "remark": "- 若物品堆叠数量大于1时,耐久度的变更对整一叠的物品生效。并且耐久度为0后,每次消耗耐久度的行为会使数量减一\r\n - 为物品设置的userData最大耐久度在计算时优先级最高,userData数据存盘。\r\n - 在砂轮或背包合并时,若两个物品都有userData,只会保留其中一个。在铁砧中修复时,最大耐久取被修复物品的耐久。\r\n - 当最大耐久值被更改时,当前耐久度也会按比例修复。\r\n - 对同一类所有物品设置的最大耐久度不存盘,每次重启世界都会重新初始化,可以通过对应item json的`minecraft:max_damage`组件设置初始化最大耐久度\r\n - 如果设置的是背包物品,当slot值为-1时,设置左手物品的最大耐久值", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "- 若物品堆叠数量大于1时,耐久度的变更对整一叠的物品生效。并且耐久度为0后,每次消耗耐久度的行为会使数量减一\r\n - 为物品设置的userData最大耐久度在计算时优先级最高,userData数据存盘。\r\n - 在砂轮或背包合并时,若两个物品都有userData,只会保留其中一个。在铁砧中修复时,最大耐久取被修复物品的耐久。\r\n - 当最大耐久值被更改时,当前耐久度也会按比例修复。\r\n - 对同一类所有物品设置的最大耐久度不存盘,每次重启世界都会重新初始化,可以通过对应item json的`minecraft:max_damage`组件设置初始化最大耐久度\r\n - 如果设置的是背包物品,当slot值为-1时,设置左手物品的最大耐久值", + "return": [], + "description": "设置物品的最大耐久值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "posType", - "type": "int", + "type": "int", + "name": "posType", "description": "[ItemPosType枚举](../枚举值/ItemPosType.md)" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "槽位,当posType为ItemPosType.INVENTORY或ItemPosType.ARMOR时才有意义" - }, + }, { - "name": "maxDurability", - "type": "int", + "type": "int", + "name": "maxDurability", "description": "最大耐久值,可设为0~32767" - }, + }, { - "name": "isUserData", - "type": "bool", + "type": "bool", + "name": "isUserData", "description": "如果为True,则该设置只对指定物品生效,如果为False,则对同一类所有物品生效" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "SetItemMaxDurability" + }, { - "type": "event", - "name": "SetItemTierLevel", - "method": "", - "description": "设置工具类物品的挖掘等级", - "remark": "- 对于不总是可以破坏的方块(包括方块材质为Stone,Metal,TopSnow,Snow,Web),需要使用不同挖掘等级(level)的工具才能破坏并产生掉落物。\r\n | level | 类型 |\r\n | ----- | ---- |\r\n | 0 | 木 |\r\n | 1 | 石 |\r\n | 2 | 铁 |\r\n | 3 | 钻石 |\r\n | 4 | 下界 |\r\n - 剑和剪刀都可以对蜘蛛网进行破坏并产生掉落物;\r\n 铲可以对雪和顶层雪进行破坏并产生掉落物;\r\n 镐是否可以破坏判断:\r\n 1)对于黑曜石、下界类方块、远古残骸,需要Level大于等于3的镐才能破坏并产生掉落物;\r\n 2)对于钻石块、钻石矿石、绿宝石块、绿宝石矿石、金块、金矿石、红石矿石、发光的红石矿石,需要Level大于等于2的镐才能破坏并产生掉落物;\r\n 3)对于铁块、铁矿石、青金石块、青金石矿石,需要Level大于等于1的镐才能破坏并产生掉落物;\r\n 4)对于其他Stone和Metal材质的方块,需要Level大于等于0的镐才能破坏并产生掉落物。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "- 对于不总是可以破坏的方块(包括方块材质为Stone,Metal,TopSnow,Snow,Web),需要使用不同挖掘等级(level)的工具才能破坏并产生掉落物。\r\n | level | 类型 |\r\n | ----- | ---- |\r\n | 0 | 木 |\r\n | 1 | 石 |\r\n | 2 | 铁 |\r\n | 3 | 钻石 |\r\n | 4 | 下界 |\r\n - 剑和剪刀都可以对蜘蛛网进行破坏并产生掉落物;\r\n 铲可以对雪和顶层雪进行破坏并产生掉落物;\r\n 镐是否可以破坏判断:\r\n 1)对于黑曜石、下界类方块、远古残骸,需要Level大于等于3的镐才能破坏并产生掉落物;\r\n 2)对于钻石块、钻石矿石、绿宝石块、绿宝石矿石、金块、金矿石、红石矿石、发光的红石矿石,需要Level大于等于2的镐才能破坏并产生掉落物;\r\n 3)对于铁块、铁矿石、青金石块、青金石矿石,需要Level大于等于1的镐才能破坏并产生掉落物;\r\n 4)对于其他Stone和Metal材质的方块,需要Level大于等于0的镐才能破坏并产生掉落物。", + "return": [], + "description": "设置工具类物品的挖掘等级", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "level", - "type": "int", + "type": "int", + "name": "level", "description": "挖掘等级" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "SetItemTierLevel" + }, { - "type": "event", - "name": "SetItemTierSpeed", - "method": "", - "description": "设置工具类物品的挖掘速度(可通过userData中的ModTierSpeed获取挖掘速度)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "设置工具类物品的挖掘速度(可通过userData中的ModTierSpeed获取挖掘速度)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "speed", - "type": "float", + "type": "float", + "name": "speed", "description": "挖掘速度" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "SetItemTierSpeed" + }, { - "type": "event", - "name": "SetMaxStackSize", - "method": "", - "description": "设置物品的最大堆叠数量(存档)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "", + "return": [], + "description": "设置物品的最大堆叠数量(存档)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "maxStackSize", - "type": "int", + "type": "int", + "name": "maxStackSize", "description": "最大堆叠数量,不能超过64,如果该值小于物品的堆叠数量,会返回失败" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "SetMaxStackSize" + }, { - "type": "event", - "name": "SetShearsDestoryBlockSpeed", - "method": "", - "description": "设置剪刀对某一方块的破坏速度", - "remark": "- 设置的速度最终会加上剪刀的附魔:效率计算\r\n - 原版剪刀对蜘蛛网的破坏速度为15,羊毛的破坏速度为5,也可以用该接口重写对这两个方块的破坏速度\r\n - 设置的速度必须大于1,否则该接口返回False", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "remark": "- 设置的速度最终会加上剪刀的附魔:效率计算\r\n - 原版剪刀对蜘蛛网的破坏速度为15,羊毛的破坏速度为5,也可以用该接口重写对这两个方块的破坏速度\r\n - 设置的速度必须大于1,否则该接口返回False", + "return": [], + "description": "设置剪刀对某一方块的破坏速度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物品.md", + "example": "", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块名称,包含命名空间" - }, + }, { - "name": "speed", - "type": "float", + "type": "float", + "name": "speed", "description": "破坏速度" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "SetShearsDestoryBlockSpeed" + }, { - "type": "api", - "name": "Bind", - "method": "", - "description": "绑定骨骼模型", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "", + "return": [], + "description": "绑定骨骼模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniSkeletonBind(frameEntityId)\r\ncomp.Bind(modelId, \"root\", (0, 1, 0), (0, 0, 0))", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "绑定的骨骼模型的ID(见model组件的GetModelId)" - }, + }, { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "绑定具体骨骼的名称" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "绑定的偏移量" - }, + }, { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "绑定的旋转角度" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniSkeletonBind(frameEntityId)\r\ncomp.Bind(modelId, \"root\", (0, 1, 0), (0, 0, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "Bind" + }, { - "type": "api", - "name": "CreateEngineSfx", - "method": "", - "description": "创建序列帧特效", - "remark": "- 创建序列帧后,可以用返回的frameEntityId创建序列帧分类中的相关组件,设置所需属性,以实现各种表现效果\r\n - 切换维度后会自动隐藏非本维度创建的而且没有绑定实体的序列帧, 回到该维度后会自动重新显示\r\n - 需要注意,序列帧创建之后需要调用frameAniControl组件的play函数才会播放,如果播放非本维度创建的序列帧,会同时修改该序列帧的创建维度为当前维度", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "- 创建序列帧后,可以用返回的frameEntityId创建序列帧分类中的相关组件,设置所需属性,以实现各种表现效果\r\n - 切换维度后会自动隐藏非本维度创建的而且没有绑定实体的序列帧, 回到该维度后会自动重新显示\r\n - 需要注意,序列帧创建之后需要调用frameAniControl组件的play函数才会播放,如果播放非本维度创建的序列帧,会同时修改该序列帧的创建维度为当前维度", + "return": [], + "description": "创建序列帧特效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclass MyClientSystem(ClientSystem):\r\n # 创建\r\n def createSfx(self):\r\n frameEntityId = self.CreateEngineSfx(\"textures/sfxs/snow_3\")\r\n frameAniTransComp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\n frameAniTransComp.SetPos((10,10,10))\r\n frameAniTransComp.SetRot((0,0,0))\r\n frameAniTransComp.SetScale((1,1,1))\r\n frameAniControlComp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n frameAniControlComp.Play()\r\n\r\n # 删除\r\n def removeSfx(self, frameEntityId):\r\n self.DestroyEntity(frameEntityId)", "params": [ { - "name": "path", - "type": "str", + "type": "str", + "name": "path", "description": "特效资源路径,不用后缀名" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "创建位置,可选,没传则可以创建完用frameAniTrans组件设置" - }, + }, { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "角度,可选,没传则可以创建完用frameAniTrans组件设置" - }, + }, { - "name": "scale", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "scale", "description": "缩放系数,可选,没传则可以创建完用frameAniTrans组件设置" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclass MyClientSystem(ClientSystem):\r\n # 创建\r\n def createSfx(self):\r\n frameEntityId = self.CreateEngineSfx(\"textures/sfxs/snow_3\")\r\n frameAniTransComp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\n frameAniTransComp.SetPos((10,10,10))\r\n frameAniTransComp.SetRot((0,0,0))\r\n frameAniTransComp.SetScale((1,1,1))\r\n frameAniControlComp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n frameAniControlComp.Play()\r\n\r\n # 删除\r\n def removeSfx(self, frameEntityId):\r\n self.DestroyEntity(frameEntityId)" - }, + ], + "type": "api", + "side": "client", + "name": "CreateEngineSfx" + }, { - "type": "api", - "name": "CreateEngineSfxFromEditor", - "method": "", - "description": "指使用资源包中effects/xxx.json,按照编辑器中编辑好的参数创建序列帧。支持环状序列帧", - "remark": "- 创建序列帧后,可以用返回的frameEntityId创建序列帧分类中的相关组件,设置所需属性,以实现各种表现效果\r\n - 需要注意,序列帧创建之后需要调用frameAniControl组件的play函数才会播放\r\n - 根据editor配置生成序列帧后还需要设置位置或绑定,以及进行播放。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "- 创建序列帧后,可以用返回的frameEntityId创建序列帧分类中的相关组件,设置所需属性,以实现各种表现效果\r\n - 需要注意,序列帧创建之后需要调用frameAniControl组件的play函数才会播放\r\n - 根据editor配置生成序列帧后还需要设置位置或绑定,以及进行播放。", + "return": [], + "description": "指使用资源包中effects/xxx.json,按照编辑器中编辑好的参数创建序列帧。支持环状序列帧", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclass MyClientSystem(ClientSystem):\r\n # 创建\r\n def createSfxFromEditor(self):\r\n frameEntityId = self.CreateEngineSfxFromEditor(\"effects/mySfx.json\")\r\n frameAniTransComp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\n frameAniTransComp.SetPos((10,10,10))\r\n frameAniTransComp.SetRot((0,0,0))\r\n frameAniTransComp.SetScale((1,1,1))\r\n frameAniControlComp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n frameAniControlComp.Play()\r\n\r\n # 删除\r\n def removeSfx(self, frameEntityId):\r\n self.DestroyEntity(frameEntityId)", "params": [ { - "name": "path", - "type": "str", + "type": "str", + "name": "path", "description": "特效配置路径,需要为\"effects/xxx.json\",\"xxx\"为编辑器创建序列帧时填写的名称" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "创建位置,可选,没传则可以创建完用frameAniTrans组件设置,一般需要设置播放的位置" - }, + }, { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "角度,可选,没传则可以创建完用frameAniTrans组件设置" - }, + }, { - "name": "scale", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "scale", "description": "缩放系数,可选,没传则可以创建完用frameAniTrans组件设置" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclass MyClientSystem(ClientSystem):\r\n # 创建\r\n def createSfxFromEditor(self):\r\n frameEntityId = self.CreateEngineSfxFromEditor(\"effects/mySfx.json\")\r\n frameAniTransComp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\n frameAniTransComp.SetPos((10,10,10))\r\n frameAniTransComp.SetRot((0,0,0))\r\n frameAniTransComp.SetScale((1,1,1))\r\n frameAniControlComp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n frameAniControlComp.Play()\r\n\r\n # 删除\r\n def removeSfx(self, frameEntityId):\r\n self.DestroyEntity(frameEntityId)" - }, + ], + "type": "api", + "side": "client", + "name": "CreateEngineSfxFromEditor" + }, { - "type": "api", - "name": "GetPos", - "method": "", - "description": "获取序列帧特效的位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\ncomp.GetPos()" - }, + "remark": "", + "return": [], + "description": "获取序列帧特效的位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\ncomp.GetPos()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPos" + }, { - "type": "api", - "name": "GetRot", - "method": "", - "description": "获取序列帧特效的旋转角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\ncomp.GetRot()" - }, + "remark": "", + "return": [], + "description": "获取序列帧特效的旋转角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\ncomp.GetRot()", + "params": [], + "type": "api", + "side": "client", + "name": "GetRot" + }, { - "type": "api", - "name": "GetScale", - "method": "", - "description": "获取序列帧特效的缩放值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\ncomp.GetScale()" - }, + "remark": "", + "return": [], + "description": "获取序列帧特效的缩放值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\ncomp.GetScale()", + "params": [], + "type": "api", + "side": "client", + "name": "GetScale" + }, { - "type": "api", - "name": "Pause", - "method": "", - "description": "暂停播放,序列帧定格在当前时刻,再次调用Play时继续播放", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\ncomp.Pause()" - }, + "remark": "", + "return": [], + "description": "暂停播放,序列帧定格在当前时刻,再次调用Play时继续播放", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\ncomp.Pause()", + "params": [], + "type": "api", + "side": "client", + "name": "Pause" + }, { - "type": "api", - "name": "Play", - "method": "", - "description": "播放序列帧", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\ncomp.Play()" - }, + "remark": "", + "return": [], + "description": "播放序列帧", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\ncomp.Play()", + "params": [], + "type": "api", + "side": "client", + "name": "Play" + }, { - "type": "api", - "name": "SetDeepTest", - "method": "", - "description": "设置序列帧是否透视,默认为否", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "", + "return": [], + "description": "设置序列帧是否透视,默认为否", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置为透视\r\ncomp.SetDeepTest(False)", "params": [ { - "name": "deepTest", - "type": "bool", + "type": "bool", + "name": "deepTest", "description": "False表示透视,则被物体/方块阻挡时仍然能看到序列帧" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置为透视\r\ncomp.SetDeepTest(False)" - }, + ], + "type": "api", + "side": "client", + "name": "SetDeepTest" + }, { - "type": "api", - "name": "SetFaceCamera", - "method": "", - "description": "设置序列帧是否始终朝向摄像机,默认为是", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "", + "return": [], + "description": "设置序列帧是否始终朝向摄像机,默认为是", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置为不始终朝摄像机\r\ncomp.SetFaceCamera(False)", "params": [ { - "name": "face", - "type": "bool", + "type": "bool", + "name": "face", "description": "True表示朝摄像机" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置为不始终朝摄像机\r\ncomp.SetFaceCamera(False)" - }, + ], + "type": "api", + "side": "client", + "name": "SetFaceCamera" + }, { - "type": "api", - "name": "SetFadeDistance", - "method": "", - "description": "设置序列帧开始自动调整透明度的距离。序列帧与摄像机之间的距离小于该值时会自动调整序列帧的透明度,距离摄像机越近,序列帧越透明", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "", + "return": [], + "description": "设置序列帧开始自动调整透明度的距离。序列帧与摄像机之间的距离小于该值时会自动调整序列帧的透明度,距离摄像机越近,序列帧越透明", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置该序列帧在与相机距离小于3时会自动调整透明度\r\ncomp.SetFadeDistance(3)", "params": [ { - "name": "fadeDistance", - "type": "float", + "type": "float", + "name": "fadeDistance", "description": "自动调整透明度的距离,应为正数,负数将视作零来处理" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置该序列帧在与相机距离小于3时会自动调整透明度\r\ncomp.SetFadeDistance(3)" - }, + ], + "type": "api", + "side": "client", + "name": "SetFadeDistance" + }, { - "type": "api", - "name": "SetGlobal", - "method": "", - "description": "设置序列帧是否是全局的,默认为否", - "remark": "- 全局时,不会因摄像机的视野范围而被裁剪", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "- 全局时,不会因摄像机的视野范围而被裁剪", + "return": [], + "description": "设置序列帧是否是全局的,默认为否", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\ncomp.SetGlobal(True)", "params": [ { - "name": "isGlobal", - "type": "bool", + "type": "bool", + "name": "isGlobal", "description": "True为全局,False为非全局" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\ncomp.SetGlobal(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetGlobal" + }, { - "type": "api", - "name": "SetLayer", - "method": "", - "description": "设置序列帧渲染层级,默认层级为1,当层级不为1时表示该特效开启特效分层渲染功能。特效(粒子和帧动画)分层渲染时,层级越高渲染越靠后,层级大的会遮挡层级低的,且同一层级的特效会根据特效的相对位置产生正确的相互遮挡关系。", - "remark": "- 该接口只针对序列帧进行设置,粒子特效请使用particleControl组件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "- 该接口只针对序列帧进行设置,粒子特效请使用particleControl组件", + "return": [], + "description": "设置序列帧渲染层级,默认层级为1,当层级不为1时表示该特效开启特效分层渲染功能。特效(粒子和帧动画)分层渲染时,层级越高渲染越靠后,层级大的会遮挡层级低的,且同一层级的特效会根据特效的相对位置产生正确的相互遮挡关系。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置为渲染层级为2\r\ncomp.SetLayer(2)", "params": [ { - "name": "layer", - "type": "int", + "type": "int", + "name": "layer", "description": "粒子渲染层级,总共包含0-15的层级。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置为渲染层级为2\r\ncomp.SetLayer(2)" - }, + ], + "type": "api", + "side": "client", + "name": "SetLayer" + }, { - "type": "api", - "name": "SetLoop", - "method": "", - "description": "设置序列帧是否循环播放,默认为否", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "", + "return": [], + "description": "设置序列帧是否循环播放,默认为否", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置为循环播放\r\ncomp.SetLoop(True)", "params": [ { - "name": "loop", - "type": "bool", + "type": "bool", + "name": "loop", "description": "True表示循环播放" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置为循环播放\r\ncomp.SetLoop(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetLoop" + }, { - "type": "api", - "name": "SetMixColor", - "method": "", - "description": "设置序列帧混合颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "", + "return": [], + "description": "设置序列帧混合颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置颜色为红色半透明\r\ncolor = (1, 0, 0, 0.5)\r\ncomp.SetMixColor(color)", "params": [ { - "name": "color", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "color", "description": "颜色的RGBA值,范围0-1" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置颜色为红色半透明\r\ncolor = (1, 0, 0, 0.5)\r\ncomp.SetMixColor(color)" - }, + ], + "type": "api", + "side": "client", + "name": "SetMixColor" + }, { - "type": "api", - "name": "SetPos", - "method": "", - "description": "设置序列帧的位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "", + "return": [], + "description": "设置序列帧的位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\ncomp.SetPos((0, 5, 0))", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "世界坐标" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\ncomp.SetPos((0, 5, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetPos" + }, { - "type": "api", - "name": "SetRot", - "method": "", - "description": "设置序列帧的旋转", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "", + "return": [], + "description": "设置序列帧的旋转", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\n# 绕y轴旋转90度,然后绕z轴旋转90度\r\ncomp.SetRot((0, 90, 90))", "params": [ { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "按顺序绕局部坐标系的+x,-y,+z轴旋转的角度" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\n# 绕y轴旋转90度,然后绕z轴旋转90度\r\ncomp.SetRot((0, 90, 90))" - }, + ], + "type": "api", + "side": "client", + "name": "SetRot" + }, { - "type": "api", - "name": "SetRotUseZXY", - "method": "", - "description": "设置序列帧的旋转,旋转顺序按照绕z,x,y轴旋转", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "", + "return": [], + "description": "设置序列帧的旋转,旋转顺序按照绕z,x,y轴旋转", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\n# 绕z轴旋转90度,然后绕y轴旋转90度\r\ncomp.SetRotUseZXY((0, 90, 90))", "params": [ { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "绕局部坐标系的+z,+x,+y轴旋转的角度,旋转顺序按照绕z,x,y轴旋转。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\n# 绕z轴旋转90度,然后绕y轴旋转90度\r\ncomp.SetRotUseZXY((0, 90, 90))" - }, + ], + "type": "api", + "side": "client", + "name": "SetRotUseZXY" + }, { - "type": "api", - "name": "SetScale", - "method": "", - "description": "设置序列帧的缩放", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "", + "return": [], + "description": "设置序列帧的缩放", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\n# 横向拉伸为2倍,纵向不变\r\ncomp.SetScale((2, 1, 1))", "params": [ { - "name": "scale", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "scale", "description": "对于平面序列帧,第一个参数为贴图横向上的缩放,第二个参数为纵向上的缩放,第三个参数无用。对于环状序列帧,为三个坐标轴上的缩放" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\n# 横向拉伸为2倍,纵向不变\r\ncomp.SetScale((2, 1, 1))" - }, + ], + "type": "api", + "side": "client", + "name": "SetScale" + }, { - "type": "api", - "name": "SetUsePointFiltering", - "method": "", - "description": "设置序列帧是否使用点滤波", - "remark": "- 使用点滤波的图像通常边缘清晰、可能会有较强烈的锯齿感;使用双线性插值的图像通常比较平滑、可能会使图像一定程度上变得模糊", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "remark": "- 使用点滤波的图像通常边缘清晰、可能会有较强烈的锯齿感;使用双线性插值的图像通常比较平滑、可能会使图像一定程度上变得模糊", + "return": [], + "description": "设置序列帧是否使用点滤波", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置该序列帧使用点滤波\r\ncomp.SetUsePointFiltering(True)", "params": [ { - "name": "use", - "type": "bool", + "type": "bool", + "name": "use", "description": "True为使用点滤波,False为使用双线性插值(默认使用)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\n# 设置该序列帧使用点滤波\r\ncomp.SetUsePointFiltering(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetUsePointFiltering" + }, { - "type": "api", - "name": "Stop", - "method": "", - "description": "停止序列帧(不是暂停)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\ncomp.Stop()" - }, + "remark": "", + "return": [], + "description": "停止序列帧(不是暂停)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/序列帧.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\ncomp.Stop()", + "params": [], + "type": "api", + "side": "client", + "name": "Stop" + }, { - "type": "api", - "name": "BindEntity", - "method": "", - "description": "绑定粒子发射器到指定实体的指定骨骼上", - "remark": "- 绑定变换的计算是在局部空间下完成的。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 绑定变换的计算是在局部空间下完成的。", + "return": [], + "description": "绑定粒子发射器到指定实体的指定骨骼上", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.Create(\"netease:tutorial_particle\")\r\ncomp.BindEntity(parId, localId, \"rightitem\", (0, 0, 0), (0, 0, 0))", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id 需要已经创建且未被销毁的粒子发射器" - }, + }, { - "name": "entity_id", - "type": "str或int", + "type": "str或int", + "name": "entity_id", "description": "需要绑定的实体id" - }, + }, { - "name": "bone_name", - "type": "str", + "type": "str", + "name": "bone_name", "description": "需要绑定的骨骼名称(不区分大小写) 默认值为\"body\",传入空字符串时代表根骨骼。包含多个根骨骼的情况下,选择按骨骼名称排序后的首个根骨骼。" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "三维 表示粒子发射器的绑定偏移 默认值为(0, 0, 0)" - }, + }, { - "name": "rotation", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rotation", "description": "表示粒子发射器绑定的三维旋转(角度制,按照ZYX顺序旋转) 默认值为(0, 0, 0)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.Create(\"netease:tutorial_particle\")\r\ncomp.BindEntity(parId, localId, \"rightitem\", (0, 0, 0), (0, 0, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "BindEntity" + }, { - "type": "api", - "name": "BindModel", - "method": "", - "description": "绑定粒子发射器到指定骨骼模型的指定骨骼上", - "remark": "- 绑定变换的计算是在局部空间下完成的,没有指定骨骼的情况下默认绑定到\"root\"上,如果root不存在则该粒子不会显示,也不会被销毁。\r\n - 切换至其他骨骼模型后导致model_id改变,所以绑定到原model_id上的粒子发射器也会一起消失。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 绑定变换的计算是在局部空间下完成的,没有指定骨骼的情况下默认绑定到\"root\"上,如果root不存在则该粒子不会显示,也不会被销毁。\r\n - 切换至其他骨骼模型后导致model_id改变,所以绑定到原model_id上的粒子发射器也会一起消失。", + "return": [], + "description": "绑定粒子发射器到指定骨骼模型的指定骨骼上", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(clientApi.GetLevelId())\r\n\r\npar_Id = comp.Create(\"netease:tutorial_particle\")\r\ncomp.BindModel(par_Id, model_id, \"root\", (0, 0, 0), (0, 0, 0))", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id 需要已经创建且未被销毁的粒子发射器" - }, + }, { - "name": "model_id", - "type": "int", + "type": "int", + "name": "model_id", "description": "绑定的骨骼模型的ID(见model组件的GetModelId)" - }, + }, { - "name": "bone_name", - "type": "str", + "type": "str", + "name": "bone_name", "description": "绑定具体骨骼的名称(不区分大小写),默认值为\"root\"" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "三维 表示粒子发射器的绑定偏移 默认值为(0, 0, 0)" - }, + }, { - "name": "rotation", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rotation", "description": "表示粒子发射器绑定的三维旋转(角度制,按照ZYX顺序旋转) 默认值为(0, 0, 0)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(clientApi.GetLevelId())\r\n\r\npar_Id = comp.Create(\"netease:tutorial_particle\")\r\ncomp.BindModel(par_Id, model_id, \"root\", (0, 0, 0), (0, 0, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "BindModel" + }, { - "type": "api", - "name": "Create", - "method": "", - "description": "创建粒子发射器, 创建后立即播放", - "remark": "- 粒子发射器json文件可以通过微软官方编辑器SnowStorm进行创建编辑,\r\n 开发者们可以通过访问在线网站 https://snowstorm.app 或在Visual Studio Code扩展商店中搜索\"snowstorm\"来使用这个编辑器\r\n - 粒子发射器json文件应存放在 资源包/particles 路径下\r\n - 粒子发射器json文件内容不应该包含中文,否则会无法解析\r\n - 请注意,如果粒子发射器出现在世界空间(即 没有绑定实体),\r\n 即使粒子发射器json文件定义了minecraft:emitter_lifetime_looping组件,\r\n 也只会播放一次或一个周期,随后销毁\r\n - 部分原版粒子使用了minecraft:emitter_rate_manual组件,需要额外调用EmitManually函数才能发射粒子", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 粒子发射器json文件可以通过微软官方编辑器SnowStorm进行创建编辑,\r\n 开发者们可以通过访问在线网站 https://snowstorm.app 或在Visual Studio Code扩展商店中搜索\"snowstorm\"来使用这个编辑器\r\n - 粒子发射器json文件应存放在 资源包/particles 路径下\r\n - 粒子发射器json文件内容不应该包含中文,否则会无法解析\r\n - 请注意,如果粒子发射器出现在世界空间(即 没有绑定实体),\r\n 即使粒子发射器json文件定义了minecraft:emitter_lifetime_looping组件,\r\n 也只会播放一次或一个周期,随后销毁\r\n - 部分原版粒子使用了minecraft:emitter_rate_manual组件,需要额外调用EmitManually函数才能发射粒子", + "return": [], + "description": "创建粒子发射器, 创建后立即播放", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nparId = comp.Create(\"netease:tutorial_particle\", (0, 0, 0), (0, 0, 0))", "params": [ { - "name": "effect_name", - "type": "str", + "type": "str", + "name": "effect_name", "description": "粒子发射器名称(粒子发射器json文件中的identifier)" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "三维 表示在某处创建粒子发射器 默认值为(0, 0, 0)" - }, + }, { - "name": "rotation", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rotation", "description": "粒子发射器创建后使用的三维旋转(使用角度制,按照ZYX顺序旋转) 默认值为(0, 0, 0)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nparId = comp.Create(\"netease:tutorial_particle\", (0, 0, 0), (0, 0, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "Create" + }, { - "type": "api", - "name": "CreateBindEntityNew", - "method": "", - "description": "创建粒子发射器并绑定到指定实体的指定骨骼上, 创建后立即播放", - "remark": "- 粒子发射器json文件可以通过微软官方编辑器SnowStorm进行创建编辑,\r\n 开发者们可以通过访问在线网站 https://snowstorm.app 或在Visual Studio Code扩展商店中搜索\"snowstorm\"来使用这个编辑器\r\n - 粒子发射器json文件应存放在 资源包/particles 路径下\r\n - 粒子发射器json文件内容不应该包含中文,否则会无法解析\r\n - 绑定变换的计算是在局部空间下完成的。\r\n - 部分原版粒子使用了minecraft:emitter_rate_manual组件,需要额外调用EmitManually函数才能发射粒子", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 粒子发射器json文件可以通过微软官方编辑器SnowStorm进行创建编辑,\r\n 开发者们可以通过访问在线网站 https://snowstorm.app 或在Visual Studio Code扩展商店中搜索\"snowstorm\"来使用这个编辑器\r\n - 粒子发射器json文件应存放在 资源包/particles 路径下\r\n - 粒子发射器json文件内容不应该包含中文,否则会无法解析\r\n - 绑定变换的计算是在局部空间下完成的。\r\n - 部分原版粒子使用了minecraft:emitter_rate_manual组件,需要额外调用EmitManually函数才能发射粒子", + "return": [], + "description": "创建粒子发射器并绑定到指定实体的指定骨骼上, 创建后立即播放", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntityNew(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))", "params": [ { - "name": "effect_name", - "type": "str", + "type": "str", + "name": "effect_name", "description": "粒子发射器名称(粒子发射器json文件中的identifier)" - }, + }, { - "name": "entity_id", - "type": "str或int", + "type": "str或int", + "name": "entity_id", "description": "需要绑定的实体id" - }, + }, { - "name": "bone_name", - "type": "str", + "type": "str", + "name": "bone_name", "description": "需要绑定的骨骼名称(不区分大小写) 默认值为\"body\",传入空字符串时代表根骨骼。包含多个根骨骼的情况下,选择按骨骼名称排序后的首个根骨骼。" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "三维 表示粒子发射器的绑定偏移 默认值为(0, 0, 0)" - }, + }, { - "name": "rotation", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rotation", "description": "表示粒子发射器绑定的三维旋转(使用角度制,按照ZYX顺序旋转) 默认值为(0, 0, 0)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntityNew(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "CreateBindEntityNew" + }, { - "type": "api", - "name": "EmitManually", - "method": "", - "description": "手动发射粒子一次", - "remark": "- 部分原版粒子使用了minecraft:emitter_rate_manual组件,在创建粒子发射器后不会自动发射粒子,需要额外调用该函数", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 部分原版粒子使用了minecraft:emitter_rate_manual组件,在创建粒子发射器后不会自动发射粒子,需要额外调用该函数", + "return": [], + "description": "手动发射粒子一次", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"minecraft:water_evaporation_manual\", localId, \"rightitem\")\r\ncomp.EmitManually(parId) # 手动发射一次粒子", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id 需要已经创建且未被销毁的粒子发射器" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"minecraft:water_evaporation_manual\", localId, \"rightitem\")\r\ncomp.EmitManually(parId) # 手动发射一次粒子" - }, + ], + "type": "api", + "side": "client", + "name": "EmitManually" + }, { - "type": "api", - "name": "Exist", - "method": "", - "description": "判断指定粒子发射器是否存在", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "", + "return": [], + "description": "判断指定粒子发射器是否存在", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.Exist(parId)\r\ncomp.RemoveAll()\r\nprint comp.Exist(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.Exist(parId)\r\ncomp.RemoveAll()\r\nprint comp.Exist(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "Exist" + }, { - "type": "api", - "name": "GetActiveDuration", - "method": "", - "description": "获取粒子发射器的激活周期", - "remark": "- 粒子发射器的激活周期在其对应的json文件(资源包/particles/xxx.json)中定义\r\n - 粒子发射器的播放周期等于 激活周期(active_time) + 休眠周期(sleep_time)\r\n - 对于没有定义激活周期的粒子发射器,其返回值为一个较大的数字(大约为1000000)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 粒子发射器的激活周期在其对应的json文件(资源包/particles/xxx.json)中定义\r\n - 粒子发射器的播放周期等于 激活周期(active_time) + 休眠周期(sleep_time)\r\n - 对于没有定义激活周期的粒子发射器,其返回值为一个较大的数字(大约为1000000)", + "return": [], + "description": "获取粒子发射器的激活周期", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetActiveDuration(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetActiveDuration(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "GetActiveDuration" + }, { - "type": "api", - "name": "GetBindingID", - "method": "", - "description": "返回粒子绑定的实体id,没有则返回\"0\"", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "", + "return": [], + "description": "返回粒子绑定的实体id,没有则返回\"0\"", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.Create(\"netease:tutorial_particle\")\r\ncomp.BindEntity(parId, localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetBindingID(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.Create(\"netease:tutorial_particle\")\r\ncomp.BindEntity(parId, localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetBindingID(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "GetBindingID" + }, { - "type": "api", - "name": "GetBindingModelID", - "method": "", - "description": "返回绑定的骨骼模型id 没有则返回-1", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "", + "return": [], + "description": "返回绑定的骨骼模型id 没有则返回-1", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncompFactory = clientApi.GetEngineCompFactory()\r\ncomp = compFactory.CreateParticleSystem(clientApi.GetLevelId())\r\nparId = comp.Create(\"netease:tutorial_particle\")\r\ncomp.BindModel(parId, modelId, 'root', (0, 0, 0), (0, 0, 0))\r\nprint comp.GetBindingModelID(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncompFactory = clientApi.GetEngineCompFactory()\r\ncomp = compFactory.CreateParticleSystem(clientApi.GetLevelId())\r\nparId = comp.Create(\"netease:tutorial_particle\")\r\ncomp.BindModel(parId, modelId, 'root', (0, 0, 0), (0, 0, 0))\r\nprint comp.GetBindingModelID(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "GetBindingModelID" + }, { - "type": "api", - "name": "GetDuration", - "method": "", - "description": "获取粒子发射器的播放周期(激活+休眠时间)", - "remark": "- 粒子发射器的播放周期在其对应的json文件(资源包/particles/xxx.json)中定义\r\n - 粒子发射器的播放周期等于 激活周期(active_time) + 休眠周期(sleep_time)\r\n - 对于没有定义播放周期的粒子发射器,其返回值为一个较大的数字(大约为1000000)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 粒子发射器的播放周期在其对应的json文件(资源包/particles/xxx.json)中定义\r\n - 粒子发射器的播放周期等于 激活周期(active_time) + 休眠周期(sleep_time)\r\n - 对于没有定义播放周期的粒子发射器,其返回值为一个较大的数字(大约为1000000)", + "return": [], + "description": "获取粒子发射器的播放周期(激活+休眠时间)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetDuration(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetDuration(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "GetDuration" + }, { - "type": "api", - "name": "GetFacingMode", - "method": "", - "description": "返回粒子发射器的粒子朝向模式", - "remark": "- 朝向模式暂不支持使用脚本设置,可以在粒子编辑器SnowStorm中编辑该属性:https://snowstorm.app\r\n - 目前支持的朝向模式如下:\r\n \r\n rotate_xyz 粒子朝向相机,面片与相机视角垂直\r\n rotate_y 粒子朝向相机,但是面片只旋转世界Y轴\r\n lookat_xyz 粒子旋转XYZ轴看向相机位置\r\n lookat_y 粒子仅旋转Y轴来看向相机位置\r\n lookat_direction 可以选择根据速度方向或者自定义方向来决定粒子面片朝向\r\n direction_x 粒子面片朝向发射器的x轴\r\n direction_y 粒子面片朝向发射器的y轴\r\n direction_z 粒子面片朝向发射器的z轴\r\n emitter_transform_xy 跟随粒子发射器的xy面朝向\r\n emitter_transform_xz 跟随粒子发射器的xz面朝向\r\n emitter_transform_yz 跟随粒子发射器的yz面朝向", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 朝向模式暂不支持使用脚本设置,可以在粒子编辑器SnowStorm中编辑该属性:https://snowstorm.app\r\n - 目前支持的朝向模式如下:\r\n \r\n rotate_xyz 粒子朝向相机,面片与相机视角垂直\r\n rotate_y 粒子朝向相机,但是面片只旋转世界Y轴\r\n lookat_xyz 粒子旋转XYZ轴看向相机位置\r\n lookat_y 粒子仅旋转Y轴来看向相机位置\r\n lookat_direction 可以选择根据速度方向或者自定义方向来决定粒子面片朝向\r\n direction_x 粒子面片朝向发射器的x轴\r\n direction_y 粒子面片朝向发射器的y轴\r\n direction_z 粒子面片朝向发射器的z轴\r\n emitter_transform_xy 跟随粒子发射器的xy面朝向\r\n emitter_transform_xz 跟随粒子发射器的xz面朝向\r\n emitter_transform_yz 跟随粒子发射器的yz面朝向", + "return": [], + "description": "返回粒子发射器的粒子朝向模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetFacingMode(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetFacingMode(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "GetFacingMode" + }, { - "type": "api", - "name": "GetLoopAge", - "method": "", - "description": "获取粒子发射器当前播放周期内已播放的时间", - "remark": "- 0.0 <= 已播放的时间 <= 粒子发射器播放周期\r\n - 返回的周期内已播放时间,受到SetTimeScale、Replay和PlayAt等函数的影响。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 0.0 <= 已播放的时间 <= 粒子发射器播放周期\r\n - 返回的周期内已播放时间,受到SetTimeScale、Replay和PlayAt等函数的影响。", + "return": [], + "description": "获取粒子发射器当前播放周期内已播放的时间", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetLoopAge(parId)\r\ncomp.PlayAt(parId, 0.5)\r\nprint comp.GetLoopAge(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetLoopAge(parId)\r\ncomp.PlayAt(parId, 0.5)\r\nprint comp.GetLoopAge(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "GetLoopAge" + }, { - "type": "api", - "name": "GetPos", - "method": "", - "description": "获取粒子发射器位置", - "remark": "- 如果粒子没有进行绑定(即 没有放在世界空间),则它的局部空间位置等于世界空间位置。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 如果粒子没有进行绑定(即 没有放在世界空间),则它的局部空间位置等于世界空间位置。", + "return": [], + "description": "获取粒子发射器位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 1, 0), (0, 0, 0))\r\nparId1 = comp.Create(\"netease:tutorial_particle\", (0, 1, 0), (0, 0, 0))\r\nprint 'local position:', comp.GetPos(parId0, True)\r\nprint 'local position:', comp.GetPos(parId1)\r\n\r\nprint 'world position:', comp.GetPos(parId0, False)\r\nprint 'world position:', comp.GetPos(parId1, False)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" - }, + }, { - "name": "is_local", - "type": "bool", + "type": "bool", + "name": "is_local", "description": "是否获取局部空间" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 1, 0), (0, 0, 0))\r\nparId1 = comp.Create(\"netease:tutorial_particle\", (0, 1, 0), (0, 0, 0))\r\nprint 'local position:', comp.GetPos(parId0, True)\r\nprint 'local position:', comp.GetPos(parId1)\r\n\r\nprint 'world position:', comp.GetPos(parId0, False)\r\nprint 'world position:', comp.GetPos(parId1, False)" - }, + ], + "type": "api", + "side": "client", + "name": "GetPos" + }, { - "type": "api", - "name": "GetRot", - "method": "", - "description": "获取粒子发射器局部旋转", - "remark": "- 如果粒子发射器没有进行绑定,则它的局部空间旋转等于世界空间旋转", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 如果粒子发射器没有进行绑定,则它的局部空间旋转等于世界空间旋转", + "return": [], + "description": "获取粒子发射器局部旋转", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (45, 0, 45))\r\nprint comp.GetRot(parId) # True\r\nprint comp.GetRot(parId, False)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" - }, + }, { - "name": "is_local", - "type": "bool", + "type": "bool", + "name": "is_local", "description": "表示是否获取局部空间旋转 默认值为True(即 默认获取局部空间旋转)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (45, 0, 45))\r\nprint comp.GetRot(parId) # True\r\nprint comp.GetRot(parId, False)" - }, + ], + "type": "api", + "side": "client", + "name": "GetRot" + }, { - "type": "api", - "name": "GetSleepDuration", - "method": "", - "description": "获取粒子发射器的休眠周期", - "remark": "- 粒子发射器的休眠周期在其对应的json文件(资源包/particles/xxx.json)中定义\r\n - 粒子发射器的播放周期等于 激活周期(active_time) + 休眠周期(sleep_time)\r\n - 对于没有定义休眠周期的粒子发射器,其返回值为0.0", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 粒子发射器的休眠周期在其对应的json文件(资源包/particles/xxx.json)中定义\r\n - 粒子发射器的播放周期等于 激活周期(active_time) + 休眠周期(sleep_time)\r\n - 对于没有定义休眠周期的粒子发射器,其返回值为0.0", + "return": [], + "description": "获取粒子发射器的休眠周期", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetSleepDuration(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetSleepDuration(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "GetSleepDuration" + }, { - "type": "api", - "name": "GetTimeScale", - "method": "", - "description": "获取粒子发射器的播放速度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "", + "return": [], + "description": "获取粒子发射器的播放速度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\")\r\nprint comp.GetTimeScale(parId)\r\ncomp.SetTimeScale(parId, 0.2)\r\nprint comp.GetTimeScale(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\")\r\nprint comp.GetTimeScale(parId)\r\ncomp.SetTimeScale(parId, 0.2)\r\nprint comp.GetTimeScale(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "GetTimeScale" + }, { - "type": "api", - "name": "GetVariable", - "method": "", - "description": "获取粒子发射器的Molang变量值", - "remark": "- Molang变量可以在粒子发射器json文件内自行定义。\r\n - 另外,粒子发射器以及粒子内置了一些Molang变量可供使用:\r\n \r\n variable.emitter_random_1 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_random_2 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_random_3 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_random_4 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_lifetime 粒子发射器的播放周期(生命周期)\r\n variable.emitter_age 粒子发射器当前播放时间\r\n variable.emitter_speed 粒子发射器的世界空间移动速度,标量,目前仅网易版我的世界可用\r\n variable.entity_scale 当粒子发射器绑定实体时,这个值表示绑定实体的大小缩放\r\n variable.particle_lifetime 粒子的生命周期\r\n variable.particle_age 粒子生成后已经过的时间\r\n variable.particle_random_1 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n variable.particle_random_2 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n variable.particle_random_3 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n variable.particle_random_4 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n - 关于Molang表达式的使用,目前大家可以参考微软官方文档:\r\n https://docs.microsoft.com/en-us/minecraft/creator/reference/content/molangreference/examples/molangconcepts/molangintroduction", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- Molang变量可以在粒子发射器json文件内自行定义。\r\n - 另外,粒子发射器以及粒子内置了一些Molang变量可供使用:\r\n \r\n variable.emitter_random_1 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_random_2 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_random_3 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_random_4 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_lifetime 粒子发射器的播放周期(生命周期)\r\n variable.emitter_age 粒子发射器当前播放时间\r\n variable.emitter_speed 粒子发射器的世界空间移动速度,标量,目前仅网易版我的世界可用\r\n variable.entity_scale 当粒子发射器绑定实体时,这个值表示绑定实体的大小缩放\r\n variable.particle_lifetime 粒子的生命周期\r\n variable.particle_age 粒子生成后已经过的时间\r\n variable.particle_random_1 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n variable.particle_random_2 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n variable.particle_random_3 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n variable.particle_random_4 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n - 关于Molang表达式的使用,目前大家可以参考微软官方文档:\r\n https://docs.microsoft.com/en-us/minecraft/creator/reference/content/molangreference/examples/molangconcepts/molangintroduction", + "return": [], + "description": "获取粒子发射器的Molang变量值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetVariable(parId, 'variable.custom_size') # variable.custom_size 是粒子json文件中自定义的变量", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" - }, + }, { - "name": "variable_name", - "type": "str", + "type": "str", + "name": "variable_name", "description": "Molang变量名(例如variable.emitter_age)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetVariable(parId, 'variable.custom_size') # variable.custom_size 是粒子json文件中自定义的变量" - }, + ], + "type": "api", + "side": "client", + "name": "GetVariable" + }, { - "type": "api", - "name": "Hide", - "method": "", - "description": "隐藏粒子发射器(不渲染)", - "remark": "- 请注意,这个函数并不停止粒子发射器的更新,因此粒子发射器在没有绑定实体或被设计为仅播放一次的情况下,会因为播放结束而自然销毁。\r\n - 可以和Show函数配合使用。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 请注意,这个函数并不停止粒子发射器的更新,因此粒子发射器在没有绑定实体或被设计为仅播放一次的情况下,会因为播放结束而自然销毁。\r\n - 可以和Show函数配合使用。", + "return": [], + "description": "隐藏粒子发射器(不渲染)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.IsHiding(parId)\r\n\r\n# 可以等待粒子出现后调用\r\ncomp.Hide(parId)\r\nprint comp.IsHiding(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.IsHiding(parId)\r\n\r\n# 可以等待粒子出现后调用\r\ncomp.Hide(parId)\r\nprint comp.IsHiding(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "Hide" + }, { - "type": "api", - "name": "IsHiding", - "method": "", - "description": "返回粒子发射器是否正在被隐藏(不渲染)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "", + "return": [], + "description": "返回粒子发射器是否正在被隐藏(不渲染)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.IsHiding(parId)\r\ncomp.Hide(parId)\r\nprint comp.IsHiding(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.IsHiding(parId)\r\ncomp.Hide(parId)\r\nprint comp.IsHiding(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "IsHiding" + }, { - "type": "api", - "name": "IsPausing", - "method": "", - "description": "返回粒子发射器的逻辑是否正在被暂停", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "", + "return": [], + "description": "返回粒子发射器的逻辑是否正在被暂停", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.IsPausing(parId)\r\ncomp.Pause(parId)\r\nprint comp.IsPausing(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.IsPausing(parId)\r\ncomp.Pause(parId)\r\nprint comp.IsPausing(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "IsPausing" + }, { - "type": "api", - "name": "Pause", - "method": "", - "description": "暂停粒子发射器的逻辑更新,但保持渲染状态", - "remark": "- 可以和Resume函数配合使用,用于暂停粒子发射器的逻辑。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 可以和Resume函数配合使用,用于暂停粒子发射器的逻辑。", + "return": [], + "description": "暂停粒子发射器的逻辑更新,但保持渲染状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.IsPausing(parId)\r\n\r\n# 等待一段时间后调用可以看到时间静止的效果\r\ncomp.Pause(parId)\r\nprint comp.IsPausing(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.IsPausing(parId)\r\n\r\n# 等待一段时间后调用可以看到时间静止的效果\r\ncomp.Pause(parId)\r\nprint comp.IsPausing(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "Pause" + }, { - "type": "api", - "name": "Play", - "method": "", - "description": "播放粒子发射器", - "remark": "- 粒子发射器在创建时就会立即播放,因此不需要手动调用这个函数。\r\n - 这个函数等价于调用Resume和Show,如果同时需要这两个功能,建议直接使用这个函数。\r\n - 这个函数用于和Stop函数配合使用,可以使粒子发射器在被停止的时间点继续播放(恢复逻辑更新、开启渲染)。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 粒子发射器在创建时就会立即播放,因此不需要手动调用这个函数。\r\n - 这个函数等价于调用Resume和Show,如果同时需要这两个功能,建议直接使用这个函数。\r\n - 这个函数用于和Stop函数配合使用,可以使粒子发射器在被停止的时间点继续播放(恢复逻辑更新、开启渲染)。", + "return": [], + "description": "播放粒子发射器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\ncomp.Stop(parId)\r\nprint comp.IsHiding(parId)\r\nprint comp.IsPausing(parId)\r\n\r\ncomp.Play(parId)\r\nprint comp.IsHiding(parId)\r\nprint comp.IsPausing(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\ncomp.Stop(parId)\r\nprint comp.IsHiding(parId)\r\nprint comp.IsPausing(parId)\r\n\r\ncomp.Play(parId)\r\nprint comp.IsHiding(parId)\r\nprint comp.IsPausing(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "Play" + }, { - "type": "api", - "name": "PlayAt", - "method": "", - "description": "设置粒子发射器播放时间点", - "remark": "- 这个函数可以和Stop函数配合使用(跳转到指定时间点、继续逻辑更新且开启渲染)。\r\n - 这个函数可以使粒子发射器跳转到它的某个时间点进行播放。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 这个函数可以和Stop函数配合使用(跳转到指定时间点、继续逻辑更新且开启渲染)。\r\n - 这个函数可以使粒子发射器跳转到它的某个时间点进行播放。", + "return": [], + "description": "设置粒子发射器播放时间点", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetLoopAge(parId)\r\n\r\ncomp.PlayAt(parId, 0.5)\r\nprint comp.GetLoopAge(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" - }, + }, { - "name": "at_second", - "type": "float", + "type": "float", + "name": "at_second", "description": "播放时间点" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.GetLoopAge(parId)\r\n\r\ncomp.PlayAt(parId, 0.5)\r\nprint comp.GetLoopAge(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "PlayAt" + }, { - "type": "api", - "name": "Remove", - "method": "", - "description": "销毁指定粒子发射器", - "remark": "- 原版的雨水等粒子发射器目前无法通过类似接口销毁,可能是因为它们使用了旧版的微软粒子系统", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 原版的雨水等粒子发射器目前无法通过类似接口销毁,可能是因为它们使用了旧版的微软粒子系统", + "return": [], + "description": "销毁指定粒子发射器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.Exist(parId)\r\ncomp.Remove(parId)\r\nprint comp.Exist(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id 对于不存在的粒子发射器id不会进行任何操作" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.Exist(parId)\r\ncomp.Remove(parId)\r\nprint comp.Exist(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "Remove" + }, { - "type": "api", - "name": "RemoveByName", - "method": "", - "description": "销毁场景中指定名称(粒子发射器json中的identifier)的所有粒子发射器", - "remark": "- 原版的雨水等粒子发射器目前无法通过类似接口销毁,可能是因为它们使用了旧版的微软粒子系统进行管理", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 原版的雨水等粒子发射器目前无法通过类似接口销毁,可能是因为它们使用了旧版的微软粒子系统进行管理", + "return": [], + "description": "销毁场景中指定名称(粒子发射器json中的identifier)的所有粒子发射器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.Exist(parId)\r\ncomp.RemoveByName(\"netease:tutorial_particle\")\r\nprint comp.Exist(parId)", "params": [ { - "name": "effect_name", - "type": "str", + "type": "str", + "name": "effect_name", "description": "粒子发射器名称(json中的identifier)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.Exist(parId)\r\ncomp.RemoveByName(\"netease:tutorial_particle\")\r\nprint comp.Exist(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveByName" + }, { - "type": "api", - "name": "Replay", - "method": "", - "description": "重播粒子发射器", - "remark": "- 这个函数可以和Stop函数配合使用(重新进行逻辑更新、开启渲染)。\r\n - 这个函数可以使粒子发射器回到它的时间点零,重新播放(不能用于已经被销毁的粒子发射器)。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 这个函数可以和Stop函数配合使用(重新进行逻辑更新、开启渲染)。\r\n - 这个函数可以使粒子发射器回到它的时间点零,重新播放(不能用于已经被销毁的粒子发射器)。", + "return": [], + "description": "重播粒子发射器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\n\r\n# 可以等待一段时间后调用\r\ncomp.Replay(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\n\r\n# 可以等待一段时间后调用\r\ncomp.Replay(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "Replay" + }, { - "type": "api", - "name": "Resume", - "method": "", - "description": "恢复粒子发射器的逻辑更新,不影响渲染状态", - "remark": "- 可以和Pause函数配合使用,用于恢复粒子发射器的逻辑更新。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 可以和Pause函数配合使用,用于恢复粒子发射器的逻辑更新。", + "return": [], + "description": "恢复粒子发射器的逻辑更新,不影响渲染状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\ncomp.Pause(parId)\r\nprint comp.IsPausing(parId)\r\n\r\n# 可以等待一段时间后调用\r\ncomp.Resume(parId)\r\nprint comp.IsPausing(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\ncomp.Pause(parId)\r\nprint comp.IsPausing(parId)\r\n\r\n# 可以等待一段时间后调用\r\ncomp.Resume(parId)\r\nprint comp.IsPausing(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "Resume" + }, { - "type": "api", - "name": "SetPos", - "method": "", - "description": "设置粒子发射器位置", - "remark": "- 粒子发射器没有进行绑定(即 被放在世界空间)时,它的局部空间位置就是世界空间位置。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 粒子发射器没有进行绑定(即 被放在世界空间)时,它的局部空间位置就是世界空间位置。", + "return": [], + "description": "设置粒子发射器位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"leftitem\", (0, 1, 0), (0, 0, 0))\r\nparId1 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, -1, 0), (0, 0, 0))\r\n\r\ncomp.SetPos(parId0, (0, 0.5, 0))\r\ncomp.SetPos(parId1) # (0, 0, 0)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" - }, + }, { - "name": "pos", - "type": "Tuple", + "type": "Tuple", + "name": "pos", "description": "三维 表示粒子发射器局部空间位置 默认值为(0, 0, 0)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"leftitem\", (0, 1, 0), (0, 0, 0))\r\nparId1 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, -1, 0), (0, 0, 0))\r\n\r\ncomp.SetPos(parId0, (0, 0.5, 0))\r\ncomp.SetPos(parId1) # (0, 0, 0)" - }, + ], + "type": "api", + "side": "client", + "name": "SetPos" + }, { - "type": "api", - "name": "SetRelative", - "method": "", - "description": "设置粒子是否在局部空间进行计算", - "remark": "- 此函数对于没有绑定的粒子发射器无效\r\n - 有关的值可以在粒子发射器json文件中的minecraft:emitter_local_space组件内预先定义,\r\n 如果没有该组件,则默认在世界坐标系下(False)进行变换\r\n - 设置relative为False时,涉及粒子运动相关的计算都会当作是在世界空间进行的。\r\n - 设置relative为True时,涉及粒子运动相关的计算都会当作是在局部空间进行的。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 此函数对于没有绑定的粒子发射器无效\r\n - 有关的值可以在粒子发射器json文件中的minecraft:emitter_local_space组件内预先定义,\r\n 如果没有该组件,则默认在世界坐标系下(False)进行变换\r\n - 设置relative为False时,涉及粒子运动相关的计算都会当作是在世界空间进行的。\r\n - 设置relative为True时,涉及粒子运动相关的计算都会当作是在局部空间进行的。", + "return": [], + "description": "设置粒子是否在局部空间进行计算", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\n# 开发者可以对比两者的区别来理解两个不同的计算空间\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"leftitem\", (0, 1.0, 0), (90, 0, 0))\r\ncomp.SetRelative(parId0, False)\r\nparId1 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 1.0, 0), (90, 0, 0))\r\ncomp.SetRelative(parId1, True)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id 需要粒子发射器已绑定实体" - }, + }, { - "name": "is_relative", - "type": "bool", + "type": "bool", + "name": "is_relative", "description": "表示粒子是否在局部空间进行计算 默认参数值为True" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\n# 开发者可以对比两者的区别来理解两个不同的计算空间\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"leftitem\", (0, 1.0, 0), (90, 0, 0))\r\ncomp.SetRelative(parId0, False)\r\nparId1 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 1.0, 0), (90, 0, 0))\r\ncomp.SetRelative(parId1, True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetRelative" + }, { - "type": "api", - "name": "SetRot", - "method": "", - "description": "设置粒子发射器局部旋转", - "remark": "- 如果粒子发射器没有进行绑定,则它的局部空间旋转就是世界空间旋转", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 如果粒子发射器没有进行绑定,则它的局部空间旋转就是世界空间旋转", + "return": [], + "description": "设置粒子发射器局部旋转", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"leftitem\", (0, 0, 0), (0, 0, 0))\r\nparId1 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\ncomp.SetRot(parId1, (0, 0, 90))", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" - }, + }, { - "name": "rot", - "type": "Tuple", + "type": "Tuple", + "name": "rot", "description": "粒子发射器三维旋转(使用角度制,按照ZYX顺序旋转) 默认值为(0, 0, 0)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"leftitem\", (0, 0, 0), (0, 0, 0))\r\nparId1 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\ncomp.SetRot(parId1, (0, 0, 90))" - }, + ], + "type": "api", + "side": "client", + "name": "SetRot" + }, { - "type": "api", - "name": "SetRotUseZXY", - "method": "", - "description": "设置粒子发射器局部旋转,旋转顺序按照绕z,x,y轴旋转", - "remark": "- 如果粒子发射器没有进行绑定,则它的局部空间旋转就是世界空间旋转", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 如果粒子发射器没有进行绑定,则它的局部空间旋转就是世界空间旋转", + "return": [], + "description": "设置粒子发射器局部旋转,旋转顺序按照绕z,x,y轴旋转", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"leftitem\", (0, 0, 0), (0, 0, 0))\r\nparId1 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\n# 绕z轴旋转90度,然后绕x轴旋转90度,最后再绕y轴旋转90度\r\ncomp.SetRotUseZXY(parId1, (90, 90, 90))", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" - }, + }, { - "name": "rot", - "type": "Tuple", + "type": "Tuple", + "name": "rot", "description": "粒子发射器三维旋转(使用角度制,按照ZXY顺序旋转) 默认值为(0, 0, 0)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"leftitem\", (0, 0, 0), (0, 0, 0))\r\nparId1 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\n# 绕z轴旋转90度,然后绕x轴旋转90度,最后再绕y轴旋转90度\r\ncomp.SetRotUseZXY(parId1, (90, 90, 90))" - }, + ], + "type": "api", + "side": "client", + "name": "SetRotUseZXY" + }, { - "type": "api", - "name": "SetTimeScale", - "method": "", - "description": "设置粒子发射器的播放速度", - "remark": "- 倒放时已经消失的粒子(请注意是单个粒子而不是粒子发射器)不会重新出现,也不会生成新的粒子\r\n - 如果倒放到了时间点0,没有绑定或者不循环播放的粒子发射器会被销毁", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 倒放时已经消失的粒子(请注意是单个粒子而不是粒子发射器)不会重新出现,也不会生成新的粒子\r\n - 如果倒放到了时间点0,没有绑定或者不循环播放的粒子发射器会被销毁", + "return": [], + "description": "设置粒子发射器的播放速度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"leftitem\")\r\n# comp.SetTimeScale(parId0, 1.0)\r\nparId1 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\")\r\ncomp.SetTimeScale(parId1, 0.2)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" - }, + }, { - "name": "scale", - "type": "float", + "type": "float", + "name": "scale", "description": "表示播放倍率 可以为负数进行倒放" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"leftitem\")\r\n# comp.SetTimeScale(parId0, 1.0)\r\nparId1 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\")\r\ncomp.SetTimeScale(parId1, 0.2)" - }, + ], + "type": "api", + "side": "client", + "name": "SetTimeScale" + }, { - "type": "api", - "name": "SetVariable", - "method": "", - "description": "设置粒子发射器的Molang变量值", - "remark": "- Molang变量可以在粒子发射器json文件内自行定义。\r\n - 另外,粒子发射器以及粒子内置了一些Molang变量可供使用:\r\n \r\n variable.emitter_random_1 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_random_2 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_random_3 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_random_4 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_lifetime 粒子发射器的播放周期(生命周期)\r\n variable.emitter_age 粒子发射器当前播放时间\r\n variable.emitter_speed 粒子发射器的世界空间移动速度,标量,目前仅网易版我的世界可用\r\n variable.entity_scale 当粒子发射器绑定实体时,这个值表示绑定实体的大小缩放\r\n variable.particle_lifetime 粒子的生命周期\r\n variable.particle_age 粒子生成后已经过的时间\r\n variable.particle_random_1 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n variable.particle_random_2 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n variable.particle_random_3 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n variable.particle_random_4 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n 部分内置的变量(例如variable.emitter_age)会每帧进行刷新,修改它们的值可能会没有任何效果。\r\n - 关于Molang表达式的使用,目前大家可以参考微软官方文档:\r\n https://docs.microsoft.com/en-us/minecraft/creator/reference/content/molangreference/examples/molangconcepts/molangintroduction", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- Molang变量可以在粒子发射器json文件内自行定义。\r\n - 另外,粒子发射器以及粒子内置了一些Molang变量可供使用:\r\n \r\n variable.emitter_random_1 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_random_2 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_random_3 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_random_4 粒子发射器随机数,范围是0.0到1.0,仅在粒子发射器创建时生成一次\r\n variable.emitter_lifetime 粒子发射器的播放周期(生命周期)\r\n variable.emitter_age 粒子发射器当前播放时间\r\n variable.emitter_speed 粒子发射器的世界空间移动速度,标量,目前仅网易版我的世界可用\r\n variable.entity_scale 当粒子发射器绑定实体时,这个值表示绑定实体的大小缩放\r\n variable.particle_lifetime 粒子的生命周期\r\n variable.particle_age 粒子生成后已经过的时间\r\n variable.particle_random_1 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n variable.particle_random_2 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n variable.particle_random_3 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n variable.particle_random_4 粒子随机数,范围是0.0到1.0,仅在粒子生成时生成一次\r\n 部分内置的变量(例如variable.emitter_age)会每帧进行刷新,修改它们的值可能会没有任何效果。\r\n - 关于Molang表达式的使用,目前大家可以参考微软官方文档:\r\n https://docs.microsoft.com/en-us/minecraft/creator/reference/content/molangreference/examples/molangconcepts/molangintroduction", + "return": [], + "description": "设置粒子发射器的Molang变量值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"leftitem\", (0, 0, 0), (0, 0, 0))\r\nparId1 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\n\r\ncomp.SetVariable(parId1, \"variable.custom_size\", 0.1) # 修改内置的Molang值效果不明显甚至无效,因此建议自定义变量名", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" - }, + }, { - "name": "variable_name", - "type": "str", + "type": "str", + "name": "variable_name", "description": "Molang变量名" - }, + }, { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "表示粒子发射器的Molang变量值" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId0 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"leftitem\", (0, 0, 0), (0, 0, 0))\r\nparId1 = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\n\r\ncomp.SetVariable(parId1, \"variable.custom_size\", 0.1) # 修改内置的Molang值效果不明显甚至无效,因此建议自定义变量名" - }, + ], + "type": "api", + "side": "client", + "name": "SetVariable" + }, { - "type": "api", - "name": "Show", - "method": "", - "description": "显示粒子发射器(开启渲染)", - "remark": "- 可以和Hide函数配合使用,用于恢复粒子发射器的显示。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 可以和Hide函数配合使用,用于恢复粒子发射器的显示。", + "return": [], + "description": "显示粒子发射器(开启渲染)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\n# 可以等待粒子出现后调用\r\ncomp.Hide(parId)\r\nprint comp.IsHiding(parId)\r\n\r\n# 可以等待粒子隐藏后调用\r\ncomp.Show(parId)\r\nprint comp.IsHiding(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\n# 可以等待粒子出现后调用\r\ncomp.Hide(parId)\r\nprint comp.IsHiding(parId)\r\n\r\n# 可以等待粒子隐藏后调用\r\ncomp.Show(parId)\r\nprint comp.IsHiding(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "Show" + }, { - "type": "api", - "name": "Stop", - "method": "", - "description": "停止粒子发射器播放(不渲染且不更新逻辑)", - "remark": "- 这个函数等价于调用Pause和Hide,如果同时需要这两个功能,建议直接使用这个函数。\r\n - 因为逻辑被停止更新,所以粒子发射器不会由于播放结束而被自然销毁。\r\n - 可以使用Play、Replay或PlayAt函数来播放被停止的粒子发射器。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- 这个函数等价于调用Pause和Hide,如果同时需要这两个功能,建议直接使用这个函数。\r\n - 因为逻辑被停止更新,所以粒子发射器不会由于播放结束而被自然销毁。\r\n - 可以使用Play、Replay或PlayAt函数来播放被停止的粒子发射器。", + "return": [], + "description": "停止粒子发射器播放(不渲染且不更新逻辑)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.IsHiding(parId)\r\nprint comp.IsPausing(parId)\r\n\r\n# 可以等待一段时间后调用\r\ncomp.Stop(parId)\r\nprint comp.IsHiding(parId)\r\nprint comp.IsPausing(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (0, 0, 0), (0, 0, 0))\r\nprint comp.IsHiding(parId)\r\nprint comp.IsPausing(parId)\r\n\r\n# 可以等待一段时间后调用\r\ncomp.Stop(parId)\r\nprint comp.IsHiding(parId)\r\nprint comp.IsPausing(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "Stop" + }, { - "type": "api", - "name": "Unbind", - "method": "", - "description": "解除指定粒子发射器的绑定状态", - "remark": "- keep_position为False时,解绑后的粒子发射器将使用绑定时的局部偏移作为世界空间位置(即例子中的(6, 6, 6))\r\n keep_rotation为False时,解绑后的粒子发射器将使用绑定时的局部旋转作为世界空间旋转(即例子中的(0, 0, 0))\r\n - keep_position为True时,解绑后的粒子发射器会保持在解绑前一刻所在的世界空间位置\r\n keep_rotation为True时,解绑后的粒子发射器会保持解绑前一刻的世界空间旋转\r\n - 请注意,如果粒子发射器出现在世界空间(即 没有绑定实体),\r\n 即使粒子发射器json文件定义了minecraft:emitter_lifetime_looping组件,\r\n 也只会播放一次或一个周期,随后销毁", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "remark": "- keep_position为False时,解绑后的粒子发射器将使用绑定时的局部偏移作为世界空间位置(即例子中的(6, 6, 6))\r\n keep_rotation为False时,解绑后的粒子发射器将使用绑定时的局部旋转作为世界空间旋转(即例子中的(0, 0, 0))\r\n - keep_position为True时,解绑后的粒子发射器会保持在解绑前一刻所在的世界空间位置\r\n keep_rotation为True时,解绑后的粒子发射器会保持解绑前一刻的世界空间旋转\r\n - 请注意,如果粒子发射器出现在世界空间(即 没有绑定实体),\r\n 即使粒子发射器json文件定义了minecraft:emitter_lifetime_looping组件,\r\n 也只会播放一次或一个周期,随后销毁", + "return": [], + "description": "解除指定粒子发射器的绑定状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/微软粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (6, 6, 6), (0, 0, 0))\r\ncomp.Unbind(parId)", "params": [ { - "name": "par_id", - "type": "int", + "type": "int", + "name": "par_id", "description": "粒子发射器id 需要已经创建且未被销毁的粒子发射器" - }, + }, { - "name": "keep_position", - "type": "bool", + "type": "bool", + "name": "keep_position", "description": "解绑后是否保持粒子发射器在世界空间的位置 默认值为True" - }, + }, { - "name": "keep_rotation", - "type": "bool", + "type": "bool", + "name": "keep_rotation", "description": "解绑后是否保持粒子发射器在世界空间的旋转 默认值为True" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSystem(None)\r\nlocalId = clientApi.GetLocalPlayerId()\r\n\r\nparId = comp.CreateBindEntity(\"netease:tutorial_particle\", localId, \"rightitem\", (6, 6, 6), (0, 0, 0))\r\ncomp.Unbind(parId)" - }, + ], + "type": "api", + "side": "client", + "name": "Unbind" + }, { - "type": "api", - "name": "CreateTextBoardInWorld", - "method": "", - "description": "创建文字面板", - "remark": "- 切换维度后会自动隐藏非本维度创建的而且没有绑定实体的文字面板, 回到该维度后会自动重新显示", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "remark": "- 切换维度后会自动隐藏非本维度创建的而且没有绑定实体的文字面板, 回到该维度后会自动重新显示", + "return": [], + "description": "创建文字面板", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\ncomp.CreateTextBoardInWorld(\"我显示在世界坐标位置\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1), True)", "params": [ { - "name": "text", - "type": "str", + "type": "str", + "name": "text", "description": "文字显示内容" - }, + }, { - "name": "textColor", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "textColor", "description": "文字颜色的RGBA值,范围0-1" - }, + }, { - "name": "boardColor", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "boardColor", "description": "可选参数,默认None,设置为黑色,面板颜色的RGBA值,范围0-1" - }, + }, { - "name": "faceCamera", - "type": "bool", + "type": "bool", + "name": "faceCamera", "description": "是否始终朝向相机, 默认为True" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\ncomp.CreateTextBoardInWorld(\"我显示在世界坐标位置\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1), True)" - }, + ], + "type": "api", + "side": "client", + "name": "CreateTextBoardInWorld" + }, { - "type": "api", - "name": "RemoveTextBoard", - "method": "", - "description": "删除文字面板", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "remark": "", + "return": [], + "description": "删除文字面板", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在世界坐标位置\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1), True)\r\nif boardId:\r\n comp.RemoveTextBoard(boardId)", "params": [ { - "name": "boardId", - "type": "int", + "type": "int", + "name": "boardId", "description": "创建的时候返回的id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在世界坐标位置\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1), True)\r\nif boardId:\r\n comp.RemoveTextBoard(boardId)" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveTextBoard" + }, { - "type": "api", - "name": "SetBoardBackgroundColor", - "method": "", - "description": "修改背景颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "remark": "", + "return": [], + "description": "修改背景颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardBackgroundColor(boardId, (1.0, 1.0, 1.0, 1.0))", "params": [ { - "name": "boardId", - "type": "int", + "type": "int", + "name": "boardId", "description": "文字面板的id" - }, + }, { - "name": "backgroundColor", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "backgroundColor", "description": "颜色的RGBA值,范围0-1" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardBackgroundColor(boardId, (1.0, 1.0, 1.0, 1.0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetBoardBackgroundColor" + }, { - "type": "api", - "name": "SetBoardBindEntity", - "method": "", - "description": "文字面板绑定实体对象", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "remark": "", + "return": [], + "description": "文字面板绑定实体对象", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))", "params": [ { - "name": "boardId", - "type": "int", + "type": "int", + "name": "boardId", "description": "文字面板的id" - }, + }, { - "name": "bindEntityId", - "type": "str", + "type": "str", + "name": "bindEntityId", "description": "绑定entity的Id; 如果为None,则为取消实体绑定, 此时下面参数为世界坐标和旋转" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "相对于实体的偏移量" - }, + }, { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "相对于实体的偏移角度" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetBoardBindEntity" + }, { - "type": "api", - "name": "SetBoardDepthTest", - "method": "", - "description": "设置是否开启深度测试, 默认状态下是开启", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "remark": "", + "return": [], + "description": "设置是否开启深度测试, 默认状态下是开启", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardDepthTest(boardId, False)", "params": [ { - "name": "boardId", - "type": "int", + "type": "int", + "name": "boardId", "description": "文字面板的id" - }, + }, { - "name": "depthTest", - "type": "bool", + "type": "bool", + "name": "depthTest", "description": "True为开启深度测试,False为不开启" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardDepthTest(boardId, False)" - }, + ], + "type": "api", + "side": "client", + "name": "SetBoardDepthTest" + }, { - "type": "api", - "name": "SetBoardFaceCamera", - "method": "", - "description": "设置文字面板的朝向", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "remark": "", + "return": [], + "description": "设置文字面板的朝向", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardFaceCamera(boardId, True)", "params": [ { - "name": "boardId", - "type": "int", + "type": "int", + "name": "boardId", "description": "文字面板的id" - }, + }, { - "name": "faceCamera", - "type": "bool", + "type": "bool", + "name": "faceCamera", "description": "是否始终朝向相机, 默认为True" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardFaceCamera(boardId, True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetBoardFaceCamera" + }, { - "type": "api", - "name": "SetBoardPos", - "method": "", - "description": "修改位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "remark": "", + "return": [], + "description": "修改位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardPos(boardId, (0.0, 3.0, 0.0))", "params": [ { - "name": "boardId", - "type": "int", + "type": "int", + "name": "boardId", "description": "文字面板的id" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "坐标" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardPos(boardId, (0.0, 3.0, 0.0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetBoardPos" + }, { - "type": "api", - "name": "SetBoardRot", - "method": "", - "description": "修改旋转角度, 若设置了文本朝向相机,则旋转角度的修改不会生效", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "remark": "", + "return": [], + "description": "修改旋转角度, 若设置了文本朝向相机,则旋转角度的修改不会生效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardRot(boardId, (45.0, 90.0, 0.0))", "params": [ { - "name": "boardId", - "type": "int", + "type": "int", + "name": "boardId", "description": "文字面板的id" - }, + }, { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "角度(不是弧度)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardRot(boardId, (45.0, 90.0, 0.0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetBoardRot" + }, { - "type": "api", - "name": "SetBoardScale", - "method": "", - "description": "内容整体缩放", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "remark": "", + "return": [], + "description": "内容整体缩放", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardScale(boardId, (2.0, 2.0))", "params": [ { - "name": "boardId", - "type": "int", + "type": "int", + "name": "boardId", "description": "文字面板的id" - }, + }, { - "name": "scale", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "scale", "description": "x,y方向上的缩放值,要求值大于0,正常状态下是(1.0,1.0)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardScale(boardId, (2.0, 2.0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetBoardScale" + }, { - "type": "api", - "name": "SetBoardTextColor", - "method": "", - "description": "修改字体颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "remark": "", + "return": [], + "description": "修改字体颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardTextColor(boardId, (1.0, 1.0, 0.0, 0.8))", "params": [ { - "name": "boardId", - "type": "int", + "type": "int", + "name": "boardId", "description": "文字面板的id" - }, + }, { - "name": "textColor", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "textColor", "description": "颜色的RGBA值,范围0-1" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"我显示在玩家头顶\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetBoardBindEntity(boardId, clientApi.GetLocalPlayerId(), (0.0, 1.5, 0.0), (0.0, 0.0, 0.0))\r\n comp.SetBoardTextColor(boardId, (1.0, 1.0, 0.0, 0.8))" - }, + ], + "type": "api", + "side": "client", + "name": "SetBoardTextColor" + }, { - "type": "api", - "name": "SetText", - "method": "", - "description": "修改文字面板内容", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "remark": "", + "return": [], + "description": "修改文字面板内容", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/文字面板.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"初始文字\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetText(boardId, \"修改后的文字\")", "params": [ { - "name": "boardId", - "type": "int", + "type": "int", + "name": "boardId", "description": "文字面板id" - }, + }, { - "name": "text", - "type": "str", + "type": "str", + "name": "text", "description": "文字内容" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\nboardId = comp.CreateTextBoardInWorld(\"初始文字\",(0.5, 0.4, 0.3, 0.8),(0, 0, 0, 1),True)\r\nif boardId:\r\n comp.SetText(boardId, \"修改后的文字\")" - }, + ], + "type": "api", + "side": "client", + "name": "SetText" + }, { - "type": "api", - "name": "CreateEngineEffectBind", - "method": "", - "description": "指用编辑器保存资源包中models/bind/xxx_bind.json生成编辑好的所有挂点的所有特效。生成的特效会自动进行挂接及播放,编辑器中设为不可见的特效也会进行播放。并且使用这种方式创建的特效,开发者不用维护entity进出视野导致的挂接特效被移除,引擎会在entity每次进入视野时自动创建所有特效。", - "remark": "- 创建特效前需要将entity的骨骼模型替换为编辑器中的一致(或者其他骨骼相同的模型),否则将挂接失败,替换模型见服务端和客户端的model组件的SetModel接口。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/模型特效.md", + "remark": "- 创建特效前需要将entity的骨骼模型替换为编辑器中的一致(或者其他骨骼相同的模型),否则将挂接失败,替换模型见服务端和客户端的model组件的SetModel接口。", + "return": [], + "description": "指用编辑器保存资源包中models/bind/xxx_bind.json生成编辑好的所有挂点的所有特效。生成的特效会自动进行挂接及播放,编辑器中设为不可见的特效也会进行播放。并且使用这种方式创建的特效,开发者不用维护entity进出视野导致的挂接特效被移除,引擎会在entity每次进入视野时自动创建所有特效。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/模型特效.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclass MyClientSystem(ClientSystem):\r\n # 创建\r\n def createEffect(self):\r\n # 绑定在本地玩家身上的模型特效\r\n effectEntityId = self.CreateEngineEffectBind(\"models/bind/xuenv_bind.json\", clientApi.GetLocalPlayerId(), 'idle')\r\n\r\n # 删除\r\n def removeEffect(self, effectEntityId):\r\n self.DestroyEntity(effectEntityId)", "params": [ { - "name": "path", - "type": "str", + "type": "str", + "name": "path", "description": "特效配置路径,需要包含json后缀名" - }, + }, { - "name": "bindEntity", - "type": "str", + "type": "str", + "name": "bindEntity", "description": "绑定实体的Id" - }, + }, { - "name": "aniName", - "type": "str", + "type": "str", + "name": "aniName", "description": "选择使用哪个模型动作的特效" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclass MyClientSystem(ClientSystem):\r\n # 创建\r\n def createEffect(self):\r\n # 绑定在本地玩家身上的模型特效\r\n effectEntityId = self.CreateEngineEffectBind(\"models/bind/xuenv_bind.json\", clientApi.GetLocalPlayerId(), 'idle')\r\n\r\n # 删除\r\n def removeEffect(self, effectEntityId):\r\n self.DestroyEntity(effectEntityId)" - }, + ], + "type": "api", + "side": "client", + "name": "CreateEngineEffectBind" + }, { - "type": "api", - "name": "Pause", - "method": "", - "description": "暂停模型特效(即使用CreateEngineEffectBind创建的特效)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/模型特效.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateEngineEffectBindControl(effectEntityId)\r\ncomp.Pause()" - }, + "remark": "", + "return": [], + "description": "暂停模型特效(即使用CreateEngineEffectBind创建的特效)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/模型特效.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateEngineEffectBindControl(effectEntityId)\r\ncomp.Pause()", + "params": [], + "type": "api", + "side": "client", + "name": "Pause" + }, { - "type": "api", - "name": "Resume", - "method": "", - "description": "继续播放模型特效(即使用CreateEngineEffectBind创建的特效)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/模型特效.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateEngineEffectBindControl(effectEntityId)\r\ncomp.Resume()" - }, + "remark": "", + "return": [], + "description": "继续播放模型特效(即使用CreateEngineEffectBind创建的特效)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/模型特效.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateEngineEffectBindControl(effectEntityId)\r\ncomp.Resume()", + "params": [], + "type": "api", + "side": "client", + "name": "Resume" + }, { - "type": "api", - "name": "Bind", - "method": "", - "description": "绑定骨骼模型", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "", + "return": [], + "description": "绑定骨骼模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSkeletonBind(particleEntityId)\r\ncomp.Bind(modelId, \"root\", (0, 1, 0), (0, 0, 0))", "params": [ { - "name": "modelId", - "type": "int", + "type": "int", + "name": "modelId", "description": "绑定的骨骼模型的ID(见model组件的GetModelId)" - }, + }, { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "绑定具体骨骼的名称" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "绑定的偏移量" - }, + }, { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "绑定的旋转角度" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSkeletonBind(particleEntityId)\r\ncomp.Bind(modelId, \"root\", (0, 1, 0), (0, 0, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "Bind" + }, { - "type": "api", - "name": "CreateEngineParticle", - "method": "", - "description": "用于创建粒子特效", - "remark": "- 创建粒子后,可以用返回的particleEntityId创建客户端粒子分类中的相关组件,设置所需属性,以实现各种表现效果。\r\n - 切换维度后会自动隐藏非本维度创建的而且没有绑定实体的粒子, 回到该维度后会自动重新显示\r\n - 粒子创建之后需要调用particleControl组件的Play函数才会播放,如果播放非本维度创建的粒子,会同时修改该粒子的创建维度为当前维度", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "- 创建粒子后,可以用返回的particleEntityId创建客户端粒子分类中的相关组件,设置所需属性,以实现各种表现效果。\r\n - 切换维度后会自动隐藏非本维度创建的而且没有绑定实体的粒子, 回到该维度后会自动重新显示\r\n - 粒子创建之后需要调用particleControl组件的Play函数才会播放,如果播放非本维度创建的粒子,会同时修改该粒子的创建维度为当前维度", + "return": [], + "description": "用于创建粒子特效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclass MyClientSystem(ClientSystem):\r\n # 创建\r\n def createParticle(self):\r\n particleEntityId = self.CreateEngineParticle(\"effects/fire.json\", (0,5,0))\r\n particleControlComp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\n particleControlComp.Play()\r\n\r\n # 删除\r\n def removeParticle(self, particleEntityId):\r\n self.DestroyEntity(particleEntityId)", "params": [ { - "name": "path", - "type": "str", + "type": "str", + "name": "path", "description": "特效资源路径,需要加上后缀名(一般是json)" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "创建位置坐标" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclass MyClientSystem(ClientSystem):\r\n # 创建\r\n def createParticle(self):\r\n particleEntityId = self.CreateEngineParticle(\"effects/fire.json\", (0,5,0))\r\n particleControlComp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\n particleControlComp.Play()\r\n\r\n # 删除\r\n def removeParticle(self, particleEntityId):\r\n self.DestroyEntity(particleEntityId)" - }, + ], + "type": "api", + "side": "client", + "name": "CreateEngineParticle" + }, { - "type": "api", - "name": "GetParticleEmissionRate", - "method": "", - "description": "获取粒子发射器每帧发射粒子的频率。", - "remark": "- 该接口所获取的值对应粒子特效json文件中\"emissionrate\"的值", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.GetParticleEmissionRate()" - }, + "remark": "- 该接口所获取的值对应粒子特效json文件中\"emissionrate\"的值", + "return": [], + "description": "获取粒子发射器每帧发射粒子的频率。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.GetParticleEmissionRate()", + "params": [], + "type": "api", + "side": "client", + "name": "GetParticleEmissionRate" + }, { - "type": "api", - "name": "GetParticleMaxNum", - "method": "", - "description": "获取粒子发射器包含的最大粒子数量。", - "remark": "- 该接口所获取的值对应粒子特效json文件中\"numparticles\"的值", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.GetParticleMaxNum()" - }, + "remark": "- 该接口所获取的值对应粒子特效json文件中\"numparticles\"的值", + "return": [], + "description": "获取粒子发射器包含的最大粒子数量。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.GetParticleMaxNum()", + "params": [], + "type": "api", + "side": "client", + "name": "GetParticleMaxNum" + }, { - "type": "api", - "name": "GetParticleMaxSize", - "method": "", - "description": "获取粒子特效中粒子大小的最大值。", - "remark": "- 该接口获取的值对应粒子特效json文件中\"particlesize\"的\"max\"值。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.GetParticleMaxSize()" - }, + "remark": "- 该接口获取的值对应粒子特效json文件中\"particlesize\"的\"max\"值。", + "return": [], + "description": "获取粒子特效中粒子大小的最大值。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.GetParticleMaxSize()", + "params": [], + "type": "api", + "side": "client", + "name": "GetParticleMaxSize" + }, { - "type": "api", - "name": "GetParticleMinSize", - "method": "", - "description": "获取粒子特效中粒子大小的最小值。", - "remark": "- 该接口获取的值对应粒子特效json文件中\"particlesize\"的\"min\"值。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.GetParticleMinSize()" - }, + "remark": "- 该接口获取的值对应粒子特效json文件中\"particlesize\"的\"min\"值。", + "return": [], + "description": "获取粒子特效中粒子大小的最小值。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.GetParticleMinSize()", + "params": [], + "type": "api", + "side": "client", + "name": "GetParticleMinSize" + }, { - "type": "api", - "name": "GetParticleVolumeSize", - "method": "", - "description": "获取粒子发射器的体积大小缩放值。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.GetParticleVolumeSize()" - }, + "remark": "", + "return": [], + "description": "获取粒子发射器的体积大小缩放值。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.GetParticleVolumeSize()", + "params": [], + "type": "api", + "side": "client", + "name": "GetParticleVolumeSize" + }, { - "type": "api", - "name": "GetPos", - "method": "", - "description": "获取粒子发射器的世界坐标位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleTrans(particleEntityId)\r\ncomp.GetPos()" - }, + "remark": "", + "return": [], + "description": "获取粒子发射器的世界坐标位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleTrans(particleEntityId)\r\ncomp.GetPos()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPos" + }, { - "type": "api", - "name": "GetRot", - "method": "", - "description": "获取粒子发射器的旋转角度", - "remark": "- 注意,当使用SetRotation设置旋转角度时,设置的x轴方向的旋转接近90度或者-90度,此时会由于旋转的奇异性,计算旋转角度时会出现除0的问题,因此为了避免这种情况,会采用奇异情况下的计算公式来计算,这种情况接口返回的是与SetRotUseZXY接口所设置的值等价的旋转角度。\r\n - 该接口获取的旋转值对应接口SetRotUseZXY所设置的旋转值。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleTrans(particleEntityId)\r\ncomp.GetRot()" - }, + "remark": "- 注意,当使用SetRotation设置旋转角度时,设置的x轴方向的旋转接近90度或者-90度,此时会由于旋转的奇异性,计算旋转角度时会出现除0的问题,因此为了避免这种情况,会采用奇异情况下的计算公式来计算,这种情况接口返回的是与SetRotUseZXY接口所设置的值等价的旋转角度。\r\n - 该接口获取的旋转值对应接口SetRotUseZXY所设置的旋转值。", + "return": [], + "description": "获取粒子发射器的旋转角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleTrans(particleEntityId)\r\ncomp.GetRot()", + "params": [], + "type": "api", + "side": "client", + "name": "GetRot" + }, { - "type": "api", - "name": "Pause", - "method": "", - "description": "暂停播放,粒子定格在当前时刻,再次调用Play时继续播放", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.Pause()" - }, + "remark": "", + "return": [], + "description": "暂停播放,粒子定格在当前时刻,再次调用Play时继续播放", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.Pause()", + "params": [], + "type": "api", + "side": "client", + "name": "Pause" + }, { - "type": "api", - "name": "Play", - "method": "", - "description": "播放粒子特效", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.Play()" - }, + "remark": "", + "return": [], + "description": "播放粒子特效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.Play()", + "params": [], + "type": "api", + "side": "client", + "name": "Play" + }, { - "type": "api", - "name": "SetFadeDistance", - "method": "", - "description": "设置粒子开始自动调整透明度的距离。粒子与摄像机之间的距离小于该值时会自动调整粒子的透明度,距离摄像机越近,粒子越透明", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "", + "return": [], + "description": "设置粒子开始自动调整透明度的距离。粒子与摄像机之间的距离小于该值时会自动调整粒子的透明度,距离摄像机越近,粒子越透明", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\n# 设置该粒子在与相机距离小于3时会自动调整透明度\r\ncomp.SetFadeDistance(3)", "params": [ { - "name": "fadeDistance", - "type": "float", + "type": "float", + "name": "fadeDistance", "description": "自动调整透明度的距离,应为正数,负数将视作零来处理" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\n# 设置该粒子在与相机距离小于3时会自动调整透明度\r\ncomp.SetFadeDistance(3)" - }, + ], + "type": "api", + "side": "client", + "name": "SetFadeDistance" + }, { - "type": "api", - "name": "SetGlobal", - "method": "", - "description": "设置粒子发射器是否为全局粒子发射器, 默认是False", - "remark": "- 该接口设置粒子发射器是否为全局粒子发射器,如果设置为True,则不会应远离摄像机被剔除。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "- 该接口设置粒子发射器是否为全局粒子发射器,如果设置为True,则不会应远离摄像机被剔除。", + "return": [], + "description": "设置粒子发射器是否为全局粒子发射器, 默认是False", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.SetGlobal(True)", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否为全局粒子发射器" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.SetGlobal(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetGlobal" + }, { - "type": "api", - "name": "SetLayer", - "method": "", - "description": "粒子默认层级为1,当层级不为1时表示该特效开启特效分层渲染功能。特效(粒子和帧动画)分层渲染时,层级越高渲染越靠后,层级大的会遮挡层级低的,且同一层级的特效会根据特效的相对位置产生正确的相互遮挡关系。", - "remark": "- 该接口只针对粒子进行设置,序列帧特效请使用frameAniControl组件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "- 该接口只针对粒子进行设置,序列帧特效请使用frameAniControl组件", + "return": [], + "description": "粒子默认层级为1,当层级不为1时表示该特效开启特效分层渲染功能。特效(粒子和帧动画)分层渲染时,层级越高渲染越靠后,层级大的会遮挡层级低的,且同一层级的特效会根据特效的相对位置产生正确的相互遮挡关系。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\n# 设置渲染层级为2\r\ncomp.SetLayer(2)", "params": [ { - "name": "layer", - "type": "int", + "type": "int", + "name": "layer", "description": "粒子渲染层级,总共包含0-15的层级。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\n# 设置渲染层级为2\r\ncomp.SetLayer(2)" - }, + ], + "type": "api", + "side": "client", + "name": "SetLayer" + }, { - "type": "api", - "name": "SetParticleEmissionRate", - "method": "", - "description": "设置粒子发射器每帧发射粒子的频率,频率越大则每帧发射的粒子数量越多,但粒子数量不会超过粒子发射器的粒子容量,同时由于性能考虑,每帧发射的粒子数量也不会超过100个。", - "remark": "- 该接口所设置的值对应粒子特效json文件中\"emissionrate\"的值", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "- 该接口所设置的值对应粒子特效json文件中\"emissionrate\"的值", + "return": [], + "description": "设置粒子发射器每帧发射粒子的频率,频率越大则每帧发射的粒子数量越多,但粒子数量不会超过粒子发射器的粒子容量,同时由于性能考虑,每帧发射的粒子数量也不会超过100个。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\n# 扩充粒子发射器的粒子容量\r\ncomp.SetParticleMaxNum(1000)\r\n# 提高发射粒子的频率\r\ncomp.SetParticleEmissionRate(15,20)", "params": [ { - "name": "minRate", - "type": "float", + "type": "float", + "name": "minRate", "description": "每帧发射粒子频率的最小值。每帧发射粒子的频率将在频率最小值和频率最大值之间取随机数进行插值。当该值设置为负值时设置将会失败,且该值不能比粒子频率的最大值大。" - }, + }, { - "name": "maxRate", - "type": "float", + "type": "float", + "name": "maxRate", "description": "每帧发射粒子频率的最大值。每帧发射粒子的频率将在频率最小值和频率最大值之间取随机数进行插值。当该值设置为负值时设置将会失败,且该值不能比粒子频率的最小值小。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\n# 扩充粒子发射器的粒子容量\r\ncomp.SetParticleMaxNum(1000)\r\n# 提高发射粒子的频率\r\ncomp.SetParticleEmissionRate(15,20)" - }, + ], + "type": "api", + "side": "client", + "name": "SetParticleEmissionRate" + }, { - "type": "api", - "name": "SetParticleMaxNum", - "method": "", - "description": "设置粒子发射器的粒子容量,即粒子发射器所包含的最大粒子数量。该数量并不代表目前粒子发射器所发射的粒子数量,如需要增加发射的粒子数量,需同时改变粒子的发射频率。", - "remark": "- 考虑到性能的原因,请注意粒子的数量不要设置过大。该接口设置的值对应粒子特效json文件中\"numparticles\"的值", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "- 考虑到性能的原因,请注意粒子的数量不要设置过大。该接口设置的值对应粒子特效json文件中\"numparticles\"的值", + "return": [], + "description": "设置粒子发射器的粒子容量,即粒子发射器所包含的最大粒子数量。该数量并不代表目前粒子发射器所发射的粒子数量,如需要增加发射的粒子数量,需同时改变粒子的发射频率。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.SetParticleMaxNum(1000)", "params": [ { - "name": "num", - "type": "int", + "type": "int", + "name": "num", "description": "粒子发射器所包含的最大粒子数量,不能为负值,粒子的数量最大值不超过100000。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.SetParticleMaxNum(1000)" - }, + ], + "type": "api", + "side": "client", + "name": "SetParticleMaxNum" + }, { - "type": "api", - "name": "SetParticleSize", - "method": "", - "description": "设置粒子特效中粒子大小的最小值及最大值。", - "remark": "- 该接口设置的值对应粒子特效json文件中\"particlesize\"的值。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "- 该接口设置的值对应粒子特效json文件中\"particlesize\"的值。", + "return": [], + "description": "设置粒子特效中粒子大小的最小值及最大值。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.SetParticleSize((0.5,0.5),(0.6,0.6))", "params": [ { - "name": "minSize", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "minSize", "description": "粒子大小的最小值(x,y)。x值影响粒子的左右拉伸程度,y值影响粒子的上下拉伸程度。粒子特效中的粒子大小会在最小值和最大值当中取随机值进行决定。当该值设置为负值时设置将会失败,且该值不能比粒子大小的最大值大。" - }, + }, { - "name": "maxSize", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "maxSize", "description": "粒子大小的最大值(x,y)。x值影响粒子的左右拉伸程度,y值影响粒子的上下拉伸程度。粒子特效中的粒子大小会在最小值和最大值当中取随机值进行决定。当该值设置为负值时设置将会失败,且该值不能比粒子大小的最小值小。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.SetParticleSize((0.5,0.5),(0.6,0.6))" - }, + ], + "type": "api", + "side": "client", + "name": "SetParticleSize" + }, { - "type": "api", - "name": "SetParticleVolumeSize", - "method": "", - "description": "设置粒子发射器的体积大小缩放,不影响单个粒子的尺寸。粒子发射器的体积越大,则粒子的发射范围越大。", - "remark": "- 当粒子绑定实体时该设置无效", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "- 当粒子绑定实体时该设置无效", + "return": [], + "description": "设置粒子发射器的体积大小缩放,不影响单个粒子的尺寸。粒子发射器的体积越大,则粒子的发射范围越大。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.SetParticleVolumeSize((1,0,0))", "params": [ { - "name": "scale", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "scale", "description": "粒子发射器的体积大小缩放值(x,y,z), x,y,z分别为各个坐标轴方向的缩放值,该值越大该方向发射粒子的范围越大。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.SetParticleVolumeSize((1,0,0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetParticleVolumeSize" + }, { - "type": "api", - "name": "SetPos", - "method": "", - "description": "设置粒子发射器的世界坐标位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "", + "return": [], + "description": "设置粒子发射器的世界坐标位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleTrans(particleEntityId)\r\ncomp.SetPos((0, 5, 0))", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "世界坐标" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleTrans(particleEntityId)\r\ncomp.SetPos((0, 5, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetPos" + }, { - "type": "api", - "name": "SetRelative", - "method": "", - "description": "当粒子绑定了entity或骨骼模型时,发射出的粒子使用entity坐标系还是世界坐标系。与mcstudio特效编辑器中粒子的“相对挂点运动”选项功能相同。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "", + "return": [], + "description": "当粒子绑定了entity或骨骼模型时,发射出的粒子使用entity坐标系还是世界坐标系。与mcstudio特效编辑器中粒子的“相对挂点运动”选项功能相同。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\n# 使用世界坐标系\r\ncomp.SetRelative(False)", "params": [ { - "name": "relative", - "type": "bool", + "type": "bool", + "name": "relative", "description": "True表示相对坐标系,False表示世界坐标系" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\n# 使用世界坐标系\r\ncomp.SetRelative(False)" - }, + ], + "type": "api", + "side": "client", + "name": "SetRelative" + }, { - "type": "api", - "name": "SetRotUseZXY", - "method": "", - "description": "设置粒子发射器的旋转,旋转顺序按照绕z,x,y轴旋转", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "", + "return": [], + "description": "设置粒子发射器的旋转,旋转顺序按照绕z,x,y轴旋转", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleTrans(particleEntityId)\r\n# 绕z轴旋转90度,然后绕y轴旋转90度\r\ncomp.SetRotUseZXY((0, 90, 90))", "params": [ { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "绕局部坐标系的+z,+x,+y轴旋转的角度,旋转顺序按照绕z,x,y轴旋转。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleTrans(particleEntityId)\r\n# 绕z轴旋转90度,然后绕y轴旋转90度\r\ncomp.SetRotUseZXY((0, 90, 90))" - }, + ], + "type": "api", + "side": "client", + "name": "SetRotUseZXY" + }, { - "type": "api", - "name": "SetUsePointFiltering", - "method": "", - "description": "设置粒子材质的纹理滤波是否使用点滤波方法。默认为使用双线性滤波", - "remark": "- 使用点滤波的图像通常边缘清晰、可能会有较强烈的锯齿感;使用双线性插值的图像通常比较平滑、可能会使图像一定程度上变得模糊", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "remark": "- 使用点滤波的图像通常边缘清晰、可能会有较强烈的锯齿感;使用双线性插值的图像通常比较平滑、可能会使图像一定程度上变得模糊", + "return": [], + "description": "设置粒子材质的纹理滤波是否使用点滤波方法。默认为使用双线性滤波", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\n# 设置使用点滤波\r\ncomp.SetUsePointFiltering(True)\r\ncomp.Play()", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "true为使用点滤波方法,false为使用默认的双线性滤波" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\n# 设置使用点滤波\r\ncomp.SetUsePointFiltering(True)\r\ncomp.Play()" - }, + ], + "type": "api", + "side": "client", + "name": "SetUsePointFiltering" + }, { - "type": "api", - "name": "Stop", - "method": "", - "description": "停止粒子播放", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.Stop()" - }, + "remark": "", + "return": [], + "description": "停止粒子播放", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/粒子.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\ncomp.Stop()", + "params": [], + "type": "api", + "side": "client", + "name": "Stop" + }, { - "type": "api", - "name": "DestroyEntity", - "method": "", - "description": "销毁特效", - "remark": "- 支持销毁粒子,序列帧及模型特效,示例见对应的创建接口", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/特效/通用.md", + "remark": "- 支持销毁粒子,序列帧及模型特效,示例见对应的创建接口", + "return": [], + "description": "销毁特效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/特效/通用.md", + "example": "", "params": [ { - "name": "entityId", - "type": "int", + "type": "int", + "name": "entityId", "description": "销毁的特效ID" } - ], - "return": [], - "example": "" - }, + ], + "type": "api", + "side": "client", + "name": "DestroyEntity" + }, { - "type": "api", - "name": "PlayTpAnimation", - "method": "", - "description": "第三人称视角播放玩家通用动作", - "remark": "- 支持的动作包括:sneaking、sneaking_inverted、swim、sleeping、holding_left、holding_right、crossbow_hold、crossbow_equipped、bow_equipped、upside_down、tp_attack", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/动画.md", + "remark": "- 支持的动作包括:sneaking、sneaking_inverted、swim、sleeping、holding_left、holding_right、crossbow_hold、crossbow_equipped、bow_equipped、upside_down、tp_attack", + "return": [], + "description": "第三人称视角播放玩家通用动作", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/动画.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayerAnim(playerId)\r\ncomp.PlayTpAnimation(\"sneaking\")", "params": [ { - "name": "anim", - "type": "str", + "type": "str", + "name": "anim", "description": "动作名称,如sneaking" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayerAnim(playerId)\r\ncomp.PlayTpAnimation(\"sneaking\")" - }, + ], + "type": "api", + "side": "client", + "name": "PlayTpAnimation" + }, { - "type": "api", - "name": "StopAnimation", - "method": "", - "description": "停止播放玩家通用动作", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/动画.md", + "remark": "", + "return": [], + "description": "停止播放玩家通用动作", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/动画.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayerAnim(playerId)\r\ncomp.StopAnimation(\"sneaking\")", "params": [ { - "name": "anim", - "type": "str", + "type": "str", + "name": "anim", "description": "动作名称,如sneaking" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayerAnim(playerId)\r\ncomp.StopAnimation(\"sneaking\")" - }, + ], + "type": "api", + "side": "client", + "name": "StopAnimation" + }, { - "type": "api", - "name": "GetNavPath", - "method": "", - "description": "获取本地玩家到目标点的寻路路径,开发者可以通过该接口定制自定义的导航系统。", - "remark": "- 寻路算法迭代一定次数后(即maxIteration的数值),如果未寻到目标点,接口会返回**局部最优解**,即当前搜索到的点的集合中,离设置目标点最近的点的路径,但是这条路径可能是不准确或错误的(例如往终点的方向是死胡同的情况)。
出现这种可能的情况包括:目标点无法抵达(被围住等),目标点所在chunk未加载,目标点较远(但是仍在区块加载范围内)或地形较复杂(例如与终点间有很长一面墙)。\r\n - 上述情况中,目标点较远或地形较复杂的情况可以通过增大maxIteration的数值避免,但是这样同时也会增加客户端的卡顿。\r\n - 如果终点在水里需要将isSwimmer参数设为True,但如果只是路途中会经过水域是不需要的。但需要注意在水中的寻路性能非常低下,其他参数不变时,单次寻路计算出的最大路径长度会小很多。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/导航.md", + "remark": "- 寻路算法迭代一定次数后(即maxIteration的数值),如果未寻到目标点,接口会返回**局部最优解**,即当前搜索到的点的集合中,离设置目标点最近的点的路径,但是这条路径可能是不准确或错误的(例如往终点的方向是死胡同的情况)。
出现这种可能的情况包括:目标点无法抵达(被围住等),目标点所在chunk未加载,目标点较远(但是仍在区块加载范围内)或地形较复杂(例如与终点间有很长一面墙)。\r\n - 上述情况中,目标点较远或地形较复杂的情况可以通过增大maxIteration的数值避免,但是这样同时也会增加客户端的卡顿。\r\n - 如果终点在水里需要将isSwimmer参数设为True,但如果只是路途中会经过水域是不需要的。但需要注意在水中的寻路性能非常低下,其他参数不变时,单次寻路计算出的最大路径长度会小很多。", + "return": [], + "description": "获取本地玩家到目标点的寻路路径,开发者可以通过该接口定制自定义的导航系统。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/导航.md", + "example": "", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "目标点的坐标" - }, + }, { - "name": "maxTrimNode", - "type": "int", + "type": "int", + "name": "maxTrimNode", "description": "对搜索路径进行平滑时的最大尝试格数。设置的太大会影响寻路性能。默认值16" - }, + }, { - "name": "maxIteration", - "type": "int", + "type": "int", + "name": "maxIteration", "description": "A星寻路的最大迭代次数。默认值800" - }, + }, { - "name": "isSwimmer", - "type": "bool", + "type": "bool", + "name": "isSwimmer", "description": "目标点是否在水中。默认为False" } - ], - "return": [], - "example": "" - }, + ], + "type": "api", + "side": "client", + "name": "GetNavPath" + }, { - "type": "api", - "name": "StartNavTo", - "method": "", - "description": "我们提供了一个基于GetNavPath的导航系统实现,做法是在路径上生成序列帧以引导玩家通向目标点,并且当玩家偏离路径会重新进行导航。", - "remark": "- 寻路算法迭代一定次数后(即maxIteration的数值),如果未寻到目标点,接口会返回**局部最优解**,即当前搜索到的点的集合中,离设置目标点最近的点的路径,但是这条路径可能是不准确或错误的(例如往终点的方向是死胡同的情况)。
出现这种可能的情况包括:目标点无法抵达(被围住等),目标点所在chunk未加载,目标点较远(但是仍在区块加载范围内)或地形较复杂(例如与终点间有很长一面墙)。\r\n - 上述情况中,目标点较远或地形较复杂的情况可以通过增大maxIteration的数值避免,但是这样同时也会增加客户端的卡顿。\r\n - 如果终点在水里需要将isSwimmer参数设为True,但如果只是路途中会经过水域是不需要的。但需要注意在水中的寻路性能非常低下,其他参数不变时,单次寻路计算出的最大路径长度会小很多。\r\n - callback函数接受一个bool参数。当参数为True时,表示玩家到达目标点附近,但不代表导航结束,如果玩家又离开目标点,导航系统会再次尝试导航,开发者需要在某个时机手动调用停止导航(参考[StopNav接口](导航.md#StopNav))。当参数为False时,表示玩家偏离航线并到了某个无法到达目标点的状态(即返回值不为0的那些情况),这种情况导航会自动终止。\r\n ```python\r\n # 一个到达终点时停止导航的callback函数示例\r\n from mod_log import logger as logger\r\n def myCallback(result):\r\n if result:\r\n extraClientApi.StopNav()\r\n else:\r\n logger.info('something happened in navigation')\r\n # 若目标点很远,需要进行分段导航的callback函数示例\r\n def myCallback2(result):\r\n if result:\r\n if GetDistence(localplayerPos, destinationPos) < sfxIntl*2:\r\n extraClientApi.StopNav()\r\n else:\r\n extraClientApi.StartNavTo(destinationPos, ...)\r\n else:\r\n logger.info('something happened in navigation')\r\n ```\r\n - 如果上一次导航没结束时再次调用会覆盖之前的导航\r\n - 使用默认参数的导航效果示例:
![avatar](../../picture/startNavTo.png)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/导航.md", + "remark": "- 寻路算法迭代一定次数后(即maxIteration的数值),如果未寻到目标点,接口会返回**局部最优解**,即当前搜索到的点的集合中,离设置目标点最近的点的路径,但是这条路径可能是不准确或错误的(例如往终点的方向是死胡同的情况)。
出现这种可能的情况包括:目标点无法抵达(被围住等),目标点所在chunk未加载,目标点较远(但是仍在区块加载范围内)或地形较复杂(例如与终点间有很长一面墙)。\r\n - 上述情况中,目标点较远或地形较复杂的情况可以通过增大maxIteration的数值避免,但是这样同时也会增加客户端的卡顿。\r\n - 如果终点在水里需要将isSwimmer参数设为True,但如果只是路途中会经过水域是不需要的。但需要注意在水中的寻路性能非常低下,其他参数不变时,单次寻路计算出的最大路径长度会小很多。\r\n - callback函数接受一个bool参数。当参数为True时,表示玩家到达目标点附近,但不代表导航结束,如果玩家又离开目标点,导航系统会再次尝试导航,开发者需要在某个时机手动调用停止导航(参考[StopNav接口](导航.md#StopNav))。当参数为False时,表示玩家偏离航线并到了某个无法到达目标点的状态(即返回值不为0的那些情况),这种情况导航会自动终止。\r\n ```python\r\n # 一个到达终点时停止导航的callback函数示例\r\n from mod_log import logger as logger\r\n def myCallback(result):\r\n if result:\r\n extraClientApi.StopNav()\r\n else:\r\n logger.info('something happened in navigation')\r\n # 若目标点很远,需要进行分段导航的callback函数示例\r\n def myCallback2(result):\r\n if result:\r\n if GetDistence(localplayerPos, destinationPos) < sfxIntl*2:\r\n extraClientApi.StopNav()\r\n else:\r\n extraClientApi.StartNavTo(destinationPos, ...)\r\n else:\r\n logger.info('something happened in navigation')\r\n ```\r\n - 如果上一次导航没结束时再次调用会覆盖之前的导航\r\n - 使用默认参数的导航效果示例:
![avatar](../../picture/startNavTo.png)", + "return": [], + "description": "我们提供了一个基于GetNavPath的导航系统实现,做法是在路径上生成序列帧以引导玩家通向目标点,并且当玩家偏离路径会重新进行导航。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/导航.md", + "example": "", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "目标点的坐标" - }, + }, { - "name": "sfxPath", - "type": "str", + "type": "str", + "name": "sfxPath", "description": "构成导航路径的序列帧素材路径。样式可以参考指向上的箭头" - }, + }, { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "玩家抵达终点时会调用的**回调函数**。该函数需要接受一个bool参数。" - }, + }, { - "name": "sfxIntl", - "type": "float", + "type": "float", + "name": "sfxIntl", "description": "相邻两个序列帧之间的间隔。默认值2" - }, + }, { - "name": "sfxMaxNum", - "type": "int", + "type": "int", + "name": "sfxMaxNum", "description": "同时存在的序列帧的最大个数。默认值16" - }, + }, { - "name": "sfxScale", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "sfxScale", "description": "序列帧的宽度及高度的缩放。默认为(0.5,0.5)" - }, + }, { - "name": "maxIteration", - "type": "int", + "type": "int", + "name": "maxIteration", "description": "A星寻路的最大迭代次数。默认值800" - }, + }, { - "name": "isSwimmer", - "type": "bool", + "type": "bool", + "name": "isSwimmer", "description": "目标点是否在水中。默认为False" - }, + }, { - "name": "fps", - "type": "int", + "type": "int", + "name": "fps", "description": "序列帧帧率,默认为20,不建议超过30" - }, + }, { - "name": "playIntl", - "type": "int", + "type": "int", + "name": "playIntl", "description": "一轮中相邻序列帧开始播放的间隔,默认为8帧,不得小于0,否则将使用默认值" - }, + }, { - "name": "duration", - "type": "int", + "type": "int", + "name": "duration", "description": "单个序列帧持续播放帧数,默认为60帧,不小于10,否则将使用默认值" - }, + }, { - "name": "oneTurnDuration", - "type": "int", + "type": "int", + "name": "oneTurnDuration", "description": "两轮序列帧之间的播放间隔(帧),默认值为90帧,至少为duration的1.5倍,否则将以1.5 * duration进行计算" - }, + }, { - "name": "sfxDepthTest", - "type": "bool", + "type": "bool", + "name": "sfxDepthTest", "description": "序列帧是否开启深度检测,默认为False,设为True时序列帧会被场景遮挡" } - ], - "return": [], - "example": "" - }, + ], + "type": "api", + "side": "client", + "name": "StartNavTo" + }, { - "type": "api", - "name": "StopNav", - "method": "", - "description": "终止当前的导航", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/导航.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "终止当前的导航", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/导航.md", + "example": "", + "params": [], + "type": "api", + "side": "client", + "name": "StopNav" + }, { - "type": "api", - "name": "AddPlayerExperience", - "method": "", - "description": "增加玩家经验值", - "remark": "- 如果设置的exp值为负数,且超过当前等级已有的经验值,调用接口后,该玩家等级不会下降但是经验值会置为最小值", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "- 如果设置的exp值为负数,且超过当前等级已有的经验值,调用接口后,该玩家等级不会下降但是经验值会置为最小值", + "return": [], + "description": "增加玩家经验值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExp(entityId)\r\ncomp.AddPlayerExperience(25)", "params": [ { - "name": "exp", - "type": "int", + "type": "int", + "name": "exp", "description": "玩家经验值,可设置负数" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExp(entityId)\r\ncomp.AddPlayerExperience(25)" - }, + ], + "type": "api", + "side": "server", + "name": "AddPlayerExperience" + }, { - "type": "api", - "name": "AddPlayerLevel", - "method": "", - "description": "修改玩家等级", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "", + "return": [], + "description": "修改玩家等级", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateLv(playerId)\r\ncomp.AddPlayerLevel(2)", "params": [ { - "name": "level", - "type": "int", + "type": "int", + "name": "level", "description": "玩家等级,可设置负数" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateLv(playerId)\r\ncomp.AddPlayerLevel(2)" - }, + ], + "type": "api", + "side": "server", + "name": "AddPlayerLevel" + }, { - "type": "api", - "name": "CollectOnlineClientData", - "method": "", - "description": "收集在线玩家客户端数据,用于判断玩家是否作弊", - "remark": "- collectTypes中类型解释如下\r\n game类型收集到的数据字典解释如下:\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | gameType | int | 游戏模式,含义:-1:获取失败,0:生存模式,1:创造模式,2:冒险模式,3:旁观者模式|\r\n | levelGravity | float | 世界的重力因子|\r\n \r\n player类型收集到的数据字典解释如下:\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | playerHealth | int | 玩家生命值|\r\n \r\n world类型收集到的数据字典解释如下:\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | blockName | str | 某一位置方块的名称,要求extraArgs参数包含pos参数|\r\n | blockAuxValue | int | 某一位置方块的附加值AuxValue,要求extraArgs参数字典中包含\"pos\",若缺少则没有数据|\r\n \r\n entity类型收集到的数据字典解释如下:\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | entityPos | tuple(float,float,float) | 实体位置,具体参见客户端GetPos接口说明,要求extraArgs参数字典中包含\"entityId\",若缺少则没有数据|\r\n | entityGravity | float | 获取实体的重力因子,当生物重力因子为0时则应用世界的重力因子,要求extraArgs参数字典中包含\"entityId\",若缺少则没有数据|", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "- collectTypes中类型解释如下\r\n game类型收集到的数据字典解释如下:\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | gameType | int | 游戏模式,含义:-1:获取失败,0:生存模式,1:创造模式,2:冒险模式,3:旁观者模式|\r\n | levelGravity | float | 世界的重力因子|\r\n \r\n player类型收集到的数据字典解释如下:\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | playerHealth | int | 玩家生命值|\r\n \r\n world类型收集到的数据字典解释如下:\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | blockName | str | 某一位置方块的名称,要求extraArgs参数包含pos参数|\r\n | blockAuxValue | int | 某一位置方块的附加值AuxValue,要求extraArgs参数字典中包含\"pos\",若缺少则没有数据|\r\n \r\n entity类型收集到的数据字典解释如下:\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | entityPos | tuple(float,float,float) | 实体位置,具体参见客户端GetPos接口说明,要求extraArgs参数字典中包含\"entityId\",若缺少则没有数据|\r\n | entityGravity | float | 获取实体的重力因子,当生物重力因子为0时则应用世界的重力因子,要求extraArgs参数字典中包含\"entityId\",若缺少则没有数据|", + "return": [], + "description": "收集在线玩家客户端数据,用于判断玩家是否作弊", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ndef ProcessData(playerId, data):\r\n #正常返回实例:ProcessData 123 {'blockAuxValue': 0, 'blockName': 'minecraft:air', 'blockBoxSize': (-1.0, -1.0), 'gameType': 1, 'entityPos': (123,456,789), 'levelGravity': -0.08, 'playerHealth': 20, 'entityGravity': 0.0}\r\n #失败返回实例:ProcessData 123 None\r\n print 'ProcessData', playerId, data\r\ncomp.CollectOnlineClientData(['player', 'world', 'entity', 'game'], ProcessData, {'entityId' :'123', 'pos' : (123,456,789))})", "params": [ { - "name": "collectTypes", - "type": "list(str)", + "type": "list(str)", + "name": "collectTypes", "description": "数据类型,不同类型收集到不同数据,具体说明参见备注。" - }, + }, { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "回调函数,用于分析数据并判断玩家是否作弊,包含两个参数,第一个参数是playerId,类型str;第二个参数表示收集到的数据,dict类型,内容由collectTypes决定的,具体参见备注,若数据收集失败则为None(比如玩家不在线)" - }, + }, { - "name": "extraArgs", - "type": "dict", + "type": "dict", + "name": "extraArgs", "description": "默认为None,根据collectTypes传入不同参数,具体说明参见备注。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ndef ProcessData(playerId, data):\r\n #正常返回实例:ProcessData 123 {'blockAuxValue': 0, 'blockName': 'minecraft:air', 'blockBoxSize': (-1.0, -1.0), 'gameType': 1, 'entityPos': (123,456,789), 'levelGravity': -0.08, 'playerHealth': 20, 'entityGravity': 0.0}\r\n #失败返回实例:ProcessData 123 None\r\n print 'ProcessData', playerId, data\r\ncomp.CollectOnlineClientData(['player', 'world', 'entity', 'game'], ProcessData, {'entityId' :'123', 'pos' : (123,456,789))})" - }, + ], + "type": "api", + "side": "server", + "name": "CollectOnlineClientData" + }, { - "type": "api", - "name": "GetArmorValue", - "method": "", - "description": "获取玩家护甲值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "", + "return": [], + "description": "获取玩家护甲值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetArmorValue(playerId))", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetArmorValue(playerId))" - }, + ], + "type": "api", + "side": "client", + "name": "GetArmorValue" + }, { - "type": "api", - "name": "GetEnchantmentSeed", - "method": "", - "description": "获取玩家的附魔种子,该种子会决定附魔台上准备附魔的装备的附魔项", - "remark": "- 该属性会自动存档", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetEnchantmentSeed()" - }, + "remark": "- 该属性会自动存档", + "return": [], + "description": "获取玩家的附魔种子,该种子会决定附魔台上准备附魔的装备的附魔项", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetEnchantmentSeed()", + "params": [], + "type": "api", + "side": "server", + "name": "GetEnchantmentSeed" + }, { - "type": "api", - "name": "GetPlayerCurLevelExp", - "method": "", - "description": "获取玩家当前等级需要的经验值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "", + "return": [], + "description": "获取玩家当前等级需要的经验值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetPlayerCurLevelExp(playerId))", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetPlayerCurLevelExp(playerId))" - }, + ], + "type": "api", + "side": "client", + "name": "GetPlayerCurLevelExp" + }, { - "type": "api", - "name": "GetPlayerExp", - "method": "", - "description": "获取玩家当前等级下的经验值", - "remark": "- 如果设置返回百分比为False,则返回玩家当前等级下经验的绝对值(非当前玩家总经验值)。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "- 如果设置返回百分比为False,则返回玩家当前等级下经验的绝对值(非当前玩家总经验值)。", + "return": [], + "description": "获取玩家当前等级下的经验值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetPlayerExp(playerId, False))", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "isPercent", - "type": "bool", + "type": "bool", + "name": "isPercent", "description": "是否为百分比, 如果设置返回百分比为False,则返回玩家当前等级下经验的绝对值(非当前玩家总经验值)。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetPlayerExp(playerId, False))" - }, + ], + "type": "api", + "side": "client", + "name": "GetPlayerExp" + }, { - "type": "api", - "name": "GetPlayerHealthLevel", - "method": "", - "description": "获取玩家健康临界值,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效。原版默认值为18", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nprint(comp.GetPlayerHealthLevel())" - }, + "remark": "", + "return": [], + "description": "获取玩家健康临界值,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效。原版默认值为18", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nprint(comp.GetPlayerHealthLevel())", + "params": [], + "type": "api", + "side": "server", + "name": "GetPlayerHealthLevel" + }, { - "type": "api", - "name": "GetPlayerHealthTick", - "method": "", - "description": "获取玩家自然恢复速度,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效。原版默认值为80刻(即每4秒)恢复1点血量", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nprint(comp.GetPlayerHealthTick())" - }, + "remark": "", + "return": [], + "description": "获取玩家自然恢复速度,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效。原版默认值为80刻(即每4秒)恢复1点血量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nprint(comp.GetPlayerHealthTick())", + "params": [], + "type": "api", + "side": "server", + "name": "GetPlayerHealthTick" + }, { - "type": "api", - "name": "GetPlayerHunger", - "method": "", - "description": "获取玩家饥饿度,展示在UI饥饿度进度条上,初始值为20,即每一个鸡腿代表2个饥饿度。 **饱和度(saturation)** :玩家当前饱和度,初始值为5,最大值始终为玩家当前饥饿度(hunger),该值直接影响玩家**饥饿度(hunger)**。
1)增加方法:吃食物。
2)减少方法:每触发一次**消耗事件**,该值减少1,如果该值不大于0,直接把玩家 **饥饿度(hunger)** 减少1。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetPlayerHunger()" - }, + "remark": "", + "return": [], + "description": "获取玩家饥饿度,展示在UI饥饿度进度条上,初始值为20,即每一个鸡腿代表2个饥饿度。 **饱和度(saturation)** :玩家当前饱和度,初始值为5,最大值始终为玩家当前饥饿度(hunger),该值直接影响玩家**饥饿度(hunger)**。
1)增加方法:吃食物。
2)减少方法:每触发一次**消耗事件**,该值减少1,如果该值不大于0,直接把玩家 **饥饿度(hunger)** 减少1。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetPlayerHunger()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPlayerHunger" + }, { - "type": "api", - "name": "GetPlayerLevel", - "method": "", - "description": "获取玩家等级", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateLv(playerId)\r\ncomp.GetPlayerLevel()" - }, + "remark": "", + "return": [], + "description": "获取玩家等级", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateLv(playerId)\r\ncomp.GetPlayerLevel()", + "params": [], + "type": "api", + "side": "server", + "name": "GetPlayerLevel" + }, { - "type": "api", - "name": "GetPlayerMaxExhaustionValue", - "method": "", - "description": "获取玩家foodExhaustionLevel的归零值,常量值,默认为4。**消耗度(exhaustion)**是指玩家当前消耗度水平,初始值为0,该值会随着玩家一系列动作(如跳跃)的影响而增加,当该值大于最大消耗度(maxExhaustion)后归零,并且把饱和度(saturation)减少1(为了说明饥饿度机制,我们将此定义为**消耗事件**)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetPlayerMaxExhaustionValue()" - }, + "remark": "", + "return": [], + "description": "获取玩家foodExhaustionLevel的归零值,常量值,默认为4。**消耗度(exhaustion)**是指玩家当前消耗度水平,初始值为0,该值会随着玩家一系列动作(如跳跃)的影响而增加,当该值大于最大消耗度(maxExhaustion)后归零,并且把饱和度(saturation)减少1(为了说明饥饿度机制,我们将此定义为**消耗事件**)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetPlayerMaxExhaustionValue()", + "params": [], + "type": "api", + "side": "server", + "name": "GetPlayerMaxExhaustionValue" + }, { - "type": "api", - "name": "GetPlayerStarveLevel", - "method": "", - "description": "获取玩家饥饿临界值,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效。原版默认值为1", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nprint(comp.GetPlayerStarveLevel())" - }, + "remark": "", + "return": [], + "description": "获取玩家饥饿临界值,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效。原版默认值为1", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nprint(comp.GetPlayerStarveLevel())", + "params": [], + "type": "api", + "side": "server", + "name": "GetPlayerStarveLevel" + }, { - "type": "api", - "name": "GetPlayerStarveTick", - "method": "", - "description": "获取玩家饥饿掉血速度,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效。原版默认值为80刻(即每4秒)扣除1点血量", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nprint(comp.GetPlayerStarveTick())" - }, + "remark": "", + "return": [], + "description": "获取玩家饥饿掉血速度,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效。原版默认值为80刻(即每4秒)扣除1点血量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nprint(comp.GetPlayerStarveTick())", + "params": [], + "type": "api", + "side": "server", + "name": "GetPlayerStarveTick" + }, { - "type": "api", - "name": "GetPlayerTotalExp", - "method": "", - "description": "获取玩家的总经验值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "", + "return": [], + "description": "获取玩家的总经验值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetPlayerTotalExp(playerId))", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.GetPlayerTotalExp(playerId))" - }, + ], + "type": "api", + "side": "client", + "name": "GetPlayerTotalExp" + }, { - "type": "api", - "name": "IsPlayerNaturalRegen", - "method": "", - "description": "是否开启玩家自然恢复,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效。原版默认开启", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nprint(comp.IsPlayerNaturalRegen())" - }, + "remark": "", + "return": [], + "description": "是否开启玩家自然恢复,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效。原版默认开启", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nprint(comp.IsPlayerNaturalRegen())", + "params": [], + "type": "api", + "side": "server", + "name": "IsPlayerNaturalRegen" + }, { - "type": "api", - "name": "IsPlayerNaturalStarve", - "method": "", - "description": "是否开启玩家饥饿掉血,当饥饿值小于饥饿临界值时会自动恢复血量,开启饥饿值且开启饥饿掉血时有效。原版默认开启", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nprint(comp.IsPlayerNaturalStarve())" - }, + "remark": "", + "return": [], + "description": "是否开启玩家饥饿掉血,当饥饿值小于饥饿临界值时会自动恢复血量,开启饥饿值且开启饥饿掉血时有效。原版默认开启", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nprint(comp.IsPlayerNaturalStarve())", + "params": [], + "type": "api", + "side": "server", + "name": "IsPlayerNaturalStarve" + }, { - "type": "api", - "name": "SetEnchantmentSeed", - "method": "", - "description": "设置玩家的附魔种子,该种子会决定附魔台上准备附魔的装备的附魔项", - "remark": "- 该属性会自动存档", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "- 该属性会自动存档", + "return": [], + "description": "设置玩家的附魔种子,该种子会决定附魔台上准备附魔的装备的附魔项", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetEnchantmentSeed(32)", "params": [ { - "name": "enchantmentSeed", - "type": "int", + "type": "int", + "name": "enchantmentSeed", "description": "种子,随机数量多,开发者可使用[GetEnchantmentSeed](#getenchantmentseed)获取当前的随机种子,自行记录" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetEnchantmentSeed(32)" - }, + ], + "type": "api", + "side": "server", + "name": "SetEnchantmentSeed" + }, { - "type": "api", - "name": "SetPlayerHealthLevel", - "method": "", - "description": "设置玩家健康临界值,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效.原版默认值为18", - "remark": "- 注:健康临界值始终大于等于饥饿临界值。如果设置的健康临界值小于饥饿临界值,饥饿临界值将被设置为当前的健康临界值", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "- 注:健康临界值始终大于等于饥饿临界值。如果设置的健康临界值小于饥饿临界值,饥饿临界值将被设置为当前的健康临界值", + "return": [], + "description": "设置玩家健康临界值,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效.原版默认值为18", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.SetPlayerHealthLevel(16) # 饥饿值大于等于16就会进入自然恢复状态,默认每隔4秒恢复1点血量", "params": [ { - "name": "healthLevel", - "type": "int", + "type": "int", + "name": "healthLevel", "description": "健康临界值" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.SetPlayerHealthLevel(16) # 饥饿值大于等于16就会进入自然恢复状态,默认每隔4秒恢复1点血量" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerHealthLevel" + }, { - "type": "api", - "name": "SetPlayerHealthTick", - "method": "", - "description": "设置玩家自然恢复速度,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效.原版默认值为80刻(即每4秒)恢复1点血量", - "remark": "- 注:最小值为1,即每秒恢复20点血量", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "- 注:最小值为1,即每秒恢复20点血量", + "return": [], + "description": "设置玩家自然恢复速度,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效.原版默认值为80刻(即每4秒)恢复1点血量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.SetPlayerHealthTick(40) # 自然恢复状态下每隔2(40/20)秒恢复1点血量", "params": [ { - "name": "healthTick", - "type": "int", + "type": "int", + "name": "healthTick", "description": "自然恢复速度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.SetPlayerHealthTick(40) # 自然恢复状态下每隔2(40/20)秒恢复1点血量" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerHealthTick" + }, { - "type": "api", - "name": "SetPlayerHunger", - "method": "", - "description": "设置玩家饥饿度。", - "remark": "- 该接口修改的饥饿度不能触发PlayerHungerChangeServerEvent事件", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "- 该接口修改的饥饿度不能触发PlayerHungerChangeServerEvent事件", + "return": [], + "description": "设置玩家饥饿度。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerHunger(10)", "params": [ { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "饥饿度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerHunger(10)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerHunger" + }, { - "type": "api", - "name": "SetPlayerMaxExhaustionValue", - "method": "", - "description": "设置玩家**最大消耗度(maxExhaustion)**,通过调整 **最大消耗度(maxExhaustion)** 的大小,就可以调整 **饥饿度(hunger)** 的消耗速度,当 **最大消耗度(maxExhaustion)** 很大时,饥饿度可以看似一直不下降", - "remark": "- 例如:当 **最大消耗度(maxExhaustion)** 为4时,玩家的饥饿消耗速度是 **最大消耗度(maxExhaustion)** 为8时的两倍", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "- 例如:当 **最大消耗度(maxExhaustion)** 为4时,玩家的饥饿消耗速度是 **最大消耗度(maxExhaustion)** 为8时的两倍", + "return": [], + "description": "设置玩家**最大消耗度(maxExhaustion)**,通过调整 **最大消耗度(maxExhaustion)** 的大小,就可以调整 **饥饿度(hunger)** 的消耗速度,当 **最大消耗度(maxExhaustion)** 很大时,饥饿度可以看似一直不下降", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerMaxExhaustionValue(10.0)", "params": [ { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "**最大消耗度(maxExhaustion)**" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerMaxExhaustionValue(10.0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerMaxExhaustionValue" + }, { - "type": "api", - "name": "SetPlayerNaturalRegen", - "method": "", - "description": "设置是否开启玩家自然恢复,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效.原版默认开启", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "", + "return": [], + "description": "设置是否开启玩家自然恢复,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效.原版默认开启", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.SetPlayerNaturalRegen(False) # 关闭自然恢复,即使饥饿值大于健康临界值时也不会恢复血量", "params": [ { - "name": "value", - "type": "bool", + "type": "bool", + "name": "value", "description": "True开启,False关闭" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.SetPlayerNaturalRegen(False) # 关闭自然恢复,即使饥饿值大于健康临界值时也不会恢复血量" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerNaturalRegen" + }, { - "type": "api", - "name": "SetPlayerNaturalStarve", - "method": "", - "description": "设置是否开启玩家饥饿掉血,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效.原版默认开启", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "", + "return": [], + "description": "设置是否开启玩家饥饿掉血,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效.原版默认开启", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.SetPlayerNaturalStarve(False) # 关闭饥饿掉血,即使饥饿值小于饥饿临界值时也不会扣除血量", "params": [ { - "name": "value", - "type": "bool", + "type": "bool", + "name": "value", "description": "True开启,False关闭" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.SetPlayerNaturalStarve(False) # 关闭饥饿掉血,即使饥饿值小于饥饿临界值时也不会扣除血量" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerNaturalStarve" + }, { - "type": "api", - "name": "SetPlayerPrefixAndSuffixName", - "method": "", - "description": "设置玩家前缀和后缀名字", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "", + "return": [], + "description": "设置玩家前缀和后缀名字", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateName(playerId)\r\ncomp.SetPlayerPrefixAndSuffixName(\"红队\",serverApi.GenerateColor('RED'),'肉盾',serverApi.GenerateColor('RED'), serverApi.GenerateColor('BLUE'))", "params": [ { - "name": "prefix", - "type": "str", + "type": "str", + "name": "prefix", "description": "前缀内容" - }, + }, { - "name": "prefixColor", - "type": "str", + "type": "str", + "name": "prefixColor", "description": "前缀内容颜色描述,可以使用GenerateColor接口传入参数" - }, + }, { - "name": "suffix", - "type": "str", + "type": "str", + "name": "suffix", "description": "后缀内容" - }, + }, { - "name": "suffixColor", - "type": "str", + "type": "str", + "name": "suffixColor", "description": "后缀内容颜色描述,可以使用GenerateColor接口传入参数" - }, + }, { - "name": "nameColor", - "type": "str", + "type": "str", + "name": "nameColor", "description": "名字颜色描述,可以使用GenerateColor接口传入参数,默认为空" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateName(playerId)\r\ncomp.SetPlayerPrefixAndSuffixName(\"红队\",serverApi.GenerateColor('RED'),'肉盾',serverApi.GenerateColor('RED'), serverApi.GenerateColor('BLUE'))" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerPrefixAndSuffixName" + }, { - "type": "api", - "name": "SetPlayerStarveLevel", - "method": "", - "description": "设置玩家饥饿临界值,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效。原版默认值为1", - "remark": "- 注:健康临界值始终大于等于饥饿临界值。如果设置的饥饿临界值大于健康临界值,将被设置为当前的健康临界值", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "- 注:健康临界值始终大于等于饥饿临界值。如果设置的饥饿临界值大于健康临界值,将被设置为当前的健康临界值", + "return": [], + "description": "设置玩家饥饿临界值,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效。原版默认值为1", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.SetPlayerStarveLevel(2) # 饥饿值小于等于2就会进入饥饿掉血状态,默认每隔4秒掉1点血量", "params": [ { - "name": "starveLevel", - "type": "int", + "type": "int", + "name": "starveLevel", "description": "饥饿临界值" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.SetPlayerStarveLevel(2) # 饥饿值小于等于2就会进入饥饿掉血状态,默认每隔4秒掉1点血量" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerStarveLevel" + }, { - "type": "api", - "name": "SetPlayerStarveTick", - "method": "", - "description": "设置玩家饥饿掉血速度,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效.原版默认值为80刻(即每4秒)扣除1点血量", - "remark": "- 注:最小值为1,即每秒扣20点血量", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "- 注:最小值为1,即每秒扣20点血量", + "return": [], + "description": "设置玩家饥饿掉血速度,当饥饿值小于饥饿临界值时会自动扣除血量,开启饥饿值且开启饥饿掉血时有效.原版默认值为80刻(即每4秒)扣除1点血量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.SetPlayerStarveTick(40) # 饥饿掉血状态下每隔2(40/20)秒扣除1点血量", "params": [ { - "name": "starveTick", - "type": "int", + "type": "int", + "name": "starveTick", "description": "饥饿掉血速度" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.SetPlayerStarveTick(40) # 饥饿掉血状态下每隔2(40/20)秒扣除1点血量" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerStarveTick" + }, { - "type": "api", - "name": "SetPlayerTotalExp", - "method": "", - "description": "设置玩家的总经验值", - "remark": "- 根据总经验值会重新计算等级,该接口可引起等级的变化\r\n - 内部运算采用浮点数,数值较大时会出现误差", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "remark": "- 根据总经验值会重新计算等级,该接口可引起等级的变化\r\n - 内部运算采用浮点数,数值较大时会出现误差", + "return": [], + "description": "设置玩家的总经验值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExp(entityId)\r\ncomp.SetPlayerTotalExp(25)", "params": [ { - "name": "exp", - "type": "int", + "type": "int", + "name": "exp", "description": "总经验值,正整数" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateExp(entityId)\r\ncomp.SetPlayerTotalExp(25)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerTotalExp" + }, { - "type": "api", - "name": "Swing", - "method": "", - "description": "本地玩家播放原版攻击动作", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(clientApi.GetLevelId())\r\ncomp.Swing()" - }, + "remark": "", + "return": [], + "description": "本地玩家播放原版攻击动作", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(clientApi.GetLevelId())\r\ncomp.Swing()", + "params": [], + "type": "api", + "side": "client", + "name": "Swing" + }, { - "type": "api", - "name": "getUid", - "method": "", - "description": "获取本地玩家的uid", - "remark": "- 不是客户端线程或者没有经过登录认证获取的uid为None。在当前机器上调用该接口获取的值为固定值,不依赖创建的player\r\n - getUid接口不能在加载mod过程中使用,推荐开发者在OnLocalPlayerStopLoading事件触发之后再使用", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nuid = comp.getUid()" - }, + "remark": "- 不是客户端线程或者没有经过登录认证获取的uid为None。在当前机器上调用该接口获取的值为固定值,不依赖创建的player\r\n - getUid接口不能在加载mod过程中使用,推荐开发者在OnLocalPlayerStopLoading事件触发之后再使用", + "return": [], + "description": "获取本地玩家的uid", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/属性.md", + "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\nuid = comp.getUid()", + "params": [], + "type": "api", + "side": "client", + "name": "getUid" + }, { - "type": "api", - "name": "AddCameraAroundEntityMotion", - "method": "", - "description": "给相机添加对实体环绕运动器", - "remark": "- 环绕运动器可叠加多个,且可与速度运动器互相叠加。当有多个运动器叠加时,位置为各个运动器计算出的瞬时向量之和,朝向以后添加的运动器设置的朝向为准。\r\n - 运动器的朝向也会受到玩家视角转动的影响,若要完全使用运动器的朝向,建议使用[SetCanDrag](../控制.md#SetCanDrag)接口屏蔽玩家的视角操作。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- 环绕运动器可叠加多个,且可与速度运动器互相叠加。当有多个运动器叠加时,位置为各个运动器计算出的瞬时向量之和,朝向以后添加的运动器设置的朝向为准。\r\n - 运动器的朝向也会受到玩家视角转动的影响,若要完全使用运动器的朝向,建议使用[SetCanDrag](../控制.md#SetCanDrag)接口屏蔽玩家的视角操作。", + "return": [], + "description": "给相机添加对实体环绕运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\naxis=(-1, 1, 1)\r\nmID = comp.AddCameraAroundEntityMotion(eID, 1.0, axis, lockDir=False, stopRad=0, radius=2.0)", "params": [ { - "name": "eID", - "type": "str", + "type": "str", + "name": "eID", "description": "要环绕的某个实体的ID" - }, + }, { - "name": "angularVelocity", - "type": "float", + "type": "float", + "name": "angularVelocity", "description": "圆周运动的角速度(弧度/秒)" - }, + }, { - "name": "axis", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "axis", "description": "圆周运动的轴,决定了在哪个平面上做圆周运动,默认为(0, 1, 0)" - }, + }, { - "name": "lockDir", - "type": "bool", + "type": "bool", + "name": "lockDir", "description": "是否在运动器生效时锁定相机的朝向,不锁定则相机的朝向会随着运动而改变,默认为False。" - }, + }, { - "name": "stopRad", - "type": "float", + "type": "float", + "name": "stopRad", "description": "停止该运动器所需要的弧度,当stopRad为0时,该运动器会一直运行,默认为0" - }, + }, { - "name": "radius", - "type": "float", + "type": "float", + "name": "radius", "description": "环绕半径,当设置为-1时环绕运动器使用当前与目标的距离作为半径,当设置为非负数时表示按设定的值作为环绕半径,默认为-1" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\naxis=(-1, 1, 1)\r\nmID = comp.AddCameraAroundEntityMotion(eID, 1.0, axis, lockDir=False, stopRad=0, radius=2.0)" - }, + ], + "type": "api", + "side": "client", + "name": "AddCameraAroundEntityMotion" + }, { - "type": "api", - "name": "AddCameraAroundPointMotion", - "method": "", - "description": "给相机添加对点环绕运动器", - "remark": "- 环绕运动器可叠加多个,且可与速度运动器互相叠加。当有多个运动器叠加时,位置为各个运动器计算出的瞬时向量之和,朝向以后添加的运动器设置的朝向为准。\r\n - 运动器的朝向也会受到玩家视角转动的影响,若要完全使用运动器的朝向,建议使用[SetCanDrag](../控制.md#SetCanDrag)接口屏蔽玩家的视角操作。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- 环绕运动器可叠加多个,且可与速度运动器互相叠加。当有多个运动器叠加时,位置为各个运动器计算出的瞬时向量之和,朝向以后添加的运动器设置的朝向为准。\r\n - 运动器的朝向也会受到玩家视角转动的影响,若要完全使用运动器的朝向,建议使用[SetCanDrag](../控制.md#SetCanDrag)接口屏蔽玩家的视角操作。", + "return": [], + "description": "给相机添加对点环绕运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncenter = (0, 8, 0)\r\naxis=(-1, 1, 1)\r\nmID = comp.AddCameraAroundPointMotion(center, 1.0, axis, lockDir=False, stopRad=0)", "params": [ { - "name": "center", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "center", "description": "要环绕的圆心点坐标" - }, + }, { - "name": "angularVelocity", - "type": "float", + "type": "float", + "name": "angularVelocity", "description": "圆周运动的角速度(弧度/秒)" - }, + }, { - "name": "axis", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "axis", "description": "圆周运动的轴,决定了在哪个平面上做圆周运动,默认为(0, 1, 0)" - }, + }, { - "name": "lockDir", - "type": "bool", + "type": "bool", + "name": "lockDir", "description": "是否在运动器生效时锁定相机的朝向,不锁定则相机的朝向会随着运动而改变,默认为False。" - }, + }, { - "name": "stopRad", - "type": "float", + "type": "float", + "name": "stopRad", "description": "停止该运动器所需要的弧度,当stopRad为0时,该运动器会一直运行,默认为0" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncenter = (0, 8, 0)\r\naxis=(-1, 1, 1)\r\nmID = comp.AddCameraAroundPointMotion(center, 1.0, axis, lockDir=False, stopRad=0)" - }, + ], + "type": "api", + "side": "client", + "name": "AddCameraAroundPointMotion" + }, { - "type": "api", - "name": "AddCameraTrackMotion", - "method": "", - "description": "给相机添加轨迹运动器", - "remark": "- 轨迹运动器不可叠加,仅能添加一个。相机会在运动器停止后自动回到原始状态。\r\n - 运动器的相对坐标设置(relativeCoord)是根据[启动](#StartCameraMotion)运动器时的相机位置计算所得,并不是在添加运动器时计算。\r\n 使用相对坐标时,是以相机自身的局部坐标系(右手坐标系)为参考。\r\n 引擎中的相机镜头默认朝向自身局部坐标系的-Z轴方向,当设置朝向时,实际上是设置了相机的Z轴的方位角,比如设置startRot=(0,0),相机镜头会朝向世界坐标的-Z轴方向。\r\n - 设置朝向后会根据相应的参数计算出最终朝向,若此时的targetRot > startRot,则会顺时针旋转,反之逆时针旋转。\r\n - 当相机被设置为lock后,添加相机轨迹运动器相关的接口失效!", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- 轨迹运动器不可叠加,仅能添加一个。相机会在运动器停止后自动回到原始状态。\r\n - 运动器的相对坐标设置(relativeCoord)是根据[启动](#StartCameraMotion)运动器时的相机位置计算所得,并不是在添加运动器时计算。\r\n 使用相对坐标时,是以相机自身的局部坐标系(右手坐标系)为参考。\r\n 引擎中的相机镜头默认朝向自身局部坐标系的-Z轴方向,当设置朝向时,实际上是设置了相机的Z轴的方位角,比如设置startRot=(0,0),相机镜头会朝向世界坐标的-Z轴方向。\r\n - 设置朝向后会根据相应的参数计算出最终朝向,若此时的targetRot > startRot,则会顺时针旋转,反之逆时针旋转。\r\n - 当相机被设置为lock后,添加相机轨迹运动器相关的接口失效!", + "return": [], + "description": "给相机添加轨迹运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ntarget = (5, 0, 0)\r\nrot1 = (0, 0)\r\nrot2 = (0, 360)\r\nmID = comp.AddCameraTrackMotion(target, 3.0, startPos=None, relativeCoord=True, isLoop=False, targetRot=rot1, startRot=rot2, useVelocityDir=True, ease = clientApi.GetMinecraftEnum().TimeEaseType.linear)", "params": [ { - "name": "targetPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "targetPos", "description": "轨迹终点" - }, + }, { - "name": "duraTime", - "type": "float", + "type": "float", + "name": "duraTime", "description": "到达终点所需要的时间" - }, + }, { - "name": "startPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "startPos", "description": "轨迹起点,默认为None,表示以调用[StartCameraMotion](#StartCameraMotion)的位置作为起点。" - }, + }, { - "name": "relativeCoord", - "type": "bool", + "type": "bool", + "name": "relativeCoord", "description": "是否使用相对坐标设置起点和终点,默认为False。" - }, + }, { - "name": "isLoop", - "type": "bool", + "type": "bool", + "name": "isLoop", "description": "是否循环,若设为True,则相机会在起点和终点之间往复运动,默认为False。" - }, + }, { - "name": "targetRot", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "targetRot", "description": "相机到达targetPos时的朝向,受参数relativeCoord影响,默认为None,表示使用调用[StartCameraMotion](#StartCameraMotion)时的朝向。" - }, + }, { - "name": "startRot", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "startRot", "description": "相机到达startPos时的朝向,受参数relativeCoord影响,默认为None,表示使用调用[StartCameraMotion](#StartCameraMotion)时的朝向。" - }, + }, { - "name": "useVelocityDir", - "type": "bool", + "type": "bool", + "name": "useVelocityDir", "description": "是否使用运动中的速度方向作为朝向,默认为False,若为True,则参数targetRot和startRot无效" - }, + }, { - "name": "ease", - "type": "TimeEaseType", + "type": "TimeEaseType", + "name": "ease", "description": "时间变化函数, 默认值为clientApi.GetMinecraftEnum().TimeEaseType.linear, 参数不在枚举值中也当作linear" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ntarget = (5, 0, 0)\r\nrot1 = (0, 0)\r\nrot2 = (0, 360)\r\nmID = comp.AddCameraTrackMotion(target, 3.0, startPos=None, relativeCoord=True, isLoop=False, targetRot=rot1, startRot=rot2, useVelocityDir=True, ease = clientApi.GetMinecraftEnum().TimeEaseType.linear)" - }, + ], + "type": "api", + "side": "client", + "name": "AddCameraTrackMotion" + }, { - "type": "api", - "name": "AddCameraVelocityMotion", - "method": "", - "description": "给相机添加速度运动器", - "remark": "- 速度运动器可叠加多个,且可与环绕运动器互相叠加。当有多个运动器叠加时,相机的朝向以后添加的运动器设置的朝向为准。\r\n - 运动器的朝向也会受到玩家视角转动的影响,若要完全使用运动器的朝向,建议使用[SetCanDrag](../控制.md#SetCanDrag)接口屏蔽玩家的视角操作。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- 速度运动器可叠加多个,且可与环绕运动器互相叠加。当有多个运动器叠加时,相机的朝向以后添加的运动器设置的朝向为准。\r\n - 运动器的朝向也会受到玩家视角转动的影响,若要完全使用运动器的朝向,建议使用[SetCanDrag](../控制.md#SetCanDrag)接口屏蔽玩家的视角操作。", + "return": [], + "description": "给相机添加速度运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\nvelocity = (0, 0, 1)\r\naccelerate = (0, 0, -1)\r\nmID = comp.AddCameraVelocityMotion(velocity, accelerate, useVelocityDir=True)", "params": [ { - "name": "velocity", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "velocity", "description": "速度,包含大小、方向" - }, + }, { - "name": "accelerate", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "accelerate", "description": "加速度,包含大小、方向,默认为None,表示没有加速度" - }, + }, { - "name": "useVelocityDir", - "type": "bool", + "type": "bool", + "name": "useVelocityDir", "description": "是否使用当前速度的方向作为此刻相机的朝向,默认为True" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\nvelocity = (0, 0, 1)\r\naccelerate = (0, 0, -1)\r\nmID = comp.AddCameraVelocityMotion(velocity, accelerate, useVelocityDir=True)" - }, + ], + "type": "api", + "side": "client", + "name": "AddCameraVelocityMotion" + }, { - "type": "api", - "name": "DepartCamera", - "method": "", - "description": "分离玩家与摄像机", - "remark": "- 分离之后,可以看到玩家四周,旋转镜头时玩家面向的方向不再跟随镜头旋转而变化。注意,分离镜头后乘船时,船的组件minecraft:rideable中的lock_rider_rotation字段将失去效果。另外,在骑乘马或者其他生物的情况下,分离镜头后由于玩家的方向不再跟随镜头旋转,因此骑乘时无法进行转向,请注意这一点。\r\n - 注意,使用后会默认解除视角移动锁定,效果等同\r\n comp.LockModCameraYaw(0) # 解除锁定左右视角\r\n comp.LockModCameraPitch(0) # 解除锁定上下视角\r\n - 该接口的效果会与lockcamera互相覆盖", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# 第三人称锁定视角例子\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.DepartCamera()\r\ncomp.LockModCameraYaw(1) # 锁定左右视角\r\ncomp.LockModCameraPitch(1) # 锁定上下视角\r\ncomp.SetCameraOffset((0, 0, 15))\r\ncomp.SetCameraRotation((45.0, 0.0, 0.0))" - }, + "remark": "- 分离之后,可以看到玩家四周,旋转镜头时玩家面向的方向不再跟随镜头旋转而变化。注意,分离镜头后乘船时,船的组件minecraft:rideable中的lock_rider_rotation字段将失去效果。另外,在骑乘马或者其他生物的情况下,分离镜头后由于玩家的方向不再跟随镜头旋转,因此骑乘时无法进行转向,请注意这一点。\r\n - 注意,使用后会默认解除视角移动锁定,效果等同\r\n comp.LockModCameraYaw(0) # 解除锁定左右视角\r\n comp.LockModCameraPitch(0) # 解除锁定上下视角\r\n - 该接口的效果会与lockcamera互相覆盖", + "return": [], + "description": "分离玩家与摄像机", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# 第三人称锁定视角例子\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.DepartCamera()\r\ncomp.LockModCameraYaw(1) # 锁定左右视角\r\ncomp.LockModCameraPitch(1) # 锁定上下视角\r\ncomp.SetCameraOffset((0, 0, 15))\r\ncomp.SetCameraRotation((45.0, 0.0, 0.0))", + "params": [], + "type": "api", + "side": "client", + "name": "DepartCamera" + }, { - "type": "api", - "name": "GetCameraAnchor", - "method": "", - "description": "获取相机锚点", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.GetCameraAnchor()" - }, + "remark": "", + "return": [], + "description": "获取相机锚点", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.GetCameraAnchor()", + "params": [], + "type": "api", + "side": "client", + "name": "GetCameraAnchor" + }, { - "type": "api", - "name": "GetCameraMotions", - "method": "", - "description": "获取相机上的所有运动器", - "remark": "- 运动器非人为停止后会被移除。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\nmotions = comp.GetCameraMotions()\r\n# motions = {\r\n# 0:1,\r\n# 1:2\r\n# }" - }, + "remark": "- 运动器非人为停止后会被移除。", + "return": [], + "description": "获取相机上的所有运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\nmotions = comp.GetCameraMotions()\r\n# motions = {\r\n# 0:1,\r\n# 1:2\r\n# }", + "params": [], + "type": "api", + "side": "client", + "name": "GetCameraMotions" + }, { - "type": "api", - "name": "GetCameraOffset", - "method": "", - "description": "获取摄像机偏移量", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.GetCameraOffset()" - }, + "remark": "", + "return": [], + "description": "获取摄像机偏移量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.GetCameraOffset()", + "params": [], + "type": "api", + "side": "client", + "name": "GetCameraOffset" + }, { - "type": "api", - "name": "GetCameraPitchLimit", - "method": "", - "description": "获取摄像机上下角度限制值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.GetCameraPitchLimit()" - }, + "remark": "", + "return": [], + "description": "获取摄像机上下角度限制值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.GetCameraPitchLimit()", + "params": [], + "type": "api", + "side": "client", + "name": "GetCameraPitchLimit" + }, { - "type": "api", - "name": "GetCameraRotation", - "method": "", - "description": "获取摄像机的朝向", - "remark": "- 若在使用[SetCameraRotation](#SetCameraRotation)立马调用该接口,会得到修改前的结果,因为摄像机是在逻辑帧之间插值移动变化的,而不是马上改变。\r\n - 与F3显示的相机调试信息的Pitch、Yaw相反。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\nrot = comp.GetCameraRotation()" - }, + "remark": "- 若在使用[SetCameraRotation](#SetCameraRotation)立马调用该接口,会得到修改前的结果,因为摄像机是在逻辑帧之间插值移动变化的,而不是马上改变。\r\n - 与F3显示的相机调试信息的Pitch、Yaw相反。", + "return": [], + "description": "获取摄像机的朝向", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\nrot = comp.GetCameraRotation()", + "params": [], + "type": "api", + "side": "client", + "name": "GetCameraRotation" + }, { - "type": "api", - "name": "GetForward", - "method": "", - "description": "返回相机向前的方向", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.GetForward()" - }, + "remark": "", + "return": [], + "description": "返回相机向前的方向", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.GetForward()", + "params": [], + "type": "api", + "side": "client", + "name": "GetForward" + }, { - "type": "api", - "name": "GetFov", - "method": "", - "description": "获取视野大小", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\nfov = comp.GetFov()" - }, + "remark": "", + "return": [], + "description": "获取视野大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\nfov = comp.GetFov()", + "params": [], + "type": "api", + "side": "client", + "name": "GetFov" + }, { - "type": "api", - "name": "GetFpHeight", - "method": "", - "description": "获取本地玩家当前状态下,第一人称视角时的摄像机高度偏移量。游泳时,滑翔时以及普通状态下会有所不同", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\nheightOffset = comp.GetFpHeight()" - }, + "remark": "", + "return": [], + "description": "获取本地玩家当前状态下,第一人称视角时的摄像机高度偏移量。游泳时,滑翔时以及普通状态下会有所不同", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\nheightOffset = comp.GetFpHeight()", + "params": [], + "type": "api", + "side": "client", + "name": "GetFpHeight" + }, { - "type": "api", - "name": "GetPerspective", - "method": "", - "description": "获取当前的视角模式", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayerView(entityId)\r\npersp = comp.GetPerspective()" - }, + "remark": "", + "return": [], + "description": "获取当前的视角模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayerView(entityId)\r\npersp = comp.GetPerspective()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPerspective" + }, { - "type": "api", - "name": "GetPosition", - "method": "", - "description": "返回相机中心", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.GetPosition()" - }, + "remark": "", + "return": [], + "description": "返回相机中心", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.GetPosition()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPosition" + }, { - "type": "api", - "name": "IsModCameraLockPitch", - "method": "", - "description": "是否锁定摄像机上下角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.IsModCameraLockPitch()" - }, + "remark": "", + "return": [], + "description": "是否锁定摄像机上下角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.IsModCameraLockPitch()", + "params": [], + "type": "api", + "side": "client", + "name": "IsModCameraLockPitch" + }, { - "type": "api", - "name": "IsModCameraLockYaw", - "method": "", - "description": "是否锁定摄像机左右角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.IsModCameraLockYaw()" - }, + "remark": "", + "return": [], + "description": "是否锁定摄像机左右角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.IsModCameraLockYaw()", + "params": [], + "type": "api", + "side": "client", + "name": "IsModCameraLockYaw" + }, { - "type": "api", - "name": "LockCamera", - "method": "", - "description": "锁定摄像机", - "remark": "- 锁定摄像机时只是锁定画面视角,玩家仍然可以移动\r\n - 该接口的效果会与departcamera互相覆盖", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- 锁定摄像机时只是锁定画面视角,玩家仍然可以移动\r\n - 该接口的效果会与departcamera互相覆盖", + "return": [], + "description": "锁定摄像机", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\n# 把摄像机固定在(0, 6, 0),并且30度俯视,朝向世界z轴正方向\r\ncomp.LockCamera((0, 6, 0), (30, 0))", "params": [ { - "name": "lockPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "lockPos", "description": "世界坐标" - }, + }, { - "name": "lockRot", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "lockRot", "description": "摄像机的角度(俯仰角及偏航角)" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\n# 把摄像机固定在(0, 6, 0),并且30度俯视,朝向世界z轴正方向\r\ncomp.LockCamera((0, 6, 0), (30, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "LockCamera" + }, { - "type": "api", - "name": "LockModCameraPitch", - "method": "", - "description": "锁定摄像机上下角度(第三人称下生效,锁定后不能上下调整视角)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "", + "return": [], + "description": "锁定摄像机上下角度(第三人称下生效,锁定后不能上下调整视角)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.LockModCameraPitch(1)", "params": [ { - "name": "enable", - "type": "int", + "type": "int", + "name": "enable", "description": "1:锁定 0:解锁" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.LockModCameraPitch(1)" - }, + ], + "type": "api", + "side": "client", + "name": "LockModCameraPitch" + }, { - "type": "api", - "name": "LockModCameraYaw", - "method": "", - "description": "锁定摄像机左右角度(第三人称下生效,锁定后不能通过鼠标左右调整视角)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "", + "return": [], + "description": "锁定摄像机左右角度(第三人称下生效,锁定后不能通过鼠标左右调整视角)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.LockModCameraYaw(1)", "params": [ { - "name": "enable", - "type": "int", + "type": "int", + "name": "enable", "description": "1:锁定 0:解锁" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.LockModCameraYaw(1)" - }, + ], + "type": "api", + "side": "client", + "name": "LockModCameraYaw" + }, { - "type": "api", - "name": "LockPerspective", - "method": "", - "description": "锁定玩家的视角模式", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "", + "return": [], + "description": "锁定玩家的视角模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayerView(entityId)\r\ncomp.LockPerspective(1)", "params": [ { - "name": "lock", - "type": "int", + "type": "int", + "name": "lock", "description": "0:第一人称视角;1:第三人称视角;2:前视第三人称视角 其他值:解除锁定" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayerView(entityId)\r\ncomp.LockPerspective(1)" - }, + ], + "type": "api", + "side": "client", + "name": "LockPerspective" + }, { - "type": "api", - "name": "RemoveCameraMotion", - "method": "", - "description": "移除相机上的某个运动器", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "", + "return": [], + "description": "移除相机上的某个运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.RemoveCameraMotion(mID)", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "要移除的某个运动器的ID" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.RemoveCameraMotion(mID)" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveCameraMotion" + }, { - "type": "api", - "name": "ResetCameraBindActorId", - "method": "", - "description": "将摄像机重新绑定回主角身上", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.ResetCameraBindActorId()" - }, + "remark": "", + "return": [], + "description": "将摄像机重新绑定回主角身上", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.ResetCameraBindActorId()", + "params": [], + "type": "api", + "side": "client", + "name": "ResetCameraBindActorId" + }, { - "type": "api", - "name": "SetCameraAnchor", - "method": "", - "description": "设置相机锚点", - "remark": "- (1) 调用了该接口会对第一人称下客户端的交互中心进行同样的偏移,如果需要修改第三人称的交互中心可使用[SetPickCenterOffset](./行为.md#setpickcenteroffset)\r\n (2) 在第一人称调高了摄像头会导致交互被撤销,这是由于服务端的交互中心还是在人物的位置,需要使用[SetInteracteCenterOffset](./行为.md#setinteractecenteroffset)进行修正\r\n (3) 在第一人称调高了摄像头会导致无法交互到地面或者远距离的方块,可以使用[SetPickRange](./行为.md#setpickrange)修改客户端的交互半径,使用[SetPlayerInteracteRange](./行为.md#setplayerinteracterange)修改服务端的交互半径.\r\n - 注:当前客户端能修改交互中心的有[SetCameraAnchor](#setcameraanchor)修改第一人称,[SetPickCenterOffset](./行为.md#setpickcenteroffset)修改第三人称。服务端能使用[SetInteracteCenterOffset](./行为.md#setinteractecenteroffset)修改玩家交互中心(服务端无第几人称概念)\r\n - 与SetCameraOffset不同的是,该接口改变的是相机的轨道的圆心位置。对第一人称和第三人称模式均生效,需要注意的是,改变后,鼠标或者触屏旋转,最终绕该圆心运动,不再绕玩家为中心。可以简单理解为,默认anchor为玩家中心。\r\n - 注意,设置后的效果不会存档\r\n - 注意,如果摄像头进入墙体里面会出现透视的情况,在联机模式时可能会破坏游戏的平衡,请谨慎使用", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- (1) 调用了该接口会对第一人称下客户端的交互中心进行同样的偏移,如果需要修改第三人称的交互中心可使用[SetPickCenterOffset](./行为.md#setpickcenteroffset)\r\n (2) 在第一人称调高了摄像头会导致交互被撤销,这是由于服务端的交互中心还是在人物的位置,需要使用[SetInteracteCenterOffset](./行为.md#setinteractecenteroffset)进行修正\r\n (3) 在第一人称调高了摄像头会导致无法交互到地面或者远距离的方块,可以使用[SetPickRange](./行为.md#setpickrange)修改客户端的交互半径,使用[SetPlayerInteracteRange](./行为.md#setplayerinteracterange)修改服务端的交互半径.\r\n - 注:当前客户端能修改交互中心的有[SetCameraAnchor](#setcameraanchor)修改第一人称,[SetPickCenterOffset](./行为.md#setpickcenteroffset)修改第三人称。服务端能使用[SetInteracteCenterOffset](./行为.md#setinteractecenteroffset)修改玩家交互中心(服务端无第几人称概念)\r\n - 与SetCameraOffset不同的是,该接口改变的是相机的轨道的圆心位置。对第一人称和第三人称模式均生效,需要注意的是,改变后,鼠标或者触屏旋转,最终绕该圆心运动,不再绕玩家为中心。可以简单理解为,默认anchor为玩家中心。\r\n - 注意,设置后的效果不会存档\r\n - 注意,如果摄像头进入墙体里面会出现透视的情况,在联机模式时可能会破坏游戏的平衡,请谨慎使用", + "return": [], + "description": "设置相机锚点", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetCameraAnchor((0,1,0))", "params": [ { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "锚点偏移量" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetCameraAnchor((0,1,0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetCameraAnchor" + }, { - "type": "api", - "name": "SetCameraBindActorId", - "method": "", - "description": "将摄像机绑定到目标实体身上(调用者与目标必须在同一个dimension,同时需要在加载范围之内,若绑定后目标离开了范围或者死亡,则会自动解除绑定)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "", + "return": [], + "description": "将摄像机绑定到目标实体身上(调用者与目标必须在同一个dimension,同时需要在加载范围之内,若绑定后目标离开了范围或者死亡,则会自动解除绑定)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetCameraBindActorId('1234')", "params": [ { - "name": "targetId", - "type": "str", + "type": "str", + "name": "targetId", "description": "目标实体id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetCameraBindActorId('1234')" - }, + ], + "type": "api", + "side": "client", + "name": "SetCameraBindActorId" + }, { - "type": "api", - "name": "SetCameraDistanceFixed", - "method": "", - "description": "设置相机弹簧臂固定,即设置当相机遇到阻挡时是否压缩与人物之间的距离", - "remark": "- 注意,当设置为True时,如果摄像头进入墙体里面会出现透视的情况,在联机模式时可能会破坏游戏的平衡,请谨慎使用", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- 注意,当设置为True时,如果摄像头进入墙体里面会出现透视的情况,在联机模式时可能会破坏游戏的平衡,请谨慎使用", + "return": [], + "description": "设置相机弹簧臂固定,即设置当相机遇到阻挡时是否压缩与人物之间的距离", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetCameraDistanceFixed(True)", "params": [ { - "name": "isFixed", - "type": "bool", + "type": "bool", + "name": "isFixed", "description": "是否固定相机距离" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetCameraDistanceFixed(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetCameraDistanceFixed" + }, { - "type": "api", - "name": "SetCameraOffset", - "method": "", - "description": "设置摄像机偏移量", - "remark": "- 注意,该接口仅改变第三人称的相机(包括前视第三人称和后视第三人称)的偏移量,对第一人称模式下的相机无效。\r\n - 与SetCameraAnchor不同的是,该接口改变的是相机的位置偏移值,不会对相机轨道的圆心位置进行改变。\r\n - 注意,设置后的效果不会存档", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- 注意,该接口仅改变第三人称的相机(包括前视第三人称和后视第三人称)的偏移量,对第一人称模式下的相机无效。\r\n - 与SetCameraAnchor不同的是,该接口改变的是相机的位置偏移值,不会对相机轨道的圆心位置进行改变。\r\n - 注意,设置后的效果不会存档", + "return": [], + "description": "设置摄像机偏移量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetCameraOffset((1, 1, 1))", "params": [ { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "偏移量" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetCameraOffset((1, 1, 1))" - }, + ], + "type": "api", + "side": "client", + "name": "SetCameraOffset" + }, { - "type": "api", - "name": "SetCameraPitchLimit", - "method": "", - "description": "设置摄像机上下角度限制值,默认是(-90,90)", - "remark": "- 注意,设置后的效果不会存档", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- 注意,设置后的效果不会存档", + "return": [], + "description": "设置摄像机上下角度限制值,默认是(-90,90)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.DepartCamera()\r\ncomp.SetCameraPitchLimit((-30, 30))", "params": [ { - "name": "limit", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "limit", "description": "上下角度限制值" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.DepartCamera()\r\ncomp.SetCameraPitchLimit((-30, 30))" - }, + ], + "type": "api", + "side": "client", + "name": "SetCameraPitchLimit" + }, { - "type": "api", - "name": "SetCameraPos", - "method": "", - "description": "设置相机中心的位置", - "remark": "- 注意,设置后的效果不会存档", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- 注意,设置后的效果不会存档", + "return": [], + "description": "设置相机中心的位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetCameraPos((1, 1, 1))", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "位置" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetCameraPos((1, 1, 1))" - }, + ], + "type": "api", + "side": "client", + "name": "SetCameraPos" + }, { - "type": "api", - "name": "SetCameraRotation", - "method": "", - "description": "设定摄像机的朝向", - "remark": "- 与F3显示的相机调试信息的Pitch、Yaw相反。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- 与F3显示的相机调试信息的Pitch、Yaw相反。", + "return": [], + "description": "设定摄像机的朝向", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetCameraRotation((1, 1, 1))", "params": [ { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "朝向,其中3个值分别代表Pitch(俯仰角),Yaw(偏航角),Roll(翻滚角)的角度。如果传进来的tuple长度为2,则Roll(翻滚角)的角度默认为0。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetCameraRotation((1, 1, 1))" - }, + ], + "type": "api", + "side": "client", + "name": "SetCameraRotation" + }, { - "type": "api", - "name": "SetFov", - "method": "", - "description": "设置视野大小", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "", + "return": [], + "description": "设置视野大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetFov(60)", "params": [ { - "name": "fov", - "type": "float", + "type": "float", + "name": "fov", "description": "单位为角度, 范围为[30, 110],若fov小于30则设置为30,,若fov大于110,则设置为110." } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetFov(60)" - }, + ], + "type": "api", + "side": "client", + "name": "SetFov" + }, { - "type": "api", - "name": "SetPerspective", - "method": "", - "description": "设置视角模式", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "", + "return": [], + "description": "设置视角模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayerView(entityId)\r\ncomp.SetPerspective(1)", "params": [ { - "name": "persp", - "type": "int", + "type": "int", + "name": "persp", "description": "0:第一人称视角;1:第三人称视角;2:前视第三人称视角" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayerView(entityId)\r\ncomp.SetPerspective(1)" - }, + ], + "type": "api", + "side": "client", + "name": "SetPerspective" + }, { - "type": "api", - "name": "SetPlayerFovScale", - "method": "", - "description": "将渲染实际使用的fov变为设置中的fov乘以fovScale,fovScale越接近0,其效果越接近原版望远镜效果", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "", + "return": [], + "description": "将渲染实际使用的fov变为设置中的fov乘以fovScale,fovScale越接近0,其效果越接近原版望远镜效果", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)\r\nprint(comp.SetPlayerFovScale(0.5))", "params": [ { - "name": "fovScale", - "type": "float", + "type": "float", + "name": "fovScale", "description": "有效范围为[0,100]" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId)\r\nprint(comp.SetPlayerFovScale(0.5))" - }, + ], + "type": "api", + "side": "client", + "name": "SetPlayerFovScale" + }, { - "type": "api", - "name": "SetSpeedFovLock", - "method": "", - "description": "是否锁定相机视野fov,锁定后不随速度变化而变化", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "", + "return": [], + "description": "是否锁定相机视野fov,锁定后不随速度变化而变化", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetSpeedFovLock(True)", "params": [ { - "name": "isLocked", - "type": "bool", + "type": "bool", + "name": "isLocked", "description": "是否锁定" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.SetSpeedFovLock(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetSpeedFovLock" + }, { - "type": "api", - "name": "StartCameraMotion", - "method": "", - "description": "启动相机上的某个运动器", - "remark": "- 启动运动器后相机的位置朝向变化会同步更改player的朝向,若要避免修改,可以使用[DepartCamera](#DepartCamera)接口。\r\n - 相机第一人称模式下,屏幕会渲染出player的手臂,此时手臂位置与相机位置无关。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- 启动运动器后相机的位置朝向变化会同步更改player的朝向,若要避免修改,可以使用[DepartCamera](#DepartCamera)接口。\r\n - 相机第一人称模式下,屏幕会渲染出player的手臂,此时手臂位置与相机位置无关。", + "return": [], + "description": "启动相机上的某个运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.StartCameraMotion(mID)", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "要启动的某个运动器的ID" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.StartCameraMotion(mID)" - }, + ], + "type": "api", + "side": "client", + "name": "StartCameraMotion" + }, { - "type": "api", - "name": "StopCameraMotion", - "method": "", - "description": "停止相机上的某个运动器", - "remark": "- 调用该接口不会触发事件[CameraMotionStopClientEvent](../../事件/玩家.md#CameraMotionStopClientEvent)。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "remark": "- 调用该接口不会触发事件[CameraMotionStopClientEvent](../../事件/玩家.md#CameraMotionStopClientEvent)。", + "return": [], + "description": "停止相机上的某个运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.StopCameraMotion(mID)", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "要停止的某个运动器的ID" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.StopCameraMotion(mID)" - }, + ], + "type": "api", + "side": "client", + "name": "StopCameraMotion" + }, { - "type": "api", - "name": "UnDepartCamera", - "method": "", - "description": "绑定玩家与摄像机", - "remark": "- 绑定之后,只能看到玩家背部\r\n - 注意,使用后会默认解除视角移动锁定,效果等同\r\n comp.LockModCameraYaw(0) # 解除锁定左右视角\r\n comp.LockModCameraPitch(0) # 解除锁定上下视角", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.UnDepartCamera()" - }, + "remark": "- 绑定之后,只能看到玩家背部\r\n - 注意,使用后会默认解除视角移动锁定,效果等同\r\n comp.LockModCameraYaw(0) # 解除锁定左右视角\r\n comp.LockModCameraPitch(0) # 解除锁定上下视角", + "return": [], + "description": "绑定玩家与摄像机", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.UnDepartCamera()", + "params": [], + "type": "api", + "side": "client", + "name": "UnDepartCamera" + }, { - "type": "api", - "name": "UnLockCamera", - "method": "", - "description": "解除摄像机锁定", - "remark": "- 注意,使用后会默认解除视角移动锁定,效果等同\r\n comp.LockModCameraYaw(0) # 解除锁定左右视角\r\n comp.LockModCameraPitch(0) # 解除锁定上下视角", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.UnLockCamera()" - }, + "remark": "- 注意,使用后会默认解除视角移动锁定,效果等同\r\n comp.LockModCameraYaw(0) # 解除锁定左右视角\r\n comp.LockModCameraPitch(0) # 解除锁定上下视角", + "return": [], + "description": "解除摄像机锁定", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/摄像机.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateCamera(levelId)\r\ncomp.UnLockCamera()", + "params": [], + "type": "api", + "side": "client", + "name": "UnLockCamera" + }, { - "type": "api", - "name": "GetPlayerAbilities", - "method": "", - "description": "获取玩家具体权限", - "remark": "- 具体权限说明\r\n | 权限字段 | 数据类型 | 说明 |\r\n | --------| ---- |------|\r\n | build | bool | 放置方块 |\r\n | mine | bool | 采集方块 |\r\n | doorsandswitches | bool | 使用门和开关 |\r\n | opencontainers | bool | 打开容器 |\r\n | attackplayers | bool | 攻击玩家 |\r\n | attackmobs | bool | 攻击生物 |\r\n | op | bool | 操作员命令 |\r\n | teleport | bool | 使用传送 |\r\n - 返回值示例\r\n ```python\r\n {'teleport': True, 'opencontainers': True, 'mine': True, 'build': True, 'op': True, 'attackmobs': True, 'doorsandswitches': True, 'attackplayers': True}\r\n ```", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\noperation = comp.GetPlayerAbilities()" - }, + "remark": "- 具体权限说明\r\n | 权限字段 | 数据类型 | 说明 |\r\n | --------| ---- |------|\r\n | build | bool | 放置方块 |\r\n | mine | bool | 采集方块 |\r\n | doorsandswitches | bool | 使用门和开关 |\r\n | opencontainers | bool | 打开容器 |\r\n | attackplayers | bool | 攻击玩家 |\r\n | attackmobs | bool | 攻击生物 |\r\n | op | bool | 操作员命令 |\r\n | teleport | bool | 使用传送 |\r\n - 返回值示例\r\n ```python\r\n {'teleport': True, 'opencontainers': True, 'mine': True, 'build': True, 'op': True, 'attackmobs': True, 'doorsandswitches': True, 'attackplayers': True}\r\n ```", + "return": [], + "description": "获取玩家具体权限", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\noperation = comp.GetPlayerAbilities()", + "params": [], + "type": "api", + "side": "server", + "name": "GetPlayerAbilities" + }, { - "type": "api", - "name": "GetPlayerOperation", - "method": "", - "description": "获取玩家权限类型信息", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\noperation = comp.GetPlayerOperation()" - }, + "remark": "", + "return": [], + "description": "获取玩家权限类型信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\noperation = comp.GetPlayerOperation()", + "params": [], + "type": "api", + "side": "server", + "name": "GetPlayerOperation" + }, { - "type": "api", - "name": "SetAttackMobsAbility", - "method": "", - "description": "设置玩家能否攻击生物", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "remark": "", + "return": [], + "description": "设置玩家能否攻击生物", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetAttackMobsAbility(False)", "params": [ { - "name": "canAttack", - "type": "bool", + "type": "bool", + "name": "canAttack", "description": "能否攻击生物" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetAttackMobsAbility(False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetAttackMobsAbility" + }, { - "type": "api", - "name": "SetAttackPlayersAbility", - "method": "", - "description": "设置玩家能否攻击其他玩家", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "remark": "", + "return": [], + "description": "设置玩家能否攻击其他玩家", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetAttackPlayersAbility(False)", "params": [ { - "name": "canAttack", - "type": "bool", + "type": "bool", + "name": "canAttack", "description": "能否攻击其他玩家" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetAttackPlayersAbility(False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetAttackPlayersAbility" + }, { - "type": "api", - "name": "SetBuildAbility", - "method": "", - "description": "设置玩家能否放置方块,该接口的设置会存档,且只影响生存模式", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "remark": "", + "return": [], + "description": "设置玩家能否放置方块,该接口的设置会存档,且只影响生存模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetBuildAbility(False)", "params": [ { - "name": "canBuild", - "type": "bool", + "type": "bool", + "name": "canBuild", "description": "能否放置方块" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetBuildAbility(False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBuildAbility" + }, { - "type": "api", - "name": "SetMineAbility", - "method": "", - "description": "设置玩家能否摧毁方块,该接口的设置会存档,且只影响生存模式", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "remark": "", + "return": [], + "description": "设置玩家能否摧毁方块,该接口的设置会存档,且只影响生存模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetMineAbility(False)", "params": [ { - "name": "canMine", - "type": "bool", + "type": "bool", + "name": "canMine", "description": "能否摧毁方块" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetMineAbility(False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetMineAbility" + }, { - "type": "api", - "name": "SetOpenContainersAbility", - "method": "", - "description": "设置玩家能否打开容器", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "remark": "", + "return": [], + "description": "设置玩家能否打开容器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetOpenContainersAbility(False)", "params": [ { - "name": "canOpen", - "type": "bool", + "type": "bool", + "name": "canOpen", "description": "能否打开容器" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetOpenContainersAbility(False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetOpenContainersAbility" + }, { - "type": "api", - "name": "SetOperateDoorsAndSwitchesAbility", - "method": "", - "description": "设置玩家能否与门和开关交互", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "remark": "", + "return": [], + "description": "设置玩家能否与门和开关交互", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetOperateDoorsAndSwitchesAbility(False)", "params": [ { - "name": "canOperate", - "type": "bool", + "type": "bool", + "name": "canOperate", "description": "能否与门和开关交互" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetOperateDoorsAndSwitchesAbility(False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetOperateDoorsAndSwitchesAbility" + }, { - "type": "api", - "name": "SetOperatorCommandAbility", - "method": "", - "description": "设置玩家是否具有操作员命令权限", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "remark": "", + "return": [], + "description": "设置玩家是否具有操作员命令权限", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetOperatorCommandAbility(False)", "params": [ { - "name": "canOperate", - "type": "bool", + "type": "bool", + "name": "canOperate", "description": "是否能发送操作员命令" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetOperatorCommandAbility(False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetOperatorCommandAbility" + }, { - "type": "api", - "name": "SetPermissionLevel", - "method": "", - "description": "设置玩家权限等级", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "remark": "", + "return": [], + "description": "设置玩家权限等级", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPermissionLevel(3)", "params": [ { - "name": "level", - "type": "int", + "type": "int", + "name": "level", "description": "权限等级,0为访客、1为成员、2为操作员、3为自定义" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPermissionLevel(3)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPermissionLevel" + }, { - "type": "api", - "name": "SetPlayerMute", - "method": "", - "description": "设置玩家是否禁言,该接口的设置不存档", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "remark": "", + "return": [], + "description": "设置玩家是否禁言,该接口的设置不存档", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerMute(True)", "params": [ { - "name": "isMute", - "type": "bool", + "type": "bool", + "name": "isMute", "description": "是否禁言" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerMute(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerMute" + }, { - "type": "api", - "name": "SetTeleportAbility", - "method": "", - "description": "设置玩家能否使用TP指令", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "remark": "", + "return": [], + "description": "设置玩家能否使用TP指令", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/权限.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetTeleportAbility(False)", "params": [ { - "name": "canTeleport", - "type": "bool", + "type": "bool", + "name": "canTeleport", "description": "能否使用TP指令" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetTeleportAbility(False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetTeleportAbility" + }, { - "type": "api", - "name": "AddPlayerAnimation", - "method": "", - "description": "增加玩家渲染动画", - "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍\r\n - 该接口的animationName参数不能传入带有大写字母的字符串,否则动画将注册失败。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍\r\n - 该接口的animationName参数不能传入带有大写字母的字符串,否则动画将注册失败。", + "return": [], + "description": "增加玩家渲染动画", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerAnimation(\"move.arms\", \"animation.player.move.arms_custom\")", "params": [ { - "name": "animationKey", - "type": "str", + "type": "str", + "name": "animationKey", "description": "动画键" - }, + }, { - "name": "animationName", - "type": "str", + "type": "str", + "name": "animationName", "description": "动画名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerAnimation(\"move.arms\", \"animation.player.move.arms_custom\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddPlayerAnimation" + }, { - "type": "api", - "name": "AddPlayerAnimationController", - "method": "", - "description": "增加玩家渲染动画控制器", - "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", + "return": [], + "description": "增加玩家渲染动画控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerAnimationController(\"root\", \"controller.animation.player.root_custom\")", "params": [ { - "name": "animationControllerKey", - "type": "str", + "type": "str", + "name": "animationControllerKey", "description": "动画控制器键" - }, + }, { - "name": "animationControllerName", - "type": "str", + "type": "str", + "name": "animationControllerName", "description": "动画控制器名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerAnimationController(\"root\", \"controller.animation.player.root_custom\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddPlayerAnimationController" + }, { - "type": "api", - "name": "AddPlayerAnimationIntoState", - "method": "", - "description": "在玩家的动画控制器中的状态添加动画或者动画控制器", - "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", + "return": [], + "description": "在玩家的动画控制器中的状态添加动画或者动画控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerAnimationIntoState(\"root\", \"first_person\", \"first_person_attack_controller_new\", \"query.mod.index > 0\")", "params": [ { - "name": "animationControllerName", - "type": "str", + "type": "str", + "name": "animationControllerName", "description": "动画控制器名称,如root(controller.animation.player.root)" - }, + }, { - "name": "stateName", - "type": "str", + "type": "str", + "name": "stateName", "description": "动画状态名称,如first_person" - }, + }, { - "name": "animationName", - "type": "str", + "type": "str", + "name": "animationName", "description": "添加的动画名称或动画控制器名称,如first_person_attack_controller_new" - }, + }, { - "name": "condition", - "type": "str", + "type": "str", + "name": "condition", "description": "动画控制表达式,默认为空,如query.mod.index > 0" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerAnimationIntoState(\"root\", \"first_person\", \"first_person_attack_controller_new\", \"query.mod.index > 0\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddPlayerAnimationIntoState" + }, { - "type": "api", - "name": "AddPlayerGeometry", - "method": "", - "description": "增加玩家渲染几何体", - "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", + "return": [], + "description": "增加玩家渲染几何体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerGeometry(\"default\", \"geometry.player.custom\")", "params": [ { - "name": "geometryKey", - "type": "str", + "type": "str", + "name": "geometryKey", "description": "渲染几何体键,如玩家默认几何体default" - }, + }, { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "渲染几何体名称,如玩家默认几何体geometry.humanoid.custom" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerGeometry(\"default\", \"geometry.player.custom\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddPlayerGeometry" + }, { - "type": "api", - "name": "AddPlayerParticleEffect", - "method": "", - "description": "增加玩家特效资源", - "remark": "- 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", + "return": [], + "description": "增加玩家特效资源", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerParticleEffect(\"nectar_dripping\", \"minecraft:nectar_drip_particle\")", "params": [ { - "name": "effectKey", - "type": "str", + "type": "str", + "name": "effectKey", "description": "特效资源Key,如bee.entity.json中的nectar_dripping" - }, + }, { - "name": "effectName", - "type": "str", + "type": "str", + "name": "effectName", "description": "特效资源名称,如minecraft:nectar_drip_particle" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerParticleEffect(\"nectar_dripping\", \"minecraft:nectar_drip_particle\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddPlayerParticleEffect" + }, { - "type": "api", - "name": "AddPlayerRenderController", - "method": "", - "description": "增加玩家渲染控制器", - "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", + "return": [], + "description": "增加玩家渲染控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerRenderController('custom_render_controller_name', 'query.mod.condition')", "params": [ { - "name": "renderControllerName", - "type": "str", + "type": "str", + "name": "renderControllerName", "description": "渲染控制器名称" - }, + }, { - "name": "condition", - "type": "str", + "type": "str", + "name": "condition", "description": "渲染控制器条件" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerRenderController('custom_render_controller_name', 'query.mod.condition')" - }, + ], + "type": "api", + "side": "client", + "name": "AddPlayerRenderController" + }, { - "type": "api", - "name": "AddPlayerRenderMaterial", - "method": "", - "description": "增加玩家渲染需要的材质", - "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", + "return": [], + "description": "增加玩家渲染需要的材质", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerRenderMaterial('custom_material_key', 'custom_material_name')", "params": [ { - "name": "materialKey", - "type": "str", + "type": "str", + "name": "materialKey", "description": "材质key" - }, + }, { - "name": "materialName", - "type": "str", + "type": "str", + "name": "materialName", "description": "材质名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerRenderMaterial('custom_material_key', 'custom_material_name')" - }, + ], + "type": "api", + "side": "client", + "name": "AddPlayerRenderMaterial" + }, { - "type": "api", - "name": "AddPlayerScriptAnimate", - "method": "", - "description": "在玩家的客户端实体定义(minecraft:client_entity)json中的scripts/animate节点添加动画/动画控制器", - "remark": "- 该接口只对CreateActorRender时传入的playerId起效果", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 该接口只对CreateActorRender时传入的playerId起效果", + "return": [], + "description": "在玩家的客户端实体定义(minecraft:client_entity)json中的scripts/animate节点添加动画/动画控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerAnimationController(\"animation_controller_short_name\", \"controller.animation.player.root_custom\")\r\ncomp.AddPlayerScriptAnimate(\"animation_controller_short_name\", \"query.mod.index > 0\")", "params": [ { - "name": "animateName", - "type": "str", + "type": "str", + "name": "animateName", "description": "动画/动画控制器名称,如look_at_target" - }, + }, { - "name": "condition", - "type": "str", + "type": "str", + "name": "condition", "description": "动画/动画控制器控制表达式,默认为空,如query.mod.index > 0" - }, + }, { - "name": "autoReplace", - "type": "bool", + "type": "bool", + "name": "autoReplace", "description": "是否覆盖已存在的动画/动画控制器,默认值为False" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerAnimationController(\"animation_controller_short_name\", \"controller.animation.player.root_custom\")\r\ncomp.AddPlayerScriptAnimate(\"animation_controller_short_name\", \"query.mod.index > 0\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddPlayerScriptAnimate" + }, { - "type": "api", - "name": "AddPlayerSoundEffect", - "method": "", - "description": "增加玩家音效资源", - "remark": "- 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍\r\n - 音效在RP/entities/player.entity.json # minecraft:client_entity / description中的定义如下:\r\n \"sound_effects\": {\r\n \"sound_thunder\": \"ambient.weather.thunder\" # ambient.weather.thunder是sound_definitions中定义\r\n }\r\n 如果在动作中同步播放音频,可以在RP/animations/player.animation_controllers.json # animation_controllers / controller.animation.player.root中定义如下:\r\n \"dripping\": {\r\n \"sound_effects\": [\r\n {\r\n \"effect\": \"sound_thunder\"\r\n }\r\n ],\r\n \"transitions\": [\r\n {\r\n \"third_person\": \"!query.mod.is_powered\"\r\n }\r\n ]\r\n },", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍\r\n - 音效在RP/entities/player.entity.json # minecraft:client_entity / description中的定义如下:\r\n \"sound_effects\": {\r\n \"sound_thunder\": \"ambient.weather.thunder\" # ambient.weather.thunder是sound_definitions中定义\r\n }\r\n 如果在动作中同步播放音频,可以在RP/animations/player.animation_controllers.json # animation_controllers / controller.animation.player.root中定义如下:\r\n \"dripping\": {\r\n \"sound_effects\": [\r\n {\r\n \"effect\": \"sound_thunder\"\r\n }\r\n ],\r\n \"transitions\": [\r\n {\r\n \"third_person\": \"!query.mod.is_powered\"\r\n }\r\n ]\r\n },", + "return": [], + "description": "增加玩家音效资源", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerSoundEffect(\"sound_thunder\", \"ambient.weather.thunder\")", "params": [ { - "name": "soundKey", - "type": "str", + "type": "str", + "name": "soundKey", "description": "音效资源Key" - }, + }, { - "name": "soundName", - "type": "str", + "type": "str", + "name": "soundName", "description": "音效资源名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerSoundEffect(\"sound_thunder\", \"ambient.weather.thunder\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddPlayerSoundEffect" + }, { - "type": "api", - "name": "AddPlayerTexture", - "method": "", - "description": "增加玩家渲染贴图", - "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", + "return": [], + "description": "增加玩家渲染贴图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerTexture(\"default\", \"textures/misc/missing_texture\")", "params": [ { - "name": "geometryKey", - "type": "str", + "type": "str", + "name": "geometryKey", "description": "贴图键" - }, + }, { - "name": "geometryName", - "type": "str", + "type": "str", + "name": "geometryName", "description": "贴图路径" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.AddPlayerTexture(\"default\", \"textures/misc/missing_texture\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddPlayerTexture" + }, { - "type": "api", - "name": "RebuildPlayerRender", - "method": "", - "description": "重建玩家的数据渲染器", - "remark": "- 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.RebuildPlayerRender()" - }, + "remark": "- 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", + "return": [], + "description": "重建玩家的数据渲染器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.RebuildPlayerRender()", + "params": [], + "type": "api", + "side": "client", + "name": "RebuildPlayerRender" + }, { - "type": "api", - "name": "RemovePlayerAnimationController", - "method": "", - "description": "移除玩家渲染动画控制器", - "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", + "return": [], + "description": "移除玩家渲染动画控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.RemovePlayerAnimationController(\"root\")", "params": [ { - "name": "animationControllKey", - "type": "str", + "type": "str", + "name": "animationControllKey", "description": "动画控制器键" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.RemovePlayerAnimationController(\"root\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemovePlayerAnimationController" + }, { - "type": "api", - "name": "RemovePlayerGeometry", - "method": "", - "description": "删除玩家渲染几何体", - "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", + "return": [], + "description": "删除玩家渲染几何体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# geometry definition in player.entity.json\r\n\"geometry\": {\r\n \"default\": \"geometry.humanoid.custom\",\r\n \"cape\": \"geometry.cape\"\r\n}\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.RemovePlayerGeometry(\"default\")", "params": [ { - "name": "geometryKey", - "type": "str", + "type": "str", + "name": "geometryKey", "description": "渲染几何体名称键,如玩家默认几何体default" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# geometry definition in player.entity.json\r\n\"geometry\": {\r\n \"default\": \"geometry.humanoid.custom\",\r\n \"cape\": \"geometry.cape\"\r\n}\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.RemovePlayerGeometry(\"default\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemovePlayerGeometry" + }, { - "type": "api", - "name": "RemovePlayerRenderController", - "method": "", - "description": "删除玩家渲染控制器", - "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 调用该接口后需要调用RebuildPlayerRender才会生效\r\n - 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍", + "return": [], + "description": "删除玩家渲染控制器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.RemovePlayerRenderController('custom_render_controller_name')", "params": [ { - "name": "renderControllerName", - "type": "str", + "type": "str", + "name": "renderControllerName", "description": "渲染控制器名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\ncomp.RemovePlayerRenderController('custom_render_controller_name')" - }, + ], + "type": "api", + "side": "client", + "name": "RemovePlayerRenderController" + }, { - "type": "api", - "name": "ResetSkin", - "method": "", - "description": "还原默认皮肤", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "", + "return": [], + "description": "还原默认皮肤", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateModel(playerId)\r\ncomp.ResetSkin()", "params": [ { - "name": "isSteve", - "type": "bool", + "type": "bool", + "name": "isSteve", "description": "是否还原成Steve默认皮肤, 默认为True。当isSteve为False时,则还原成资源中心中购买并穿戴的皮肤" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateModel(playerId)\r\ncomp.ResetSkin()" - }, + ], + "type": "api", + "side": "client", + "name": "ResetSkin" + }, { - "type": "api", - "name": "SetPlayerItemInHandVisible", - "method": "", - "description": "设置是否隐藏玩家的手持物品模型显示", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "", + "return": [], + "description": "设置是否隐藏玩家的手持物品模型显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\n# 隐藏指定玩家的手持物品模型显示\r\nprint actorRenderComp.SetPlayerItemInHandVisible(False, 0)", "params": [ { - "name": "visible", - "type": "bool", + "type": "bool", + "name": "visible", "description": "设置是否显示或隐藏,True表示显示,False表示隐藏" - }, + }, { - "name": "mode", - "type": "int", + "type": "int", + "name": "mode", "description": "设置隐藏手持物品在哪一个视角模式生效。mode=0时,表示第一人称和第三人称下均隐藏手持物品;mode=1时表示仅隐藏第三人称下的手持物品;mode=2时表示仅隐藏第一人称下的手持物品。默认值为0。填入0,1,2以外的数值会被强制设置为0" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nactorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)\r\n# 隐藏指定玩家的手持物品模型显示\r\nprint actorRenderComp.SetPlayerItemInHandVisible(False, 0)" - }, + ], + "type": "api", + "side": "client", + "name": "SetPlayerItemInHandVisible" + }, { - "type": "api", - "name": "SetSkin", - "method": "", - "description": "更换原版自定义皮肤", - "remark": "- 会覆盖原有皮肤(包括4d皮肤)。但会被骨骼模型覆盖\r\n - 只能修改Steve模型的皮肤,不能修改Alex模型的皮肤", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "remark": "- 会覆盖原有皮肤(包括4d皮肤)。但会被骨骼模型覆盖\r\n - 只能修改Steve模型的皮肤,不能修改Alex模型的皮肤", + "return": [], + "description": "更换原版自定义皮肤", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/渲染.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateModel(playerId)\r\ncomp.SetSkin(\"kagura\")", "params": [ { - "name": "skin", - "type": "str", + "type": "str", + "name": "skin", "description": "贴图路径,以textures\\models为当前路径的相对路径" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateModel(playerId)\r\ncomp.SetSkin(\"kagura\")" - }, + ], + "type": "api", + "side": "client", + "name": "SetSkin" + }, { - "type": "api", - "name": "GetPlayerGameType", - "method": "", - "description": "获取指定玩家的游戏模式", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/游戏模式.md", + "remark": "", + "return": [], + "description": "获取指定玩家的游戏模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/游戏模式.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ngameType = comp.GetPlayerGameType(playerId)", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ngameType = comp.GetPlayerGameType(playerId)" - }, + ], + "type": "api", + "side": "client", + "name": "GetPlayerGameType" + }, { - "type": "api", - "name": "SetPlayerGameType", - "method": "", - "description": "设置玩家个人游戏模式", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/游戏模式.md", + "remark": "", + "return": [], + "description": "设置玩家个人游戏模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/游戏模式.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerGameType(serverApi.GetMinecraftEnum().GameType.Survival)", "params": [ { - "name": "gameType", - "type": "int", + "type": "int", + "name": "gameType", "description": "[GameType枚举](../../枚举值/GameType.md)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerGameType(serverApi.GetMinecraftEnum().GameType.Survival)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerGameType" + }, { - "type": "api", - "name": "AddEnchantToInvItem", - "method": "", - "description": "给物品栏的物品添加附魔信息", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "给物品栏的物品添加附魔信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.AddEnchantToInvItem(0, serverApi.GetMinecraftEnum().EnchantType.BowDamage, 2)", "params": [ { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "物品栏槽位" - }, + }, { - "name": "enchantType", - "type": "int", + "type": "int", + "name": "enchantType", "description": "附魔类型,可以查看枚举值文档" - }, + }, { - "name": "level", - "type": "int", + "type": "int", + "name": "level", "description": "附魔等级" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.AddEnchantToInvItem(0, serverApi.GetMinecraftEnum().EnchantType.BowDamage, 2)" - }, + ], + "type": "api", + "side": "server", + "name": "AddEnchantToInvItem" + }, { - "type": "api", - "name": "AddModEnchantToInvItem", - "method": "", - "description": "给物品栏中物品添加自定义附魔信息", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "给物品栏中物品添加自定义附魔信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.AddModEnchantToInvItem(0, \"customenchant\", 2)", "params": [ { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "物品栏槽位" - }, + }, { - "name": "modEnchantId", - "type": "str", + "type": "str", + "name": "modEnchantId", "description": "自定义附魔identifier" - }, + }, { - "name": "level", - "type": "int", + "type": "int", + "name": "level", "description": "自定义附魔等级" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.AddModEnchantToInvItem(0, \"customenchant\", 2)" - }, + ], + "type": "api", + "side": "server", + "name": "AddModEnchantToInvItem" + }, { - "type": "api", - "name": "ChangePlayerItemTipsAndExtraId", - "method": "", - "description": "修改玩家物品的自定义tips和自定义标识符", - "remark": "- 该接口不支持设置盔甲栏。\r\n - 建议使用GetEntityItem,SetEntityItem代替该接口:\r\n import mod.server.extraServerApi as serverApi\r\n comp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\n itemDict = comp.GetEntityItem(serverApi.GetMinecraftEnum().ItemPosType.ARMOR, 0, True)\r\n itemDict['customTips'] = 'xxx'\r\n itemDict['extraId'] = 'yyy'\r\n comp.SetEntityItem(serverApi.GetMinecraftEnum().ItemPosType.ARMOR, itemDict, 0)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "- 该接口不支持设置盔甲栏。\r\n - 建议使用GetEntityItem,SetEntityItem代替该接口:\r\n import mod.server.extraServerApi as serverApi\r\n comp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\n itemDict = comp.GetEntityItem(serverApi.GetMinecraftEnum().ItemPosType.ARMOR, 0, True)\r\n itemDict['customTips'] = 'xxx'\r\n itemDict['extraId'] = 'yyy'\r\n comp.SetEntityItem(serverApi.GetMinecraftEnum().ItemPosType.ARMOR, itemDict, 0)", + "return": [], + "description": "修改玩家物品的自定义tips和自定义标识符", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.ChangePlayerItemTipsAndExtraId(serverApi.GetMinecraftEnum().ItemPosType.INVENTORY, 0, \"自定义tips\", \"自定义标识符\")", "params": [ { - "name": "posType", - "type": "int", + "type": "int", + "name": "posType", "description": "[ItemPosType枚举](../../枚举值/ItemPosType.md)" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "物品栏槽位" - }, + }, { - "name": "customTips", - "type": "str", + "type": "str", + "name": "customTips", "description": "物品的自定义tips" - }, + }, { - "name": "extraId", - "type": "str", + "type": "str", + "name": "extraId", "description": "物品的自定义标识符" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.ChangePlayerItemTipsAndExtraId(serverApi.GetMinecraftEnum().ItemPosType.INVENTORY, 0, \"自定义tips\", \"自定义标识符\")" - }, + ], + "type": "api", + "side": "server", + "name": "ChangePlayerItemTipsAndExtraId" + }, { - "type": "api", - "name": "ChangeSelectSlot", - "method": "", - "description": "设置玩家当前选中快捷栏物品的index", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "设置玩家当前选中快捷栏物品的index", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\nsuccess = comp.ChangeSelectSlot(0)", "params": [ { - "name": "slot", - "type": "int", + "type": "int", + "name": "slot", "description": "快捷栏物品的index,从0开始,最大为8" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\nsuccess = comp.ChangeSelectSlot(0)" - }, + ], + "type": "api", + "side": "server", + "name": "ChangeSelectSlot" + }, { - "type": "api", - "name": "GetCarriedItem", - "method": "", - "description": "获取右手物品的信息", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "获取右手物品的信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(entityId)\r\ncarriedData = comp.GetCarriedItem()", "params": [ { - "name": "getUserData", - "type": "bool", + "type": "bool", + "name": "getUserData", "description": "是否获取物品的userData,默认为False" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(entityId)\r\ncarriedData = comp.GetCarriedItem()" - }, + ], + "type": "api", + "side": "client", + "name": "GetCarriedItem" + }, { - "type": "api", - "name": "GetInvItemEnchantData", - "method": "", - "description": "获取物品栏的物品附魔信息", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "获取物品栏的物品附魔信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetInvItemEnchantData(0)", "params": [ { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "物品栏槽位" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetInvItemEnchantData(0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetInvItemEnchantData" + }, { - "type": "api", - "name": "GetInvItemModEnchantData", - "method": "", - "description": "获取物品栏的物品自定义附魔信息", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "获取物品栏的物品自定义附魔信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetInvItemModEnchantData(0)", "params": [ { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "物品栏槽位" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetInvItemModEnchantData(0)" - }, + ], + "type": "api", + "side": "server", + "name": "GetInvItemModEnchantData" + }, { - "type": "api", - "name": "GetOffhandItem", - "method": "", - "description": "获取左手物品的信息", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "获取左手物品的信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(entityId)\r\noffhandData = comp.GetOffhandItem()", "params": [ { - "name": "getUserData", - "type": "bool", + "type": "bool", + "name": "getUserData", "description": "是否获取物品的userData,默认为False" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(entityId)\r\noffhandData = comp.GetOffhandItem()" - }, + ], + "type": "api", + "side": "client", + "name": "GetOffhandItem" + }, { - "type": "api", - "name": "GetPlayerAllItems", - "method": "", - "description": "获取玩家指定的槽位的批量物品信息,支持获取盔甲栏,副手以及主手物品,背包物品仅支持本地玩家", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "获取玩家指定的槽位的批量物品信息,支持获取盔甲栏,副手以及主手物品,背包物品仅支持本地玩家", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetPlayerAllItems(clientApi.GetMinecraftEnum().ItemPosType.INVENTORY)", "params": [ { - "name": "posType", - "type": "int", + "type": "int", + "name": "posType", "description": "[ItemPosType枚举](../../枚举值/ItemPosType.md)" - }, + }, { - "name": "getUserData", - "type": "bool", + "type": "bool", + "name": "getUserData", "description": "是否获取userData,默认为False" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetPlayerAllItems(clientApi.GetMinecraftEnum().ItemPosType.INVENTORY)" - }, + ], + "type": "api", + "side": "client", + "name": "GetPlayerAllItems" + }, { - "type": "api", - "name": "GetPlayerItem", - "method": "", - "description": "获取玩家物品,支持获取背包(本地玩家),盔甲栏,副手以及主手物品", - "remark": "- 客户端不支持获取其他玩家的背包物品", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "- 客户端不支持获取其他玩家的背包物品", + "return": [], + "description": "获取玩家物品,支持获取背包(本地玩家),盔甲栏,副手以及主手物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetPlayerItem(clientApi.GetMinecraftEnum().ItemPosType.INVENTORY, 0)", "params": [ { - "name": "posType", - "type": "int", + "type": "int", + "name": "posType", "description": "[ItemPosType枚举](../../枚举值/ItemPosType.md)" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "槽位,获取INVENTORY及ARMOR时需要设置,其他情况写0即可" - }, + }, { - "name": "getUserData", - "type": "bool", + "type": "bool", + "name": "getUserData", "description": "是否获取userData,默认为False" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetPlayerItem(clientApi.GetMinecraftEnum().ItemPosType.INVENTORY, 0)" - }, + ], + "type": "api", + "side": "client", + "name": "GetPlayerItem" + }, { - "type": "api", - "name": "GetSelectSlotId", - "method": "", - "description": "获取玩家当前选中槽位", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetSelectSlotId()" - }, + "remark": "", + "return": [], + "description": "获取玩家当前选中槽位", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.GetSelectSlotId()", + "params": [], + "type": "api", + "side": "server", + "name": "GetSelectSlotId" + }, { - "type": "api", - "name": "GetSlotId", - "method": "", - "description": "获取当前手持的快捷栏的槽id", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(entityId)\r\nslotId = comp.GetSlotId()" - }, + "remark": "", + "return": [], + "description": "获取当前手持的快捷栏的槽id", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateItem(entityId)\r\nslotId = comp.GetSlotId()", + "params": [], + "type": "api", + "side": "client", + "name": "GetSlotId" + }, { - "type": "api", - "name": "RemoveEnchantToInvItem", - "method": "", - "description": "给物品栏的物品移除附魔信息", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "给物品栏的物品移除附魔信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.RemoveEnchantToInvItem(0, serverApi.GetMinecraftEnum().EnchantType.BowDamage)", "params": [ { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "物品栏槽位" - }, + }, { - "name": "enchantType", - "type": "int", + "type": "int", + "name": "enchantType", "description": "附魔类型,可以查看枚举值文档" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.RemoveEnchantToInvItem(0, serverApi.GetMinecraftEnum().EnchantType.BowDamage)" - }, + ], + "type": "api", + "side": "server", + "name": "RemoveEnchantToInvItem" + }, { - "type": "api", - "name": "RemoveModEnchantToInvItem", - "method": "", - "description": "给物品栏中物品移除自定义附魔信息", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "给物品栏中物品移除自定义附魔信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.RemoveModEnchantToInvItem(0, \"customenchant\")", "params": [ { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "物品栏槽位" - }, + }, { - "name": "modEnchantId", - "type": "str", + "type": "str", + "name": "modEnchantId", "description": "自定义附魔identifier" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.RemoveModEnchantToInvItem(0, \"customenchant\")" - }, + ], + "type": "api", + "side": "server", + "name": "RemoveModEnchantToInvItem" + }, { - "type": "api", - "name": "SetInvItemExchange", - "method": "", - "description": "交换玩家背包物品", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "交换玩家背包物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.SetInvItemExchange(0, 2)", "params": [ { - "name": "pos1", - "type": "int", + "type": "int", + "name": "pos1", "description": "物品位置" - }, + }, { - "name": "pos2", - "type": "int", + "type": "int", + "name": "pos2", "description": "物品位置" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.SetInvItemExchange(0, 2)" - }, + ], + "type": "api", + "side": "server", + "name": "SetInvItemExchange" + }, { - "type": "api", - "name": "SetInvItemNum", - "method": "", - "description": "设置玩家背包物品数目", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "设置玩家背包物品数目", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.SetInvItemNum(0, 10)", "params": [ { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "物品栏槽位" - }, + }, { - "name": "num", - "type": "int", + "type": "int", + "name": "num", "description": "物品数目,可以通过设置数量为0来达到清除背包物品的效果" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.SetInvItemNum(0, 10)" - }, + ], + "type": "api", + "side": "server", + "name": "SetInvItemNum" + }, { - "type": "api", - "name": "SetPlayerAllItems", - "method": "", - "description": "添加批量物品信息到指定槽位", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "添加批量物品信息到指定槽位", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\nitemsDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { },\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\nitemsDictMap = {}\r\nfor i in xrange(36):\r\n if i % 3 == 0:\r\n itemsDictMap[(minecraftEnum.ItemPosType.INVENTORY, i)] = itemsDict\r\nitemsDictMap[(minecraftEnum.ItemPosType.CARRIED, 0)] = itemsDict\r\nitemsDictMap[(minecraftEnum.ItemPosType.OFFHAND, 0)] = itemsDict\r\ncomp.SetPlayerAllItems(itemsDictMap)", "params": [ { - "name": "itemsDictMap", - "type": "dict", + "type": "dict", + "name": "itemsDictMap", "description": "需要添加的物品的字典,字典的key是tuple([ItemPosType](../../枚举值/ItemPosType.md), slotPos),value是需要添加的物品信息字典" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nitemsDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { },\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\nitemsDictMap = {}\r\nfor i in xrange(36):\r\n if i % 3 == 0:\r\n itemsDictMap[(minecraftEnum.ItemPosType.INVENTORY, i)] = itemsDict\r\nitemsDictMap[(minecraftEnum.ItemPosType.CARRIED, 0)] = itemsDict\r\nitemsDictMap[(minecraftEnum.ItemPosType.OFFHAND, 0)] = itemsDict\r\ncomp.SetPlayerAllItems(itemsDictMap)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerAllItems" + }, { - "type": "api", - "name": "SpawnItemToPlayerCarried", - "method": "", - "description": "生成物品到玩家右手", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "", + "return": [], + "description": "生成物品到玩家右手", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { },\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.SpawnItemToPlayerCarried(itemDict, playerId)", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { },\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.SpawnItemToPlayerCarried(itemDict, playerId)" - }, + ], + "type": "api", + "side": "server", + "name": "SpawnItemToPlayerCarried" + }, { - "type": "api", - "name": "SpawnItemToPlayerInv", - "method": "", - "description": "生成物品到玩家背包", - "remark": "- 当slotPos不设置时,当设置的数量超过单个槽位堆叠的上限时,会将多余的物品设置到另外的空闲槽位.如果生成的物品与背包中有的槽位的物品种类一致,该接口也会将物品增加到这些槽位中。注意:如果背包中剩余的物品数目和增加的物品数目之和大于64,则会生成物品数目到64,但是接口返回失败。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "remark": "- 当slotPos不设置时,当设置的数量超过单个槽位堆叠的上限时,会将多余的物品设置到另外的空闲槽位.如果生成的物品与背包中有的槽位的物品种类一致,该接口也会将物品增加到这些槽位中。注意:如果背包中剩余的物品数目和增加的物品数目之和大于64,则会生成物品数目到64,但是接口返回失败。", + "return": [], + "description": "生成物品到玩家背包", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/背包.md", + "example": "import mod.server.extraServerApi as serverApi\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { },\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.SpawnItemToPlayerInv(itemDict, playerId, 0)", "params": [ { - "name": "itemDict", - "type": "dict", + "type": "dict", + "name": "itemDict", "description": "物品信息字典" - }, + }, { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "背包槽位(可选)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nitemDict = {\r\n 'itemName': 'minecraft:bow',\r\n 'count': 1,\r\n 'enchantData': [(serverApi.GetMinecraftEnum().EnchantType.BowDamage, 1),],\r\n 'auxValue': 0,\r\n 'customTips':'§c new item §r',\r\n 'extraId': 'abc',\r\n 'userData': { },\r\n}\r\ncomp = serverApi.GetEngineCompFactory().CreateItem(playerId)\r\ncomp.SpawnItemToPlayerInv(itemDict, playerId, 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SpawnItemToPlayerInv" + }, { - "type": "api", - "name": "AddPlayerAroundEntityMotion", - "method": "", - "description": "给玩家添加对实体环绕运动器", - "remark": "- 该接口会在客户端和服务端同步进行,使用前请确保环绕的对象在客户端和服务端都已创建。\r\n - 该接口不屏蔽玩家控制的移动以及重力作用,当有玩家控制发生时,最终的表现结果可能与预期有差异。由于玩家的头部与相机控制相关,若需要使运动器控制玩家的头部,请使用[DepartCamera](./摄像机.md#DepartCamera)分离玩家与摄像机。\r\n - 环绕运动器可叠加多个,且可与速度运动器互相叠加,每一帧的最终效果为各个运动器计算出的瞬时向量之和。\r\n - 由于引擎中有加载的区块限制以及客户端对实体管理进行了优化,建议将玩家与目标之间的半径控制在30以内。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 该接口会在客户端和服务端同步进行,使用前请确保环绕的对象在客户端和服务端都已创建。\r\n - 该接口不屏蔽玩家控制的移动以及重力作用,当有玩家控制发生时,最终的表现结果可能与预期有差异。由于玩家的头部与相机控制相关,若需要使运动器控制玩家的头部,请使用[DepartCamera](./摄像机.md#DepartCamera)分离玩家与摄像机。\r\n - 环绕运动器可叠加多个,且可与速度运动器互相叠加,每一帧的最终效果为各个运动器计算出的瞬时向量之和。\r\n - 由于引擎中有加载的区块限制以及客户端对实体管理进行了优化,建议将玩家与目标之间的半径控制在30以内。", + "return": [], + "description": "给玩家添加对实体环绕运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\naxis=(-1, 1, 1)\r\nmID = motionComp.AddPlayerAroundEntityMotion(eID, 1.0, axis, lockDir=False, stopRad=0, radius=2.0)\r\n#启动该运动器\r\nmotionComp.StartPlayerMotion(mID)", "params": [ { - "name": "eID", - "type": "str", + "type": "str", + "name": "eID", "description": "要环绕的某个实体的ID" - }, + }, { - "name": "angularVelocity", - "type": "float", + "type": "float", + "name": "angularVelocity", "description": "圆周运动的角速度(弧度/秒)" - }, + }, { - "name": "axis", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "axis", "description": "圆周运动的轴,决定了在哪个平面上做圆周运动,默认为(0, 1, 0)" - }, + }, { - "name": "lockDir", - "type": "bool", + "type": "bool", + "name": "lockDir", "description": "是否在运动器生效时锁定实体的朝向,不锁定则实体的朝向会随着运动而改变,默认为False。" - }, + }, { - "name": "stopRad", - "type": "float", + "type": "float", + "name": "stopRad", "description": "停止该运动器所需要的弧度,当stopRad为0时,该运动器会一直运行,默认为0" - }, + }, { - "name": "radius", - "type": "float", + "type": "float", + "name": "radius", "description": "环绕半径,当设置为-1时环绕运动器使用当前与目标的距离作为半径,当设置为非负数时表示按设定的值作为环绕半径,默认为-1" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\naxis=(-1, 1, 1)\r\nmID = motionComp.AddPlayerAroundEntityMotion(eID, 1.0, axis, lockDir=False, stopRad=0, radius=2.0)\r\n#启动该运动器\r\nmotionComp.StartPlayerMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "AddPlayerAroundEntityMotion" + }, { - "type": "api", - "name": "AddPlayerAroundPointMotion", - "method": "", - "description": "给玩家添加对点环绕运动器", - "remark": "- 该接口不屏蔽玩家控制的移动以及重力作用,当有玩家控制发生时,最终的表现结果可能与预期有差异。由于玩家的头部与相机控制相关,若需要使运动器控制玩家的头部,请使用[DepartCamera](./摄像机.md#DepartCamera)分离玩家与摄像机。\r\n - 环绕运动器可叠加多个,且可与速度运动器互相叠加,每一帧的最终效果为各个运动器计算出的瞬时向量之和。\r\n - 由于引擎中有加载的区块限制,建议将玩家的运动范围控制在当前位置±100内。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 该接口不屏蔽玩家控制的移动以及重力作用,当有玩家控制发生时,最终的表现结果可能与预期有差异。由于玩家的头部与相机控制相关,若需要使运动器控制玩家的头部,请使用[DepartCamera](./摄像机.md#DepartCamera)分离玩家与摄像机。\r\n - 环绕运动器可叠加多个,且可与速度运动器互相叠加,每一帧的最终效果为各个运动器计算出的瞬时向量之和。\r\n - 由于引擎中有加载的区块限制,建议将玩家的运动范围控制在当前位置±100内。", + "return": [], + "description": "给玩家添加对点环绕运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\ncenter = (0, 8, 0)\r\naxis=(-1, 1, 1)\r\nmID = motionComp.AddPlayerAroundPointMotion(center, 1.0, axis, lockDir=False, stopRad=0)\r\n#启动该运动器\r\nmotionComp.StartPlayerMotion(mID)", "params": [ { - "name": "center", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "center", "description": "要环绕的圆心点坐标" - }, + }, { - "name": "angularVelocity", - "type": "float", + "type": "float", + "name": "angularVelocity", "description": "圆周运动的角速度(弧度/秒)" - }, + }, { - "name": "axis", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "axis", "description": "圆周运动的轴,决定了在哪个平面上做圆周运动,默认为(0, 1, 0)" - }, + }, { - "name": "lockDir", - "type": "bool", + "type": "bool", + "name": "lockDir", "description": "是否在运动器生效时锁定实体的朝向,不锁定则玩家的朝向会随着运动而改变,默认为False。" - }, + }, { - "name": "stopRad", - "type": "float", + "type": "float", + "name": "stopRad", "description": "停止该运动器所需要的弧度,当stopRad为0时,该运动器会一直运行,默认为0" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\ncenter = (0, 8, 0)\r\naxis=(-1, 1, 1)\r\nmID = motionComp.AddPlayerAroundPointMotion(center, 1.0, axis, lockDir=False, stopRad=0)\r\n#启动该运动器\r\nmotionComp.StartPlayerMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "AddPlayerAroundPointMotion" + }, { - "type": "api", - "name": "AddPlayerTrackMotion", - "method": "", - "description": "给玩家添加轨迹运动器", - "remark": "- 该接口不屏蔽玩家控制的移动,当有玩家控制发生时,最终的表现结果可能与预期有差异。由于玩家的头部与相机控制相关,若需要使运动器控制玩家的头部,请使用[DepartCamera](./摄像机.md#DepartCamera)分离玩家与摄像机。\r\n - 轨迹运动器不可叠加,仅能添加一个。\r\n - 设置朝向后会根据相应的参数计算出最终朝向,若此时的targetRot > startRot,则会顺时针旋转,反之逆时针旋转。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 该接口不屏蔽玩家控制的移动,当有玩家控制发生时,最终的表现结果可能与预期有差异。由于玩家的头部与相机控制相关,若需要使运动器控制玩家的头部,请使用[DepartCamera](./摄像机.md#DepartCamera)分离玩家与摄像机。\r\n - 轨迹运动器不可叠加,仅能添加一个。\r\n - 设置朝向后会根据相应的参数计算出最终朝向,若此时的targetRot > startRot,则会顺时针旋转,反之逆时针旋转。", + "return": [], + "description": "给玩家添加轨迹运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\ntarget = (5, 0, 0)\r\nrot1 = (0, 0)\r\nrot2 = (0, 360)\r\nmID = motionComp.AddPlayerTrackMotion(target, 3.0, startPos=None, relativeCoord=True, isLoop=False, targetRot=rot1, startRot=rot2, useVelocityDir=True, ease = serverApi.GetMinecraftEnum().TimeEaseType.linear)\r\n#启动该运动器\r\nmotionComp.StartPlayerMotion(mID)", "params": [ { - "name": "targetPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "targetPos", "description": "轨迹终点" - }, + }, { - "name": "duraTime", - "type": "float", + "type": "float", + "name": "duraTime", "description": "到达终点所需要的时间" - }, + }, { - "name": "startPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "startPos", "description": "轨迹起点,默认为None,表示以调用[StartPlayerMotion](#StartPlayerMotion)的位置作为起点。" - }, + }, { - "name": "relativeCoord", - "type": "bool", + "type": "bool", + "name": "relativeCoord", "description": "是否使用相对坐标设置起点和终点的位置以及朝向,默认为False。" - }, + }, { - "name": "isLoop", - "type": "bool", + "type": "bool", + "name": "isLoop", "description": "是否循环,若设为True,则玩家会在起点和终点之间往复运动,默认为False。" - }, + }, { - "name": "targetRot", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "targetRot", "description": "玩家到达targetPos时的朝向,受参数relativeCoord影响,默认为None,表示使用调用[StartPlayerMotion](#StartPlayerMotion)时的朝向。" - }, + }, { - "name": "startRot", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "startRot", "description": "玩家到达startPos时的朝向,受参数relativeCoord影响,默认为None,表示使用调用[StartPlayerMotion](#StartPlayerMotion)时的朝向。" - }, + }, { - "name": "useVelocityDir", - "type": "bool", + "type": "bool", + "name": "useVelocityDir", "description": "是否使用运动中的速度方向作为朝向,默认为False,若为True,则参数targetRot和startRot无效" - }, + }, { - "name": "ease", - "type": "TimeEaseType", + "type": "TimeEaseType", + "name": "ease", "description": "时间变化函数, 默认值为serverApi.GetMinecraftEnum().TimeEaseType.linear, 参数不在枚举值中也当作linear" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\ntarget = (5, 0, 0)\r\nrot1 = (0, 0)\r\nrot2 = (0, 360)\r\nmID = motionComp.AddPlayerTrackMotion(target, 3.0, startPos=None, relativeCoord=True, isLoop=False, targetRot=rot1, startRot=rot2, useVelocityDir=True, ease = serverApi.GetMinecraftEnum().TimeEaseType.linear)\r\n#启动该运动器\r\nmotionComp.StartPlayerMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "AddPlayerTrackMotion" + }, { - "type": "api", - "name": "AddPlayerVelocityMotion", - "method": "", - "description": "给玩家添加速度运动器", - "remark": "- 该接口不屏蔽玩家控制的移动以及重力作用,当有玩家控制发生时,最终的表现结果可能与预期有差异。由于玩家的头部与相机控制相关,若需要使运动器控制玩家的头部,请使用[DepartCamera](./摄像机.md#DepartCamera)分离玩家与摄像机。\r\n - 速度运动器可叠加多个,且可与环绕运动器互相叠加。\r\n - 由于引擎中有加载的区块限制,建议将玩家的运动范围控制在当前位置±100内。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 该接口不屏蔽玩家控制的移动以及重力作用,当有玩家控制发生时,最终的表现结果可能与预期有差异。由于玩家的头部与相机控制相关,若需要使运动器控制玩家的头部,请使用[DepartCamera](./摄像机.md#DepartCamera)分离玩家与摄像机。\r\n - 速度运动器可叠加多个,且可与环绕运动器互相叠加。\r\n - 由于引擎中有加载的区块限制,建议将玩家的运动范围控制在当前位置±100内。", + "return": [], + "description": "给玩家添加速度运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\nvelocity = (0, 0, 1)\r\naccelerate = (0, 0, -1)\r\nmID = motionComp.AddPlayerVelocityMotion(velocity, accelerate, useVelocityDir=True)\r\n#启动该运动器\r\nmotionComp.StartPlayerMotion(mID)", "params": [ { - "name": "velocity", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "velocity", "description": "速度,包含大小、方向" - }, + }, { - "name": "accelerate", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "accelerate", "description": "加速度,包含大小、方向,默认为None,表示没有加速度" - }, + }, { - "name": "useVelocityDir", - "type": "bool", + "type": "bool", + "name": "useVelocityDir", "description": "是否使用当前速度的方向作为此刻实体的朝向,默认为True" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\nvelocity = (0, 0, 1)\r\naccelerate = (0, 0, -1)\r\nmID = motionComp.AddPlayerVelocityMotion(velocity, accelerate, useVelocityDir=True)\r\n#启动该运动器\r\nmotionComp.StartPlayerMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "AddPlayerVelocityMotion" + }, { - "type": "api", - "name": "BeginSprinting", - "method": "", - "description": "使本地玩家进入并保持向前疾跑/冲刺状态", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorMotion(localPlayerId)\r\ncomp.BeginSprinting()" - }, + "remark": "", + "return": [], + "description": "使本地玩家进入并保持向前疾跑/冲刺状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorMotion(localPlayerId)\r\ncomp.BeginSprinting()", + "params": [], + "type": "api", + "side": "client", + "name": "BeginSprinting" + }, { - "type": "api", - "name": "ChangePlayerDimension", - "method": "", - "description": "传送玩家", - "remark": "- 该接口在成功切换维度时pos位置为玩家头的位置,即比设定位置低1.62", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 该接口在成功切换维度时pos位置为玩家头的位置,即比设定位置低1.62", + "return": [], + "description": "传送玩家", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(playerId)\r\ncomp.ChangePlayerDimension(0, (0,4,0))", "params": [ { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "维度,0-overWorld; 1-nether; 2-theEnd" - }, + }, { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "传送的坐标" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateDimension(playerId)\r\ncomp.ChangePlayerDimension(0, (0,4,0))" - }, + ], + "type": "api", + "side": "server", + "name": "ChangePlayerDimension" + }, { - "type": "api", - "name": "ChangePlayerFlyState", - "method": "", - "description": "给予/取消飞行能力, 并根据enterFly参数确定是否进入飞行状态", - "remark": "- 不建议在OnGroundClientEvent事件回调中NotifyToServer,然后服务端收到数据后,调用ChangePlayerFlyState接口。\r\n 如果仍然需要这样调用,则建议在服务端收到数据后,用AddTimer延迟一帧后再调用ChangePlayerFlyState接口\r\n - 拥有飞行能力时,不会受到摔落伤害", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 不建议在OnGroundClientEvent事件回调中NotifyToServer,然后服务端收到数据后,调用ChangePlayerFlyState接口。\r\n 如果仍然需要这样调用,则建议在服务端收到数据后,用AddTimer延迟一帧后再调用ChangePlayerFlyState接口\r\n - 拥有飞行能力时,不会受到摔落伤害", + "return": [], + "description": "给予/取消飞行能力, 并根据enterFly参数确定是否进入飞行状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateFly(playerId)\r\ncomp.ChangePlayerFlyState(True) # 给予飞行能力,并进入飞行状态\r\n# comp.ChangePlayerFlyState(True, False)# 给予飞行能力,不进入飞行状态\r\n# comp.ChangePlayerFlyState(False)# 取消飞行能力", "params": [ { - "name": "isFly", - "type": "bool", + "type": "bool", + "name": "isFly", "description": "给予/取消飞行能力" - }, + }, { - "name": "enterFly", - "type": "bool", + "type": "bool", + "name": "enterFly", "description": "是否进入飞行状态,当isFly为true时,该参数才有效,其他情况下均为false" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateFly(playerId)\r\ncomp.ChangePlayerFlyState(True) # 给予飞行能力,并进入飞行状态\r\n# comp.ChangePlayerFlyState(True, False)# 给予飞行能力,不进入飞行状态\r\n# comp.ChangePlayerFlyState(False)# 取消飞行能力" - }, + ], + "type": "api", + "side": "server", + "name": "ChangePlayerFlyState" + }, { - "type": "api", - "name": "EnableKeepInventory", - "method": "", - "description": "设置玩家死亡不掉落物品", - "remark": "- 只有全局的“保留物品栏”规则关闭时,才会使用该设置控制玩家是否掉落。如果全局的“保留物品栏”规则是开启的,那么所有玩家死亡时都不会掉落。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 只有全局的“保留物品栏”规则关闭时,才会使用该设置控制玩家是否掉落。如果全局的“保留物品栏”规则是开启的,那么所有玩家死亡时都不会掉落。", + "return": [], + "description": "设置玩家死亡不掉落物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\nsucc = comp.EnableKeepInventory(True)", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "True:不掉落,False:掉落" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\nsucc = comp.EnableKeepInventory(True)" - }, + ], + "type": "api", + "side": "server", + "name": "EnableKeepInventory" + }, { - "type": "api", - "name": "EndSprinting", - "method": "", - "description": "使本地玩家结束向前疾跑/冲刺状态", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorMotion(localPlayerId)\r\ncomp.EndSprinting()" - }, + "remark": "", + "return": [], + "description": "使本地玩家结束向前疾跑/冲刺状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateActorMotion(localPlayerId)\r\ncomp.EndSprinting()", + "params": [], + "type": "api", + "side": "client", + "name": "EndSprinting" + }, { - "type": "api", - "name": "GetEntityRider", - "method": "", - "description": "获取骑乘者正在骑乘的实体的id。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRide(entityId)\r\nriderId = comp.GetEntityRider()" - }, + "remark": "", + "return": [], + "description": "获取骑乘者正在骑乘的实体的id。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateRide(entityId)\r\nriderId = comp.GetEntityRider()", + "params": [], + "type": "api", + "side": "client", + "name": "GetEntityRider" + }, { - "type": "api", - "name": "GetInteracteCenterOffset", - "method": "", - "description": "获取玩家[服务端交互中心](../../../1-ModAPI/更新信息/2.8.md#玩家摄像机)的偏移", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetInteracteCenterOffset()" - }, + "remark": "", + "return": [], + "description": "获取玩家[服务端交互中心](../../../1-ModAPI/更新信息/2.8.md#玩家摄像机)的偏移", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetInteracteCenterOffset()", + "params": [], + "type": "api", + "side": "server", + "name": "GetInteracteCenterOffset" + }, { - "type": "api", - "name": "GetIsBlocking", - "method": "", - "description": "获取玩家激活盾牌状态", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetIsBlocking()" - }, + "remark": "", + "return": [], + "description": "获取玩家激活盾牌状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetIsBlocking()", + "params": [], + "type": "api", + "side": "server", + "name": "GetIsBlocking" + }, { - "type": "api", - "name": "GetPickCenterOffset", - "method": "", - "description": "获取玩家设置的第三人称下客户端交互中心的偏移", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetPickCenterOffset()" - }, + "remark": "", + "return": [], + "description": "获取玩家设置的第三人称下客户端交互中心的偏移", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetPickCenterOffset()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPickCenterOffset" + }, { - "type": "api", - "name": "GetPickRange", - "method": "", - "description": "获取玩家客户端的交互距离", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetPickRange()" - }, + "remark": "", + "return": [], + "description": "获取玩家客户端的交互距离", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetPickRange()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPickRange" + }, { - "type": "api", - "name": "GetPlayerDestroyTotalTime", - "method": "", - "description": "获取玩家破坏方块需要的时间,受玩家状态(急迫、潮涌、挖掘疲劳)和手持物及手持物附魔(效率)影响", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "", + "return": [], + "description": "获取玩家破坏方块需要的时间,受玩家状态(急迫、潮涌、挖掘疲劳)和手持物及手持物附魔(效率)影响", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetPlayerDestroyTotalTime(\"minecraft:diamond_block\")", "params": [ { - "name": "blockName", - "type": "str", + "type": "str", + "name": "blockName", "description": "方块标识符,格式[namespace:name:auxvalue],auxvalue默认为0" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetPlayerDestroyTotalTime(\"minecraft:diamond_block\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetPlayerDestroyTotalTime" + }, { - "type": "api", - "name": "GetPlayerExhaustionRatioByType", - "method": "", - "description": "获取玩家某行为饥饿度消耗倍率", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "", + "return": [], + "description": "获取玩家某行为饥饿度消耗倍率", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\njumpType = serverApi.GetMinecraftEnum().PlayerExhauseRatioType.JUMP\r\nratio = comp.GetPlayerExhaustionRatioByType(jumpType)", "params": [ { - "name": "type", - "type": "int", + "type": "int", + "name": "type", "description": "行为枚举[PlayerExhauseRatioType枚举](../../枚举值/PlayerExhauseRatioType.md)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\njumpType = serverApi.GetMinecraftEnum().PlayerExhauseRatioType.JUMP\r\nratio = comp.GetPlayerExhaustionRatioByType(jumpType)" - }, + ], + "type": "api", + "side": "server", + "name": "GetPlayerExhaustionRatioByType" + }, { - "type": "api", - "name": "GetPlayerInteracteRange", - "method": "", - "description": "获取玩家服务端的交互距离", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetPlayerInteracteRange()" - }, + "remark": "", + "return": [], + "description": "获取玩家服务端的交互距离", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetPlayerInteracteRange()", + "params": [], + "type": "api", + "side": "server", + "name": "GetPlayerInteracteRange" + }, { - "type": "api", - "name": "GetPlayerMotions", - "method": "", - "description": "获取玩家身上的所有运动器", - "remark": "- 运动器非人为停止后会被移除。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\nmotions = motionComp.GetPlayerMotions()\r\n# motions = {\r\n# 0:1,\r\n# 1:2\r\n# }" - }, + "remark": "- 运动器非人为停止后会被移除。", + "return": [], + "description": "获取玩家身上的所有运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\nmotions = motionComp.GetPlayerMotions()\r\n# motions = {\r\n# 0:1,\r\n# 1:2\r\n# }", + "params": [], + "type": "api", + "side": "server", + "name": "GetPlayerMotions" + }, { - "type": "api", - "name": "GetPlayerRespawnPos", - "method": "", - "description": "获取玩家复活点", - "remark": "- 使用spawnpoint指令设置玩家的出生点后,该接口可以获取到设置后的出生点\r\n - 未使用setworldspawn指令设置过出生点位置时,返回坐标的y轴是32767", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\nprint comp.GetPlayerRespawnPos()\r\n#结果示例 {'dimensionId': 0, 'pos': (44, 32767, 4)}" - }, + "remark": "- 使用spawnpoint指令设置玩家的出生点后,该接口可以获取到设置后的出生点\r\n - 未使用setworldspawn指令设置过出生点位置时,返回坐标的y轴是32767", + "return": [], + "description": "获取玩家复活点", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\nprint comp.GetPlayerRespawnPos()\r\n#结果示例 {'dimensionId': 0, 'pos': (44, 32767, 4)}", + "params": [], + "type": "api", + "side": "server", + "name": "GetPlayerRespawnPos" + }, { - "type": "api", - "name": "GetRelevantPlayer", - "method": "", - "description": "获取附近玩家id列表", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "", + "return": [], + "description": "获取附近玩家id列表", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetRelevantPlayer(exceptId)", "params": [ { - "name": "exceptList", - "type": "list(str)", + "type": "list(str)", + "name": "exceptList", "description": "排除的玩家id列表,默认值为None,不排除其他玩家及自身" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.GetRelevantPlayer(exceptId)" - }, + ], + "type": "api", + "side": "server", + "name": "GetRelevantPlayer" + }, { - "type": "api", - "name": "IsEntityRiding", - "method": "", - "description": "检查玩家是否骑乘。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\nisRiding = comp.IsEntityRiding()" - }, + "remark": "", + "return": [], + "description": "检查玩家是否骑乘。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateRide(entityId)\r\nisRiding = comp.IsEntityRiding()", + "params": [], + "type": "api", + "side": "server", + "name": "IsEntityRiding" + }, { - "type": "api", - "name": "IsInScaffolding", - "method": "", - "description": "获取玩家是否在脚手架中", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.IsInScaffolding()" - }, + "remark": "", + "return": [], + "description": "获取玩家是否在脚手架中", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.IsInScaffolding()", + "params": [], + "type": "api", + "side": "client", + "name": "IsInScaffolding" + }, { - "type": "api", - "name": "IsOnLadder", - "method": "", - "description": "获取玩家是否在梯子/藤蔓上", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.IsOnLadder()" - }, + "remark": "", + "return": [], + "description": "获取玩家是否在梯子/藤蔓上", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.IsOnLadder()", + "params": [], + "type": "api", + "side": "client", + "name": "IsOnLadder" + }, { - "type": "api", - "name": "IsPlayerCanFly", - "method": "", - "description": "获取玩家能否飞行", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateFly(playerId)\r\ncomp.IsPlayerCanFly()" - }, + "remark": "", + "return": [], + "description": "获取玩家能否飞行", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateFly(playerId)\r\ncomp.IsPlayerCanFly()", + "params": [], + "type": "api", + "side": "server", + "name": "IsPlayerCanFly" + }, { - "type": "api", - "name": "IsPlayerFlying", - "method": "", - "description": "获取玩家是否在飞行", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateFly(playerId)\r\ncomp.IsPlayerFlying()" - }, + "remark": "", + "return": [], + "description": "获取玩家是否在飞行", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateFly(playerId)\r\ncomp.IsPlayerFlying()", + "params": [], + "type": "api", + "side": "server", + "name": "IsPlayerFlying" + }, { - "type": "api", - "name": "OpenWorkBench", - "method": "", - "description": "在玩家当前位置打开工作台UI,不依赖于工作台方块", - "remark": "- 工作台有交互距离要求,太远了(与打开位置超过5格以上)打开工作台UI后会自动关闭", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId) # 此处playerId为使用物品的玩家\r\ncomp.OpenWorkBench()" - }, + "remark": "- 工作台有交互距离要求,太远了(与打开位置超过5格以上)打开工作台UI后会自动关闭", + "return": [], + "description": "在玩家当前位置打开工作台UI,不依赖于工作台方块", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId) # 此处playerId为使用物品的玩家\r\ncomp.OpenWorkBench()", + "params": [], + "type": "api", + "side": "server", + "name": "OpenWorkBench" + }, { - "type": "api", - "name": "PickUpItemEntity", - "method": "", - "description": "某个Player拾取物品ItemEntity", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "", + "return": [], + "description": "某个Player拾取物品ItemEntity", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.PickUpItemEntity(playerEntityId, itemEntityId)", "params": [ { - "name": "playerEntityId", - "type": "str", + "type": "str", + "name": "playerEntityId", "description": "拾取者的playerEntityId" - }, + }, { - "name": "itemEntityId", - "type": "str", + "type": "str", + "name": "itemEntityId", "description": "要拾取的物品itemEntityId" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.PickUpItemEntity(playerEntityId, itemEntityId)" - }, + ], + "type": "api", + "side": "server", + "name": "PickUpItemEntity" + }, { - "type": "api", - "name": "PlayerAttackEntity", - "method": "", - "description": "玩家使用手持武器攻击某个生物", - "remark": "- 1.会触发[PlayerAttackEntityEvent](../../事件/玩家.md#playerattackentityevent)事件,并且可以被这个事件cancel\r\n - 2.此接口无视距离,但无法跨维度使用,同时需要目标区域已加载\r\n - 3.常加载区块的生物也不会执行tick,生物受伤cd不会减少,无法对生物多次造成伤害,通过[SetHurtCD](../世界/游戏规则.md#sethurtcd)接口设置伤害间隔为0,可以解决这个问题\r\n - 4.此接口不会播放原版攻击动作,可以使用[Swing](../玩家/属性.md#Swing)接口来播放原版攻击动作", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 1.会触发[PlayerAttackEntityEvent](../../事件/玩家.md#playerattackentityevent)事件,并且可以被这个事件cancel\r\n - 2.此接口无视距离,但无法跨维度使用,同时需要目标区域已加载\r\n - 3.常加载区块的生物也不会执行tick,生物受伤cd不会减少,无法对生物多次造成伤害,通过[SetHurtCD](../世界/游戏规则.md#sethurtcd)接口设置伤害间隔为0,可以解决这个问题\r\n - 4.此接口不会播放原版攻击动作,可以使用[Swing](../玩家/属性.md#Swing)接口来播放原版攻击动作", + "return": [], + "description": "玩家使用手持武器攻击某个生物", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId) # 此处playerId为发起攻击的玩家\r\nsuc = comp.PlayerAttackEntity(\"-123456\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物entityId" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId) # 此处playerId为发起攻击的玩家\r\nsuc = comp.PlayerAttackEntity(\"-123456\")" - }, + ], + "type": "api", + "side": "server", + "name": "PlayerAttackEntity" + }, { - "type": "api", - "name": "PlayerDestoryBlock", - "method": "", - "description": "使用手上工具破坏方块", - "remark": "- 手上工具的附魔效果会生效,同时扣除耐久度\r\n - 会触发ServerPlayerTryDestroyBlockEvent事件,并且可以被这个事件cancel", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 手上工具的附魔效果会生效,同时扣除耐久度\r\n - 会触发ServerPlayerTryDestroyBlockEvent事件,并且可以被这个事件cancel", + "return": [], + "description": "使用手上工具破坏方块", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId) # 此处playerId为block的破坏者\r\ncomp.PlayerDestoryBlock((0, 5, 0), 1, False)\r\ncomp.PlayerDestoryBlock((0, 6, 0), 1, True)\r\n\r\n# 关闭破坏粒子效果\r\ncomp.PlayerDestoryBlock((0, 6, 0),0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "方块位置" - }, + }, { - "name": "particle", - "type": "int", + "type": "int", + "name": "particle", "description": "是否开启破坏粒子效果,默认为开" - }, + }, { - "name": "sendInv", - "type": "bool", + "type": "bool", + "name": "sendInv", "description": "是否同步服务端背包信息,默认为不同步。因为破坏方块可能会造成手持物品耐久度降低等信息改变,不同步信息可能会造成后续一些逻辑异常,若大批量破坏方块,每次同步会有性能问题,建议前面的调用可令sendInv为False,在最后一次调用此函数时传入sendInv为True。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId) # 此处playerId为block的破坏者\r\ncomp.PlayerDestoryBlock((0, 5, 0), 1, False)\r\ncomp.PlayerDestoryBlock((0, 6, 0), 1, True)\r\n\r\n# 关闭破坏粒子效果\r\ncomp.PlayerDestoryBlock((0, 6, 0),0)" - }, + ], + "type": "api", + "side": "server", + "name": "PlayerDestoryBlock" + }, { - "type": "api", - "name": "PlayerUseItemToEntity", - "method": "", - "description": "玩家使用手上物品对某个生物使用", - "remark": "- 1.会触发[PlayerInteractServerEvent](../../事件/玩家.html#playerinteractserverevent)事件,并且可以被这个事件cancel\r\n - 2.使用PlayerUseItemToEntity接口模拟玩家用命名牌重命名生物、用食物喂养生物时,可以触发[PlayerNamedEntityServerEvent](../../事件/玩家.html#playernamedentityserverevent)、[PlayerFeedEntityServerEvent](../../事件/玩家.html#playerfeedentityserverevent)事件,并且这两个事件都可以cancel\r\n - 3.此接口无视距离,但无法跨维度使用,同时需要目标区域已加载", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 1.会触发[PlayerInteractServerEvent](../../事件/玩家.html#playerinteractserverevent)事件,并且可以被这个事件cancel\r\n - 2.使用PlayerUseItemToEntity接口模拟玩家用命名牌重命名生物、用食物喂养生物时,可以触发[PlayerNamedEntityServerEvent](../../事件/玩家.html#playernamedentityserverevent)、[PlayerFeedEntityServerEvent](../../事件/玩家.html#playerfeedentityserverevent)事件,并且这两个事件都可以cancel\r\n - 3.此接口无视距离,但无法跨维度使用,同时需要目标区域已加载", + "return": [], + "description": "玩家使用手上物品对某个生物使用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId) # 此处playerId为使用物品的玩家\r\nsuc = comp.PlayerUseItemToEntity(\"-123456\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "生物entityId" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId) # 此处playerId为使用物品的玩家\r\nsuc = comp.PlayerUseItemToEntity(\"-123456\")" - }, + ], + "type": "api", + "side": "server", + "name": "PlayerUseItemToEntity" + }, { - "type": "api", - "name": "PlayerUseItemToPos", - "method": "", - "description": "模拟玩家对某个坐标使用物品", - "remark": "- 当使用抛射物时,只有在非创造模式下才会返回True;如果要对\"盔甲架\"等实体使用物品,请使用PlayerUseItemToEntity接口;只能对玩家周边200格以内的坐标使用\r\n - 模拟玩家使用物品时,最终效果和右键使用物品类似,会先触发方块交互,再触发物品使用。因此,该接口同时也可用作方块交互目的\r\n - 使用api放置容器类方块(如箱子)后,立刻调用PlayerUseItemToPos尝试打开箱子,会因为当前客户端还没有这个方块而无法打开,同时导致服务端与客户端状态不同步,后续也无法打开其他容器与玩家背包。为防止此问题,请确保客户端获取到对应坐标是箱子,再调用服务端PlayerUseItemToPos。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 当使用抛射物时,只有在非创造模式下才会返回True;如果要对\"盔甲架\"等实体使用物品,请使用PlayerUseItemToEntity接口;只能对玩家周边200格以内的坐标使用\r\n - 模拟玩家使用物品时,最终效果和右键使用物品类似,会先触发方块交互,再触发物品使用。因此,该接口同时也可用作方块交互目的\r\n - 使用api放置容器类方块(如箱子)后,立刻调用PlayerUseItemToPos尝试打开箱子,会因为当前客户端还没有这个方块而无法打开,同时导致服务端与客户端状态不同步,后续也无法打开其他容器与玩家背包。为防止此问题,请确保客户端获取到对应坐标是箱子,再调用服务端PlayerUseItemToPos。", + "return": [], + "description": "模拟玩家对某个坐标使用物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId) # 此处playerId为使用物品的玩家\r\ncomp.PlayerUseItemToPos((0, 5, 0), serverApi.GetMinecraftEnum().ItemPosType.INVENTORY, 0, 1)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "坐标" - }, + }, { - "name": "posType", - "type": "int", + "type": "int", + "name": "posType", "description": "物品所在的地方[ItemPosType枚举](../../枚举值/ItemPosType.md)" - }, + }, { - "name": "slotPos", - "type": "int", + "type": "int", + "name": "slotPos", "description": "槽位,获取INVENTORY及ARMOR时需要设置,其他情况写0即可" - }, + }, { - "name": "facing", - "type": "int", + "type": "int", + "name": "facing", "description": "朝向,详见[Facing枚举](../../枚举值/Facing.md)" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateBlockInfo(playerId) # 此处playerId为使用物品的玩家\r\ncomp.PlayerUseItemToPos((0, 5, 0), serverApi.GetMinecraftEnum().ItemPosType.INVENTORY, 0, 1)" - }, + ], + "type": "api", + "side": "server", + "name": "PlayerUseItemToPos" + }, { - "type": "api", - "name": "RemovePlayerMotion", - "method": "", - "description": "移除玩家身上的运动器", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "", + "return": [], + "description": "移除玩家身上的运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\nmotionComp.RemovePlayerMotion(mID)", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "要移除的某个运动器的ID" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\nmotionComp.RemovePlayerMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "RemovePlayerMotion" + }, { - "type": "api", - "name": "SetBanPlayerFishing", - "method": "", - "description": "设置是否屏蔽玩家钓鱼功能,屏蔽后玩家可以正常抛甩鱼竿,但无法钓起任何物品", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "", + "return": [], + "description": "设置是否屏蔽玩家钓鱼功能,屏蔽后玩家可以正常抛甩鱼竿,但无法钓起任何物品", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetBanPlayerFishing(True)", "params": [ { - "name": "isBan", - "type": "bool", + "type": "bool", + "name": "isBan", "description": "是否屏蔽玩家钓鱼功能,True为屏蔽,False为取消屏蔽" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetBanPlayerFishing(True)" - }, + ], + "type": "api", + "side": "server", + "name": "SetBanPlayerFishing" + }, { - "type": "api", - "name": "SetInteracteCenterOffset", - "method": "", - "description": "设置玩家服务端交互中心的偏移", - "remark": "- 该接口只修改服务端的交互中心,所以需要使用[SetCameraAnchor](./摄像机.md#setcameraanchor)修改客户端第一人称的交互中心,使用[SetPickCenterOffset](#setpickcenteroffset)修改客户端第三人称的交互中心,否则客户端将无法选中方块,即无法发送正确的信息给服务端\r\n - 注:当前客户端能修改交互中心的有[SetCameraAnchor](./摄像机.md#setcameraanchor)修改第一人称,[SetPickCenterOffset](#setpickcenteroffset)修改第三人称。服务端能使用[SetInteracteCenterOffset](#setinteractecenteroffset)修改玩家交互中心(服务端无第几人称概念)", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 该接口只修改服务端的交互中心,所以需要使用[SetCameraAnchor](./摄像机.md#setcameraanchor)修改客户端第一人称的交互中心,使用[SetPickCenterOffset](#setpickcenteroffset)修改客户端第三人称的交互中心,否则客户端将无法选中方块,即无法发送正确的信息给服务端\r\n - 注:当前客户端能修改交互中心的有[SetCameraAnchor](./摄像机.md#setcameraanchor)修改第一人称,[SetPickCenterOffset](#setpickcenteroffset)修改第三人称。服务端能使用[SetInteracteCenterOffset](#setinteractecenteroffset)修改玩家交互中心(服务端无第几人称概念)", + "return": [], + "description": "设置玩家服务端交互中心的偏移", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetInteracteCenterOffset(offset)", "params": [ { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "偏移量" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetInteracteCenterOffset(offset)" - }, + ], + "type": "api", + "side": "server", + "name": "SetInteracteCenterOffset" + }, { - "type": "api", - "name": "SetPickCenterOffset", - "method": "", - "description": "设置第三人称下,玩家客户端交互中心的偏移", - "remark": "- 该接口只修改第三人称,第一人称下需要使用[SetCameraAnchor](./摄像机.md#setcameraanchor)接口设置交互中心。\r\n - 该接口只修改客户端的交互中心,选中后客户端会将选中的消息发给服务端,所以需要使用[SetInteracteCenterOffset](#setinteractecenteroffset)修改服务端的的玩家交互中心,否则超出服务端允许的玩家可交互范围将被撤销。\r\n - 注:当前客户端能修改交互中心的有[SetCameraAnchor](./摄像机.md#setcameraanchor)修改第一人称,[SetPickCenterOffset](#setpickcenteroffset)修改第三人称。服务端能使用[SetInteracteCenterOffset](#setinteractecenteroffset)修改玩家交互中心(服务端无第几人称概念)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 该接口只修改第三人称,第一人称下需要使用[SetCameraAnchor](./摄像机.md#setcameraanchor)接口设置交互中心。\r\n - 该接口只修改客户端的交互中心,选中后客户端会将选中的消息发给服务端,所以需要使用[SetInteracteCenterOffset](#setinteractecenteroffset)修改服务端的的玩家交互中心,否则超出服务端允许的玩家可交互范围将被撤销。\r\n - 注:当前客户端能修改交互中心的有[SetCameraAnchor](./摄像机.md#setcameraanchor)修改第一人称,[SetPickCenterOffset](#setpickcenteroffset)修改第三人称。服务端能使用[SetInteracteCenterOffset](#setinteractecenteroffset)修改玩家交互中心(服务端无第几人称概念)", + "return": [], + "description": "设置第三人称下,玩家客户端交互中心的偏移", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPickCenterOffset(offset)", "params": [ { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "偏移量" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPickCenterOffset(offset)" - }, + ], + "type": "api", + "side": "client", + "name": "SetPickCenterOffset" + }, { - "type": "api", - "name": "SetPickRange", - "method": "", - "description": "设置玩家客户端的交互距离", - "remark": "- 该接口只修改客户端的交互距离,选中后客户端会将选中的消息发给服务端,所以需要使用[SetPlayerInteracteRange](#setplayerinteracterange)修改服务端玩家的交互距离,否则超出服务端允许的玩家可交互范围将被撤销。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 该接口只修改客户端的交互距离,选中后客户端会将选中的消息发给服务端,所以需要使用[SetPlayerInteracteRange](#setplayerinteracterange)修改服务端玩家的交互距离,否则超出服务端允许的玩家可交互范围将被撤销。", + "return": [], + "description": "设置玩家客户端的交互距离", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPickRange(pickRange)", "params": [ { - "name": "pickRange", - "type": "float", + "type": "float", + "name": "pickRange", "description": "交互半径" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPickRange(pickRange)" - }, + ], + "type": "api", + "side": "client", + "name": "SetPickRange" + }, { - "type": "api", - "name": "SetPickUpArea", - "method": "", - "description": "设置玩家的拾取物品范围,设置后该玩家的拾取物品范围会在原版拾取范围的基础上进行改变。", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "", + "return": [], + "description": "设置玩家的拾取物品范围,设置后该玩家的拾取物品范围会在原版拾取范围的基础上进行改变。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\n# 玩家拾取物品范围在X轴正负方向各增加5格,在Z轴正负方向各增加3格,在Y轴保持不变\r\nsucc = comp.SetPickUpArea((5, 0, 3))", "params": [ { - "name": "area", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "area", "description": "拾取物品范围,传入(0, 0, 0)时视作取消设置" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\n# 玩家拾取物品范围在X轴正负方向各增加5格,在Z轴正负方向各增加3格,在Y轴保持不变\r\nsucc = comp.SetPickUpArea((5, 0, 3))" - }, + ], + "type": "api", + "side": "server", + "name": "SetPickUpArea" + }, { - "type": "api", - "name": "SetPlayerAttackSpeedAmplifier", - "method": "", - "description": "设置玩家攻击速度倍数,1.0表示正常水平,1.2表示速度减益20%,0.8表示速度增益20%", - "remark": "- 该接口影响接口[SetHurtCD](../世界/游戏规则.md#sethurtcd)设置的全局受击间隔CD", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 该接口影响接口[SetHurtCD](../世界/游戏规则.md#sethurtcd)设置的全局受击间隔CD", + "return": [], + "description": "设置玩家攻击速度倍数,1.0表示正常水平,1.2表示速度减益20%,0.8表示速度增益20%", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerAttackSpeedAmplifier(1.1)", "params": [ { - "name": "amplifier", - "type": "float", + "type": "float", + "name": "amplifier", "description": "攻击速度倍数,范围[0.5,2.0]" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerAttackSpeedAmplifier(1.1)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerAttackSpeedAmplifier" + }, { - "type": "api", - "name": "SetPlayerExhaustionRatioByType", - "method": "", - "description": "设置玩家某行为饥饿度消耗倍率", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "", + "return": [], + "description": "设置玩家某行为饥饿度消耗倍率", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\njumpType = serverApi.GetMinecraftEnum().PlayerExhauseRatioType.JUMP\r\nratio = comp.SetPlayerExhaustionRatioByType(jumpType, 20)", "params": [ { - "name": "type", - "type": "int", + "type": "int", + "name": "type", "description": "行为枚举[PlayerExhauseRatioType枚举](../../枚举值/PlayerExhauseRatioType.md)" - }, + }, { - "name": "ratio", - "type": "float", + "type": "float", + "name": "ratio", "description": "倍率" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\njumpType = serverApi.GetMinecraftEnum().PlayerExhauseRatioType.JUMP\r\nratio = comp.SetPlayerExhaustionRatioByType(jumpType, 20)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerExhaustionRatioByType" + }, { - "type": "api", - "name": "SetPlayerInteracteRange", - "method": "", - "description": "设置玩家服务端的交互距离", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "", + "return": [], + "description": "设置玩家服务端的交互距离", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerInteracteRange(interacteRange)", "params": [ { - "name": "interacteRange", - "type": "float", + "type": "float", + "name": "interacteRange", "description": "交互半径" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerInteracteRange(interacteRange)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerInteracteRange" + }, { - "type": "api", - "name": "SetPlayerJumpable", - "method": "", - "description": "设置玩家是否可跳跃", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "", + "return": [], + "description": "设置玩家是否可跳跃", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerJumpable(False)", "params": [ { - "name": "isJumpable", - "type": "bool", + "type": "bool", + "name": "isJumpable", "description": "是否可跳跃,True允许跳跃,False禁止跳跃" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerJumpable(False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerJumpable" + }, { - "type": "api", - "name": "SetPlayerMotion", - "method": "", - "description": "设置玩家的瞬时移动方向向量(可解决SetMotion闪现问题)", - "remark": "- 在damageEvent事件里面使用该接口时,需把damageEvent事件回调的knock参数设置为False\r\n - SetMotion接口需要客户端服务端双端调用,但受限于网速、延迟等,会出现闪现情况,此接口可完美解决上述问题", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 在damageEvent事件里面使用该接口时,需把damageEvent事件回调的knock参数设置为False\r\n - SetMotion接口需要客户端服务端双端调用,但受限于网速、延迟等,会出现闪现情况,此接口可完美解决上述问题", + "return": [], + "description": "设置玩家的瞬时移动方向向量(可解决SetMotion闪现问题)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\n# 使生物向准星的方向突进一段距离\r\nrotComp = serverApi.GetEngineCompFactory().CreateRot(entityId)\r\nrot = rotComp.GetRot()\r\nx, y, z = serverApi.GetDirFromRot(rot)\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotionComp.SetPlayerMotion((x * 5, y * 5, z * 5))\r\n# rot 和 世界坐标系关系\r\n# ^ x -90°\r\n# |\r\n# 180°/-180 ----------> z 0°\r\n# | 90°", "params": [ { - "name": "motion", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "motion", "description": "世界坐标系下的向量,该方向为世界坐标系下的向量,以x,z,y三个轴的正方向为正值,可以通过当前生物的rot组件判断目前玩家面向的方向,可在开发模式下打开F3观察数值变化。" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\n# 使生物向准星的方向突进一段距离\r\nrotComp = serverApi.GetEngineCompFactory().CreateRot(entityId)\r\nrot = rotComp.GetRot()\r\nx, y, z = serverApi.GetDirFromRot(rot)\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(entityId)\r\nmotionComp.SetPlayerMotion((x * 5, y * 5, z * 5))\r\n# rot 和 世界坐标系关系\r\n# ^ x -90°\r\n# |\r\n# 180°/-180 ----------> z 0°\r\n# | 90°" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerMotion" + }, { - "type": "api", - "name": "SetPlayerMovable", - "method": "", - "description": "设置玩家是否可移动", - "remark": "- 备注:如需限制玩家跳跃,请使用SetPlayerJumpable", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 备注:如需限制玩家跳跃,请使用SetPlayerJumpable", + "return": [], + "description": "设置玩家是否可移动", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerMovable(False)", "params": [ { - "name": "isMovable", - "type": "bool", + "type": "bool", + "name": "isMovable", "description": "是否可移动,True允许移动,False禁止移动" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\ncomp.SetPlayerMovable(False)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerMovable" + }, { - "type": "api", - "name": "SetPlayerRespawnPos", - "method": "", - "description": "设置玩家复活的位置与维度", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "", + "return": [], + "description": "设置玩家复活的位置与维度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\nsuc = comp.SetPlayerRespawnPos((0, 4, 0), 0)", "params": [ { - "name": "pos", - "type": "tuple(int,int,int)", + "type": "tuple(int,int,int)", + "name": "pos", "description": "复活点的位置坐标" - }, + }, { - "name": "dimensionId", - "type": "int", + "type": "int", + "name": "dimensionId", "description": "复活点的维度,默认值为0(主世界),注意1:维度21是不可用的;注意2:不能在玩家死亡(PlayerDieEvent)之后设置复活点" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)\r\nsuc = comp.SetPlayerRespawnPos((0, 4, 0), 0)" - }, + ], + "type": "api", + "side": "server", + "name": "SetPlayerRespawnPos" + }, { - "type": "api", - "name": "StartPlayerMotion", - "method": "", - "description": "启动玩家身上的某个运动器", - "remark": "- 运动器控制的玩家会无视原生的碰撞逻辑而穿透方块,若需停止,请自行监听碰撞事件OnPlayerHitBlockServerEvent然后使用StopPlayerMotion停止\r\n - 由于玩家的运动器需要在客户端与服务端之间同步,所以请以[EntityMotionStartServerEvent](../../事件/实体.md#EntityMotionStartServerEvent)事件的触发作为真正的开始时机。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 运动器控制的玩家会无视原生的碰撞逻辑而穿透方块,若需停止,请自行监听碰撞事件OnPlayerHitBlockServerEvent然后使用StopPlayerMotion停止\r\n - 由于玩家的运动器需要在客户端与服务端之间同步,所以请以[EntityMotionStartServerEvent](../../事件/实体.md#EntityMotionStartServerEvent)事件的触发作为真正的开始时机。", + "return": [], + "description": "启动玩家身上的某个运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\nmotionComp.StartPlayerMotion(mID)", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "要启动的某个运动器的ID" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\nmotionComp.StartPlayerMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "StartPlayerMotion" + }, { - "type": "api", - "name": "StopPlayerMotion", - "method": "", - "description": "停止玩家身上的某个运动器", - "remark": "- 调用该接口不会触发事件[EntityMotionStopServerEvent](../../事件/实体.md#EntityMotionStopServerEvent)。", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "- 调用该接口不会触发事件[EntityMotionStopServerEvent](../../事件/实体.md#EntityMotionStopServerEvent)。", + "return": [], + "description": "停止玩家身上的某个运动器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\nmotionComp.StopPlayerMotion(mID)", "params": [ { - "name": "motionId", - "type": "int", + "type": "int", + "name": "motionId", "description": "要停止的某个运动器的ID" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nmotionComp = serverApi.GetEngineCompFactory().CreateActorMotion(playerId)\r\nmotionComp.StopPlayerMotion(mID)" - }, + ], + "type": "api", + "side": "server", + "name": "StopPlayerMotion" + }, { - "type": "api", - "name": "isGliding", - "method": "", - "description": "是否鞘翅飞行", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isGliding()" - }, + "remark": "", + "return": [], + "description": "是否鞘翅飞行", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isGliding()", + "params": [], + "type": "api", + "side": "client", + "name": "isGliding" + }, { - "type": "api", - "name": "isInWater", - "method": "", - "description": "是否在水中", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isInWater()" - }, + "remark": "", + "return": [], + "description": "是否在水中", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isInWater()", + "params": [], + "type": "api", + "side": "client", + "name": "isInWater" + }, { - "type": "api", - "name": "isMoving", - "method": "", - "description": "是否在行走", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isMoving()" - }, + "remark": "", + "return": [], + "description": "是否在行走", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isMoving()", + "params": [], + "type": "api", + "side": "client", + "name": "isMoving" + }, { - "type": "api", - "name": "isRiding", - "method": "", - "description": "是否骑乘", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isRiding()" - }, + "remark": "", + "return": [], + "description": "是否骑乘", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isRiding()", + "params": [], + "type": "api", + "side": "client", + "name": "isRiding" + }, { - "type": "api", - "name": "isSneaking", - "method": "", - "description": "是否潜行", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isSneaking()" - }, + "remark": "", + "return": [], + "description": "是否潜行", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isSneaking()", + "params": [], + "type": "api", + "side": "client", + "name": "isSneaking" + }, { - "type": "api", - "name": "isSprinting", - "method": "", - "description": "是否在疾跑", - "remark": "- 注意,只有当玩家在疾跑时,该接口才返回true,静止状态下,返回false", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isSprinting()" - }, + "remark": "- 注意,只有当玩家在疾跑时,该接口才返回true,静止状态下,返回false", + "return": [], + "description": "是否在疾跑", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isSprinting()", + "params": [], + "type": "api", + "side": "client", + "name": "isSprinting" + }, { - "type": "api", - "name": "isSwimming", - "method": "", - "description": "是否游泳", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isSwimming()" - }, + "remark": "", + "return": [], + "description": "是否游泳", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.isSwimming()", + "params": [], + "type": "api", + "side": "client", + "name": "isSwimming" + }, { - "type": "api", - "name": "setMoving", - "method": "", - "description": "设置是否行走,只能设置本地玩家(只适用于移动端)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.setMoving()" - }, + "remark": "", + "return": [], + "description": "设置是否行走,只能设置本地玩家(只适用于移动端)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.setMoving()", + "params": [], + "type": "api", + "side": "client", + "name": "setMoving" + }, { - "type": "api", - "name": "setSneaking", - "method": "", - "description": "设置是否潜行,只能设置本地玩家(只适用于移动端)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.setSneaking()" - }, + "remark": "", + "return": [], + "description": "设置是否潜行,只能设置本地玩家(只适用于移动端)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.setSneaking()", + "params": [], + "type": "api", + "side": "client", + "name": "setSneaking" + }, { - "type": "api", - "name": "setSprinting", - "method": "", - "description": "设置行走模式为疾跑/冲刺,只能设置本地玩家(只适用于移动端)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", - "params": [], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.setSprinting()" - }, + "remark": "", + "return": [], + "description": "设置行走模式为疾跑/冲刺,只能设置本地玩家(只适用于移动端)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.setSprinting()", + "params": [], + "type": "api", + "side": "client", + "name": "setSprinting" + }, { - "type": "api", - "name": "setUsingShield", - "method": "", - "description": "激活盾牌状态", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "remark": "", + "return": [], + "description": "激活盾牌状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/玩家/行为.md", + "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.setUsingShield(True)", "params": [ { - "name": "flag", - "type": "bool", + "type": "bool", + "name": "flag", "description": "True使用盾牌,False取消使用盾牌" } - ], - "return": [], - "example": "comp = clientApi.GetEngineCompFactory().CreatePlayer(entityId)\r\ncomp.setUsingShield(True)" - }, + ], + "type": "api", + "side": "client", + "name": "setUsingShield" + }, { - "type": "event", - "name": "GetPlayerUid", - "method": "", - "description": "获取玩家的uid。只有在线玩家才可获取", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/联机大厅.md", + "remark": "", + "return": [], + "description": "获取玩家的uid。只有在线玩家才可获取", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/联机大厅.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家实体id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "GetPlayerUid" + }, { - "type": "event", - "name": "LobbyGetStorage", - "method": "", - "description": "获取存储的数据。仅联机大厅可用", - "remark": "- 可以使用uid为0,key为op_config获取开发者平台的运营管理配置中配置的json\r\n - callback需要接受一个参数\r\n 当请求失败时,参数返回None,当请求成功时,参数为一个dict,格式如下。(获取的key如果没有设置过,就不会出现在返回的最新数据中)\r\n ```python\r\n {\r\n \"entity\": {\r\n \"data\": [\r\n {\r\n \"key\": str, # 数据的key\r\n \"value\": int/float/str # 数据的值\r\n },\r\n ...\r\n ]\r\n }\r\n }\r\n ```\r\n - **该接口有调用频率限流,同一个组件所有联机大厅房间的请求频率最多为每秒200次。如果请求超过该频率会导致阻塞,请求的相应时间变长。**", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/联机大厅.md", + "remark": "- 可以使用uid为0,key为op_config获取开发者平台的运营管理配置中配置的json\r\n - callback需要接受一个参数\r\n 当请求失败时,参数返回None,当请求成功时,参数为一个dict,格式如下。(获取的key如果没有设置过,就不会出现在返回的最新数据中)\r\n ```python\r\n {\r\n \"entity\": {\r\n \"data\": [\r\n {\r\n \"key\": str, # 数据的key\r\n \"value\": int/float/str # 数据的值\r\n },\r\n ...\r\n ]\r\n }\r\n }\r\n ```\r\n - **该接口有调用频率限流,同一个组件所有联机大厅房间的请求频率最多为每秒200次。如果请求超过该频率会导致阻塞,请求的相应时间变长。**", + "return": [], + "description": "获取存储的数据。仅联机大厅可用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/联机大厅.md", + "example": "", "params": [ { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "请求回调函数" - }, + }, { - "name": "uid", - "type": "int", + "type": "int", + "name": "uid", "description": "玩家uid,如果传0表示获取全局数据" - }, + }, { - "name": "keys", - "type": "list(str)", + "type": "list(str)", + "name": "keys", "description": "查询数据的key列表,排序key与非排序key都可获取" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "LobbyGetStorage" + }, { - "type": "event", - "name": "LobbyGetStorageBySort", - "method": "", - "description": "排序获取存储的数据。仅联机大厅可用", - "remark": "- 全局数据(即uid为0)不参与排序\r\n - 最多只能获取前200的数据(升序前200及降序前200)\r\n - 返回的结果不一定是最新数据,会有两分钟的刷新间隔,建议只用来作客户端显示,获取业务逻辑所需的数据请使用[LobbyGetStorage](#lobbygetstorage)\r\n - callback需要接受一个参数\r\n 当请求失败时,参数返回None,当请求成功时,参数为一个dict,格式如下。(获取的key如果没有设置过,就不会出现在返回的最新数据中)\r\n ```python\r\n {\r\n \"entity\": {\r\n \"data\": [\r\n {\r\n \"uid\": int, # 玩家uid\r\n \"nickname\": str # 玩家的用户名\r\n \"value\": int/float/str, # 数据的值\r\n },\r\n ...\r\n ]\r\n }\r\n }\r\n ```", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/联机大厅.md", + "remark": "- 全局数据(即uid为0)不参与排序\r\n - 最多只能获取前200的数据(升序前200及降序前200)\r\n - 返回的结果不一定是最新数据,会有两分钟的刷新间隔,建议只用来作客户端显示,获取业务逻辑所需的数据请使用[LobbyGetStorage](#lobbygetstorage)\r\n - callback需要接受一个参数\r\n 当请求失败时,参数返回None,当请求成功时,参数为一个dict,格式如下。(获取的key如果没有设置过,就不会出现在返回的最新数据中)\r\n ```python\r\n {\r\n \"entity\": {\r\n \"data\": [\r\n {\r\n \"uid\": int, # 玩家uid\r\n \"nickname\": str # 玩家的用户名\r\n \"value\": int/float/str, # 数据的值\r\n },\r\n ...\r\n ]\r\n }\r\n }\r\n ```", + "return": [], + "description": "排序获取存储的数据。仅联机大厅可用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/联机大厅.md", + "example": "", "params": [ { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "请求回调函数" - }, + }, { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "查询数据的key。在开发者平台上配置的可排序的key才可以查询" - }, + }, { - "name": "ascend", - "type": "bool", + "type": "bool", + "name": "ascend", "description": "是否升序" - }, + }, { - "name": "offset", - "type": "int", + "type": "int", + "name": "offset", "description": "从排序后的第几个数据开始返回(从0开始计算)" - }, + }, { - "name": "length", - "type": "int", + "type": "int", + "name": "length", "description": "返回多少个数据,上限为50" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "LobbyGetStorageBySort" + }, { - "type": "event", - "name": "LobbySetStorageAndUserItem", - "method": "", - "description": "设置订单已发货或者存数据。仅联机大厅可用", - "remark": "- uid为0,key为op_config对应开发者平台的运营管理配置中配置的json,使用这个接口时请避免覆盖掉\r\n - callback需要接受一个参数\r\n 当请求**失败**时,参数返回None。\r\n 当请求**成功**时,参数为一个dict,包含返回码,最新数据等信息。\r\n - 当code为0时,表示设置成功。\r\n - 当code为2时,表示数据冲突,例如多个房间同时设置同一个玩家的数据或者全局数据。\r\n - 当code为5时,表示订单冲突,例如该订单已经标记为发货了。\r\n \r\n 当请求成功时,无论返回码是多少,都应该使用返回的最新数据更新本地数据。\r\n 当数据冲突时,callback回调结束后会自动重新调用entitiesGetter获取数据并发起重试。\r\n 当订单冲突时,callback回调结束后不会重试。\r\n (当发生冲突时,设置的key如果之前没有设置过,就不会出现在返回的最新数据中))\r\n 具体格式如下:\r\n ```python\r\n {\r\n “code”: int, # 返回码\r\n \"message\": str # 返回信息\r\n \"entity\": {\r\n \"data\": [ # 数据库最新值\r\n {\r\n \"key\": str, # 数据的key\r\n \"value\": object # 数据的值\r\n },\r\n ...\r\n ]\r\n }\r\n }\r\n ```\r\n - entitiesGetter需要返回一个list(dict),格式为:\r\n ```python\r\n [\r\n {\r\n \"key\": str, # 数据的key,长度最大为64个字符\r\n # uid为0,key为op_config对应开发者平台的运营管理配置中配置的json,请注意避免覆盖掉\r\n \"value\": object # 数据的值\r\n # 1. 如果是排序的key,value只能是int或者long,范围为-2^63到2^63-1\r\n # 2. 如果是非排序的key,value需要是可以被json序列化的对象,如int/float/str/list/dict等\r\n # 该object序列化为json字符串后,最大不能超过1024*1024个字符\r\n # 中文字符串需要是utf8编码,不要用unicode\r\n # 请留意json跟dict的区分,例如json的key一定要是字符串,json没有tuple等\r\n },\r\n ...\r\n ]\r\n ```\r\n - **该接口有调用频率限流,同一个组件所有联机大厅房间的请求频率最多为每秒50次。如果请求超过该频率会导致阻塞,请求的相应时间变长。**\r\n - 同一个uid的LobbyGetStorage与LobbySetStorageAndUserItem调用会保证顺序执行", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/联机大厅.md", + "remark": "- uid为0,key为op_config对应开发者平台的运营管理配置中配置的json,使用这个接口时请避免覆盖掉\r\n - callback需要接受一个参数\r\n 当请求**失败**时,参数返回None。\r\n 当请求**成功**时,参数为一个dict,包含返回码,最新数据等信息。\r\n - 当code为0时,表示设置成功。\r\n - 当code为2时,表示数据冲突,例如多个房间同时设置同一个玩家的数据或者全局数据。\r\n - 当code为5时,表示订单冲突,例如该订单已经标记为发货了。\r\n \r\n 当请求成功时,无论返回码是多少,都应该使用返回的最新数据更新本地数据。\r\n 当数据冲突时,callback回调结束后会自动重新调用entitiesGetter获取数据并发起重试。\r\n 当订单冲突时,callback回调结束后不会重试。\r\n (当发生冲突时,设置的key如果之前没有设置过,就不会出现在返回的最新数据中))\r\n 具体格式如下:\r\n ```python\r\n {\r\n “code”: int, # 返回码\r\n \"message\": str # 返回信息\r\n \"entity\": {\r\n \"data\": [ # 数据库最新值\r\n {\r\n \"key\": str, # 数据的key\r\n \"value\": object # 数据的值\r\n },\r\n ...\r\n ]\r\n }\r\n }\r\n ```\r\n - entitiesGetter需要返回一个list(dict),格式为:\r\n ```python\r\n [\r\n {\r\n \"key\": str, # 数据的key,长度最大为64个字符\r\n # uid为0,key为op_config对应开发者平台的运营管理配置中配置的json,请注意避免覆盖掉\r\n \"value\": object # 数据的值\r\n # 1. 如果是排序的key,value只能是int或者long,范围为-2^63到2^63-1\r\n # 2. 如果是非排序的key,value需要是可以被json序列化的对象,如int/float/str/list/dict等\r\n # 该object序列化为json字符串后,最大不能超过1024*1024个字符\r\n # 中文字符串需要是utf8编码,不要用unicode\r\n # 请留意json跟dict的区分,例如json的key一定要是字符串,json没有tuple等\r\n },\r\n ...\r\n ]\r\n ```\r\n - **该接口有调用频率限流,同一个组件所有联机大厅房间的请求频率最多为每秒50次。如果请求超过该频率会导致阻塞,请求的相应时间变长。**\r\n - 同一个uid的LobbyGetStorage与LobbySetStorageAndUserItem调用会保证顺序执行", + "return": [], + "description": "设置订单已发货或者存数据。仅联机大厅可用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/联机大厅.md", + "example": "", "params": [ { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "请求回调函数" - }, + }, { - "name": "uid", - "type": "int", + "type": "int", + "name": "uid", "description": "玩家uid,如果传0表示设置全局数据" - }, + }, { - "name": "orderId", - "type": "int或None", + "type": "int或None", + "name": "orderId", "description": "订单Id,可选" - }, + }, { - "name": "entitiesGetter", - "type": "function或None", + "type": "function或None", + "name": "entitiesGetter", "description": "用于返回存储的数据的函数,可选" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "LobbySetStorageAndUserItem" + }, { - "type": "event", - "name": "QueryLobbyUserItem", - "method": "", - "description": "查询还没发货的订单。仅联机大厅可用", - "remark": "- callback需要接受一个参数\r\n 当请求失败时,参数返回None,当请求成功时,参数为一个dict,格式为:\r\n ```python\r\n {\r\n \"entity\": {\r\n \"orders\": [\r\n {\r\n \"order_id\": int, # 订单id\r\n \"timestamp\": int, # 购买时间\r\n \"cmd\": str # 实现指令\r\n \"product_count\": int # 购买数量。目前不允许一次购买多个,所以返回都是1\r\n },\r\n ...\r\n ]\r\n }\r\n }\r\n ```", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/联机大厅.md", + "remark": "- callback需要接受一个参数\r\n 当请求失败时,参数返回None,当请求成功时,参数为一个dict,格式为:\r\n ```python\r\n {\r\n \"entity\": {\r\n \"orders\": [\r\n {\r\n \"order_id\": int, # 订单id\r\n \"timestamp\": int, # 购买时间\r\n \"cmd\": str # 实现指令\r\n \"product_count\": int # 购买数量。目前不允许一次购买多个,所以返回都是1\r\n },\r\n ...\r\n ]\r\n }\r\n }\r\n ```", + "return": [], + "description": "查询还没发货的订单。仅联机大厅可用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/联机大厅.md", + "example": "", "params": [ { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "请求回调函数" - }, + }, { - "name": "uid", - "type": "int", + "type": "int", + "name": "uid", "description": "玩家uid" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "QueryLobbyUserItem" + }, { - "type": "api", - "name": "AddEntityMarker", - "method": "", - "description": "增加实体位置标记", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "增加实体位置标记", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.AddEntityMarker(entityId, \"textures/ui/custom_head\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体Id" - }, + }, { - "name": "texturePath", - "type": "str", + "type": "str", + "name": "texturePath", "description": "头顶ICON贴图,如textures/blocks/border" - }, + }, { - "name": "size", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "size", "description": "贴图大小,默认为(4,4)" - }, + }, { - "name": "enableRotation", - "type": "bool", + "type": "bool", + "name": "enableRotation", "description": "是否启用实体朝向,默认为False" - }, + }, { - "name": "isRevertZRot", - "type": "bool", + "type": "bool", + "name": "isRevertZRot", "description": "是否翻转实体Z轴旋转,默认为False" } - ], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.AddEntityMarker(entityId, \"textures/ui/custom_head\")" - }, + ], + "type": "api", + "side": "client", + "name": "AddEntityMarker" + }, { - "type": "api", - "name": "AddEntityTextMarker", - "method": "", - "description": "在小地图上增加实体文本标记", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "在小地图上增加实体文本标记", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.AddEntityTextMarker(entityId, \"just test\", 1.0)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体Id" - }, + }, { - "name": "text", - "type": "str", + "type": "str", + "name": "text", "description": "文本的内容,可以支持[样式代码](https://minecraft-zh.gamepedia.com/%E6%A0%B7%E5%BC%8F%E4%BB%A3%E7%A0%81)(§可以设置文字的颜色、格式等,该种用法更加灵活多变)" - }, + }, { - "name": "scale", - "type": "float", + "type": "float", + "name": "scale", "description": "文本缩放倍数,等于文本控件json中的font_scale_factor参数,默认缩放倍数为1.0" } - ], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.AddEntityTextMarker(entityId, \"just test\", 1.0)" - }, + ], + "type": "api", + "side": "client", + "name": "AddEntityTextMarker" + }, { - "type": "api", - "name": "AddHoverEventParams", - "method": "", - "description": "开启按钮的悬浮回调功能,不调用该函数则按钮无悬浮回调", - "remark": "- 只有PC能生效,且只有PushScreen生成UI时生成的鼠标能产生悬浮回调!", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "buttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddHoverEventParams()" - }, + "remark": "- 只有PC能生效,且只有PushScreen生成UI时生成的鼠标能产生悬浮回调!", + "return": [], + "description": "开启按钮的悬浮回调功能,不调用该函数则按钮无悬浮回调", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "buttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddHoverEventParams()", + "params": [], + "type": "api", + "side": "client", + "name": "AddHoverEventParams" + }, { - "type": "api", - "name": "AddOption", - "method": "", - "description": "添加下拉框项,若添加成功则返回True,否则返回False", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "添加下拉框项,若添加成功则返回True,否则返回False", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\nsuccess = comboBoxUIControl.AddOption(\"测试项\", \"textures/ui/test_icon\", {\"mydata\": \"netease\"})", "params": [ { - "name": "showName", - "type": "str", + "type": "str", + "name": "showName", "description": "显示文本,必填参数" - }, + }, { - "name": "icon", - "type": "str", + "type": "str", + "name": "icon", "description": "贴图路径,若填写则在下拉框项前端会显示该icon,默认为None" - }, + }, { - "name": "userData", - "type": "any", + "type": "any", + "name": "userData", "description": "自定义数据,在选中该下拉框项时会跟随回调函数传回,默认为None" } - ], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\nsuccess = comboBoxUIControl.AddOption(\"测试项\", \"textures/ui/test_icon\", {\"mydata\": \"netease\"})" - }, + ], + "type": "api", + "side": "client", + "name": "AddOption" + }, { - "type": "api", - "name": "AddStaticMarker", - "method": "", - "description": "增加地图上静态位置的标记", - "remark": "- 如使用该接口请勿将地图缩小倍数设置过大(建议ZoomOut设置后的地图倍数不小于原地图大小的0.5倍),以免造成地图缩小后静态标记位置失效等问题。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 如使用该接口请勿将地图缩小倍数设置过大(建议ZoomOut设置后的地图倍数不小于原地图大小的0.5倍),以免造成地图缩小后静态标记位置失效等问题。", + "return": [], + "description": "增加地图上静态位置的标记", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.AddStaticMarker(\"this_is_marker_key\", (10,2), \"textures/blocks/border\", (3,3))", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "标记Id" - }, + }, { - "name": "vec2", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "vec2", "description": "地图位置二维坐标(x,z)" - }, + }, { - "name": "texturePath", - "type": "str", + "type": "str", + "name": "texturePath", "description": "贴图路径" - }, + }, { - "name": "size", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "size", "description": "贴图大小,默认为(4,4)" } - ], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.AddStaticMarker(\"this_is_marker_key\", (10,2), \"textures/blocks/border\", (3,3))" - }, + ], + "type": "api", + "side": "client", + "name": "AddStaticMarker" + }, { - "type": "api", - "name": "AddStaticTextMarker", - "method": "", - "description": "在小地图上增加静态文本的标记", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "在小地图上增加静态文本的标记", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.AddStaticTextMarker(\"this_is_marker_key\", (10,2), \"just test\", 1.0)", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "标记Id" - }, + }, { - "name": "vec2", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "vec2", "description": "地图位置二维坐标(x,z)" - }, + }, { - "name": "text", - "type": "str", + "type": "str", + "name": "text", "description": "文本的内容,可以支持[样式代码](https://minecraft-zh.gamepedia.com/%E6%A0%B7%E5%BC%8F%E4%BB%A3%E7%A0%81)(§可以设置文字的颜色、格式等,该种用法更加灵活多变)" - }, + }, { - "name": "scale", - "type": "float", + "type": "float", + "name": "scale", "description": "文本缩放倍数,等于文本控件json中的font_scale_factor参数,默认缩放倍数为1.0" } - ], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.AddStaticTextMarker(\"this_is_marker_key\", (10,2), \"just test\", 1.0)" - }, + ], + "type": "api", + "side": "client", + "name": "AddStaticTextMarker" + }, { - "type": "api", - "name": "AddTouchEventParams", - "method": "", - "description": "开启按钮回调功能,不调用该函数则按钮无回调", - "remark": "- AddTouchEventParams参数args说明:\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | isSwallow | bool | 默认为True, 按钮是否吞噬事件;或为Ture时,点击按钮时,点击事件不会穿透到世界。如破坏方块、镜头转向不会被响应|", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- AddTouchEventParams参数args说明:\r\n | 关键字 | 数据类型 | 说明 |\r\n | ----------| --------------------- | ---------|\r\n | isSwallow | bool | 默认为True, 按钮是否吞噬事件;或为Ture时,点击按钮时,点击事件不会穿透到世界。如破坏方块、镜头转向不会被响应|", + "return": [], + "description": "开启按钮回调功能,不调用该函数则按钮无回调", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "buttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})", "params": [ { - "name": "args", - "type": "dict", + "type": "dict", + "name": "args", "description": "默认为None,详细说明请见备注。" } - ], - "return": [], - "example": "buttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})" - }, + ], + "type": "api", + "side": "client", + "name": "AddTouchEventParams" + }, { - "type": "api", - "name": "ClearOptions", - "method": "", - "description": "清空下拉框", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.ClearOptions()" - }, + "remark": "", + "return": [], + "description": "清空下拉框", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.ClearOptions()", + "params": [], + "type": "api", + "side": "client", + "name": "ClearOptions" + }, { - "type": "api", - "name": "ClearSelection", - "method": "", - "description": "清除当前选中,使下拉框恢复未选中内容状态", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.ClearSelection()" - }, + "remark": "", + "return": [], + "description": "清除当前选中,使下拉框恢复未选中内容状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.ClearSelection()", + "params": [], + "type": "api", + "side": "client", + "name": "ClearSelection" + }, { - "type": "api", - "name": "DisableTextShadow", - "method": "", - "description": "关闭文本控件显示阴影", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to diable text2 textShadow\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nret = labelUIControl.DisableTextShadow()" - }, + "remark": "", + "return": [], + "description": "关闭文本控件显示阴影", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to diable text2 textShadow\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nret = labelUIControl.DisableTextShadow()", + "params": [], + "type": "api", + "side": "client", + "name": "DisableTextShadow" + }, { - "type": "api", - "name": "EnableTextShadow", - "method": "", - "description": "使文本控件显示阴影", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to enable text2 textShadow\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nret = labelUIControl.EnableTextShadow()" - }, + "remark": "", + "return": [], + "description": "使文本控件显示阴影", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to enable text2 textShadow\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nret = labelUIControl.EnableTextShadow()", + "params": [], + "type": "api", + "side": "client", + "name": "EnableTextShadow" + }, { - "type": "api", - "name": "GetAnchorFrom", - "method": "", - "description": "判断控件相对于父节点的哪个锚点来计算位置与大小", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get image1 anchorFrom\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nanchorFrom = baseUIControl.GetAnchorFrom()" - }, + "remark": "", + "return": [], + "description": "判断控件相对于父节点的哪个锚点来计算位置与大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get image1 anchorFrom\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nanchorFrom = baseUIControl.GetAnchorFrom()", + "params": [], + "type": "api", + "side": "client", + "name": "GetAnchorFrom" + }, { - "type": "api", - "name": "GetAnchorTo", - "method": "", - "description": "获取控件自身锚点位置信息", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get image1 anchorTo\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nanchorTo = baseUIControl.GetAnchorTo()" - }, + "remark": "", + "return": [], + "description": "获取控件自身锚点位置信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get image1 anchorTo\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nanchorTo = baseUIControl.GetAnchorTo()", + "params": [], + "type": "api", + "side": "client", + "name": "GetAnchorTo" + }, { - "type": "api", - "name": "GetChildByName", - "method": "", - "description": "根据子控件的名称获取BaseUIControl实例", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "根据子控件的名称获取BaseUIControl实例", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# text1的BaseUIControl实例获得text2的BaseUIControl实例\r\ntext1Path = \"/text1\"\r\ntext1Control = uiNode.GetBaseUIControl(text1Path)\r\ntext2Control = text1Control.GetChildByName(\"text2\")", "params": [ { - "name": "childName", - "type": "str", + "type": "str", + "name": "childName", "description": "子节点名称" } - ], - "return": [], - "example": "# text1的BaseUIControl实例获得text2的BaseUIControl实例\r\ntext1Path = \"/text1\"\r\ntext1Control = uiNode.GetBaseUIControl(text1Path)\r\ntext2Control = text1Control.GetChildByName(\"text2\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetChildByName" + }, { - "type": "api", - "name": "GetChildByPath", - "method": "", - "description": "根据相对路径获取BaseUIControl实例", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "根据相对路径获取BaseUIControl实例", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 根据路径\"/text1\"的BaseUIControl实例获得路径为\"/text1/text2/text3\"的BaseUIControl实例\r\ntext1Path = \"/text1\"\r\ntext1Control = uiNode.GetBaseUIControl(text1Path)\r\ntext3Control = text1Control.GetChildByPath(\"/text2/text3\")", "params": [ { - "name": "childPath", - "type": "str", + "type": "str", + "name": "childPath", "description": "相对当前BaseUIControl路径的路径" } - ], - "return": [], - "example": "# 根据路径\"/text1\"的BaseUIControl实例获得路径为\"/text1/text2/text3\"的BaseUIControl实例\r\ntext1Path = \"/text1\"\r\ntext1Control = uiNode.GetBaseUIControl(text1Path)\r\ntext3Control = text1Control.GetChildByPath(\"/text2/text3\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetChildByPath" + }, { - "type": "api", - "name": "GetClipDirection", - "method": "", - "description": "获取图片控件的裁剪方向", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "imagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.GetClipDirection()" - }, + "remark": "", + "return": [], + "description": "获取图片控件的裁剪方向", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.GetClipDirection()", + "params": [], + "type": "api", + "side": "client", + "name": "GetClipDirection" + }, { - "type": "api", - "name": "GetClipOffset", - "method": "", - "description": "获取控件的裁剪偏移信息", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get image1 clipOffset\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nclipOffset = baseUIControl.GetClipOffset()" - }, + "remark": "", + "return": [], + "description": "获取控件的裁剪偏移信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get image1 clipOffset\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nclipOffset = baseUIControl.GetClipOffset()", + "params": [], + "type": "api", + "side": "client", + "name": "GetClipOffset" + }, { - "type": "api", - "name": "GetClipsChildren", - "method": "", - "description": "根据控件路径返回某控件是否开启裁剪内容", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to know whether image1 enables clipsChildren\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nclipsChildrenEnabled = baseUIControl.GetClipsChildren()" - }, + "remark": "", + "return": [], + "description": "根据控件路径返回某控件是否开启裁剪内容", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to know whether image1 enables clipsChildren\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nclipsChildrenEnabled = baseUIControl.GetClipsChildren()", + "params": [], + "type": "api", + "side": "client", + "name": "GetClipsChildren" + }, { - "type": "api", - "name": "GetCurrentSliceIndex", - "method": "", - "description": "获取轮盘当前选择的切片的index,一般是在SetHoverCallback和SetTouchUpCallback中使用,表示当前鼠标悬浮或者点击的轮盘切片index", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "selectionWheelPath = \"/selectionWheel\"\r\nselectionWheelControl = uiNode.GetBaseUIControl(selectionWheelPath).asSelectionWheel()\r\nselectionWheelControl.GetCurrentSliceIndex()" - }, + "remark": "", + "return": [], + "description": "获取轮盘当前选择的切片的index,一般是在SetHoverCallback和SetTouchUpCallback中使用,表示当前鼠标悬浮或者点击的轮盘切片index", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "selectionWheelPath = \"/selectionWheel\"\r\nselectionWheelControl = uiNode.GetBaseUIControl(selectionWheelPath).asSelectionWheel()\r\nselectionWheelControl.GetCurrentSliceIndex()", + "params": [], + "type": "api", + "side": "client", + "name": "GetCurrentSliceIndex" + }, { - "type": "api", - "name": "GetEditText", - "method": "", - "description": "获取edit_box输入框的文本信息,获取失败会返回None", - "remark": "- 获取失败通常是由于路径填写错误,或该控件不是edit_box类型", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get edit2 content\r\neditBoxPath = \"/panel/edit2\"\r\ntextEditBoxUIControl = uiNode.GetBaseUIControl(editBoxPath).asTextEditBox()\r\ntext = textEditBoxUIControl.GetEditText()" - }, + "remark": "- 获取失败通常是由于路径填写错误,或该控件不是edit_box类型", + "return": [], + "description": "获取edit_box输入框的文本信息,获取失败会返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get edit2 content\r\neditBoxPath = \"/panel/edit2\"\r\ntextEditBoxUIControl = uiNode.GetBaseUIControl(editBoxPath).asTextEditBox()\r\ntext = textEditBoxUIControl.GetEditText()", + "params": [], + "type": "api", + "side": "client", + "name": "GetEditText" + }, { - "type": "api", - "name": "GetFullPosition", - "method": "", - "description": "获取控件的锚点坐标,支持比例值以及绝对值", - "remark": "- 参见SetFullPosition接口,控件的大小信息描述可由 absoluteValue, followType, relativeValue三个属性描述\r\n 因此返回值的结构如下:\r\n | 键值 | 类型 |\r\n | ----------------| -------------|\r\n | \"absoluteValue\" | float |\r\n | \"followType\" | str |\r\n | \"relativeValue\" | float |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 参见SetFullPosition接口,控件的大小信息描述可由 absoluteValue, followType, relativeValue三个属性描述\r\n 因此返回值的结构如下:\r\n | 键值 | 类型 |\r\n | ----------------| -------------|\r\n | \"absoluteValue\" | float |\r\n | \"followType\" | str |\r\n | \"relativeValue\" | float |", + "return": [], + "description": "获取控件的锚点坐标,支持比例值以及绝对值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\n# 获取image1的锚点x坐标\r\nret = baseUIControl.GetFullPosition(axis=\"x\")", "params": [ { - "name": "axis", - "type": "str", + "type": "str", + "name": "axis", "description": "要获取的轴向,可选的值有[\"x\",\"y\"],\"x\"表示获取控件的x坐标,\"y\"表示获取控件的y坐标" } - ], - "return": [], - "example": "imagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\n# 获取image1的锚点x坐标\r\nret = baseUIControl.GetFullPosition(axis=\"x\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetFullPosition" + }, { - "type": "api", - "name": "GetFullSize", - "method": "", - "description": "获取控件的大小,支持百分比以及绝对值", - "remark": "- 参见SetFullSize接口,控件的大小信息描述可由 absoluteValue, followType, relativeValue, fit四个属性描述\r\n 因此返回值的结构如下:\r\n | 键值 | 类型 |\r\n | ----------------| -------------|\r\n | \"absoluteValue\" | float |\r\n | \"followType\" | str |\r\n | \"relativeValue\" | float |\r\n | \"fit\" | bool |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 参见SetFullSize接口,控件的大小信息描述可由 absoluteValue, followType, relativeValue, fit四个属性描述\r\n 因此返回值的结构如下:\r\n | 键值 | 类型 |\r\n | ----------------| -------------|\r\n | \"absoluteValue\" | float |\r\n | \"followType\" | str |\r\n | \"relativeValue\" | float |\r\n | \"fit\" | bool |", + "return": [], + "description": "获取控件的大小,支持百分比以及绝对值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\n# 获取image1的宽度信息\r\nret = baseUIControl.GetFullSize(axis=\"x\")", "params": [ { - "name": "axis", - "type": "str", + "type": "str", + "name": "axis", "description": "要获取的轴向,可选的值有[\"x\",\"y\"],\"x\"表示获取控件的宽度,\"y\"表示获取控件的高度" } - ], - "return": [], - "example": "imagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\n# 获取image1的宽度信息\r\nret = baseUIControl.GetFullSize(axis=\"x\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetFullSize" + }, { - "type": "api", - "name": "GetGlobalPosition", - "method": "", - "description": "获取控件全局坐标", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get text2 global position\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\ntextPosition = baseUIControl.GetGlobalPosition()" - }, + "remark": "", + "return": [], + "description": "获取控件全局坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get text2 global position\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\ntextPosition = baseUIControl.GetGlobalPosition()", + "params": [], + "type": "api", + "side": "client", + "name": "GetGlobalPosition" + }, { - "type": "api", - "name": "GetGlobalRotateAngle", - "method": "", - "description": "获取图片通过RotateAround函数设置进去的角度值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nprint imageControl.GetGlobalRotateAngle()" - }, + "remark": "", + "return": [], + "description": "获取图片通过RotateAround函数设置进去的角度值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nprint imageControl.GetGlobalRotateAngle()", + "params": [], + "type": "api", + "side": "client", + "name": "GetGlobalRotateAngle" + }, { - "type": "api", - "name": "GetGlobalRotatePoint", - "method": "", - "description": "获取图片通过RotateAround函数设置进去的point值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nprint imageControl.GetGlobalRotatePoint()" - }, + "remark": "", + "return": [], + "description": "获取图片通过RotateAround函数设置进去的point值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nprint imageControl.GetGlobalRotatePoint()", + "params": [], + "type": "api", + "side": "client", + "name": "GetGlobalRotatePoint" + }, { - "type": "api", - "name": "GetGridItem", - "method": "", - "description": "根据网格位置获取元素控件", - "remark": "- 获取网格子节点需要注意一些细节,详见《开发指南-界面与交互-UI说明文档》中对Grid控件的描述", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 获取网格子节点需要注意一些细节,详见《开发指南-界面与交互-UI说明文档》中对Grid控件的描述", + "return": [], + "description": "根据网格位置获取元素控件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get element positioned at (0, 0)\r\ngridPath = \"/grid1\"\r\ngridUIControl = uiNode.GetBaseUIControl(gridPath).asGrid()\r\ngridItem_0 = gridUIControl.GetGridItem(0, 0)\r\nif gridItem_0:\r\n print gridItem_0.GetSize()", "params": [ { - "name": "x", - "type": "int", + "type": "int", + "name": "x", "description": "元素在网格的横坐标" - }, + }, { - "name": "y", - "type": "int", + "type": "int", + "name": "y", "description": "元素在网格的纵坐标" } - ], - "return": [], - "example": "# we want to get element positioned at (0, 0)\r\ngridPath = \"/grid1\"\r\ngridUIControl = uiNode.GetBaseUIControl(gridPath).asGrid()\r\ngridItem_0 = gridUIControl.GetGridItem(0, 0)\r\nif gridItem_0:\r\n print gridItem_0.GetSize()" - }, + ], + "type": "api", + "side": "client", + "name": "GetGridItem" + }, { - "type": "api", - "name": "GetIsModal", - "method": "", - "description": "判断当前面板是否为模态框", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to know whether inputPanel1 isModal\r\ninputPanelPath = \"/inputPanel1\"\r\ninputPanel = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()\r\ninputPanel.GetIsModal()" - }, + "remark": "", + "return": [], + "description": "判断当前面板是否为模态框", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to know whether inputPanel1 isModal\r\ninputPanelPath = \"/inputPanel1\"\r\ninputPanel = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()\r\ninputPanel.GetIsModal()", + "params": [], + "type": "api", + "side": "client", + "name": "GetIsModal" + }, { - "type": "api", - "name": "GetIsSwallow", - "method": "", - "description": "判断当前面板输入是否会吞噬事件,isSwallow为Ture时,点击时,点击事件不会穿透到世界。如破坏方块、镜头转向不会被响应", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to know whether inputPanel1 isSwallow\r\ninputPanelPath = \"/inputPanel1\"\r\ninputPanel = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()\r\ninputPanel.GetIsSwallow()" - }, + "remark": "", + "return": [], + "description": "判断当前面板输入是否会吞噬事件,isSwallow为Ture时,点击时,点击事件不会穿透到世界。如破坏方块、镜头转向不会被响应", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to know whether inputPanel1 isSwallow\r\ninputPanelPath = \"/inputPanel1\"\r\ninputPanel = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()\r\ninputPanel.GetIsSwallow()", + "params": [], + "type": "api", + "side": "client", + "name": "GetIsSwallow" + }, { - "type": "api", - "name": "GetMaxSize", - "method": "", - "description": "获取控件所允许的最大的大小值", - "remark": "- 返回值为(0, 0)表示无限制", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get image1 maxSize\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nimageMaxSize = baseUIControl.GetMaxSize()" - }, + "remark": "- 返回值为(0, 0)表示无限制", + "return": [], + "description": "获取控件所允许的最大的大小值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get image1 maxSize\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nimageMaxSize = baseUIControl.GetMaxSize()", + "params": [], + "type": "api", + "side": "client", + "name": "GetMaxSize" + }, { - "type": "api", - "name": "GetMinSize", - "method": "", - "description": "获取控件所允许的最小的大小值", - "remark": "- 返回值为(0, 0)表示无限制", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get image1 minSize\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nimageMinSize = baseUIControl.GetMinSize()" - }, + "remark": "- 返回值为(0, 0)表示无限制", + "return": [], + "description": "获取控件所允许的最小的大小值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get image1 minSize\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nimageMinSize = baseUIControl.GetMinSize()", + "params": [], + "type": "api", + "side": "client", + "name": "GetMinSize" + }, { - "type": "api", - "name": "GetModelId", - "method": "", - "description": "获取渲染的骨骼模型Id", - "remark": "- 注意:请不要在RenderEntity/RenderSkeletonModel调用之后立即执行。\r\n 骨骼模型Id可用于一下情形:\r\n 1.绑定一个另外的骨骼模型;\r\n 2.绑定序列帧动画;\r\n 3.绑定特效粒子动画", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npath = '/demoPanel/paper_doll'\r\ndoll = uiNode.GetBaseUIControl(path).asNeteasePaperDoll()\r\nmodelId = doll.GetModelId()\r\nif modelId == -1:\r\n return\r\n#用途1:绑定一个另外的骨骼模型\r\nmodelComp = clientApi.GetEngineCompFactory().CreateModel(modelId)\r\nnewModelId = modelComp.BindModelToModel(\"rightHand\", \"gun\") # 把名称为gun的骨骼模型挂接到rightHand骨骼上\r\n#用途2:绑定序列帧动画\r\nsfxId = clientSystem.CreateEngineSfxFromEditor(\"effects/example_sfx.json\") # 创建特效\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniSkeletonBind(sfxId)\r\ncomp.Bind(modelId, \"root\", (0, 1, 0), (0, 0, 0)) # 把特效绑定到骨骼模型的骨骼节点上\r\nframeComp = clientApi.GetEngineCompFactory().CreateFrameAniControl(sfxId)\r\nframeComp.Play() # 播放动画\r\nclientSystem.DestroyEntity(sfxId) # 销毁动画\r\n#用途3:绑定特效粒子动画\r\nparticleEntityId = clientSystem.CreateEngineParticle(\"effects/example_particle.json\", (0,0,0)) # 创建特效\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSkeletonBind(particleEntityId)\r\ncomp.Bind(modelId, \"root\", (0, 1, 0), (0, 0, 0)) # 把特效绑定到骨骼模型的骨骼节点上\r\nparticleComp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\nparticleComp.Play() # 播放动画\r\nclientSystem.DestroyEntity(particleEntityId) # 销毁动画" - }, + "remark": "- 注意:请不要在RenderEntity/RenderSkeletonModel调用之后立即执行。\r\n 骨骼模型Id可用于一下情形:\r\n 1.绑定一个另外的骨骼模型;\r\n 2.绑定序列帧动画;\r\n 3.绑定特效粒子动画", + "return": [], + "description": "获取渲染的骨骼模型Id", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "import mod.client.extraClientApi as clientApi\r\npath = '/demoPanel/paper_doll'\r\ndoll = uiNode.GetBaseUIControl(path).asNeteasePaperDoll()\r\nmodelId = doll.GetModelId()\r\nif modelId == -1:\r\n return\r\n#用途1:绑定一个另外的骨骼模型\r\nmodelComp = clientApi.GetEngineCompFactory().CreateModel(modelId)\r\nnewModelId = modelComp.BindModelToModel(\"rightHand\", \"gun\") # 把名称为gun的骨骼模型挂接到rightHand骨骼上\r\n#用途2:绑定序列帧动画\r\nsfxId = clientSystem.CreateEngineSfxFromEditor(\"effects/example_sfx.json\") # 创建特效\r\ncomp = clientApi.GetEngineCompFactory().CreateFrameAniSkeletonBind(sfxId)\r\ncomp.Bind(modelId, \"root\", (0, 1, 0), (0, 0, 0)) # 把特效绑定到骨骼模型的骨骼节点上\r\nframeComp = clientApi.GetEngineCompFactory().CreateFrameAniControl(sfxId)\r\nframeComp.Play() # 播放动画\r\nclientSystem.DestroyEntity(sfxId) # 销毁动画\r\n#用途3:绑定特效粒子动画\r\nparticleEntityId = clientSystem.CreateEngineParticle(\"effects/example_particle.json\", (0,0,0)) # 创建特效\r\ncomp = clientApi.GetEngineCompFactory().CreateParticleSkeletonBind(particleEntityId)\r\ncomp.Bind(modelId, \"root\", (0, 1, 0), (0, 0, 0)) # 把特效绑定到骨骼模型的骨骼节点上\r\nparticleComp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\nparticleComp.Play() # 播放动画\r\nclientSystem.DestroyEntity(particleEntityId) # 销毁动画", + "params": [], + "type": "api", + "side": "client", + "name": "GetModelId" + }, { - "type": "api", - "name": "GetOffsetDelta", - "method": "", - "description": "获得点击面板的拖拽偏移量", - "remark": "- 点击面板拖拽功能及拖拽偏移量相关,详见InputPanel", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get inputPanel1's offset_delta\r\ninputPanelPath = \"/inputPanel1\"\r\ninputPanel = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()\r\noffset_delta = inputPanel.GetOffsetDelta()" - }, + "remark": "- 点击面板拖拽功能及拖拽偏移量相关,详见InputPanel", + "return": [], + "description": "获得点击面板的拖拽偏移量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get inputPanel1's offset_delta\r\ninputPanelPath = \"/inputPanel1\"\r\ninputPanel = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()\r\noffset_delta = inputPanel.GetOffsetDelta()", + "params": [], + "type": "api", + "side": "client", + "name": "GetOffsetDelta" + }, { - "type": "api", - "name": "GetOptionCount", - "method": "", - "description": "获得选项数量", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ntotalNum = comboBoxUIControl.GetOptionCount()" - }, + "remark": "", + "return": [], + "description": "获得选项数量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ntotalNum = comboBoxUIControl.GetOptionCount()", + "params": [], + "type": "api", + "side": "client", + "name": "GetOptionCount" + }, { - "type": "api", - "name": "GetOptionIndexByShowName", - "method": "", - "description": "根据展示文本查找对应下拉框项的索引位置,若找不到返回-1", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "根据展示文本查找对应下拉框项的索引位置,若找不到返回-1", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\nindex = comboBoxUIControl.GetOptionIndexByShowName(\"测试项\")", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "显示文本" } - ], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\nindex = comboBoxUIControl.GetOptionIndexByShowName(\"测试项\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetOptionIndexByShowName" + }, { - "type": "api", - "name": "GetOptionShowNameByIndex", - "method": "", - "description": "根据索引位置查找当前栈式文本,若找不到返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "根据索引位置查找当前栈式文本,若找不到返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ntext = comboBoxUIControl.GetOptionShowNameByIndex(0)", "params": [ { - "name": "index", - "type": "int", + "type": "int", + "name": "index", "description": "索引位置" } - ], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ntext = comboBoxUIControl.GetOptionShowNameByIndex(0)" - }, + ], + "type": "api", + "side": "client", + "name": "GetOptionShowNameByIndex" + }, { - "type": "api", - "name": "GetOrientation", - "method": "", - "description": "获取stackPanel的排列方向", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get stackPanel1 orientation\r\nstackPanelPath = \"/stackPanel1\"\r\nstackPanel = uiNode.GetBaseUIControl(stackPanelPath).asStackPanel()\r\nstackPanel.GetOrientation()" - }, + "remark": "", + "return": [], + "description": "获取stackPanel的排列方向", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get stackPanel1 orientation\r\nstackPanelPath = \"/stackPanel1\"\r\nstackPanel = uiNode.GetBaseUIControl(stackPanelPath).asStackPanel()\r\nstackPanel.GetOrientation()", + "params": [], + "type": "api", + "side": "client", + "name": "GetOrientation" + }, { - "type": "api", - "name": "GetPath", - "method": "", - "description": "返回当前控件的相对路径,路径从画布节点开始算起", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "text2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\npath = baseUIControl.GetPath()" - }, + "remark": "", + "return": [], + "description": "返回当前控件的相对路径,路径从画布节点开始算起", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "text2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\npath = baseUIControl.GetPath()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPath" + }, { - "type": "api", - "name": "GetPosition", - "method": "", - "description": "获取控件相对父节点的坐标", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get text2 position\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\ntextPosition = baseUIControl.GetPosition()" - }, + "remark": "", + "return": [], + "description": "获取控件相对父节点的坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get text2 position\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\ntextPosition = baseUIControl.GetPosition()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPosition" + }, { - "type": "api", - "name": "GetRotateAngle", - "method": "", - "description": "获取图片相对自身的旋转锚点旋转的角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nprint imageControl.GetRotateAngle()" - }, + "remark": "", + "return": [], + "description": "获取图片相对自身的旋转锚点旋转的角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nprint imageControl.GetRotateAngle()", + "params": [], + "type": "api", + "side": "client", + "name": "GetRotateAngle" + }, { - "type": "api", - "name": "GetRotatePivot", - "method": "", - "description": "获取图片相对自身的旋转锚点", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nprint imageControl.GetRotatePivot()" - }, + "remark": "", + "return": [], + "description": "获取图片相对自身的旋转锚点", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nprint imageControl.GetRotatePivot()", + "params": [], + "type": "api", + "side": "client", + "name": "GetRotatePivot" + }, { - "type": "api", - "name": "GetRotateRect", - "method": "", - "description": "获取图片当前的四个边角点", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nprint imageControl.GetRotateRect()" - }, + "remark": "", + "return": [], + "description": "获取图片当前的四个边角点", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nprint imageControl.GetRotateRect()", + "params": [], + "type": "api", + "side": "client", + "name": "GetRotateRect" + }, { - "type": "api", - "name": "GetScrollViewContentControl", - "method": "", - "description": "返回该scroll_view内容的BaseUIControl实例", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want get scroll_view content\r\nscrollViewPath = \"/scroll_view0\"\r\nscrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView()\r\ncontentUIControl = scrollViewUIControl.GetScrollViewContentControl()" - }, + "remark": "", + "return": [], + "description": "返回该scroll_view内容的BaseUIControl实例", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want get scroll_view content\r\nscrollViewPath = \"/scroll_view0\"\r\nscrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView()\r\ncontentUIControl = scrollViewUIControl.GetScrollViewContentControl()", + "params": [], + "type": "api", + "side": "client", + "name": "GetScrollViewContentControl" + }, { - "type": "api", - "name": "GetScrollViewContentPath", - "method": "", - "description": "返回该scroll_view内容的路径", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want get scroll_view content path\r\nscrollViewPath = \"/scroll_view0\"\r\nscrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView()\r\npath = scrollViewUIControl.GetScrollViewContentPath()" - }, + "remark": "", + "return": [], + "description": "返回该scroll_view内容的路径", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want get scroll_view content path\r\nscrollViewPath = \"/scroll_view0\"\r\nscrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView()\r\npath = scrollViewUIControl.GetScrollViewContentPath()", + "params": [], + "type": "api", + "side": "client", + "name": "GetScrollViewContentPath" + }, { - "type": "api", - "name": "GetScrollViewPercentValue", - "method": "", - "description": "获取当前scroll_view内容的百分比位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want get scroll_view percent\r\nscrollViewPath = \"/scroll_view0\"\r\nscrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView()\r\nscrollViewUIControl.GetScrollViewPercentValue()" - }, + "remark": "", + "return": [], + "description": "获取当前scroll_view内容的百分比位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want get scroll_view percent\r\nscrollViewPath = \"/scroll_view0\"\r\nscrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView()\r\nscrollViewUIControl.GetScrollViewPercentValue()", + "params": [], + "type": "api", + "side": "client", + "name": "GetScrollViewPercentValue" + }, { - "type": "api", - "name": "GetScrollViewPos", - "method": "", - "description": "获得当前scroll_view最上方内容的位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want get scroll_view pos\r\nscrollViewPath = \"/scroll_view0\"\r\nscrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView()\r\nscrollViewUIControl.GetScrollViewPos()" - }, + "remark": "", + "return": [], + "description": "获得当前scroll_view最上方内容的位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want get scroll_view pos\r\nscrollViewPath = \"/scroll_view0\"\r\nscrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView()\r\nscrollViewUIControl.GetScrollViewPos()", + "params": [], + "type": "api", + "side": "client", + "name": "GetScrollViewPos" + }, { - "type": "api", - "name": "GetSelectOptionIndex", - "method": "", - "description": "获得当前选中项的索引,所无选中项则返回-1", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncurrentIndex = comboBoxUIControl.GetSelectOptionIndex()" - }, + "remark": "", + "return": [], + "description": "获得当前选中项的索引,所无选中项则返回-1", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncurrentIndex = comboBoxUIControl.GetSelectOptionIndex()", + "params": [], + "type": "api", + "side": "client", + "name": "GetSelectOptionIndex" + }, { - "type": "api", - "name": "GetSelectOptionShowName", - "method": "", - "description": "获得当前选中项的展示文本,所无选中项则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncurrentText = comboBoxUIControl.GetSelectOptionShowName()" - }, + "remark": "", + "return": [], + "description": "获得当前选中项的展示文本,所无选中项则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncurrentText = comboBoxUIControl.GetSelectOptionShowName()", + "params": [], + "type": "api", + "side": "client", + "name": "GetSelectOptionShowName" + }, { - "type": "api", - "name": "GetSize", - "method": "", - "description": "获取控件的大小", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get text2 size\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\ntext2Size = baseUIControl.GetSize()" - }, + "remark": "", + "return": [], + "description": "获取控件的大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get text2 size\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\ntext2Size = baseUIControl.GetSize()", + "params": [], + "type": "api", + "side": "client", + "name": "GetSize" + }, { - "type": "api", - "name": "GetSliceCount", - "method": "", - "description": "获取轮盘可以选择的总切片数量", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "selectionWheelPath = \"/selectionWheel\"\r\nselectionWheelControl = uiNode.GetBaseUIControl(selectionWheelPath).asSelectionWheel()\r\nselectionWheelControl.GetSliceCount()" - }, + "remark": "", + "return": [], + "description": "获取轮盘可以选择的总切片数量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "selectionWheelPath = \"/selectionWheel\"\r\nselectionWheelControl = uiNode.GetBaseUIControl(selectionWheelPath).asSelectionWheel()\r\nselectionWheelControl.GetSliceCount()", + "params": [], + "type": "api", + "side": "client", + "name": "GetSliceCount" + }, { - "type": "api", - "name": "GetSliderValue", - "method": "", - "description": "获取滑动条的值,失败返回0", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get slider value\r\nsliderPath = \"/panel/slider0\"\r\nsliderUIControl = uiNode.GetBaseUIControl(sliderPath).asSlider()\r\nvalue = sliderUIControl.GetSliderValue()" - }, + "remark": "", + "return": [], + "description": "获取滑动条的值,失败返回0", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get slider value\r\nsliderPath = \"/panel/slider0\"\r\nsliderUIControl = uiNode.GetBaseUIControl(sliderPath).asSlider()\r\nvalue = sliderUIControl.GetSliderValue()", + "params": [], + "type": "api", + "side": "client", + "name": "GetSliderValue" + }, { - "type": "api", - "name": "GetText", - "method": "", - "description": "获取Label的文本信息,获取失败会返回None", - "remark": "- 获取失败通常是由于路径填写错误,或该控件不是Label类型", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get text2 content\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.GetText()" - }, + "remark": "- 获取失败通常是由于路径填写错误,或该控件不是Label类型", + "return": [], + "description": "获取Label的文本信息,获取失败会返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get text2 content\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.GetText()", + "params": [], + "type": "api", + "side": "client", + "name": "GetText" + }, { - "type": "api", - "name": "GetTextAlignment", - "method": "", - "description": "获取文本控件的文本对齐方式", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get text2 textAlignment\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.GetTextAlignment()" - }, + "remark": "", + "return": [], + "description": "获取文本控件的文本对齐方式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get text2 textAlignment\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.GetTextAlignment()", + "params": [], + "type": "api", + "side": "client", + "name": "GetTextAlignment" + }, { - "type": "api", - "name": "GetTextColor", - "method": "", - "description": "获取Label文本颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get text2 color\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.GetTextColor()" - }, + "remark": "", + "return": [], + "description": "获取Label文本颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get text2 color\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.GetTextColor()", + "params": [], + "type": "api", + "side": "client", + "name": "GetTextColor" + }, { - "type": "api", - "name": "GetTextLinePadding", - "method": "", - "description": "获取文本控件的行间距", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to get text2 textLinePadding\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.GetTextLinePadding()" - }, + "remark": "", + "return": [], + "description": "获取文本控件的行间距", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to get text2 textLinePadding\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.GetTextLinePadding()", + "params": [], + "type": "api", + "side": "client", + "name": "GetTextLinePadding" + }, { - "type": "api", - "name": "GetToggleState", - "method": "", - "description": "获取Toggle开关控件的状态", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "获取Toggle开关控件的状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "togglePath = \"/toggle1\"\r\nswitchToggleUIControl = uiNode.GetBaseUIControl(togglePath).asSwitchToggle()\r\nprint switchToggleUIControl.GetToggleState()", "params": [ { - "name": "toggle_path", - "type": "str", + "type": "str", + "name": "toggle_path", "description": "实际toggle控件相对路径,由UI编辑器生成的开关控件该参数即为默认值\"/this_toggle\"" } - ], - "return": [], - "example": "togglePath = \"/toggle1\"\r\nswitchToggleUIControl = uiNode.GetBaseUIControl(togglePath).asSwitchToggle()\r\nprint switchToggleUIControl.GetToggleState()" - }, + ], + "type": "api", + "side": "client", + "name": "GetToggleState" + }, { - "type": "api", - "name": "GetUiItem", - "method": "", - "description": "获取ItemRenderer控件显示的物品,ItemRenderer控件的配置方式详见控件介绍ItemRenderer", - "remark": "- 返回值具体如下:\r\n | 键值 | 类型 | 内容 |\r\n | ----------------| -------------| ---------------------|\r\n | \"itemName\" | str | 物品identifier |\r\n | \"auxValue\" | int | 物品附加值 |\r\n | \"isEnchanted\" | bool | 是否显示附魔效果 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "#获取木板block信息\r\nitemRenderPath = \"/panel/item_renderer\"\r\nitemRendererBaseControl = uiNode.GetBaseUIControl(itemRenderPath)\r\nitemRendererControl = itemRendererBaseControl.asItemRenderer()\r\nitemInfoDict = itemRendererControl.GetUiItem()" - }, + "remark": "- 返回值具体如下:\r\n | 键值 | 类型 | 内容 |\r\n | ----------------| -------------| ---------------------|\r\n | \"itemName\" | str | 物品identifier |\r\n | \"auxValue\" | int | 物品附加值 |\r\n | \"isEnchanted\" | bool | 是否显示附魔效果 |", + "return": [], + "description": "获取ItemRenderer控件显示的物品,ItemRenderer控件的配置方式详见控件介绍ItemRenderer", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "#获取木板block信息\r\nitemRenderPath = \"/panel/item_renderer\"\r\nitemRendererBaseControl = uiNode.GetBaseUIControl(itemRenderPath)\r\nitemRendererControl = itemRendererBaseControl.asItemRenderer()\r\nitemInfoDict = itemRendererControl.GetUiItem()", + "params": [], + "type": "api", + "side": "client", + "name": "GetUiItem" + }, { - "type": "api", - "name": "GetVisible", - "method": "", - "description": "根据控件路径返回某控件是否已显示", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# 我们获得panel下面的text2是否显示\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\ntextVisible = baseUIControl.GetVisible()" - }, + "remark": "", + "return": [], + "description": "根据控件路径返回某控件是否已显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 我们获得panel下面的text2是否显示\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\ntextVisible = baseUIControl.GetVisible()", + "params": [], + "type": "api", + "side": "client", + "name": "GetVisible" + }, { - "type": "api", - "name": "IsAnimEndCallbackRegistered", - "method": "", - "description": "控件是否对名称为animName的动画进行了注册回调", - "remark": "- UI属性动画相关,详见属性动画", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- UI属性动画相关,详见属性动画", + "return": [], + "description": "控件是否对名称为animName的动画进行了注册回调", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\nprint control.IsAnimEndCallbackRegistered(\"offset_animation\")", "params": [ { - "name": "animName", - "type": "str", + "type": "str", + "name": "animName", "description": "动画的名称,请不要包含动画的命名空间" } - ], - "return": [], - "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\nprint control.IsAnimEndCallbackRegistered(\"offset_animation\")" - }, + ], + "type": "api", + "side": "client", + "name": "IsAnimEndCallbackRegistered" + }, { - "type": "api", - "name": "IsTextShadowEnabled", - "method": "", - "description": "判断文本控件是否显示阴影", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# we want to know whether text2 has shadow\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.IsTextShadowEnabled()" - }, + "remark": "", + "return": [], + "description": "判断文本控件是否显示阴影", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to know whether text2 has shadow\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.IsTextShadowEnabled()", + "params": [], + "type": "api", + "side": "client", + "name": "IsTextShadowEnabled" + }, { - "type": "api", - "name": "PauseAnimation", - "method": "", - "description": "暂停动画,暂停后的动画会停在当前的状态", - "remark": "- UI属性动画相关,详见属性动画", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- UI属性动画相关,详见属性动画", + "return": [], + "description": "暂停动画,暂停后的动画会停在当前的状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n# 暂停所有动画\r\ncontrol.PauseAnimation()\r\n# 暂停尺寸动画\r\n# control.PauseAnimation(\"size\")\r\n# 暂停位移动画\r\n# control.PauseAnimation(\"offset\")\r\n# 其他属性也是支持暂停的,具体可参见备注", "params": [ { - "name": "propertyName", - "type": "str", + "type": "str", + "name": "propertyName", "description": "动画的属性名称,默认值为\"all\",表示暂停所有动画,不为\"all\"的时候表示单个动画的暂停,比如propertyName==\"size\"时,表示暂停尺寸属性上的动画" } - ], - "return": [], - "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n# 暂停所有动画\r\ncontrol.PauseAnimation()\r\n# 暂停尺寸动画\r\n# control.PauseAnimation(\"size\")\r\n# 暂停位移动画\r\n# control.PauseAnimation(\"offset\")\r\n# 其他属性也是支持暂停的,具体可参见备注" - }, + ], + "type": "api", + "side": "client", + "name": "PauseAnimation" + }, { - "type": "api", - "name": "PlayAnimation", - "method": "", - "description": "继续播放动画,从动画当前状态开始播放", - "remark": "- UI属性动画相关,详见属性动画", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- UI属性动画相关,详见属性动画", + "return": [], + "description": "继续播放动画,从动画当前状态开始播放", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n# 播放所有动画\r\ncontrol.PlayAnimation()\r\n# 播放尺寸动画\r\n# control.PlayAnimation(\"size\")\r\n# 播放位移动画\r\n# control.PlayAnimation(\"offset\")\r\n# 其他属性也是支持播放的,具体可参见备注", "params": [ { - "name": "propertyName", - "type": "str", + "type": "str", + "name": "propertyName", "description": "动画的属性名称,默认值为\"all\",表示播放所有动画,不为\"all\"的时候表示单个动画的播放,比如propertyName==\"size\"时,表示播放尺寸属性上的动画" } - ], - "return": [], - "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n# 播放所有动画\r\ncontrol.PlayAnimation()\r\n# 播放尺寸动画\r\n# control.PlayAnimation(\"size\")\r\n# 播放位移动画\r\n# control.PlayAnimation(\"offset\")\r\n# 其他属性也是支持播放的,具体可参见备注" - }, + ], + "type": "api", + "side": "client", + "name": "PlayAnimation" + }, { - "type": "api", - "name": "RegisterCloseComboBoxCallback", - "method": "", - "description": "注册关闭下拉框事件回调", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "注册关闭下拉框事件回调", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 注册关闭下拉框事件回调,在点击关闭下拉框时会调用注册的回调函数\r\ndef onCloseComboBoxCallback(args):\r\n pass\r\n\r\ncomboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.RegisterCloseComboBoxCallback(onCloseComboBoxCallback)", "params": [ { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "回调函数,必须是UI的类函数" } - ], - "return": [], - "example": "# 注册关闭下拉框事件回调,在点击关闭下拉框时会调用注册的回调函数\r\ndef onCloseComboBoxCallback(args):\r\n pass\r\n\r\ncomboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.RegisterCloseComboBoxCallback(onCloseComboBoxCallback)" - }, + ], + "type": "api", + "side": "client", + "name": "RegisterCloseComboBoxCallback" + }, { - "type": "api", - "name": "RegisterOpenComboBoxCallback", - "method": "", - "description": "注册展开下拉框事件回调", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "注册展开下拉框事件回调", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 注册展开下拉框事件回调,在点击展开下拉框时会调用注册的回调函数\r\ndef onOpenComboBoxCallback(args):\r\n pass\r\n\r\ncomboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.RegisterOpenComboBoxCallback(onOpenComboBoxCallback)", "params": [ { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "回调函数,必须是UI的类函数" } - ], - "return": [], - "example": "# 注册展开下拉框事件回调,在点击展开下拉框时会调用注册的回调函数\r\ndef onOpenComboBoxCallback(args):\r\n pass\r\n\r\ncomboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.RegisterOpenComboBoxCallback(onOpenComboBoxCallback)" - }, + ], + "type": "api", + "side": "client", + "name": "RegisterOpenComboBoxCallback" + }, { - "type": "api", - "name": "RegisterSelectItemCallback", - "method": "", - "description": "注册选中下拉框内容事件回调", - "remark": "- onSelectItemCallback参数说明:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | index | int | 当前选中项的索引 |\r\n | showName | str | 当前选中项的显示文本 |\r\n | userData | Unknown | 当前选中项的自定义数据,若添加下拉框项时未传入自定义数据则此处为None |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- onSelectItemCallback参数说明:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | index | int | 当前选中项的索引 |\r\n | showName | str | 当前选中项的显示文本 |\r\n | userData | Unknown | 当前选中项的自定义数据,若添加下拉框项时未传入自定义数据则此处为None |", + "return": [], + "description": "注册选中下拉框内容事件回调", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 注册选中下拉框内容事件回调,在点击关闭下拉框时会调用注册的回调函数\r\ndef onSelectItemCallback(index, showName, userData):\r\n pass\r\n\r\ncomboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.RegisterSelectItemCallback(onSelectItemCallback)", "params": [ { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "回调函数,必须是UI的类函数" } - ], - "return": [], - "example": "# 注册选中下拉框内容事件回调,在点击关闭下拉框时会调用注册的回调函数\r\ndef onSelectItemCallback(index, showName, userData):\r\n pass\r\n\r\ncomboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.RegisterSelectItemCallback(onSelectItemCallback)" - }, + ], + "type": "api", + "side": "client", + "name": "RegisterSelectItemCallback" + }, { - "type": "api", - "name": "RemoveAnimEndCallback", - "method": "", - "description": "移除动画播放结束后的回调", - "remark": "- UI属性动画相关,详见属性动画", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- UI属性动画相关,详见属性动画", + "return": [], + "description": "移除动画播放结束后的回调", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n# 移除属性动画offset_animation播放结束后的回调\r\ncontrol.RemoveAnimEndCallback(\"offset_animation\")", "params": [ { - "name": "animName", - "type": "str", + "type": "str", + "name": "animName", "description": "动画的名称,请不要包含动画的命名空间" } - ], - "return": [], - "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n# 移除属性动画offset_animation播放结束后的回调\r\ncontrol.RemoveAnimEndCallback(\"offset_animation\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveAnimEndCallback" + }, { - "type": "api", - "name": "RemoveAnimation", - "method": "", - "description": "删除单一属性的动画,删除后的值与当前状态有关,建议删除后重新设置该属性值", - "remark": "- UI属性动画相关,详见属性动画", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- UI属性动画相关,详见属性动画", + "return": [], + "description": "删除单一属性的动画,删除后的值与当前状态有关,建议删除后重新设置该属性值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n# 删除 位移 属性上的动画\r\ncontrol.RemoveAnimation(\"offset\")", "params": [ { - "name": "propertyName", - "type": "str", + "type": "str", + "name": "propertyName", "description": "要删除动画的属性名称,无默认值,值必须为单一属性(不能填\"all\")" } - ], - "return": [], - "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n# 删除 位移 属性上的动画\r\ncontrol.RemoveAnimation(\"offset\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveAnimation" + }, { - "type": "api", - "name": "RemoveEntityMarker", - "method": "", - "description": "删除实体位置标记", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "删除实体位置标记", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.RemoveEntityMarker(entityId)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体Id" } - ], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.RemoveEntityMarker(entityId)" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveEntityMarker" + }, { - "type": "api", - "name": "RemoveEntityTextMarker", - "method": "", - "description": "在小地图上删除实体文本标记", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "在小地图上删除实体文本标记", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.RemoveEntityTextMarker(entityId)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体Id" } - ], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.RemoveEntityTextMarker(entityId)" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveEntityTextMarker" + }, { - "type": "api", - "name": "RemoveOptionByIndex", - "method": "", - "description": "根据提供的索引移除对应下拉框项,移除成功则返回True,否则返回False", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "根据提供的索引移除对应下拉框项,移除成功则返回True,否则返回False", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\nsuccess = comboBoxUIControl.RemoveOptionByIndex(0)", "params": [ { - "name": "index", - "type": "int", + "type": "int", + "name": "index", "description": "索引" } - ], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\nsuccess = comboBoxUIControl.RemoveOptionByIndex(0)" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveOptionByIndex" + }, { - "type": "api", - "name": "RemoveOptionByShowName", - "method": "", - "description": "根据提供的展示文本移除对应下拉框项,移除成功则返回True,否则返回False", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "根据提供的展示文本移除对应下拉框项,移除成功则返回True,否则返回False", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\nsuccess = comboBoxUIControl.RemoveOptionByShowName(\"测试项\")", "params": [ { - "name": "showName", - "type": "str", + "type": "str", + "name": "showName", "description": "展示文本" } - ], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\nsuccess = comboBoxUIControl.RemoveOptionByShowName(\"测试项\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveOptionByShowName" + }, { - "type": "api", - "name": "RemoveStaticMarker", - "method": "", - "description": "删除静态位置标记", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "删除静态位置标记", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.RemoveStaticMarker(entityId)", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "标记的Id" } - ], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.RemoveStaticMarker(entityId)" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveStaticMarker" + }, { - "type": "api", - "name": "RemoveStaticTextMarker", - "method": "", - "description": "在小地图上删除静态文本标记", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "在小地图上删除静态文本标记", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.RemoveStaticTextMarker(\"this_is_marker_key\")", "params": [ { - "name": "key", - "type": "str", + "type": "str", + "name": "key", "description": "标记Id" } - ], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.RemoveStaticTextMarker(\"this_is_marker_key\")" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveStaticTextMarker" + }, { - "type": "api", - "name": "RenderBlockGeometryModel", - "method": "", - "description": "渲染网格体模型", - "remark": "- 网格体模型使用[CombineBlockPaletteToGeometry](../方块/方块几何体模型.md#combineblockpalettetogeometry)生成\r\n - 每次进入游戏需要重新调用本接口渲染网格体模型,可使用[SerializeBlockPalette](../方块/方块调色板.md#serializeblockpalette)和[DeserializeBlockPalette](../方块/方块调色板.md#deserializeblockpalette)实现调色板保存并重载调色板,重新生成网格体模型进行渲染。\r\n - RenderBlockGeometryModel参数params说明:\r\n params参数解释如下:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | block_geometry_model_name | str | 网格体模型名称, 可用CombineBlockPaletteToGeometry返回值 | |\r\n | scale | float | 渲染缩放比例,默认为1.0 | |\r\n | init_rot_y | float | 初始Y方向的朝向 |\r\n | init_rot_x | float | 初始x方向的朝向 |\r\n | init_rot_z | float | 初始z方向的朝向 |\r\n | molang_dict | dict | molang表达式字典,其中key为str,value为float |\r\n | rotation_axis | tuple | 选择旋转环绕的轴,如(0,1,0)依次代表x、y、z轴,此为绕y轴旋转,该属性只在netease_paper_doll_renderer控件的rotation属性为“freedom_gesture”时起效 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 网格体模型使用[CombineBlockPaletteToGeometry](../方块/方块几何体模型.md#combineblockpalettetogeometry)生成\r\n - 每次进入游戏需要重新调用本接口渲染网格体模型,可使用[SerializeBlockPalette](../方块/方块调色板.md#serializeblockpalette)和[DeserializeBlockPalette](../方块/方块调色板.md#deserializeblockpalette)实现调色板保存并重载调色板,重新生成网格体模型进行渲染。\r\n - RenderBlockGeometryModel参数params说明:\r\n params参数解释如下:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | block_geometry_model_name | str | 网格体模型名称, 可用CombineBlockPaletteToGeometry返回值 | |\r\n | scale | float | 渲染缩放比例,默认为1.0 | |\r\n | init_rot_y | float | 初始Y方向的朝向 |\r\n | init_rot_x | float | 初始x方向的朝向 |\r\n | init_rot_z | float | 初始z方向的朝向 |\r\n | molang_dict | dict | molang表达式字典,其中key为str,value为float |\r\n | rotation_axis | tuple | 选择旋转环绕的轴,如(0,1,0)依次代表x、y、z轴,此为绕y轴旋转,该属性只在netease_paper_doll_renderer控件的rotation属性为“freedom_gesture”时起效 |", + "return": [], + "description": "渲染网格体模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "import mod.client.extraClientApi as clientApi\r\npath = '/demoPanel/paper_doll'\r\nparam = {\r\n \"block_geometry_model_name\": \"my_geometry_model\",\r\n \"scale\": 0.5,\r\n \"init_rot_y\": 60,\r\n \"rotation_axis\":(0,1,1),\r\n \"molang_dict\": {\"variable.liedownamount\": 1}\r\n}\r\ndoll = uiNode.GetBaseUIControl(path).asNeteasePaperDoll()\r\ndoll.RenderBlockGeometryModel(param)", "params": [ { - "name": "params", - "type": "dict", + "type": "dict", + "name": "params", "description": "渲染参数,详细说明请见备注" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npath = '/demoPanel/paper_doll'\r\nparam = {\r\n \"block_geometry_model_name\": \"my_geometry_model\",\r\n \"scale\": 0.5,\r\n \"init_rot_y\": 60,\r\n \"rotation_axis\":(0,1,1),\r\n \"molang_dict\": {\"variable.liedownamount\": 1}\r\n}\r\ndoll = uiNode.GetBaseUIControl(path).asNeteasePaperDoll()\r\ndoll.RenderBlockGeometryModel(param)" - }, + ], + "type": "api", + "side": "client", + "name": "RenderBlockGeometryModel" + }, { - "type": "api", - "name": "RenderEntity", - "method": "", - "description": "渲染实体", - "remark": "- RenderEntity参数params说明:\r\n params参数解释如下:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | entity_id | str | 渲染生物的实体Id,与实体的identifier二者选其一即可。如果与entity_identifier同时定义,则优先使用entity_id。 |\r\n | entity_identifier | str | 渲染生物的identifier,与实体Id二者选其一即可。如果与entity_id同时定义,则优先使用entity_id。 |\r\n | scale | float | 渲染缩放比例,默认为1.0 |\r\n | render_depth | int | 渲染深度,对于玩家默认-50,普通生物-15,该参数可解决UI遮挡剔除问题 |\r\n | init_rot_y | float | 初始Y方向的朝向 |\r\n | init_rot_x | float | 初始x方向的朝向 |\r\n | init_rot_z | float | 初始z方向的朝向 |\r\n | molang_dict | dict | molang表达式字典,其中key为str,value为float |\r\n | rotation_axis | tuple | 选择旋转环绕的轴,如(0,1,0)依次代表x、y、z轴,此为绕y轴旋转,该属性只在netease_paper_doll_renderer控件的rotation属性为“freedom_gesture”时起效 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- RenderEntity参数params说明:\r\n params参数解释如下:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | entity_id | str | 渲染生物的实体Id,与实体的identifier二者选其一即可。如果与entity_identifier同时定义,则优先使用entity_id。 |\r\n | entity_identifier | str | 渲染生物的identifier,与实体Id二者选其一即可。如果与entity_id同时定义,则优先使用entity_id。 |\r\n | scale | float | 渲染缩放比例,默认为1.0 |\r\n | render_depth | int | 渲染深度,对于玩家默认-50,普通生物-15,该参数可解决UI遮挡剔除问题 |\r\n | init_rot_y | float | 初始Y方向的朝向 |\r\n | init_rot_x | float | 初始x方向的朝向 |\r\n | init_rot_z | float | 初始z方向的朝向 |\r\n | molang_dict | dict | molang表达式字典,其中key为str,value为float |\r\n | rotation_axis | tuple | 选择旋转环绕的轴,如(0,1,0)依次代表x、y、z轴,此为绕y轴旋转,该属性只在netease_paper_doll_renderer控件的rotation属性为“freedom_gesture”时起效 |", + "return": [], + "description": "渲染实体", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = '/demoPanel/paper_doll'\r\n# 使用entity_id进行渲染\r\nparam = {\r\n \"entity_id\": \"-8589934591\",\r\n \"scale\": 0.5,\r\n \"render_depth\": -50,\r\n \"init_rot_y\": 60,\r\n \"rotation_axis\":(0,1,1),\r\n \"molang_dict\": {\"variable.liedownamount\": 1}\r\n}\r\ndoll = uiNode.GetBaseUIControl(path).asNeteasePaperDoll()\r\ndoll.RenderEntity(param)\r\n# 使用identifier进行渲染\r\nparam = {\r\n \"entity_identifier\": \"minecraft:cow\",\r\n \"scale\": 0.5,\r\n \"render_depth\": -50,\r\n \"init_rot_y\": 60,\r\n \"rotation_axis\":(0,1,1),\r\n \"molang_dict\": {\"variable.liedownamount\": 1}\r\n}\r\ndoll = uiNode.GetBaseUIControl(path).asNeteasePaperDoll()\r\ndoll.RenderEntity(param)", "params": [ { - "name": "params", - "type": "dict", + "type": "dict", + "name": "params", "description": "渲染参数,详细说明请见备注" } - ], - "return": [], - "example": "path = '/demoPanel/paper_doll'\r\n# 使用entity_id进行渲染\r\nparam = {\r\n \"entity_id\": \"-8589934591\",\r\n \"scale\": 0.5,\r\n \"render_depth\": -50,\r\n \"init_rot_y\": 60,\r\n \"rotation_axis\":(0,1,1),\r\n \"molang_dict\": {\"variable.liedownamount\": 1}\r\n}\r\ndoll = uiNode.GetBaseUIControl(path).asNeteasePaperDoll()\r\ndoll.RenderEntity(param)\r\n# 使用identifier进行渲染\r\nparam = {\r\n \"entity_identifier\": \"minecraft:cow\",\r\n \"scale\": 0.5,\r\n \"render_depth\": -50,\r\n \"init_rot_y\": 60,\r\n \"rotation_axis\":(0,1,1),\r\n \"molang_dict\": {\"variable.liedownamount\": 1}\r\n}\r\ndoll = uiNode.GetBaseUIControl(path).asNeteasePaperDoll()\r\ndoll.RenderEntity(param)" - }, + ], + "type": "api", + "side": "client", + "name": "RenderEntity" + }, { - "type": "api", - "name": "RenderSkeletonModel", - "method": "", - "description": "渲染骨骼模型(不依赖实体)", - "remark": "- RenderSkeletonModel参数params说明:\r\n params参数解释如下:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | skeleton_model_name | str | 骨骼模型名称 |\r\n | animation | str | 骨骼动作名称,默认为idle |\r\n | animation_looped | bool | 骨骼动作是否循环播放,默认True |\r\n | scale | float | 渲染缩放比例,默认为1.0 |\r\n | render_depth | int | 渲染深度,对于玩家默认-50,普通生物-15,该参数可解决UI遮挡剔除问题 |\r\n | init_rot_y | float | 初始Y方向的朝向 |\r\n | init_rot_x | float | 初始x方向的朝向 |\r\n | init_rot_z | float | 初始z方向的朝向 |\r\n | molang_dict | dict | molang表达式字典,其中key为str,value为float |\r\n | rotation_axis | tuple | 选择旋转环绕的轴,如(0,1,0)依次代表x、y、z轴,此为绕y轴旋转,该属性只在netease_paper_doll_renderer控件的rotation属性为“freedom_gesture”时起效 |\r\n | light_direction | tuple | 可选参数。控制骨骼模型在纸娃娃中显示时的光照方向,x控制光照的左右方向,y控制光照的上下方向,z控制光照的前后方向,取值为-1,0,1。不填写该参数时模型默认从底部打光。该属性仅对没有自定义材质的骨骼模型生效。如果该骨骼模型定义了自定义材质,则无效。如需要对使用自定义材质的骨骼模型控制其光照方向,可以参考官方骨骼模型vertex shader中getLightColor使用到HIDE_COLOR的这部分代码。该参数对部分安卓低端设备,极低端设备无效。 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- RenderSkeletonModel参数params说明:\r\n params参数解释如下:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | skeleton_model_name | str | 骨骼模型名称 |\r\n | animation | str | 骨骼动作名称,默认为idle |\r\n | animation_looped | bool | 骨骼动作是否循环播放,默认True |\r\n | scale | float | 渲染缩放比例,默认为1.0 |\r\n | render_depth | int | 渲染深度,对于玩家默认-50,普通生物-15,该参数可解决UI遮挡剔除问题 |\r\n | init_rot_y | float | 初始Y方向的朝向 |\r\n | init_rot_x | float | 初始x方向的朝向 |\r\n | init_rot_z | float | 初始z方向的朝向 |\r\n | molang_dict | dict | molang表达式字典,其中key为str,value为float |\r\n | rotation_axis | tuple | 选择旋转环绕的轴,如(0,1,0)依次代表x、y、z轴,此为绕y轴旋转,该属性只在netease_paper_doll_renderer控件的rotation属性为“freedom_gesture”时起效 |\r\n | light_direction | tuple | 可选参数。控制骨骼模型在纸娃娃中显示时的光照方向,x控制光照的左右方向,y控制光照的上下方向,z控制光照的前后方向,取值为-1,0,1。不填写该参数时模型默认从底部打光。该属性仅对没有自定义材质的骨骼模型生效。如果该骨骼模型定义了自定义材质,则无效。如需要对使用自定义材质的骨骼模型控制其光照方向,可以参考官方骨骼模型vertex shader中getLightColor使用到HIDE_COLOR的这部分代码。该参数对部分安卓低端设备,极低端设备无效。 |", + "return": [], + "description": "渲染骨骼模型(不依赖实体)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "import mod.client.extraClientApi as clientApi\r\npath = '/demoPanel/paper_doll'\r\nparam = {\r\n \"skeleton_model_name\": \"ty_yuanshenghuli_0_0\",\r\n \"animation\": \"idle_stand\",\r\n \"scale\": 0.5,\r\n \"render_depth\": -50,\r\n \"init_rot_y\": 60,\r\n \"rotation_axis\":(0,1,1),\r\n \"molang_dict\": {\"variable.liedownamount\": 1},\r\n # 控制光照方向为从模型的正右边往左边打光,以及从模型的正前方往后打光\r\n \"light_direction\": ( 1.0, 0.0, 1.0 )\r\n}\r\ndoll = uiNode.GetBaseUIControl(path).asNeteasePaperDoll()\r\ndoll.RenderSkeletonModel(param)", "params": [ { - "name": "params", - "type": "dict", + "type": "dict", + "name": "params", "description": "渲染参数,详细说明请见备注" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\npath = '/demoPanel/paper_doll'\r\nparam = {\r\n \"skeleton_model_name\": \"ty_yuanshenghuli_0_0\",\r\n \"animation\": \"idle_stand\",\r\n \"scale\": 0.5,\r\n \"render_depth\": -50,\r\n \"init_rot_y\": 60,\r\n \"rotation_axis\":(0,1,1),\r\n \"molang_dict\": {\"variable.liedownamount\": 1},\r\n # 控制光照方向为从模型的正右边往左边打光,以及从模型的正前方往后打光\r\n \"light_direction\": ( 1.0, 0.0, 1.0 )\r\n}\r\ndoll = uiNode.GetBaseUIControl(path).asNeteasePaperDoll()\r\ndoll.RenderSkeletonModel(param)" - }, + ], + "type": "api", + "side": "client", + "name": "RenderSkeletonModel" + }, { - "type": "api", - "name": "RepaintMiniMap", - "method": "", - "description": "重新绘制小地图", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.RepaintMiniMap()" - }, + "remark": "", + "return": [], + "description": "重新绘制小地图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.RepaintMiniMap()", + "params": [], + "type": "api", + "side": "client", + "name": "RepaintMiniMap" + }, { - "type": "api", - "name": "Rotate", - "method": "", - "description": "图片相对自身的旋转锚点进行旋转", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "图片相对自身的旋转锚点进行旋转", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageControl.Rotate(30)", "params": [ { - "name": "angle", - "type": "float", + "type": "float", + "name": "angle", "description": "旋转角度" } - ], - "return": [], - "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageControl.Rotate(30)" - }, + ], + "type": "api", + "side": "client", + "name": "Rotate" + }, { - "type": "api", - "name": "RotateAround", - "method": "", - "description": "图片相对全局坐标系中某个固定的点进行旋转", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "图片相对全局坐标系中某个固定的点进行旋转", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageControl.RotateAround((50, 50), 30)", "params": [ { - "name": "point", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "point", "description": "全局坐标点" - }, + }, { - "name": "angle", - "type": "float", + "type": "float", + "name": "angle", "description": "旋转角度" } - ], - "return": [], - "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageControl.RotateAround((50, 50), 30)" - }, + ], + "type": "api", + "side": "client", + "name": "RotateAround" + }, { - "type": "api", - "name": "SetAlpha", - "method": "", - "description": "设置节点的透明度,仅对image和label控件生效", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置节点的透明度,仅对image和label控件生效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 设置text2的透明度为半透明\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\nbaseUIControl.SetAlpha(0.5)", "params": [ { - "name": "alpha", - "type": "float", + "type": "float", + "name": "alpha", "description": "透明度,取值0-1之间,0表示完全透明,1表示完全不透明" } - ], - "return": [], - "example": "# 设置text2的透明度为半透明\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\nbaseUIControl.SetAlpha(0.5)" - }, + ], + "type": "api", + "side": "client", + "name": "SetAlpha" + }, { - "type": "api", - "name": "SetAnchorFrom", - "method": "", - "description": "设置控件相对于父节点的锚点", - "remark": "- anchorFrom可选的值\r\n | 值 | 解释 |\r\n | ----------------| ------------------------------------------------------------ |\r\n | \"top_left\" | 相对于父节点的左上角 |\r\n | \"top_middle\" | 相对于父节点的上边中间 |\r\n | \"top_right\" | 相对于父节点的右上角 |\r\n | \"left_middle\" | 相对于父节点的左边中间 |\r\n | \"center\" | 相对于父节点的中间 |\r\n | \"right_middle\" | 相对于父节点的右边中间 |\r\n | \"bottom_left\" | 相对于父节点的底部左边 |\r\n | \"bottom_middle\" | 相对于父节点的部中间 |\r\n | \"bottom_right\" | 相对于父节点的底部右边 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- anchorFrom可选的值\r\n | 值 | 解释 |\r\n | ----------------| ------------------------------------------------------------ |\r\n | \"top_left\" | 相对于父节点的左上角 |\r\n | \"top_middle\" | 相对于父节点的上边中间 |\r\n | \"top_right\" | 相对于父节点的右上角 |\r\n | \"left_middle\" | 相对于父节点的左边中间 |\r\n | \"center\" | 相对于父节点的中间 |\r\n | \"right_middle\" | 相对于父节点的右边中间 |\r\n | \"bottom_left\" | 相对于父节点的底部左边 |\r\n | \"bottom_middle\" | 相对于父节点的部中间 |\r\n | \"bottom_right\" | 相对于父节点的底部右边 |", + "return": [], + "description": "设置控件相对于父节点的锚点", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 设置image1控件相对于父节点的左上角\r\nimagePath = \"/panel/image1\"\r\nanchorFrom = \"top_left\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nret = baseUIControl.SetAnchorFrom(anchorFrom)", "params": [ { - "name": "anchorFrom", - "type": "str", + "type": "str", + "name": "anchorFrom", "description": "相对于父节点的锚点,可选的值详见备注" } - ], - "return": [], - "example": "# 设置image1控件相对于父节点的左上角\r\nimagePath = \"/panel/image1\"\r\nanchorFrom = \"top_left\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nret = baseUIControl.SetAnchorFrom(anchorFrom)" - }, + ], + "type": "api", + "side": "client", + "name": "SetAnchorFrom" + }, { - "type": "api", - "name": "SetAnchorTo", - "method": "", - "description": "设置控件自身锚点位置", - "remark": "- anchorTo可选的值\r\n | 值 | 解释 |\r\n | ----------------| ------------------------------------------------------------ |\r\n | \"top_left\" | 自身锚点位于左上角 |\r\n | \"top_middle\" | 自身锚点位于上边中间 |\r\n | \"top_right\" | 自身锚点位于右上角 |\r\n | \"left_middle\" | 自身锚点位于左边中间 |\r\n | \"center\" | 自身锚点位于中间 |\r\n | \"right_middle\" | 自身锚点位于右边中间 |\r\n | \"bottom_left\" | 自身锚点位于底部左边 |\r\n | \"bottom_middle\" | 自身锚点位于底部中间 |\r\n | \"bottom_right\" | 自身锚点位于底部右边 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- anchorTo可选的值\r\n | 值 | 解释 |\r\n | ----------------| ------------------------------------------------------------ |\r\n | \"top_left\" | 自身锚点位于左上角 |\r\n | \"top_middle\" | 自身锚点位于上边中间 |\r\n | \"top_right\" | 自身锚点位于右上角 |\r\n | \"left_middle\" | 自身锚点位于左边中间 |\r\n | \"center\" | 自身锚点位于中间 |\r\n | \"right_middle\" | 自身锚点位于右边中间 |\r\n | \"bottom_left\" | 自身锚点位于底部左边 |\r\n | \"bottom_middle\" | 自身锚点位于底部中间 |\r\n | \"bottom_right\" | 自身锚点位于底部右边 |", + "return": [], + "description": "设置控件自身锚点位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 设置image1控件锚点到自身中间\r\nimagePath = \"/panel/image1\"\r\nanchorTo = \"center\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nret = baseUIControl.SetAnchorTo(anchorTo)", "params": [ { - "name": "anchorTo", - "type": "str", + "type": "str", + "name": "anchorTo", "description": "控件自身锚点位置,可选的值详见备注" } - ], - "return": [], - "example": "# 设置image1控件锚点到自身中间\r\nimagePath = \"/panel/image1\"\r\nanchorTo = \"center\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nret = baseUIControl.SetAnchorTo(anchorTo)" - }, + ], + "type": "api", + "side": "client", + "name": "SetAnchorTo" + }, { - "type": "api", - "name": "SetAnimEndCallback", - "method": "", - "description": "设置动画播放结束后的回调,每次设置都会覆盖上一次的设置", - "remark": "- UI属性动画相关,详见属性动画", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- UI属性动画相关,详见属性动画", + "return": [], + "description": "设置动画播放结束后的回调,每次设置都会覆盖上一次的设置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n\r\ndef callback():\r\n print \"offset_animation end\"\r\n\r\n# 设置属性动画offset_animation播放结束后的回调\r\ncontrol.SetAnimEndCallback(\"offset_animation\", callback)", "params": [ { - "name": "animName", - "type": "str", + "type": "str", + "name": "animName", "description": "动画的名称,请不要包含动画的命名空间" - }, + }, { - "name": "func", - "type": "function", + "type": "function", + "name": "func", "description": "回调,无参数无返回值的函数" } - ], - "return": [], - "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n\r\ndef callback():\r\n print \"offset_animation end\"\r\n\r\n# 设置属性动画offset_animation播放结束后的回调\r\ncontrol.SetAnimEndCallback(\"offset_animation\", callback)" - }, + ], + "type": "api", + "side": "client", + "name": "SetAnimEndCallback" + }, { - "type": "api", - "name": "SetAnimation", - "method": "", - "description": "给单一属性设置动画,已有重复的会设置失败,需要先remove", - "remark": "- UI属性动画相关,详见属性动画\r\n - 需要注意,设置动画本质上是拷贝动画数据到控件的动画组件里面,所以如果动画数据发生了改变(比如通过接口RegisterUIAnimations修改了动画数据),如果想要控件应用修改需要再次调用setAnimation进行更新", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- UI属性动画相关,详见属性动画\r\n - 需要注意,设置动画本质上是拷贝动画数据到控件的动画组件里面,所以如果动画数据发生了改变(比如通过接口RegisterUIAnimations修改了动画数据),如果想要控件应用修改需要再次调用setAnimation进行更新", + "return": [], + "description": "给单一属性设置动画,已有重复的会设置失败,需要先remove", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n\r\n# 如果动画不在json中定义,也可以通过接口进行动态注册\r\ndata = {\r\n \"namespace\": \"CustomAnimations\",\r\n \"alpha_animation_1\": {\r\n \"anim_type\": \"alpha\",\r\n \"duration\": 1.5,\r\n \"from\": 0,\r\n \"to\": 1,\r\n \"next\": \"@namespace.alpha_animation_2\"\r\n },\r\n \"alpha_animation_2\": {\r\n \"anim_type\": \"alpha\",\r\n \"duration\": 1.5,\r\n \"from\": 1,\r\n \"to\": 0,\r\n \"next\": \"@namespace.alpha_animation_1\"\r\n }\r\n}\r\nimport mod.client.extraClientApi as clientApi\r\nclientApi.RegisterUIAnimations(data, True)\r\n\r\n# 给 alpha属性 添加 透明度动画\r\ncontrol.SetAnimation(\"alpha\", \"CustomAnimations\", \"alpha_animation_1\")", "params": [ { - "name": "propertyName", - "type": "str", + "type": "str", + "name": "propertyName", "description": "要设置的动画的属性名称,无默认值,值必须为单一属性(不能填\"all\")" - }, + }, { - "name": "namespace", - "type": "str", + "type": "str", + "name": "namespace", "description": "动画的命名空间,类似于自定义控件,动画也是可以定义到某个命名空间的,详见备注" - }, + }, { - "name": "animName", - "type": "str", + "type": "str", + "name": "animName", "description": "动画的名称,详见备注" - }, + }, { - "name": "autoPlay", - "type": "bool", + "type": "bool", + "name": "autoPlay", "description": "动画添加后是否自动播放,默认值为False,表示不进行播放" } - ], - "return": [], - "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n\r\n# 如果动画不在json中定义,也可以通过接口进行动态注册\r\ndata = {\r\n \"namespace\": \"CustomAnimations\",\r\n \"alpha_animation_1\": {\r\n \"anim_type\": \"alpha\",\r\n \"duration\": 1.5,\r\n \"from\": 0,\r\n \"to\": 1,\r\n \"next\": \"@namespace.alpha_animation_2\"\r\n },\r\n \"alpha_animation_2\": {\r\n \"anim_type\": \"alpha\",\r\n \"duration\": 1.5,\r\n \"from\": 1,\r\n \"to\": 0,\r\n \"next\": \"@namespace.alpha_animation_1\"\r\n }\r\n}\r\nimport mod.client.extraClientApi as clientApi\r\nclientApi.RegisterUIAnimations(data, True)\r\n\r\n# 给 alpha属性 添加 透明度动画\r\ncontrol.SetAnimation(\"alpha\", \"CustomAnimations\", \"alpha_animation_1\")" - }, + ], + "type": "api", + "side": "client", + "name": "SetAnimation" + }, { - "type": "api", - "name": "SetButtonHoverInCallback", - "method": "", - "description": "设置鼠标进入按钮时触发的悬浮回调函数", - "remark": "- 将鼠标移入添加了悬浮回调的控件中会触发该事件,该鼠标指PushScreen生成UI后显示的鼠标,F11生成的鼠标无法生效\r\n - OnButtonHoverInCallback接收到的参数:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | isHoverIn | int | 鼠标是否为进入悬浮回调,1为移入,0为移出 |\r\n | PrevButtonDownID | str | 上一个被点击Down的按钮的ID,如果没有取值为\"-1\" |\r\n | TouchPosX | float | 鼠标进入按钮时屏幕上的UI坐标X值 |\r\n | TouchPosY | float | 鼠标进入按钮时屏幕上的UI坐标Y值 |\r\n | ButtonPath | str | 鼠标进入的按钮的ComponentPath |\r\n | AddHoverEventParams| dict | 在调用AddHoverEventParams接口时传入的参数字典 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 将鼠标移入添加了悬浮回调的控件中会触发该事件,该鼠标指PushScreen生成UI后显示的鼠标,F11生成的鼠标无法生效\r\n - OnButtonHoverInCallback接收到的参数:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | isHoverIn | int | 鼠标是否为进入悬浮回调,1为移入,0为移出 |\r\n | PrevButtonDownID | str | 上一个被点击Down的按钮的ID,如果没有取值为\"-1\" |\r\n | TouchPosX | float | 鼠标进入按钮时屏幕上的UI坐标X值 |\r\n | TouchPosY | float | 鼠标进入按钮时屏幕上的UI坐标Y值 |\r\n | ButtonPath | str | 鼠标进入的按钮的ComponentPath |\r\n | AddHoverEventParams| dict | 在调用AddHoverEventParams接口时传入的参数字典 |", + "return": [], + "description": "设置鼠标进入按钮时触发的悬浮回调函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "def onButtonHoveInCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddHoverEventParams()\r\nbuttonUIControl.SetButtonHoverInCallback(onButtonHoveInCallback)", "params": [ { - "name": "callbackFunc", - "type": "function", + "type": "function", + "name": "callbackFunc", "description": "回调函数,必须是UI的类函数" } - ], - "return": [], - "example": "def onButtonHoveInCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddHoverEventParams()\r\nbuttonUIControl.SetButtonHoverInCallback(onButtonHoveInCallback)" - }, + ], + "type": "api", + "side": "client", + "name": "SetButtonHoverInCallback" + }, { - "type": "api", - "name": "SetButtonHoverOutCallback", - "method": "", - "description": "设置鼠标退出按钮时触发的悬浮回调函数", - "remark": "- 将鼠标移出添加了悬浮回调的控件中会触发该事件,该鼠标指PushScreen生成UI后显示的鼠标,F11生成的鼠标无法生效\r\n - OnButtonHoverInCallback接收到的参数:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | isHoverIn | int | 鼠标是否为进入悬浮回调,1为移入,0为移出 |\r\n | PrevButtonDownID | str | 上一个被点击Down的按钮的ID,如果没有取值为\"-1\" |\r\n | ButtonPath | str | 鼠标退出的按钮的ComponentPath |\r\n | AddHoverEventParams| dict | 在调用AddHoverEventParams接口时传入的参数字典 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 将鼠标移出添加了悬浮回调的控件中会触发该事件,该鼠标指PushScreen生成UI后显示的鼠标,F11生成的鼠标无法生效\r\n - OnButtonHoverInCallback接收到的参数:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | isHoverIn | int | 鼠标是否为进入悬浮回调,1为移入,0为移出 |\r\n | PrevButtonDownID | str | 上一个被点击Down的按钮的ID,如果没有取值为\"-1\" |\r\n | ButtonPath | str | 鼠标退出的按钮的ComponentPath |\r\n | AddHoverEventParams| dict | 在调用AddHoverEventParams接口时传入的参数字典 |", + "return": [], + "description": "设置鼠标退出按钮时触发的悬浮回调函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "def OnButtonHoverOutCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddHoverEventParams()\r\nbuttonUIControl.SetButtonHoverOutCallback(OnButtonHoverOutCallback)", "params": [ { - "name": "callbackFunc", - "type": "function", + "type": "function", + "name": "callbackFunc", "description": "回调函数,必须是UI的类函数" } - ], - "return": [], - "example": "def OnButtonHoverOutCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddHoverEventParams()\r\nbuttonUIControl.SetButtonHoverOutCallback(OnButtonHoverOutCallback)" - }, + ], + "type": "api", + "side": "client", + "name": "SetButtonHoverOutCallback" + }, { - "type": "api", - "name": "SetButtonScreenExitCallback", - "method": "", - "description": "设置按钮所在画布退出时若鼠标仍未抬起时触发回调函数", - "remark": "- 其他相关说明见SetButtonTouchDownCallback接口:", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 其他相关说明见SetButtonTouchDownCallback接口:", + "return": [], + "description": "设置按钮所在画布退出时若鼠标仍未抬起时触发回调函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "def onButtonScreenExitCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonScreenExitCallback(onButtonScreenExitCallback)", "params": [ { - "name": "callbackFunc", - "type": "function", + "type": "function", + "name": "callbackFunc", "description": "回调函数,必须是UI的类函数" } - ], - "return": [], - "example": "def onButtonScreenExitCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonScreenExitCallback(onButtonScreenExitCallback)" - }, + ], + "type": "api", + "side": "client", + "name": "SetButtonScreenExitCallback" + }, { - "type": "api", - "name": "SetButtonTouchCancelCallback", - "method": "", - "description": "设置触控在按钮范围外弹起时触发的回调函数", - "remark": "- 其他相关说明见SetButtonTouchDownCallback接口:", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 其他相关说明见SetButtonTouchDownCallback接口:", + "return": [], + "description": "设置触控在按钮范围外弹起时触发的回调函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "def onButtonTouchCancelCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonTouchCancelCallback(onButtonTouchCancelCallback)", "params": [ { - "name": "callbackFunc", - "type": "function", + "type": "function", + "name": "callbackFunc", "description": "回调函数,必须是UI的类函数" } - ], - "return": [], - "example": "def onButtonTouchCancelCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonTouchCancelCallback(onButtonTouchCancelCallback)" - }, + ], + "type": "api", + "side": "client", + "name": "SetButtonTouchCancelCallback" + }, { - "type": "api", - "name": "SetButtonTouchDownCallback", - "method": "", - "description": "设置按钮按下时触发的回调函数", - "remark": "- onButtonTouchDownCallback参数args说明:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | #collection_name | str | 按钮所属的集合名称 |\r\n | #collection_index | int | 按钮在集合所属的集合序号 |\r\n | ButtonState | int | 按钮的状态:Up为0,Down为1,默认是-1,建议使用New |\r\n | TouchEvent | int | 按钮的状态新版本:Up为0,Down为1,Cancel为3,Move为4,默认是-1 |\r\n | PrevButtonDownID | str | 上一个被点击Down的按钮的ID,如果没有取值为\"-1\" |\r\n | TouchPosX | float | 按钮被点击时屏幕上的UI坐标X值 |\r\n | TouchPosY | float | 按钮被点击时屏幕上的UI坐标Y值 |\r\n | ButtonPath | str | 被点击的按钮的ComponentPath |\r\n | AddTouchEventParams| dict | 在调用AddTouchEventParams接口时传入的参数字典 |\r\n \r\n 事件之间的关系如下图所示:\r\n ![事件说明](../../picture/touch_event.png)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- onButtonTouchDownCallback参数args说明:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | #collection_name | str | 按钮所属的集合名称 |\r\n | #collection_index | int | 按钮在集合所属的集合序号 |\r\n | ButtonState | int | 按钮的状态:Up为0,Down为1,默认是-1,建议使用New |\r\n | TouchEvent | int | 按钮的状态新版本:Up为0,Down为1,Cancel为3,Move为4,默认是-1 |\r\n | PrevButtonDownID | str | 上一个被点击Down的按钮的ID,如果没有取值为\"-1\" |\r\n | TouchPosX | float | 按钮被点击时屏幕上的UI坐标X值 |\r\n | TouchPosY | float | 按钮被点击时屏幕上的UI坐标Y值 |\r\n | ButtonPath | str | 被点击的按钮的ComponentPath |\r\n | AddTouchEventParams| dict | 在调用AddTouchEventParams接口时传入的参数字典 |\r\n \r\n 事件之间的关系如下图所示:\r\n ![事件说明](../../picture/touch_event.png)", + "return": [], + "description": "设置按钮按下时触发的回调函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "def onButtonTouchDownCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonTouchDownCallback(onButtonTouchDownCallback)", "params": [ { - "name": "callbackFunc", - "type": "function", + "type": "function", + "name": "callbackFunc", "description": "回调函数,必须是UI的类函数" } - ], - "return": [], - "example": "def onButtonTouchDownCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonTouchDownCallback(onButtonTouchDownCallback)" - }, + ], + "type": "api", + "side": "client", + "name": "SetButtonTouchDownCallback" + }, { - "type": "api", - "name": "SetButtonTouchMoveCallback", - "method": "", - "description": "设置按下后触控移动时触发的回调函数", - "remark": "- 其他相关说明见SetButtonTouchDownCallback接口:\r\n - 该事件只在触屏模式下触发", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 其他相关说明见SetButtonTouchDownCallback接口:\r\n - 该事件只在触屏模式下触发", + "return": [], + "description": "设置按下后触控移动时触发的回调函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "def onButtonTouchMoveCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonTouchMoveCallback(onButtonTouchMoveCallback)", "params": [ { - "name": "callbackFunc", - "type": "function", + "type": "function", + "name": "callbackFunc", "description": "回调函数,必须是UI的类函数" } - ], - "return": [], - "example": "def onButtonTouchMoveCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonTouchMoveCallback(onButtonTouchMoveCallback)" - }, + ], + "type": "api", + "side": "client", + "name": "SetButtonTouchMoveCallback" + }, { - "type": "api", - "name": "SetButtonTouchMoveInCallback", - "method": "", - "description": "设置按下按钮后进入控件时触发的回调函数", - "remark": "- 其他相关说明见SetButtonTouchDownCallback接口:\r\n - 键鼠模式下,鼠标移入会触发该事件。触屏模式下,鼠标按下按钮会触发该事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 其他相关说明见SetButtonTouchDownCallback接口:\r\n - 键鼠模式下,鼠标移入会触发该事件。触屏模式下,鼠标按下按钮会触发该事件", + "return": [], + "description": "设置按下按钮后进入控件时触发的回调函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "def onButtonTouchMoveInCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonTouchMoveInCallback(onButtonTouchMoveInCallback)", "params": [ { - "name": "callbackFunc", - "type": "function", + "type": "function", + "name": "callbackFunc", "description": "回调函数,必须是UI的类函数" } - ], - "return": [], - "example": "def onButtonTouchMoveInCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonTouchMoveInCallback(onButtonTouchMoveInCallback)" - }, + ], + "type": "api", + "side": "client", + "name": "SetButtonTouchMoveInCallback" + }, { - "type": "api", - "name": "SetButtonTouchMoveOutCallback", - "method": "", - "description": "设置按下按钮后退出控件时触发的回调函数", - "remark": "- 其他相关说明见SetButtonTouchDownCallback接口:\r\n - 键鼠模式下,鼠标移出会触发该事件。触屏模式下,鼠标松开按钮会触发该事件", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 其他相关说明见SetButtonTouchDownCallback接口:\r\n - 键鼠模式下,鼠标移出会触发该事件。触屏模式下,鼠标松开按钮会触发该事件", + "return": [], + "description": "设置按下按钮后退出控件时触发的回调函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "def onButtonTouchMoveOutCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonTouchMoveOutCallback(onButtonTouchMoveOutCallback)", "params": [ { - "name": "callbackFunc", - "type": "function", + "type": "function", + "name": "callbackFunc", "description": "回调函数,必须是UI的类函数" } - ], - "return": [], - "example": "def onButtonTouchMoveOutCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonTouchMoveOutCallback(onButtonTouchMoveOutCallback)" - }, + ], + "type": "api", + "side": "client", + "name": "SetButtonTouchMoveOutCallback" + }, { - "type": "api", - "name": "SetButtonTouchUpCallback", - "method": "", - "description": "设置触控在按钮范围内弹起时的回调函数", - "remark": "- 其他相关说明见SetButtonTouchDownCallback接口:", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 其他相关说明见SetButtonTouchDownCallback接口:", + "return": [], + "description": "设置触控在按钮范围内弹起时的回调函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "def onButtonTouchUpCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonTouchUpCallback(onButtonTouchUpCallback)", "params": [ { - "name": "callbackFunc", - "type": "function", + "type": "function", + "name": "callbackFunc", "description": "回调函数,必须是UI的类函数" } - ], - "return": [], - "example": "def onButtonTouchUpCallback(args):\r\n pass\r\n\r\nbuttonPath = \"/panel/test_btn\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(\"/panel/test_btn\").asButton()\r\nbuttonUIControl.AddTouchEventParams({\"isSwallow\":True})\r\nbuttonUIControl.SetButtonTouchUpCallback(onButtonTouchUpCallback)" - }, + ], + "type": "api", + "side": "client", + "name": "SetButtonTouchUpCallback" + }, { - "type": "api", - "name": "SetClipDirection", - "method": "", - "description": "设置图片控件的裁剪方向", - "remark": "- clipDirection可选的值\r\n | 值 | 解释 |\r\n | ------------------------| --------------------------------------------- |\r\n | \"fromLeftToRight\" | 从左到右 |\r\n | \"fromRightToLeft\" | 从右到左 |\r\n | \"fromOutsideToInside\" | 从外到内 |\r\n | \"fromTopToBottom\" | 从上到下 |\r\n | \"fromBottomToTop\" | 从下到上 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- clipDirection可选的值\r\n | 值 | 解释 |\r\n | ------------------------| --------------------------------------------- |\r\n | \"fromLeftToRight\" | 从左到右 |\r\n | \"fromRightToLeft\" | 从右到左 |\r\n | \"fromOutsideToInside\" | 从外到内 |\r\n | \"fromTopToBottom\" | 从上到下 |\r\n | \"fromBottomToTop\" | 从下到上 |", + "return": [], + "description": "设置图片控件的裁剪方向", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nclipDirection = \"fromOutsideToInside\"\r\nret = imageUIControl.SetClipDirection(clipDirection)", "params": [ { - "name": "clipDirection", - "type": "str", + "type": "str", + "name": "clipDirection", "description": "图片控件的裁剪方向,可选的值详见备注" } - ], - "return": [], - "example": "imagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nclipDirection = \"fromOutsideToInside\"\r\nret = imageUIControl.SetClipDirection(clipDirection)" - }, + ], + "type": "api", + "side": "client", + "name": "SetClipDirection" + }, { - "type": "api", - "name": "SetClipOffset", - "method": "", - "description": "设置控件的裁剪偏移信息", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置控件的裁剪偏移信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set image1 maxSize\r\nimagePath = \"/panel/image1\"\r\nclipOffset = (20, 20)\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nret = baseUIControl.SetClipOffset(clipOffset)", "params": [ { - "name": "clipOffset", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "clipOffset", "description": "该控件的裁剪偏移信息,第一项为横轴,第二项为纵轴" } - ], - "return": [], - "example": "# we want to set image1 maxSize\r\nimagePath = \"/panel/image1\"\r\nclipOffset = (20, 20)\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nret = baseUIControl.SetClipOffset(clipOffset)" - }, + ], + "type": "api", + "side": "client", + "name": "SetClipOffset" + }, { - "type": "api", - "name": "SetClipsChildren", - "method": "", - "description": "设置控件是否开启裁剪内容", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置控件是否开启裁剪内容", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to enable image1 clipsChildren\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nret = baseUIControl.SetClipsChildren(True)", "params": [ { - "name": "clipsChildren", - "type": "bool", + "type": "bool", + "name": "clipsChildren", "description": "True表示开启,False表示关闭" } - ], - "return": [], - "example": "# we want to enable image1 clipsChildren\r\nimagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nret = baseUIControl.SetClipsChildren(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetClipsChildren" + }, { - "type": "api", - "name": "SetCurrentSliceIndex", - "method": "", - "description": "设置轮盘选择的切片", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置轮盘选择的切片", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "selectionWheelPath = \"/selectionWheel\"\r\nselectionWheelControl = uiNode.GetBaseUIControl(selectionWheelPath).asSelectionWheel()\r\nselectionWheelControl.SetCurrentSliceIndex(-1)", "params": [ { - "name": "index", - "type": "int", + "type": "int", + "name": "index", "description": "轮盘选择的切片的index,取值范围为 [-1, GetSliceCount() - 1],-1表示轮盘无选择" } - ], - "return": [], - "example": "selectionWheelPath = \"/selectionWheel\"\r\nselectionWheelControl = uiNode.GetBaseUIControl(selectionWheelPath).asSelectionWheel()\r\nselectionWheelControl.SetCurrentSliceIndex(-1)" - }, + ], + "type": "api", + "side": "client", + "name": "SetCurrentSliceIndex" + }, { - "type": "api", - "name": "SetEditText", - "method": "", - "description": "设置edit_box输入框的文本信息", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置edit_box输入框的文本信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to clear edit2 content\r\neditBoxPath = \"/panel/edit2\"\r\ntext = \"\"\r\ntextEditBoxUIControl = uiNode.GetBaseUIControl(editBoxPath).asTextEditBox()\r\ntextEditBoxUIControl.SetEditText(text)", "params": [ { - "name": "text", - "type": "str", + "type": "str", + "name": "text", "description": "文本的内容" } - ], - "return": [], - "example": "# we want to clear edit2 content\r\neditBoxPath = \"/panel/edit2\"\r\ntext = \"\"\r\ntextEditBoxUIControl = uiNode.GetBaseUIControl(editBoxPath).asTextEditBox()\r\ntextEditBoxUIControl.SetEditText(text)" - }, + ], + "type": "api", + "side": "client", + "name": "SetEditText" + }, { - "type": "api", - "name": "SetEditTextMaxLength", - "method": "", - "description": "设置输入框的最大输入长度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置输入框的最大输入长度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set text_edit_box max input length 10\r\neditTextPath = \"/panel2/text_edit_box\"\r\ntextEditBoxUIControl = uiNode.GetBaseUIControl(editBoxPath).asTextEditBox()\r\ntextEditBoxUIControl.SetEditTextMaxLength(10)", "params": [ { - "name": "maxLength", - "type": "int", + "type": "int", + "name": "maxLength", "description": "输入框可输入的最大长度,取值[0, +∞)" } - ], - "return": [], - "example": "# we want to set text_edit_box max input length 10\r\neditTextPath = \"/panel2/text_edit_box\"\r\ntextEditBoxUIControl = uiNode.GetBaseUIControl(editBoxPath).asTextEditBox()\r\ntextEditBoxUIControl.SetEditTextMaxLength(10)" - }, + ], + "type": "api", + "side": "client", + "name": "SetEditTextMaxLength" + }, { - "type": "api", - "name": "SetFullPosition", - "method": "", - "description": "设置控件的锚点坐标(全局坐标),支持比例值以及绝对值", - "remark": "- paramDict的键值\r\n | 参数名 | 参数类型 | 解释 |\r\n | ----------------| --------------|---------------------------------------------- |\r\n | \"followType\"| str | 跟随类型,默认值为\"none\",可以不写该键值|\r\n | \"relativeValue\"| float | 相对于跟随控件的比例值,默认值为0,可以不写该键值|\r\n | \"absoluteValue\"| float | 设置的绝对值,默认值为0,可以不写该键值 |\r\n - 控件的大小支持复杂的计算来实现自适应布局,形式为“absoluteValue + relativeValue * 跟随值”。\r\n 其中跟随值由跟随的控件以及当前设置的属性共同决定。比如当前设置的是控件的x坐标,并且跟随控件为父控件,而跟随值为父控件的宽度。\r\n 而跟随的控件是特定的,是与控件本身有一定关系的,比如控件的父控件,子控件等,可以通过设置followType的值来指定。\r\n - followType可选的值\r\n | 值 | 解释 |\r\n | ----------------| ------------------------------------------------------------ |\r\n | \"none\" | 无跟随,实际计算的时候只考虑absoluteValue |\r\n | \"parent\" | 跟随控件为父控件 |\r\n | \"maxChildren\" | 跟随控件为最大子控件(设置x则为最大宽度,设置y则为最大高度),relativeValue无论如何设置都为1.0 |\r\n | \"maxSibling\" | 跟随控件为最大兄弟控件(设置x则为最大宽度,设置y则为最大高度),relativeValue无论如何设置都为1.0 |\r\n | \"children\" | 跟随值等于所有子节点之和(如果是x则计算的是子节点的宽度之和,如果是y则计算的是子节点的高度之和) |\r\n | \"x\" | 跟随值等于控件本身的宽度,该值仅当 axis == \"y\" 才生效|\r\n | \"y\" | 跟随值等于控件本身的高度,该值仅当 axis == \"x\" 才生效|\r\n - 设置跟随类型的时候请务必小心,不要造成依赖循环,比如父控件x坐标依赖子控件的宽度,而子控件的宽度又依赖于父控件这类情况,这样即使设置成功,结果也是未知的", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- paramDict的键值\r\n | 参数名 | 参数类型 | 解释 |\r\n | ----------------| --------------|---------------------------------------------- |\r\n | \"followType\"| str | 跟随类型,默认值为\"none\",可以不写该键值|\r\n | \"relativeValue\"| float | 相对于跟随控件的比例值,默认值为0,可以不写该键值|\r\n | \"absoluteValue\"| float | 设置的绝对值,默认值为0,可以不写该键值 |\r\n - 控件的大小支持复杂的计算来实现自适应布局,形式为“absoluteValue + relativeValue * 跟随值”。\r\n 其中跟随值由跟随的控件以及当前设置的属性共同决定。比如当前设置的是控件的x坐标,并且跟随控件为父控件,而跟随值为父控件的宽度。\r\n 而跟随的控件是特定的,是与控件本身有一定关系的,比如控件的父控件,子控件等,可以通过设置followType的值来指定。\r\n - followType可选的值\r\n | 值 | 解释 |\r\n | ----------------| ------------------------------------------------------------ |\r\n | \"none\" | 无跟随,实际计算的时候只考虑absoluteValue |\r\n | \"parent\" | 跟随控件为父控件 |\r\n | \"maxChildren\" | 跟随控件为最大子控件(设置x则为最大宽度,设置y则为最大高度),relativeValue无论如何设置都为1.0 |\r\n | \"maxSibling\" | 跟随控件为最大兄弟控件(设置x则为最大宽度,设置y则为最大高度),relativeValue无论如何设置都为1.0 |\r\n | \"children\" | 跟随值等于所有子节点之和(如果是x则计算的是子节点的宽度之和,如果是y则计算的是子节点的高度之和) |\r\n | \"x\" | 跟随值等于控件本身的宽度,该值仅当 axis == \"y\" 才生效|\r\n | \"y\" | 跟随值等于控件本身的高度,该值仅当 axis == \"x\" 才生效|\r\n - 设置跟随类型的时候请务必小心,不要造成依赖循环,比如父控件x坐标依赖子控件的宽度,而子控件的宽度又依赖于父控件这类情况,这样即使设置成功,结果也是未知的", + "return": [], + "description": "设置控件的锚点坐标(全局坐标),支持比例值以及绝对值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\n# 设置image1的位置在父控件的中间\r\nret = baseUIControl.SetFullPosition(axis=\"x\", paramDict={\"followType\":\"parent\", \"relativeValue\":0.5})\r\nret = baseUIControl.SetFullPosition(axis=\"y\", paramDict={\"followType\":\"parent\", \"relativeValue\":0.5})", "params": [ { - "name": "axis", - "type": "str", + "type": "str", + "name": "axis", "description": "设置的轴向,可选的值有[\"x\",\"y\"],\"x\"表示设置控件锚点的x坐标,\"y\"表示设置控件锚点的y坐标" - }, + }, { - "name": "paramDict", - "type": "dict", + "type": "dict", + "name": "paramDict", "description": "设置的参数,具体见备注" } - ], - "return": [], - "example": "imagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\n# 设置image1的位置在父控件的中间\r\nret = baseUIControl.SetFullPosition(axis=\"x\", paramDict={\"followType\":\"parent\", \"relativeValue\":0.5})\r\nret = baseUIControl.SetFullPosition(axis=\"y\", paramDict={\"followType\":\"parent\", \"relativeValue\":0.5})" - }, + ], + "type": "api", + "side": "client", + "name": "SetFullPosition" + }, { - "type": "api", - "name": "SetFullSize", - "method": "", - "description": "设置控件的大小,支持比例形式以及绝对值", - "remark": "- paramDict的键值\r\n | 参数名 | 参数类型 | 解释 |\r\n | ----------------| --------------|---------------------------------------------- |\r\n | \"fit\"| bool | 是否自适应父控件,默认值为False,可以不写该键值|\r\n | \"followType\"| str | 跟随类型,默认值为\"none\",可以不写该键值|\r\n | \"relativeValue\"| float | 相对于跟随控件的比例值,默认值为0,可以不写该键值|\r\n | \"absoluteValue\"| float | 设置的绝对值,默认值为0,可以不写该键值 |\r\n - 控件的大小支持复杂的计算来实现自适应布局,形式为“absoluteValue + relativeValue * 跟随值”。\r\n 其中跟随值由跟随的控件以及当前设置的属性共同决定。比如当前设置的是控件的宽度,并且跟随控件为父控件,则跟随值为父控件的宽度。\r\n 而跟随的控件是特定的,是与控件本身有一定关系的,比如控件的父控件,子控件等,可以通过设置followType的值来指定。\r\n - followType可选的值\r\n | 值 | 解释 |\r\n | ----------------| ------------------------------------------------------------ |\r\n | \"none\" | 无跟随,实际计算的时候只考虑absoluteValue |\r\n | \"parent\" | 跟随控件为父控件 |\r\n | \"maxChildren\" | 跟随控件为最大子控件(设置宽度则为最大宽度,设置高度则为最大高度),relativeValue无论如何设置都为1.0 |\r\n | \"maxSibling\" | 跟随控件为最大兄弟控件(设置宽度则为最大宽度,设置高度则为最大高度),relativeValue无论如何设置都为1.0 |\r\n | \"children\" | 跟随值等于所有子节点之和 |\r\n | \"x\" | 跟随值等于控件本身的宽度,该值仅当 axis == \"y\" 才生效|\r\n | \"y\" | 跟随值等于控件本身的高度,该值仅当 axis == \"x\" 才生效|\r\n - fit参数用来指定是否自适应父控件,如果是自适应父控件,则absoluteValue,followType,relativeValue参数均会失效,控件的值直接取自父控件的值\r\n - 设置跟随类型的时候请务必小心,不要造成依赖循环,比如父控件宽度依赖子控件的宽度,而子控件的宽度又依赖于父控件这类情况,这样即使设置成功,结果也是未知的", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- paramDict的键值\r\n | 参数名 | 参数类型 | 解释 |\r\n | ----------------| --------------|---------------------------------------------- |\r\n | \"fit\"| bool | 是否自适应父控件,默认值为False,可以不写该键值|\r\n | \"followType\"| str | 跟随类型,默认值为\"none\",可以不写该键值|\r\n | \"relativeValue\"| float | 相对于跟随控件的比例值,默认值为0,可以不写该键值|\r\n | \"absoluteValue\"| float | 设置的绝对值,默认值为0,可以不写该键值 |\r\n - 控件的大小支持复杂的计算来实现自适应布局,形式为“absoluteValue + relativeValue * 跟随值”。\r\n 其中跟随值由跟随的控件以及当前设置的属性共同决定。比如当前设置的是控件的宽度,并且跟随控件为父控件,则跟随值为父控件的宽度。\r\n 而跟随的控件是特定的,是与控件本身有一定关系的,比如控件的父控件,子控件等,可以通过设置followType的值来指定。\r\n - followType可选的值\r\n | 值 | 解释 |\r\n | ----------------| ------------------------------------------------------------ |\r\n | \"none\" | 无跟随,实际计算的时候只考虑absoluteValue |\r\n | \"parent\" | 跟随控件为父控件 |\r\n | \"maxChildren\" | 跟随控件为最大子控件(设置宽度则为最大宽度,设置高度则为最大高度),relativeValue无论如何设置都为1.0 |\r\n | \"maxSibling\" | 跟随控件为最大兄弟控件(设置宽度则为最大宽度,设置高度则为最大高度),relativeValue无论如何设置都为1.0 |\r\n | \"children\" | 跟随值等于所有子节点之和 |\r\n | \"x\" | 跟随值等于控件本身的宽度,该值仅当 axis == \"y\" 才生效|\r\n | \"y\" | 跟随值等于控件本身的高度,该值仅当 axis == \"x\" 才生效|\r\n - fit参数用来指定是否自适应父控件,如果是自适应父控件,则absoluteValue,followType,relativeValue参数均会失效,控件的值直接取自父控件的值\r\n - 设置跟随类型的时候请务必小心,不要造成依赖循环,比如父控件宽度依赖子控件的宽度,而子控件的宽度又依赖于父控件这类情况,这样即使设置成功,结果也是未知的", + "return": [], + "description": "设置控件的大小,支持比例形式以及绝对值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\n# 设置image1的宽度为父节点的一半,\r\nret = baseUIControl.SetFullSize(axis=\"x\", paramDict={\"followType\":\"parent\", \"relativeValue\":0.5})\r\n# 设置image1的高度为所有子节点的高度的2倍并且多20像素\r\nret = baseUIControl.SetFullSize(axis=\"y\", paramDict={\"absoluteValue\":20, \"followType\":\"children\", \"relativeValue\":2})\r\n# 设置image1的宽,高为父亲节点的宽,高\r\nret = baseUIControl.SetFullSize(axis=\"x\", {\"fit\":True})\r\nret = baseUIControl.SetFullSize(axis=\"y\", {\"fit\":True})", "params": [ { - "name": "axis", - "type": "str", + "type": "str", + "name": "axis", "description": "设置的轴向,可选的值有[\"x\",\"y\"],\"x\"表示设置控件的宽度,\"y\"表示设置控件的高度" - }, + }, { - "name": "paramDict", - "type": "dict", + "type": "dict", + "name": "paramDict", "description": "设置的参数,具体见备注" } - ], - "return": [], - "example": "imagePath = \"/panel/image1\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\n# 设置image1的宽度为父节点的一半,\r\nret = baseUIControl.SetFullSize(axis=\"x\", paramDict={\"followType\":\"parent\", \"relativeValue\":0.5})\r\n# 设置image1的高度为所有子节点的高度的2倍并且多20像素\r\nret = baseUIControl.SetFullSize(axis=\"y\", paramDict={\"absoluteValue\":20, \"followType\":\"children\", \"relativeValue\":2})\r\n# 设置image1的宽,高为父亲节点的宽,高\r\nret = baseUIControl.SetFullSize(axis=\"x\", {\"fit\":True})\r\nret = baseUIControl.SetFullSize(axis=\"y\", {\"fit\":True})" - }, + ], + "type": "api", + "side": "client", + "name": "SetFullSize" + }, { - "type": "api", - "name": "SetGridDimension", - "method": "", - "description": "设置Grid控件的大小", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置Grid控件的大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want change grid dimension\r\ngridPath = \"/grid1\"\r\ngridUIControl = uiNode.GetBaseUIControl(gridPath).asGrid()\r\ngridUIControl.SetGridDimension((2, 2))", "params": [ { - "name": "dimension", - "type": "tuple(int,int)", + "type": "tuple(int,int)", + "name": "dimension", "description": "设置网格的横向与纵向大小" } - ], - "return": [], - "example": "# we want change grid dimension\r\ngridPath = \"/grid1\"\r\ngridUIControl = uiNode.GetBaseUIControl(gridPath).asGrid()\r\ngridUIControl.SetGridDimension((2, 2))" - }, + ], + "type": "api", + "side": "client", + "name": "SetGridDimension" + }, { - "type": "api", - "name": "SetHighestY", - "method": "", - "description": "设置绘制地图的最大高度", - "remark": "- 动态调整高度值后,已经绘制过的区块不会刷新为新的高度值,只有没有绘制过的区块会以新的高度值来绘制。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 动态调整高度值后,已经绘制过的区块不会刷新为新的高度值,只有没有绘制过的区块会以新的高度值来绘制。", + "return": [], + "description": "设置绘制地图的最大高度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.SetHighestY(255)", "params": [ { - "name": "highestY", - "type": "int", + "type": "int", + "name": "highestY", "description": "绘制高度值" } - ], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.SetHighestY(255)" - }, + ], + "type": "api", + "side": "client", + "name": "SetHighestY" + }, { - "type": "api", - "name": "SetHoverCallback", - "method": "", - "description": "设置轮盘选择切片触发回调函数", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置轮盘选择切片触发回调函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "def onSelectionWheelHover():\r\n pass\r\n\r\nselectionWheelPath = \"/selectionWheel\"\r\nselectionWheelControl = uiNode.GetBaseUIControl(selectionWheelPath).asSelectionWheel()\r\nselectionWheelControl.SetHoverCallback(onSelectionWheelHover)", "params": [ { - "name": "callbackFunc", - "type": "function", + "type": "function", + "name": "callbackFunc", "description": "回调函数,必须是UI的类函数,并且无参数" } - ], - "return": [], - "example": "def onSelectionWheelHover():\r\n pass\r\n\r\nselectionWheelPath = \"/selectionWheel\"\r\nselectionWheelControl = uiNode.GetBaseUIControl(selectionWheelPath).asSelectionWheel()\r\nselectionWheelControl.SetHoverCallback(onSelectionWheelHover)" - }, + ], + "type": "api", + "side": "client", + "name": "SetHoverCallback" + }, { - "type": "api", - "name": "SetImageAdaptionType", - "method": "", - "description": "设置图片控件的图片适配方式以及信息", - "remark": "- imageAdaptionType可选的值如下\r\n | 值 | 解释 |\r\n | ------------------------| --------------------------------------------- |\r\n | \"normal\" | 普通适配,不开启九宫并保持宽高比 |\r\n | \"filled\" | 填充适配,不开启九宫并保持宽高比 |\r\n | \"oldNineSlice\" | 旧版九宫格适配 |\r\n | \"originNineSlice\" | 原版九宫格适配 |", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- imageAdaptionType可选的值如下\r\n | 值 | 解释 |\r\n | ------------------------| --------------------------------------------- |\r\n | \"normal\" | 普通适配,不开启九宫并保持宽高比 |\r\n | \"filled\" | 填充适配,不开启九宫并保持宽高比 |\r\n | \"oldNineSlice\" | 旧版九宫格适配 |\r\n | \"originNineSlice\" | 原版九宫格适配 |", + "return": [], + "description": "设置图片控件的图片适配方式以及信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\n# 普通适配\r\nret = imageUIControl.SetImageAdaptionType(\"normal\")\r\n# 原版九公格适配,并设置边距\r\nret = imageUIControl.SetImageAdaptionType(\"originNineSlice\", (0, 0, 0, 0))", "params": [ { - "name": "imageAdaptionType", - "type": "str", + "type": "str", + "name": "imageAdaptionType", "description": "图片控件的图片适配方式,可选的值详见备注" - }, + }, { - "name": "imageAdaptionData", - "type": "tuple(float,float,float,float)", + "type": "tuple(float,float,float,float)", + "name": "imageAdaptionData", "description": "如果图片不是九宫适配方式,无需传该值,否则需要设置,tuple的每个值分别代表九宫格切割的四个参数:左,右,上,下" } - ], - "return": [], - "example": "imagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\n# 普通适配\r\nret = imageUIControl.SetImageAdaptionType(\"normal\")\r\n# 原版九公格适配,并设置边距\r\nret = imageUIControl.SetImageAdaptionType(\"originNineSlice\", (0, 0, 0, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetImageAdaptionType" + }, { - "type": "api", - "name": "SetIsModal", - "method": "", - "description": "设置当前面板是否为模态框", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置当前面板是否为模态框", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set inputPanel1 isModal\r\ninputPanelPath = \"/inputPanel1\"\r\ninputPanel = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()\r\nret = inputPanel.SetIsModal(True)", "params": [ { - "name": "isModal", - "type": "bool", + "type": "bool", + "name": "isModal", "description": "当前面板是否为模态框" } - ], - "return": [], - "example": "# we want to set inputPanel1 isModal\r\ninputPanelPath = \"/inputPanel1\"\r\ninputPanel = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()\r\nret = inputPanel.SetIsModal(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetIsModal" + }, { - "type": "api", - "name": "SetIsSwallow", - "method": "", - "description": "设置当前面板输入是否会吞噬事件,isSwallow为Ture时,点击时,点击事件不会穿透到世界。如破坏方块、镜头转向不会被响应", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置当前面板输入是否会吞噬事件,isSwallow为Ture时,点击时,点击事件不会穿透到世界。如破坏方块、镜头转向不会被响应", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set inputPanel1 isSwallow\r\ninputPanelPath = \"/inputPanel1\"\r\ninputPanel = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()\r\nret = inputPanel.SetIsSwallow(True)", "params": [ { - "name": "isSwallow", - "type": "bool", + "type": "bool", + "name": "isSwallow", "description": "设置当前面板输入是否会吞噬事件" } - ], - "return": [], - "example": "# we want to set inputPanel1 isSwallow\r\ninputPanelPath = \"/inputPanel1\"\r\ninputPanel = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()\r\nret = inputPanel.SetIsSwallow(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetIsSwallow" + }, { - "type": "api", - "name": "SetLayer", - "method": "", - "description": "设置控件节点的层级,可以通过传入空字符串(\"\")的方式来调整整个JSON的基础层级", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置控件节点的层级,可以通过传入空字符串(\"\")的方式来调整整个JSON的基础层级", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 设置text2的控件的层级\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\nbaseUIControl.SetLayer(2)\r\n# 同一帧设置若干控件的层级\r\ntext1Path = \"/panel/text1\"\r\nuiNode.GetBaseUIControl(text1Path).SetLayer(1,False)\r\ntext2Path = \"/panel/text2\"\r\nuiNode.GetBaseUIControl(text2Path).SetLayer(2,False)\r\ntext3Path = \"/panel/text3\"\r\nuiNode.GetBaseUIControl(text3Path).SetLayer(3,False)\r\n# 不同帧设置若干控件的层级\r\ndef _setLyerText1(path, layer):\r\n uiNode.GetBaseUIControl(text1Path).SetLayer(1,False,False)\r\ndef _updateScreen():\r\n uiNode.UpdateScreen(True)\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.AddTimer(100, _setLyerText1, \"/panel/text1\", 1)\r\ncomp.AddTimer(200, _setLyerText1, \"/panel/text2\", 2)\r\ncomp.AddTimer(300, _setLyerText1, \"/panel/text3\", 3)\r\ncomp.AddTimer(300, _updateScreen)", "params": [ { - "name": "layer", - "type": "int", + "type": "int", + "name": "layer", "description": "设置层级" - }, + }, { - "name": "syncRefresh", - "type": "bool", + "type": "bool", + "name": "syncRefresh", "description": "是否需要同步刷新,默认值为True。置True为游戏在同一帧根据该控件的层级进行相关计算,置False则在下一帧进行计算。如同一帧有大量SetLayer操作建议置False,操作结束后调用一次ScreenNode.UpdateScreen接口刷新界面及相关控件数据" - }, + }, { - "name": "forceUpdate", - "type": "bool", + "type": "bool", + "name": "forceUpdate", "description": "是否需要强制刷新,默认值为True。置True则按照syncRefresh逻辑进行同步或者下一帧刷新,置False则当前帧和下一帧均不刷新,需要手动调用UpdateScreen进行刷新。如有大量SetLayer操作且非在同一帧执行,建议设置为False,需要更新时再调用UpdateScreen接口刷新界面及相关控件数据" } - ], - "return": [], - "example": "# 设置text2的控件的层级\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\nbaseUIControl.SetLayer(2)\r\n# 同一帧设置若干控件的层级\r\ntext1Path = \"/panel/text1\"\r\nuiNode.GetBaseUIControl(text1Path).SetLayer(1,False)\r\ntext2Path = \"/panel/text2\"\r\nuiNode.GetBaseUIControl(text2Path).SetLayer(2,False)\r\ntext3Path = \"/panel/text3\"\r\nuiNode.GetBaseUIControl(text3Path).SetLayer(3,False)\r\n# 不同帧设置若干控件的层级\r\ndef _setLyerText1(path, layer):\r\n uiNode.GetBaseUIControl(text1Path).SetLayer(1,False,False)\r\ndef _updateScreen():\r\n uiNode.UpdateScreen(True)\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.AddTimer(100, _setLyerText1, \"/panel/text1\", 1)\r\ncomp.AddTimer(200, _setLyerText1, \"/panel/text2\", 2)\r\ncomp.AddTimer(300, _setLyerText1, \"/panel/text3\", 3)\r\ncomp.AddTimer(300, _updateScreen)" - }, + ], + "type": "api", + "side": "client", + "name": "SetLayer" + }, { - "type": "api", - "name": "SetMaxSize", - "method": "", - "description": "设置控件所允许的最大的大小值", - "remark": "- maxSize = (0, 0)表示无限制", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- maxSize = (0, 0)表示无限制", + "return": [], + "description": "设置控件所允许的最大的大小值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set image1 maxSize\r\nimagePath = \"/panel/image1\"\r\nimageMaxSize = (10, 10)\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nret = baseUIControl.SetMaxSize(imageMaxSize)", "params": [ { - "name": "maxSize", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "maxSize", "description": "该控件所允许的最大的大小值,第一项为横轴,第二项为纵轴" } - ], - "return": [], - "example": "# we want to set image1 maxSize\r\nimagePath = \"/panel/image1\"\r\nimageMaxSize = (10, 10)\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nret = baseUIControl.SetMaxSize(imageMaxSize)" - }, + ], + "type": "api", + "side": "client", + "name": "SetMaxSize" + }, { - "type": "api", - "name": "SetMinSize", - "method": "", - "description": "设置控件所允许的最小的大小值", - "remark": "- minSize = (0, 0)表示无限制", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- minSize = (0, 0)表示无限制", + "return": [], + "description": "设置控件所允许的最小的大小值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set image1 minSize\r\nimagePath = \"/panel/image1\"\r\nimageMinSize = (10, 10)\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nret = baseUIControl.SetMinSize(imageMinSize)", "params": [ { - "name": "minSize", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "minSize", "description": "该控件所允许的大小值,第一项为横轴,第二项为纵轴" } - ], - "return": [], - "example": "# we want to set image1 minSize\r\nimagePath = \"/panel/image1\"\r\nimageMinSize = (10, 10)\r\nbaseUIControl = uiNode.GetBaseUIControl(imagePath)\r\nret = baseUIControl.SetMinSize(imageMinSize)" - }, + ], + "type": "api", + "side": "client", + "name": "SetMinSize" + }, { - "type": "api", - "name": "SetOffsetDelta", - "method": "", - "description": "设置点击面板的拖拽偏移量", - "remark": "- 点击面板拖拽功能及拖拽偏移量相关,详见InputPanel", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 点击面板拖拽功能及拖拽偏移量相关,详见InputPanel", + "return": [], + "description": "设置点击面板的拖拽偏移量", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set inputPanel's offset_delta\r\ninputPanelPath = \"/inputPanel1\"\r\ninputPanel = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()\r\nsuccess = inputPanel.SetOffsetDelta((100, 100))", "params": [ { - "name": "offset_delta", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "offset_delta", "description": "该控件的拖拽偏移量,第一项为横轴,第二项为纵轴" } - ], - "return": [], - "example": "# we want to set inputPanel's offset_delta\r\ninputPanelPath = \"/inputPanel1\"\r\ninputPanel = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()\r\nsuccess = inputPanel.SetOffsetDelta((100, 100))" - }, + ], + "type": "api", + "side": "client", + "name": "SetOffsetDelta" + }, { - "type": "api", - "name": "SetOrientation", - "method": "", - "description": "设置stackPanel的排列方向", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置stackPanel的排列方向", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set stackPanel1 orientation\r\nstackPanelPath = \"/stackPanel1\"\r\nstackPanel = uiNode.GetBaseUIControl(stackPanelPath).asStackPanel()\r\norientation = \"vertical\"\r\nstackPanel.SetOrientation(orientation)", "params": [ { - "name": "orientation", - "type": "str", + "type": "str", + "name": "orientation", "description": "stackPanel的排列方向,取值有限为[\"vertical\", \"horizontal\"],分别表示垂直方向,水平方向" } - ], - "return": [], - "example": "# we want to set stackPanel1 orientation\r\nstackPanelPath = \"/stackPanel1\"\r\nstackPanel = uiNode.GetBaseUIControl(stackPanelPath).asStackPanel()\r\norientation = \"vertical\"\r\nstackPanel.SetOrientation(orientation)" - }, + ], + "type": "api", + "side": "client", + "name": "SetOrientation" + }, { - "type": "api", - "name": "SetPosition", - "method": "", - "description": "设置控件相对父节点的坐标", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置控件相对父节点的坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set text2 position\r\ntext2Path = \"/panel/text2\"\r\npos = (10, 10)\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\nbaseUIControl.SetPosition(pos)", "params": [ { - "name": "pos", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "pos", "description": "该控件相对父节点的坐标信息,第一项为横轴,第二项为纵轴" } - ], - "return": [], - "example": "# we want to set text2 position\r\ntext2Path = \"/panel/text2\"\r\npos = (10, 10)\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\nbaseUIControl.SetPosition(pos)" - }, + ], + "type": "api", + "side": "client", + "name": "SetPosition" + }, { - "type": "api", - "name": "SetRotatePivot", - "method": "", - "description": "设置图片自身旋转锚点,该点并不是固定的点,而是相对于自身位置的点", - "remark": "- 自身的旋转锚点是一个相对坐标,它是根据图片当前所在位置和大小进行计算的,所以一旦设置后,就会每帧都进行位置的计算。如果不调用该函数,默认状态下图片的旋转锚点是 (0.5, 0.5)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 自身的旋转锚点是一个相对坐标,它是根据图片当前所在位置和大小进行计算的,所以一旦设置后,就会每帧都进行位置的计算。如果不调用该函数,默认状态下图片的旋转锚点是 (0.5, 0.5)", + "return": [], + "description": "设置图片自身旋转锚点,该点并不是固定的点,而是相对于自身位置的点", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\n# 设置旋转锚点为图片的左上角\r\nimageControl.SetRotatePivot((0, 0))\r\n# 设置旋转锚点为图片的右上角\r\nimageControl.SetRotatePivot((1, 0))\r\n# 设置旋转锚点为图片的右下角\r\nimageControl.SetRotatePivot((1, 1))\r\n# 设置旋转锚点为图片的左下角\r\nimageControl.SetRotatePivot((0, 1))", "params": [ { - "name": "pivot", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "pivot", "description": "相对于自身位置的锚点,第一项为横轴x,第二项为纵轴y,锚点实际坐标=图片的position + anchor * (width, height)" } - ], - "return": [], - "example": "imagePath = \"/imagePath\"\r\nimageControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\n# 设置旋转锚点为图片的左上角\r\nimageControl.SetRotatePivot((0, 0))\r\n# 设置旋转锚点为图片的右上角\r\nimageControl.SetRotatePivot((1, 0))\r\n# 设置旋转锚点为图片的右下角\r\nimageControl.SetRotatePivot((1, 1))\r\n# 设置旋转锚点为图片的左下角\r\nimageControl.SetRotatePivot((0, 1))" - }, + ], + "type": "api", + "side": "client", + "name": "SetRotatePivot" + }, { - "type": "api", - "name": "SetScrollViewPercentValue", - "method": "", - "description": "设置当前scroll_view内容的百分比位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置当前scroll_view内容的百分比位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want set scroll_view percent pos\r\nscrollViewPath = \"/scroll_view0\"\r\nscrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView()\r\nscrollViewUIControl.SetScrollViewPercentValue(20)", "params": [ { - "name": "percent_value", - "type": "int", + "type": "int", + "name": "percent_value", "description": "需要跳转到的百分比位置,一般设置的位置会出现在scroll_view的最上方。该值取值范围0-100" } - ], - "return": [], - "example": "# we want set scroll_view percent pos\r\nscrollViewPath = \"/scroll_view0\"\r\nscrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView()\r\nscrollViewUIControl.SetScrollViewPercentValue(20)" - }, + ], + "type": "api", + "side": "client", + "name": "SetScrollViewPercentValue" + }, { - "type": "api", - "name": "SetScrollViewPos", - "method": "", - "description": "设置当前scroll_view内容的位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置当前scroll_view内容的位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want set scroll_view pos\r\nscrollViewPath = \"/scroll_view0\"\r\nscrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView()\r\nscrollViewUIControl.SetScrollViewPos(100)", "params": [ { - "name": "pos", - "type": "float", + "type": "float", + "name": "pos", "description": "需要跳转到的位置,一般设置的位置会出现在scroll_view的最上方。" } - ], - "return": [], - "example": "# we want set scroll_view pos\r\nscrollViewPath = \"/scroll_view0\"\r\nscrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView()\r\nscrollViewUIControl.SetScrollViewPos(100)" - }, + ], + "type": "api", + "side": "client", + "name": "SetScrollViewPos" + }, { - "type": "api", - "name": "SetSelectOptionByIndex", - "method": "", - "description": "根据提供的索引选中对应下拉框项", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "根据提供的索引选中对应下拉框项", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.SetSelectOptionByIndex(0)", "params": [ { - "name": "index", - "type": "int", + "type": "int", + "name": "index", "description": "索引" } - ], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.SetSelectOptionByIndex(0)" - }, + ], + "type": "api", + "side": "client", + "name": "SetSelectOptionByIndex" + }, { - "type": "api", - "name": "SetSelectOptionByShowName", - "method": "", - "description": "根据提供的展示文本选中对应下拉框项", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "根据提供的展示文本选中对应下拉框项", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.SetSelectOptionByShowName(\"测试项\")", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "索引" } - ], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()\r\ncomboBoxUIControl.SetSelectOptionByShowName(\"测试项\")" - }, + ], + "type": "api", + "side": "client", + "name": "SetSelectOptionByShowName" + }, { - "type": "api", - "name": "SetSize", - "method": "", - "description": "设置控件的大小", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置控件的大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set text2 size\r\ntext2Path = \"/panel/text2\"\r\ntext2Size = (10, 10)\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\nbaseUIControl.SetSize(text2Size)", "params": [ { - "name": "size", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "size", "description": "该控件的大小信息,第一项为横轴,第二项为纵轴" - }, + }, { - "name": "resizeChildren", - "type": "bool", + "type": "bool", + "name": "resizeChildren", "description": "是否同时调整子控件尺寸,默认为False" } - ], - "return": [], - "example": "# we want to set text2 size\r\ntext2Path = \"/panel/text2\"\r\ntext2Size = (10, 10)\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\nbaseUIControl.SetSize(text2Size)" - }, + ], + "type": "api", + "side": "client", + "name": "SetSize" + }, { - "type": "api", - "name": "SetSliderValue", - "method": "", - "description": "设置滑动条的值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置滑动条的值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set slider value\r\nsliderPath = \"/panel/slider0\"\r\nsliderUIControl = uiNode.GetBaseUIControl(sliderPath).asSlider()\r\nsliderUIControl.SetSliderValue(0.5) # 百分比滑动条\r\n# sliderUIControl.SetSliderValue(5) # 固定格类型滑动条", "params": [ { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "滑动条的值" } - ], - "return": [], - "example": "# we want to set slider value\r\nsliderPath = \"/panel/slider0\"\r\nsliderUIControl = uiNode.GetBaseUIControl(sliderPath).asSlider()\r\nsliderUIControl.SetSliderValue(0.5) # 百分比滑动条\r\n# sliderUIControl.SetSliderValue(5) # 固定格类型滑动条" - }, + ], + "type": "api", + "side": "client", + "name": "SetSliderValue" + }, { - "type": "api", - "name": "SetSprite", - "method": "", - "description": "给图片控件换指定贴图", - "remark": "- 给ImageButton换贴图的时候注意使用子控件路径(default / hover / pressed)获得ImageUIControl", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 给ImageButton换贴图的时候注意使用子控件路径(default / hover / pressed)获得ImageUIControl", + "return": [], + "description": "给图片控件换指定贴图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set image_button textures\r\nimageButtonPath = \"/image_button\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(imageButtonPath).asButton()\r\nbuttonDefaultUIControl = buttonUIControl.GetChildByName(\"default\").asImage()\r\nbuttonHoverUIControl = buttonUIControl.GetChildByName(\"hover\").asImage()\r\nbuttonPressedUIControl = buttonUIControl.GetChildByName(\"pressed\").asImage()\r\nbuttonDefaultUIControl.SetSprite(\"textures/button01_default\")\r\nbuttonHoverUIControl.SetSprite(\"textures/button01_hover\")\r\nbuttonPressedUIControl.SetSprite(\"textures/button01_pressed\")", "params": [ { - "name": "texturePath", - "type": "str", + "type": "str", + "name": "texturePath", "description": "贴图的路径,需要从resource_pack下面的textures目录开始" } - ], - "return": [], - "example": "# we want to set image_button textures\r\nimageButtonPath = \"/image_button\"\r\nbuttonUIControl = uiNode.GetBaseUIControl(imageButtonPath).asButton()\r\nbuttonDefaultUIControl = buttonUIControl.GetChildByName(\"default\").asImage()\r\nbuttonHoverUIControl = buttonUIControl.GetChildByName(\"hover\").asImage()\r\nbuttonPressedUIControl = buttonUIControl.GetChildByName(\"pressed\").asImage()\r\nbuttonDefaultUIControl.SetSprite(\"textures/button01_default\")\r\nbuttonHoverUIControl.SetSprite(\"textures/button01_hover\")\r\nbuttonPressedUIControl.SetSprite(\"textures/button01_pressed\")" - }, + ], + "type": "api", + "side": "client", + "name": "SetSprite" + }, { - "type": "api", - "name": "SetSpriteClipRatio", - "method": "", - "description": "设置图片的裁剪区域比例(不改变控件尺寸)。可以配合image控件的clip_ratio属性控制方向。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置图片的裁剪区域比例(不改变控件尺寸)。可以配合image控件的clip_ratio属性控制方向。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 我们想对UI编辑器创建的进度条设置进度\r\n# 编辑器进度条包含两个image控件(名为empty_progress_bar和filled_progress_bar)\r\nprogress = 0.8 # 用于模拟进度时,下面的裁剪比例需设为(1-进度),才能得到正确的视觉效果\r\nimagePath = \"/progress_bar0/filled_progress_bar\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.SetSpriteClipRatio(1.0 - progress)", "params": [ { - "name": "clipRatio", - "type": "float", + "type": "float", + "name": "clipRatio", "description": "图片的裁剪比例(范围0到1),裁剪精度与图片分辨率相关" } - ], - "return": [], - "example": "# 我们想对UI编辑器创建的进度条设置进度\r\n# 编辑器进度条包含两个image控件(名为empty_progress_bar和filled_progress_bar)\r\nprogress = 0.8 # 用于模拟进度时,下面的裁剪比例需设为(1-进度),才能得到正确的视觉效果\r\nimagePath = \"/progress_bar0/filled_progress_bar\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.SetSpriteClipRatio(1.0 - progress)" - }, + ], + "type": "api", + "side": "client", + "name": "SetSpriteClipRatio" + }, { - "type": "api", - "name": "SetSpriteColor", - "method": "", - "description": "设置图片颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置图片颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 我们想对耐久度条随耐久度变化颜色,满的时候为绿色,空的时候为红色,其中barPath为耐久度条路径\r\ndurabilityRatio = 0.8 # 耐久度比例,1为满耐久\r\nbarPath = \"/image_bar\"\r\nimageUIControl = uiNode.GetBaseUIControl(barPath).asImage()\r\nimageUIControl.SetSpriteColor((1 - durabilityRatio, durabilityRatio, 0))", "params": [ { - "name": "color", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "color", "description": "图片颜色rgb,取值[0, 1]" } - ], - "return": [], - "example": "# 我们想对耐久度条随耐久度变化颜色,满的时候为绿色,空的时候为红色,其中barPath为耐久度条路径\r\ndurabilityRatio = 0.8 # 耐久度比例,1为满耐久\r\nbarPath = \"/image_bar\"\r\nimageUIControl = uiNode.GetBaseUIControl(barPath).asImage()\r\nimageUIControl.SetSpriteColor((1 - durabilityRatio, durabilityRatio, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetSpriteColor" + }, { - "type": "api", - "name": "SetSpriteGray", - "method": "", - "description": "给图片控件置灰,比直接SetSprite一张灰图片效率要高", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "给图片控件置灰,比直接SetSprite一张灰图片效率要高", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want set image gray\r\nimagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.SetSpriteGray(True)", "params": [ { - "name": "gray", - "type": "bool", + "type": "bool", + "name": "gray", "description": "True为将图片置灰,False为恢复原色" } - ], - "return": [], - "example": "# we want set image gray\r\nimagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.SetSpriteGray(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetSpriteGray" + }, { - "type": "api", - "name": "SetSpritePlatformFrame", - "method": "", - "description": "设置图片为我的世界移动端启动器当前帐号的头像框", - "remark": "- 该接口仅支持移动端调用,其他平台该接口无效:\r\n - 当我的世界移动端启动器账号的头像框是动态头像框时,该头像框图片将无法被加载,该问题将在下个版本修复:", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# 我们想将当前图片控件设置为我的世界移动端启动器当前帐号的头像框\r\nimagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.SetSpritePlatformFrame()" - }, + "remark": "- 该接口仅支持移动端调用,其他平台该接口无效:\r\n - 当我的世界移动端启动器账号的头像框是动态头像框时,该头像框图片将无法被加载,该问题将在下个版本修复:", + "return": [], + "description": "设置图片为我的世界移动端启动器当前帐号的头像框", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 我们想将当前图片控件设置为我的世界移动端启动器当前帐号的头像框\r\nimagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.SetSpritePlatformFrame()", + "params": [], + "type": "api", + "side": "client", + "name": "SetSpritePlatformFrame" + }, { - "type": "api", - "name": "SetSpritePlatformHead", - "method": "", - "description": "设置图片为我的世界移动端启动器当前帐号的头像", - "remark": "- 该接口仅支持移动端调用,其他平台该接口无效:", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# 我们想将当前图片控件设置为我的世界移动端启动器当前帐号的头像\r\nimagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.SetSpritePlatformHead()" - }, + "remark": "- 该接口仅支持移动端调用,其他平台该接口无效:", + "return": [], + "description": "设置图片为我的世界移动端启动器当前帐号的头像", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 我们想将当前图片控件设置为我的世界移动端启动器当前帐号的头像\r\nimagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.SetSpritePlatformHead()", + "params": [], + "type": "api", + "side": "client", + "name": "SetSpritePlatformHead" + }, { - "type": "api", - "name": "SetSpriteUV", - "method": "", - "description": "设置图片的起始uv,与json中的\"uv\"属性作用一致", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置图片的起始uv,与json中的\"uv\"属性作用一致", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.SetSpriteUV((10, 0))", "params": [ { - "name": "uv", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "uv", "description": "图片的左上角为(0,0),向右为x轴,向下为y轴" } - ], - "return": [], - "example": "imagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.SetSpriteUV((10, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "SetSpriteUV" + }, { - "type": "api", - "name": "SetSpriteUVSize", - "method": "", - "description": "设置图片的uv大小,与json中的\"uv_size\"属性作用一致", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置图片的uv大小,与json中的\"uv_size\"属性作用一致", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.SetSpriteUVSize((40, 30))", "params": [ { - "name": "uvSize", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "uvSize", "description": "图片向右为x轴,向下为y轴" } - ], - "return": [], - "example": "imagePath = \"/image\"\r\nimageUIControl = uiNode.GetBaseUIControl(imagePath).asImage()\r\nimageUIControl.SetSpriteUVSize((40, 30))" - }, + ], + "type": "api", + "side": "client", + "name": "SetSpriteUVSize" + }, { - "type": "api", - "name": "SetText", - "method": "", - "description": "设置Label的文本信息", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置Label的文本信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set text2 content\r\ntext2Path = \"/panel/text2\"\r\ntext = \"Hello World!\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.SetText(text)", "params": [ { - "name": "text", - "type": "str", + "type": "str", + "name": "text", "description": "文本的内容,可以支持[样式代码](https://minecraft-zh.gamepedia.com/%E6%A0%B7%E5%BC%8F%E4%BB%A3%E7%A0%81)(§可以设置文字的颜色、格式等,该种用法更加灵活多变)" - }, + }, { - "name": "syncSize", - "type": "bool", + "type": "bool", + "name": "syncSize", "description": "是否设置文本时同步更新文本框大小,默认值为False" } - ], - "return": [], - "example": "# we want to set text2 content\r\ntext2Path = \"/panel/text2\"\r\ntext = \"Hello World!\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.SetText(text)" - }, + ], + "type": "api", + "side": "client", + "name": "SetText" + }, { - "type": "api", - "name": "SetTextAlignment", - "method": "", - "description": "设置文本控件的文本对齐方式", - "remark": "- textAlignment可选的值\r\n | 值 | 解释 |\r\n | ----------------| ------------------------------------------------------------ |\r\n | \"left\" | 文本左对齐(水平方向) |\r\n | \"right\" | 文本右对齐(水平方向) |\r\n | \"center\" | 文本居中对齐(水平方向)|", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- textAlignment可选的值\r\n | 值 | 解释 |\r\n | ----------------| ------------------------------------------------------------ |\r\n | \"left\" | 文本左对齐(水平方向) |\r\n | \"right\" | 文本右对齐(水平方向) |\r\n | \"center\" | 文本居中对齐(水平方向)|", + "return": [], + "description": "设置文本控件的文本对齐方式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to align text2 to center\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\ntextAlignment = \"center\"\r\nret = labelUIControl.SetTextAlignment(textAlignment)", "params": [ { - "name": "textAlignment", - "type": "str", + "type": "str", + "name": "textAlignment", "description": "文本控件的文本对齐方式,可选的值详见备注" } - ], - "return": [], - "example": "# we want to align text2 to center\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\ntextAlignment = \"center\"\r\nret = labelUIControl.SetTextAlignment(textAlignment)" - }, + ], + "type": "api", + "side": "client", + "name": "SetTextAlignment" + }, { - "type": "api", - "name": "SetTextColor", - "method": "", - "description": "设置Label文本的颜色", - "remark": "- 该接口不支持传入alpha通道改变透明度,建议使用SetAlpha接口", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 该接口不支持传入alpha通道改变透明度,建议使用SetAlpha接口", + "return": [], + "description": "设置Label文本的颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set text2 green\r\ntext2Path = \"/panel/text2\"\r\ncolor = (0, 1, 0)\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.SetTextColor(color)", "params": [ { - "name": "color", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "color", "description": "文本的颜色信息(r, g, b),取值[0, 1]" } - ], - "return": [], - "example": "# we want to set text2 green\r\ntext2Path = \"/panel/text2\"\r\ncolor = (0, 1, 0)\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.SetTextColor(color)" - }, + ], + "type": "api", + "side": "client", + "name": "SetTextColor" + }, { - "type": "api", - "name": "SetTextFontSize", - "method": "", - "description": "设置Label中文本字体的大小", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置Label中文本字体的大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# set text font size\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.SetTextFontSize(0.8)", "params": [ { - "name": "scale", - "type": "float", + "type": "float", + "name": "scale", "description": "label的font_size的作用是Label中的默认字体大小,取值有限为[small normal large],这个scale是在这个默认字体的基础上进行缩放字体大小,默认字体大小为1.0" } - ], - "return": [], - "example": "# set text font size\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\nlabelUIControl.SetTextFontSize(0.8)" - }, + ], + "type": "api", + "side": "client", + "name": "SetTextFontSize" + }, { - "type": "api", - "name": "SetTextLinePadding", - "method": "", - "description": "设置文本控件的行间距", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置文本控件的行间距", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set text2 textLinePadding\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\ntextLinePadding = 20\r\nret = labelUIControl.SetTextLinePadding(textLinePadding)", "params": [ { - "name": "textLinePadding", - "type": "float", + "type": "float", + "name": "textLinePadding", "description": "文本控件的行间距,单位为像素" } - ], - "return": [], - "example": "# we want to set text2 textLinePadding\r\ntext2Path = \"/panel/text2\"\r\nlabelUIControl = uiNode.GetBaseUIControl(text2Path).asLabel()\r\ntextLinePadding = 20\r\nret = labelUIControl.SetTextLinePadding(textLinePadding)" - }, + ], + "type": "api", + "side": "client", + "name": "SetTextLinePadding" + }, { - "type": "api", - "name": "SetToggleState", - "method": "", - "description": "设置Toggle开关控件的值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置Toggle开关控件的值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "togglePath = \"/toggle1\"\r\nswitchToggleUIControl = uiNode.GetBaseUIControl(togglePath).asSwitchToggle()\r\nswitchToggleUIControl.SetToggleState(True)", "params": [ { - "name": "is_on", - "type": "bool", + "type": "bool", + "name": "is_on", "description": "设置Toggle开关控件是打开还是关闭状态" - }, + }, { - "name": "toggle_path", - "type": "str", + "type": "str", + "name": "toggle_path", "description": "实际toggle控件相对路径,由UI编辑器生成的开关控件该参数即为默认值\"/this_toggle\"" } - ], - "return": [], - "example": "togglePath = \"/toggle1\"\r\nswitchToggleUIControl = uiNode.GetBaseUIControl(togglePath).asSwitchToggle()\r\nswitchToggleUIControl.SetToggleState(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetToggleState" + }, { - "type": "api", - "name": "SetTouchEnable", - "method": "", - "description": "设置控件是否可点击交互", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置控件是否可点击交互", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set image_button unable\r\nimageButtonPath = \"/image_button\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imageButtonPath)\r\nbaseUIControl.SetTouchEnable(False)", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "False为不响应,True为恢复响应" } - ], - "return": [], - "example": "# we want to set image_button unable\r\nimageButtonPath = \"/image_button\"\r\nbaseUIControl = uiNode.GetBaseUIControl(imageButtonPath)\r\nbaseUIControl.SetTouchEnable(False)" - }, + ], + "type": "api", + "side": "client", + "name": "SetTouchEnable" + }, { - "type": "api", - "name": "SetTouchUpCallback", - "method": "", - "description": "设置轮盘选择切片并且鼠标按下抬起后触发回调函数", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置轮盘选择切片并且鼠标按下抬起后触发回调函数", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "def onSelectionWheelTouchUp():\r\n pass\r\n\r\nselectionWheelPath = \"/selectionWheel\"\r\nselectionWheelControl = uiNode.GetBaseUIControl(selectionWheelPath).asSelectionWheel()\r\nselectionWheelControl.SetTouchUpCallback(onSelectionWheelTouchUp)", "params": [ { - "name": "callbackFunc", - "type": "function", + "type": "function", + "name": "callbackFunc", "description": "回调函数,必须是UI的类函数,并且无参数" } - ], - "return": [], - "example": "def onSelectionWheelTouchUp():\r\n pass\r\n\r\nselectionWheelPath = \"/selectionWheel\"\r\nselectionWheelControl = uiNode.GetBaseUIControl(selectionWheelPath).asSelectionWheel()\r\nselectionWheelControl.SetTouchUpCallback(onSelectionWheelTouchUp)" - }, + ], + "type": "api", + "side": "client", + "name": "SetTouchUpCallback" + }, { - "type": "api", - "name": "SetUiItem", - "method": "", - "description": "设置ItemRenderer控件显示的物品,ItemRenderer控件的配置方式详见控件介绍ItemRenderer", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置ItemRenderer控件显示的物品,ItemRenderer控件的配置方式详见控件介绍ItemRenderer", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "#设置显示为羊毛wool\r\nitemRenderPath = \"/panel/item_renderer\"\r\nitemName = \"minecraft:wool\"\r\nauxValue = 0\r\nitemRendererBaseControl = uiNode.GetBaseUIControl(itemRenderPath)\r\nitemRendererControl = itemRendererBaseControl.asItemRenderer()\r\nitemRendererControl.SetUiItem(itemName, auxValue)", "params": [ { - "name": "itemName", - "type": "str", + "type": "str", + "name": "itemName", "description": "物品identifier" - }, + }, { - "name": "auxValue", - "type": "int", + "type": "int", + "name": "auxValue", "description": "物品附加值" - }, + }, { - "name": "isEnchanted", - "type": "bool", + "type": "bool", + "name": "isEnchanted", "description": "可选参数,是否显示附魔效果,默认为False不显示" - }, + }, { - "name": "userData", - "type": "dict", + "type": "dict", + "name": "userData", "description": "可选参数,如果是灾厄旗帜或焰火之星等带有userData的需要传入该参数才能正确显示,目前已知仅有灾厄旗帜和焰火之星需要传" } - ], - "return": [], - "example": "#设置显示为羊毛wool\r\nitemRenderPath = \"/panel/item_renderer\"\r\nitemName = \"minecraft:wool\"\r\nauxValue = 0\r\nitemRendererBaseControl = uiNode.GetBaseUIControl(itemRenderPath)\r\nitemRendererControl = itemRendererBaseControl.asItemRenderer()\r\nitemRendererControl.SetUiItem(itemName, auxValue)" - }, + ], + "type": "api", + "side": "client", + "name": "SetUiItem" + }, { - "type": "api", - "name": "SetValue", - "method": "", - "description": "设置进度条的进度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "设置进度条的进度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# we want to set progress\r\nprogressBarPath = \"/panel/progress_bar\"\r\nprogressBarUIControl = uiNode.GetBaseUIControl(progressBarPath).asProgressBar()\r\nprogressBarUIControl.SetValue(0.8)", "params": [ { - "name": "progress", - "type": "float", + "type": "float", + "name": "progress", "description": "进度,取值[0, 1]" } - ], - "return": [], - "example": "# we want to set progress\r\nprogressBarPath = \"/panel/progress_bar\"\r\nprogressBarUIControl = uiNode.GetBaseUIControl(progressBarPath).asProgressBar()\r\nprogressBarUIControl.SetValue(0.8)" - }, + ], + "type": "api", + "side": "client", + "name": "SetValue" + }, { - "type": "api", - "name": "SetVisible", - "method": "", - "description": "根据控件路径选择是否显示某控件,可以通过传入空字符串(\"\")的方式来调整整个JSON的显示/隐藏", - "remark": "- 特殊情况说明:\r\n 当该接口的调用来自滚动列表内容控件中的按钮回调,且调用目的是隐藏滚动列表控件或其父节点控件时,将forceUpdate参数置True会导致滚动列表数据异常。若没有刷新界面的必要请将forceUpdate参数置False,若有请使用定时器延迟执行手动UpdateScreen接口。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 特殊情况说明:\r\n 当该接口的调用来自滚动列表内容控件中的按钮回调,且调用目的是隐藏滚动列表控件或其父节点控件时,将forceUpdate参数置True会导致滚动列表数据异常。若没有刷新界面的必要请将forceUpdate参数置False,若有请使用定时器延迟执行手动UpdateScreen接口。", + "return": [], + "description": "根据控件路径选择是否显示某控件,可以通过传入空字符串(\"\")的方式来调整整个JSON的显示/隐藏", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 隐藏panel的子控件text2\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\nbaseUIControl.SetVisible(False)\r\n# 在非同一帧,隐藏panel的子控件text1, text2, text3\r\nparentPath = \"/panel\"\r\ntextPrefabPath = \"/panel/text_prefab\"\r\ndef _tickSetVisible(pathName):\r\n baseUIControl = uiNode.GetBaseUIControl(pathName)\r\n baseUIControl.SetVisible(False, False)\r\ndef _tickUpdateScreen():\r\n uiNode.UpdateScreen(True)\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.AddTimer(100, _tickSetVisible, \"/panel/text1\")\r\ncomp.AddTimer(200, _tickSetVisible, \"/panel/text2\")\r\ncomp.AddTimer(300, _tickSetVisible, \"/panel/text3\")\r\ncomp.AddTimer(300, _tickUpdateScreen)", "params": [ { - "name": "visible", - "type": "bool", + "type": "bool", + "name": "visible", "description": "False为隐藏该控件,True为显示该控件" - }, + }, { - "name": "forceUpdate", - "type": "bool", + "type": "bool", + "name": "forceUpdate", "description": "是否需要强制刷新,默认值为True。置True则按照马上进行刷新,新的visible状态生效。置False,则需要再次调用UpdateScreen使新状态生效。如有大量SetVisible操作且非在同一帧执行,建议设置为False,需要更新时再调用UpdateScreen接口刷新界面及相关控件数据" } - ], - "return": [], - "example": "# 隐藏panel的子控件text2\r\ntext2Path = \"/panel/text2\"\r\nbaseUIControl = uiNode.GetBaseUIControl(text2Path)\r\nbaseUIControl.SetVisible(False)\r\n# 在非同一帧,隐藏panel的子控件text1, text2, text3\r\nparentPath = \"/panel\"\r\ntextPrefabPath = \"/panel/text_prefab\"\r\ndef _tickSetVisible(pathName):\r\n baseUIControl = uiNode.GetBaseUIControl(pathName)\r\n baseUIControl.SetVisible(False, False)\r\ndef _tickUpdateScreen():\r\n uiNode.UpdateScreen(True)\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.AddTimer(100, _tickSetVisible, \"/panel/text1\")\r\ncomp.AddTimer(200, _tickSetVisible, \"/panel/text2\")\r\ncomp.AddTimer(300, _tickSetVisible, \"/panel/text3\")\r\ncomp.AddTimer(300, _tickUpdateScreen)" - }, + ], + "type": "api", + "side": "client", + "name": "SetVisible" + }, { - "type": "api", - "name": "StopAnimation", - "method": "", - "description": "停止动画,动画将恢复到第一段动画片段的from状态", - "remark": "- UI属性动画相关,详见属性动画", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- UI属性动画相关,详见属性动画", + "return": [], + "description": "停止动画,动画将恢复到第一段动画片段的from状态", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n# 停止所有动画\r\ncontrol.StopAnimation()\r\n# 停止尺寸动画\r\n# control.StopAnimation(\"size\")\r\n# 停止位移动画\r\n# control.StopAnimation(\"offset\")\r\n# 其他属性也是支持停止的,具体可参见备注", "params": [ { - "name": "propertyName", - "type": "str", + "type": "str", + "name": "propertyName", "description": "动画的属性名称,默认值为\"all\",表示停止所有动画,不为\"all\"的时候表示单个动画的停止,比如propertyName==\"size\"时,表示停止尺寸属性上的动画" } - ], - "return": [], - "example": "# 获取控件\r\ncontrol = uiNode.GetBaseUIControl(\"/image\")\r\n# 停止所有动画\r\ncontrol.StopAnimation()\r\n# 停止尺寸动画\r\n# control.StopAnimation(\"size\")\r\n# 停止位移动画\r\n# control.StopAnimation(\"offset\")\r\n# 其他属性也是支持停止的,具体可参见备注" - }, + ], + "type": "api", + "side": "client", + "name": "StopAnimation" + }, { - "type": "api", - "name": "ZoomIn", - "method": "", - "description": "放大地图", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "放大地图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.ZoomIn(0.2)", "params": [ { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "在原有基础上的增量值,可以控制放大速度,默认为0.05" } - ], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.ZoomIn(0.2)" - }, + ], + "type": "api", + "side": "client", + "name": "ZoomIn" + }, { - "type": "api", - "name": "ZoomOut", - "method": "", - "description": "缩小地图", - "remark": "- 客户端地图区块加载有限,如果地图UI界面太大或者缩小地图倍数太大,会导致小地图无法显示未加载的区块。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "- 客户端地图区块加载有限,如果地图UI界面太大或者缩小地图倍数太大,会导致小地图无法显示未加载的区块。", + "return": [], + "description": "缩小地图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.ZoomOut(0.2)", "params": [ { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "在原有基础上的减少值,可以控制缩小速度,默认为0.05" } - ], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.ZoomOut(0.2)" - }, + ], + "type": "api", + "side": "client", + "name": "ZoomOut" + }, { - "type": "api", - "name": "ZoomReset", - "method": "", - "description": "恢复地图放缩大小为默认值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.ZoomReset(0.2)" - }, + "remark": "", + "return": [], + "description": "恢复地图放缩大小为默认值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/demoPanel/netease_mini_map\"\r\nmap = uiNode.GetBaseUIControl(path).asMiniMap()\r\nmap.ZoomReset(0.2)", + "params": [], + "type": "api", + "side": "client", + "name": "ZoomReset" + }, { - "type": "api", - "name": "asButton", - "method": "", - "description": "将当前BaseUIControl转换为ButtonUIControl实例,如当前控件非button类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "buttonPath = \"/button\"\r\nbuttonBaseControl = uiNode.GetBaseUIControl(buttonPath)\r\nbuttonControl = buttonBaseControl.asButton()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为ButtonUIControl实例,如当前控件非button类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "buttonPath = \"/button\"\r\nbuttonBaseControl = uiNode.GetBaseUIControl(buttonPath)\r\nbuttonControl = buttonBaseControl.asButton()", + "params": [], + "type": "api", + "side": "client", + "name": "asButton" + }, { - "type": "api", - "name": "asGrid", - "method": "", - "description": "将当前BaseUIControl转换为GridUIControl实例,如当前控件非grid类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "gridPath = \"/grid\"\r\ngridBaseControl = uiNode.GetBaseUIControl(gridPath)\r\ngridControl = gridBaseControl.asGrid()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为GridUIControl实例,如当前控件非grid类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "gridPath = \"/grid\"\r\ngridBaseControl = uiNode.GetBaseUIControl(gridPath)\r\ngridControl = gridBaseControl.asGrid()", + "params": [], + "type": "api", + "side": "client", + "name": "asGrid" + }, { - "type": "api", - "name": "asImage", - "method": "", - "description": "将当前BaseUIControl转换为ImageUIControl实例,如当前控件非image类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "imagePath = \"/image\"\r\nimageBaseControl = uiNode.GetBaseUIControl(imagePath)\r\nimageControl = imageBaseControl.asImage()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为ImageUIControl实例,如当前控件非image类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "imagePath = \"/image\"\r\nimageBaseControl = uiNode.GetBaseUIControl(imagePath)\r\nimageControl = imageBaseControl.asImage()", + "params": [], + "type": "api", + "side": "client", + "name": "asImage" + }, { - "type": "api", - "name": "asInputPanel", - "method": "", - "description": "将当前BaseUIControl转换为InputPanelUIControl实例,如当前控件非inputPanel类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "inputPanelPath = \"/inputPanel\"\r\ninputPanelUIControl = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为InputPanelUIControl实例,如当前控件非inputPanel类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "inputPanelPath = \"/inputPanel\"\r\ninputPanelUIControl = uiNode.GetBaseUIControl(inputPanelPath).asInputPanel()", + "params": [], + "type": "api", + "side": "client", + "name": "asInputPanel" + }, { - "type": "api", - "name": "asItemRenderer", - "method": "", - "description": "将当前BaseUIControl转换为ItemRenderer实例,如当前控件非custom类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "itemRendererPath = \"/item_renderer\"\r\nitemRendererBaseControl = uiNode.GetBaseUIControl(itemRendererPath)\r\nitemRendererControl = itemRendererBaseControl.asItemRenderer()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为ItemRenderer实例,如当前控件非custom类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "itemRendererPath = \"/item_renderer\"\r\nitemRendererBaseControl = uiNode.GetBaseUIControl(itemRendererPath)\r\nitemRendererControl = itemRendererBaseControl.asItemRenderer()", + "params": [], + "type": "api", + "side": "client", + "name": "asItemRenderer" + }, { - "type": "api", - "name": "asLabel", - "method": "", - "description": "将当前BaseUIControl转换为LabelUIControl实例,如当前控件非Label类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "text1Path = \"/text1\"\r\ntext1BaseControl = uiNode.GetBaseUIControl(text1Path)\r\ntext1LabelControl = text1BaseControl.asLabel()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为LabelUIControl实例,如当前控件非Label类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "text1Path = \"/text1\"\r\ntext1BaseControl = uiNode.GetBaseUIControl(text1Path)\r\ntext1LabelControl = text1BaseControl.asLabel()", + "params": [], + "type": "api", + "side": "client", + "name": "asLabel" + }, { - "type": "api", - "name": "asMiniMap", - "method": "", - "description": "将当前BaseUIControl转换为MiniMapUIControl实例,如当前控件非小地图类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "path = \"/mini_map\"\r\nminiMapBaseControl = uiNode.GetBaseUIControl(path)\r\nminiMapControl = miniMapBaseControl.asMiniMap()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为MiniMapUIControl实例,如当前控件非小地图类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/mini_map\"\r\nminiMapBaseControl = uiNode.GetBaseUIControl(path)\r\nminiMapControl = miniMapBaseControl.asMiniMap()", + "params": [], + "type": "api", + "side": "client", + "name": "asMiniMap" + }, { - "type": "api", - "name": "asNeteaseComboBox", - "method": "", - "description": "将当前BaseUIControl转换为NeteaseComboBoxUIControl实例,如当前控件非panel类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为NeteaseComboBoxUIControl实例,如当前控件非panel类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "comboBoxPath = \"/panel/comboBoxPanel\"\r\ncomboBoxUIControl = uiNode.GetBaseUIControl(comboBoxPath).asNeteaseComboBox()", + "params": [], + "type": "api", + "side": "client", + "name": "asNeteaseComboBox" + }, { - "type": "api", - "name": "asNeteasePaperDoll", - "method": "", - "description": "将当前BaseUIControl转换为NeteasePaperDollUIControl实例,如当前控件非custom类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "paperDollPath = \"/paper_doll\"\r\npaperDollBaseControl = uiNode.GetBaseUIControl(paperDollPath)\r\npaperDollControl = paperDollBaseControl.asNeteasePaperDoll()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为NeteasePaperDollUIControl实例,如当前控件非custom类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "paperDollPath = \"/paper_doll\"\r\npaperDollBaseControl = uiNode.GetBaseUIControl(paperDollPath)\r\npaperDollControl = paperDollBaseControl.asNeteasePaperDoll()", + "params": [], + "type": "api", + "side": "client", + "name": "asNeteasePaperDoll" + }, { - "type": "api", - "name": "asProgressBar", - "method": "", - "description": "将当前BaseUIControl转换为ProgressBarUIControl实例,如当前控件非panel类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为ProgressBarUIControl实例,如当前控件非panel类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "progressBarPath = \"/progress_bar\"\r\nprogressBarBaseControl = uiNode.GetBaseUIControl(progressBarPath)\r\nprogressBarControl = progressBarBaseControl.asProgressBar()", "params": [ { - "name": "fillImagePath", - "type": "str", + "type": "str", + "name": "fillImagePath", "description": "进度条填充图片路径,默认为\"/filled_progress_bar\",该参数影响该控件API的效果" } - ], - "return": [], - "example": "progressBarPath = \"/progress_bar\"\r\nprogressBarBaseControl = uiNode.GetBaseUIControl(progressBarPath)\r\nprogressBarControl = progressBarBaseControl.asProgressBar()" - }, + ], + "type": "api", + "side": "client", + "name": "asProgressBar" + }, { - "type": "api", - "name": "asScrollView", - "method": "", - "description": "将当前BaseUIControl转换为ScrollViewUIControl实例,如当前控件非scrollview类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "scrollViewPath = \"/scroll_view\"\r\nscrollViewBaseControl = uiNode.GetBaseUIControl(scrollViewPath)\r\nscrollViewControl = scrollviewBaseControl.asScrollView()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为ScrollViewUIControl实例,如当前控件非scrollview类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "scrollViewPath = \"/scroll_view\"\r\nscrollViewBaseControl = uiNode.GetBaseUIControl(scrollViewPath)\r\nscrollViewControl = scrollviewBaseControl.asScrollView()", + "params": [], + "type": "api", + "side": "client", + "name": "asScrollView" + }, { - "type": "api", - "name": "asSelectionWheel", - "method": "", - "description": "将当前BaseUIControl转换为SelectionWheelUIControl实例,如当前控件非selectionWheel类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "selectionWheelPath = \"/selectionWheel\"\r\nselectionWheelControl = uiNode.GetBaseUIControl(selectionWheelPath).asSelectionWheel()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为SelectionWheelUIControl实例,如当前控件非selectionWheel类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "selectionWheelPath = \"/selectionWheel\"\r\nselectionWheelControl = uiNode.GetBaseUIControl(selectionWheelPath).asSelectionWheel()", + "params": [], + "type": "api", + "side": "client", + "name": "asSelectionWheel" + }, { - "type": "api", - "name": "asSlider", - "method": "", - "description": "将当前BaseUIControl转换为SliderUIControl实例,如当前控件非滑动条类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "path = \"/slider0\"\r\nsliderBaseControl = uiNode.GetBaseUIControl(path)\r\nsliderControl = sliderBaseControl.asSlider()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为SliderUIControl实例,如当前控件非滑动条类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "path = \"/slider0\"\r\nsliderBaseControl = uiNode.GetBaseUIControl(path)\r\nsliderControl = sliderBaseControl.asSlider()", + "params": [], + "type": "api", + "side": "client", + "name": "asSlider" + }, { - "type": "api", - "name": "asStackPanel", - "method": "", - "description": "将当前BaseUIControl转换为StackPanelUIControl实例,如当前控件非stackPanel类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "stackPanelPath = \"/stackPanel\"\r\nstackPanelUIControl = uiNode.GetBaseUIControl(stackPanelPath).asStackPanel()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为StackPanelUIControl实例,如当前控件非stackPanel类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "stackPanelPath = \"/stackPanel\"\r\nstackPanelUIControl = uiNode.GetBaseUIControl(stackPanelPath).asStackPanel()", + "params": [], + "type": "api", + "side": "client", + "name": "asStackPanel" + }, { - "type": "api", - "name": "asSwitchToggle", - "method": "", - "description": "将当前BaseUIControl转换为SwitchToggleUIControl实例,如当前控件非panel类型或非toggle则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "switchTogglePath = \"/switch_toggle\"\r\nswitchToggleBaseControl = uiNode.GetBaseUIControl(switchTogglePath)\r\nswitchToggleControl = switchToggleBaseControl.asSwitchToggle()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为SwitchToggleUIControl实例,如当前控件非panel类型或非toggle则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "switchTogglePath = \"/switch_toggle\"\r\nswitchToggleBaseControl = uiNode.GetBaseUIControl(switchTogglePath)\r\nswitchToggleControl = switchToggleBaseControl.asSwitchToggle()", + "params": [], + "type": "api", + "side": "client", + "name": "asSwitchToggle" + }, { - "type": "api", - "name": "asTextEditBox", - "method": "", - "description": "将当前BaseUIControl转换为TextEditBoxUIControl实例,如当前控件非editbox类型则返回None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "textEditBoxPath = \"/text_edit_box\"\r\ntextEditBoxBaseControl = uiNode.GetBaseUIControl(textEditBoxPath)\r\ntextEditBoxControl = textEditBoxBaseControl.asTextEditBox()" - }, + "remark": "", + "return": [], + "description": "将当前BaseUIControl转换为TextEditBoxUIControl实例,如当前控件非editbox类型则返回None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "textEditBoxPath = \"/text_edit_box\"\r\ntextEditBoxBaseControl = uiNode.GetBaseUIControl(textEditBoxPath)\r\ntextEditBoxControl = textEditBoxBaseControl.asTextEditBox()", + "params": [], + "type": "api", + "side": "client", + "name": "asTextEditBox" + }, { - "type": "api", - "name": "resetAnimation", - "method": "", - "description": "重置该控件的动画", - "remark": "- UI属性动画相关,详见属性动画", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", - "params": [], - "return": [], - "example": "# 重置/text1控件上的属性动画\r\ntext1Path = \"/text1\"\r\ntext1Control = uiNode.GetBaseUIControl(text1Path)\r\ntext1Control.resetAnimation()" - }, + "remark": "- UI属性动画相关,详见属性动画", + "return": [], + "description": "重置该控件的动画", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI控件.md", + "example": "# 重置/text1控件上的属性动画\r\ntext1Path = \"/text1\"\r\ntext1Control = uiNode.GetBaseUIControl(text1Path)\r\ntext1Control.resetAnimation()", + "params": [], + "type": "api", + "side": "client", + "name": "resetAnimation" + }, { - "type": "api", - "name": "BindVirtualWorldModel", - "method": "", - "description": "绑定虚拟世界中的模型", - "remark": "- 绑定的对象销毁时UI不会销毁,而是会隐藏起来,建议复用或者销毁", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "- 绑定的对象销毁时UI不会销毁,而是会隐藏起来,建议复用或者销毁", + "return": [], + "description": "绑定虚拟世界中的模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# 若是被绑定的UI需要创建多份,则需要使用此方式进行创建:\r\nuiNode=clientApi.CreateUI(\"modNamespace\",\"testUI\", {\r\n \"bindEntityId\": clientApi.GetLocalPlayerId()\r\n})\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.VirtualWorldCreate()\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nsucc = uiNode.BindVirtualWorldModel(objId, (0.0, 0.0, 0.0))", "params": [ { - "name": "bindToObjId", - "type": "int", + "type": "int", + "name": "bindToObjId", "description": "绑定的模型对象的id" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "UI与绑定实体的偏移量" } - ], - "return": [], - "example": "# 若是被绑定的UI需要创建多份,则需要使用此方式进行创建:\r\nuiNode=clientApi.CreateUI(\"modNamespace\",\"testUI\", {\r\n \"bindEntityId\": clientApi.GetLocalPlayerId()\r\n})\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.VirtualWorldCreate()\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nsucc = uiNode.BindVirtualWorldModel(objId, (0.0, 0.0, 0.0))" - }, + ], + "type": "api", + "side": "client", + "name": "BindVirtualWorldModel" + }, { - "type": "api", - "name": "ChangeBindAutoScale", - "method": "", - "description": "设置已绑定实体的UI是否根据绑定实体与本地玩家间的距离动态缩放,**只对已绑定实体的UI界面生效,如何将UI与实体绑定详见[CreateUI](通用.md#CreateUI)接口**", - "remark": "- 注意:\r\n 绑定实体的UI缩放仅作用于根节点(比如\"main\"节点)下的子节点。\r\n \r\n 建议在根节点下挂载一个panel类型的节点,然后将所有需要缩放的UI节点设置为百分比属性并挂载在这个panel节点下。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "- 注意:\r\n 绑定实体的UI缩放仅作用于根节点(比如\"main\"节点)下的子节点。\r\n \r\n 建议在根节点下挂载一个panel类型的节点,然后将所有需要缩放的UI节点设置为百分比属性并挂载在这个panel节点下。", + "return": [], + "description": "设置已绑定实体的UI是否根据绑定实体与本地玩家间的距离动态缩放,**只对已绑定实体的UI界面生效,如何将UI与实体绑定详见[CreateUI](通用.md#CreateUI)接口**", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "succ = uiNode.ChangeBindAutoScale(1)", "params": [ { - "name": "autoScale", - "type": "int", + "type": "int", + "name": "autoScale", "description": "1:动态缩放 0:不动态缩放" } - ], - "return": [], - "example": "succ = uiNode.ChangeBindAutoScale(1)" - }, + ], + "type": "api", + "side": "client", + "name": "ChangeBindAutoScale" + }, { - "type": "api", - "name": "ChangeBindEntityId", - "method": "", - "description": "修改绑定的实体id,**只对已绑定实体的UI界面生效,如何将UI与实体绑定详见[CreateUI](通用.md#CreateUI)接口**", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "修改绑定的实体id,**只对已绑定实体的UI界面生效,如何将UI与实体绑定详见[CreateUI](通用.md#CreateUI)接口**", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "succ = uiNode.ChangeBindEntityId(entityId)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "绑定的实体id" } - ], - "return": [], - "example": "succ = uiNode.ChangeBindEntityId(entityId)" - }, + ], + "type": "api", + "side": "client", + "name": "ChangeBindEntityId" + }, { - "type": "api", - "name": "ChangeBindOffset", - "method": "", - "description": "修改与绑定实体之间的偏移量,**只对已绑定实体的UI界面生效,如何将UI与实体绑定详见[CreateUI](通用.md#CreateUI)接口**", - "remark": "- 不建议在第一人称视角下,将本地玩家绑定UI的偏移量设为(0, 0, 0)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "- 不建议在第一人称视角下,将本地玩家绑定UI的偏移量设为(0, 0, 0)", + "return": [], + "description": "修改与绑定实体之间的偏移量,**只对已绑定实体的UI界面生效,如何将UI与实体绑定详见[CreateUI](通用.md#CreateUI)接口**", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "succ = uiNode.ChangeBindOffset((0, 3, 0))", "params": [ { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "偏移量" } - ], - "return": [], - "example": "succ = uiNode.ChangeBindOffset((0, 3, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "ChangeBindOffset" + }, { - "type": "api", - "name": "Clone", - "method": "", - "description": "克隆一个已有的控件,修改它的名称,并将它挂接到指定的父节点上,目前文本、图片、按钮控件的克隆控件表现正常,其他复杂控件的克隆控件可能存在运行问题,建议在json编写的过程中,手动复制一份对应控件使用。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "克隆一个已有的控件,修改它的名称,并将它挂接到指定的父节点上,目前文本、图片、按钮控件的克隆控件表现正常,其他复杂控件的克隆控件可能存在运行问题,建议在json编写的过程中,手动复制一份对应控件使用。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# 克隆text2控件,重命名为text3并以panel为父控件\r\nparentPath = \"/panel\"\r\ntext2Path = \"/panel/text2\"\r\ntext3Name = \"text3\"\r\nuiNode.Clone(text2Path, parentPath, text3Name)\r\n# 以panel为父控件,以text_prefab为模板克隆若干控件\r\nparentPath = \"/panel\"\r\ntextPrefabPath = \"/panel/text_prefab\"\r\nfor i in range(0, 10):\r\n uiNode.Clone(textPrefabPath, parentPath, \"text\" + str(i), False)\r\nuiNode.UpdateScreen(True)\r\n# 在非同一帧,以panel为父控件,text_prefab为模板克隆若干控件\r\nparentPath = \"/panel\"\r\ntextPrefabPath = \"/panel/text_prefab\"\r\ndef _tickClone(newName):\r\n uiNode.Clone(textPrefabPath, parentPath, newName , False, False)\r\ndef _tickUpdateScreen():\r\n uiNode.UpdateScreen(True)\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.AddTimer(100, _tickClone, \"text1\")\r\ncomp.AddTimer(200, _tickClone, \"text2\")\r\ncomp.AddTimer(300, _tickUpdateScreen)", "params": [ { - "name": "componentPath", - "type": "str", + "type": "str", + "name": "componentPath", "description": "为从main节点开始的控件路径" - }, + }, { - "name": "parentPath", - "type": "str", + "type": "str", + "name": "parentPath", "description": "为从main节点开始,父节点的控件路径" - }, + }, { - "name": "newName", - "type": "str", + "type": "str", + "name": "newName", "description": "为克隆成功后创建的新控件名称,新控件的路径为parentPath/newName" - }, + }, { - "name": "syncRefresh", - "type": "bool", + "type": "bool", + "name": "syncRefresh", "description": "是否需要同步刷新,默认值为True。置True为游戏在同一帧计算该控件的Size等相关数据,置False则在下一帧进行计算。**如同一帧有大量clone操作建议置False,操作结束后调用一次UpdateScreen接口刷新界面及相关控件数据**" - }, + }, { - "name": "forceUpdate", - "type": "bool", + "type": "bool", + "name": "forceUpdate", "description": "是否需要强制刷新,默认值为True。置True则按照syncRefresh逻辑进行同一帧或者下一帧刷新,置False则当前帧和下一帧均不刷新,需要手动调用UpdateScreen进行刷新。如有大量Clone操作且非在同一帧执行,建议设置为False,需要更新时再调用UpdateScreen接口刷新界面及相关控件数据" } - ], - "return": [], - "example": "# 克隆text2控件,重命名为text3并以panel为父控件\r\nparentPath = \"/panel\"\r\ntext2Path = \"/panel/text2\"\r\ntext3Name = \"text3\"\r\nuiNode.Clone(text2Path, parentPath, text3Name)\r\n# 以panel为父控件,以text_prefab为模板克隆若干控件\r\nparentPath = \"/panel\"\r\ntextPrefabPath = \"/panel/text_prefab\"\r\nfor i in range(0, 10):\r\n uiNode.Clone(textPrefabPath, parentPath, \"text\" + str(i), False)\r\nuiNode.UpdateScreen(True)\r\n# 在非同一帧,以panel为父控件,text_prefab为模板克隆若干控件\r\nparentPath = \"/panel\"\r\ntextPrefabPath = \"/panel/text_prefab\"\r\ndef _tickClone(newName):\r\n uiNode.Clone(textPrefabPath, parentPath, newName , False, False)\r\ndef _tickUpdateScreen():\r\n uiNode.UpdateScreen(True)\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.AddTimer(100, _tickClone, \"text1\")\r\ncomp.AddTimer(200, _tickClone, \"text2\")\r\ncomp.AddTimer(300, _tickUpdateScreen)" - }, + ], + "type": "api", + "side": "client", + "name": "Clone" + }, { - "type": "api", - "name": "Create", - "method": "", - "description": "UI生命周期函数,当UI创建成功时调用。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "UI生命周期函数,当UI创建成功时调用。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "", + "params": [], + "type": "api", + "side": "client", + "name": "Create" + }, { - "type": "api", - "name": "CreateChildControl", - "method": "", - "description": "在当前画布中创建子控件,如果该子控件已经存在则返回已存在的子控件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "在当前画布中创建子控件,如果该子控件已经存在则返回已存在的子控件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# 在父控件\"/panel\"下创建命名空间为\"ui0\"的自定义控件\"myImage\",并取名为\"myChild\"\r\nparentControl = uiNode.GetBaseUIControl(\"/panel\")\r\nif parentControl:\r\n childNode = uiNode.CreateChildControl(\"ui0.myImage\", \"myChild\", parentControl, True)\r\n print childNode", "params": [ { - "name": "defName", - "type": "str", + "type": "str", + "name": "defName", "description": "UI控件路径,格式为\"namespace.controlName\"。namespace对应uiJson文件中\"namespace\"对应的值,UI编辑器生成的uiJson文件该值等于文件名。controlName对应想创建的控件的名称。" - }, + }, { - "name": "childName", - "type": "str", + "type": "str", + "name": "childName", "description": "所创建的子控件的名称" - }, + }, { - "name": "parentControl", - "type": "BaseUIControl", + "type": "BaseUIControl", + "name": "parentControl", "description": "指定所创建的子节点的父节点,默认值为None,表示直接创建在当前画布根节点下。" - }, + }, { - "name": "forceUpdate", - "type": "bool", + "type": "bool", + "name": "forceUpdate", "description": "是否需要强制刷新,默认值为True。置True则进行同一帧或者下一帧刷新,置False则当前帧和下一帧均不刷新,需要手动调用UpdateScreen进行刷新。如有大量CreateChildControl操作且在同一帧执行,建议设置为False,需要更新时再调用UpdateScreen接口刷新界面及相关控件数据" } - ], - "return": [], - "example": "# 在父控件\"/panel\"下创建命名空间为\"ui0\"的自定义控件\"myImage\",并取名为\"myChild\"\r\nparentControl = uiNode.GetBaseUIControl(\"/panel\")\r\nif parentControl:\r\n childNode = uiNode.CreateChildControl(\"ui0.myImage\", \"myChild\", parentControl, True)\r\n print childNode" - }, + ], + "type": "api", + "side": "client", + "name": "CreateChildControl" + }, { - "type": "api", - "name": "Destroy", - "method": "", - "description": "UI生命周期函数,当UI销毁时调用。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "UI生命周期函数,当UI销毁时调用。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "", + "params": [], + "type": "api", + "side": "client", + "name": "Destroy" + }, { - "type": "api", - "name": "GetAllChildrenPath", - "method": "", - "description": "获取所有子节点的路径list", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "获取所有子节点的路径list", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# get panel's all children path\r\nnode.GetAllChildrenPath(\"/panel\")", "params": [ { - "name": "parentPath", - "type": "str", + "type": "str", + "name": "parentPath", "description": "为从main节点开始,父节点的控件路径" } - ], - "return": [], - "example": "# get panel's all children path\r\nnode.GetAllChildrenPath(\"/panel\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetAllChildrenPath" + }, { - "type": "api", - "name": "GetBaseUIControl", - "method": "", - "description": "根据路径获取BaseUIControl实例", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "根据路径获取BaseUIControl实例", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# 根据路径获得BaseUIControl实例\r\ntext2Path = \"/panel/text2\"\r\ntext2UIControl = uiNode.GetBaseUIControl(text2Path)", "params": [ { - "name": "path", - "type": "str", + "type": "str", + "name": "path", "description": "当前控件的路径" } - ], - "return": [], - "example": "# 根据路径获得BaseUIControl实例\r\ntext2Path = \"/panel/text2\"\r\ntext2UIControl = uiNode.GetBaseUIControl(text2Path)" - }, + ], + "type": "api", + "side": "client", + "name": "GetBaseUIControl" + }, { - "type": "api", - "name": "GetBindAutoScale", - "method": "", - "description": "获取该绑定实体的UI是否动态缩放,未绑定的UI将传回默认值1", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "autoScale = uiNode.GetBindAutoScale()" - }, + "remark": "", + "return": [], + "description": "获取该绑定实体的UI是否动态缩放,未绑定的UI将传回默认值1", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "autoScale = uiNode.GetBindAutoScale()", + "params": [], + "type": "api", + "side": "client", + "name": "GetBindAutoScale" + }, { - "type": "api", - "name": "GetBindEntityId", - "method": "", - "description": "获取该UI绑定的实体id,未绑定的UI将传回默认值None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "entityId = uiNode.GetBindEntityId()" - }, + "remark": "", + "return": [], + "description": "获取该UI绑定的实体id,未绑定的UI将传回默认值None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "entityId = uiNode.GetBindEntityId()", + "params": [], + "type": "api", + "side": "client", + "name": "GetBindEntityId" + }, { - "type": "api", - "name": "GetBindOffset", - "method": "", - "description": "获取该UI绑定实体的偏移量,未绑定的UI将传回默认值(0, 0, 0)", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "offset = uiNode.GetBindOffset()" - }, + "remark": "", + "return": [], + "description": "获取该UI绑定实体的偏移量,未绑定的UI将传回默认值(0, 0, 0)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "offset = uiNode.GetBindOffset()", + "params": [], + "type": "api", + "side": "client", + "name": "GetBindOffset" + }, { - "type": "api", - "name": "GetBindWorldPosition", - "method": "", - "description": "获取该UI绑定的worldPosition,未绑定返回默认值None", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "position = uiNode.GetBindWorldPosition()" - }, + "remark": "", + "return": [], + "description": "获取该UI绑定的worldPosition,未绑定返回默认值None", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "position = uiNode.GetBindWorldPosition()", + "params": [], + "type": "api", + "side": "client", + "name": "GetBindWorldPosition" + }, { - "type": "api", - "name": "GetChildrenName", - "method": "", - "description": "获取子节点的名称list", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "获取子节点的名称list", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# get panel's children name\r\nnode.GetChildrenName(\"/panel\")", "params": [ { - "name": "parentPath", - "type": "str", + "type": "str", + "name": "parentPath", "description": "为从main节点开始,父节点的控件路径" } - ], - "return": [], - "example": "# get panel's children name\r\nnode.GetChildrenName(\"/panel\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetChildrenName" + }, { - "type": "api", - "name": "GetIsHud", - "method": "", - "description": "获得本界面的输入模式", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "# 我们需要获得本界面的输入模式\r\nisHud = uiNode.GetIsHud()" - }, + "remark": "", + "return": [], + "description": "获得本界面的输入模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# 我们需要获得本界面的输入模式\r\nisHud = uiNode.GetIsHud()", + "params": [], + "type": "api", + "side": "client", + "name": "GetIsHud" + }, { - "type": "api", - "name": "GetRichTextItem", - "method": "", - "description": "返回一个富文本控件实例", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "返回一个富文本控件实例", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# we want get a rich-text-item\r\nrichTextPath = \"/RichTextPanel\"\r\nrichTextItem = uiNode.GetRichTextItem(richTextPath)", "params": [ { - "name": "componentPath", - "type": "str", + "type": "str", + "name": "componentPath", "description": "为从main节点开始,继承自rich_text.RichTextPanel控件的路径" } - ], - "return": [], - "example": "# we want get a rich-text-item\r\nrichTextPath = \"/RichTextPanel\"\r\nrichTextItem = uiNode.GetRichTextItem(richTextPath)" - }, + ], + "type": "api", + "side": "client", + "name": "GetRichTextItem" + }, { - "type": "api", - "name": "GetScreenName", - "method": "", - "description": "获得本界面的名称", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "# 我们需要获得本界面名称\r\nscreenName = uiNode.GetScreenName()" - }, + "remark": "", + "return": [], + "description": "获得本界面的名称", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# 我们需要获得本界面名称\r\nscreenName = uiNode.GetScreenName()", + "params": [], + "type": "api", + "side": "client", + "name": "GetScreenName" + }, { - "type": "api", - "name": "GetSelf", - "method": "", - "description": "获取零件界面自身", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取零件界面自身", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "", + "params": [], + "type": "api", + "side": "client", + "name": "GetSelf" + }, { - "type": "api", - "name": "OnActive", - "method": "", - "description": "UI生命周期函数,当UI重新回到栈顶时调用。", - "remark": "- 不建议使用在OnDeactive函数中调用SetScreenVisible(False),在OnActive函数中调用SetScreenVisible(True)的方式实现打开新界面时隐藏原界面,新界面关闭时自动显示原界面的功能,由于隐藏接口不会改动UI栈,多Mod容易形成冲突。推荐使用PushScreen,PopScreen接口实现。\r\n 调用OpenPauseGui、OpenChatGui、OpenInventoryGui等原生UI函数弹出的UI被关闭时,不会调用此函数。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 不建议使用在OnDeactive函数中调用SetScreenVisible(False),在OnActive函数中调用SetScreenVisible(True)的方式实现打开新界面时隐藏原界面,新界面关闭时自动显示原界面的功能,由于隐藏接口不会改动UI栈,多Mod容易形成冲突。推荐使用PushScreen,PopScreen接口实现。\r\n 调用OpenPauseGui、OpenChatGui、OpenInventoryGui等原生UI函数弹出的UI被关闭时,不会调用此函数。", + "return": [], + "description": "UI生命周期函数,当UI重新回到栈顶时调用。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "", + "params": [], + "type": "api", + "side": "client", + "name": "OnActive" + }, { - "type": "api", - "name": "OnDeactive", - "method": "", - "description": "UI生命周期函数,当栈顶UI有其他UI入栈时调用。", - "remark": "- 不建议使用在OnDeactive函数中调用SetScreenVisible(False),在OnActive函数中调用SetScreenVisible(True)的方式实现打开新界面时隐藏原界面,新界面关闭时自动显示原界面的功能,由于隐藏接口不会改动UI栈,多Mod容易形成冲突。推荐使用PushScreen,PopScreen接口实现。\r\n 调用OpenPauseGui、OpenChatGui、OpenInventoryGui等原生UI函数时不会调用此函数。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "- 不建议使用在OnDeactive函数中调用SetScreenVisible(False),在OnActive函数中调用SetScreenVisible(True)的方式实现打开新界面时隐藏原界面,新界面关闭时自动显示原界面的功能,由于隐藏接口不会改动UI栈,多Mod容易形成冲突。推荐使用PushScreen,PopScreen接口实现。\r\n 调用OpenPauseGui、OpenChatGui、OpenInventoryGui等原生UI函数时不会调用此函数。", + "return": [], + "description": "UI生命周期函数,当栈顶UI有其他UI入栈时调用。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "", + "params": [], + "type": "api", + "side": "client", + "name": "OnDeactive" + }, { - "type": "api", - "name": "RemoveChildControl", - "method": "", - "description": "移除当前画布中的子控件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "移除当前画布中的子控件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# 移除\"/panel/myChild\"控件\r\nchildControl = uiNode.GetBaseUIControl(\"/panel/myChild\")\r\nif childControl:\r\n ret = uiNode.RemoveChildControl(childControl)\r\n print ret", "params": [ { - "name": "childControl", - "type": "BaseUIControl", + "type": "BaseUIControl", + "name": "childControl", "description": "所要移除的子控件" } - ], - "return": [], - "example": "# 移除\"/panel/myChild\"控件\r\nchildControl = uiNode.GetBaseUIControl(\"/panel/myChild\")\r\nif childControl:\r\n ret = uiNode.RemoveChildControl(childControl)\r\n print ret" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveChildControl" + }, { - "type": "api", - "name": "RemoveComponent", - "method": "", - "description": "动态删除某一控件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "动态删除某一控件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# we want to remove text2\r\ntext2Path = \"/panel/text2\"\r\nparentPath = \"/panel\"\r\nuiNode.RemoveComponent(text2Path, parentPath)", "params": [ { - "name": "componentPath", - "type": "str", + "type": "str", + "name": "componentPath", "description": "为从main节点开始,被删除控件路径" - }, + }, { - "name": "parentPath", - "type": "str", + "type": "str", + "name": "parentPath", "description": "为从main节点开始,父节点的控件路径" } - ], - "return": [], - "example": "# we want to remove text2\r\ntext2Path = \"/panel/text2\"\r\nparentPath = \"/panel\"\r\nuiNode.RemoveComponent(text2Path, parentPath)" - }, + ], + "type": "api", + "side": "client", + "name": "RemoveComponent" + }, { - "type": "api", - "name": "SetBindWorldPosition", - "method": "", - "description": "设置UI绑定的worldPosition", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "设置UI绑定的worldPosition", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "uiNode.SetBindWorldPosition(0, (100,60,100))", "params": [ { - "name": "dimension", - "type": "int", + "type": "int", + "name": "dimension", "description": "维度id" - }, + }, { - "name": "position", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "position", "description": "坐标" } - ], - "return": [], - "example": "uiNode.SetBindWorldPosition(0, (100,60,100))" - }, + ], + "type": "api", + "side": "client", + "name": "SetBindWorldPosition" + }, { - "type": "api", - "name": "SetIsHud", - "method": "", - "description": "设置本界面的输入模式", - "remark": "- CreateUI的isHud参数设置为0或不传时,会在比当前UI的层级大1000的地方生成,生成后再调用SetIsHud接口无法再修改层级!", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "- CreateUI的isHud参数设置为0或不传时,会在比当前UI的层级大1000的地方生成,生成后再调用SetIsHud接口无法再修改层级!", + "return": [], + "description": "设置本界面的输入模式", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# 我们需要设置本界面为HUD操作模式\r\nuiNode.SetIsHud(1)", "params": [ { - "name": "isHud", - "type": "int", + "type": "int", + "name": "isHud", "description": "设置1表示该界面不屏蔽游戏操作,设置0则屏蔽。" } - ], - "return": [], - "example": "# 我们需要设置本界面为HUD操作模式\r\nuiNode.SetIsHud(1)" - }, + ], + "type": "api", + "side": "client", + "name": "SetIsHud" + }, { - "type": "api", - "name": "SetRemove", - "method": "", - "description": "删除本界面节点", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "# we want to remove this screen\r\nuiNode.SetRemove()" - }, + "remark": "", + "return": [], + "description": "删除本界面节点", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# we want to remove this screen\r\nuiNode.SetRemove()", + "params": [], + "type": "api", + "side": "client", + "name": "SetRemove" + }, { - "type": "api", - "name": "SetScreenVisible", - "method": "", - "description": "设置是否显示本界面", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "设置是否显示本界面", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# 我们隐藏当前UI的界面\r\nuiNode.SetScreenVisible(False)", "params": [ { - "name": "visible", - "type": "bool", + "type": "bool", + "name": "visible", "description": "False为隐藏该界面,True为显示该界面" } - ], - "return": [], - "example": "# 我们隐藏当前UI的界面\r\nuiNode.SetScreenVisible(False)" - }, + ], + "type": "api", + "side": "client", + "name": "SetScreenVisible" + }, { - "type": "api", - "name": "SetSelectControl", - "method": "", - "description": "设置当前焦点所在的控件,当设置控件为文本输入框时会弹出系统小键盘", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "设置当前焦点所在的控件,当设置控件为文本输入框时会弹出系统小键盘", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "path = \"/text_edit_box0\"\r\nuiNode.SetSelectControl(path, True)", "params": [ { - "name": "componentPath", - "type": "str", + "type": "str", + "name": "componentPath", "description": "为从main节点开始,所要选中控件的路径" - }, + }, { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "True为选中componentPath所代表的控件,False为取消选中" } - ], - "return": [], - "example": "path = \"/text_edit_box0\"\r\nuiNode.SetSelectControl(path, True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetSelectControl" + }, { - "type": "api", - "name": "SetStackGridCount", - "method": "", - "description": "设置StackGrid控件的大小", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "设置StackGrid控件的大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# we want change stackgrid count\r\nstackgridPath = \"/stack_grid1\"\r\nuiNode.SetStackGridCount(stackgridPath, 3)", "params": [ { - "name": "componentPath", - "type": "str", + "type": "str", + "name": "componentPath", "description": "为从main节点开始,Grid控件的路径" - }, + }, { - "name": "count", - "type": "int", + "type": "int", + "name": "count", "description": "设置StackGrid的内容数量" } - ], - "return": [], - "example": "# we want change stackgrid count\r\nstackgridPath = \"/stack_grid1\"\r\nuiNode.SetStackGridCount(stackgridPath, 3)" - }, + ], + "type": "api", + "side": "client", + "name": "SetStackGridCount" + }, { - "type": "api", - "name": "SetUiEntity", - "method": "", - "description": "设置PaperDoll控件需要显示的生物模型,PaperDoll控件的配置方式详见控件介绍PaperDoll", - "remark": "- 暂不支持的微软原版模型:minecraft:horse(马)、minecraft:donkey(驴)、minecraft:mule(骡子)、minecraft:skeleton_horse(骷髅马)、minecraft:zombie_horse(僵尸马)、minecraft:llama(羊驼)、minecraft:tropicalfish(热带鱼)、minecraft:slime(史莱姆)、minecraft:magma_cube(岩浆怪)、minecraft:ghast(恶魂)、minecraft:shulker(潜影贝)、minecraft:ender_dragon(末影龙)、minecraft:thrown_trident(三叉戟)、minecraft:ender_crystal(末影水晶)、minecraft:boat(船)、minecraft:tnt(TNT)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "- 暂不支持的微软原版模型:minecraft:horse(马)、minecraft:donkey(驴)、minecraft:mule(骡子)、minecraft:skeleton_horse(骷髅马)、minecraft:zombie_horse(僵尸马)、minecraft:llama(羊驼)、minecraft:tropicalfish(热带鱼)、minecraft:slime(史莱姆)、minecraft:magma_cube(岩浆怪)、minecraft:ghast(恶魂)、minecraft:shulker(潜影贝)、minecraft:ender_dragon(末影龙)、minecraft:thrown_trident(三叉戟)、minecraft:ender_crystal(末影水晶)、minecraft:boat(船)、minecraft:tnt(TNT)", + "return": [], + "description": "设置PaperDoll控件需要显示的生物模型,PaperDoll控件的配置方式详见控件介绍PaperDoll", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# we want to show an entity model\r\nimagePath = \"/paper_doll0\"\r\nuiNode.SetUiEntity(imagePath, 'minecraft:cat')", "params": [ { - "name": "componentPath", - "type": "str", + "type": "str", + "name": "componentPath", "description": "为从main节点开始的控件路径" - }, + }, { - "name": "entityIdentifier", - "type": "str", + "type": "str", + "name": "entityIdentifier", "description": "生物定义中设定的identifier" } - ], - "return": [], - "example": "# we want to show an entity model\r\nimagePath = \"/paper_doll0\"\r\nuiNode.SetUiEntity(imagePath, 'minecraft:cat')" - }, + ], + "type": "api", + "side": "client", + "name": "SetUiEntity" + }, { - "type": "api", - "name": "SetUiModel", - "method": "", - "description": "设置PaperDoll控件需要显示的模型,PaperDoll控件的配置方式详见控件介绍PaperDoll", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "设置PaperDoll控件需要显示的模型,PaperDoll控件的配置方式详见控件介绍PaperDoll", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# we want to change model\r\nimagePath = \"/paper_doll0\"\r\nuiNode.SetUiModel(imagePath, 'saber', 'idle', True)", "params": [ { - "name": "componentPath", - "type": "str", + "type": "str", + "name": "componentPath", "description": "为从main节点开始的控件路径" - }, + }, { - "name": "modelName", - "type": "str", + "type": "str", + "name": "modelName", "description": "骨骼模型的名称" - }, + }, { - "name": "animateName", - "type": "str", + "type": "str", + "name": "animateName", "description": "动画名称,默认为'idle'" - }, + }, { - "name": "looped", - "type": "bool", + "type": "bool", + "name": "looped", "description": "是否循环播放动画,默认为True" } - ], - "return": [], - "example": "# we want to change model\r\nimagePath = \"/paper_doll0\"\r\nuiNode.SetUiModel(imagePath, 'saber', 'idle', True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetUiModel" + }, { - "type": "api", - "name": "SetUiModelScale", - "method": "", - "description": "设置PaperDoll控件模型的缩放比例", - "remark": "- 当设置为原版生物模型时会导致偏移,建议开发者自行调整位置", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "- 当设置为原版生物模型时会导致偏移,建议开发者自行调整位置", + "return": [], + "description": "设置PaperDoll控件模型的缩放比例", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "imagePath = \"/paper_doll0\"\r\nuiNode.SetUiModelScale(imagePath, 1.2)", "params": [ { - "name": "componentPath", - "type": "str", + "type": "str", + "name": "componentPath", "description": "为从main节点开始,PaperDoll控件路径" - }, + }, { - "name": "scale", - "type": "float", + "type": "float", + "name": "scale", "description": "PaperDoll的缩放比例,默认为1.0" } - ], - "return": [], - "example": "imagePath = \"/paper_doll0\"\r\nuiNode.SetUiModelScale(imagePath, 1.2)" - }, + ], + "type": "api", + "side": "client", + "name": "SetUiModelScale" + }, { - "type": "api", - "name": "Update", - "method": "", - "description": "客户端每帧调用,1秒有30帧", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "客户端每帧调用,1秒有30帧", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "", + "params": [], + "type": "api", + "side": "client", + "name": "Update" + }, { - "type": "api", - "name": "UpdateScreen", - "method": "", - "description": "刷新界面,重新计算各个控件的相关数据", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "remark": "", + "return": [], + "description": "刷新界面,重新计算各个控件的相关数据", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/UI界面.md", + "example": "# 当前帧刷新界面\r\nuiNode.UpdateScreen(True)\r\n# 下一帧刷新界面\r\nuiNode.UpdateScreen(False)", "params": [ { - "name": "syncRefresh", - "type": "bool", + "type": "bool", + "name": "syncRefresh", "description": "是否需要同步刷新,默认值为True。置True为游戏在同一帧计算各个控件的相关数据,置False则在下一帧进行计算。若置True不建议在同一帧调用多次" } - ], - "return": [], - "example": "# 当前帧刷新界面\r\nuiNode.UpdateScreen(True)\r\n# 下一帧刷新界面\r\nuiNode.UpdateScreen(False)" - }, + ], + "type": "api", + "side": "client", + "name": "UpdateScreen" + }, { - "type": "api", - "name": "GetBookManager", - "method": "", - "description": "获取书本管理对象", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义书本.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nbookManager = clientApi.GetBookManager()" - }, + "remark": "", + "return": [], + "description": "获取书本管理对象", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义书本.md", + "example": "import mod.client.extraClientApi as clientApi\r\nbookManager = clientApi.GetBookManager()", + "params": [], + "type": "api", + "side": "client", + "name": "GetBookManager" + }, { - "type": "api", - "name": "AddNodeProgress", - "method": "", - "description": "增加对应玩家的对应成就节点的成就进度", - "remark": "- callback需要接受一个参数\r\n 当请求**失败**时,参数返回None。\r\n 当请求**成功**时,参数为一个dict,包含返回码,最新数据等信息。\r\n - 当code为0时,表示设置成功。\r\n - 当code为5时,表示数据冲突,此时系统不会存储此次上传的数据,当开发者通过callback处理完冲突后,必须返回一个Bool值。当callback的返回值为True,系统会自动再自动调用一次getExtra来获取最新的extra数据,并自动存储进度与extra。如果不想系统再自动调用,将callback返回值设置为False,系统将不会再进行一次进度存储,可选", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义成就系统.md", + "remark": "- callback需要接受一个参数\r\n 当请求**失败**时,参数返回None。\r\n 当请求**成功**时,参数为一个dict,包含返回码,最新数据等信息。\r\n - 当code为0时,表示设置成功。\r\n - 当code为5时,表示数据冲突,此时系统不会存储此次上传的数据,当开发者通过callback处理完冲突后,必须返回一个Bool值。当callback的返回值为True,系统会自动再自动调用一次getExtra来获取最新的extra数据,并自动存储进度与extra。如果不想系统再自动调用,将callback返回值设置为False,系统将不会再进行一次进度存储,可选", + "return": [], + "description": "增加对应玩家的对应成就节点的成就进度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义成就系统.md", + "example": "import mod.server.extraServerApi as serverApi\r\ndef cb(data):\r\n if data:\r\n print { {}.format(data[\"entity\"]) }\r\n else:\r\n print \"获取数据失败\"\r\ndef get():\r\n return extraData\r\ncomp = serverApi.GetEngineCompFactory().CreateAchievement(levelId)\r\n#增加该玩家成就进度:\r\ncomp.AddNodeProgress(playerId, nodeId, delta, callback = cb, getExtra = get)", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家ID" - }, + }, { - "name": "nodeId", - "type": "str", + "type": "str", + "name": "nodeId", "description": "节点ID" - }, + }, { - "name": "delta", - "type": "int", + "type": "int", + "name": "delta", "description": "增加该节点进度的值,只能填写大于0的正整数" - }, + }, { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "请求回调函数,如果节点的json配置了为云节点,则调用此接口必须填写此参数,否则无法传到云端" - }, + }, { - "name": "getExtra", - "type": "function", + "type": "function", + "name": "getExtra", "description": "用于返回存储更新后的数据的函数,用于云成就节点,返回值必须为str类型,可选" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ndef cb(data):\r\n if data:\r\n print { {}.format(data[\"entity\"]) }\r\n else:\r\n print \"获取数据失败\"\r\ndef get():\r\n return extraData\r\ncomp = serverApi.GetEngineCompFactory().CreateAchievement(levelId)\r\n#增加该玩家成就进度:\r\ncomp.AddNodeProgress(playerId, nodeId, delta, callback = cb, getExtra = get)" - }, + ], + "type": "api", + "side": "server", + "name": "AddNodeProgress" + }, { - "type": "api", - "name": "GetAchievementGatePosition", - "method": "", - "description": "获取自定义成就系统的入口按钮位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义成就系统.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateAchievement(playerId)\r\nresult = comp.GetAchievementGatePosition()" - }, + "remark": "", + "return": [], + "description": "获取自定义成就系统的入口按钮位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义成就系统.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateAchievement(playerId)\r\nresult = comp.GetAchievementGatePosition()", + "params": [], + "type": "api", + "side": "client", + "name": "GetAchievementGatePosition" + }, { - "type": "api", - "name": "GetChildrenNode", - "method": "", - "description": "获得该成就节点的下一级所有孩子节点的list", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义成就系统.md", + "remark": "", + "return": [], + "description": "获得该成就节点的下一级所有孩子节点的list", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义成就系统.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAchievement(levelId)\r\n#获得该成就节点的下一级所有孩子节点的list:\r\nNodeChildren = comp.GetChildrenNode(nodeId)", "params": [ { - "name": "nodeId", - "type": "str", + "type": "str", + "name": "nodeId", "description": "节点ID" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAchievement(levelId)\r\n#获得该成就节点的下一级所有孩子节点的list:\r\nNodeChildren = comp.GetChildrenNode(nodeId)" - }, + ], + "type": "api", + "side": "server", + "name": "GetChildrenNode" + }, { - "type": "api", - "name": "GetNodeDetailInfo", - "method": "", - "description": "获取对应玩家的对应节点信息", - "remark": "- 该接口获取到的信息只有json里面配置的信息,如果可选内容不配,该接口获取不到不配的可选内容信息\r\n - 不可在“AddServerPlayerEvent”和\"ClientLoadAddonsFinishServerEvent\"事件中调用该接口", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义成就系统.md", + "remark": "- 该接口获取到的信息只有json里面配置的信息,如果可选内容不配,该接口获取不到不配的可选内容信息\r\n - 不可在“AddServerPlayerEvent”和\"ClientLoadAddonsFinishServerEvent\"事件中调用该接口", + "return": [], + "description": "获取对应玩家的对应节点信息", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义成就系统.md", + "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAchievement(levelId)\r\n#获取信息:\r\nNodeDetail = comp.GetNodeDetailInfo(playerId, nodeId)", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家ID" - }, + }, { - "name": "nodeId", - "type": "str", + "type": "str", + "name": "nodeId", "description": "节点ID" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ncomp = serverApi.GetEngineCompFactory().CreateAchievement(levelId)\r\n#获取信息:\r\nNodeDetail = comp.GetNodeDetailInfo(playerId, nodeId)" - }, + ], + "type": "api", + "side": "server", + "name": "GetNodeDetailInfo" + }, { - "type": "api", - "name": "SetAchievementGatePosition", - "method": "", - "description": "设置自定义成就系统的入口按钮位置", - "remark": "- 如果设置的位置超过边界,将设置到目标最近的边界位置", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义成就系统.md", + "remark": "- 如果设置的位置超过边界,将设置到目标最近的边界位置", + "return": [], + "description": "设置自定义成就系统的入口按钮位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义成就系统.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateAchievement(playerId)\r\nresult = comp.SetAchievementGatePosition(10, 10)", "params": [ { - "name": "x", - "type": "float", + "type": "float", + "name": "x", "description": "横轴坐标" - }, + }, { - "name": "y", - "type": "float", + "type": "float", + "name": "y", "description": "竖轴坐标" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateAchievement(playerId)\r\nresult = comp.SetAchievementGatePosition(10, 10)" - }, + ], + "type": "api", + "side": "client", + "name": "SetAchievementGatePosition" + }, { - "type": "api", - "name": "SetNodeFinish", - "method": "", - "description": "设置对应玩家的对应成就节点完成", - "remark": "- callback需要接受一个参数\r\n 当请求**失败**时,参数返回None。\r\n 当请求**成功**时,参数为一个dict,包含返回码,最新数据等信息。\r\n - 当code为0时,表示设置成功。\r\n - 当code为5时,表示数据冲突,此时系统不会存储此次上传的数据,当开发者通过callback处理完冲突后,必须返回一个Bool值。当callback的返回值为True,系统会自动再自动调用一次getExtra来获取最新的extra数据,并自动存储进度与extra。如果不想系统再自动调用,将callback放回值设置为False,系统将不会再进行一次进度存储,可选", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义成就系统.md", + "remark": "- callback需要接受一个参数\r\n 当请求**失败**时,参数返回None。\r\n 当请求**成功**时,参数为一个dict,包含返回码,最新数据等信息。\r\n - 当code为0时,表示设置成功。\r\n - 当code为5时,表示数据冲突,此时系统不会存储此次上传的数据,当开发者通过callback处理完冲突后,必须返回一个Bool值。当callback的返回值为True,系统会自动再自动调用一次getExtra来获取最新的extra数据,并自动存储进度与extra。如果不想系统再自动调用,将callback放回值设置为False,系统将不会再进行一次进度存储,可选", + "return": [], + "description": "设置对应玩家的对应成就节点完成", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/自定义成就系统.md", + "example": "import mod.server.extraServerApi as serverApi\r\ndef cb(data):\r\n if data:\r\n print { {}.format(data[\"entity\"]) }\r\n else:\r\n print \"获取数据失败\"\r\ndef get():\r\n return extraData\r\ncomp = serverApi.GetEngineCompFactory().CreateAchievement(levelId)\r\n#设置该成就完成:\r\ncomp.SetNodeFinish(playerId, nodeId, callback = cb, getExtra = get)", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家ID" - }, + }, { - "name": "nodeId", - "type": "str", + "type": "str", + "name": "nodeId", "description": "节点ID" - }, + }, { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "请求回调函数,如果节点的json配置了为云节点,则调用此接口必须填写此参数,否则无法传到云端" - }, + }, { - "name": "getExtra", - "type": "function", + "type": "function", + "name": "getExtra", "description": "用于返回存储更新后的数据的函数,用于云成就节点,返回值必须为str类型,可选" } - ], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\ndef cb(data):\r\n if data:\r\n print { {}.format(data[\"entity\"]) }\r\n else:\r\n print \"获取数据失败\"\r\ndef get():\r\n return extraData\r\ncomp = serverApi.GetEngineCompFactory().CreateAchievement(levelId)\r\n#设置该成就完成:\r\ncomp.SetNodeFinish(playerId, nodeId, callback = cb, getExtra = get)" - }, + ], + "type": "api", + "side": "server", + "name": "SetNodeFinish" + }, { - "type": "api", - "name": "CheckCanBindUI", - "method": "", - "description": "检查实体是否可以绑定头顶UI,如何将UI与实体绑定详见[CreateUI](#createui)接口", - "remark": "- 不能绑定头顶UI通常是由于该实体已经死亡或该实体刚创建出来。刚创建的实体若无法绑定头顶UI,等待1-3帧后再次尝试绑定即可", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "remark": "- 不能绑定头顶UI通常是由于该实体已经死亡或该实体刚创建出来。刚创建的实体若无法绑定头顶UI,等待1-3帧后再次尝试绑定即可", + "return": [], + "description": "检查实体是否可以绑定头顶UI,如何将UI与实体绑定详见[CreateUI](#createui)接口", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncanBind = clientApi.CheckCanBindUI(entityId)", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncanBind = clientApi.CheckCanBindUI(entityId)" - }, + ], + "type": "api", + "side": "client", + "name": "CheckCanBindUI" + }, { - "type": "api", - "name": "CreateUI", - "method": "", - "description": "创建UI,详见界面创建流程及生命周期", - "remark": "- createParams参数解释如下:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | isHud | int | 值为( 0 / 1) ,意为是否为HUD界面的UI。一般情况下,射击按钮不屏蔽游戏, 原生的操作的界面应该isHud为1;商城界面等不是游戏内操作的界面isHud应该为0,默认值为0。当isHud取0时,创建的UI会默认从比当前UI的层级大1000的地方生成,可能会造成控件遮挡情况;当isHud为1时,创建的UI会从层级为0的地方生成 |\r\n | inputMode | int | 值为( 0 / 1 ) ,属于旧版本写法,和isHud含义相同但取值相反,即isHud取0 等于 inputMode取1,两者同时存在优先判断isHud。 |\r\n | bindEntityId | str | 意为绑定实体的id。若不传入该键值对或值为None,则会以isHud = 0来处理该UI界面。 |\r\n | bindWorldPosition | (int, (float, float, float)) | 第一个元素为绑定的维度,第二个为世界坐标, 若传入这个参数,autoScale默认为1,isHud强制为1,其他传入参数无效。 |\r\n | bindOffset | tuple | 意为UI与绑定实体的偏移量,默认值为(0, 1, 0)。 |\r\n | autoScale | int | 值为( 0 / 1 ) ,意为绑定实体的UI是否会自动根据实体与本地玩家的距离动态缩放大小,默认值为1,即会动态缩放头顶UI的大小。 |\r\n | mini_map_root_path | str | 小地图控件根路径 |\r\n - 当isHud参数设置为0或不传时,会在比当前UI的层级大1000的地方生成,生成后再调用SetIsHud接口无法再修改层级!如果新创建的UI导致了其他UI无法正常交互,可以把新UI中main的type由screen改为panel,并删除screen相关属性来解决遮挡问题。\r\n - 设置自动缩放需要将UI写为百分比形式,设置为固定尺寸将无法缩放,超过一定距离会不可见。\r\n - 注意:\r\n 绑定实体的UI缩放仅作用于根节点(比如\"main\"节点)下的子节点。\r\n \r\n 建议在根节点下挂载一个panel类型的节点,然后将所有需要缩放的UI节点设置为百分比属性并挂载在这个panel节点下。\r\n \r\n 如果开启了自动缩放,父节点(如上述panel)的偏移需要设置为[0,0],缩放功能才能正常使用\r\n - 注意:\r\n 若同屏中存在太多绑定实体的UI或一次性创建、删除大量绑定实体UI,都可能会造成卡顿等性能问题。\r\n \r\n 建议使用资源池来管理绑定实体UI,当实体与本地玩家距离超过一定范围时,隐藏/移除其绑定UI,或使其绑定UI改为绑定其他有需求的实体。\r\n \r\n 当需要大批量创建绑定实体UI时,建议将创建UI的任务分为小批量多次执行,每批次间相距至少一帧。例如需要创建100个绑定实体UI,将任务分散在5帧中,每帧创建20个绑定实体UI。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "remark": "- createParams参数解释如下:\r\n | 参数 | 类型 | 解释 |\r\n | ----------------- | ----- | ------------------------------------------------------------ |\r\n | isHud | int | 值为( 0 / 1) ,意为是否为HUD界面的UI。一般情况下,射击按钮不屏蔽游戏, 原生的操作的界面应该isHud为1;商城界面等不是游戏内操作的界面isHud应该为0,默认值为0。当isHud取0时,创建的UI会默认从比当前UI的层级大1000的地方生成,可能会造成控件遮挡情况;当isHud为1时,创建的UI会从层级为0的地方生成 |\r\n | inputMode | int | 值为( 0 / 1 ) ,属于旧版本写法,和isHud含义相同但取值相反,即isHud取0 等于 inputMode取1,两者同时存在优先判断isHud。 |\r\n | bindEntityId | str | 意为绑定实体的id。若不传入该键值对或值为None,则会以isHud = 0来处理该UI界面。 |\r\n | bindWorldPosition | (int, (float, float, float)) | 第一个元素为绑定的维度,第二个为世界坐标, 若传入这个参数,autoScale默认为1,isHud强制为1,其他传入参数无效。 |\r\n | bindOffset | tuple | 意为UI与绑定实体的偏移量,默认值为(0, 1, 0)。 |\r\n | autoScale | int | 值为( 0 / 1 ) ,意为绑定实体的UI是否会自动根据实体与本地玩家的距离动态缩放大小,默认值为1,即会动态缩放头顶UI的大小。 |\r\n | mini_map_root_path | str | 小地图控件根路径 |\r\n - 当isHud参数设置为0或不传时,会在比当前UI的层级大1000的地方生成,生成后再调用SetIsHud接口无法再修改层级!如果新创建的UI导致了其他UI无法正常交互,可以把新UI中main的type由screen改为panel,并删除screen相关属性来解决遮挡问题。\r\n - 设置自动缩放需要将UI写为百分比形式,设置为固定尺寸将无法缩放,超过一定距离会不可见。\r\n - 注意:\r\n 绑定实体的UI缩放仅作用于根节点(比如\"main\"节点)下的子节点。\r\n \r\n 建议在根节点下挂载一个panel类型的节点,然后将所有需要缩放的UI节点设置为百分比属性并挂载在这个panel节点下。\r\n \r\n 如果开启了自动缩放,父节点(如上述panel)的偏移需要设置为[0,0],缩放功能才能正常使用\r\n - 注意:\r\n 若同屏中存在太多绑定实体的UI或一次性创建、删除大量绑定实体UI,都可能会造成卡顿等性能问题。\r\n \r\n 建议使用资源池来管理绑定实体UI,当实体与本地玩家距离超过一定范围时,隐藏/移除其绑定UI,或使其绑定UI改为绑定其他有需求的实体。\r\n \r\n 当需要大批量创建绑定实体UI时,建议将创建UI的任务分为小批量多次执行,每批次间相距至少一帧。例如需要创建100个绑定实体UI,将任务分散在5帧中,每帧创建20个绑定实体UI。", + "return": [], + "description": "创建UI,详见界面创建流程及生命周期", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\nfrom mod_log import logger as logger\r\n# 监听引擎初始化完成事件,在这个事件后创建我们的战斗UI\r\ndef OnUIInitFinished(self, args):\r\n logger.info(\"OnUIInitFinished : %s\" % args)\r\n # 注册UI 详细解释参照《UI API》\r\n clientApi.RegisterUI(modConfig.ModName, modConfig.FpsBattleUIName, modConfig.FpsBattleUIPyClsPath, modConfig.FpsBattleUIScreenDef)\r\n # 创建普通UI界面\r\n clientApi.CreateUI(modConfig.ModName, modConfig.FpsBattleUIName, {\"isHud\" : 1})\r\n # 获取创建的UI界面\r\n self.mFpsBattleUINode = clientApi.GetUI(modConfig.ModName, modConfig.FpsBattleUIName)\r\n if self.mFpsBattleUINode:\r\n self.mFpsBattleUINode.Init()\r\n\r\n# 不同于上面的例子,这里展示的是如何创建绑定实体的UI界面\r\ndef OnUIInitFinished(self, args):\r\n logger.info(\"OnUIInitFinished : %s\" % args)\r\n # 同样先注册UI\r\n clientApi.RegisterUI(modConfig.ModName, modConfig.FpsBattleUIName, modConfig.FpsBattleUIPyClsPath, modConfig.FpsBattleUIScreenDef)\r\n # 创建绑定id为entityId的实体的UI\r\n clientApi.CreateUI(\r\n modConfig.ModName,\r\n modConfig.FpsBattleUIName,\r\n {\r\n \"bindEntityId\": entityId,\r\n \"bindOffset\": (0, 2, 0),\r\n \"autoScale\": 1\r\n }\r\n )\r\n self.mFpsBattleUINode = clientApi.GetUI(modConfig.ModName, modConfig.FpsBattleUIName)\r\n if self.mFpsBattleUINode:\r\n self.mFpsBattleUINode.Init()", "params": [ { - "name": "nameSpace", - "type": "str", + "type": "str", + "name": "nameSpace", "description": "命名空间,建议为mod名字" - }, + }, { - "name": "uiKey", - "type": "str", + "type": "str", + "name": "uiKey", "description": "UI唯一标识" - }, + }, { - "name": "createParams", - "type": "dict", + "type": "dict", + "name": "createParams", "description": "创建UI的参数,会传到UI类的_init_函数中" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nfrom mod_log import logger as logger\r\n# 监听引擎初始化完成事件,在这个事件后创建我们的战斗UI\r\ndef OnUIInitFinished(self, args):\r\n logger.info(\"OnUIInitFinished : %s\" % args)\r\n # 注册UI 详细解释参照《UI API》\r\n clientApi.RegisterUI(modConfig.ModName, modConfig.FpsBattleUIName, modConfig.FpsBattleUIPyClsPath, modConfig.FpsBattleUIScreenDef)\r\n # 创建普通UI界面\r\n clientApi.CreateUI(modConfig.ModName, modConfig.FpsBattleUIName, {\"isHud\" : 1})\r\n # 获取创建的UI界面\r\n self.mFpsBattleUINode = clientApi.GetUI(modConfig.ModName, modConfig.FpsBattleUIName)\r\n if self.mFpsBattleUINode:\r\n self.mFpsBattleUINode.Init()\r\n\r\n# 不同于上面的例子,这里展示的是如何创建绑定实体的UI界面\r\ndef OnUIInitFinished(self, args):\r\n logger.info(\"OnUIInitFinished : %s\" % args)\r\n # 同样先注册UI\r\n clientApi.RegisterUI(modConfig.ModName, modConfig.FpsBattleUIName, modConfig.FpsBattleUIPyClsPath, modConfig.FpsBattleUIScreenDef)\r\n # 创建绑定id为entityId的实体的UI\r\n clientApi.CreateUI(\r\n modConfig.ModName,\r\n modConfig.FpsBattleUIName,\r\n {\r\n \"bindEntityId\": entityId,\r\n \"bindOffset\": (0, 2, 0),\r\n \"autoScale\": 1\r\n }\r\n )\r\n self.mFpsBattleUINode = clientApi.GetUI(modConfig.ModName, modConfig.FpsBattleUIName)\r\n if self.mFpsBattleUINode:\r\n self.mFpsBattleUINode.Init()" - }, + ], + "type": "api", + "side": "client", + "name": "CreateUI" + }, { - "type": "api", - "name": "EnableFontBatchRender", - "method": "", - "description": "是否开启字体合批", - "remark": "- 设置是否开启字体合批功能,开启之后对性能有优化效果,默认开启。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "remark": "- 设置是否开启字体合批功能,开启之后对性能有优化效果,默认开启。", + "return": [], + "description": "是否开启字体合批", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.EnableFontBatchRender(True))", "params": [ { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "True开启,False关闭" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nprint(comp.EnableFontBatchRender(True))" - }, + ], + "type": "api", + "side": "client", + "name": "EnableFontBatchRender" + }, { - "type": "api", - "name": "GetCustomUIControlProxyCls", - "method": "", - "description": "获得原生界面自定义UI代理基类", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", - "params": [], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nCustomUIControlProxy = clientApi.GetCustomUIControlProxyCls()" - }, + "remark": "", + "return": [], + "description": "获得原生界面自定义UI代理基类", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import client.extraClientApi as clientApi\r\nCustomUIControlProxy = clientApi.GetCustomUIControlProxyCls()", + "params": [], + "type": "api", + "side": "client", + "name": "GetCustomUIControlProxyCls" + }, { - "type": "api", - "name": "GetMiniMapScreenNodeCls", - "method": "", - "description": "获取小地图ScreenNode基类", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nMiniMapBaseScreen = clientApi.GetMiniMapScreenNodeCls()" - }, + "remark": "", + "return": [], + "description": "获取小地图ScreenNode基类", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\nMiniMapBaseScreen = clientApi.GetMiniMapScreenNodeCls()", + "params": [], + "type": "api", + "side": "client", + "name": "GetMiniMapScreenNodeCls" + }, { - "type": "api", - "name": "GetNativeScreenManagerCls", - "method": "", - "description": "获得NativeScreenManager类", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", - "params": [], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nNativeScreenManager = clientApi.GetNativeScreenManagerCls()" - }, + "remark": "", + "return": [], + "description": "获得NativeScreenManager类", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import client.extraClientApi as clientApi\r\nNativeScreenManager = clientApi.GetNativeScreenManagerCls()", + "params": [], + "type": "api", + "side": "client", + "name": "GetNativeScreenManagerCls" + }, { - "type": "api", - "name": "GetScreenNodeCls", - "method": "", - "description": "获得ScreenNode类", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", - "params": [], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nScreenNode = clientApi.GetScreenNodeCls()" - }, + "remark": "", + "return": [], + "description": "获得ScreenNode类", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import client.extraClientApi as clientApi\r\nScreenNode = clientApi.GetScreenNodeCls()", + "params": [], + "type": "api", + "side": "client", + "name": "GetScreenNodeCls" + }, { - "type": "api", - "name": "GetTopScreen", - "method": "", - "description": "获取UI堆栈栈顶的UI节点", - "remark": "- 该接口获取最后一次PushScreen创建的界面,区别于GetTopUI接口,GetTopScreen仅可获取PushScreen创建的UI,GetTopUI可获取创建的原生UI或PushScreen创建的UI", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nnode = clientApi.GetTopScreen()" - }, + "remark": "- 该接口获取最后一次PushScreen创建的界面,区别于GetTopUI接口,GetTopScreen仅可获取PushScreen创建的UI,GetTopUI可获取创建的原生UI或PushScreen创建的UI", + "return": [], + "description": "获取UI堆栈栈顶的UI节点", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\nnode = clientApi.GetTopScreen()", + "params": [], + "type": "api", + "side": "client", + "name": "GetTopScreen" + }, { - "type": "api", - "name": "GetTopUI", - "method": "", - "description": "获取UI栈顶的UI名称", - "remark": "- 获取UI堆栈栈顶的UI名称,区别于GetTopScreen接口,GetTopUI可获取原生UI及PushScreen生成的UI,GetTopScreen仅可获取PushScreen创建的UI。\r\n - 获取到PushScreen生成UI返回为main,如果在ui的json文件中修改main名称,这里获得的返回值也会与之对应。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nTopUIName = clientApi.GetTopUI()" - }, + "remark": "- 获取UI堆栈栈顶的UI名称,区别于GetTopScreen接口,GetTopUI可获取原生UI及PushScreen生成的UI,GetTopScreen仅可获取PushScreen创建的UI。\r\n - 获取到PushScreen生成UI返回为main,如果在ui的json文件中修改main名称,这里获得的返回值也会与之对应。", + "return": [], + "description": "获取UI栈顶的UI名称", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\nTopUIName = clientApi.GetTopUI()", + "params": [], + "type": "api", + "side": "client", + "name": "GetTopUI" + }, { - "type": "api", - "name": "GetTopUINode", - "method": "", - "description": "获取Push进来的最顶层界面,包括原生界面,详见 界面创建流程及生命周期 ", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nuiNode = clientApi.GetTopUINode()" - }, + "remark": "", + "return": [], + "description": "获取Push进来的最顶层界面,包括原生界面,详见 界面创建流程及生命周期 ", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\nuiNode = clientApi.GetTopUINode()", + "params": [], + "type": "api", + "side": "client", + "name": "GetTopUINode" + }, { - "type": "api", - "name": "GetUI", - "method": "", - "description": "获取UI节点,详见界面创建流程及生命周期", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "remark": "", + "return": [], + "description": "获取UI节点,详见界面创建流程及生命周期", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\nuiNode = clientApi.GetUI(modConfig.ModName, modConfig.FpsBattleUIName)", "params": [ { - "name": "nameSpace", - "type": "str", + "type": "str", + "name": "nameSpace", "description": "命名空间,建议为mod名字" - }, + }, { - "name": "uiKey", - "type": "str", + "type": "str", + "name": "uiKey", "description": "UI唯一标识" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nuiNode = clientApi.GetUI(modConfig.ModName, modConfig.FpsBattleUIName)" - }, + ], + "type": "api", + "side": "client", + "name": "GetUI" + }, { - "type": "api", - "name": "GetUIScreenProxyCls", - "method": "", - "description": "获得原生界面Screen代理基类", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", - "params": [], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nCustomUIScreenProxy = clientApi.GetUIScreenProxyCls()" - }, + "remark": "", + "return": [], + "description": "获得原生界面Screen代理基类", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import client.extraClientApi as clientApi\r\nCustomUIScreenProxy = clientApi.GetUIScreenProxyCls()", + "params": [], + "type": "api", + "side": "client", + "name": "GetUIScreenProxyCls" + }, { - "type": "api", - "name": "GetViewBinderCls", - "method": "", - "description": "获得ViewBinder类", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", - "params": [], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nViewBinder = clientApi.GetViewBinderCls()" - }, + "remark": "", + "return": [], + "description": "获得ViewBinder类", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import client.extraClientApi as clientApi\r\nViewBinder = clientApi.GetViewBinderCls()", + "params": [], + "type": "api", + "side": "client", + "name": "GetViewBinderCls" + }, { - "type": "api", - "name": "GetViewViewRequestCls", - "method": "", - "description": "获得ViewRequest类", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", - "params": [], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nViewRequest = clientApi.GetViewViewRequestCls()" - }, + "remark": "", + "return": [], + "description": "获得ViewRequest类", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import client.extraClientApi as clientApi\r\nViewRequest = clientApi.GetViewViewRequestCls()", + "params": [], + "type": "api", + "side": "client", + "name": "GetViewViewRequestCls" + }, { - "type": "api", - "name": "OpenDeveloperHomeWindow", - "method": "", - "description": "打开网易资源中心开发者主页。该接口只能在横屏版本手机端使用", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "remark": "", + "return": [], + "description": "打开网易资源中心开发者主页。该接口只能在横屏版本手机端使用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateNeteaseWindow(playerId)\r\ncomp.OpenDeveloperHomeWindow(\"developer@163.com\")", "params": [ { - "name": "mailAddress", - "type": "str", + "type": "str", + "name": "mailAddress", "description": "开发者邮箱" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateNeteaseWindow(playerId)\r\ncomp.OpenDeveloperHomeWindow(\"developer@163.com\")" - }, + ], + "type": "api", + "side": "client", + "name": "OpenDeveloperHomeWindow" + }, { - "type": "api", - "name": "OpenResourceCenterDetailWindow", - "method": "", - "description": "打开网易资源中心组件详情界面。该接口只能在横屏版本手机端使用", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "remark": "", + "return": [], + "description": "打开网易资源中心组件详情界面。该接口只能在横屏版本手机端使用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateNeteaseWindow(playerId)\r\ncomp.OpenResourceCenterDetailWindow(\"itemId\")", "params": [ { - "name": "itemId", - "type": "str", + "type": "str", + "name": "itemId", "description": "组件id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateNeteaseWindow(playerId)\r\ncomp.OpenResourceCenterDetailWindow(\"itemId\")" - }, + ], + "type": "api", + "side": "client", + "name": "OpenResourceCenterDetailWindow" + }, { - "type": "api", - "name": "PopScreen", - "method": "", - "description": "使用堆栈管理的方式关闭UI", - "remark": "- 该接口关闭由PushScreen创建的界面,区别于PopTopUI接口,PopScreen仅可弹出PushScreen创建的UI,PopTopUI可弹出游戏原生UI及PushScreen创建的UI", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.PopScreen()" - }, + "remark": "- 该接口关闭由PushScreen创建的界面,区别于PopTopUI接口,PopScreen仅可弹出PushScreen创建的UI,PopTopUI可弹出游戏原生UI及PushScreen创建的UI", + "return": [], + "description": "使用堆栈管理的方式关闭UI", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.PopScreen()", + "params": [], + "type": "api", + "side": "client", + "name": "PopScreen" + }, { - "type": "api", - "name": "PopTopUI", - "method": "", - "description": "弹出UI栈顶的UI", - "remark": "- 弹出UI堆栈栈顶的UI,区别于PopScreen接口,PopTopUI可弹出原生UI及PushScreen生成的UI,PopScreen仅可弹出PushScreen创建的UI。\r\n - 不允许在同一帧里面进行多次操作,只允许一帧弹出一个UI", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nMyBool = clientApi.PopTopUI()" - }, + "remark": "- 弹出UI堆栈栈顶的UI,区别于PopScreen接口,PopTopUI可弹出原生UI及PushScreen生成的UI,PopScreen仅可弹出PushScreen创建的UI。\r\n - 不允许在同一帧里面进行多次操作,只允许一帧弹出一个UI", + "return": [], + "description": "弹出UI栈顶的UI", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\nMyBool = clientApi.PopTopUI()", + "params": [], + "type": "api", + "side": "client", + "name": "PopTopUI" + }, { - "type": "api", - "name": "PushScreen", - "method": "", - "description": "使用堆栈管理的方式创建UI", - "remark": "- 使用PopScreen可以关闭该接口创建的界面\r\n - createParams为自定义参数,该参数和CreateUI方法中的createParams不同,不支持CreateUI所列举的所有参数。\r\n - 生成UI的json文件中is_showing_menu必须设置为True", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "remark": "- 使用PopScreen可以关闭该接口创建的界面\r\n - createParams为自定义参数,该参数和CreateUI方法中的createParams不同,不支持CreateUI所列举的所有参数。\r\n - 生成UI的json文件中is_showing_menu必须设置为True", + "return": [], + "description": "使用堆栈管理的方式创建UI", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# 监听引擎初始化完成事件,在这个事件后创建我们的战斗UI\r\n# 由于UI不会在PushScreen被调用后立即创建完成,请不要在Init函数中对控件进行操作,创建完成后会调用screenNode的Create函数\r\ndef OnUIInitFinished(self, args):\r\n clientApi.RegisterUI(modConfig.ModName, modConfig.FpsBattleUIName, modConfig.FpsBattleUIPyClsPath, modConfig.FpsBattleUIScreenDef)\r\n self.mFpsBattleUINode = clientApi.PushScreen(modConfig.ModName, modConfig.FpsBattleUIName)\r\n if self.mFpsBattleUINode:\r\n self.mFpsBattleUINode.Init()", "params": [ { - "name": "namespace", - "type": "str", + "type": "str", + "name": "namespace", "description": "命名空间,建议为mod名字" - }, + }, { - "name": "uiname", - "type": "str", + "type": "str", + "name": "uiname", "description": "UI唯一标识" - }, + }, { - "name": "createParams", - "type": "dict", + "type": "dict", + "name": "createParams", "description": "创建UI的自定义参数,会传到UI类的_init_函数中,默认为None" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# 监听引擎初始化完成事件,在这个事件后创建我们的战斗UI\r\n# 由于UI不会在PushScreen被调用后立即创建完成,请不要在Init函数中对控件进行操作,创建完成后会调用screenNode的Create函数\r\ndef OnUIInitFinished(self, args):\r\n clientApi.RegisterUI(modConfig.ModName, modConfig.FpsBattleUIName, modConfig.FpsBattleUIPyClsPath, modConfig.FpsBattleUIScreenDef)\r\n self.mFpsBattleUINode = clientApi.PushScreen(modConfig.ModName, modConfig.FpsBattleUIName)\r\n if self.mFpsBattleUINode:\r\n self.mFpsBattleUINode.Init()" - }, + ], + "type": "api", + "side": "client", + "name": "PushScreen" + }, { - "type": "api", - "name": "RegisterUI", - "method": "", - "description": "注册UI,创建UI前,需要先注册UI。同一UI只需要注册一次即可。详见界面创建流程及生命周期", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "remark": "", + "return": [], + "description": "注册UI,创建UI前,需要先注册UI。同一UI只需要注册一次即可。详见界面创建流程及生命周期", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "import mod.client.extraClientApi as clientApi\r\nfrom mod_log import logger as logger\r\n# 监听引擎初始化完成事件,在这个事件后创建我们的战斗UI\r\ndef OnUIInitFinished(self, args):\r\n logger.info(\"OnUIInitFinished : %s\" % args)\r\n # 注册UI 详细解释参照《UI API》\r\n clientApi.RegisterUI(modConfig.ModName, modConfig.FpsBattleUIName, modConfig.FpsBattleUIPyClsPath, modConfig.FpsBattleUIScreenDef)\r\n # 创建UI 详细解释参照《UI API》\r\n clientApi.CreateUI(modConfig.ModName, modConfig.FpsBattleUIName, {\"isHud\" : 1})\r\n self.mFpsBattleUINode = clientApi.GetUI(modConfig.ModName, modConfig.FpsBattleUIName)\r\n if self.mFpsBattleUINode:\r\n self.mFpsBattleUINode.Init()", "params": [ { - "name": "nameSpace", - "type": "str", + "type": "str", + "name": "nameSpace", "description": "命名空间,建议为mod名字" - }, + }, { - "name": "uiKey", - "type": "str", + "type": "str", + "name": "uiKey", "description": "UI唯一标识" - }, + }, { - "name": "clsPath", - "type": "str", + "type": "str", + "name": "clsPath", "description": "UI类路径" - }, + }, { - "name": "uiScreenDef", - "type": "str", + "type": "str", + "name": "uiScreenDef", "description": "UI画布路径,格式为\"namespace.screenName\"。namespace对应uiJson文件中\"namespace\"对应的值,UI编辑器生成的uiJson文件该值等于文件名。screenName对应想打开的画布的名称。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nfrom mod_log import logger as logger\r\n# 监听引擎初始化完成事件,在这个事件后创建我们的战斗UI\r\ndef OnUIInitFinished(self, args):\r\n logger.info(\"OnUIInitFinished : %s\" % args)\r\n # 注册UI 详细解释参照《UI API》\r\n clientApi.RegisterUI(modConfig.ModName, modConfig.FpsBattleUIName, modConfig.FpsBattleUIPyClsPath, modConfig.FpsBattleUIScreenDef)\r\n # 创建UI 详细解释参照《UI API》\r\n clientApi.CreateUI(modConfig.ModName, modConfig.FpsBattleUIName, {\"isHud\" : 1})\r\n self.mFpsBattleUINode = clientApi.GetUI(modConfig.ModName, modConfig.FpsBattleUIName)\r\n if self.mFpsBattleUINode:\r\n self.mFpsBattleUINode.Init()" - }, + ], + "type": "api", + "side": "client", + "name": "RegisterUI" + }, { - "type": "api", - "name": "RegisterUIAnimations", - "method": "", - "description": "注册UI动画", - "remark": "- UI属性动画相关,详见属性动画\r\n - 需要注意的是,动态注册的动画是不支持外部继承以及变量解析的,除此之外,这里是通过代码动态注入动画,实际上和用json写动画是一致的。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "remark": "- UI属性动画相关,详见属性动画\r\n - 需要注意的是,动态注册的动画是不支持外部继承以及变量解析的,除此之外,这里是通过代码动态注入动画,实际上和用json写动画是一致的。", + "return": [], + "description": "注册UI动画", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "# 准备动画的数据,其中必须要有 \"namespace\" 作为动画的命名空间\r\n# 这里我们一次注册了两个动画片段,分别是 \"alpha_animation_1\" 以及 \"alpha_animation_2\"(一次可以注册多个回调,和写 ui json是一致的)\r\ndata = {\r\n \"namespace\": \"alphaTest\",\r\n \"alpha_animation_1\": {\r\n \"anim_type\": \"alpha\",\r\n \"duration\": 1.5,\r\n \"from\": 0,\r\n \"to\": 1,\r\n \"next\": \"@namespace.alpha_animation_2\"\r\n },\r\n \"alpha_animation_2\": {\r\n \"anim_type\": \"alpha\",\r\n \"duration\": 1.5,\r\n \"from\": 1,\r\n \"to\": 0,\r\n \"next\": \"@namespace.alpha_animation_1\"\r\n }\r\n}\r\nimport mod.client.extraClientApi as clientApi\r\nclientApi.RegisterUIAnimations(data, True)", "params": [ { - "name": "data", - "type": "dict", + "type": "dict", + "name": "data", "description": "动画的json数据,详见备注" - }, + }, { - "name": "override", - "type": "bool", + "type": "bool", + "name": "override", "description": "是否覆盖原先注册的同命名空间同名的动画(相当于对原先动画的修改),默认值是True,表示覆盖(如果为False,则会检测是否有覆盖,有的话会打印错误信息)" } - ], - "return": [], - "example": "# 准备动画的数据,其中必须要有 \"namespace\" 作为动画的命名空间\r\n# 这里我们一次注册了两个动画片段,分别是 \"alpha_animation_1\" 以及 \"alpha_animation_2\"(一次可以注册多个回调,和写 ui json是一致的)\r\ndata = {\r\n \"namespace\": \"alphaTest\",\r\n \"alpha_animation_1\": {\r\n \"anim_type\": \"alpha\",\r\n \"duration\": 1.5,\r\n \"from\": 0,\r\n \"to\": 1,\r\n \"next\": \"@namespace.alpha_animation_2\"\r\n },\r\n \"alpha_animation_2\": {\r\n \"anim_type\": \"alpha\",\r\n \"duration\": 1.5,\r\n \"from\": 1,\r\n \"to\": 0,\r\n \"next\": \"@namespace.alpha_animation_1\"\r\n }\r\n}\r\nimport mod.client.extraClientApi as clientApi\r\nclientApi.RegisterUIAnimations(data, True)" - }, + ], + "type": "api", + "side": "client", + "name": "RegisterUIAnimations" + }, { - "type": "api", - "name": "UnregisterUIAnimation", - "method": "", - "description": "取消UI动画的注册", - "remark": "- UI属性动画相关,详见属性动画", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "remark": "- UI属性动画相关,详见属性动画", + "return": [], + "description": "取消UI动画的注册", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/自定义UI/通用.md", + "example": "# 取消 \"alphaTest\" 命名空间下的 \"alpha_animation_1\" 动画,后续无法通过 setAnimation 设置该动画到控件中\r\nimport mod.client.extraClientApi as clientApi\r\nclientApi.UnregisterUIAnimation(\"alphaTest\", \"alpha_animation_1\")", "params": [ { - "name": "namespace", - "type": "str", + "type": "str", + "name": "namespace", "description": "动画的命名空间" - }, + }, { - "name": "defName", - "type": "str", + "type": "str", + "name": "defName", "description": "动画的名称" } - ], - "return": [], - "example": "# 取消 \"alphaTest\" 命名空间下的 \"alpha_animation_1\" 动画,后续无法通过 setAnimation 设置该动画到控件中\r\nimport mod.client.extraClientApi as clientApi\r\nclientApi.UnregisterUIAnimation(\"alphaTest\", \"alpha_animation_1\")" - }, + ], + "type": "api", + "side": "client", + "name": "UnregisterUIAnimation" + }, { - "type": "api", - "name": "VirtualWorldCreate", - "method": "", - "description": "创建虚拟世界,虚拟世界只允许存在一个,已经存在虚拟世界的情况下再调用此方法则无效", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md", - "params": [], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.VirtualWorldCreate()" - }, + "remark": "", + "return": [], + "description": "创建虚拟世界,虚拟世界只允许存在一个,已经存在虚拟世界的情况下再调用此方法则无效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.VirtualWorldCreate()", + "params": [], + "type": "api", + "side": "client", + "name": "VirtualWorldCreate" + }, { - "type": "api", - "name": "VirtualWorldDestroy", - "method": "", - "description": "销毁虚拟世界", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md", - "params": [], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.VirtualWorldDestroy()" - }, + "remark": "", + "return": [], + "description": "销毁虚拟世界", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.VirtualWorldDestroy()", + "params": [], + "type": "api", + "side": "client", + "name": "VirtualWorldDestroy" + }, { - "type": "api", - "name": "VirtualWorldSetCollidersVisible", - "method": "", - "description": "设置虚拟世界中模型的包围盒是否显示,主要用于调试,默认为不显示", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md", + "remark": "", + "return": [], + "description": "设置虚拟世界中模型的包围盒是否显示,主要用于调试,默认为不显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.VirtualWorldSetCollidersVisible(True)\r\n\r\nid = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetBoxCollider(id, (2.0, 2.0, 2.0), (0.0, 0.0, 0.0))", "params": [ { - "name": "isVisible", - "type": "bool", + "type": "bool", + "name": "isVisible", "description": "是否显示" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.VirtualWorldSetCollidersVisible(True)\r\n\r\nid = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetBoxCollider(id, (2.0, 2.0, 2.0), (0.0, 0.0, 0.0))" - }, + ], + "type": "api", + "side": "client", + "name": "VirtualWorldSetCollidersVisible" + }, { - "type": "api", - "name": "VirtualWorldSetSkyBgColor", - "method": "", - "description": "设置虚拟世界中天空背景的颜色", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md", + "remark": "", + "return": [], + "description": "设置虚拟世界中天空背景的颜色", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n#设置天空为红色\r\nvirtualWorldComp.VirtualWorldSetSkyBgColor((1.0, 0.0, 0.0))", "params": [ { - "name": "color", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "color", "description": "颜色的r,g,b值,均为0.0到1.0的浮点值" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n#设置天空为红色\r\nvirtualWorldComp.VirtualWorldSetSkyBgColor((1.0, 0.0, 0.0))" - }, + ], + "type": "api", + "side": "client", + "name": "VirtualWorldSetSkyBgColor" + }, { - "type": "api", - "name": "VirtualWorldSetSkyTexture", - "method": "", - "description": "设置虚拟世界中天空的贴图", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md", + "remark": "", + "return": [], + "description": "设置虚拟世界中天空的贴图", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.VirtualWorldSetSkyTexture(\"textures/virtualWorldSky\", 0)", "params": [ { - "name": "texturePath", - "type": "str", + "type": "str", + "name": "texturePath", "description": "贴图路径" - }, + }, { - "name": "mode", - "type": "int", + "type": "int", + "name": "mode", "description": "拉伸模式,0或1。0代表贴图宽高都拉伸至全屏,可能造成贴图变形;1代表高度拉伸至全屏,宽度按贴图原宽高比进行相应缩放,能保持贴图不被拉伸,但会造成贴图超出屏幕或不完全铺满屏幕。" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.VirtualWorldSetSkyTexture(\"textures/virtualWorldSky\", 0)" - }, + ], + "type": "api", + "side": "client", + "name": "VirtualWorldSetSkyTexture" + }, { - "type": "api", - "name": "VirtualWorldToggleVisibility", - "method": "", - "description": "设置虚拟世界是否显示", - "remark": "- 建议在需要频繁在主世界跟虚拟世界切换的时候使用该方法,若后续长时间不需要使用虚拟世界,建议调用VirtualWorldDestroy进行销毁释放资源", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md", + "remark": "- 建议在需要频繁在主世界跟虚拟世界切换的时候使用该方法,若后续长时间不需要使用虚拟世界,建议调用VirtualWorldDestroy进行销毁释放资源", + "return": [], + "description": "设置虚拟世界是否显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/世界.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.VirtualWorldToggleVisibility(False)", "params": [ { - "name": "isVisible", - "type": "bool", + "type": "bool", + "name": "isVisible", "description": "是否显示" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.VirtualWorldToggleVisibility(False)" - }, + ], + "type": "api", + "side": "client", + "name": "VirtualWorldToggleVisibility" + }, { - "type": "api", - "name": "BindModel", - "method": "", - "description": "把对象绑定到模型上, 支持绑定序列帧,粒子,文本和其它模型", - "remark": "- 模型绑定模型暂时不支持绑定到具体骨骼\r\n - 模型绑定仅支持原版模型绑定原版模型,或者网易骨骼模型绑定网易骨骼模型,不支持原版模型绑定到网易骨骼模型这种类型交错的绑定\r\n - 序列帧,文本,粒子的生命周期与可见性需要玩家自己管理,虚拟世界在隐藏或者销毁时不做处理。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/其它对象.md", + "remark": "- 模型绑定模型暂时不支持绑定到具体骨骼\r\n - 模型绑定仅支持原版模型绑定原版模型,或者网易骨骼模型绑定网易骨骼模型,不支持原版模型绑定到网易骨骼模型这种类型交错的绑定\r\n - 序列帧,文本,粒子的生命周期与可见性需要玩家自己管理,虚拟世界在隐藏或者销毁时不做处理。", + "return": [], + "description": "把对象绑定到模型上, 支持绑定序列帧,粒子,文本和其它模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/其它对象.md", + "example": "import client.extraClientApi as clientApi\r\nVirtualWorldObjectType = clientApi.GetMinecraftEnum().VirtualWorldObjectType\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\n\r\n# 序列帧\r\nframeEntityId = self.CreateEngineSfx(\"textures/sfxs/testSfx\")\r\nframeAniTransComp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\nframeAniControlComp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\nframeAniControlComp.SetLoop(True)\r\nframeAniControlComp.Play()\r\nvirtualWorldComp.BindModel(VirtualWorldObjectType.Sfx, frameEntityId, objId, (0.0, 3.0, 0.0), (0.0, 0.0, 0.0), \"root\")\r\n\r\n# 文本\r\ntextBoardComp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\ntextBoardId = textBoardComp.CreateTextBoardInWorld(\"Hello\", (0.5, 0.4, 0.3, 0.8), (0, 0, 0, 1), True)\r\nvirtualWorldComp.BindModel(VirtualWorldObjectType.Textboard, textBoardId, objId, (0.0, 3.0, 0.0), (0.0, 0.0, 0.0), \"root\")\r\n\r\n# 粒子\r\nparticleEntityId = self.CreateEngineParticle(\"effects/testParticle.json\", (0.0, 0.0, 0.0))\r\nparComp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\nparComp.Play()\r\nvirtualWorldComp.BindModel(VirtualWorldObjectType.Particle, particleEntityId, objId, (0.0, 3.0, 0.0), (0.0, 0.0, 0.0), \"root\")\r\n\r\n# 模型\r\nchildObj = virtualWorldComp.ModelCreateObject(\"datiangou\", \"fengxi\")\r\nvirtualWorldComp.BindModel(VirtualWorldObjectType.Model, childObj, objId, (-1.0, 0.0, 0.0), (0.0, 0.0, 0.0))", "params": [ { - "name": "virtualWorldObjectType", - "type": "int", + "type": "int", + "name": "virtualWorldObjectType", "description": "对象类型枚举, 支持VirtualWorldObjectType.Sfx, VirtualWorldObjectType.Textboard和VirtualWorldObjectType.Particle, VirtualWorldObjectType.Model" - }, + }, { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "要被绑定的对象的id" - }, + }, { - "name": "targetId", - "type": "int", + "type": "int", + "name": "targetId", "description": "绑定到的目标对象的id, 该对象删掉时,绑定在上面的对象也会删除" - }, + }, { - "name": "posOffset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "posOffset", "description": "绑定后相对目标的位置偏移" - }, + }, { - "name": "rotOffset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rotOffset", "description": "绑定后相对目标的旋转角度偏移" - }, + }, { - "name": "boneName", - "type": "str", + "type": "str", + "name": "boneName", "description": "要绑定到目标对象哪个骨骼,默认为root" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nVirtualWorldObjectType = clientApi.GetMinecraftEnum().VirtualWorldObjectType\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\n\r\n# 序列帧\r\nframeEntityId = self.CreateEngineSfx(\"textures/sfxs/testSfx\")\r\nframeAniTransComp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\nframeAniControlComp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\nframeAniControlComp.SetLoop(True)\r\nframeAniControlComp.Play()\r\nvirtualWorldComp.BindModel(VirtualWorldObjectType.Sfx, frameEntityId, objId, (0.0, 3.0, 0.0), (0.0, 0.0, 0.0), \"root\")\r\n\r\n# 文本\r\ntextBoardComp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\ntextBoardId = textBoardComp.CreateTextBoardInWorld(\"Hello\", (0.5, 0.4, 0.3, 0.8), (0, 0, 0, 1), True)\r\nvirtualWorldComp.BindModel(VirtualWorldObjectType.Textboard, textBoardId, objId, (0.0, 3.0, 0.0), (0.0, 0.0, 0.0), \"root\")\r\n\r\n# 粒子\r\nparticleEntityId = self.CreateEngineParticle(\"effects/testParticle.json\", (0.0, 0.0, 0.0))\r\nparComp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\nparComp.Play()\r\nvirtualWorldComp.BindModel(VirtualWorldObjectType.Particle, particleEntityId, objId, (0.0, 3.0, 0.0), (0.0, 0.0, 0.0), \"root\")\r\n\r\n# 模型\r\nchildObj = virtualWorldComp.ModelCreateObject(\"datiangou\", \"fengxi\")\r\nvirtualWorldComp.BindModel(VirtualWorldObjectType.Model, childObj, objId, (-1.0, 0.0, 0.0), (0.0, 0.0, 0.0))" - }, + ], + "type": "api", + "side": "client", + "name": "BindModel" + }, { - "type": "api", - "name": "MoveToVirtualWorld", - "method": "", - "description": "把对象从主世界移到虚拟世界, 非绑定的序列帧,文本,粒子需要调用该方法后才会出现在虚拟世界中,绑定的可以省略调用该方法。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/其它对象.md", + "remark": "", + "return": [], + "description": "把对象从主世界移到虚拟世界, 非绑定的序列帧,文本,粒子需要调用该方法后才会出现在虚拟世界中,绑定的可以省略调用该方法。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/其它对象.md", + "example": "import client.extraClientApi as clientApi\r\nVirtualWorldObjectType = clientApi.GetMinecraftEnum().VirtualWorldObjectType\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n\r\n# 序列帧\r\nframeEntityId = self.CreateEngineSfx(\"textures/sfxs/testSfx\")\r\nframeAniTransComp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\nframeAniTransComp.SetPos((0.0, 0.0, 0.0))\r\nframeAniControlComp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\nframeAniControlComp.SetLoop(True)\r\nframeAniControlComp.Play()\r\nvirtualWorldComp.MoveToVirtualWorld(VirtualWorldObjectType.Sfx, frameEntityId)\r\n\r\n# 文本\r\ntextBoardComp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\ntextBoardId = textBoardComp.CreateTextBoardInWorld(\"Hello\", (0.5, 0.4, 0.3, 0.8), (0, 0, 0, 1), True)\r\nvirtualWorldComp.MoveToVirtualWorld(VirtualWorldObjectType.Textboard, textBoardId)\r\n\r\n# 粒子\r\nparticleEntityId = self.CreateEngineParticle(\"effects/testParticle.json\", (0.0, 0.0, 0.0))\r\nparComp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\nparComp.Play()\r\nvirtualWorldComp.MoveToVirtualWorld(VirtualWorldObjectType.Particle, particleEntityId)", "params": [ { - "name": "virtualWorldObjectType", - "type": "int", + "type": "int", + "name": "virtualWorldObjectType", "description": "对象类型枚举, 支持VirtualWorldObjectType.Sfx, VirtualWorldObjectType.Textboard和VirtualWorldObjectType.Particle" - }, + }, { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "要移动的对象的id" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nVirtualWorldObjectType = clientApi.GetMinecraftEnum().VirtualWorldObjectType\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n\r\n# 序列帧\r\nframeEntityId = self.CreateEngineSfx(\"textures/sfxs/testSfx\")\r\nframeAniTransComp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId)\r\nframeAniTransComp.SetPos((0.0, 0.0, 0.0))\r\nframeAniControlComp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId)\r\nframeAniControlComp.SetLoop(True)\r\nframeAniControlComp.Play()\r\nvirtualWorldComp.MoveToVirtualWorld(VirtualWorldObjectType.Sfx, frameEntityId)\r\n\r\n# 文本\r\ntextBoardComp = clientApi.GetEngineCompFactory().CreateTextBoard(clientApi.GetLevelId())\r\ntextBoardId = textBoardComp.CreateTextBoardInWorld(\"Hello\", (0.5, 0.4, 0.3, 0.8), (0, 0, 0, 1), True)\r\nvirtualWorldComp.MoveToVirtualWorld(VirtualWorldObjectType.Textboard, textBoardId)\r\n\r\n# 粒子\r\nparticleEntityId = self.CreateEngineParticle(\"effects/testParticle.json\", (0.0, 0.0, 0.0))\r\nparComp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId)\r\nparComp.Play()\r\nvirtualWorldComp.MoveToVirtualWorld(VirtualWorldObjectType.Particle, particleEntityId)" - }, + ], + "type": "api", + "side": "client", + "name": "MoveToVirtualWorld" + }, { - "type": "api", - "name": "ModelCancelAllBoneMask", - "method": "", - "description": "取消动画中的所有骨骼屏蔽。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "", + "return": [], + "description": "取消动画中的所有骨骼屏蔽。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.ModelCancelAllBoneMask(objId, \"attack\")", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "animationName", - "type": "str", + "type": "str", + "name": "animationName", "description": "模型的动画" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.ModelCancelAllBoneMask(objId, \"attack\")" - }, + ], + "type": "api", + "side": "client", + "name": "ModelCancelAllBoneMask" + }, { - "type": "api", - "name": "ModelCreateMinecraftObject", - "method": "", - "description": "在虚拟世界中创建微软原版模型", - "remark": "- 创建模型后需要使用 ModelUpdateAnimationMolangVariable 为该模型json动作文件里面的所有变量进行赋值,不然运行时会有大量非空判断处理,会产生性能下降\r\n - 模型创建时初始默认朝向为+z方向, 位置为相机朝向的正前方10个单位,建议后续对坐标进行修改\r\n - 创建的原版模型需要改变播放的动作,只能通过 ModelUpdateAnimationMolangVariable 接口修改molang变量进行控制,不兼容组件中的其它动作接口\r\n - 暂不支持的微软原版模型:minecraft:horse(马)、minecraft:donkey(驴)、minecraft:mule(骡子)、minecraft:skeleton_horse(骷髅马)、minecraft:zombie_horse(僵尸马)、minecraft:llama(羊驼)、minecraft:tropicalfish(热带鱼)、minecraft:slime(史莱姆)、minecraft:magma_cube(岩浆怪)、minecraft:ghast(恶魂)、minecraft:shulker(潜影贝)、minecraft:ender_dragon(末影龙)、minecraft:thrown_trident(三叉戟)、minecraft:ender_crystal(末影水晶)、minecraft:boat(船)、minecraft:tnt(TNT)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "- 创建模型后需要使用 ModelUpdateAnimationMolangVariable 为该模型json动作文件里面的所有变量进行赋值,不然运行时会有大量非空判断处理,会产生性能下降\r\n - 模型创建时初始默认朝向为+z方向, 位置为相机朝向的正前方10个单位,建议后续对坐标进行修改\r\n - 创建的原版模型需要改变播放的动作,只能通过 ModelUpdateAnimationMolangVariable 接口修改molang变量进行控制,不兼容组件中的其它动作接口\r\n - 暂不支持的微软原版模型:minecraft:horse(马)、minecraft:donkey(驴)、minecraft:mule(骡子)、minecraft:skeleton_horse(骷髅马)、minecraft:zombie_horse(僵尸马)、minecraft:llama(羊驼)、minecraft:tropicalfish(热带鱼)、minecraft:slime(史莱姆)、minecraft:magma_cube(岩浆怪)、minecraft:ghast(恶魂)、minecraft:shulker(潜影贝)、minecraft:ender_dragon(末影龙)、minecraft:thrown_trident(三叉戟)、minecraft:ender_crystal(末影水晶)、minecraft:boat(船)、minecraft:tnt(TNT)", + "return": [], + "description": "在虚拟世界中创建微软原版模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.ModelCreateMinecraftObject(\"minecraft:sheep\")\r\nvirtualWorldComp.ModelUpdateAnimationMolangVariable(id, {\"variable.state\": 2, \"variable.liedownamount\": 0})", "params": [ { - "name": "identifier", - "type": "str", + "type": "str", + "name": "identifier", "description": "模型的identifier" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.ModelCreateMinecraftObject(\"minecraft:sheep\")\r\nvirtualWorldComp.ModelUpdateAnimationMolangVariable(id, {\"variable.state\": 2, \"variable.liedownamount\": 0})" - }, + ], + "type": "api", + "side": "client", + "name": "ModelCreateMinecraftObject" + }, { - "type": "api", - "name": "ModelCreateObject", - "method": "", - "description": "在虚拟世界中创建网易骨骼模型", - "remark": "- 模型创建时初始默认朝向为+z方向, 位置为相机朝向的正前方10个单位,建议后续对坐标进行修改", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "- 模型创建时初始默认朝向为+z方向, 位置为相机朝向的正前方10个单位,建议后续对坐标进行修改", + "return": [], + "description": "在虚拟世界中创建网易骨骼模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")", "params": [ { - "name": "modelName", - "type": "str", + "type": "str", + "name": "modelName", "description": "模型的资源" - }, + }, { - "name": "animationName", - "type": "str", + "type": "str", + "name": "animationName", "description": "模型的动画" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")" - }, + ], + "type": "api", + "side": "client", + "name": "ModelCreateObject" + }, { - "type": "api", - "name": "ModelGetPos", - "method": "", - "description": "获取模型的坐标", - "remark": "- 若对象绑定到其它对象上,则返回无意义,以绑定时参数为准", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "- 若对象绑定到其它对象上,则返回无意义,以绑定时参数为准", + "return": [], + "description": "获取模型的坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetPos(objId, (0.0, 0.0, -10.0))\r\npos = virtualWorldComp.ModelGetPos(objId)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetPos(objId, (0.0, 0.0, -10.0))\r\npos = virtualWorldComp.ModelGetPos(objId)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelGetPos" + }, { - "type": "api", - "name": "ModelGetRot", - "method": "", - "description": "返回模型的旋转角度", - "remark": "- 若对象绑定到其它对象上,则返回无意义,以绑定时参数为准", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "- 若对象绑定到其它对象上,则返回无意义,以绑定时参数为准", + "return": [], + "description": "返回模型的旋转角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetRot(objId, (0.0, 90.0, 0.0))\r\nrot = virtualWorldComp.ModelGetRot(objId)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetRot(objId, (0.0, 90.0, 0.0))\r\nrot = virtualWorldComp.ModelGetRot(objId)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelGetRot" + }, { - "type": "api", - "name": "ModelIsVisible", - "method": "", - "description": "返回模型可见性", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "", + "return": [], + "description": "返回模型可见性", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nid = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nprint(virtualWorldComp.ModelIsVisible(id))", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nid = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nprint(virtualWorldComp.ModelIsVisible(id))" - }, + ], + "type": "api", + "side": "client", + "name": "ModelIsVisible" + }, { - "type": "api", - "name": "ModelMoveTo", - "method": "", - "description": "设置模型平移运动", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "", + "return": [], + "description": "设置模型平移运动", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetPos(objId, (0.0, 0.0, 0.0))\r\nvirtualWorldComp.ModelMoveTo(objId, (0.0, 0.0, -10.0), 3.0, clientApi.GetMinecraftEnum().TimeEaseType.linear)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "坐标值(x, y, z)" - }, + }, { - "name": "time", - "type": "float", + "type": "float", + "name": "time", "description": "单位秒,运动时长(大于0的浮点数)" - }, + }, { - "name": "ease", - "type": "TimeEaseType", + "type": "TimeEaseType", + "name": "ease", "description": "时间变化函数, 默认值为clientApi.GetMinecraftEnum().TimeEaseType.linear, 参数不在枚举值中也当作linear" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetPos(objId, (0.0, 0.0, 0.0))\r\nvirtualWorldComp.ModelMoveTo(objId, (0.0, 0.0, -10.0), 3.0, clientApi.GetMinecraftEnum().TimeEaseType.linear)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelMoveTo" + }, { - "type": "api", - "name": "ModelPlayAnimation", - "method": "", - "description": "模型播放动画,支持动作融合,其功能与模型接口ModelPlayAni相同。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "", + "return": [], + "description": "模型播放动画,支持动作融合,其功能与模型接口ModelPlayAni相同。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelPlayAnimation(objId, \"fengxi\", True)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "animationName", - "type": "str", + "type": "str", + "name": "animationName", "description": "模型的动画" - }, + }, { - "name": "loop", - "type": "bool", + "type": "bool", + "name": "loop", "description": "是否循环播放" - }, + }, { - "name": "isBlended", - "type": "bool", + "type": "bool", + "name": "isBlended", "description": "播放时是与当前动画混合还是中止当前动画的播放,默认False,即中止当前动画播放。设置为True时,将允许即将播放的动画进行混合(注意,在没有设置骨骼屏蔽或是设置线性混合参数的情况下不会产生混合效果)。另外,动画混合仅在相同层级的动画之间进行。若当前播放的动画与即将播放的动画层级不一样,则isBlended参数无效。" - }, + }, { - "name": "layer", - "type": "int", + "type": "int", + "name": "layer", "description": "设置骨骼动画的层级,范围为0~255,默认为0。注意,如果播放的动画已经存在,则会将原有的动画层级覆盖。动画层级越大,则优先度越高,骨骼模型的骨骼优先播放优先度最高的动画。" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelPlayAnimation(objId, \"fengxi\", True)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelPlayAnimation" + }, { - "type": "api", - "name": "ModelRegisterAnim1DControlParam", - "method": "", - "description": "当同时播放多个骨骼动画时,新建用于控制动画进行1D线性混合的参数。目前线性混合仅支持对两个动画进行混合。新建的参数值范围为[0,1]。指定的骨骼将会按照这个参数的值对两个动画进行线性混合。", - "remark": "- 注意,如果对某个骨骼使用了骨骼屏蔽,则这个1D线性混合将对该骨骼不会生效。另外,如果在使用该接口时新建一个已经存在的参数名称,则会将原来的参数覆盖。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "- 注意,如果对某个骨骼使用了骨骼屏蔽,则这个1D线性混合将对该骨骼不会生效。另外,如果在使用该接口时新建一个已经存在的参数名称,则会将原来的参数覆盖。", + "return": [], + "description": "当同时播放多个骨骼动画时,新建用于控制动画进行1D线性混合的参数。目前线性混合仅支持对两个动画进行混合。新建的参数值范围为[0,1]。指定的骨骼将会按照这个参数的值对两个动画进行线性混合。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n# 新建1D控制参数,用于对attack和walk这两个动画进行线性混合,参数的名称为“arm_control_param”。\r\nvirtualWorldComp.ModelRegisterAnim1DControlParam(objId, \"attack\", \"walk\", \"arm_control_param\")\r\n# 相继播放这两个动画,设置isBlend为True,开启动画混合。\r\nvirtualWorldComp.ModelPlayAnimation(objId, \"attack\", True, True)\r\nvirtualWorldComp.ModelPlayAnimation(objId, \"walk\",True, True)\r\n# 改变1D控制参数的值,两个动画将根据该值进行线性混合。可根据实际情况进行动态调整。\r\nvirtualWorldComp.ModelSetAnim1DControlParam(objId, \"arm_control_param\", 0.5)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "leftAniName", - "type": "str", + "type": "str", + "name": "leftAniName", "description": "混合的第一个动画名称,当1D参数的值为0时指定的骨骼仅播放这个动画。" - }, + }, { - "name": "rightAniName", - "type": "str", + "type": "str", + "name": "rightAniName", "description": "混合的第二个动画名称,当1D参数的值为1时指定的骨骼仅播放这个动画。" - }, + }, { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "自定义的1D参数名称。该参数新建后的初始值为0。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n# 新建1D控制参数,用于对attack和walk这两个动画进行线性混合,参数的名称为“arm_control_param”。\r\nvirtualWorldComp.ModelRegisterAnim1DControlParam(objId, \"attack\", \"walk\", \"arm_control_param\")\r\n# 相继播放这两个动画,设置isBlend为True,开启动画混合。\r\nvirtualWorldComp.ModelPlayAnimation(objId, \"attack\", True, True)\r\nvirtualWorldComp.ModelPlayAnimation(objId, \"walk\",True, True)\r\n# 改变1D控制参数的值,两个动画将根据该值进行线性混合。可根据实际情况进行动态调整。\r\nvirtualWorldComp.ModelSetAnim1DControlParam(objId, \"arm_control_param\", 0.5)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelRegisterAnim1DControlParam" + }, { - "type": "api", - "name": "ModelRemove", - "method": "", - "description": "销毁虚拟世界中的模型", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "", + "return": [], + "description": "销毁虚拟世界中的模型", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelRemove(objId)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelRemove(objId)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelRemove" + }, { - "type": "api", - "name": "ModelRotate", - "method": "", - "description": "模型绕某个轴旋转多少度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "", + "return": [], + "description": "模型绕某个轴旋转多少度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelRotate(objId, 90.0, (0.0, 1.0, 0.0))", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "degreeAngle", - "type": "float", + "type": "float", + "name": "degreeAngle", "description": "旋转角度,为了避免数值过大出现浮点误差,建议角度范围控制在-360度到360度" - }, + }, { - "name": "axis", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "axis", "description": "旋转轴(x, y, z)" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelRotate(objId, 90.0, (0.0, 1.0, 0.0))" - }, + ], + "type": "api", + "side": "client", + "name": "ModelRotate" + }, { - "type": "api", - "name": "ModelRotateTo", - "method": "", - "description": "设置模型旋转运动", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "", + "return": [], + "description": "设置模型旋转运动", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetRot(objId, (0.0, 0.0, 0.0))\r\nvirtualWorldComp.ModelRotateTo(objId, (0.0, 90.0, 0.0), 3.0, clientApi.GetMinecraftEnum().TimeEaseType.linear)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "旋转值(x, y, z)" - }, + }, { - "name": "time", - "type": "float", + "type": "float", + "name": "time", "description": "单位秒,运动时长(大于0的浮点数)" - }, + }, { - "name": "ease", - "type": "TimeEaseType", + "type": "TimeEaseType", + "name": "ease", "description": "时间变化函数, 默认值为clientApi.GetMinecraftEnum().TimeEaseType.linear, 参数不在枚举值中也当作linear" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetRot(objId, (0.0, 0.0, 0.0))\r\nvirtualWorldComp.ModelRotateTo(objId, (0.0, 90.0, 0.0), 3.0, clientApi.GetMinecraftEnum().TimeEaseType.linear)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelRotateTo" + }, { - "type": "api", - "name": "ModelSetAnim1DControlParam", - "method": "", - "description": "新建动画的1D控制参数后,使用该接口对相应的参数进行控制。", - "remark": "- 注意,如果对某个骨骼使用了骨骼屏蔽,则这个1D线性混合将对该骨骼不会生效。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "- 注意,如果对某个骨骼使用了骨骼屏蔽,则这个1D线性混合将对该骨骼不会生效。", + "return": [], + "description": "新建动画的1D控制参数后,使用该接口对相应的参数进行控制。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n# 新建1D控制参数,用于对attack和walk这两个动画进行线性混合,参数的名称为“arm_control_param”。\r\nvirtualWorldComp.ModelRegisterAnim1DControlParam(objId, \"attack\", \"walk\", \"arm_control_param\")\r\n# 相继播放这两个动画,设置isBlend为True,开启动画混合。\r\nvirtualWorldComp.ModelPlayAnimation(objId, \"attack\", True, True)\r\nvirtualWorldComp.ModelPlayAnimation(objId, \"walk\",True, True)\r\n# 改变1D控制参数的值,两个动画将根据该值进行线性混合。可根据实际情况进行动态调整。\r\nvirtualWorldComp.ModelSetAnim1DControlParam(objId, \"arm_control_param\", 0.5)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "paramName", - "type": "str", + "type": "str", + "name": "paramName", "description": "使用接口RegisterAnim1DControlParam所新建的自定义1D参数名称。该参数新建后的初始值为0。" - }, + }, { - "name": "value", - "type": "float", + "type": "float", + "name": "value", "description": "参数的值,范围为[0,1]。当1D参数的值为0时仅播放接口RegisterAnim1DControlParam中的leftAniName参数指定的动画,当1D参数的值为1时仅播放接口RegisterAnim1DControlParam中的rightAniName参数指定的动画" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n# 新建1D控制参数,用于对attack和walk这两个动画进行线性混合,参数的名称为“arm_control_param”。\r\nvirtualWorldComp.ModelRegisterAnim1DControlParam(objId, \"attack\", \"walk\", \"arm_control_param\")\r\n# 相继播放这两个动画,设置isBlend为True,开启动画混合。\r\nvirtualWorldComp.ModelPlayAnimation(objId, \"attack\", True, True)\r\nvirtualWorldComp.ModelPlayAnimation(objId, \"walk\",True, True)\r\n# 改变1D控制参数的值,两个动画将根据该值进行线性混合。可根据实际情况进行动态调整。\r\nvirtualWorldComp.ModelSetAnim1DControlParam(objId, \"arm_control_param\", 0.5)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelSetAnim1DControlParam" + }, { - "type": "api", - "name": "ModelSetAnimAllBoneMask", - "method": "", - "description": "设置是否屏蔽动画中所有骨骼的动画,若开启骨骼屏蔽后,该骨骼将不再播放该动画中的动作。该接口会对该动画中所有骨骼生效,可通过参数ignoreBoneList来指定不受影响的骨骼名称。通过屏蔽指定骨骼的动画可实现同一个骨骼模型同时在不同骨骼上播放不同的动作动画,从而实现快捷的动作融合。", - "remark": "- 在使用该接口屏蔽上下半身的动画时,如果骨骼当中存在root骨骼,并且root骨骼的子骨骼包含上下半身的骨骼的话,root骨骼往往会控制整体骨骼模型的移动,要注意root骨骼对其他骨骼的影响。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "- 在使用该接口屏蔽上下半身的动画时,如果骨骼当中存在root骨骼,并且root骨骼的子骨骼包含上下半身的骨骼的话,root骨骼往往会控制整体骨骼模型的移动,要注意root骨骼对其他骨骼的影响。", + "return": [], + "description": "设置是否屏蔽动画中所有骨骼的动画,若开启骨骼屏蔽后,该骨骼将不再播放该动画中的动作。该接口会对该动画中所有骨骼生效,可通过参数ignoreBoneList来指定不受影响的骨骼名称。通过屏蔽指定骨骼的动画可实现同一个骨骼模型同时在不同骨骼上播放不同的动作动画,从而实现快捷的动作融合。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n# 屏蔽名为attack动画中所有骨骼的动画,\"l_arm\"及\"r_arm\"这两个不受影响,其子骨骼也不受影响\r\nvirtualWorldComp.ModelSetAnimAllBoneMask(objId, \"attack\", [\"l_arm\", \"r_arm\"], False, True)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "animationName", - "type": "str", + "type": "str", + "name": "animationName", "description": "模型的动画" - }, + }, { - "name": "ignoreBonesList", - "type": "list(str)", + "type": "list(str)", + "name": "ignoreBonesList", "description": "忽视的骨骼名称列表。在这个列表中的骨骼将不会被影响。输入空列表时则对所有骨骼执行这次设置。" - }, + }, { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否启用该骨骼的动画。True为不屏蔽,启动该骨骼的动画。False为屏蔽,不启动该骨骼的动画。" - }, + }, { - "name": "applyToChild", - "type": "bool", + "type": "bool", + "name": "applyToChild", "description": "True为对ignoreBoneList中的骨骼的子骨骼也生效,False为仅对ignoreBoneList中的骨骼生效,默认为True。若ignoreBoneList为空列表,则applyToChild无效果。" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n# 屏蔽名为attack动画中所有骨骼的动画,\"l_arm\"及\"r_arm\"这两个不受影响,其子骨骼也不受影响\r\nvirtualWorldComp.ModelSetAnimAllBoneMask(objId, \"attack\", [\"l_arm\", \"r_arm\"], False, True)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelSetAnimAllBoneMask" + }, { - "type": "api", - "name": "ModelSetAnimBoneMask", - "method": "", - "description": "设置是否屏蔽动画中指定的骨骼的动画,若开启骨骼屏蔽后,该骨骼将不再播放该动画中的动作。通过屏蔽指定骨骼的动画可实现同一个骨骼模型同时在不同骨骼上播放不同的动作动画,从而实现快捷的动作融合。", - "remark": "- 在使用该接口屏蔽上下半身的动画时,如果骨骼当中存在root骨骼,并且root骨骼的子骨骼包含上下半身的骨骼的话,root骨骼往往会控制整体骨骼模型的移动,要注意root骨骼对其他骨骼的影响。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "- 在使用该接口屏蔽上下半身的动画时,如果骨骼当中存在root骨骼,并且root骨骼的子骨骼包含上下半身的骨骼的话,root骨骼往往会控制整体骨骼模型的移动,要注意root骨骼对其他骨骼的影响。", + "return": [], + "description": "设置是否屏蔽动画中指定的骨骼的动画,若开启骨骼屏蔽后,该骨骼将不再播放该动画中的动作。通过屏蔽指定骨骼的动画可实现同一个骨骼模型同时在不同骨骼上播放不同的动作动画,从而实现快捷的动作融合。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n# 屏蔽名为attack动画中的\"l_arm\"及\"r_arm\"的骨骼的动画,对其子骨骼也生效\r\nvirtualWorldComp.ModelSetAnimBoneMask(objId, \"attack\", [\"l_arm\", \"r_arm\"], False, True)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "animationName", - "type": "str", + "type": "str", + "name": "animationName", "description": "模型的动画" - }, + }, { - "name": "boneNamesList", - "type": "list(str)", + "type": "list(str)", + "name": "boneNamesList", "description": "骨骼名称列表" - }, + }, { - "name": "enable", - "type": "bool", + "type": "bool", + "name": "enable", "description": "是否启用该骨骼的动画。True为不屏蔽,启动该骨骼的动画。False为屏蔽,不启动该骨骼的动画。" - }, + }, { - "name": "applyToChild", - "type": "bool", + "type": "bool", + "name": "applyToChild", "description": "True为对该骨骼及其子骨骼生效,False为仅对该骨骼生效,默认为True" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n# 屏蔽名为attack动画中的\"l_arm\"及\"r_arm\"的骨骼的动画,对其子骨骼也生效\r\nvirtualWorldComp.ModelSetAnimBoneMask(objId, \"attack\", [\"l_arm\", \"r_arm\"], False, True)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelSetAnimBoneMask" + }, { - "type": "api", - "name": "ModelSetAnimLayer", - "method": "", - "description": "设置骨骼动画的层级,动画层级越大,则优先度越高,骨骼模型的骨骼优先播放优先度最高的动画,相同层级的动画则优先播放率先播放的动画。", - "remark": "- 注意,设置层级相同的情况下不会改变当前的优先播放序列。举个例子:当前存在动画A及动画B,动画A的层级为1,动画B的层级为0,此时骨骼模型播放的动画为动画A。如果将动画A的层级设置为0,即动画A及动画B的层级相同,则当前仍然会播放动画A,因为层级相同的情况下不会改变目前的优先播放序列。要想让骨骼模型播放动画B,则需要动画B的层级比动画A的层级高。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "- 注意,设置层级相同的情况下不会改变当前的优先播放序列。举个例子:当前存在动画A及动画B,动画A的层级为1,动画B的层级为0,此时骨骼模型播放的动画为动画A。如果将动画A的层级设置为0,即动画A及动画B的层级相同,则当前仍然会播放动画A,因为层级相同的情况下不会改变目前的优先播放序列。要想让骨骼模型播放动画B,则需要动画B的层级比动画A的层级高。", + "return": [], + "description": "设置骨骼动画的层级,动画层级越大,则优先度越高,骨骼模型的骨骼优先播放优先度最高的动画,相同层级的动画则优先播放率先播放的动画。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import mod.client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.ModelSetAnimLayer(objId, \"attack\", 1)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "animationName", - "type": "str", + "type": "str", + "name": "animationName", "description": "模型的动画" - }, + }, { - "name": "layer", - "type": "int", + "type": "int", + "name": "layer", "description": "动画层级, 正整数,范围为0~255" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.ModelSetAnimLayer(objId, \"attack\", 1)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelSetAnimLayer" + }, { - "type": "api", - "name": "ModelSetBoxCollider", - "method": "", - "description": "设置模型的包围盒", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "", + "return": [], + "description": "设置模型的包围盒", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetBoxCollider(objId, (2.0, 2.0, 2.0), (0.0, 0.0, 0.0))", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "lengths", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "lengths", "description": "模型包围盒各个方向的长度,(x,y,z)" - }, + }, { - "name": "offset", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "offset", "description": "模型包围盒中心的偏移,(x,y,z),默认为(0.0,0.0,0.0)" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetBoxCollider(objId, (2.0, 2.0, 2.0), (0.0, 0.0, 0.0))" - }, + ], + "type": "api", + "side": "client", + "name": "ModelSetBoxCollider" + }, { - "type": "api", - "name": "ModelSetPos", - "method": "", - "description": "设置模型坐标", - "remark": "- 若对象绑定到其它对象上,则修改无效,实际位置以绑定时参数为准", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "- 若对象绑定到其它对象上,则修改无效,实际位置以绑定时参数为准", + "return": [], + "description": "设置模型坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetPos(objId, (0.0, 0.0, -10.0))", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "坐标(x, y, z)" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetPos(objId, (0.0, 0.0, -10.0))" - }, + ], + "type": "api", + "side": "client", + "name": "ModelSetPos" + }, { - "type": "api", - "name": "ModelSetRot", - "method": "", - "description": "设置模型的旋转角度", - "remark": "- 若对象绑定到其它对象上,则修改无效,实际旋转角度以绑定时参数为准", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "- 若对象绑定到其它对象上,则修改无效,实际旋转角度以绑定时参数为准", + "return": [], + "description": "设置模型的旋转角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetRot(objId, (0.0, 90.0, 0.0))", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "rot", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "rot", "description": "旋转角度(x, y, z)初始默认为(0, 0, 0),指向z轴负方向。 为了避免数值过大出现浮点误差,建议各维度角度控制范围在-360度到360度" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetRot(objId, (0.0, 90.0, 0.0))" - }, + ], + "type": "api", + "side": "client", + "name": "ModelSetRot" + }, { - "type": "api", - "name": "ModelSetScale", - "method": "", - "description": "设置模型的缩放值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "", + "return": [], + "description": "设置模型的缩放值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetScale(objId, (2.0, 2.0, 2.0))", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "scales", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "scales", "description": "缩放值(x, y, z)" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetScale(objId, (2.0, 2.0, 2.0))" - }, + ], + "type": "api", + "side": "client", + "name": "ModelSetScale" + }, { - "type": "api", - "name": "ModelSetVisible", - "method": "", - "description": "设置模型可见性", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "", + "return": [], + "description": "设置模型可见性", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nid = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetVisible(id, False)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "isVisible", - "type": "bool", + "type": "bool", + "name": "isVisible", "description": "是否可见" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nid = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetVisible(id, False)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelSetVisible" + }, { - "type": "api", - "name": "ModelStopActions", - "method": "", - "description": "停止模型的移动和旋转运动", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "", + "return": [], + "description": "停止模型的移动和旋转运动", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetPos(objId, (0.0, 0.0, 0.0))\r\nvirtualWorldComp.ModelSetRot(objId, (0.0, 0.0, 0.0))\r\nvirtualWorldComp.ModelMoveTo(objId, (0.0, 0.0, -10.0), 3.0, clientApi.GetMinecraftEnum().TimeEaseType.linear)\r\nvirtualWorldComp.ModelRotateTo(objId, (0.0, 90.0, 0.0), 3.0, clientApi.GetMinecraftEnum().TimeEaseType.linear)\r\nvirtualWorldComp.ModelStopActions(objId)", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nobjId = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\nvirtualWorldComp.ModelSetPos(objId, (0.0, 0.0, 0.0))\r\nvirtualWorldComp.ModelSetRot(objId, (0.0, 0.0, 0.0))\r\nvirtualWorldComp.ModelMoveTo(objId, (0.0, 0.0, -10.0), 3.0, clientApi.GetMinecraftEnum().TimeEaseType.linear)\r\nvirtualWorldComp.ModelRotateTo(objId, (0.0, 90.0, 0.0), 3.0, clientApi.GetMinecraftEnum().TimeEaseType.linear)\r\nvirtualWorldComp.ModelStopActions(objId)" - }, + ], + "type": "api", + "side": "client", + "name": "ModelStopActions" + }, { - "type": "api", - "name": "ModelStopAnimation", - "method": "", - "description": "停止播放指定的模型动画。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "", + "return": [], + "description": "停止播放指定的模型动画。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.ModelStopAnimation(objId, \"fengxi\")", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "animationName", - "type": "str", + "type": "str", + "name": "animationName", "description": "模型的动画" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.ModelStopAnimation(objId, \"fengxi\")" - }, + ], + "type": "api", + "side": "client", + "name": "ModelStopAnimation" + }, { - "type": "api", - "name": "ModelUpdateAnimationMolangVariable", - "method": "", - "description": "更新微软原版模型表达式变量,可控制动作的改变", - "remark": "- 如果创建模型后同一帧内马上调用该接口,则客户端实体配置中的scripts/initialize字段不再会执行。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "remark": "- 如果创建模型后同一帧内马上调用该接口,则客户端实体配置中的scripts/initialize字段不再会执行。", + "return": [], + "description": "更新微软原版模型表达式变量,可控制动作的改变", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/模型.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nid = virtualWorldComp.ModelCreateMinecraftObject(\"minecraft:cat\")\r\nvirtualWorldComp.ModelUpdateAnimationMolangVariable(id, {\"variable.state\": 2, \"variable.liedownamount\": 0})", "params": [ { - "name": "objId", - "type": "int", + "type": "int", + "name": "objId", "description": "模型对象的id" - }, + }, { - "name": "molangDict", - "type": "dict", + "type": "dict", + "name": "molangDict", "description": "键值对形式的数据" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nid = virtualWorldComp.ModelCreateMinecraftObject(\"minecraft:cat\")\r\nvirtualWorldComp.ModelUpdateAnimationMolangVariable(id, {\"variable.state\": 2, \"variable.liedownamount\": 0})" - }, + ], + "type": "api", + "side": "client", + "name": "ModelUpdateAnimationMolangVariable" + }, { - "type": "api", - "name": "CameraGetClickModel", - "method": "", - "description": "获取相机当前指向的模型的id,会返回离相机最近的,通常与GetEntityByCoordEvent配合使用", - "remark": "- 模型需要设置包围盒才能响应点击", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", - "params": [], - "return": [], - "example": "# 当玩家点击屏幕时获取点击位置的模型的id\r\nimport mod.client.extraClientApi as clientApi\r\nclass MyClientSystem(ClientSystem):\r\n def __init__(self, namespace, name):\r\n ClientSystem.__init__(self, namespace, name)\r\n self.ListenForEvent('Minecraft', 'Engine', 'GetEntityByCoordEvent', self, self.click)\r\n self.initModel()\r\n\r\n def initModel(self):\r\n virtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n id = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\n # 设置了包围盒才能响应点击\r\n virtualWorldComp.ModelSetBoxCollider(id, (2.0, 2.0, 2.0), (0.0, 0.0, 0.0))\r\n\r\n def click(self, args):\r\n import client.extraClientApi as clientApi\r\n virtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n id = virtualWorldComp.CameraGetClickModel()\r\n if id > 0:\r\n print(\"select:\", id)" - }, + "remark": "- 模型需要设置包围盒才能响应点击", + "return": [], + "description": "获取相机当前指向的模型的id,会返回离相机最近的,通常与GetEntityByCoordEvent配合使用", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "example": "# 当玩家点击屏幕时获取点击位置的模型的id\r\nimport mod.client.extraClientApi as clientApi\r\nclass MyClientSystem(ClientSystem):\r\n def __init__(self, namespace, name):\r\n ClientSystem.__init__(self, namespace, name)\r\n self.ListenForEvent('Minecraft', 'Engine', 'GetEntityByCoordEvent', self, self.click)\r\n self.initModel()\r\n\r\n def initModel(self):\r\n virtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n id = virtualWorldComp.ModelCreateObject(\"datiangou\", \"run\")\r\n # 设置了包围盒才能响应点击\r\n virtualWorldComp.ModelSetBoxCollider(id, (2.0, 2.0, 2.0), (0.0, 0.0, 0.0))\r\n\r\n def click(self, args):\r\n import client.extraClientApi as clientApi\r\n virtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\n id = virtualWorldComp.CameraGetClickModel()\r\n if id > 0:\r\n print(\"select:\", id)", + "params": [], + "type": "api", + "side": "client", + "name": "CameraGetClickModel" + }, { - "type": "api", - "name": "CameraGetFov", - "method": "", - "description": "获取相机视野大小", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", - "params": [], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nfov = virtualWorldComp.CameraGetFov()" - }, + "remark": "", + "return": [], + "description": "获取相机视野大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nfov = virtualWorldComp.CameraGetFov()", + "params": [], + "type": "api", + "side": "client", + "name": "CameraGetFov" + }, { - "type": "api", - "name": "CameraGetPos", - "method": "", - "description": "返回相机位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", - "params": [], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\ncameraPos = virtualWorldComp.CameraGetPos()" - }, + "remark": "", + "return": [], + "description": "返回相机位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\ncameraPos = virtualWorldComp.CameraGetPos()", + "params": [], + "type": "api", + "side": "client", + "name": "CameraGetPos" + }, { - "type": "api", - "name": "CameraGetZoom", - "method": "", - "description": "获取相机的缩放值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", - "params": [], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nzoom = virtualWorldComp.CameraGetZoom()" - }, + "remark": "", + "return": [], + "description": "获取相机的缩放值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nzoom = virtualWorldComp.CameraGetZoom()", + "params": [], + "type": "api", + "side": "client", + "name": "CameraGetZoom" + }, { - "type": "api", - "name": "CameraLookAt", - "method": "", - "description": "修改相机朝向", - "remark": "- 相机初始默认朝向为-z轴", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "remark": "- 相机初始默认朝向为-z轴", + "return": [], + "description": "修改相机朝向", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.CameraLookAt((0.0, 0.0, -10.0), (0.0, 1.0, 0.0))", "params": [ { - "name": "targetPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "targetPos", "description": "目标的坐标" - }, + }, { - "name": "upVector", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "upVector", "description": "相机向上方向的向量, (x,y,z)初始默认为(0,1,0)" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.CameraLookAt((0.0, 0.0, -10.0), (0.0, 1.0, 0.0))" - }, + ], + "type": "api", + "side": "client", + "name": "CameraLookAt" + }, { - "type": "api", - "name": "CameraMoveTo", - "method": "", - "description": "设置相机移动动画, 会根据当前相机状态与传入参数按时间进行插值显示", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "remark": "", + "return": [], + "description": "设置相机移动动画, 会根据当前相机状态与传入参数按时间进行插值显示", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.CameraMoveTo((0.0, 0.0, -10.0), (1.0, 1.0, -10.0), (0.0,1.0, 0.0), 1.0, 3.0, clientApi.GetMinecraftEnum().TimeEaseType.linear)", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "目标点的坐标" - }, + }, { - "name": "targetPos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "targetPos", "description": "到达目标点后朝向的位置" - }, + }, { - "name": "upVector", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "upVector", "description": "到达目标点后相机向上方向的向量" - }, + }, { - "name": "zoom", - "type": "float", + "type": "float", + "name": "zoom", "description": "到达目标点相机的缩放值" - }, + }, { - "name": "time", - "type": "float", + "type": "float", + "name": "time", "description": "单位秒,动作时长(大于0的浮点数)。为了镜头连贯性,相机的运动与实际帧率有关,默认以60帧计算,会因实际帧率波动稍有偏差。" - }, + }, { - "name": "ease", - "type": "TimeEaseType", + "type": "TimeEaseType", + "name": "ease", "description": "时间变化函数, 默认值为clientApi.GetMinecraftEnum().TimeEaseType.linear, 参数不在枚举值中也当作linear" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.CameraMoveTo((0.0, 0.0, -10.0), (1.0, 1.0, -10.0), (0.0,1.0, 0.0), 1.0, 3.0, clientApi.GetMinecraftEnum().TimeEaseType.linear)" - }, + ], + "type": "api", + "side": "client", + "name": "CameraMoveTo" + }, { - "type": "api", - "name": "CameraSetFov", - "method": "", - "description": "设置相机视野大小", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "remark": "", + "return": [], + "description": "设置相机视野大小", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.CameraSetFov(60)", "params": [ { - "name": "fov", - "type": "float", + "type": "float", + "name": "fov", "description": "视野大小( field of view ),单位为角度, 范围为[30, 110],若fov小于30则设置为30,若fov大于110,则设置为110。不修改时默认为45。" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.CameraSetFov(60)" - }, + ], + "type": "api", + "side": "client", + "name": "CameraSetFov" + }, { - "type": "api", - "name": "CameraSetPos", - "method": "", - "description": "设置相机位置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "remark": "", + "return": [], + "description": "设置相机位置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.CameraSetPos((0.0, 6.0, 0.0))", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "坐标值(x,y,z)初始默认为 (0,0,0),且朝向z轴负方向" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.CameraSetPos((0.0, 6.0, 0.0))" - }, + ], + "type": "api", + "side": "client", + "name": "CameraSetPos" + }, { - "type": "api", - "name": "CameraSetZoom", - "method": "", - "description": "设置相机缩放", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "remark": "", + "return": [], + "description": "设置相机缩放", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.CameraSetZoom(2.0)", "params": [ { - "name": "zoom", - "type": "float", + "type": "float", + "name": "zoom", "description": "缩放值, 范围为[0.1,100.0],小于0.1则设置为0.1,大于100则设置为100,不修改时默认为1。" } - ], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.CameraSetZoom(2.0)" - }, + ], + "type": "api", + "side": "client", + "name": "CameraSetZoom" + }, { - "type": "api", - "name": "CameraStopActions", - "method": "", - "description": "停止相机移动动画", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", - "params": [], - "return": [], - "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.CameraMoveTo((0.0, 0.0, -10.0), (1.0, 1.0, -10.0), (0.0,1.0, 0.0), 1.0, 3.0, clientApi.GetMinecraftEnum().TimeEaseType.linear)\r\nvirtualWorldComp.CameraStopActions()" - }, + "remark": "", + "return": [], + "description": "停止相机移动动画", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/虚拟世界/相机.md", + "example": "import client.extraClientApi as clientApi\r\nvirtualWorldComp = clientApi.GetEngineCompFactory().CreateVirtualWorld(clientApi.GetLevelId())\r\nvirtualWorldComp.CameraMoveTo((0.0, 0.0, -10.0), (1.0, 1.0, -10.0), (0.0,1.0, 0.0), 1.0, 3.0, clientApi.GetMinecraftEnum().TimeEaseType.linear)\r\nvirtualWorldComp.CameraStopActions()", + "params": [], + "type": "api", + "side": "client", + "name": "CameraStopActions" + }, { - "type": "api", - "name": "CreateComponent", - "method": "", - "description": "给实体创建客户端组件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/Component.md", + "remark": "", + "return": [], + "description": "给实体创建客户端组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/Component.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.CreateComponent(clientApi.GetLocalPlayerId(), \"Minecraft\", \"item\")\r\n# 拿到comp后就可以做一些逻辑内容,与GetComponent类似,如果已经创建会自动直接Get", "params": [ { - "name": "entityId", - "type": "str或int", + "type": "str或int", + "name": "entityId", "description": "该组件属主的实体id" - }, + }, { - "name": "nameSpace", - "type": "str", + "type": "str", + "name": "nameSpace", "description": "组件的命名空间,registerComponent的namespace" - }, + }, { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "组件的名字" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.CreateComponent(clientApi.GetLocalPlayerId(), \"Minecraft\", \"item\")\r\n# 拿到comp后就可以做一些逻辑内容,与GetComponent类似,如果已经创建会自动直接Get" - }, + ], + "type": "api", + "side": "client", + "name": "CreateComponent" + }, { - "type": "api", - "name": "DestroyComponent", - "method": "", - "description": "删除实体的客户端组件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/Component.md", + "remark": "", + "return": [], + "description": "删除实体的客户端组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/Component.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.DestroyComponent(clientApi.GetLocalPlayerId(), \"Minecraft\", \"item\")", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "该组件属主的实体id" - }, + }, { - "name": "nameSpace", - "type": "str", + "type": "str", + "name": "nameSpace", "description": "组件的命名空间,registerComponent的namespace" - }, + }, { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "组件的名字" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.DestroyComponent(clientApi.GetLocalPlayerId(), \"Minecraft\", \"item\")" - }, + ], + "type": "api", + "side": "client", + "name": "DestroyComponent" + }, { - "type": "api", - "name": "GetComponent", - "method": "", - "description": "获取实体的客户端组件。一般用来判断某个组件是否创建过,其他情况请使用CreateComponent", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/Component.md", + "remark": "", + "return": [], + "description": "获取实体的客户端组件。一般用来判断某个组件是否创建过,其他情况请使用CreateComponent", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/Component.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetComponent(clientApi.GetLocalPlayerId(), \"Minecraft\", \"item\")\r\n# 拿到comp后就可以做一些逻辑内容,如果没有创建过会返回None", "params": [ { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "该组件属主的实体id" - }, + }, { - "name": "nameSpace", - "type": "str", + "type": "str", + "name": "nameSpace", "description": "组件的命名空间,registerComponent的namespace" - }, + }, { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "组件的名字" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetComponent(clientApi.GetLocalPlayerId(), \"Minecraft\", \"item\")\r\n# 拿到comp后就可以做一些逻辑内容,如果没有创建过会返回None" - }, + ], + "type": "api", + "side": "client", + "name": "GetComponent" + }, { - "type": "api", - "name": "GetComponentCls", - "method": "", - "description": "用于获取客户端component基类。实现新的component时,需要继承该接口返回的类", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/Component.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nClientComponentCls = clientApi.GetComponentCls()\r\n# Component要继承于基类才能生效\r\nclass ShootComponentClient(ClientComponentCls):\r\n def __init__(self, entityId):\r\n ClientComponentCls.__init__(self, entityId)\r\n # 这里设置了一个开关来开关更新射击\r\n self.mShoot = False" - }, + "remark": "", + "return": [], + "description": "用于获取客户端component基类。实现新的component时,需要继承该接口返回的类", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/Component.md", + "example": "import mod.client.extraClientApi as clientApi\r\nClientComponentCls = clientApi.GetComponentCls()\r\n# Component要继承于基类才能生效\r\nclass ShootComponentClient(ClientComponentCls):\r\n def __init__(self, entityId):\r\n ClientComponentCls.__init__(self, entityId)\r\n # 这里设置了一个开关来开关更新射击\r\n self.mShoot = False", + "params": [], + "type": "api", + "side": "client", + "name": "GetComponentCls" + }, { - "type": "api", - "name": "GetEngineCompFactory", - "method": "", - "description": "获取引擎组件的工厂,通过工厂可以创建客户端的引擎组件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/Component.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncompFactory = clientApi.GetEngineCompFactory()\r\ngameComp = compFactory.CreateGame(clientApi.GetLevelId())" - }, + "remark": "", + "return": [], + "description": "获取引擎组件的工厂,通过工厂可以创建客户端的引擎组件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/Component.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncompFactory = clientApi.GetEngineCompFactory()\r\ngameComp = compFactory.CreateGame(clientApi.GetLevelId())", + "params": [], + "type": "api", + "side": "client", + "name": "GetEngineCompFactory" + }, { - "type": "api", - "name": "RegisterComponent", - "method": "", - "description": "用于将组件注册到引擎中", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/Component.md", + "remark": "", + "return": [], + "description": "用于将组件注册到引擎中", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/Component.md", + "example": "import mod.client.extraClientApi as clientApi\r\n@Mod.InitClient()\r\ndef TutorialClientInit(self):\r\n # 注册一个自定义的客户端Component\r\n clientApi.RegisterComponent(\"TutorialMod\", \"ClientShoot\", \"tutorialScripts.modClient.clientComponent.shootComponentClient.ShootComponentClient\")", "params": [ { - "name": "nameSpace", - "type": "str", + "type": "str", + "name": "nameSpace", "description": "命名空间,建议为mod名字" - }, + }, { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "组件名称" - }, + }, { - "name": "clsPath", - "type": "str", + "type": "str", + "name": "clsPath", "description": "组件类路径,路径从脚本的第一层开始算起" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n@Mod.InitClient()\r\ndef TutorialClientInit(self):\r\n # 注册一个自定义的客户端Component\r\n clientApi.RegisterComponent(\"TutorialMod\", \"ClientShoot\", \"tutorialScripts.modClient.clientComponent.shootComponentClient.ShootComponentClient\")" - }, + ], + "type": "api", + "side": "client", + "name": "RegisterComponent" + }, { - "type": "api", - "name": "GetClientSystemCls", - "method": "", - "description": "用于获取客户端system基类。实现新的system时,需要继承该接口返回的类", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/System.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nClientSystem = clientApi.GetClientSystemCls()\r\nclass FpsClientSystem(ClientSystem):\r\n def __init__(self, namespace, systemName):\r\n ClientSystem.__init__(self, namespace, systemName)" - }, + "remark": "", + "return": [], + "description": "用于获取客户端system基类。实现新的system时,需要继承该接口返回的类", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/System.md", + "example": "import mod.client.extraClientApi as clientApi\r\nClientSystem = clientApi.GetClientSystemCls()\r\nclass FpsClientSystem(ClientSystem):\r\n def __init__(self, namespace, systemName):\r\n ClientSystem.__init__(self, namespace, systemName)", + "params": [], + "type": "api", + "side": "client", + "name": "GetClientSystemCls" + }, { - "type": "api", - "name": "GetServerSystemCls", - "method": "", - "description": "用于获取服务器system基类。实现新的system时,需要继承该接口返回的类", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/System.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nServerSystem = serverApi.GetServerSystemCls()\r\nclass FpsServerSystem(ServerSystem):\r\n def __init__(self, namespace, systemName):\r\n ServerSystem.__init__(self, namespace, systemName)" - }, + "remark": "", + "return": [], + "description": "用于获取服务器system基类。实现新的system时,需要继承该接口返回的类", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/System.md", + "example": "import mod.server.extraServerApi as serverApi\r\nServerSystem = serverApi.GetServerSystemCls()\r\nclass FpsServerSystem(ServerSystem):\r\n def __init__(self, namespace, systemName):\r\n ServerSystem.__init__(self, namespace, systemName)", + "params": [], + "type": "api", + "side": "server", + "name": "GetServerSystemCls" + }, { - "type": "api", - "name": "GetSystem", - "method": "", - "description": "用于获取其他系统实例", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/System.md", + "remark": "", + "return": [], + "description": "用于获取其他系统实例", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/System.md", + "example": "import mod.client.extraClientApi as clientApi\r\nClientSystem = clientApi.GetClientSystemCls()\r\nclass FpsClientSystem(ClientSystem):\r\n def __init__(self, namespace, systemName):\r\n ClientSystem.__init__(self, namespace, systemName)\r\n self.tutorialSystem = clientApi.GetSystem(\"TutorialMod\", \"TutorialClientSystem\")", "params": [ { - "name": "nameSpace", - "type": "str", + "type": "str", + "name": "nameSpace", "description": "系统注册的命名空间,一般为mod名字" - }, + }, { - "name": "systemName", - "type": "str", + "type": "str", + "name": "systemName", "description": "要获取的系统名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nClientSystem = clientApi.GetClientSystemCls()\r\nclass FpsClientSystem(ClientSystem):\r\n def __init__(self, namespace, systemName):\r\n ClientSystem.__init__(self, namespace, systemName)\r\n self.tutorialSystem = clientApi.GetSystem(\"TutorialMod\", \"TutorialClientSystem\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetSystem" + }, { - "type": "api", - "name": "RegisterSystem", - "method": "", - "description": "用于将系统注册到引擎中,引擎会创建一个该系统的实例,并在退出游戏时回收。系统可以执行我们引擎赋予的基本逻辑,例如监听事件、执行Tick函数、与服务端进行通讯等。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/System.md", + "remark": "", + "return": [], + "description": "用于将系统注册到引擎中,引擎会创建一个该系统的实例,并在退出游戏时回收。系统可以执行我们引擎赋予的基本逻辑,例如监听事件、执行Tick函数、与服务端进行通讯等。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/System.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# 系统system的注册是在modMain.py的MOD类中\r\n# 客户端系统system的注册方式\r\n@Mod.InitClient()\r\ndef TutorialClientInit(self):\r\n clientApi.RegisterSystem(\"TutorialMod\", \"TutorialClientSystem\", \"tutorialScripts.tutorialClientSystem.TutorialClientSystem\")", "params": [ { - "name": "nameSpace", - "type": "str", + "type": "str", + "name": "nameSpace", "description": "命名空间,建议为mod名字" - }, + }, { - "name": "systemName", - "type": "str", + "type": "str", + "name": "systemName", "description": "系统名称,自定义名称,可以使用英文、拼音和下划线,建议尽量个性化" - }, + }, { - "name": "clsPath", - "type": "str", + "type": "str", + "name": "clsPath", "description": "组件类路径,路径从脚本的第一层开始算起" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# 系统system的注册是在modMain.py的MOD类中\r\n# 客户端系统system的注册方式\r\n@Mod.InitClient()\r\ndef TutorialClientInit(self):\r\n clientApi.RegisterSystem(\"TutorialMod\", \"TutorialClientSystem\", \"tutorialScripts.tutorialClientSystem.TutorialClientSystem\")" - }, + ], + "type": "api", + "side": "client", + "name": "RegisterSystem" + }, { - "type": "event", - "name": "BroadcastEvent", - "method": "", - "description": "本地广播事件,客户端system广播的事件仅客户端system能监听,服务器system广播的事件仅服务端system能监听。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "remark": "", + "return": [], + "description": "本地广播事件,客户端system广播的事件仅客户端system能监听,服务器system广播的事件仅服务端system能监听。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "example": "", "params": [ { - "name": "eventName", - "type": "str", + "type": "str", + "name": "eventName", "description": "事件名" - }, + }, { - "name": "eventData", - "type": "dict", + "type": "dict", + "name": "eventData", "description": "事件参数,一般用CreateEventData的返回值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "BroadcastEvent" + }, { - "type": "event", - "name": "BroadcastToAllClient", - "method": "", - "description": "服务器广播事件到所有客户端", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "remark": "", + "return": [], + "description": "服务器广播事件到所有客户端", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "example": "", "params": [ { - "name": "eventName", - "type": "str", + "type": "str", + "name": "eventName", "description": "事件名" - }, + }, { - "name": "eventData", - "type": "dict", + "type": "dict", + "name": "eventData", "description": "事件参数,一般用CreateEventData的返回值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "BroadcastToAllClient" + }, { - "type": "event", - "name": "CreateEventData", - "method": "", - "description": "创建自定义事件的数据,eventData用于发送事件。创建的eventData可以理解为一个dict,可以嵌套赋值dict,list和基本数据类型,但不支持tuple", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "创建自定义事件的数据,eventData用于发送事件。创建的eventData可以理解为一个dict,可以嵌套赋值dict,list和基本数据类型,但不支持tuple", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "CreateEventData" + }, { - "type": "event", - "name": "GetEngineNamespace", - "method": "", - "description": "获取引擎事件的命名空间。监听引擎事件时,namespace传该接口返回的namespace", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取引擎事件的命名空间。监听引擎事件时,namespace传该接口返回的namespace", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetEngineNamespace" + }, { - "type": "event", - "name": "GetEngineSystemName", - "method": "", - "description": "获取引擎系统名。监听引擎事件时,systemName传该接口返回的systemName", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "获取引擎系统名。监听引擎事件时,systemName传该接口返回的systemName", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "GetEngineSystemName" + }, { - "type": "event", - "name": "ListenForEvent", - "method": "", - "description": "注册监听某个系统抛出的事件。若监听引擎事件时,namespace和systemName分别为GetEngineNamespace()和GetEngineSystemName()。具体每个事件的详细事件data可以参考\"事件\"分类下的内容", - "remark": "- 服务端system监听的客户端系统事件的回调参数中会自带一个叫\"\\_\\_id\\_\\_\"的key,值为对应客户端的玩家id", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "remark": "- 服务端system监听的客户端系统事件的回调参数中会自带一个叫\"\\_\\_id\\_\\_\"的key,值为对应客户端的玩家id", + "return": [], + "description": "注册监听某个系统抛出的事件。若监听引擎事件时,namespace和systemName分别为GetEngineNamespace()和GetEngineSystemName()。具体每个事件的详细事件data可以参考\"事件\"分类下的内容", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "example": "", "params": [ { - "name": "namespace", - "type": "str", + "type": "str", + "name": "namespace", "description": "所监听事件的来源系统的namespace" - }, + }, { - "name": "systemName", - "type": "str", + "type": "str", + "name": "systemName", "description": "所监听事件的来源系统的systemName" - }, + }, { - "name": "eventName", - "type": "str", + "type": "str", + "name": "eventName", "description": "事件名" - }, + }, { - "name": "instance", - "type": "any", + "type": "any", + "name": "instance", "description": "回调函数所属的类的实例" - }, + }, { - "name": "func", - "type": "function", + "type": "function", + "name": "func", "description": "回调函数" - }, + }, { - "name": "priority", - "type": "int", + "type": "int", + "name": "priority", "description": "这个回调函数的优先级。默认值为0,这个数值越大表示被执行的优先级越高,最高为10。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "ListenForEvent" + }, { - "type": "event", - "name": "NotifyToClient", - "method": "", - "description": "服务器发送事件到指定客户端", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "remark": "", + "return": [], + "description": "服务器发送事件到指定客户端", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "example": "", "params": [ { - "name": "targetId", - "type": "str", + "type": "str", + "name": "targetId", "description": "客户端对应的Id,一般就是玩家Id" - }, + }, { - "name": "eventName", - "type": "str", + "type": "str", + "name": "eventName", "description": "事件名" - }, + }, { - "name": "eventData", - "type": "dict", + "type": "dict", + "name": "eventData", "description": "事件参数,一般用CreateEventData的返回值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "NotifyToClient" + }, { - "type": "event", - "name": "NotifyToMultiClients", - "method": "", - "description": "服务器发送事件到指定一批客户端,相比于在for循环内使用NotifyToClient性能更好", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "remark": "", + "return": [], + "description": "服务器发送事件到指定一批客户端,相比于在for循环内使用NotifyToClient性能更好", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "example": "", "params": [ { - "name": "targetIdList", - "type": "list(str)", + "type": "list(str)", + "name": "targetIdList", "description": "客户端对应的playerId列表,playerId为玩家的entityId" - }, + }, { - "name": "eventName", - "type": "str", + "type": "str", + "name": "eventName", "description": "事件名" - }, + }, { - "name": "eventData", - "type": "dict", + "type": "dict", + "name": "eventData", "description": "事件参数,一般用CreateEventData的返回值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "NotifyToMultiClients" + }, { - "type": "event", - "name": "NotifyToServer", - "method": "", - "description": "客户端发送事件到服务器", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "remark": "", + "return": [], + "description": "客户端发送事件到服务器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "example": "", "params": [ { - "name": "eventName", - "type": "str", + "type": "str", + "name": "eventName", "description": "事件名" - }, + }, { - "name": "eventData", - "type": "dict", + "type": "dict", + "name": "eventData", "description": "事件参数,一般用CreateEventData的返回值" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "NotifyToServer" + }, { - "type": "event", - "name": "UnListenAllEvents", - "method": "", - "description": "反注册监听某个系统抛出的所有事件,即不再监听。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "反注册监听某个系统抛出的所有事件,即不再监听。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "example": "", + "params": [], + "type": "event", + "side": "client", + "name": "UnListenAllEvents" + }, { - "type": "event", - "name": "UnListenForEvent", - "method": "", - "description": "反注册监听某个系统抛出的事件,即不再监听。若是引擎事件,则namespace和systemName分别为[GetEngineNamespace](#getenginenamespace)和[GetEngineSystemName](#getenginesystemname)。与ListenForEvent对应。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "remark": "", + "return": [], + "description": "反注册监听某个系统抛出的事件,即不再监听。若是引擎事件,则namespace和systemName分别为[GetEngineNamespace](#getenginenamespace)和[GetEngineSystemName](#getenginesystemname)。与ListenForEvent对应。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/事件.md", + "example": "", "params": [ { - "name": "namespace", - "type": "str", + "type": "str", + "name": "namespace", "description": "所监听事件的来源系统的namespace" - }, + }, { - "name": "systemName", - "type": "str", + "type": "str", + "name": "systemName", "description": "所监听事件的来源系统的systemName" - }, + }, { - "name": "eventName", - "type": "str", + "type": "str", + "name": "eventName", "description": "事件名" - }, + }, { - "name": "instance", - "type": "any", + "type": "any", + "name": "instance", "description": "回调函数所属的类的实例" - }, + }, { - "name": "func", - "type": "function", + "type": "function", + "name": "func", "description": "回调函数" - }, + }, { - "name": "priority", - "type": "int", + "type": "int", + "name": "priority", "description": "这个回调函数的优先级。默认值为0,这个数值越大表示被执行的优先级越高。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "UnListenForEvent" + }, { - "type": "api", - "name": "AddRepeatedTimer", - "method": "", - "description": "添加客户端触发的定时器,重复执行", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "remark": "", + "return": [], + "description": "添加客户端触发的定时器,重复执行", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.AddRepeatedTimer(3.0,func,args,kwargs)", "params": [ { - "name": "delay", - "type": "float", + "type": "float", + "name": "delay", "description": "延迟时间,单位秒" - }, + }, { - "name": "func", - "type": "function", + "type": "function", + "name": "func", "description": "定时器触发函数" - }, + }, { - "name": "*args", - "type": "any", + "type": "any", + "name": "*args", "description": "变长参数,可以不设置" - }, + }, { - "name": "**kwargs", - "type": "any", + "type": "any", + "name": "**kwargs", "description": "字典变长参数,可以不设置" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.AddRepeatedTimer(3.0,func,args,kwargs)" - }, + ], + "type": "api", + "side": "client", + "name": "AddRepeatedTimer" + }, { - "type": "api", - "name": "AddTimer", - "method": "", - "description": "添加客户端触发的定时器,非重复", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "remark": "", + "return": [], + "description": "添加客户端触发的定时器,非重复", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.AddTimer(3.0,func,args,kwargs)", "params": [ { - "name": "delay", - "type": "float", + "type": "float", + "name": "delay", "description": "延迟时间,单位秒" - }, + }, { - "name": "func", - "type": "function", + "type": "function", + "name": "func", "description": "定时器触发函数" - }, + }, { - "name": "*args", - "type": "any", + "type": "any", + "name": "*args", "description": "变长参数,可以不设置" - }, + }, { - "name": "**kwargs", - "type": "any", + "type": "any", + "name": "**kwargs", "description": "字典变长参数,可以不设置" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.AddTimer(3.0,func,args,kwargs)" - }, + ], + "type": "api", + "side": "client", + "name": "AddTimer" + }, { - "type": "api", - "name": "CancelTimer", - "method": "", - "description": "取消定时器", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "remark": "", + "return": [], + "description": "取消定时器", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.CancelTimer(timer)", "params": [ { - "name": "timer", - "type": "CallLater", + "type": "CallLater", + "name": "timer", "description": "AddTimer和AddRepeatedTimer时返回的定时器实例" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\ncomp.CancelTimer(timer)" - }, + ], + "type": "api", + "side": "client", + "name": "CancelTimer" + }, { - "type": "api", - "name": "CheckNameValid", - "method": "", - "description": "检查昵称是否合法,即不包含敏感词", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "remark": "", + "return": [], + "description": "检查昵称是否合法,即不包含敏感词", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nisValid = comp.CheckNameValid(\"史蒂夫\")", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "昵称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nisValid = comp.CheckNameValid(\"史蒂夫\")" - }, + ], + "type": "api", + "side": "client", + "name": "CheckNameValid" + }, { - "type": "api", - "name": "CheckWordsValid", - "method": "", - "description": "检查语句是否合法,即不包含敏感词", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "remark": "", + "return": [], + "description": "检查语句是否合法,即不包含敏感词", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nisValid = comp.CheckWordsValid(\"creeper? Aww man\")", "params": [ { - "name": "words", - "type": "str", + "type": "str", + "name": "words", "description": "语句" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nisValid = comp.CheckWordsValid(\"creeper? Aww man\")" - }, + ], + "type": "api", + "side": "client", + "name": "CheckWordsValid" + }, { - "type": "api", - "name": "GetChinese", - "method": "", - "description": "获取langStr对应的中文,可参考PC开发包中\\handheld\\localization\\handheld\\data\\resource_packs\\vanilla\\texts\\zh_CN.lang", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "remark": "", + "return": [], + "description": "获取langStr对应的中文,可参考PC开发包中\\handheld\\localization\\handheld\\data\\resource_packs\\vanilla\\texts\\zh_CN.lang", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\n# 获取\"entity.wolf.name\"对应的中文(\"狼\")\r\nChinese = comp.GetChinese(\"entity.wolf.name\")", "params": [ { - "name": "langStr", - "type": "str", + "type": "str", + "name": "langStr", "description": "传入的langStr" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\n# 获取\"entity.wolf.name\"对应的中文(\"狼\")\r\nChinese = comp.GetChinese(\"entity.wolf.name\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetChinese" + }, { - "type": "api", - "name": "GetClipboardContent", - "method": "", - "description": "获取系统剪贴板内容", - "remark": "- 如果剪贴板里的内容并非文本内容,或者剪贴板里没有内容,则返回空字符串。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\n# 从其他地方复制一段文本后\r\n# 获取剪贴板内容\r\ncontent = comp.GetClipboardContent()" - }, + "remark": "- 如果剪贴板里的内容并非文本内容,或者剪贴板里没有内容,则返回空字符串。", + "return": [], + "description": "获取系统剪贴板内容", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\n# 从其他地方复制一段文本后\r\n# 获取剪贴板内容\r\ncontent = comp.GetClipboardContent()", + "params": [], + "type": "api", + "side": "client", + "name": "GetClipboardContent" + }, { - "type": "api", - "name": "GetFps", - "method": "", - "description": "获取fps", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nfps = comp.GetFps()" - }, + "remark": "", + "return": [], + "description": "获取fps", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\nfps = comp.GetFps()", + "params": [], + "type": "api", + "side": "client", + "name": "GetFps" + }, { - "type": "api", - "name": "GetMinecraftEnum", - "method": "", - "description": "用于获取[枚举值文档](../../枚举值/索引.md)中的枚举值", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\n# 使用枚举值与事件参数比较\r\nclass BattleUI(ScreenNode):\r\n def OnButtonTouch(self, args):\r\n touchEventEnum = clientApi.GetMinecraftEnum().TouchEvent\r\n if touchEvent == touchEventEnum.TouchUp:\r\n pass\r\n\r\n def Create(self):\r\n self.AddTouchEventHandler(\"/panel/test_btn\", self.OnButtonTouch, {\"isSwallow\":True})" - }, + "remark": "", + "return": [], + "description": "用于获取[枚举值文档](../../枚举值/索引.md)中的枚举值", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\n# 使用枚举值与事件参数比较\r\nclass BattleUI(ScreenNode):\r\n def OnButtonTouch(self, args):\r\n touchEventEnum = clientApi.GetMinecraftEnum().TouchEvent\r\n if touchEvent == touchEventEnum.TouchUp:\r\n pass\r\n\r\n def Create(self):\r\n self.AddTouchEventHandler(\"/panel/test_btn\", self.OnButtonTouch, {\"isSwallow\":True})", + "params": [], + "type": "api", + "side": "client", + "name": "GetMinecraftEnum" + }, { - "type": "api", - "name": "GetModConfigJson", - "method": "", - "description": "以字典形式返回指定路径的json格式配置文件的内容,文件必须放置在资源包的/modconfigs目录下", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "remark": "", + "return": [], + "description": "以字典形式返回指定路径的json格式配置文件的内容,文件必须放置在资源包的/modconfigs目录下", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\ndata = clientApi.GetModConfigJson(\"modconfigs/monster.json\")", "params": [ { - "name": "path", - "type": "str", + "type": "str", + "name": "path", "description": "指定路径的json文件" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ndata = clientApi.GetModConfigJson(\"modconfigs/monster.json\")" - }, + ], + "type": "api", + "side": "client", + "name": "GetModConfigJson" + }, { - "type": "api", - "name": "GetServerTickTime", - "method": "", - "description": "获取服务端引擎上一帧的帧消耗时间", - "remark": "- 服务端引擎的帧率为20帧,而服务端脚本的帧率为30帧,因此当脚本每帧获取引擎帧消耗时间时,有可能连续获取到的是同一个引擎帧的时间", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nprint serverApi.GetServerTickTime()" - }, + "remark": "- 服务端引擎的帧率为20帧,而服务端脚本的帧率为30帧,因此当脚本每帧获取引擎帧消耗时间时,有可能连续获取到的是同一个引擎帧的时间", + "return": [], + "description": "获取服务端引擎上一帧的帧消耗时间", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.server.extraServerApi as serverApi\r\nprint serverApi.GetServerTickTime()", + "params": [], + "type": "api", + "side": "server", + "name": "GetServerTickTime" + }, { - "type": "api", - "name": "ImportModule", - "method": "", - "description": "使用字符串路径导入模块,作用与importlib.import_module类似,但只能导入当前加载的mod中的模块", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "remark": "", + "return": [], + "description": "使用字符串路径导入模块,作用与importlib.import_module类似,但只能导入当前加载的mod中的模块", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.ImportModule(\"tutorialScripts.tutorialClientSystem\")", "params": [ { - "name": "path", - "type": "str", + "type": "str", + "name": "path", "description": "模块的绝对路径" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.ImportModule(\"tutorialScripts.tutorialClientSystem\")" - }, + ], + "type": "api", + "side": "client", + "name": "ImportModule" + }, { - "type": "api", - "name": "SetClipboardContent", - "method": "", - "description": "设置系统剪贴板内容", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "remark": "", + "return": [], + "description": "设置系统剪贴板内容", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\n# 设置剪贴板内容为\"Hello, minecraft\"\r\ncomp.SetClipboardContent(\"Hello, minecraft\")\r\n# 可以粘贴到其他地方", "params": [ { - "name": "content", - "type": "str", + "type": "str", + "name": "content", "description": "需要设置的剪贴板内容" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(levelId)\r\n# 设置剪贴板内容为\"Hello, minecraft\"\r\ncomp.SetClipboardContent(\"Hello, minecraft\")\r\n# 可以粘贴到其他地方" - }, + ], + "type": "api", + "side": "client", + "name": "SetClipboardContent" + }, { - "type": "api", - "name": "StartCoroutine", - "method": "", - "description": "开启客户端协程,实现函数分段式执行,可用于缓解复杂逻辑计算导致游戏卡顿问题", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "remark": "", + "return": [], + "description": "开启客户端协程,实现函数分段式执行,可用于缓解复杂逻辑计算导致游戏卡顿问题", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "#通过生成器执行协程\r\nimport client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(clientApi.GetLevelId())\r\n\r\ndef callback():\r\n print \"callback\"\r\n\r\ndef coroutineTest():\r\n for i in xrange(1000):\r\n print i\r\n yield\r\n\r\ngenerator = clientApi.StartCoroutine(coroutineTest, callback)\r\n#执行1秒后停止协程\r\ncomp.AddTimer(1.0, clientApi.StopCoroutine, generator)\r\n#执行5秒后传入StartCoroutine返回的生成器,则函数将从停止位置继续执行\r\ncomp.AddTimer(5.0, clientApi.StartCoroutine, generator, callback)\r\n\r\n#----------------------------------------------------------------\r\n\r\n#通过函数执行协程\r\nimport client.extraClientApi as clientApi\r\ndef callback():\r\n print \"callback\"\r\n\r\ndef coroutineTest():\r\n for i in xrange(1000):\r\n print i\r\n yield\r\n#传入函数,函数将从头开始执行\r\nclientApi.StartCoroutine(coroutineTest, callback)", "params": [ { - "name": "iterOrFunc", - "type": "generator或callable([],generator)", + "type": "generator或callable([],generator)", + "name": "iterOrFunc", "description": "传入带有yield的函数或传入生成器。如传入生成器则将从生成器中断位置开始执行,如传入函数将从头开始执行" - }, + }, { - "name": "callback", - "type": "function", + "type": "function", + "name": "callback", "description": "协程执行完后的回调函数,默认为None" } - ], - "return": [], - "example": "#通过生成器执行协程\r\nimport client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateGame(clientApi.GetLevelId())\r\n\r\ndef callback():\r\n print \"callback\"\r\n\r\ndef coroutineTest():\r\n for i in xrange(1000):\r\n print i\r\n yield\r\n\r\ngenerator = clientApi.StartCoroutine(coroutineTest, callback)\r\n#执行1秒后停止协程\r\ncomp.AddTimer(1.0, clientApi.StopCoroutine, generator)\r\n#执行5秒后传入StartCoroutine返回的生成器,则函数将从停止位置继续执行\r\ncomp.AddTimer(5.0, clientApi.StartCoroutine, generator, callback)\r\n\r\n#----------------------------------------------------------------\r\n\r\n#通过函数执行协程\r\nimport client.extraClientApi as clientApi\r\ndef callback():\r\n print \"callback\"\r\n\r\ndef coroutineTest():\r\n for i in xrange(1000):\r\n print i\r\n yield\r\n#传入函数,函数将从头开始执行\r\nclientApi.StartCoroutine(coroutineTest, callback)" - }, + ], + "type": "api", + "side": "client", + "name": "StartCoroutine" + }, { - "type": "api", - "name": "StopCoroutine", - "method": "", - "description": "停止客户端协程", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "remark": "", + "return": [], + "description": "停止客户端协程", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/工具.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StopCoroutine(generator)", "params": [ { - "name": "iter", - "type": "generator", + "type": "generator", + "name": "iter", "description": "需要停止的生成器对象,StartCoroutine的返回值" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StopCoroutine(generator)" - }, + ], + "type": "api", + "side": "client", + "name": "StopCoroutine" + }, { - "type": "api", - "name": "GetDirFromRot", - "method": "", - "description": "通过旋转角度获取朝向", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/数学.md", + "remark": "", + "return": [], + "description": "通过旋转角度获取朝向", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/数学.md", + "example": "import mod.client.extraClientApi as clientApi\r\ndirection = clientApi.GetDirFromRot((0, 0))", "params": [ { - "name": "rot", - "type": "tuple(float,float)", + "type": "tuple(float,float)", + "name": "rot", "description": "俯仰角度及绕竖直方向的角度,单位是角度" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ndirection = clientApi.GetDirFromRot((0, 0))" - }, + ], + "type": "api", + "side": "client", + "name": "GetDirFromRot" + }, { - "type": "api", - "name": "GetLocalPosFromWorld", - "method": "", - "description": "获取基于实体的世界坐标对应的局部坐标", - "remark": "- 可能存在精度差", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/数学.md", + "remark": "- 可能存在精度差", + "return": [], + "description": "获取基于实体的世界坐标对应的局部坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/数学.md", + "example": "import mod.client.extraClientApi as clientApi\r\nposition = clientApi.GetLocalPosFromWorld((90, 65, -95), entityId)", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "基于实体的世界坐标" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nposition = clientApi.GetLocalPosFromWorld((90, 65, -95), entityId)" - }, + ], + "type": "api", + "side": "client", + "name": "GetLocalPosFromWorld" + }, { - "type": "api", - "name": "GetRotFromDir", - "method": "", - "description": "通过朝向获取旋转角度", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/数学.md", + "remark": "", + "return": [], + "description": "通过朝向获取旋转角度", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/数学.md", + "example": "import mod.client.extraClientApi as clientApi\r\nrot = clientApi.GetRotFromDir((1, 0, 1))", "params": [ { - "name": "dir", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "dir", "description": "玩家朝向的单位向量" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nrot = clientApi.GetRotFromDir((1, 0, 1))" - }, + ], + "type": "api", + "side": "client", + "name": "GetRotFromDir" + }, { - "type": "api", - "name": "GetWorldPosFromLocal", - "method": "", - "description": "获取基于实体的局部坐标对应的世界坐标", - "remark": "- 可能存在精度差", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/数学.md", + "remark": "- 可能存在精度差", + "return": [], + "description": "获取基于实体的局部坐标对应的世界坐标", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/数学.md", + "example": "import mod.client.extraClientApi as clientApi\r\nposition = clientApi.GetWorldPosFromLocal((0, 0, 1), entityId)", "params": [ { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "基于实体的局部坐标" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "实体id" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nposition = clientApi.GetWorldPosFromLocal((0, 0, 1), entityId)" - }, + ], + "type": "api", + "side": "client", + "name": "GetWorldPosFromLocal" + }, { - "type": "api", - "name": "GetConfigData", - "method": "", - "description": "获取本地配置文件中存储的数据", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地存储.md", + "remark": "", + "return": [], + "description": "获取本地配置文件中存储的数据", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地存储.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateConfigClient(clientApi.GetLevelId())\r\nconfigDict = comp.GetConfigData(\"addon_namespace_global_config_name\", True)", "params": [ { - "name": "configName", - "type": "str", + "type": "str", + "name": "configName", "description": "配置名称,只能包含字母、数字和下划线字符,另外为了避免addon之间的冲突,建议加上addon的命名空间作为前缀" - }, + }, { - "name": "isGlobal", - "type": "bool", + "type": "bool", + "name": "isGlobal", "description": "存档配置or全局配置,默认为False" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateConfigClient(clientApi.GetLevelId())\r\nconfigDict = comp.GetConfigData(\"addon_namespace_global_config_name\", True)" - }, + ], + "type": "api", + "side": "client", + "name": "GetConfigData" + }, { - "type": "api", - "name": "SetConfigData", - "method": "", - "description": "以本地配置文件的方式存储数据", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地存储.md", + "remark": "", + "return": [], + "description": "以本地配置文件的方式存储数据", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地存储.md", + "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateConfigClient(clientApi.GetLevelId())\r\ndata = {}\r\ndata[\"key\"] = \"value\"\r\ncomp.SetConfigData(\"addon_namespace_global_config_name\", data, True)", "params": [ { - "name": "configName", - "type": "str", + "type": "str", + "name": "configName", "description": "配置名称,只能包含字母、数字和下划线字符,另外为了避免addon之间的冲突,建议加上addon的命名空间作为前缀" - }, + }, { - "name": "value", - "type": "dict", + "type": "dict", + "name": "value", "description": "数据" - }, + }, { - "name": "isGlobal", - "type": "bool", + "type": "bool", + "name": "isGlobal", "description": "为True时是全局配置,否则为存档配置,默认为False" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\ncomp = clientApi.GetEngineCompFactory().CreateConfigClient(clientApi.GetLevelId())\r\ndata = {}\r\ndata[\"key\"] = \"value\"\r\ncomp.SetConfigData(\"addon_namespace_global_config_name\", data, True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetConfigData" + }, { - "type": "api", - "name": "GetEngineVersion", - "method": "", - "description": "获取游戏版本-客户端。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nprint(clientApi.GetEngineVersion())" - }, + "remark": "", + "return": [], + "description": "获取游戏版本-客户端。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md", + "example": "import mod.client.extraClientApi as clientApi\r\nprint(clientApi.GetEngineVersion())", + "params": [], + "type": "api", + "side": "client", + "name": "GetEngineVersion" + }, { - "type": "api", - "name": "GetIP", - "method": "", - "description": "获取本地玩家的ip地址", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.GetIP()" - }, + "remark": "", + "return": [], + "description": "获取本地玩家的ip地址", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.GetIP()", + "params": [], + "type": "api", + "side": "client", + "name": "GetIP" + }, { - "type": "api", - "name": "GetMinecraftVersion", - "method": "", - "description": "获取Minecraft版本-客户端。", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nprint(clientApi.GetMinecraftVersion())" - }, + "remark": "", + "return": [], + "description": "获取Minecraft版本-客户端。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md", + "example": "import mod.client.extraClientApi as clientApi\r\nprint(clientApi.GetMinecraftVersion())", + "params": [], + "type": "api", + "side": "client", + "name": "GetMinecraftVersion" + }, { - "type": "api", - "name": "GetPlatform", - "method": "", - "description": "获取脚本运行的平台", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.GetPlatform()" - }, + "remark": "", + "return": [], + "description": "获取脚本运行的平台", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.GetPlatform()", + "params": [], + "type": "api", + "side": "client", + "name": "GetPlatform" + }, { - "type": "api", - "name": "IsInApollo", - "method": "", - "description": "返回当前游戏Mod是否运行在Apollo网络服", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nIsInApollo = serverApi.IsInApollo()" - }, + "remark": "", + "return": [], + "description": "返回当前游戏Mod是否运行在Apollo网络服", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md", + "example": "import mod.server.extraServerApi as serverApi\r\nIsInApollo = serverApi.IsInApollo()", + "params": [], + "type": "api", + "side": "server", + "name": "IsInApollo" + }, { - "type": "api", - "name": "IsInServer", - "method": "", - "description": "获取当前游戏是否跑在服务器环境下", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nisInServer = serverApi.IsInServer()" - }, + "remark": "", + "return": [], + "description": "获取当前游戏是否跑在服务器环境下", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/本地设备.md", + "example": "import mod.server.extraServerApi as serverApi\r\nisInServer = serverApi.IsInServer()", + "params": [], + "type": "api", + "side": "server", + "name": "IsInServer" + }, { - "type": "api", - "name": "GetEnableReconnectNetgame", - "method": "", - "description": "获取是否允许断线重连", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.GetEnableReconnectNetgame()" - }, + "remark": "", + "return": [], + "description": "获取是否允许断线重连", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.GetEnableReconnectNetgame()", + "params": [], + "type": "api", + "side": "client", + "name": "GetEnableReconnectNetgame" + }, { - "type": "api", - "name": "GetKeepResourceWhenTransfer", - "method": "", - "description": "获取快速切服设置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "# 先打开快速切服开关\r\nimport mod.client.extraClientApi as clientApi\r\nprint clientApi.GetKeepResourceWhenTransfer()" - }, + "remark": "", + "return": [], + "description": "获取快速切服设置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "# 先打开快速切服开关\r\nimport mod.client.extraClientApi as clientApi\r\nprint clientApi.GetKeepResourceWhenTransfer()", + "params": [], + "type": "api", + "side": "client", + "name": "GetKeepResourceWhenTransfer" + }, { - "type": "api", - "name": "GetMcpModLogCanPostDump", - "method": "", - "description": "获取是否可以打印错误信息到McpModLog日志。", - "remark": "- McpModLog日志包括开发者组件的错误信息,不包括引擎错误信息,存在手机端本地。每个McpModLog日志只针对调用该接口的Mcp生效,最多可以保留7天的日志,可在开发者后台查看,打印接口默认关闭。\r\n - Mcp指手机端组件中,行为包路径下,每个包含modMain.py脚本的文件夹所构成的代码模块,一个组件可以有多个Mcp模块,接口调用时会自动获取Mcp信息,不需要传入。\r\n - 请引导玩家在反馈模组问题时勾选“同步上传7天内日志”后,在开发者平台下载并查看。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nprint(clientApi.GetMcpModLogCanPostDump())" - }, + "remark": "- McpModLog日志包括开发者组件的错误信息,不包括引擎错误信息,存在手机端本地。每个McpModLog日志只针对调用该接口的Mcp生效,最多可以保留7天的日志,可在开发者后台查看,打印接口默认关闭。\r\n - Mcp指手机端组件中,行为包路径下,每个包含modMain.py脚本的文件夹所构成的代码模块,一个组件可以有多个Mcp模块,接口调用时会自动获取Mcp信息,不需要传入。\r\n - 请引导玩家在反馈模组问题时勾选“同步上传7天内日志”后,在开发者平台下载并查看。", + "return": [], + "description": "获取是否可以打印错误信息到McpModLog日志。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nprint(clientApi.GetMcpModLogCanPostDump())", + "params": [], + "type": "api", + "side": "client", + "name": "GetMcpModLogCanPostDump" + }, { - "type": "api", - "name": "GetResourceFastload", - "method": "", - "description": "获取资源快速加载设置", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nprint clientApi.GetResourceFastload()" - }, + "remark": "", + "return": [], + "description": "获取资源快速加载设置", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nprint clientApi.GetResourceFastload()", + "params": [], + "type": "api", + "side": "client", + "name": "GetResourceFastload" + }, { - "type": "api", - "name": "PostMcpModDump", - "method": "", - "description": "主动打印信息到McpModLog日志,需要先调用 SetMcpModLogCanPostDump 接口进行设置,才能生效。", - "remark": "- McpModLog日志包括开发者组件的错误信息,不包括引擎错误信息,存在手机端本地。每个McpModLog日志只针对调用该接口的Mcp生效,最多可以保留7天的日志,可在开发者后台查看,打印接口默认关闭。\r\n - Mcp指手机端组件中,行为包路径下,每个包含modMain.py脚本的文件夹所构成的代码模块,一个组件可以有多个Mcp模块,接口调用时会自动获取Mcp信息,不需要传入。\r\n - 请引导玩家在反馈模组问题时勾选“同步上传7天内日志”后,在开发者平台下载并查看。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "remark": "- McpModLog日志包括开发者组件的错误信息,不包括引擎错误信息,存在手机端本地。每个McpModLog日志只针对调用该接口的Mcp生效,最多可以保留7天的日志,可在开发者后台查看,打印接口默认关闭。\r\n - Mcp指手机端组件中,行为包路径下,每个包含modMain.py脚本的文件夹所构成的代码模块,一个组件可以有多个Mcp模块,接口调用时会自动获取Mcp信息,不需要传入。\r\n - 请引导玩家在反馈模组问题时勾选“同步上传7天内日志”后,在开发者平台下载并查看。", + "return": [], + "description": "主动打印信息到McpModLog日志,需要先调用 SetMcpModLogCanPostDump 接口进行设置,才能生效。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.PostMcpModDump('Test Msg')", "params": [ { - "name": "msg", - "type": "str", + "type": "str", + "name": "msg", "description": "错误信息" - }, + }, { - "name": "*args", - "type": "any", + "type": "any", + "name": "*args", "description": "此参数将作为可变参数传入 logger.error" - }, + }, { - "name": "**kwargs", - "type": "dict", + "type": "dict", + "name": "**kwargs", "description": "此参数将作为关键字参数传入 logger.error" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.PostMcpModDump('Test Msg')" - }, + ], + "type": "api", + "side": "client", + "name": "PostMcpModDump" + }, { - "type": "api", - "name": "ReloadAllMaterials", - "method": "", - "description": "重新加载所有材质文件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.ReloadAllMaterials()" - }, + "remark": "", + "return": [], + "description": "重新加载所有材质文件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.ReloadAllMaterials()", + "params": [], + "type": "api", + "side": "client", + "name": "ReloadAllMaterials" + }, { - "type": "api", - "name": "ReloadAllShaders", - "method": "", - "description": "重新加载所有Shader文件", - "remark": "- 若修改到材质,建议使用ReloadAllMaterials方法。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.ReloadAllShaders()" - }, + "remark": "- 若修改到材质,建议使用ReloadAllMaterials方法。", + "return": [], + "description": "重新加载所有Shader文件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.ReloadAllShaders()", + "params": [], + "type": "api", + "side": "client", + "name": "ReloadAllShaders" + }, { - "type": "api", - "name": "ReloadOneShader", - "method": "", - "description": "重新加载某个Shader文件", - "remark": "- 若同时修改了多个Shader,建议使用ReloadAllShaders方法。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "remark": "- 若同时修改了多个Shader,建议使用ReloadAllShaders方法。", + "return": [], + "description": "重新加载某个Shader文件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.ReloadOneShader(\"entity.fragment\")", "params": [ { - "name": "shaderName", - "type": "str", + "type": "str", + "name": "shaderName", "description": "shader名称" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.ReloadOneShader(\"entity.fragment\")" - }, + ], + "type": "api", + "side": "client", + "name": "ReloadOneShader" + }, { - "type": "api", - "name": "SetEnableReconnectNetgame", - "method": "", - "description": "设置是否允许断线重连", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "remark": "", + "return": [], + "description": "设置是否允许断线重连", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.SetEnableReconnectNetgame(True)", "params": [ { - "name": "keep", - "type": "bool", + "type": "bool", + "name": "keep", "description": "是否允许断线重连" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.SetEnableReconnectNetgame(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetEnableReconnectNetgame" + }, { - "type": "api", - "name": "SetKeepResourceWhenTransfer", - "method": "", - "description": "设置快速切服", - "remark": "- 快速切服通过在切服时保留资源实现,可以缩短切服等待时间。\r\n - 切服前后的两个服,需要保证资源完全一样。\r\n - 快速切服设置在退出游戏之前一直有效,如果要切到其他类型的服务器,需要在切服前调用clientApi.SetKeepResourceWhenTransfer(False)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "remark": "- 快速切服通过在切服时保留资源实现,可以缩短切服等待时间。\r\n - 切服前后的两个服,需要保证资源完全一样。\r\n - 快速切服设置在退出游戏之前一直有效,如果要切到其他类型的服务器,需要在切服前调用clientApi.SetKeepResourceWhenTransfer(False)", + "return": [], + "description": "设置快速切服", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "# 先打开快速切服开关\r\nimport mod.client.extraClientApi as clientApi\r\nclientApi.SetKeepResourceWhenTransfer(True)\r\n\r\n# 然后切服\r\nimport lobbyGame.netgameApi as lobbyGameApi\r\nlobbyGameApi.TransferToOtherServer('123', 'game')", "params": [ { - "name": "keep", - "type": "bool", + "type": "bool", + "name": "keep", "description": "是否在切服时保留资源,True为保留资源,False为不保留资源" } - ], - "return": [], - "example": "# 先打开快速切服开关\r\nimport mod.client.extraClientApi as clientApi\r\nclientApi.SetKeepResourceWhenTransfer(True)\r\n\r\n# 然后切服\r\nimport lobbyGame.netgameApi as lobbyGameApi\r\nlobbyGameApi.TransferToOtherServer('123', 'game')" - }, + ], + "type": "api", + "side": "client", + "name": "SetKeepResourceWhenTransfer" + }, { - "type": "api", - "name": "SetMcpModLogCanPostDump", - "method": "", - "description": "设置是否可以打印错误信息到McpModLog日志。", - "remark": "- McpModLog日志包括开发者组件的错误信息,不包括引擎错误信息,存在手机端本地。每个McpModLog日志只针对调用该接口的Mcp生效,最多可以保留7天的日志,可在开发者后台查看,打印接口默认关闭。\r\n - Mcp指手机端组件中,行为包路径下,每个包含modMain.py脚本的文件夹所构成的代码模块,一个组件可以有多个Mcp模块,接口调用时会自动获取Mcp信息,不需要传入。\r\n - 请引导玩家在反馈模组问题时勾选“同步上传7天内日志”后,在开发者平台下载并查看。", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "remark": "- McpModLog日志包括开发者组件的错误信息,不包括引擎错误信息,存在手机端本地。每个McpModLog日志只针对调用该接口的Mcp生效,最多可以保留7天的日志,可在开发者后台查看,打印接口默认关闭。\r\n - Mcp指手机端组件中,行为包路径下,每个包含modMain.py脚本的文件夹所构成的代码模块,一个组件可以有多个Mcp模块,接口调用时会自动获取Mcp信息,不需要传入。\r\n - 请引导玩家在反馈模组问题时勾选“同步上传7天内日志”后,在开发者平台下载并查看。", + "return": [], + "description": "设置是否可以打印错误信息到McpModLog日志。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.SetMcpModLogCanPostDump(True)", "params": [ { - "name": "canPost", - "type": "bool", + "type": "bool", + "name": "canPost", "description": "是否可以打印" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.SetMcpModLogCanPostDump(True)" - }, + ], + "type": "api", + "side": "client", + "name": "SetMcpModLogCanPostDump" + }, { - "type": "api", - "name": "SetResourceFastload", - "method": "", - "description": "设置资源快速加载", - "remark": "- 开启资源快速加载,可以缩短切服等待时间。\r\n - 开启资源快速加载,切服速度比设置SetKeepResourceWhenTransfer慢,但不要求切服前后两个服资源完全一致。\r\n - 物品和方块的自定义贴图需要定义在item_texture.json和terrain_texture.json中,才能开启资源快速加载\r\n - 设置资源快速加载在退出游戏之前一直有效,退出游戏后自动恢复为False", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "remark": "- 开启资源快速加载,可以缩短切服等待时间。\r\n - 开启资源快速加载,切服速度比设置SetKeepResourceWhenTransfer慢,但不要求切服前后两个服资源完全一致。\r\n - 物品和方块的自定义贴图需要定义在item_texture.json和terrain_texture.json中,才能开启资源快速加载\r\n - 设置资源快速加载在退出游戏之前一直有效,退出游戏后自动恢复为False", + "return": [], + "description": "设置资源快速加载", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "# 先设置资源快速加载\r\nimport mod.client.extraClientApi as clientApi\r\nclientApi.SetResourceFastload(True)\r\n\r\n# 然后切服\r\nimport lobbyGame.netgameApi as lobbyGameApi\r\nlobbyGameApi.TransferToOtherServer('123', 'game')", "params": [ { - "name": "fastload", - "type": "bool", + "type": "bool", + "name": "fastload", "description": "是否在进入游戏时快速加载资源,True为快速加载资源,False为不快速加载资源" } - ], - "return": [], - "example": "# 先设置资源快速加载\r\nimport mod.client.extraClientApi as clientApi\r\nclientApi.SetResourceFastload(True)\r\n\r\n# 然后切服\r\nimport lobbyGame.netgameApi as lobbyGameApi\r\nlobbyGameApi.TransferToOtherServer('123', 'game')" - }, + ], + "type": "api", + "side": "client", + "name": "SetResourceFastload" + }, { - "type": "api", - "name": "StartMemProfile", - "method": "", - "description": "开始启动客户端脚本内存分析,启动后调用[StopMemProfile](#stopMemProfile)即可在路径fileName生成函数内存火焰图,此接口只支持PC端。生成的火焰图可以用浏览器打开,推荐chrome浏览器。", - "remark": "- 由于分析时并不区分服务端和客户端,在进行分析时,只需要其中一端startmemprofile和stopmemprofile即可,无需双端同时进行。\r\n - 将鼠标放在一个函数块上时,下方会显示当前函数对应的详细信息,具体含义可见获取性能分析火焰图", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StartMemProfile()\r\nmodfunc()# 处理对应的逻辑\r\n# 之后通过计时器或者其他触发方式调用StopMemProfile\r\nclientApi.StopMemProfile(fileName)" - }, + "remark": "- 由于分析时并不区分服务端和客户端,在进行分析时,只需要其中一端startmemprofile和stopmemprofile即可,无需双端同时进行。\r\n - 将鼠标放在一个函数块上时,下方会显示当前函数对应的详细信息,具体含义可见获取性能分析火焰图", + "return": [], + "description": "开始启动客户端脚本内存分析,启动后调用[StopMemProfile](#stopMemProfile)即可在路径fileName生成函数内存火焰图,此接口只支持PC端。生成的火焰图可以用浏览器打开,推荐chrome浏览器。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StartMemProfile()\r\nmodfunc()# 处理对应的逻辑\r\n# 之后通过计时器或者其他触发方式调用StopMemProfile\r\nclientApi.StopMemProfile(fileName)", + "params": [], + "type": "api", + "side": "client", + "name": "StartMemProfile" + }, { - "type": "api", - "name": "StartMultiProfile", - "method": "", - "description": "开始启动服务端与客户端双端脚本性能分析,启动后调用[StopMultiProfile](#stopmultiprofile)即可在路径fileName生成函数性能火焰图。双端采集时数据误差较大,建议优先使用[StartProfile](#startprofile)单端版本,此接口只支持PC端", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StartMultiProfile()\r\nmodfunc()# 处理对应的逻辑\r\n# 之后通过计时器或者其他触发方式调用StopMultiProfile\r\nclientApi.StopMultiProfile()" - }, + "remark": "", + "return": [], + "description": "开始启动服务端与客户端双端脚本性能分析,启动后调用[StopMultiProfile](#stopmultiprofile)即可在路径fileName生成函数性能火焰图。双端采集时数据误差较大,建议优先使用[StartProfile](#startprofile)单端版本,此接口只支持PC端", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StartMultiProfile()\r\nmodfunc()# 处理对应的逻辑\r\n# 之后通过计时器或者其他触发方式调用StopMultiProfile\r\nclientApi.StopMultiProfile()", + "params": [], + "type": "api", + "side": "client", + "name": "StartMultiProfile" + }, { - "type": "api", - "name": "StartProfile", - "method": "", - "description": "开始启动客户端脚本性能分析,启动后调用[StopProfile](#stopprofile)即可在路径fileName生成函数性能火焰图,此接口只支持PC端。生成的火焰图可以用浏览器打开,推荐chrome浏览器。", - "remark": "- 火焰图主页面示例:
![火焰图示意图](../../picture/flameGraph_mainPage.png)\r\n - 如火焰图所示,竖直方向表示调用栈,每一层都是一个函数。调用栈越深,火焰就越高,顶部就是正在执行的函数,下方都是它的父函数。分析性能时主要看火焰图的宽度(其中颜色没有特别意义),火焰图越宽,表示该函数对整体性能的消耗越大。因此需要对该函数进行优化。\r\n - 将鼠标放在一个函数块上时,下方会显示当前函数对应的详细信息,具体含义可见获取性能分析火焰图\r\n - 优化的核心主要是减少调用次数以及优化函数的写法。其中对于开发者而言,只需要关注开发者开发的代码即可,对于部分函数调用到mod框架或者引擎顶层框架进而导致性能消耗较大的,可以尝试通过减少调用次数来进行优化。\r\n - 另外,火焰图支持通过右上方的Search框或者“F3”快捷键对函数关键词进行搜索。同时可以点击函数缩放查看对应的调用栈。\r\n - 上架时请去掉这个接口的调用", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StartProfile()\r\nmodfunc()# 处理对应的逻辑\r\n# 之后通过计时器或者其他触发方式调用StopProfile\r\nclientApi.StopProfile()" - }, + "remark": "- 火焰图主页面示例:
![火焰图示意图](../../picture/flameGraph_mainPage.png)\r\n - 如火焰图所示,竖直方向表示调用栈,每一层都是一个函数。调用栈越深,火焰就越高,顶部就是正在执行的函数,下方都是它的父函数。分析性能时主要看火焰图的宽度(其中颜色没有特别意义),火焰图越宽,表示该函数对整体性能的消耗越大。因此需要对该函数进行优化。\r\n - 将鼠标放在一个函数块上时,下方会显示当前函数对应的详细信息,具体含义可见获取性能分析火焰图\r\n - 优化的核心主要是减少调用次数以及优化函数的写法。其中对于开发者而言,只需要关注开发者开发的代码即可,对于部分函数调用到mod框架或者引擎顶层框架进而导致性能消耗较大的,可以尝试通过减少调用次数来进行优化。\r\n - 另外,火焰图支持通过右上方的Search框或者“F3”快捷键对函数关键词进行搜索。同时可以点击函数缩放查看对应的调用栈。\r\n - 上架时请去掉这个接口的调用", + "return": [], + "description": "开始启动客户端脚本性能分析,启动后调用[StopProfile](#stopprofile)即可在路径fileName生成函数性能火焰图,此接口只支持PC端。生成的火焰图可以用浏览器打开,推荐chrome浏览器。", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StartProfile()\r\nmodfunc()# 处理对应的逻辑\r\n# 之后通过计时器或者其他触发方式调用StopProfile\r\nclientApi.StopProfile()", + "params": [], + "type": "api", + "side": "client", + "name": "StartProfile" + }, { - "type": "api", - "name": "StartRecordEvent", - "method": "", - "description": "开始启动服务端与客户端之间的脚本事件收发统计,启动后调用[StopRecordEvent](#stoprecordevent)即可获取两个函数调用之间脚本事件收发的统计信息,仅支持租赁服与Apollo网络服环境(不支持单机环境)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nsuc = serverApi.StartRecordEvent()\r\n# 之后通过计时器或者其他触发方式调用StopRecordEvent\r\nresult = serverApi.StopRecordEvent()\r\nfor eventName, data in result.iteritems():\r\n print \"event[{}] send={} sendSize={} recv={} recvSize={}\".format(eventName, data[\"send_num\"], data[\"send_size\"], data[\"recv_num\"], data[\"recv_size\"])" - }, + "remark": "", + "return": [], + "description": "开始启动服务端与客户端之间的脚本事件收发统计,启动后调用[StopRecordEvent](#stoprecordevent)即可获取两个函数调用之间脚本事件收发的统计信息,仅支持租赁服与Apollo网络服环境(不支持单机环境)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.server.extraServerApi as serverApi\r\nsuc = serverApi.StartRecordEvent()\r\n# 之后通过计时器或者其他触发方式调用StopRecordEvent\r\nresult = serverApi.StopRecordEvent()\r\nfor eventName, data in result.iteritems():\r\n print \"event[{}] send={} sendSize={} recv={} recvSize={}\".format(eventName, data[\"send_num\"], data[\"send_size\"], data[\"recv_num\"], data[\"recv_size\"])", + "params": [], + "type": "api", + "side": "server", + "name": "StartRecordEvent" + }, { - "type": "api", - "name": "StartRecordPacket", - "method": "", - "description": "开始启动服务端与客户端之间的引擎收发包统计,启动后调用[StopRecordPacket](#stoprecordpacket)即可获取两个函数调用之间引擎收发包的统计信息,仅支持租赁服与Apollo网络服环境(不支持单机环境)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nsuc = serverApi.StartRecordPacket()\r\n# 之后通过计时器或者其他触发方式调用StopRecordPacket\r\nresult = serverApi.StopRecordPacket()\r\nfor packetName, data in result.iteritems():\r\n print \"packet[{}] send={} sendSize={} recv={} recvSize={}\".format(packetName, data[\"send_num\"], data[\"send_size\"], data[\"recv_num\"], data[\"recv_size\"])" - }, + "remark": "", + "return": [], + "description": "开始启动服务端与客户端之间的引擎收发包统计,启动后调用[StopRecordPacket](#stoprecordpacket)即可获取两个函数调用之间引擎收发包的统计信息,仅支持租赁服与Apollo网络服环境(不支持单机环境)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.server.extraServerApi as serverApi\r\nsuc = serverApi.StartRecordPacket()\r\n# 之后通过计时器或者其他触发方式调用StopRecordPacket\r\nresult = serverApi.StopRecordPacket()\r\nfor packetName, data in result.iteritems():\r\n print \"packet[{}] send={} sendSize={} recv={} recvSize={}\".format(packetName, data[\"send_num\"], data[\"send_size\"], data[\"recv_num\"], data[\"recv_size\"])", + "params": [], + "type": "api", + "side": "server", + "name": "StartRecordPacket" + }, { - "type": "api", - "name": "StopMemProfile", - "method": "", - "description": "停止客户端脚本内存分析并生成火焰图,与[StartMemProfile](#startMemProfile)配合使用,此接口只支持PC端", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "remark": "", + "return": [], + "description": "停止客户端脚本内存分析并生成火焰图,与[StartMemProfile](#startMemProfile)配合使用,此接口只支持PC端", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StartMemProfile()\r\nmodfunc()# 处理对应的逻辑\r\n# 之后通过计时器或者其他触发方式调用StopMemProfile\r\nclientApi.StopMemProfile(fileName)", "params": [ { - "name": "fileName", - "type": "str", + "type": "str", + "name": "fileName", "description": "具体路径,相对于PC开发包的路径,默认为\"flamegraph.svg\",位于PC开发包目录下,自定义路径请确保文件后缀名为\".svg\"" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StartMemProfile()\r\nmodfunc()# 处理对应的逻辑\r\n# 之后通过计时器或者其他触发方式调用StopMemProfile\r\nclientApi.StopMemProfile(fileName)" - }, + ], + "type": "api", + "side": "client", + "name": "StopMemProfile" + }, { - "type": "api", - "name": "StopMultiProfile", - "method": "", - "description": "停止双端脚本性能分析并生成火焰图,与[StartMultiProfile](#startmultiprofile)配合使用,此接口只支持PC端", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "remark": "", + "return": [], + "description": "停止双端脚本性能分析并生成火焰图,与[StartMultiProfile](#startmultiprofile)配合使用,此接口只支持PC端", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StartMultiProfile()\r\nmodfunc()# 处理对应的逻辑\r\n# 之后通过计时器或者其他触发方式调用StopMultiProfile\r\nclientApi.StopMultiProfile()", "params": [ { - "name": "fileName", - "type": "str", + "type": "str", + "name": "fileName", "description": "具体路径,相对于PC开发包的路径,默认为\"flamegraph.svg\",位于PC开发包目录下,自定义路径请确保文件后缀名为\".svg\"" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StartMultiProfile()\r\nmodfunc()# 处理对应的逻辑\r\n# 之后通过计时器或者其他触发方式调用StopMultiProfile\r\nclientApi.StopMultiProfile()" - }, + ], + "type": "api", + "side": "client", + "name": "StopMultiProfile" + }, { - "type": "api", - "name": "StopProfile", - "method": "", - "description": "停止客户端脚本性能分析并生成火焰图,与[StartProfile](#startprofile)配合使用,此接口只支持PC端", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "remark": "", + "return": [], + "description": "停止客户端脚本性能分析并生成火焰图,与[StartProfile](#startprofile)配合使用,此接口只支持PC端", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StartProfile()\r\nmodfunc()# 处理对应的逻辑\r\n# 之后通过计时器或者其他触发方式调用StopProfile\r\nclientApi.StopProfile()", "params": [ { - "name": "fileName", - "type": "str", + "type": "str", + "name": "fileName", "description": "具体路径,相对于PC开发包的路径,默认为\"flamegraph.svg\",位于PC开发包目录下,自定义路径请确保文件后缀名为\".svg\"" } - ], - "return": [], - "example": "import mod.client.extraClientApi as clientApi\r\nclientApi.StartProfile()\r\nmodfunc()# 处理对应的逻辑\r\n# 之后通过计时器或者其他触发方式调用StopProfile\r\nclientApi.StopProfile()" - }, + ], + "type": "api", + "side": "client", + "name": "StopProfile" + }, { - "type": "api", - "name": "StopRecordEvent", - "method": "", - "description": "停止服务端与客户端之间的脚本事件收发统计并输出结果,与[StartRecordEvent](#startrecordevent)配合使用,输出结果为字典,key为网络包名,value字典中记录收发信息,具体见示例,仅支持租赁服与Apollo网络服环境(不支持单机环境)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nsuc = serverApi.StartRecordEvent()\r\n# 之后通过计时器或者其他触发方式调用StopRecordEvent\r\nresult = serverApi.StopRecordEvent()\r\nfor eventName, data in result.iteritems():\r\n print \"event[{}] send={} sendSize={} recv={} recvSize={}\".format(eventName, data[\"send_num\"], data[\"send_size\"], data[\"recv_num\"], data[\"recv_size\"])" - }, + "remark": "", + "return": [], + "description": "停止服务端与客户端之间的脚本事件收发统计并输出结果,与[StartRecordEvent](#startrecordevent)配合使用,输出结果为字典,key为网络包名,value字典中记录收发信息,具体见示例,仅支持租赁服与Apollo网络服环境(不支持单机环境)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.server.extraServerApi as serverApi\r\nsuc = serverApi.StartRecordEvent()\r\n# 之后通过计时器或者其他触发方式调用StopRecordEvent\r\nresult = serverApi.StopRecordEvent()\r\nfor eventName, data in result.iteritems():\r\n print \"event[{}] send={} sendSize={} recv={} recvSize={}\".format(eventName, data[\"send_num\"], data[\"send_size\"], data[\"recv_num\"], data[\"recv_size\"])", + "params": [], + "type": "api", + "side": "server", + "name": "StopRecordEvent" + }, { - "type": "api", - "name": "StopRecordPacket", - "method": "", - "description": "停止服务端与客户端之间的引擎收发包统计并输出结果,与[StartRecordPacket](#startrecordpacket)配合使用,输出结果为字典,key为网络包名,value字典中记录收发信息,具体见示例,仅支持租赁服与Apollo网络服环境(不支持单机环境)", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", - "params": [], - "return": [], - "example": "import mod.server.extraServerApi as serverApi\r\nsuc = serverApi.StartRecordPacket()\r\n# 之后通过计时器或者其他触发方式调用StopRecordPacket\r\nresult = serverApi.StopRecordPacket()\r\nfor packetName, data in result.iteritems():\r\n print \"packet[{}] send={} sendSize={} recv={} recvSize={}\".format(packetName, data[\"send_num\"], data[\"send_size\"], data[\"recv_num\"], data[\"recv_size\"])" - }, + "remark": "", + "return": [], + "description": "停止服务端与客户端之间的引擎收发包统计并输出结果,与[StartRecordPacket](#startrecordpacket)配合使用,输出结果为字典,key为网络包名,value字典中记录收发信息,具体见示例,仅支持租赁服与Apollo网络服环境(不支持单机环境)", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/通用/调试.md", + "example": "import mod.server.extraServerApi as serverApi\r\nsuc = serverApi.StartRecordPacket()\r\n# 之后通过计时器或者其他触发方式调用StopRecordPacket\r\nresult = serverApi.StopRecordPacket()\r\nfor packetName, data in result.iteritems():\r\n print \"packet[{}] send={} sendSize={} recv={} recvSize={}\".format(packetName, data[\"send_num\"], data[\"send_size\"], data[\"recv_num\"], data[\"recv_size\"])", + "params": [], + "type": "api", + "side": "server", + "name": "StopRecordPacket" + }, { - "type": "event", - "name": "DisableOriginMusic", - "method": "", - "description": "停止原生背景音乐", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "remark": "", + "return": [], + "description": "停止原生背景音乐", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "example": "", "params": [ { - "name": "disable", - "type": "bool", + "type": "bool", + "name": "disable", "description": "True表示停止,False表示恢复" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "DisableOriginMusic" + }, { - "type": "event", - "name": "PlayCustomMusic", - "method": "", - "description": "播放场景音效,包括原版音效及自定义音效", - "remark": "- 当播放音乐错误时,将返回相应的错误id\r\n | 错误 | 错误描述 |\r\n | -- | -- |\r\n | -1 | 无法在服务端播放音效 |\r\n | -2 | 播放位置错误 |\r\n | -3 | 已有同名背景音乐正在播放 |\r\n | -4 | 播放失败 |\r\n | -5 | 绑定实体不存在 |\r\n | -6 | **位置距离本地玩家距离大于16格,跳过音效播放**(绑定实体的音效不受此限制) |\r\n - 当背景音乐在播放的时候,请不要播放同名的场景音效\r\n - 针对比较大的音乐,请将load_on_low_memory和stream设为true。但使用stream的音频无法同时播放两个音效实例,多次调用的效果是从头播放音频(不使用stream的音频,多次调用会同时播放多个)\r\n - 该接口触发[PlaySoundClientEvent](../事件/音效.md#playsoundclientevent)\r\n - 与示例对应的sound_definitions.json配置:\r\n ```json\r\n {\r\n \"sound001\": {\r\n \"min_distance\": 0,\r\n \"max_distance\": 20.0,\r\n \"sounds\": [\r\n {\r\n \"name\": \"sounds/testaudio/largeBlast1\",\r\n \"load_on_low_memory\": true,\r\n \"stream\": true,\r\n \"pitch\": 1,\r\n \"volume\": 1\r\n }\r\n ]\r\n }\r\n }\r\n ```", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "remark": "- 当播放音乐错误时,将返回相应的错误id\r\n | 错误 | 错误描述 |\r\n | -- | -- |\r\n | -1 | 无法在服务端播放音效 |\r\n | -2 | 播放位置错误 |\r\n | -3 | 已有同名背景音乐正在播放 |\r\n | -4 | 播放失败 |\r\n | -5 | 绑定实体不存在 |\r\n | -6 | **位置距离本地玩家距离大于16格,跳过音效播放**(绑定实体的音效不受此限制) |\r\n - 当背景音乐在播放的时候,请不要播放同名的场景音效\r\n - 针对比较大的音乐,请将load_on_low_memory和stream设为true。但使用stream的音频无法同时播放两个音效实例,多次调用的效果是从头播放音频(不使用stream的音频,多次调用会同时播放多个)\r\n - 该接口触发[PlaySoundClientEvent](../事件/音效.md#playsoundclientevent)\r\n - 与示例对应的sound_definitions.json配置:\r\n ```json\r\n {\r\n \"sound001\": {\r\n \"min_distance\": 0,\r\n \"max_distance\": 20.0,\r\n \"sounds\": [\r\n {\r\n \"name\": \"sounds/testaudio/largeBlast1\",\r\n \"load_on_low_memory\": true,\r\n \"stream\": true,\r\n \"pitch\": 1,\r\n \"volume\": 1\r\n }\r\n ]\r\n }\r\n }\r\n ```", + "return": [], + "description": "播放场景音效,包括原版音效及自定义音效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "example": "", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "音效名称" - }, + }, { - "name": "pos", - "type": "tuple(float,float,float)", + "type": "tuple(float,float,float)", + "name": "pos", "description": "播放位置" - }, + }, { - "name": "volume", - "type": "float", + "type": "float", + "name": "volume", "description": "音量倍率,范围0-1,与json中的volume乘算后为游戏中实际播放的音量大小" - }, + }, { - "name": "pitch", - "type": "float", + "type": "float", + "name": "pitch", "description": "播放速度,范围0-256,1表示原速,可以从json文件里进行修改" - }, + }, { - "name": "loop", - "type": "bool", + "type": "bool", + "name": "loop", "description": "是否循环播放" - }, + }, { - "name": "entityId", - "type": "str", + "type": "str", + "name": "entityId", "description": "绑定的实体id,默认为None,若有绑定的实体,则pos参数为相对于实体的坐标" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PlayCustomMusic" + }, { - "type": "event", - "name": "PlayCustomUIMusic", - "method": "", - "description": "播放UI音效,包括原版音效及自定义音效", - "remark": "- 当播放音乐错误时,将返回相应的错误id\r\n | 错误 | 错误描述 |\r\n | -- | -- |\r\n | -1 | 无法在服务端播放音效 |\r\n | -2 | 播放失败 |\r\n | -3 | 已有同名背景音乐正在播放 |\r\n - 当背景音乐在播放的时候,请不要播放同名的场景音效\r\n - 该接口触发[PlaySoundClientEvent](../事件/音效.md#playsoundclientevent)", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "remark": "- 当播放音乐错误时,将返回相应的错误id\r\n | 错误 | 错误描述 |\r\n | -- | -- |\r\n | -1 | 无法在服务端播放音效 |\r\n | -2 | 播放失败 |\r\n | -3 | 已有同名背景音乐正在播放 |\r\n - 当背景音乐在播放的时候,请不要播放同名的场景音效\r\n - 该接口触发[PlaySoundClientEvent](../事件/音效.md#playsoundclientevent)", + "return": [], + "description": "播放UI音效,包括原版音效及自定义音效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "example": "", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "音效名称" - }, + }, { - "name": "volume", - "type": "float", + "type": "float", + "name": "volume", "description": "音量倍率,范围0-1,与json中的volume乘算后为游戏中实际播放的音量大小" - }, + }, { - "name": "pitch", - "type": "float", + "type": "float", + "name": "pitch", "description": "播放速度,范围0-256,1表示原速,可以从json文件里进行修改" - }, + }, { - "name": "loop", - "type": "bool", + "type": "bool", + "name": "loop", "description": "是否循环播放" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PlayCustomUIMusic" + }, { - "type": "event", - "name": "PlayGlobalCustomMusic", - "method": "", - "description": "播放背景音乐", - "remark": "- 背景音乐同时仅能播放一个,当播放背景音乐时,会停止掉当前播放的音乐。这个规则也包括原版的背景音乐,所以为了避免原版背景音乐覆盖掉自定义背景音乐,建议先使用DisableOriginMusic屏蔽原版背景音乐。\r\n - 背景音乐的优先级大于场景音效,当背景音乐在播放时,会让同名场景音效播放失败\r\n - 背景音乐的播放速度需要从配置json里进行修改\r\n - 针对比较大的背景音乐,请将load_on_low_memory和stream设为true\r\n - 背景音乐需要在json里定义category为music\r\n - 该接口触发[PlayMusicClientEvent](../事件/音效.md#playmusicclientevent)\r\n - 与示例对应的sound_definitions.json配置:\r\n ```json\r\n {\r\n \"Gsound001\": {\r\n \"category\": \"music\",\r\n \"sounds\": [\r\n {\r\n \"name\": \"sounds/testaudio/Music001\",\r\n \"load_on_low_memory\": true,\r\n \"stream\": true,\r\n \"pitch\": 1,\r\n \"volume\": 1\r\n }\r\n ]\r\n }\r\n }\r\n ```", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "remark": "- 背景音乐同时仅能播放一个,当播放背景音乐时,会停止掉当前播放的音乐。这个规则也包括原版的背景音乐,所以为了避免原版背景音乐覆盖掉自定义背景音乐,建议先使用DisableOriginMusic屏蔽原版背景音乐。\r\n - 背景音乐的优先级大于场景音效,当背景音乐在播放时,会让同名场景音效播放失败\r\n - 背景音乐的播放速度需要从配置json里进行修改\r\n - 针对比较大的背景音乐,请将load_on_low_memory和stream设为true\r\n - 背景音乐需要在json里定义category为music\r\n - 该接口触发[PlayMusicClientEvent](../事件/音效.md#playmusicclientevent)\r\n - 与示例对应的sound_definitions.json配置:\r\n ```json\r\n {\r\n \"Gsound001\": {\r\n \"category\": \"music\",\r\n \"sounds\": [\r\n {\r\n \"name\": \"sounds/testaudio/Music001\",\r\n \"load_on_low_memory\": true,\r\n \"stream\": true,\r\n \"pitch\": 1,\r\n \"volume\": 1\r\n }\r\n ]\r\n }\r\n }\r\n ```", + "return": [], + "description": "播放背景音乐", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "example": "", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "音乐名称" - }, + }, { - "name": "volume", - "type": "float", + "type": "float", + "name": "volume", "description": "音量大小,范围0-1,与json中的volume乘算后为游戏中实际播放的音量大小" - }, + }, { - "name": "loop", - "type": "bool", + "type": "bool", + "name": "loop", "description": "是否循环播放" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "PlayGlobalCustomMusic" + }, { - "type": "event", - "name": "SetCustomMusicLoop", - "method": "", - "description": "设定指定音乐是否循环播放,包括场景音效与背景音乐", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "remark": "", + "return": [], + "description": "设定指定音乐是否循环播放,包括场景音效与背景音乐", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "example": "", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "音乐名称" - }, + }, { - "name": "loop", - "type": "bool", + "type": "bool", + "name": "loop", "description": "True则循环播放,False则停止循环,停止会持续到播放到本次结束" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCustomMusicLoop" + }, { - "type": "event", - "name": "SetCustomMusicLoopById", - "method": "", - "description": "设定指定音乐是否循环播放", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "remark": "", + "return": [], + "description": "设定指定音乐是否循环播放", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "example": "", "params": [ { - "name": "musicId", - "type": "str", + "type": "str", + "name": "musicId", "description": "音乐id,播放指定音乐获取的音乐id" - }, + }, { - "name": "loop", - "type": "bool", + "type": "bool", + "name": "loop", "description": "True则循环播放,False则停止循环,停止会持续到播放到本次结束" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "SetCustomMusicLoopById" + }, { - "type": "event", - "name": "StopCustomMusic", - "method": "", - "description": "停止音效,包括场景音效与背景音乐,将依据fadeOutTime触发OnMusicStopClientEvent事件", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "remark": "", + "return": [], + "description": "停止音效,包括场景音效与背景音乐,将依据fadeOutTime触发OnMusicStopClientEvent事件", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "example": "", "params": [ { - "name": "name", - "type": "str", + "type": "str", + "name": "name", "description": "音乐名称" - }, + }, { - "name": "fadeOutTime", - "type": "float", + "type": "float", + "name": "fadeOutTime", "description": "停止的淡出时间,单位为秒,如果剩余时间小于淡出时间,将以剩余时间为准" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "client", + "name": "StopCustomMusic" + }, { - "type": "event", - "name": "StopCustomMusicById", - "method": "", - "description": "停止场景音效", - "remark": "", - "side": "client", - "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "remark": "", + "return": [], + "description": "停止场景音效", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/接口/音效.md", + "example": "", "params": [ { - "name": "musicId", - "type": "str", + "type": "str", + "name": "musicId", "description": "音乐id,播放指定音乐获取的音乐id" - }, + }, { - "name": "fadeOutTime", - "type": "float", + "type": "float", + "name": "fadeOutTime", "description": "停止的淡出时间,单位为秒" } - ], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "一、更新时间表", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/更新信息/3.3.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "二、重要功能更新", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/更新信息/3.3.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "三、API更新", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/1-ModAPI/更新信息/3.3.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2025.03.13 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2025.01.07 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.12.10 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.11.20 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.10.17 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.09.12 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.08.27 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.08.15 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.08.08 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.06.20 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.06.14 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.05.23 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.04.23 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.04.11 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.03.19 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2024.01.18 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.12.20 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.11.21 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.11.16 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.10.24 更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.09.19 2.8更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.09.07 2.8更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.08.15 2.8beta更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.08.10 2.7更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.06.27 2.7更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.06.21 2.7更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.05.30 2.6更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.05.26 2.7beta更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.05.04 2.6更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.04.18 2.6、2.5更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.04.06 2.6、2.5更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.03.23 2.5更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.03.14 2.6beta更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.03.09 2.5更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.02.21 2.5更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.02.07 2.5更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2023.01.12 2.5更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.12.29 2.5更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.12.15 2.4更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.12.06 2.5beta更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.12.01 2.4更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.11.15 2.4更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.11.08 2.4更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.10.27 2.4beta更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.10.18 2.3更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.09.28 2.3更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.09.15 2.3更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.08.31 2.2更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.08.23 2.3beta更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.08.02 2.2更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.07.19 2.2更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.07.05 2.2更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.06.30 2.2更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.06.21 2.1更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.06.07 2.2更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.04.26 2.1更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.04.12 2.1更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.03.29 2.0更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.03.15 2.0更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.03.01 2.0更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.02.16 2.0更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.01.20 2.0更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2022.01.06 1.25更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.12.23 1.25更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.12.21 2.0 beta更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.12.09 1.25更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.11.25 1.25更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.11.11 1.24更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.11.04 1.25 beta更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.10.28 1.24更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.10.14 1.24更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.09.29 1.24更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.09.16 1.24更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.09.02 1.23更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.08.23 1.24 beta更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.08.19 1.23更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.08.05 1.23更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.07.22 1.23更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.07.08 1.23更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.06.24 1.23更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.06.10 1.22更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.05.27 1.22更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.05.13 1.22更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.04.29 1.22更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.04.20 1.22更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.04.15 1.22更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.04.07 1.22更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.04.01 1.21更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.03.18 1.21更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.03.04 1.21更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.01.28 1.21更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.01.21 1.21更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2021.01.14 1.20更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.12.31 1.20更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.12.17 1.20更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.12.03 1.20更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.11.23 1.20更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.11.19 1.19更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.11.05 1.19更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.10.22 1.19更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.9.29 1.19更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.9.17 1.19更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.9.3 1.18更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.8.20 1.18更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.8.13 1.18更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.8.6 1.18更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.7.23 1.18更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.7.17 1.18更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.7.9 1.18更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.7.9 1.17更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.6.24 1.17更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.6.11 1.17更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.6.04 1.17更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.5.28 1.17更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.5.14 1.17更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.4.30 1.17更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.4.24 1.17更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.4.16 1.16更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.4.2 1.16更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.3.19 1.16更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.2.20 1.16更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2020.1.15 1.16更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2019.12.26 1.15更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2019.11.28 1.15更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2019.10.31 1.15更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2019.9.27 1.15更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2019.9.26 1.14更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2019.9.12 1.14更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "api", - "name": "2019.8.2 1.14更新内容", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", - "params": [], - "return": [], - "example": "" - }, - { - "type": "event", - "name": "服务器", - "method": "", - "description": "不建议开发者使用,service向lobby/game注册module", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/1-大厅与游戏服事件.md", + ], + "type": "event", + "side": "client", + "name": "StopCustomMusicById" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/更新信息/3.3.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "一、更新时间表" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/更新信息/3.3.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "二、重要功能更新" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/1-ModAPI/更新信息/3.3.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "三、API更新" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2025.03.13 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2025.01.07 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.12.10 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.11.20 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.10.17 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.09.12 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.08.27 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.08.15 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.08.08 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.06.20 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.06.14 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.05.23 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.04.23 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.04.11 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.03.19 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2024.01.18 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.12.20 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.11.21 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.11.16 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.10.24 更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.09.19 2.8更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.09.07 2.8更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.08.15 2.8beta更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.08.10 2.7更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.06.27 2.7更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.06.21 2.7更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.05.30 2.6更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.05.26 2.7beta更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.05.04 2.6更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.04.18 2.6、2.5更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.04.06 2.6、2.5更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.03.23 2.5更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.03.14 2.6beta更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.03.09 2.5更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.02.21 2.5更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.02.07 2.5更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2023.01.12 2.5更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.12.29 2.5更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.12.15 2.4更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.12.06 2.5beta更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.12.01 2.4更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.11.15 2.4更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.11.08 2.4更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.10.27 2.4beta更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.10.18 2.3更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.09.28 2.3更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.09.15 2.3更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.08.31 2.2更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.08.23 2.3beta更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.08.02 2.2更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.07.19 2.2更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.07.05 2.2更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.06.30 2.2更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.06.21 2.1更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.06.07 2.2更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.04.26 2.1更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.04.12 2.1更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.03.29 2.0更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.03.15 2.0更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.03.01 2.0更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.02.16 2.0更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.01.20 2.0更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2022.01.06 1.25更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.12.23 1.25更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.12.21 2.0 beta更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.12.09 1.25更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.11.25 1.25更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.11.11 1.24更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.11.04 1.25 beta更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.10.28 1.24更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.10.14 1.24更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.09.29 1.24更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.09.16 1.24更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.09.02 1.23更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.08.23 1.24 beta更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.08.19 1.23更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.08.05 1.23更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.07.22 1.23更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.07.08 1.23更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.06.24 1.23更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.06.10 1.22更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.05.27 1.22更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.05.13 1.22更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.04.29 1.22更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.04.20 1.22更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.04.15 1.22更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.04.07 1.22更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.04.01 1.21更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.03.18 1.21更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.03.04 1.21更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.01.28 1.21更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.01.21 1.21更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2021.01.14 1.20更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.12.31 1.20更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.12.17 1.20更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.12.03 1.20更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.11.23 1.20更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.11.19 1.19更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.11.05 1.19更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.10.22 1.19更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.9.29 1.19更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.9.17 1.19更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.9.3 1.18更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.8.20 1.18更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.8.13 1.18更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.8.6 1.18更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.7.23 1.18更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.7.17 1.18更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.7.9 1.18更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.7.9 1.17更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.6.24 1.17更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.6.11 1.17更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.6.04 1.17更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.5.28 1.17更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.5.14 1.17更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.4.30 1.17更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.4.24 1.17更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.4.16 1.16更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.4.2 1.16更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.3.19 1.16更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.2.20 1.16更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2020.1.15 1.16更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2019.12.26 1.15更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2019.11.28 1.15更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2019.10.31 1.15更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2019.9.27 1.15更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2019.9.26 1.14更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2019.9.12 1.14更新内容" + }, + { + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/0-Apollo更新信息.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "2019.8.2 1.14更新内容" + }, + { + "remark": "", + "return": [], + "description": "不建议开发者使用,service向lobby/game注册module", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/1-大厅与游戏服事件.md", + "example": "", "params": [ { - "name": "serverId", - "type": "int", + "type": "int", + "name": "serverId", "description": "service服务器id" - }, + }, { - "name": "moduleName", - "type": "str", + "type": "str", + "name": "moduleName", "description": "模块名,是公共配置中module_names中某个module" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "服务器" + }, { - "type": "event", - "name": "配置", - "method": "", - "description": "不建议开发者使用,公共配置发生变化时触发本事件,注意只有与本服相关配置发生变化时才会触发本事件,比如日志等级", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/1-大厅与游戏服事件.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "不建议开发者使用,公共配置发生变化时触发本事件,注意只有与本服相关配置发生变化时才会触发本事件,比如日志等级", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/1-大厅与游戏服事件.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "配置" + }, { - "type": "event", - "name": "玩家", - "method": "", - "description": "玩家游戏内购买商品时服务端抛出的事件", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/1-大厅与游戏服事件.md", + "remark": "", + "return": [], + "description": "玩家游戏内购买商品时服务端抛出的事件", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/1-大厅与游戏服事件.md", + "example": "", "params": [ { - "name": "playerId", - "type": "str", + "type": "str", + "name": "playerId", "description": "玩家id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "玩家" + }, { - "type": "event", - "name": "服务器", - "method": "", - "description": "lobby/game/proxy断开连接时触发", - "remark": "entity为一个list(dict),每个元素包含以下字段,对应mcstudio的服务器配置:\r\n | 字段 | 类型 | 说明 |\r\n | --- | --- | --- |\r\n | serverid | int | 服务器id |\r\n | ip | str | 服务器ip |\r\n | mods | str | 服务器mod列表 |\r\n | app_type | str | game/lobby/proxy |\r\n | type | str | 服务器类型 |\r\n | save | bool | 是否保存地图 |\r\n | save_id | int | 使用地图 |\r\n | gb | int | 单进程内存 |\r\n\r\n\r\n\r\n### ServerConnectedEvent", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/2-控制服事件.md", + "remark": "entity为一个list(dict),每个元素包含以下字段,对应mcstudio的服务器配置:\r\n | 字段 | 类型 | 说明 |\r\n | --- | --- | --- |\r\n | serverid | int | 服务器id |\r\n | ip | str | 服务器ip |\r\n | mods | str | 服务器mod列表 |\r\n | app_type | str | game/lobby/proxy |\r\n | type | str | 服务器类型 |\r\n | save | bool | 是否保存地图 |\r\n | save_id | int | 使用地图 |\r\n | gb | int | 单进程内存 |\r\n\r\n\r\n\r\n### ServerConnectedEvent", + "return": [], + "description": "lobby/game/proxy断开连接时触发", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/2-控制服事件.md", + "example": "", "params": [ { - "name": "serverId", - "type": "int", + "type": "int", + "name": "serverId", "description": "服务器id" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "服务器" + }, { - "type": "event", - "name": "配置", - "method": "", - "description": "公共配置发生变化时触发,具体包括:新增或删服服务器;服务器相关配置变化;日志等级发生变化", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/2-控制服事件.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "公共配置发生变化时触发,具体包括:新增或删服服务器;服务器相关配置变化;日志等级发生变化", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/2-控制服事件.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "配置" + }, { - "type": "event", - "name": "玩家", - "method": "", - "description": "玩家开始切服事件,此时master开始为玩家准备服务器,玩家还没切服完毕,后续可能切服失败", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/2-控制服事件.md", + "remark": "", + "return": [], + "description": "玩家开始切服事件,此时master开始为玩家准备服务器,玩家还没切服完毕,后续可能切服失败", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/2-控制服事件.md", + "example": "", "params": [ { - "name": "serverId", - "type": "int", + "type": "int", + "name": "serverId", "description": "客户端连接的proxy服务器id" - }, + }, { - "name": "uid", - "type": "int/long", + "type": "int/long", + "name": "uid", "description": "玩家的uid" - }, + }, { - "name": "targetServerId", - "type": "int", + "type": "int", + "name": "targetServerId", "description": "目标lobby/game服务器id" - }, + }, { - "name": "targetServerType", - "type": "str", + "type": "str", + "name": "targetServerType", "description": "目标服务器类型,比如\"game\"或\"lobby\"。若targetServerId为0,则会从目标类型的多个服务器中随机选一个,作为目标服务器" - }, + }, { - "name": "protocolVersion", - "type": "int", + "type": "int", + "name": "protocolVersion", "description": "协议版本号" - }, + }, { - "name": "transferParam", - "type": "str", + "type": "str", + "name": "transferParam", "description": "切服参数。调用【TransferToOtherServer】或【TransferToOtherServerById】传入的切服参数。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "玩家" + }, { - "type": "event", - "name": "服务器", - "method": "", - "description": "lobby/game/proxy状态发生变化时触发", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/3-功能服事件.md", + "remark": "", + "return": [], + "description": "lobby/game/proxy状态发生变化时触发", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/3-功能服事件.md", + "example": "", "params": [ { - "name": "dict类型,key:str,服务器id的字符串,value:str,服务器状态字符串。服务器状态如下:‘1’", - "type": "就绪状态,‘2’", + "type": "就绪状态,‘2’", + "name": "dict类型,key:str,服务器id的字符串,value:str,服务器状态字符串。服务器状态如下:‘1’", "description": "停止状态,‘3’ 准备状态。服务器状态为'1'时,服务器才可用,其他状态下,服务器不可用。" } - ], - "return": [], - "example": "" - }, + ], + "type": "event", + "side": "server", + "name": "服务器" + }, { - "type": "event", - "name": "配置", - "method": "", - "description": "服务器配置发生变化时触发,具体包括:新增或删服服务器;服务器相关配置变化;日志等级发生变化", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/3-功能服事件.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "服务器配置发生变化时触发,具体包括:新增或删服服务器;服务器相关配置变化;日志等级发生变化", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/3-功能服事件.md", + "example": "", + "params": [], + "type": "event", + "side": "server", + "name": "配置" + }, { - "type": "api", - "name": "查询UID", - "method": "", - "description": "查询当前在线玩家的uid\r\n\r\n - 无post body json参数\r\n\r\n - response entity参数\r\n dict。key是服务器id,value是在线玩家uid列表;当对应服务器中不存在玩家时,服务器id不会作为key出现\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/netease/get-online-uids\r\n post body:\r\n {\r\n }\r\n response:\r\n {\r\n \"code\": 0,\r\n \"message\": \"\",\r\n \"entity\": {\r\n \"4000\":[1989540401,2147585444]\r\n }\r\n }\r\n ```\r\n\r\n* **/netease/get-lazy-uids**\r\n\r\n - 描述\r\n\r\n 查询最近请求登录玩家的uid以及请求登录时间\r\n\r\n - 无post body json参数\r\n\r\n - response entity参数\r\n list(string)。每条记录上有uid和对应请求登录的时间,按照登录请求时间远近排序(越近越在前);最多30条\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/netease/get-lazy-uids\r\n post body:\r\n {\r\n }\r\n response:\r\n {\r\n \"code\": 0,\r\n \"message\": \"\",\r\n \"entity\": {\r\n \"uid=680116908 login=2021-05-26 15:12:41\",\r\n \"uid=1989540401 login=2021-05-26 15:12:08\",\r\n \"uid=2147585444 login=2021-05-26 15:11:24\"\r\n }\r\n }\r\n ```", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "查询当前在线玩家的uid\r\n\r\n - 无post body json参数\r\n\r\n - response entity参数\r\n dict。key是服务器id,value是在线玩家uid列表;当对应服务器中不存在玩家时,服务器id不会作为key出现\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/netease/get-online-uids\r\n post body:\r\n {\r\n }\r\n response:\r\n {\r\n \"code\": 0,\r\n \"message\": \"\",\r\n \"entity\": {\r\n \"4000\":[1989540401,2147585444]\r\n }\r\n }\r\n ```\r\n\r\n* **/netease/get-lazy-uids**\r\n\r\n - 描述\r\n\r\n 查询最近请求登录玩家的uid以及请求登录时间\r\n\r\n - 无post body json参数\r\n\r\n - response entity参数\r\n list(string)。每条记录上有uid和对应请求登录的时间,按照登录请求时间远近排序(越近越在前);最多30条\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/netease/get-lazy-uids\r\n post body:\r\n {\r\n }\r\n response:\r\n {\r\n \"code\": 0,\r\n \"message\": \"\",\r\n \"entity\": {\r\n \"uid=680116908 login=2021-05-26 15:12:41\",\r\n \"uid=1989540401 login=2021-05-26 15:12:08\",\r\n \"uid=2147585444 login=2021-05-26 15:11:24\"\r\n }\r\n }\r\n ```", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "查询UID" + }, { - "type": "api", - "name": "在线人数", - "method": "", - "description": "修改全局最高同时在线人数限制\r\n\r\n - post body 参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | online_limit | int | 需要设置的最高同时在线人数,当设置为0时代表不限制最高同时在线|\r\n\r\n - response entity参数\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | code | int | 整个指令的返回码,1为成功,其他数字为失败|\r\n | message | str | 整个指令的返回结果描述,一般成功时会空,失败时会描述失败原因|\r\n | entity | dict | 关键字version为当前配置文件中,全局同时在线人数限制的版本号,暂时无用;关键字old_online_limit为修改前,全局最高同时在线人数的限制,返回0代表修改前,没有限制最高同时在线|\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/netease/update-player-online-limit\r\n post body:\r\n {\r\n\t \"online_limit\":8000\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": {\r\n \"version\": 0,\r\n \"old_online_limit\": 6000\r\n },\r\n \"message\": \"\"\r\n }\r\n ```\r\n\r\n* **/online-num/query**\r\n\r\n - 描述\r\n\r\n 获取proxy/lobby/game在线人数或获取总在线人数。\r\n\r\n - post body 参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | serverType | str | 服务器类型,比如\"lobby\",\"game\",\"proxy\",若不传入该值,则表示总在线人数|\r\n\r\n - response entity参数\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | onlineNum | int | 在线人数|\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/online-num/query\r\n post body:\r\n {\r\n\t \"serverType\":\"game\"\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": {\r\n \"onlineNum\": 0\r\n },\r\n \"message\": \"\"\r\n }\r\n ```\r\n\r\n* **/online-num/query-by-server-id**\r\n\r\n - 描述\r\n\r\n 获取某个proxy/game/lobby在线人数\r\n\r\n - post body参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | serverId | int | 服务器id|\r\n\r\n - response entity参数\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | onlineNum | int | 在线人数|\r\n - 示例:\r\n\r\n ```\r\n post url: http://111.222.333.444:1101/online-num/query-by-server-id\r\n post body:\r\n {\r\n\t \"serverId\":1\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": {\r\n \"onlineNum\": 2\r\n },\r\n \"message\": \"\"\r\n }\r\n ```", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "修改全局最高同时在线人数限制\r\n\r\n - post body 参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | online_limit | int | 需要设置的最高同时在线人数,当设置为0时代表不限制最高同时在线|\r\n\r\n - response entity参数\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | code | int | 整个指令的返回码,1为成功,其他数字为失败|\r\n | message | str | 整个指令的返回结果描述,一般成功时会空,失败时会描述失败原因|\r\n | entity | dict | 关键字version为当前配置文件中,全局同时在线人数限制的版本号,暂时无用;关键字old_online_limit为修改前,全局最高同时在线人数的限制,返回0代表修改前,没有限制最高同时在线|\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/netease/update-player-online-limit\r\n post body:\r\n {\r\n\t \"online_limit\":8000\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": {\r\n \"version\": 0,\r\n \"old_online_limit\": 6000\r\n },\r\n \"message\": \"\"\r\n }\r\n ```\r\n\r\n* **/online-num/query**\r\n\r\n - 描述\r\n\r\n 获取proxy/lobby/game在线人数或获取总在线人数。\r\n\r\n - post body 参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | serverType | str | 服务器类型,比如\"lobby\",\"game\",\"proxy\",若不传入该值,则表示总在线人数|\r\n\r\n - response entity参数\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | onlineNum | int | 在线人数|\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/online-num/query\r\n post body:\r\n {\r\n\t \"serverType\":\"game\"\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": {\r\n \"onlineNum\": 0\r\n },\r\n \"message\": \"\"\r\n }\r\n ```\r\n\r\n* **/online-num/query-by-server-id**\r\n\r\n - 描述\r\n\r\n 获取某个proxy/game/lobby在线人数\r\n\r\n - post body参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | serverId | int | 服务器id|\r\n\r\n - response entity参数\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | onlineNum | int | 在线人数|\r\n - 示例:\r\n\r\n ```\r\n post url: http://111.222.333.444:1101/online-num/query-by-server-id\r\n post body:\r\n {\r\n\t \"serverId\":1\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": {\r\n \"onlineNum\": 2\r\n },\r\n \"message\": \"\"\r\n }\r\n ```", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "在线人数" + }, { - "type": "api", - "name": "日志等级", - "method": "", - "description": "开服工具日志等级设置为debug或info level等级\r\n\r\n - post body 参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | debugLevel | bool | true:则日志设置为debug log level;false:日志设置为info log level |\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/conf/set-log-debug-level\r\n post body:\r\n {\r\n\t \"debugLevel\":false\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```\r\n\r\n* **/conf/set-server-log-debug-level**\r\n\r\n - 描述\r\n\r\n 设置某个服务器的日志等级。\r\n\r\n - post body 参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | serverId | int | 服务器id。可以是proxy、lobby、game、service的serverid。若为0,则表示master。|\r\n | debugLevel | bool | true:则日志设置为debug log level;false:日志设置为info log level |\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/conf/set-server-log-debug-level\r\n post body:\r\n {\r\n\t \"serverId\":1,\r\n\t \"debugLevel\":false\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "开服工具日志等级设置为debug或info level等级\r\n\r\n - post body 参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | debugLevel | bool | true:则日志设置为debug log level;false:日志设置为info log level |\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/conf/set-log-debug-level\r\n post body:\r\n {\r\n\t \"debugLevel\":false\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```\r\n\r\n* **/conf/set-server-log-debug-level**\r\n\r\n - 描述\r\n\r\n 设置某个服务器的日志等级。\r\n\r\n - post body 参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | serverId | int | 服务器id。可以是proxy、lobby、game、service的serverid。若为0,则表示master。|\r\n | debugLevel | bool | true:则日志设置为debug log level;false:日志设置为info log level |\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/conf/set-server-log-debug-level\r\n post body:\r\n {\r\n\t \"serverId\":1,\r\n\t \"debugLevel\":false\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "日志等级" + }, { - "type": "api", - "name": "服务器", - "method": "", - "description": "查询所有服务器状态\r\n\r\n - 无post body json参数\r\n\r\n - response entity参数\r\n dict。key是服务器id,value是服务器状态。服务器状态有:\r\n 1:断开连接状态\r\n 2:已连接状态\r\n 3:关服状态\r\n 4:优雅关服状态\r\n 6, 滚动更新中间状态,即将转换到状态7\r\n 7 也是滚动更新中间状态,即将转换到状态1或2\r\n\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/query-all-server-status\r\n post body:\r\n {\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": {\r\n \t\"1\": 1,\r\n \t\"2\": 1\r\n \t }\r\n \"message\": \"\"\r\n }\r\n ```\r\n\r\n* **/query-one-server-status**\r\n\r\n - 描述\r\n\r\n 查询某个服务器状态\r\n\r\n - post body 参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | serverId | int | proxy/lobby/game服务器id |\r\n\r\n - response entity参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | status | int | 服务器状态。服务器状态有:服务器状态如下:
1:断开连接状态
2:已连接状态
3:关服状态
4:优雅关服状态
6, 滚动更新中间状态,即将转换到状态7
7 也是滚动更新中间状态,即将转换到状态1或2 |\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/query-one-server-status\r\n post body:\r\n {\r\n \t\"serverId\":1\r\n }\r\n response:\r\n {\r\n \"message\": \"\",\r\n \"code\": 1,\r\n \"entity\": {\r\n \"status\": 1\r\n }\r\n }\r\n ```", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "查询所有服务器状态\r\n\r\n - 无post body json参数\r\n\r\n - response entity参数\r\n dict。key是服务器id,value是服务器状态。服务器状态有:\r\n 1:断开连接状态\r\n 2:已连接状态\r\n 3:关服状态\r\n 4:优雅关服状态\r\n 6, 滚动更新中间状态,即将转换到状态7\r\n 7 也是滚动更新中间状态,即将转换到状态1或2\r\n\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/query-all-server-status\r\n post body:\r\n {\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": {\r\n \t\"1\": 1,\r\n \t\"2\": 1\r\n \t }\r\n \"message\": \"\"\r\n }\r\n ```\r\n\r\n* **/query-one-server-status**\r\n\r\n - 描述\r\n\r\n 查询某个服务器状态\r\n\r\n - post body 参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | serverId | int | proxy/lobby/game服务器id |\r\n\r\n - response entity参数\r\n\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | status | int | 服务器状态。服务器状态有:服务器状态如下:
1:断开连接状态
2:已连接状态
3:关服状态
4:优雅关服状态
6, 滚动更新中间状态,即将转换到状态7
7 也是滚动更新中间状态,即将转换到状态1或2 |\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/query-one-server-status\r\n post body:\r\n {\r\n \t\"serverId\":1\r\n }\r\n response:\r\n {\r\n \"message\": \"\",\r\n \"code\": 1,\r\n \"entity\": {\r\n \"status\": 1\r\n }\r\n }\r\n ```", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "服务器" + }, { - "type": "api", - "name": "禁言,解除禁言", - "method": "", - "description": "禁言某个玩家\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | uid |int | 玩家id |\r\n | banTime |int | 禁言时间,单位为秒,-1表示永封|\r\n | reason |str | 禁言原因|\r\n | type |str | 禁言类型,可自定义,公屏禁言为`Commom`|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/silent\r\n post body:\r\n {\r\n\t \"uid\":11111,\r\n\t \"banTime\":40,\r\n \"reason\":\"玩家作弊\",\r\n\t \"type\":\"Common\"\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```\r\n\r\n* **/unban-silent**\r\n\r\n - 描述\r\n\r\n 解除某个玩家的禁言\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | uid |int | 解除禁言玩家的uid|\r\n | type |str | 禁言类型,可自定义,公屏禁言为`Commom`|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/unban-silent\r\n post body:\r\n {\r\n\t \"uid\":11111,\r\n\t \"type\":\"Commom\"\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```\r\n\r\n* **/global-silent**\r\n\r\n - 描述\r\n\r\n 全局公屏禁言开关\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | isSilent |bool | 全局禁言开关,`true`表示开启全局禁言,`false`表示关闭全局禁言|\r\n | reason |str | 禁言原因|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/global-silent\r\n post body:\r\n {\r\n\t \"isSilent\":true,\r\n\t \"reason\":\"系统维护\"\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "禁言某个玩家\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | uid |int | 玩家id |\r\n | banTime |int | 禁言时间,单位为秒,-1表示永封|\r\n | reason |str | 禁言原因|\r\n | type |str | 禁言类型,可自定义,公屏禁言为`Commom`|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/silent\r\n post body:\r\n {\r\n\t \"uid\":11111,\r\n\t \"banTime\":40,\r\n \"reason\":\"玩家作弊\",\r\n\t \"type\":\"Common\"\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```\r\n\r\n* **/unban-silent**\r\n\r\n - 描述\r\n\r\n 解除某个玩家的禁言\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | uid |int | 解除禁言玩家的uid|\r\n | type |str | 禁言类型,可自定义,公屏禁言为`Commom`|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/unban-silent\r\n post body:\r\n {\r\n\t \"uid\":11111,\r\n\t \"type\":\"Commom\"\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```\r\n\r\n* **/global-silent**\r\n\r\n - 描述\r\n\r\n 全局公屏禁言开关\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | isSilent |bool | 全局禁言开关,`true`表示开启全局禁言,`false`表示关闭全局禁言|\r\n | reason |str | 禁言原因|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/global-silent\r\n post body:\r\n {\r\n\t \"isSilent\":true,\r\n\t \"reason\":\"系统维护\"\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "禁言,解除禁言" + }, { - "type": "api", - "name": "踢出玩家", - "method": "", - "description": "把某个玩家从游戏中踢出\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | uid |int | 被踢出玩家的uid|\r\n | reason |str | 踢出原因|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/kickout-user\r\n post body:\r\n {\r\n\t \"uid\":11111,\r\n \"reason\":\"玩家作弊\",\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "把某个玩家从游戏中踢出\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | uid |int | 被踢出玩家的uid|\r\n | reason |str | 踢出原因|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/kickout-user\r\n post body:\r\n {\r\n\t \"uid\":11111,\r\n \"reason\":\"玩家作弊\",\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "踢出玩家" + }, { - "type": "api", - "name": "封禁,解除封禁", - "method": "", - "description": "封禁某个玩家\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | uid |int | 封禁玩家的uid|\r\n | banTime |int | 封禁时间,单位为秒,-1表示永封|\r\n | reason |str | 封禁原因|\r\n | bCombineReason |bool | 是否组合显示封禁原因。若为True,则按备注说明处理,否则被封禁玩家登陆会提示【reason】|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/ban-user\r\n post body:\r\n {\r\n\t \"uid\":11111,\r\n\t \"banTime\":40,\r\n \"reason\":\"玩家作弊\",\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```\r\n - 备注\r\n 若banTime>0,则被封禁玩家登陆提示:您的账号已经被封禁,剩余封禁时间:x天y小时z分,封禁原因:【reason】。如有疑问,请前往客服专区反馈\r\n 若banTime=-1,则被封禁玩家登陆提示:您的账号已经被永久封禁,封禁原因:【reason】。如有疑问,请前往客服专区反馈\r\n\r\n* **/unban-user**\r\n\r\n - 描述\r\n\r\n 解除某个玩家的封禁\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | uid |uint32 | 解除封禁玩家的uid|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/unban-user\r\n post body:\r\n {\r\n\t \"uid\":11111,\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "封禁某个玩家\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | uid |int | 封禁玩家的uid|\r\n | banTime |int | 封禁时间,单位为秒,-1表示永封|\r\n | reason |str | 封禁原因|\r\n | bCombineReason |bool | 是否组合显示封禁原因。若为True,则按备注说明处理,否则被封禁玩家登陆会提示【reason】|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/ban-user\r\n post body:\r\n {\r\n\t \"uid\":11111,\r\n\t \"banTime\":40,\r\n \"reason\":\"玩家作弊\",\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```\r\n - 备注\r\n 若banTime>0,则被封禁玩家登陆提示:您的账号已经被封禁,剩余封禁时间:x天y小时z分,封禁原因:【reason】。如有疑问,请前往客服专区反馈\r\n 若banTime=-1,则被封禁玩家登陆提示:您的账号已经被永久封禁,封禁原因:【reason】。如有疑问,请前往客服专区反馈\r\n\r\n* **/unban-user**\r\n\r\n - 描述\r\n\r\n 解除某个玩家的封禁\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | uid |uint32 | 解除封禁玩家的uid|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/unban-user\r\n post body:\r\n {\r\n\t \"uid\":11111,\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "封禁,解除封禁" + }, { - "type": "api", - "name": "强制解除玩家在线标识", - "method": "", - "description": "强制解除指定UID玩家的在线标识\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | uidList |list(int) | 需要解除在线标识的玩家的UID列表|\r\n\r\n - response entity参数\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | sucUids | list(int) | 成功解除玩家在线标识的UID列表,包括请求时已经不在线的|\r\n | failUids | list(int) | 解除玩家在线标识失败的UID列表|\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/netease/release-online-lock\r\n post body:\r\n {\r\n\t \"uidList\":[2147585444,2819362897],\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"message\": \"\",\r\n \"entity\": {\r\n \"sucUids\": [2147585444,2819362897],\r\n \"failUids\": []\r\n }\r\n }\r\n ```\r\n\r\n* **/netease/release-online-lock-by-server**\r\n\r\n - 描述\r\n\r\n 强制解除指定ID服务器当前在线玩家的在线标识\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | serverId |list(int) | 需要解除在线标识的服务器ID|\r\n\r\n - response entity参数\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | sucUids | list(int) | 成功解除玩家在线标识的UID列表|\r\n | failUids | list(int) | 解除玩家在线标识的UID列表|\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/netease/release-online-lock-by-server\r\n post body:\r\n {\r\n\t \"serverId\": 4000,\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"message\": \"\",\r\n \"entity\": {\r\n \"sucUids\": [2147585444,2819362897],\r\n \"failUids\": []\r\n }\r\n }\r\n ```", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "强制解除指定UID玩家的在线标识\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | uidList |list(int) | 需要解除在线标识的玩家的UID列表|\r\n\r\n - response entity参数\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | sucUids | list(int) | 成功解除玩家在线标识的UID列表,包括请求时已经不在线的|\r\n | failUids | list(int) | 解除玩家在线标识失败的UID列表|\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/netease/release-online-lock\r\n post body:\r\n {\r\n\t \"uidList\":[2147585444,2819362897],\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"message\": \"\",\r\n \"entity\": {\r\n \"sucUids\": [2147585444,2819362897],\r\n \"failUids\": []\r\n }\r\n }\r\n ```\r\n\r\n* **/netease/release-online-lock-by-server**\r\n\r\n - 描述\r\n\r\n 强制解除指定ID服务器当前在线玩家的在线标识\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | serverId |list(int) | 需要解除在线标识的服务器ID|\r\n\r\n - response entity参数\r\n | 关键字 | 数据类型 | 说明 |\r\n | ---------- | -------- | ------------ |\r\n | sucUids | list(int) | 成功解除玩家在线标识的UID列表|\r\n | failUids | list(int) | 解除玩家在线标识的UID列表|\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/netease/release-online-lock-by-server\r\n post body:\r\n {\r\n\t \"serverId\": 4000,\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"message\": \"\",\r\n \"entity\": {\r\n \"sucUids\": [2147585444,2819362897],\r\n \"failUids\": []\r\n }\r\n }\r\n ```", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "强制解除玩家在线标识" + }, { - "type": "api", - "name": "停服维护", - "method": "", - "description": "开启/关闭停服维护\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | invalid |bool | 停服维护开关,`true`表示开启停服维护,`false`表示关闭停服维护|\r\n | reason |str | 停服维护原因|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/invalid-all-servers\r\n post body:\r\n {\r\n\t \"invalid\":true,\r\n \"reason\":\"停服维护\",\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "开启/关闭停服维护\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | invalid |bool | 停服维护开关,`true`表示开启停服维护,`false`表示关闭停服维护|\r\n | reason |str | 停服维护原因|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/invalid-all-servers\r\n post body:\r\n {\r\n\t \"invalid\":true,\r\n \"reason\":\"停服维护\",\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n ```", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "停服维护" + }, { - "type": "api", - "name": "Hunter调试命令", - "method": "", - "description": "使目的服务器执行Python脚本,脚本中使用**print**打印的信息会体现在请求返回中,同时,也会打印到目的服务器的日志文件中,具体是\"hunterDebug exec\"日志的下面n行日志。\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | opServerIds |list(int) |可选参数,需要执行python脚本的服务器ID列表,0表示为master|\r\n | opServerType |str |可选参数,需要执行python脚本的服务器类型列表|\r\n | script |str | 服务器需要执行的python脚本,用`\\n`换行|\r\n | command |str | 服务器需要执行的控制台命令|\r\n\r\n - response entity参数\r\n dict。key是服务器id,value也是一个dict,有两个key,code和message\r\n code=0代表在对应服务器上执行脚本成功,此时message中的信息为脚本中**print**打印的信息;\r\n code=1代表在对应服务器上执行脚本失败,此时message中的信息为失败的原因;\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/netease/hunter-debug\r\n post body:\r\n {\r\n \"opServerIds\": [0,8000,4000,6000],\r\n \"script\":\"import time\\nprint time.time()\"\r\n }\r\n response:\r\n {\r\n \"code\": 0,\r\n \"message\": \"\",\r\n \"entity\": {\r\n \"0\": {\"message\": \"1623327430.98\\n\", \"code\": 0},\r\n \"4000\": {\"message\": \"1623327431.04\\n\", \"code\": 0},\r\n \"6000\": {\"message\": \"1623327431.04\\n\", \"code\": 0},\r\n \"8000\": {\"message\": \"1623327431.04\\n\", \"code\": 0}\r\n }\r\n }\r\n 对应服务器日志文件中包含下面日志:\r\n [2019-06-03 10:21:29 INFO] Python:hunterDebug exec\r\n [2019-06-03 10:21:29 INFO] Python:1559543269.12\r\n ```\r\n\r\n* **/hunter-debug**\r\n\r\n - 描述\r\n\r\n 使目的服务器执行Python脚本,其结果打印到目的服务器的日志文件中,具体是\"hunterDebug exec\"日志的下面n行日志。\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | serverId |int |服务器对应ID,0表示为master|\r\n | script |str | 服务器需要执行的python脚本,用`\\n`换行|\r\n | command |str | 服务器需要执行的控制台命令|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/hunter-debug\r\n post body:\r\n {\r\n\t \"serverId\":101,\r\n \"script\":\"import time\\nprint time.time()\"\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n 101服务器日志文件中包含下面日志:\r\n [2019-06-03 10:21:29 INFO] Python:hunterDebug exec\r\n [2019-06-03 10:21:29 INFO] Python:1559543269.12\r\n ```", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "使目的服务器执行Python脚本,脚本中使用**print**打印的信息会体现在请求返回中,同时,也会打印到目的服务器的日志文件中,具体是\"hunterDebug exec\"日志的下面n行日志。\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | opServerIds |list(int) |可选参数,需要执行python脚本的服务器ID列表,0表示为master|\r\n | opServerType |str |可选参数,需要执行python脚本的服务器类型列表|\r\n | script |str | 服务器需要执行的python脚本,用`\\n`换行|\r\n | command |str | 服务器需要执行的控制台命令|\r\n\r\n - response entity参数\r\n dict。key是服务器id,value也是一个dict,有两个key,code和message\r\n code=0代表在对应服务器上执行脚本成功,此时message中的信息为脚本中**print**打印的信息;\r\n code=1代表在对应服务器上执行脚本失败,此时message中的信息为失败的原因;\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/netease/hunter-debug\r\n post body:\r\n {\r\n \"opServerIds\": [0,8000,4000,6000],\r\n \"script\":\"import time\\nprint time.time()\"\r\n }\r\n response:\r\n {\r\n \"code\": 0,\r\n \"message\": \"\",\r\n \"entity\": {\r\n \"0\": {\"message\": \"1623327430.98\\n\", \"code\": 0},\r\n \"4000\": {\"message\": \"1623327431.04\\n\", \"code\": 0},\r\n \"6000\": {\"message\": \"1623327431.04\\n\", \"code\": 0},\r\n \"8000\": {\"message\": \"1623327431.04\\n\", \"code\": 0}\r\n }\r\n }\r\n 对应服务器日志文件中包含下面日志:\r\n [2019-06-03 10:21:29 INFO] Python:hunterDebug exec\r\n [2019-06-03 10:21:29 INFO] Python:1559543269.12\r\n ```\r\n\r\n* **/hunter-debug**\r\n\r\n - 描述\r\n\r\n 使目的服务器执行Python脚本,其结果打印到目的服务器的日志文件中,具体是\"hunterDebug exec\"日志的下面n行日志。\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | serverId |int |服务器对应ID,0表示为master|\r\n | script |str | 服务器需要执行的python脚本,用`\\n`换行|\r\n | command |str | 服务器需要执行的控制台命令|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/hunter-debug\r\n post body:\r\n {\r\n\t \"serverId\":101,\r\n \"script\":\"import time\\nprint time.time()\"\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n 101服务器日志文件中包含下面日志:\r\n [2019-06-03 10:21:29 INFO] Python:hunterDebug exec\r\n [2019-06-03 10:21:29 INFO] Python:1559543269.12\r\n ```", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "Hunter调试命令" + }, { - "type": "api", - "name": "性能分析", - "method": "", - "description": "检查服务器脚本层内存泄漏。需要执行两次指令,第一次生成快照,第二次生成同第一次的diff。\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | serverId |int ||\r\n | useList |list | 通常是 [\"tracemalloc\", \"objreport\"]|\r\n | objNames |list | 通常是空|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/check-memory-run\r\n post body:\r\n {\r\n\t \"serverId\":101,\r\n \"useList\":[\"tracemalloc\", \"objreport\"],\r\n\t\t\"objNames\":[]\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n\r\n 服务器日志文件包含下面日志:\r\n\t[2019-09-11 17:09:33 INFO] Python:run_tracemalloc traceback\r\n\t[2019-09-11 17:09:33 INFO] Python:[ Top 10 differences ]\r\n\t[2019-09-11 17:09:33 INFO] Python:/tmp/tmpxlycSu/scripts/mod/server/memory/obj_report.py:43: size=12.0 KiB (+12.0 KiB), count=1 (+1), average=12.0 KiB\r\n\t[2019-09-11 17:09:33 INFO] Python:/tmp/tmpxlycSu/scripts/mod/server/memory/obj_report.py:45: size=10.0 KiB (+10.0 KiB), count=11 (+11), average=992 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/tmp/tmpxlycSu/scripts/mod/server/memory/check_memory.py:61: size=10.0 KiB (+10.0 KiB), count=127 (+127), average=84 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/tmp/tmpxlycSu/scripts/mod/server/memory/obj_report.py:12: size=1736 B (+1736 B), count=6 (+6), average=289 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/tmp/tmpxlycSu/scripts/mod/server/memory/obj_report.py:6: size=1007 B (+1007 B), count=5 (+5), average=201 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/usr/local/lib/python2.7/site-packages/tracemalloc.py:380: size=864 B (+864 B), count=4 (+4), average=216 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/usr/local/lib/python2.7/json/decoder.py:380: size=704 B (+704 B), count=11 (+11), average=64 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/usr/local/lib/python2.7/site-packages/tracemalloc.py:518: size=672 B (+672 B), count=4 (+4), average=168 B\r\n\t[2019-09-11 17:09:33 INFO] Python::0: size=650 B (+650 B), count=2 (+2), average=325 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/tmp/tmpxlycSu/scripts/mod/server/memory/check_memory.py:66: size=544 B (+544 B), count=1 (+1), average=544 B\r\n\t[2019-09-11 17:09:33 INFO] Python:[QA] [DIFF_MORE]\r\n\t[2019-09-11 17:09:33 INFO] Python:[QA] [DIFF_LESS]\r\n\t[2019-09-11 17:09:33 INFO] Python:-2 \r\n\r\n\t日志说明,打印了两次【/check-memory】间,内存变化前十的文件,两次指令间,减少了2个tuple的实例。\r\n\t ```\r\n\r\n* **/profile**\r\n - 描述\r\n\r\n 用于测量python函数占用cpu时间。需要执行两次指令,第一次开始profile,第二次生成性能数据文件。性能数据文件放到执行文件所在目录下的profile子目录中。性能数据文件名的格式:profile+生成文件的时间戳\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | serverId |int ||服务器对应ID。0表示为master,-1表示所有服务器,其他表示lobby/game/service的服务器ID|\r\n | bBegin |bool |true:开始profile;false:完成profile|\r\n\r\n - 无response entity参数\r\n - 示例:\r\n ```\r\n 性能数据文件名:profile_1574325974\r\n 文件内容:\r\n 33 function calls in 0.000 seconds\r\n\r\n Ordered by: internal time\r\n\r\n ncalls tottime percall cumtime percall filename:lineno(function)\r\n 1 0.000 0.000 0.000 0.000 {_log.logInfo}\r\n 2 0.000 0.000 0.000 0.000 logout.py:83(write)\r\n 1 0.000 0.000 0.000 0.000 logout.py:62(split_and_log)\r\n 1 0.000 0.000 0.000 0.000 netServerApp.py:17(TickApp)\r\n 1 0.000 0.000 0.000 0.000 Queue.py:93(empty)\r\n 1 0.000 0.000 0.000 0.000 timer.py:72(scheduler)\r\n 1 0.000 0.000 0.000 0.000 idvScript.modMaster.httpHandlerSys:141(Update)\r\n 1 0.000 0.000 0.000 0.000 async_task_pool.py:293(schedule)\r\n 1 0.000 0.000 0.000 0.000 netgameApp.py:3(Tick)\r\n 1 0.000 0.000 0.000 0.000 async_task_pool.py:302(exec_callback)\r\n 2 0.000 0.000 0.000 0.000 {len}\r\n 1 0.000 0.000 0.000 0.000 baseApp.py:73(ClearNeedsUpdate)\r\n 5 0.000 0.000 0.000 0.000 {method 'has_key' of 'dict' objects}\r\n 1 0.000 0.000 0.000 0.000 {time.time}\r\n 1 0.000 0.000 0.000 0.000 {method 'acquire' of 'thread.lock' objects}\r\n 1 0.000 0.000 0.000 0.000 {method 'replace' of 'str' objects}\r\n 2 0.000 0.000 0.000 0.000 {method 'splitlines' of 'str' objects}\r\n 1 0.000 0.000 0.000 0.000 mongopool.py:194(tick)\r\n 1 0.000 0.000 0.000 0.000 redispool.py:274(do_tick)\r\n 1 0.000 0.000 0.000 0.000 Queue.py:200(_qsize)\r\n 1 0.000 0.000 0.000 0.000 memoryScripts.MasterMemorySys:21(Update)\r\n 1 0.000 0.000 0.000 0.000 {method 'release' of 'thread.lock' objects}\r\n 1 0.000 0.000 0.000 0.000 redispool.py:271(tick)\r\n 3 0.000 0.000 0.000 0.000 baseSystem.py:86(Update)\r\n 内容解读:\r\n 第一行:33个函数调用被监控,这些函数占用cpu总运行时间为0.000秒\r\n 接下来输出个字段含义:\r\n ncalls:表示函数调用的次数;\r\n tottime:表示指定函数的总的运行时间,除掉函数中调用子函数的运行时间;\r\n percall:(第一个percall)等于 tottime/ncalls;\r\n cumtime:表示该函数及其所有子函数的调用运行的时间,即函数开始调用到返回的时间;\r\n percall:(第二个percall)即函数运行一次的平均时间,等于 cumtime/ncalls;\r\n filename:lineno(function):每个函数调用的具体信息;\r\n\r\n\t```", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "检查服务器脚本层内存泄漏。需要执行两次指令,第一次生成快照,第二次生成同第一次的diff。\r\n\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | serverId |int ||\r\n | useList |list | 通常是 [\"tracemalloc\", \"objreport\"]|\r\n | objNames |list | 通常是空|\r\n\r\n - 无response entity参数\r\n\r\n - 示例:\r\n ```\r\n post url: http://111.222.333.444:1101/check-memory-run\r\n post body:\r\n {\r\n\t \"serverId\":101,\r\n \"useList\":[\"tracemalloc\", \"objreport\"],\r\n\t\t\"objNames\":[]\r\n }\r\n response:\r\n {\r\n \"code\": 1,\r\n \"entity\": null,\r\n \"message\": \"\"\r\n }\r\n\r\n 服务器日志文件包含下面日志:\r\n\t[2019-09-11 17:09:33 INFO] Python:run_tracemalloc traceback\r\n\t[2019-09-11 17:09:33 INFO] Python:[ Top 10 differences ]\r\n\t[2019-09-11 17:09:33 INFO] Python:/tmp/tmpxlycSu/scripts/mod/server/memory/obj_report.py:43: size=12.0 KiB (+12.0 KiB), count=1 (+1), average=12.0 KiB\r\n\t[2019-09-11 17:09:33 INFO] Python:/tmp/tmpxlycSu/scripts/mod/server/memory/obj_report.py:45: size=10.0 KiB (+10.0 KiB), count=11 (+11), average=992 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/tmp/tmpxlycSu/scripts/mod/server/memory/check_memory.py:61: size=10.0 KiB (+10.0 KiB), count=127 (+127), average=84 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/tmp/tmpxlycSu/scripts/mod/server/memory/obj_report.py:12: size=1736 B (+1736 B), count=6 (+6), average=289 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/tmp/tmpxlycSu/scripts/mod/server/memory/obj_report.py:6: size=1007 B (+1007 B), count=5 (+5), average=201 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/usr/local/lib/python2.7/site-packages/tracemalloc.py:380: size=864 B (+864 B), count=4 (+4), average=216 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/usr/local/lib/python2.7/json/decoder.py:380: size=704 B (+704 B), count=11 (+11), average=64 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/usr/local/lib/python2.7/site-packages/tracemalloc.py:518: size=672 B (+672 B), count=4 (+4), average=168 B\r\n\t[2019-09-11 17:09:33 INFO] Python::0: size=650 B (+650 B), count=2 (+2), average=325 B\r\n\t[2019-09-11 17:09:33 INFO] Python:/tmp/tmpxlycSu/scripts/mod/server/memory/check_memory.py:66: size=544 B (+544 B), count=1 (+1), average=544 B\r\n\t[2019-09-11 17:09:33 INFO] Python:[QA] [DIFF_MORE]\r\n\t[2019-09-11 17:09:33 INFO] Python:[QA] [DIFF_LESS]\r\n\t[2019-09-11 17:09:33 INFO] Python:-2 \r\n\r\n\t日志说明,打印了两次【/check-memory】间,内存变化前十的文件,两次指令间,减少了2个tuple的实例。\r\n\t ```\r\n\r\n* **/profile**\r\n - 描述\r\n\r\n 用于测量python函数占用cpu时间。需要执行两次指令,第一次开始profile,第二次生成性能数据文件。性能数据文件放到执行文件所在目录下的profile子目录中。性能数据文件名的格式:profile+生成文件的时间戳\r\n - post body json参数\r\n\r\n | 关键字 | 数据类型| 说明 |\r\n | ------------ | -----------| ------------ |\r\n | serverId |int ||服务器对应ID。0表示为master,-1表示所有服务器,其他表示lobby/game/service的服务器ID|\r\n | bBegin |bool |true:开始profile;false:完成profile|\r\n\r\n - 无response entity参数\r\n - 示例:\r\n ```\r\n 性能数据文件名:profile_1574325974\r\n 文件内容:\r\n 33 function calls in 0.000 seconds\r\n\r\n Ordered by: internal time\r\n\r\n ncalls tottime percall cumtime percall filename:lineno(function)\r\n 1 0.000 0.000 0.000 0.000 {_log.logInfo}\r\n 2 0.000 0.000 0.000 0.000 logout.py:83(write)\r\n 1 0.000 0.000 0.000 0.000 logout.py:62(split_and_log)\r\n 1 0.000 0.000 0.000 0.000 netServerApp.py:17(TickApp)\r\n 1 0.000 0.000 0.000 0.000 Queue.py:93(empty)\r\n 1 0.000 0.000 0.000 0.000 timer.py:72(scheduler)\r\n 1 0.000 0.000 0.000 0.000 idvScript.modMaster.httpHandlerSys:141(Update)\r\n 1 0.000 0.000 0.000 0.000 async_task_pool.py:293(schedule)\r\n 1 0.000 0.000 0.000 0.000 netgameApp.py:3(Tick)\r\n 1 0.000 0.000 0.000 0.000 async_task_pool.py:302(exec_callback)\r\n 2 0.000 0.000 0.000 0.000 {len}\r\n 1 0.000 0.000 0.000 0.000 baseApp.py:73(ClearNeedsUpdate)\r\n 5 0.000 0.000 0.000 0.000 {method 'has_key' of 'dict' objects}\r\n 1 0.000 0.000 0.000 0.000 {time.time}\r\n 1 0.000 0.000 0.000 0.000 {method 'acquire' of 'thread.lock' objects}\r\n 1 0.000 0.000 0.000 0.000 {method 'replace' of 'str' objects}\r\n 2 0.000 0.000 0.000 0.000 {method 'splitlines' of 'str' objects}\r\n 1 0.000 0.000 0.000 0.000 mongopool.py:194(tick)\r\n 1 0.000 0.000 0.000 0.000 redispool.py:274(do_tick)\r\n 1 0.000 0.000 0.000 0.000 Queue.py:200(_qsize)\r\n 1 0.000 0.000 0.000 0.000 memoryScripts.MasterMemorySys:21(Update)\r\n 1 0.000 0.000 0.000 0.000 {method 'release' of 'thread.lock' objects}\r\n 1 0.000 0.000 0.000 0.000 redispool.py:271(tick)\r\n 3 0.000 0.000 0.000 0.000 baseSystem.py:86(Update)\r\n 内容解读:\r\n 第一行:33个函数调用被监控,这些函数占用cpu总运行时间为0.000秒\r\n 接下来输出个字段含义:\r\n ncalls:表示函数调用的次数;\r\n tottime:表示指定函数的总的运行时间,除掉函数中调用子函数的运行时间;\r\n percall:(第一个percall)等于 tottime/ncalls;\r\n cumtime:表示该函数及其所有子函数的调用运行的时间,即函数开始调用到返回的时间;\r\n percall:(第二个percall)即函数运行一次的平均时间,等于 cumtime/ncalls;\r\n filename:lineno(function):每个函数调用的具体信息;\r\n\r\n\t```", + "method": "", + "link": "/docs/mcdocs/2-Apollo/4-SDK/9-运营指令.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "性能分析" + }, { - "type": "api", - "name": "游戏玩法", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/5-官方插件简介.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/5-官方插件简介.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "游戏玩法" + }, { - "type": "api", - "name": "游戏系统", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/5-官方插件简介.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/5-官方插件简介.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "游戏系统" + }, { - "type": "api", - "name": "基础功能", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/5-官方插件简介.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/5-官方插件简介.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "基础功能" + }, { - "type": "api", - "name": "活动和运营", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/5-官方插件简介.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/5-官方插件简介.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "活动和运营" + }, { - "type": "api", - "name": "概述", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/6-第三方插件简介.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/6-第三方插件简介.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "概述" + }, { - "type": "api", - "name": "下载说明", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/6-第三方插件简介.md", - "params": [], - "return": [], - "example": "" - }, + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/6-第三方插件简介.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "下载说明" + }, { - "type": "api", - "name": "简介", - "method": "", - "description": "", - "remark": "", - "side": "server", - "link": "/docs/mcdocs/2-Apollo/6-第三方插件简介.md", - "params": [], - "return": [], - "example": "" + "remark": "", + "return": [], + "description": "", + "method": "", + "link": "/docs/mcdocs/2-Apollo/6-第三方插件简介.md", + "example": "", + "params": [], + "type": "api", + "side": "server", + "name": "简介" + }, + { + "return": [ + { + "type": "bool", + "description": "是否成功" + } + ], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物理.md", + "name": "CreatePxActor", + "example": "", + "params": [], + "side": "server", + "type": "api", + "method": "mod.server.component.physxCompServer.PhysxComponentServer", + "description": "给实体创建自定义刚体" + }, + { + "return": [ + { + "type": "bool", + "description": "是否成功" + } + ], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物理.md", + "name": "AddBoxGeometry", + "example": "", + "params": [ + { + "type": "tuple(float,float,float)", + "name": "localTransform", + "description": "盒子中心相对实体原点的偏移" + }, + { + "type": "float", + "name": "halfX", + "description": "表示盒子长度的一半" + }, + { + "type": "float", + "name": "halfY", + "description": "表示盒子高度的一半" + }, + { + "type": "float", + "name": "halfZ", + "description": "表示盒子宽度的一半" + }, + { + "type": "float", + "name": "staticFriction", + "description": "静摩擦系数" + }, + { + "type": "float", + "name": "dynamicFriction", + "description": "动摩擦系数" + }, + { + "type": "float", + "name": "restitution", + "description": "弹性恢复系数" + }, + { + "type": "int", + "name": "eventMask", + "description": "PxEventMask枚举" + }, + { + "type": "None/str", + "name": "userData", + "description": "自定义数据" + } + ], + "side": "server", + "type": "api", + "method": "mod.server.component.physxCompServer.PhysxComponentServer", + "description": "给自定义刚体创建盒形碰撞体" + }, + { + "return": [ + { + "type": "bool", + "description": "是否成功" + } + ], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物理.md", + "name": "AddForce", + "example": "", + "params": [ + { + "type": "tuple(float,float,float)", + "name": "dir", + "description": "在全局坐标系中定义的力/冲量" + }, + { + "type": "int", + "name": "mode", + "description": "PxForceMode枚举" + } + ], + "side": "server", + "type": "api", + "method": "mod.server.component.physxCompServer.PhysxComponentServer", + "description": "对自定义刚体的质心添加力,对运动学刚体无效" + }, + { + "return": [ + { + "type": "tuple(float,float,float,float)", + "description": "四元数" + } + ], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物理.md", + "name": "GetQuaternion", + "example": "", + "params": [], + "side": "server", + "type": "api", + "method": "mod.server.component.physxCompServer.PhysxComponentServer", + "description": "获取自定义刚体的四元数旋转" + }, + { + "return": [ + { + "type": "tuple(float,float,float,float)", + "description": "四元数" + } + ], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物理.md", + "name": "GetQuaternion", + "example": "", + "params": [], + "side": "client", + "type": "api", + "method": "mod.client.component.physxCompClient.PhysxComponentClient", + "description": "获取自定义刚体的四元数旋转" + }, + { + "return": [ + { + "type": "list(dict)", + "description": "返回相交的碰撞体的信息" + } + ], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物理.md", + "name": "Raycast", + "example": "", + "params": [ + { + "type": "int", + "name": "dimensionId", + "description": "维度id" + }, + { + "type": "tuple(float,float,float)", + "name": "origin", + "description": "射线的起点" + }, + { + "type": "tuple(float,float,float)", + "name": "dir", + "description": "射线的方向" + }, + { + "type": "float", + "name": "maxDist", + "description": "射线的最大长度" + }, + { + "type": "int", + "name": "maxHits", + "description": "获取射线相交的前N个碰撞体" + } + ], + "side": "server", + "type": "api", + "method": "mod.server.component.physxCompServer.PhysxComponentServer", + "description": "射线检测,获取与射线相交的碰撞体" + }, + { + "return": [ + { + "type": "list(dict)", + "description": "返回相交的碰撞体的信息" + } + ], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物理.md", + "name": "Raycast", + "example": "", + "params": [ + { + "type": "tuple(float,float,float)", + "name": "origin", + "description": "射线的起点" + }, + { + "type": "tuple(float,float,float)", + "name": "dir", + "description": "射线的方向" + }, + { + "type": "float", + "name": "maxDist", + "description": "射线的最大长度" + }, + { + "type": "int", + "name": "maxHits", + "description": "获取射线相交的前N个碰撞体" + } + ], + "side": "client", + "type": "api", + "method": "mod.client.component.physxCompClient.PhysxComponentClient", + "description": "射线检测,获取与射线相交的碰撞体" + }, + { + "return": [ + { + "type": "bool", + "description": "是否成功" + } + ], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物理.md", + "name": "SetActorFlag", + "example": "", + "params": [ + { + "type": "int", + "name": "flag", + "description": "PxActorFlag枚举" + } + ], + "side": "server", + "type": "api", + "method": "mod.server.component.physxCompServer.PhysxComponentServer", + "description": "设置物理实体的行为开关" + }, + { + "return": [ + { + "type": "bool", + "description": "是否成功" + } + ], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物理.md", + "name": "SetGlobalPose", + "example": "", + "params": [ + { + "type": "tuple(float,float,float)/None", + "name": "pos", + "description": "目标位置" + }, + { + "type": "tuple(float,float,float,float)/None", + "name": "rot", + "description": "目标旋转,四元数" + } + ], + "side": "server", + "type": "api", + "method": "mod.server.component.physxCompServer.PhysxComponentServer", + "description": "设置自定义刚体的变换(直接瞆移)" + }, + { + "return": [ + { + "type": "bool", + "description": "是否成功" + } + ], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物理.md", + "name": "SetKinematicTarget", + "example": "", + "params": [ + { + "type": "tuple(float,float,float)/None", + "name": "pos", + "description": "目标位置" + }, + { + "type": "tuple(float,float,float,float)/None", + "name": "rot", + "description": "目标旋转,四元数" + } + ], + "side": "server", + "type": "api", + "method": "mod.server.component.physxCompServer.PhysxComponentServer", + "description": "设置运动学刚体的目标变换" + }, + { + "return": [ + { + "type": "bool", + "description": "是否成功" + } + ], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物理.md", + "name": "SetRigidBodyFlag", + "example": "", + "params": [ + { + "type": "int", + "name": "flag", + "description": "PxRigidBodyFlag枚举" + }, + { + "type": "bool", + "name": "val", + "description": "开关" + } + ], + "side": "server", + "type": "api", + "method": "mod.server.component.physxCompServer.PhysxComponentServer", + "description": "设置自定义刚体的行为开关" + }, + { + "return": [ + { + "type": "bool", + "description": "是否成功" + } + ], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/接口/物理.md", + "name": "SetRigidDynamicLockFlags", + "example": "", + "params": [ + { + "type": "int", + "name": "flag", + "description": "PxRigidDynamicLockFlag枚举" + } + ], + "side": "server", + "type": "api", + "method": "mod.server.component.physxCompServer.PhysxComponentServer", + "description": "设置自定义刚体的约束" + }, + { + "return": [], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物理.md", + "name": "PhysxTouchClientEvent", + "example": "", + "params": [ + { + "type": "list(dict)", + "name": "touch", + "description": "开始接触的碰撞体对的信息" + }, + { + "type": "list(dict)", + "name": "lost", + "description": "结束接触的碰撞体对的信息" + } + ], + "side": "client", + "type": "event", + "method": "", + "description": "给自定义刚体添加的碰撞体,与其他碰撞体或原版实体发生碰撞/结束碰撞时触发" + }, + { + "return": [], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/事件/物理.md", + "name": "PhysxTouchServerEvent", + "example": "", + "params": [ + { + "type": "list(dict)", + "name": "touch", + "description": "开始接触的碰撞体对的信息" + }, + { + "type": "list(dict)", + "name": "lost", + "description": "结束接触的碰撞体对的信息" + } + ], + "side": "server", + "type": "event", + "method": "", + "description": "给自定义刚体添加的碰撞体,与其他碰撞体或原版实体发生碰撞/结束碰撞时触发" + }, + { + "return": [], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/事件/游戏设置.md", + "name": "OnCustomGamepadChangedEvent", + "example": "", + "params": [ + { + "type": "str", + "name": "name", + "description": "按键名称" + }, + { + "type": "str", + "name": "oldKey", + "description": "旧的键码" + }, + { + "type": "str", + "name": "newKey", + "description": "新的键码" + } + ], + "side": "client", + "type": "event", + "method": "", + "description": "当自定义手柄按键绑定发生改变时触发" + }, + { + "return": [], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/事件/游戏设置.md", + "name": "OnCustomGamepadPressInGame", + "example": "", + "params": [ + { + "type": "str", + "name": "name", + "description": "按键名称" + }, + { + "type": "str", + "name": "key", + "description": "键码" + }, + { + "type": "str", + "name": "category", + "description": "按键分类" + }, + { + "type": "str", + "name": "isDown", + "description": "按下状态" + }, + { + "type": "float", + "name": "magnitude", + "description": "扳机力度" + }, + { + "type": "float", + "name": "x", + "description": "摇杆X轴偏移" + }, + { + "type": "float", + "name": "y", + "description": "摇杆Y轴偏移" + }, + { + "type": "str", + "name": "screenName", + "description": "当前屏幕名称" + } + ], + "side": "client", + "type": "event", + "method": "", + "description": "当玩家按下自定义手柄按键时触发" + }, + { + "return": [], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/事件/游戏设置.md", + "name": "OnCustomKeyChangedEvent", + "example": "", + "params": [ + { + "type": "str", + "name": "name", + "description": "按键名称" + }, + { + "type": "str", + "name": "oldKey", + "description": "旧的键码" + }, + { + "type": "str", + "name": "newKey", + "description": "新的键码" + } + ], + "side": "client", + "type": "event", + "method": "", + "description": "当自定义按键绑定发生改变时触发" + }, + { + "return": [], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/事件/游戏设置.md", + "name": "OnCustomKeyPressInGame", + "example": "", + "params": [ + { + "type": "str", + "name": "name", + "description": "按键名称" + }, + { + "type": "str", + "name": "key", + "description": "键码" + }, + { + "type": "str", + "name": "category", + "description": "按键分类" + }, + { + "type": "str", + "name": "isDown", + "description": "按下状态" + }, + { + "type": "str", + "name": "screenName", + "description": "当前屏幕名称" + } + ], + "side": "client", + "type": "event", + "method": "", + "description": "当玩家按下自定义按键时触发" + }, + { + "return": [], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/枚举值/PxActorFlag.md", + "name": "PxActorFlag", + "example": "", + "params": [], + "side": "both", + "type": "enum", + "method": "", + "description": "物理实体行为枚举" + }, + { + "return": [], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/枚举值/PxEventMask.md", + "name": "PxEventMask", + "example": "", + "params": [], + "side": "both", + "type": "enum", + "method": "", + "description": "碰撞事件枚举" + }, + { + "return": [], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/枚举值/PxForceMode.md", + "name": "PxForceMode", + "example": "", + "params": [], + "side": "both", + "type": "enum", + "method": "", + "description": "添加力的模式" + }, + { + "return": [], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/枚举值/PxRigidBodyFlag.md", + "name": "PxRigidBodyFlag", + "example": "", + "params": [], + "side": "both", + "type": "enum", + "method": "", + "description": "自定义刚体行为枚举" + }, + { + "return": [], + "remark": "", + "link": "/docs/mcdocs/1-ModAPI/枚举值/PxRigidDynamicLockFlag.md", + "name": "PxRigidDynamicLockFlag", + "example": "", + "params": [], + "side": "both", + "type": "enum", + "method": "", + "description": "自定义刚体约束枚举" } ] \ No newline at end of file diff --git a/docs/mcdocs/1-ModAPI/config.json b/docs/mcdocs/1-ModAPI/config.json index d110bb3c..04e683c9 100644 --- a/docs/mcdocs/1-ModAPI/config.json +++ b/docs/mcdocs/1-ModAPI/config.json @@ -144,7 +144,8 @@ "/mcdocs/1-ModAPI/接口/联机大厅", "/mcdocs/1-ModAPI/接口/成就", "/mcdocs/1-ModAPI/接口/商城", - "/mcdocs/1-ModAPI/接口/渲染" + "/mcdocs/1-ModAPI/接口/渲染", + "/mcdocs/1-ModAPI/接口/物理" ], "title": "接口" }, @@ -160,7 +161,9 @@ "/mcdocs/1-ModAPI/事件/UI", "/mcdocs/1-ModAPI/事件/音效", "/mcdocs/1-ModAPI/事件/控制", - "/mcdocs/1-ModAPI/事件/联机大厅" + "/mcdocs/1-ModAPI/事件/联机大厅", + "/mcdocs/1-ModAPI/事件/物理", + "/mcdocs/1-ModAPI/事件/游戏设置" ], "title": "事件" }, @@ -217,6 +220,11 @@ "/mcdocs/1-ModAPI/枚举值/PlayerActionType", "/mcdocs/1-ModAPI/枚举值/PlayerExhauseRatioType", "/mcdocs/1-ModAPI/枚举值/PlayerUISlot", + "/mcdocs/1-ModAPI/枚举值/PxActorFlag", + "/mcdocs/1-ModAPI/枚举值/PxEventMask", + "/mcdocs/1-ModAPI/枚举值/PxForceMode", + "/mcdocs/1-ModAPI/枚举值/PxRigidBodyFlag", + "/mcdocs/1-ModAPI/枚举值/PxRigidDynamicLockFlag", "/mcdocs/1-ModAPI/枚举值/RayFilterType", "/mcdocs/1-ModAPI/枚举值/RedstoneModeType", "/mcdocs/1-ModAPI/枚举值/RenderControllerArrayType", @@ -240,6 +248,7 @@ }, { "children": [ + "/mcdocs/1-ModAPI/更新信息/3.7", "/mcdocs/1-ModAPI/更新信息/3.6", "/mcdocs/1-ModAPI/更新信息/3.5", "/mcdocs/1-ModAPI/更新信息/3.4", diff --git a/docs/mcdocs/1-ModAPI/事件/事件索引表.md b/docs/mcdocs/1-ModAPI/事件/事件索引表.md index bff041a9..f0018f78 100644 --- a/docs/mcdocs/1-ModAPI/事件/事件索引表.md +++ b/docs/mcdocs/1-ModAPI/事件/事件索引表.md @@ -15,6 +15,8 @@ sidebarDepth: 1 - [音效](#音效) - [控制](#控制) - [联机大厅](#联机大厅) +- [物理](#物理) +- [游戏设置](#游戏设置) ## 世界 | 事件|
| 描述 | @@ -337,3 +339,17 @@ sidebarDepth: 1 | --- | --- | --- | | [lobbyGoodBuySucServerEvent](联机大厅.md#lobbygoodbuysucserverevent) | 服务端 | 玩家登录联机大厅服务器,或者联机大厅游戏内购买商品时触发。如果是玩家登录,触发时玩家客户端已经触发了UiInitFinished事件 | +## 物理 +| 事件|
| 描述 | +| --- | --- | --- | +| [PhysxTouchClientEvent](物理.md#physxtouchclientevent) | 客户端 | 给自定义刚体添加的碰撞体,与其他碰撞体或原版实体发生碰撞/结束碰撞时触发。需要在碰撞体创建时使用PxEventMask.Client才会触发 | +| [PhysxTouchServerEvent](物理.md#physxtouchserverevent) | 服务端 | 给自定义刚体添加的碰撞体,与其他碰撞体或原版实体发生碰撞/结束碰撞时触发。需要在碰撞体创建时使用PxEventMask.Server才会触发 | + +## 游戏设置 +| 事件|
| 描述 | +| --- | --- | --- | +| [OnCustomGamepadChangedEvent](游戏设置.md#oncustomgamepadchangedevent) | 客户端 | 当自定义手柄按键绑定发生改变时触发 | +| [OnCustomGamepadPressInGame](游戏设置.md#oncustomgamepadpressingame) | 客户端 | 当玩家按下自定义手柄按键时触发 | +| [OnCustomKeyChangedEvent](游戏设置.md#oncustomkeychangedevent) | 客户端 | 当自定义按键绑定发生改变时触发 | +| [OnCustomKeyPressInGame](游戏设置.md#oncustomkeypressingame) | 客户端 | 当玩家按下自定义按键时触发 | + diff --git a/docs/mcdocs/1-ModAPI/事件/游戏设置.md b/docs/mcdocs/1-ModAPI/事件/游戏设置.md new file mode 100644 index 00000000..6a867a33 --- /dev/null +++ b/docs/mcdocs/1-ModAPI/事件/游戏设置.md @@ -0,0 +1,109 @@ +--- +sidebarDepth: 1 +--- +# 游戏设置 + +# 索引 + +| 事件 |
| 描述 | +| --- | --- | --- | +| [OnCustomGamepadChangedEvent](游戏设置.md#oncustomgamepadchangedevent) | 客户端 | 当自定义手柄按键绑定发生改变时触发 | +| [OnCustomGamepadPressInGame](游戏设置.md#oncustomgamepadpressingame) | 客户端 | 当玩家按下自定义手柄按键时触发 | +| [OnCustomKeyChangedEvent](游戏设置.md#oncustomkeychangedevent) | 客户端 | 当自定义按键绑定发生改变时触发 | +| [OnCustomKeyPressInGame](游戏设置.md#oncustomkeypressingame) | 客户端 | 当玩家按下自定义按键时触发 | +# 游戏设置 + +## OnCustomGamepadChangedEvent + +客户端 + +- 描述 + + 当自定义手柄按键绑定发生改变时触发 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 按键名称 | + | oldKey | str | 旧的键码 | + | newKey | str | 新的键码 | + +- 返回值 + + 无 + + + +## OnCustomGamepadPressInGame + +客户端 + +- 描述 + + 当玩家按下自定义手柄按键时触发 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 按键名称 | + | key | str | 键码 | + | category | str | 按键分类 | + | isDown | str | 按下状态 ("1"为按下, "0"为抬起),仅普通按键有效 | + | magnitude | float | 扳机力度 (0.0-1.0),仅扳机键有效 | + | x | float | 摇杆X轴偏移 (-1.0-1.0),仅摇杆键有效 | + | y | float | 摇杆Y轴偏移 (-1.0-1.0),仅摇杆键有效 | + | screenName | str | 当前屏幕名称 | + +- 返回值 + + 无 + + + +## OnCustomKeyChangedEvent + +客户端 + +- 描述 + + 当自定义按键绑定发生改变时触发 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 按键名称 | + | oldKey | str | 旧的键码 | + | newKey | str | 新的键码 | + +- 返回值 + + 无 + + + +## OnCustomKeyPressInGame + +客户端 + +- 描述 + + 当玩家按下自定义按键时触发 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | name | str | 按键名称 | + | key | str | 键码 | + | category | str | 按键分类 | + | isDown | str | 按下状态 ("1"为按下, "0"为抬起) | + | screenName | str | 当前屏幕名称 | + +- 返回值 + + 无 + + diff --git a/docs/mcdocs/1-ModAPI/事件/物理.md b/docs/mcdocs/1-ModAPI/事件/物理.md new file mode 100644 index 00000000..dfac9f47 --- /dev/null +++ b/docs/mcdocs/1-ModAPI/事件/物理.md @@ -0,0 +1,118 @@ +--- +sidebarDepth: 1 +--- +# 物理 + +# 索引 + +| 事件 |
| 描述 | +| --- | --- | --- | +| [PhysxTouchClientEvent](物理.md#physxtouchclientevent) | 客户端 | 给自定义刚体添加的碰撞体,与其他碰撞体或原版实体发生碰撞/结束碰撞时触发。需要在碰撞体创建时使用PxEventMask.Client才会触发 | +| [PhysxTouchServerEvent](物理.md#physxtouchserverevent) | 服务端 | 给自定义刚体添加的碰撞体,与其他碰撞体或原版实体发生碰撞/结束碰撞时触发。需要在碰撞体创建时使用PxEventMask.Server才会触发 | +# 物理 + +## PhysxTouchClientEvent + +客户端 + +- 描述 + + 给自定义刚体添加的碰撞体,与其他碰撞体或原版实体发生碰撞/结束碰撞时触发。需要在碰撞体创建时使用PxEventMask.Client才会触发 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | touch | list(dict) | 开始接触的碰撞体对的信息。一个碰撞体在创建时使用了PxEventMask.Found,他与其他碰撞体/原版实体开始接触时,会出现在列表中 | + | lost | list(dict) | 结束接触的碰撞体对的信息。一个碰撞体在创建时使用了PxEventMask.Lost,他与其他碰撞体/原版实体结束接触时,会出现在列表中 | + +- 返回值 + + 无 + +- 备注 + + touch列表每个元素的内容: + + ```python + { + "entityId0": str, # 一个碰撞体所属实体的entityId + "identifier0": str, # 一个碰撞体所属实体的identifier + "shape0": str或None, # 一个碰撞体的userData + "entityId1": str, # 另一个碰撞体所属实体的entityId + "identifier1": str, # 另一个碰撞体所属实体的identifier + "shape1": str或None, # 另一个碰撞体的userData + "pos": (float,float,float), # 碰撞点的世界坐标。其中一个碰撞体在创建时使用了PxEventMask.Found_Detail才有该字段 + "normal":(float,float,float) # 碰撞产生的力的方向,由碰撞体1指向碰撞体0。其中一个碰撞体在创建时使用了PxEventMask.Found_Detail才有该字段 + } + ``` + + lost列表每个元素的内容: + + ```python + { + "entityId0": str, # 一个碰撞体所属实体的entityId + "identifier0": str, # 一个碰撞体所属实体的identifier + "shape0": str或None, # 一个碰撞体的userData + "entityId1": str, # 另一个碰撞体所属实体的entityId + "identifier1": str, # 另一个碰撞体所属实体的identifier + "shape1": str或None # 另一个碰撞体的userData + } + ``` + + 列表中的碰撞对不分先后,每个碰撞对中的碰撞体0与碰撞体1也不分先后 + + + +## PhysxTouchServerEvent + +服务端 + +- 描述 + + 给自定义刚体添加的碰撞体,与其他碰撞体或原版实体发生碰撞/结束碰撞时触发。需要在碰撞体创建时使用PxEventMask.Server才会触发 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | touch | list(dict) | 开始接触的碰撞体对的信息。一个碰撞体在创建时使用了PxEventMask.Found,他与其他碰撞体/原版实体开始接触时,会出现在列表中 | + | lost | list(dict) | 结束接触的碰撞体对的信息。一个碰撞体在创建时使用了PxEventMask.Lost,他与其他碰撞体/原版实体结束接触时,会出现在列表中 | + +- 返回值 + + 无 + +- 备注 + + touch列表每个元素的内容: + + ```python + { + "entityId0": str, # 一个碰撞体所属实体的entityId + "identifier0": str, # 一个碰撞体所属实体的identifier + "shape0": str或None, # 一个碰撞体的userData + "entityId1": str, # 另一个碰撞体所属实体的entityId + "identifier1": str, # 另一个碰撞体所属实体的identifier + "shape1": str或None, # 另一个碰撞体的userData + "pos": (float,float,float), # 碰撞点的世界坐标。其中一个碰撞体在创建时使用了PxEventMask.Found_Detail才有该字段 + "normal":(float,float,float) # 碰撞产生的力的方向,由碰撞体1指向碰撞体0。其中一个碰撞体在创建时使用了PxEventMask.Found_Detail才有该字段 + } + ``` + + lost列表每个元素的内容: + + ```python + { + "entityId0": str, # 一个碰撞体所属实体的entityId + "identifier0": str, # 一个碰撞体所属实体的identifier + "shape0": str或None, # 一个碰撞体的userData + "entityId1": str, # 另一个碰撞体所属实体的entityId + "identifier1": str, # 另一个碰撞体所属实体的identifier + "shape1": str或None # 另一个碰撞体的userData + } + ``` + + 列表中的碰撞对不分先后,每个碰撞对中的碰撞体0与碰撞体1也不分先后 + + diff --git a/docs/mcdocs/1-ModAPI/接口/物理.md b/docs/mcdocs/1-ModAPI/接口/物理.md new file mode 100644 index 00000000..93302199 --- /dev/null +++ b/docs/mcdocs/1-ModAPI/接口/物理.md @@ -0,0 +1,469 @@ +--- +sidebarDepth: 1 +--- +# 物理 + +# 索引 + +--- + +| 接口 |
| 描述 | +| --- | --- | --- | +| [AddBoxGeometry](物理.md#addboxgeometry) | 服务端 | 给自定义刚体创建盒形碰撞体 | +| [AddForce](物理.md#addforce) | 服务端 | 对自定义刚体的质心添加力,对运动学刚体无效 | +| [CreatePxActor](物理.md#createpxactor) | 服务端 | 给实体创建自定义刚体 | +| [GetQuaternion](物理.md#getquaternion) | 服务端 客户端 | 获取自定义刚体的四元数旋转 | +| [Raycast](物理.md#raycast) | 服务端 客户端 | 射线检测,获取与射线相交的碰撞体。目前仅支持获取自定义刚体 | +| [SetActorFlag](物理.md#setactorflag) | 服务端 | 设置物理实体的行为开关 | +| [SetGlobalPose](物理.md#setglobalpose) | 服务端 | 设置自定义刚体的变换(直接瞬移) | +| [SetKinematicTarget](物理.md#setkinematictarget) | 服务端 | 设置运动学刚体的目标变换,仅对开启了PxRigidBodyFlag.eKINEMATIC的自定义刚体生效 | +| [SetRigidBodyFlag](物理.md#setrigidbodyflag) | 服务端 | 设置自定义刚体的行为开关 | +| [SetRigidDynamicLockFlags](物理.md#setrigiddynamiclockflags) | 服务端 | 设置自定义刚体的约束 | + +## AddBoxGeometry + +服务端 + +method in mod.server.component.physxCompServer.PhysxComponentServer + +- 描述 + + 给自定义刚体创建盒形碰撞体 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | localTransform | tuple(float,float,float) | 盒子中心相对实体原点的偏移 | + | halfX | float | 表示盒子长度的一半 | + | halfY | float | 表示盒子高度的一半 | + | halfZ | float | 表示盒子宽度的一半 | + | staticFriction | float | 静摩擦系数 | + | dynamicFriction | float | 动摩擦系数 | + | restitution | float | 弹性恢复系数,范围:[0, 1] | + | eventMask | int | [PxEventMask](../枚举值/PxEventMask.md)枚举,用于监听碰撞事件,默认为PxEventMask.Null,即不需要碰撞事件 | + | userData | None或str | 可记录自定义数据,长度不超过20,默认为None | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 备注 + + - 目前只能在AddEntityServerEvent事件中使用,不存档 + - 世界中同时存在的碰撞体上限为8192个 + +- 示例 + +```python +import mod.server.extraServerApi as serverApi +comp = serverApi.GetEngineCompFactory().CreatePhysx(entityId) +comp.AddBoxGeometry((0, 0.9, 0), 0.3, 0.9, 0.3, 0.05, 0.05, 0) +``` + + + +## AddForce + +服务端 + +method in mod.server.component.physxCompServer.PhysxComponentServer + +- 描述 + + 对自定义刚体的质心添加力,对运动学刚体无效 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dir | tuple(float,float,float) | 在全局坐标系中定义的力/冲量 | + | mode | int | [PxForceMode](../枚举值/PxForceMode.md)枚举,施加力/冲量时使用的模式 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +import mod.server.extraServerApi as serverApi +from common.minecraftEnum import PxForceMode +comp = serverApi.GetEngineCompFactory().CreatePhysx(entityId) +# 添加一个向上的速度 +comp.AddForce((0,1,0), PxForceMode.eVELOCITY_CHANGE) +``` + + + +## CreatePxActor + +服务端 + +method in mod.server.component.physxCompServer.PhysxComponentServer + +- 描述 + + 给实体创建自定义刚体 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 备注 + + - 只能在AddEntityServerEvent事件中使用,不存档 + - 只能对自定义生物使用,不支持玩家与原版实体。自定义生物需移除minecraft:physics等原生物理组件,并且使用SetBlockControlAi关闭ai + +- 示例 + +```python +import mod.server.extraServerApi as serverApi +comp = serverApi.GetEngineCompFactory().CreatePhysx(entityId) +comp.CreatePxActor() +``` + + + +## GetQuaternion + +服务端 客户端 + +### 服务端接口 + +method in mod.server.component.physxCompServer.PhysxComponentServer + +- 描述 + + 获取自定义刚体的四元数旋转 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float,float) | 四元数 | + +- 备注 + + 非自定义刚体返回(0,0,0,1) + +- 示例 + +```python +import mod.server.extraServerApi as serverApi +comp = serverApi.GetEngineCompFactory().CreatePhysx(entityId) +print comp.GetQuaternion() +``` + +### 客户端接口 + +method in mod.client.component.physxCompClient.PhysxComponentClient + +- 描述 + + 获取自定义刚体的四元数旋转 + +- 参数 + + 无 + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | tuple(float,float,float,float) | 四元数 | + +- 备注 + + 非自定义刚体返回(0,0,0,1) + +- 示例 + +```python +import mod.client.extraClientApi as clientApi +comp = clientApi.GetEngineCompFactory().CreatePhysx(entityId) +print comp.GetQuaternion() +``` + + + +## Raycast + +服务端 客户端 + +### 服务端接口 + +method in mod.server.component.physxCompServer.PhysxComponentServer + +- 描述 + + 射线检测,获取与射线相交的碰撞体。目前仅支持获取自定义刚体 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | dimensionId | int | 维度id | + | origin | tuple(float,float,float) | 射线的起点 | + | dir | tuple(float,float,float) | 射线的方向 | + | maxDist | float | 射线的最大长度,最大128 | + | maxHits | int | 获取射线相交的前N个碰撞体,最大为16,默认为1 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(dict) | 返回相交的碰撞体的信息。每个元素的内容见备注 | + +- 备注 + + 返回列表的每个元素为一个dict,内容如下: + + ```python + { + "entityId": str, # 碰撞体所属的实体id + "userData": str或None, # 碰撞体的userData + "pos": (float,float,float), # 相交的位置 + "normal": (float,float,float), # 碰撞体在相交位置的法线 + "dist": float, # 射线起点与相交点的距离 + } + ``` + +- 示例 + +```python +import mod.server.extraServerApi as serverApi +comp = serverApi.GetEngineCompFactory().CreatePhysx(levelId) +print comp.Raycast(0, (0,80,0), (0,1,0), 5) +``` + +### 客户端接口 + +method in mod.client.component.physxCompClient.PhysxComponentClient + +- 描述 + + 射线检测,获取与射线相交的碰撞体。目前仅支持获取自定义刚体 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | origin | tuple(float,float,float) | 射线的起点 | + | dir | tuple(float,float,float) | 射线的方向 | + | maxDist | float | 射线的最大长度,最大128 | + | maxHits | int | 获取射线相交的前N个碰撞体,最大为16,默认为1 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | list(dict) | 按顺序返回相交的碰撞体的信息。每个元素的内容见备注 | + +- 备注 + + 返回列表的每个元素为一个dict,内容如下: + + ```python + { + "entityId": str, # 碰撞体所属的实体id + "userData": str或None, # 碰撞体的userData + "pos": (float,float,float), # 相交的位置 + "normal": (float,float,float), # 碰撞体在相交位置的法线 + "dist": float, # 射线起点与相交点的距离 + } + ``` + +- 示例 + +```python +import mod.client.extraClientApi as clientApi +comp = clientApi.GetEngineCompFactory().CreatePhysx(levelId) +print comp.Raycast((0,80,0), (0,1,0), 5) +``` + + + +## SetActorFlag + +服务端 + +method in mod.server.component.physxCompServer.PhysxComponentServer + +- 描述 + + 设置物理实体的行为开关 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | flag | int | [PxActorFlag](../枚举值/PxActorFlag.md)枚举 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +import mod.server.extraServerApi as serverApi +from common.minecraftEnum import PxActorFlag +comp = serverApi.GetEngineCompFactory().CreatePhysx(entityId) +# 不受重力 +comp.SetActorFlag(PxActorFlag.eDISABLE_GRAVITY, True) +``` + + + +## SetGlobalPose + +服务端 + +method in mod.server.component.physxCompServer.PhysxComponentServer + +- 描述 + + 设置自定义刚体的变换(直接瞬移) + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float)或None | 目标位置,None表示位置不变 | + | rot | tuple(float,float,float,float)或None | 目标旋转,用四元数表示,None表示旋转不变 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +import mod.server.extraServerApi as serverApi +comp = serverApi.GetEngineCompFactory().CreatePhysx(entityId) +# 瞬移到0,80,0,旋转不变 +comp.SetGlobalPose((0,80,0), None) +``` + + + +## SetKinematicTarget + +服务端 + +method in mod.server.component.physxCompServer.PhysxComponentServer + +- 描述 + + 设置运动学刚体的目标变换,仅对开启了PxRigidBodyFlag.eKINEMATIC的自定义刚体生效 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | pos | tuple(float,float,float)或None | 目标位置,None表示位置不变 | + | rot | tuple(float,float,float,float)或None | 目标旋转,用四元数表示,None表示旋转不变 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +import mod.server.extraServerApi as serverApi +comp = serverApi.GetEngineCompFactory().CreatePhysx(entityId) +# 位置移动到0,80,0,旋转不变 +comp.SetKinematicTarget((0,80,0), None) +``` + + + +## SetRigidBodyFlag + +服务端 + +method in mod.server.component.physxCompServer.PhysxComponentServer + +- 描述 + + 设置自定义刚体的行为开关 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | flag | int | [PxRigidBodyFlag](../枚举值/PxRigidBodyFlag.md)枚举 | + | val | bool | 开关 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +import mod.server.extraServerApi as serverApi +from common.minecraftEnum import PxRigidBodyFlag +comp = serverApi.GetEngineCompFactory().CreatePhysx(entityId) +comp.SetRigidBodyFlag(PxRigidBodyFlag.eKINEMATIC, True) # 设置为运动学刚体 +``` + + + +## SetRigidDynamicLockFlags + +服务端 + +method in mod.server.component.physxCompServer.PhysxComponentServer + +- 描述 + + 设置自定义刚体的约束 + +- 参数 + + | 参数名 |
数据类型
| 说明 | + | :--- | :--- | :--- | + | flag | int | [PxRigidDynamicLockFlag](../枚举值/PxRigidDynamicLockFlag.md)枚举 | + +- 返回值 + + |
数据类型
| 说明 | + | :--- | :--- | + | bool | 是否成功 | + +- 示例 + +```python +import mod.server.extraServerApi as serverApi +from common.minecraftEnum import PxRigidDynamicLockFlag +comp = serverApi.GetEngineCompFactory().CreatePhysx(entityId) +# 锁定xyz轴旋转 +comp.SetRigidDynamicLockFlags(PxRigidDynamicLockFlag.eLOCK_ANGULAR_X | PxRigidDynamicLockFlag.eLOCK_ANGULAR_Y | PxRigidDynamicLockFlag.eLOCK_ANGULAR_Z) +``` + + diff --git a/docs/mcdocs/1-ModAPI/更新信息/3.7.md b/docs/mcdocs/1-ModAPI/更新信息/3.7.md new file mode 100644 index 00000000..c2eb278b --- /dev/null +++ b/docs/mcdocs/1-ModAPI/更新信息/3.7.md @@ -0,0 +1,191 @@ +# 3.7 + +2025.12.31:版本号(V3.7 BE1.21.50)包括Mod PC包,手机测试版启动器,和服务器引擎。 + +示例Demo:前往此处下载 + +## 一、更新时间表 + +1. 在2025年12月31日上线3.7第一个Beta版。 +2. 在2026年1月14日上线3.7第二个Beta版。 +3. 在2026年1月28日上线3.7稳定版。有以下注意事项: + - 3.7稳定包,会提供RenderDragon渲染龙、Opengl两个包体 + - 渲染龙版本仅会在Java经典版中的基岩版(非基岩互通版和手机版)上线,基岩互通版和手机端仍然使用 OpenGL + - 为了确保您的模组、光影等内容后续能够兼容基岩版,您可以通过3.7稳定版渲染龙包进行测试兼容开发 +4. 在2026年2月1日,全渠道将更新3.7版本玩家包体,玩家将陆续更新到3.7版本,请开发者合理安排更新节奏。 + +## 二、重要功能更新 + +1. **物理系统** + + > 注意:物理系列的接口为实验性内容,在后期版本中可能会存在接口变更、开发环境变更等情况。请各位开发者合理安排开发内容与正式版本,避免后续版本物理系统更新后出现模组失效的情况 + + - 新增创建物理刚体,开发者可以给实体创建自定义刚体,并给刚体添加力、碰撞盒,设置其位置、四元数旋转等,同时新增支持刚体碰撞盒之间碰撞检测、以及适用于刚体的射线检测 + - 物理系统相关教程请见[物理的使用指南](../../../mcguide/20-玩法开发/13-模组SDK编程/60-Demo示例.md) + +2. **PC按键绑定** + + - 新增自定义手柄按键(GamepadKeyMappings)的注册和获取,同时新增事件支持在按下自定义手柄按键时、自定义手柄按键绑定发生改变时触发 + - 新增自定义按键映射(CustomKeyMapping)的注册和获取,同时新增事件支持在玩家按下自定义按键时、自定义按键绑定发生改变时触发 + +3. **客户端实体** + + - 对 CreateClientEntityByTypeStr 创建的客户端实体,接口创建的客户端实体进行了优化,对实体使用的一系列渲染、模型、材质、动画等接口,也支持对客户端实体使用 + - 新增[GetEntitiesAroundForClientEntity](../接口/实体/属性.md#getentitiesaroundforcliententity)(客户端) + - 新增[GetEntitiesInSquareAreaForClientEntity](../接口/实体/属性.md#getentitiesinsquareareaforcliententity)(客户端)接口,用于获取区域内的客户端实体 + - 新增[SetRotForClientEntity](../接口/实体/属性.md#setrotforcliententity)(客户端),设置客户端实体头与水平方向的俯仰角度和竖直方向的旋转角度 + - 新增[SetPosForClientEntity](../接口/实体/属性.md#setposforcliententity)(客户端),设置客户端实体位置 + +4. **新增其他接口** + + - 新增[EntityUseItemToPos](../接口/世界/行为.md#entityuseitemtopos)(服务端),模拟实体对某个坐标使用指定物品 + - 新增[UseItemToEntity](../接口/世界/行为.md#useitemtoentity)(服务端),模拟对某个实体使用物品 + - 新增[GetRecipeByRecipeId](../接口/世界/方块管理.md#getrecipebyrecipeid)(客户端),可以根据配方id查询配方内容 + +5. **接口优化** + + - [AddEffectToEntity](../接口/实体/状态效果.md#addeffecttoentity)(服务端)接口持续时间支持设置浮点型 + - [UseItemAttackEntity](../接口/世界/行为.md#useitemattackentity)(服务端)接口增加damageFormula参数,可传入计算公式来修改伤害值 + - 调整[ItemPushInCustomContainerServerEvent](../事件/方块.md#itempushincustomcontainerserverevent)(服务端)、[ItemPullOutCustomContainerServerEvent](../事件/方块.md#itempulloutcustomcontainerserverevent)(服务端),增加容器方块所在维度的参数 + +::: warning 特别注意 +**3.7同步微软版本后变更内容较多,以下为官方整理的重要变更,请开发者们注意适配。** +::: + +- 微软在1.21.50继续修改了部分方块ID,如光源方块、虫蚀类方块等,详见[3.7版本物品id变更](../../../mcguide/20-玩法开发/13-模组SDK编程/Python脚本开发/103-3.7版本物品id变更.md),请开发者注意适配 +- 3.7 版本同步微软后,将会移除假日创作者实验。使用实验性功能的内容可能无法正常运行。开发者可以使用网易组件+Mod API,可以复刻大部分内容 +- **极限模式说明**:以下接口不能在极限模式使用,同样原版指令也将不会生效,请开发者注意使用场景 + - `SetPlayerGameType` 设置玩家游戏模式 + - `SetGameRulesInfoServer` 设置游戏规则 + - `SetGameDifficulty` 设置游戏难度 + - `SetDefaultGameType` 设置默认游戏模式 +- **原版UI变更**:原版界面Json路径有所修改,如果开发者修改原版Json界面,则需要重新调整路径。以下文件具有变更,请开发者注意适配 + - ui_common.json + - play_screen.json + - gameplay_common.json + - start_screen.json + - pause_screen.json + - settings_screen.json + - hud_screen.json + - inventory_screen.json + - inventory_screen_pocket.json + - general_section.json + - world_section.json + - controls_section.json + - command_block_screen.json + +## 三、API更新 + +- 新增 + +1. 新增[EntityUseItemToPos](../接口/世界/行为.md#entityuseitemtopos)(服务端),模拟实体对某个坐标使用指定物品。 + +1. 新增[UseItemToEntity](../接口/世界/行为.md#useitemtoentity)(服务端),模拟对某个实体使用物品。 + +1. 新增[CreatePxActor](../接口/物理.md#createpxactor)(服务端),给实体创建自定义刚体 + +1. 新增[AddBoxGeometry](../接口/物理.md#addboxgeometry)(服务端),给自定义刚体创建盒形碰撞体 + +1. 新增[SetRigidBodyFlag](../接口/物理.md#setrigidbodyflag)(服务端),设置自定义刚体的行为 + +1. 新增[SetRigidDynamicLockFlags](../接口/物理.md#setrigiddynamiclockflags)(服务端),设置自定义刚体的约束 + +1. 新增[SetActorFlag](../接口/物理.md#setactorflag)(服务端),设置物理实体的行为开关 + +1. 新增[SetKinematicTarget](../接口/物理.md#setkinematictarget)(服务端),设置运动学刚体的目标变换 + +1. 新增[SetGlobalPose](../接口/物理.md#setglobalpose)(服务端),设置自定义刚体的变换(直接瞬移) + +1. 新增[AddForce](../接口/物理.md#addforce)(服务端),给自定义刚体添加力 + +1. 新增[GetQuaternion](../接口/物理.md#getquaternion)(服务端),获取自定义刚体的四元数旋转 + +1. 新增[Raycast](../接口/物理.md#raycast)(服务端),射线检测 + +1. 新增[GetRecipeByRecipeId](../接口/世界/方块管理.md#getrecipebyrecipeid)(服务端),根据配方id查询配方内容。 + +1. 新增[GetEntitiesAroundForClientEntity](../接口/实体/属性.md#getentitiesaroundforcliententity)(客户端),获取区域内的客户端实体列表 + +1. 新增[GetEntitiesInSquareAreaForClientEntity](../接口/实体/属性.md#getentitiesinsquareareaforcliententity)(客户端),获取区域内的客户端实体列表 + +1. 新增[GetQuaternion](../接口/物理.md#getquaternion)(客户端),获取自定义刚体的四元数旋转 + +1. 新增[Raycast](../接口/物理.md#raycast)(客户端),射线检测 + +1. 新增[GetKeyMappings](../接口/游戏设置.md#getkeymappings)(客户端),获取指定的自定义按键映射配置 + +1. 新增[RegisterCustomKeyMapping](../接口/游戏设置.md#registercustomkeymapping)(客户端),注册自定义按键映射 + +1. 新增[GetGamepadKeyMappings](../接口/游戏设置.md#getgamepadkeymappings)(客户端),获取自定义手柄按键映射 + +1. 新增[RegisterCustomGamepadMapping](../接口/游戏设置.md#registercustomgamepadmapping)(客户端),注册自定义手柄按键映射 + +1. 新增[SetPosForClientEntity](../接口/实体/属性.md#setposforcliententity)(客户端),设置客户端实体位置。 + +1. 新增[GetRecipeByRecipeId](../接口/世界/方块管理.md#getrecipebyrecipeid)(客户端),根据配方id查询配方内容。 + +1. 新增[SetRotForClientEntity](../接口/实体/属性.md#setrotforcliententity)(客户端),设置客户端实体头与水平方向的俯仰角度和竖直方向的旋转角度。 + +1. 新增[PhysxTouchServerEvent](../事件/物理.md#physxtouchserverevent)(服务端),给自定义刚体添加的碰撞体,与其他碰撞体或原版生物发生碰撞/结束碰撞时触发 + +1. 新增[OnCustomKeyPressInGame](../事件/游戏设置.md#oncustomkeypressingame)(客户端),当玩家按下自定义按键时触发 + +1. 新增[OnCustomKeyChangedEvent](../事件/游戏设置.md#oncustomkeychangedevent)(客户端),当自定义按键绑定发生改变时触发 + +1. 新增[OnCustomGamepadPressInGame](../事件/游戏设置.md#oncustomgamepadpressingame)(客户端),当玩家按下自定义手柄按键时触发 + +1. 新增[OnCustomGamepadChangedEvent](../事件/游戏设置.md#oncustomgamepadchangedevent)(客户端),当自定义手柄按键绑定发生改变时触发 + +1. 新增[PhysxTouchClientEvent](../事件/物理.md#physxtouchclientevent)(客户端),给自定义刚体添加的碰撞体,与其他碰撞体或原版生物发生碰撞/结束碰撞时触发 + +1. 新增[ActorDamageCause](../枚举值/ActorDamageCause.md),新增MaceSmash类型 + +1. 新增[BiomeType](../枚举值/BiomeType.md),新增pale_garden(苍白花园)类型 + +1. 新增[EntityType](../枚举值/EntityType.md),新增Creaking(嘎枝)类型 + +1. 新增[OpenContainerId](../枚举值/OpenContainerId.md),新增DynamicContainer类型 + +1. 新增[PxActorFlag](../枚举值/PxActorFlag.md),物理实体行为枚举 + +1. 新增[PxEventMask](../枚举值/PxEventMask.md),碰撞事件枚举 + +1. 新增[PxForceMode](../枚举值/PxForceMode.md),添加力的模式 + +1. 新增[PxRigidBodyFlag](../枚举值/PxRigidBodyFlag.md),自定义刚体行为枚举 + +1. 新增[PxRigidDynamicLockFlag](../枚举值/PxRigidDynamicLockFlag.md),自定义刚体约束枚举 + +1. 新增[RenderLayer](../枚举值/RenderLayer.md),补充原版发光方块渲染时的材质类型 + +- 调整 + +1. 调整[AddEffectToEntity](../接口/实体/状态效果.md#addeffecttoentity)(服务端),持续时间支持浮点型 + +1. 调整[CanSee](../接口/实体/属性.md#cansee)(服务端),增加angleX、angleY的描述 + +1. 调整[SetGameDifficulty](../接口/世界/行为.md#setgamedifficulty)(服务端),极限模式不可修改游戏难度 + +1. 调整[SetDefaultGameType](../接口/世界/行为.md#setdefaultgametype)(服务端),极限模式不可修改默认游戏模式 + +1. 调整[SetGameRulesInfoServer](../接口/世界/游戏规则.md#setgamerulesinfoserver)(服务端),极限模式不可修改cheat_info部分的游戏规则 + +1. 调整[UseItemAttackEntity](../接口/世界/行为.md#useitemattackentity)(服务端),增加damageFormula参数,可传入计算公式来修改伤害值。 + +1. 调整[SetPlayerGameType](../接口/玩家/游戏模式.md#setplayergametype)(服务端),极限模式不可修改玩家个人游戏模式 + +1. 调整GetNotRenderAtAll(客户端),新增支持CreateClientEntityByTypeStr创建的客户端实体。 + +1. 调整SetNotRenderAtAll(客户端),新增支持CreateClientEntityByTypeStr创建的客户端实体。 + +1. 调整ResetActorRender(客户端),新增支持CreateClientEntityByTypeStr创建的客户端实体。 + +1. 调整多个客户端渲染、模型、材质、动画相关接口,新增支持CreateClientEntityByTypeStr创建的客户端实体。详见官方文档。 + +1. 调整[ItemPushInCustomContainerServerEvent](../事件/方块.md#itempushincustomcontainerserverevent)(服务端),增加容器方块所在维度的参数 + +1. 调整[ItemPullOutCustomContainerServerEvent](../事件/方块.md#itempulloutcustomcontainerserverevent)(服务端),增加容器方块所在维度的参数 + +- 废弃(将在未来不可用) + +1. 废弃OpenVoiceGui,语言转文字功能已移除 diff --git a/docs/mcdocs/1-ModAPI/枚举值/PxActorFlag.md b/docs/mcdocs/1-ModAPI/枚举值/PxActorFlag.md new file mode 100644 index 00000000..ca5aa164 --- /dev/null +++ b/docs/mcdocs/1-ModAPI/枚举值/PxActorFlag.md @@ -0,0 +1,18 @@ +# PxActorFlag + +class in mod.common.minecraftEnum + +- 描述 + + 物理实体行为枚举 + + + +```python +class PxActorFlag(object): + eDISABLE_GRAVITY = (1 << 1) # 禁用重力 + eDISABLE_SIMULATION = (1 << 3) # 禁用物理模拟 + +``` + + diff --git a/docs/mcdocs/1-ModAPI/枚举值/PxEventMask.md b/docs/mcdocs/1-ModAPI/枚举值/PxEventMask.md new file mode 100644 index 00000000..5d3cf6dc --- /dev/null +++ b/docs/mcdocs/1-ModAPI/枚举值/PxEventMask.md @@ -0,0 +1,22 @@ +# PxEventMask + +class in mod.common.minecraftEnum + +- 描述 + + 碰撞事件枚举 + + + +```python +class PxEventMask(object): + Null = 0x0 # 不需要碰撞事件。若不为Null,则Found或Lost必须有一个,Server或Client必须有一个 + Found = 0x1 # 需要接触开始事件 + Found_Detail = 0x2 # 接触开始事件需要附带碰撞点与法线信息。性能消耗较大。 + Lost = 0x4 # 需要接触结束事件 + Server = 0x8 # 需要服务器事件 + Client = 0x10 # 需要客户端事件 + +``` + + diff --git a/docs/mcdocs/1-ModAPI/枚举值/PxForceMode.md b/docs/mcdocs/1-ModAPI/枚举值/PxForceMode.md new file mode 100644 index 00000000..8c84ab79 --- /dev/null +++ b/docs/mcdocs/1-ModAPI/枚举值/PxForceMode.md @@ -0,0 +1,20 @@ +# PxForceMode + +class in mod.common.minecraftEnum + +- 描述 + + 添加力的模式 + + + +```python +class PxForceMode(object): + eFORCE = 0 # 力,单位为质量 × 距离 / 时间² + eIMPULSE = 1 # 冲量,单位为质量 × 距离 / 时间 + eVELOCITY_CHANGE = 2 # 速度变化,单位为距离 / 时间,直接改变速度,与质量无关 + eACCELERATION = 3 # 加速度,单位为距离 / 时间²,直接施加加速度,与质量无关 + +``` + + diff --git a/docs/mcdocs/1-ModAPI/枚举值/PxRigidBodyFlag.md b/docs/mcdocs/1-ModAPI/枚举值/PxRigidBodyFlag.md new file mode 100644 index 00000000..5bc08c5f --- /dev/null +++ b/docs/mcdocs/1-ModAPI/枚举值/PxRigidBodyFlag.md @@ -0,0 +1,17 @@ +# PxRigidBodyFlag + +class in mod.common.minecraftEnum + +- 描述 + + 自定义刚体行为枚举 + + + +```python +class PxRigidBodyFlag(object): + eKINEMATIC = (1 << 0) # 设置刚体的运动学模式。运动学刚体不受力的影响,使用setKinematicTarget控制移动 + +``` + + diff --git a/docs/mcdocs/1-ModAPI/枚举值/PxRigidDynamicLockFlag.md b/docs/mcdocs/1-ModAPI/枚举值/PxRigidDynamicLockFlag.md new file mode 100644 index 00000000..e409bf7c --- /dev/null +++ b/docs/mcdocs/1-ModAPI/枚举值/PxRigidDynamicLockFlag.md @@ -0,0 +1,22 @@ +# PxRigidDynamicLockFlag + +class in mod.common.minecraftEnum + +- 描述 + + 自定义刚体约束枚举 + + + +```python +class PxRigidDynamicLockFlag(object): + eLOCK_LINEAR_X = (1 << 0) # 锁定x轴平移 + eLOCK_LINEAR_Y = (1 << 1) # 锁定y轴平移 + eLOCK_LINEAR_Z = (1 << 2) # 锁定z轴平移 + eLOCK_ANGULAR_X = (1 << 3) # 锁定x轴旋转 + eLOCK_ANGULAR_Y = (1 << 4) # 锁定y轴旋转 + eLOCK_ANGULAR_Z = (1 << 5) # 锁定z轴旋转 + +``` + + diff --git a/docs/mcdocs/1-ModAPI/枚举值/索引.md b/docs/mcdocs/1-ModAPI/枚举值/索引.md index fac8877f..6c058f08 100644 --- a/docs/mcdocs/1-ModAPI/枚举值/索引.md +++ b/docs/mcdocs/1-ModAPI/枚举值/索引.md @@ -56,6 +56,11 @@ | [PlayerActionType](../枚举值/PlayerActionType.md) | 玩家动作枚举 | | [PlayerExhauseRatioType](../枚举值/PlayerExhauseRatioType.md) | 饥饿度消耗倍率类型 | | [PlayerUISlot](../枚举值/PlayerUISlot.md) | 开放容器对应的slot偏移 | +| [PxActorFlag](../枚举值/PxActorFlag.md) | 物理实体行为枚举 | +| [PxEventMask](../枚举值/PxEventMask.md) | 碰撞事件枚举 | +| [PxForceMode](../枚举值/PxForceMode.md) | 添加力的模式 | +| [PxRigidBodyFlag](../枚举值/PxRigidBodyFlag.md) | 自定义刚体行为枚举 | +| [PxRigidDynamicLockFlag](../枚举值/PxRigidDynamicLockFlag.md) | 自定义刚体约束枚举 | | [RayFilterType](../枚举值/RayFilterType.md) | 射线检测类型 | | [RedstoneModeType](../枚举值/RedstoneModeType.md) | 命令方块红石类型 | | [RenderControllerArrayType](../枚举值/RenderControllerArrayType.md) | 渲染控制器字典中材质、贴图、模型的枚举值 | diff --git a/docs/mcguide/20-玩法开发/13-模组SDK编程/2-Python脚本开发/103-3.7版本物品id变更.md b/docs/mcguide/20-玩法开发/13-模组SDK编程/2-Python脚本开发/103-3.7版本物品id变更.md new file mode 100644 index 00000000..b6ef93ed --- /dev/null +++ b/docs/mcguide/20-玩法开发/13-模组SDK编程/2-Python脚本开发/103-3.7版本物品id变更.md @@ -0,0 +1,257 @@ +# 3.7版本物品id变更 + +## 简介 + +微软在1.21.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.7版本变更了id、名称等的物品列表,表格内的名称省略了minecraft命名空间。 + +### 统计信息 + +- 变更项数量: 89 +- 仅名称变更: 12 +- 新增项数量: 69 +- 移除项数量: 17 + +### 变更项 + +| 新中文名 | 旧中文名 | 旧命名 | 旧附加值 | 新命名 | 新附加值 | +| --- | --- | --- | --- | --- | --- | +| 蒲公英 | 蒲公英 | yellow_flower | 0 | dandelion | 0 | +| 虫蚀石头 | 虫蚀石头 | monster_egg | 0 | infested_stone | 0 | +| 石砖 | 石砖 | stonebrick | 0 | stone_bricks | 0 | +| 蘑菇柄 | 蘑菇柄 | brown_mushroom_block | 15 | mushroom_stem | 0 | +| 双红砂岩台阶 | 红砂岩双层台阶 | double_stone_block_slab2 | 0 | red_sandstone_double_slab | 0 | +| 红砂岩台阶 | 红砂岩台阶 | stone_block_slab2 | 0 | red_sandstone_slab | 0 | +| 末地石砖台阶 | 末地石砖台阶 | stone_block_slab3 | 0 | end_stone_brick_slab | 0 | +| 苔石砖台阶 | 苔石砖台阶 | stone_block_slab4 | 0 | mossy_stone_brick_slab | 0 | +| 光源方块-亮度0 | 光源方块 | light_block | 0 | light_block_0 | 0 | +| 虫蚀圆石 | 虫蚀圆石 | monster_egg | 1 | infested_cobblestone | 0 | +| 虫蚀石砖 | 虫蚀石砖 | monster_egg | 2 | infested_stone_bricks | 0 | +| 虫蚀苔石砖 | 虫蚀苔石砖 | monster_egg | 3 | infested_mossy_stone_bricks | 0 | +| 虫蚀裂纹石砖 | 虫蚀裂纹石砖 | monster_egg | 4 | infested_cracked_stone_bricks | 0 | +| 虫蚀雕纹石砖 | 虫蚀雕纹石砖 | monster_egg | 5 | infested_chiseled_stone_bricks | 0 | +| 苔石砖 | 苔石砖 | stonebrick | 1 | mossy_stone_bricks | 0 | +| 裂纹石砖 | 裂纹石砖 | stonebrick | 2 | cracked_stone_bricks | 0 | +| 雕纹石砖 | 雕纹石砖 | stonebrick | 3 | chiseled_stone_bricks | 0 | +| 双砂岩台阶 | 砂岩双层台阶 | double_stone_block_slab | 1 | sandstone_double_slab | 0 | +| 双圆石台阶 | 圆石双层台阶 | double_stone_block_slab | 3 | cobblestone_double_slab | 0 | +| 双红砖台阶 | 红砖双层台阶 | double_stone_block_slab | 4 | brick_double_slab | 0 | +| 双石砖台阶 | 石砖双层台阶 | double_stone_block_slab | 5 | stone_brick_double_slab | 0 | +| 双石英台阶 | 石英双层台阶 | double_stone_block_slab | 6 | quartz_double_slab | 0 | +| 双下界砖台阶 | 下界砖双层台阶 | double_stone_block_slab | 7 | nether_brick_double_slab | 0 | +| 紫珀台阶 | 紫珀台阶 | stone_block_slab2 | 1 | purpur_slab | 0 | +| 海晶石台阶 | 海晶石台阶 | stone_block_slab2 | 2 | prismarine_slab | 0 | +| 暗海晶石台阶 | 暗海晶石台阶 | stone_block_slab2 | 3 | dark_prismarine_slab | 0 | +| 海晶石砖台阶 | 海晶石砖台阶 | stone_block_slab2 | 4 | prismarine_brick_slab | 0 | +| 苔石台阶 | 苔石台阶 | stone_block_slab2 | 5 | mossy_cobblestone_slab | 0 | +| 平滑砂岩台阶 | 平滑砂岩台阶 | stone_block_slab2 | 6 | smooth_sandstone_slab | 0 | +| 红色下界砖台阶 | 红色下界砖台阶 | stone_block_slab2 | 7 | red_nether_brick_slab | 0 | +| 平滑红砂岩台阶 | 平滑红砂岩台阶 | stone_block_slab3 | 1 | smooth_red_sandstone_slab | 0 | +| 磨制安山岩台阶 | 磨制安山岩台阶 | stone_block_slab3 | 2 | polished_andesite_slab | 0 | +| 安山岩台阶 | 安山岩台阶 | stone_block_slab3 | 3 | andesite_slab | 0 | +| 闪长岩台阶 | 闪长岩台阶 | stone_block_slab3 | 4 | diorite_slab | 0 | +| 磨制闪长岩台阶 | 磨制闪长岩台阶 | stone_block_slab3 | 5 | polished_diorite_slab | 0 | +| 花岗岩台阶 | 花岗岩台阶 | stone_block_slab3 | 6 | granite_slab | 0 | +| 磨制花岗岩台阶 | 磨制花岗岩台阶 | stone_block_slab3 | 7 | polished_granite_slab | 0 | +| 平滑石英台阶 | 平滑石英台阶 | stone_block_slab4 | 1 | smooth_quartz_slab | 0 | +| 石头台阶 | 石头台阶 | stone_block_slab4 | 2 | normal_stone_slab | 0 | +| 切制砂岩台阶 | 切制砂岩台阶 | stone_block_slab4 | 3 | cut_sandstone_slab | 0 | +| 切制红砂岩台阶 | 切制红砂岩台阶 | stone_block_slab4 | 4 | cut_red_sandstone_slab | 0 | +| 双石化橡木台阶 | 石化橡木双层台阶 | double_stone_block_slab | 2 | petrified_oak_double_slab | 0 | +| 双紫珀台阶 | 双紫珀台阶 | double_stone_block_slab2 | 1 | purpur_double_slab | 0 | +| 双海晶石台阶 | 双海晶石台阶 | double_stone_block_slab2 | 2 | prismarine_double_slab | 0 | +| 双暗海晶石台阶 | 双暗海晶石台阶 | double_stone_block_slab2 | 3 | dark_prismarine_double_slab | 0 | +| 双海晶石砖台阶 | 双海晶石砖台阶 | double_stone_block_slab2 | 4 | prismarine_brick_double_slab | 0 | +| 双苔石台阶 | 双苔石台阶 | double_stone_block_slab2 | 5 | mossy_cobblestone_double_slab | 0 | +| 双平滑砂岩台阶 | 双平滑砂岩台阶 | double_stone_block_slab2 | 6 | smooth_sandstone_double_slab | 0 | +| 双红色下界砖台阶 | 双红色下界砖台阶 | double_stone_block_slab2 | 7 | red_nether_brick_double_slab | 0 | +| 双平滑红砂岩台阶 | 双平滑红砂岩台阶 | double_stone_block_slab3 | 1 | smooth_red_sandstone_double_slab | 0 | +| 双磨制安山岩台阶 | 双磨制安山岩台阶 | double_stone_block_slab3 | 2 | polished_andesite_double_slab | 0 | +| 双安山岩台阶 | 双安山岩台阶 | double_stone_block_slab3 | 3 | andesite_double_slab | 0 | +| 双闪长岩台阶 | 双闪长岩台阶 | double_stone_block_slab3 | 4 | diorite_double_slab | 0 | +| 双磨制闪长岩台阶 | 双磨制闪长岩台阶 | double_stone_block_slab3 | 5 | polished_diorite_double_slab | 0 | +| 双花岗岩台阶 | 双花岗岩台阶 | double_stone_block_slab3 | 6 | granite_double_slab | 0 | +| 双磨制花岗岩台阶 | 双磨制花岗岩台阶 | double_stone_block_slab3 | 7 | polished_granite_double_slab | 0 | +| 双平滑石英台阶 | 双平滑石英台阶 | double_stone_block_slab4 | 1 | smooth_quartz_double_slab | 0 | +| 双石台阶 | 双石台阶 | double_stone_block_slab4 | 2 | normal_stone_double_slab | 0 | +| 双切制砂岩台阶 | 双切制砂岩台阶 | double_stone_block_slab4 | 3 | cut_sandstone_double_slab | 0 | +| 双切制红砂岩台阶 | 双切制红砂岩台阶 | double_stone_block_slab4 | 4 | cut_red_sandstone_double_slab | 0 | +| 雕纹砂岩 | 雕纹砂岩 | sandstone | 1 | chiseled_sandstone | 0 | +| 切制砂岩 | 切制砂岩 | sandstone | 2 | cut_sandstone | 0 | +| 平滑砂岩 | 平滑砂岩 | sandstone | 3 | smooth_sandstone | 0 | +| 暗海晶石 | 暗海晶石 | prismarine | 1 | dark_prismarine | 0 | +| 海晶石砖 | 海晶石砖 | prismarine | 2 | prismarine_bricks | 0 | +| 红沙 | 红沙 | sand | 1 | red_sand | 0 | +| 雕纹石英块 | 雕纹石英块 | quartz_block | 1 | chiseled_quartz_block | 0 | +| 石英柱 | 石英柱 | quartz_block | 2 | quartz_pillar | 0 | +| 平滑石英块 | 平滑石英块 | quartz_block | 3 | smooth_quartz | 0 | +| 雕纹红砂岩 | 雕纹红砂岩 | red_sandstone | 1 | chiseled_red_sandstone | 0 | +| 切制红砂岩 | 切制红砂岩 | red_sandstone | 2 | cut_red_sandstone | 0 | +| 平滑红砂岩 | 平滑红砂岩 | red_sandstone | 3 | smooth_red_sandstone | 0 | +| 开裂的铁砧 | 开裂的铁砧 | anvil | 4 | chipped_anvil | 0 | +| 损坏的铁砧 | 损坏的铁砧 | anvil | 8 | damaged_anvil | 0 | +| 砂土 | 砂土 | dirt | 1 | coarse_dirt | 0 | +| 苔石墙 | 苔石墙 | cobblestone_wall | 1 | mossy_cobblestone_wall | 0 | +| 花岗岩墙 | 花岗岩墙 | cobblestone_wall | 2 | granite_wall | 0 | +| 闪长岩墙 | 闪长岩墙 | cobblestone_wall | 3 | diorite_wall | 0 | +| 安山岩墙 | 安山岩墙 | cobblestone_wall | 4 | andesite_wall | 0 | +| 砂岩墙 | 砂岩墙 | cobblestone_wall | 5 | sandstone_wall | 0 | +| 红砖墙 | 红砖墙 | cobblestone_wall | 6 | brick_wall | 0 | +| 石砖墙 | 石砖墙 | cobblestone_wall | 7 | stone_brick_wall | 0 | +| 苔石砖墙 | 苔石砖墙 | cobblestone_wall | 8 | mossy_stone_brick_wall | 0 | +| 下界砖墙 | 下界砖墙 | cobblestone_wall | 9 | nether_brick_wall | 0 | +| 末地石砖墙 | 末地石砖墙 | cobblestone_wall | 10 | end_stone_brick_wall | 0 | +| 海晶石墙 | 海晶石墙 | cobblestone_wall | 11 | prismarine_wall | 0 | +| 红砂岩墙 | 红砂岩墙 | cobblestone_wall | 12 | red_sandstone_wall | 0 | +| 红色下界砖墙 | 红色下界砖墙 | cobblestone_wall | 13 | red_nether_brick_wall | 0 | +| 湿海绵 | 湿海绵 | sponge | 1 | wet_sponge | 0 | + +### 仅名称变更(内容不变) + +| 新中文名 | 旧中文名 | 英文命名 | 附加值 | +| --- | --- | --- | --- | +| 橡木门 | 木门 | wooden_door | 0 | +| 双绯红木台阶 | 绯红木双层台阶 | crimson_double_slab | 0 | +| 双诡异木台阶 | 诡异木双层台阶 | warped_double_slab | 0 | +| 双深板岩圆石台阶 | 深板岩圆石双层台阶 | cobbled_deepslate_double_slab | 0 | +| 双磨制深板岩台阶 | 磨制深板岩双层台阶 | polished_deepslate_double_slab | 0 | +| 双深板岩瓦台阶 | 深板岩瓦双层台阶 | deepslate_tile_double_slab | 0 | +| 双深板岩砖台阶 | 深板岩砖双层台阶 | deepslate_brick_double_slab | 0 | +| 悬挂式云杉木告示牌 | 云杉木悬挂告示牌 | spruce_hanging_sign | 0 | +| 悬挂式白桦木告示牌 | 白桦木悬挂告示牌 | birch_hanging_sign | 0 | +| 悬挂式金合欢木告示牌 | 金合欢木悬挂告示牌 | acacia_hanging_sign | 0 | +| 悬挂式深色橡木告示牌 | 深色橡木悬挂告示牌 | dark_oak_hanging_sign | 0 | +| 双樱花木台阶 | 樱花木双层台阶 | cherry_double_slab | 0 | + +### 新增项 + +| 中文名称 | 英文命名 | 附加值 | +| --- | --- | --- | +| 双平滑石头台阶 | smooth_stone_double_slab | 0 | +| 下界砖 | nether_brick | 0 | +| 骷髅模型 | skeleton_skull | 0 | +| 潜声感测器 | sculk_sensor | 0 | +| 荧光物品展示框 | glow_frame | 0 | +| 潜声 | sculk | 0 | +| 红树木门 | mangrove_door | 0 | +| 红树木告示牌 | mangrove_standing_sign | 0 | +| 双红树木台阶 | mangrove_double_slab | 0 | +| 悬挂式橡木告示牌 | oak_hanging_sign | 0 | +| 悬挂式丛林木告示牌 | jungle_hanging_sign | 0 | +| 悬挂式绯红木告示牌 | crimson_hanging_sign | 0 | +| 悬挂式诡异木告示牌 | warped_hanging_sign | 0 | +| 悬挂式红树木告示牌 | mangrove_hanging_sign | 0 | +| 悬挂式竹告示牌 | bamboo_hanging_sign | 0 | +| 悬挂式樱花木告示牌 | cherry_hanging_sign | 0 | +| 光源方块-亮度1 | light_block_1 | 0 | +| 光源方块-亮度2 | light_block_2 | 0 | +| 光源方块-亮度3 | light_block_3 | 0 | +| 光源方块-亮度4 | light_block_4 | 0 | +| 光源方块-亮度5 | light_block_5 | 0 | +| 光源方块-亮度6 | light_block_6 | 0 | +| 光源方块-亮度7 | light_block_7 | 0 | +| 光源方块-亮度8 | light_block_8 | 0 | +| 光源方块-亮度9 | light_block_9 | 0 | +| 光源方块-亮度10 | light_block_10 | 0 | +| 光源方块-亮度11 | light_block_11 | 0 | +| 光源方块-亮度12 | light_block_12 | 0 | +| 光源方块-亮度13 | light_block_13 | 0 | +| 光源方块-亮度14 | light_block_14 | 0 | +| 光源方块-亮度15 | light_block_15 | 0 | +| 紫珀柱 | purpur_pillar | 0 | +| 凋灵骷髅模型 | wither_skeleton_skull | 0 | +| 僵尸模型 | zombie_head | 0 | +| 模型 | player_head | 0 | +| 苦力怕模型 | creeper_head | 0 | +| 龙的模型 | dragon_head | 0 | +| 猪灵模型 | piglin_head | 0 | +| 苍白橡木按钮 | pale_oak_button | 0 | +| 苍白橡木门 | pale_oak_door | 0 | +| 苍白橡木栅栏 | pale_oak_fence | 0 | +| 苍白橡木栅栏大门 | pale_oak_fence_gate | 0 | +| 苍白橡木悬挂告示牌 | pale_oak_hanging_sign | 0 | +| 去皮苍白橡树原木 | stripped_pale_oak_log | 0 | +| 苍白橡树原木 | pale_oak_log | 0 | +| 苍白橡木木板 | pale_oak_planks | 0 | +| 苍白橡木压力板 | pale_oak_pressure_plate | 0 | +| 苍白橡木台阶 | pale_oak_slab | 0 | +| 苍白橡木双台阶 | pale_oak_double_slab | 0 | +| 苍白橡木楼梯 | pale_oak_stairs | 0 | +| 苍白橡木活板门 | pale_oak_trapdoor | 0 | +| 去皮苍白橡木 | stripped_pale_oak_wood | 0 | +| 苍白橡木 | pale_oak_wood | 0 | +| 苍白橡木树苗 | pale_oak_sapling | 0 | +| 苍白橡木树叶 | pale_oak_leaves | 0 | +| 苍白苔藓块 | pale_moss_block | 0 | +| 苍白苔藓地毯 | pale_moss_carpet | 0 | +| 苍白垂须 | pale_hanging_moss | 0 | +| 嘎枝之心 | creaking_heart | 0 | +| 树脂砖块 | resin_bricks | 0 | +| 树脂砖台阶 | resin_brick_slab | 0 | +| 双树脂砖台阶 | resin_brick_double_slab | 0 | +| 树脂砖楼梯 | resin_brick_stairs | 0 | +| 树脂砖墙 | resin_brick_wall | 0 | +| 张开的眼眸花 | open_eyeblossom | 0 | +| 闭合的眼眸花 | closed_eyeblossom | 0 | +| 雕纹树脂砖块 | chiseled_resin_bricks | 0 | +| 树脂块 | resin_block | 0 | +| 树脂团 | resin_clump | 0 | + +### 移除项 + +| 中文名称 | 英文命名 | 附加值 | +| --- | --- | --- | +| 石头双层台阶 | double_stone_block_slab | 0 | +| 蘑菇 | brown_mushroom_block | 0 | +| 下界砖块 | nether_brick | 0 | +| 生物头颅 | skull | 0 | +| 紫珀柱子 | purpur_block | 2 | +| 幽匿感测体 | sculk_sensor | 0 | +| 幽匿块 | sculk | 0 | +| 红树林门 | mangrove_door | 0 | +| 红树林告示牌 | mangrove_standing_sign | 0 | +| 双红树林台阶 | mangrove_double_slab | 0 | +| 橡树悬挂告示牌 | oak_hanging_sign | 0 | +| 丛林悬挂告示牌 | jungle_hanging_sign | 0 | +| 绯红悬挂告示牌 | crimson_hanging_sign | 0 | +| 翘曲悬挂告示牌 | warped_hanging_sign | 0 | +| 红树林悬挂告示牌 | mangrove_hanging_sign | 0 | +| 竹制悬挂告示牌 | bamboo_hanging_sign | 0 | +| 樱花悬挂告示牌 | cherry_hanging_sign | 0 | diff --git a/docs/mcguide/20-玩法开发/20-物理玩法开发/1-物理的使用指南.md b/docs/mcguide/20-玩法开发/20-物理玩法开发/1-物理的使用指南.md new file mode 100644 index 00000000..288b270e --- /dev/null +++ b/docs/mcguide/20-玩法开发/20-物理玩法开发/1-物理的使用指南.md @@ -0,0 +1,258 @@ +# 物理的使用指南 + +## 使用准则与免责声明 + +### 使用准则 + +- 仅限第三方用户生成内容(UGC)使用 +- 只有创作者创建的自定义实体才能与物理刚体绑定,原版实体无法与PhysX创建的刚体绑定 +- 物理身件可以与其他游戏物件(包括原生游戏物件)产生互动,但是原生游戏物件与其他原生游戏物件之间的互动方式及物理碰撞不会被改变 +- 当两个碰撞同时发生时,核心游戏的物理引擎具有最高优先级 + +只有满足上述条件,您的模组才能符合要求进行上架 + +### 免责声明 + +物理相关api与特性,可能会在将来调整并且不向前兼容。请随时做好调整的准备 + +但是,每次调整都会做出充分的预告和调整内容公告,方便你对您的模组进行最新内容的兼容。 + +## 准备工作 + +由于我们的物理引擎是用的 NVIDIA PhysX,您可以先前往NVIDIA官网下载PhysX Visual Debugger,方便后续调试。 + +[https://developer.nvidia.com/physx-visual-debugger](https://developer.nvidia.com/physx-visual-debugger) + +![img.png](./picture/physx/img_2.png) + +## 全局配置 + +在使用物理引擎之前,您需要在模组的 behavior_packs 行为包中新增 physx_setting.json 全局配置文件 + +![img.png](./picture/physx/img.png) + +文件里面需要设置成 + +```json +{ + "enable": true +} +``` + +保存后,您的模组可以正常使用 PhysX 物理引擎了。 + +## 开始创作 + +现在我会通过demo,来向你介绍physx能做的内容 + +### 创建自定义刚体 + +使用物理内容的之前,您首先需要创建一个新的物理刚体,物理刚体**必须**绑定在`自定义实体`上,且创建刚体的方法只能在 `AddEntityServerEvent` 事件中使用 + +```python +# 创建一个自定义刚体 +comp = serverApi.GetEngineCompFactory().CreatePhysx(entityId) +comp.CreatePxActor() +``` + +现在你已经为这个 entityId 的实体添加了一个物理刚体 + +> 注意: 刚体创建数量不得大于 8192, 虽然Physx限制是31767,但是我们需要预留一些刚体阈值给到其他实体和客户端内容 + +> 注意:必须要在 AddEntityServerEvent 事件中创建刚体,否则会报错 + +> 注意:实体必须绑定在 自定义实体上,不得绑定在原版实体上 + +### 添加包围盒 + +目前这个刚体暂时没有任何功能和属性,为了让它能够正常工作,我们需要给刚体添加一些属性 + +首先需要添加包围盒,包围盒是刚体的基本属性,你只有添加了包围盒,才能让刚体与世界实体进行交互 + +添加包围盒的方法是 AddBoxGeometry ,参数方法如下 + +```python +# localTransform tuple(float,float,float) 盒子中心相对实体原点的偏移 +# halfX float 表示盒子长度的一半 +# halfY float 表示盒子高度的一半 +# halfZ float 表示盒子宽度的一半 +# staticFriction float 静摩擦系数 +# dynamicFriction float 动摩擦系数,默认为e 注意:此摩擦力设置为0,并不代表刚体与原生游戏交互也是 0 摩擦力 +# restitution float 弹性恢复系数,默认为0 +# eventMask int PxEventMask枚举,用于监听碰撞事件,默认为PxRigidBodyFlag.Null,即不需要碰撞事件 +# userData None或str 可记录自定义数据,长度不超过20,默认为None +comp.AddBoxGeometry((0, 0.9, 0), 0.3, 0.9, 0.3, 0.05, 0.05, 0, PxEventMask.Server | PxEventMask.Found, None) +``` + +PxEventMask 枚举目前有六个 + +- PxEventMask.Server 服务端事件 +- PxEventMask.Client 客户端事件 +- PxEventMask.Lost 结束碰撞事件 +- PxEventMask.Found 开始碰撞事件 +- PxEventMask.Found_Detail 碰撞事件的详细信息 +- PxEventMask.Null 该刚体不附加任何事件 + +此时你已经成功为你的刚体创建好了包围盒 + +当你启动游戏时,如果你此时提前打开了 PhysX Visual Debugger,那么刚体的包围盒就会显示出来了 + +![img.png](./picture/physx/img_3.png) + +红色代表世界的原生方块、绿色和黄色代表刚体的包围盒 + +![img.png](./picture/physx/img_4.png) + +### 添加约束和运动 + +如果你想给刚体添加一些约束,比如刚体的运动锁定某个轴体,您需要添加动态约束 + +```python +# 下面的方法是规定此刚体只会沿着 X Y Z 轴运动 +comp.SetRigidDynamicLockFlags(PxRigidDynamicLockFlag.eLOCK_ANGULAR_X | PxRigidDynamicLockFlag.eLOCK_ANGULAR_Y | PxRigidDynamicLockFlag.eLOCK_ANGULAR_Z) +``` + +PxRigidDynamicLockFlag 枚举目前有六个 + +- PxRigidDynamicLockFlag.eLOCK_ANGULAR_X 锁定沿着 X 轴运动 +- PxRigidDynamicLockFlag.eLOCK_ANGULAR_Y 锁定沿着 Y 轴运动 +- PxRigidDynamicLockFlag.eLOCK_ANGULAR_Z 锁定沿着 Z 轴运动 +- PxRigidDynamicLockFlag.eLOCK_LINEAR_X 锁定沿着 X 轴旋转 +- PxRigidDynamicLockFlag.eLOCK_LINEAR_Y 锁定沿着 Y 轴旋转 +- PxRigidDynamicLockFlag.eLOCK_LINEAR_Z 锁定沿着 Z 轴旋转 + +如果你希望您的刚体具有运动的属性,你需要将刚体设置为运动学刚体 + +那什么叫做有运动的属性? +比如你想要手动控制刚体的运动,那么你需要将刚体设置为运动学刚体 +包括做成刚体风车、刚体传送带等行为 + +```python +# 目前PxRigdiBodyFlag 仅支持PxRigidBodyFlag.eKINEMATIC +comp.SetRigidBodyFlag(PxRigidBodyFlag.eKINEMATIC, True) +``` + +### AI控制 + +利用实体创建刚体,您需要对AI进行调整 +否则在客户端会出现悬空的情况 + +```python +comp = serverApi.GetEngineCompFactory().CreateControlAi(entityId) +comp.SetBlockControlAi(False) +``` + +### 做一个简单的风车 + +对此我们可以通过上述内容做一个简单的风车,我们计划是配合方块调色板 + 物理引擎来做一个简单的风车 + +机械动力的风车是一个比较不错的参考对象 + +我们仿照机械动力的风车,来做一个中国版物理引擎的风车 + +首先根据上面介绍的内容,我们依次创建刚体,设置包围盒 + +但是原版Java版机械动力的风车,可以自由组合方块,所以我们需要一个刚体对应一个方块。目前规划是创建一个长度5格的刚体 + +可以做一个for循环 + +```python +for i in range(2): + for j in range(-2,3): + comp.AddBoxGeometry((j, 0.5 + i, 0), 0.5, 0.5, 0.5, 0.05, 0.05, 0, + PxEventMask.Server | PxEventMask.Client | PxEventMask.Found | PxEventMask.Found_Detail | PxEventMask.Lost, + '%s,%s,0' % (j, i)) +``` + +此时就会创建一个总长度 5 格的刚体包围盒,并且每个刚体对应一个方块 + +因为这个刚体会有旋转的效果,所以我们需要给刚体添加一个运动属性 + +```python +# 目前PxRigdiBodyFlag 仅支持PxRigidBodyFlag.eKINEMATIC +comp.SetRigidBodyFlag(PxRigidBodyFlag.eKINEMATIC, True) +``` + +因为刚体旋转是通过传入一个四元数并对四元数调整来达到目标的 + +所以我们需要创建一个四元数组 + +```python +# 这里建议用一个成员变量来做存储,方便删除实体后对数据进行调整和删除 +self.mSkeletons[entityId] = Quaternion(0, 0, 0, 1) +``` + +因为旋转是一个连续的过程,所以我们需要重写Update方法,以达到每tick刷新我们的旋转数据 + +```python +# 这里我们对 self.mSkeletons 进行遍历,获取刚刚存储好的四元数,修改的同时传入刚体运动方法 +for entityId, v in self.mSkeletons.iteritems(): + # 旋转 + q = v * Quaternion.AngleAxis(1, Vector3.Up()) + # 修改变量值 + self.mSkeletons[entityId] = q + # 设置为运动学目标 + comp = serverApi.GetEngineCompFactory().CreatePhysx(entityId) + # 运动 + comp.SetKinematicTarget(None, q.ToTuple()) +``` + +此时刚体就会每tick旋转角度 + +但是目前做的内容仅仅只是对刚体进行了旋转,客户端没有表现,我们还需要用方块调色板对客户端进行调试 + +首先创建一个调色板 + +```python +dataDict = {'extra': {}, 'void': False, 'actor': {}, 'volume': (1, 5, 2), 'common': {('minecraft:grass_block', 0): [4, 9], ('minecraft:glass', 0): [1, 6], ('minecraft:quartz_block', 0): [3, 8], ('minecraft:white_wool', 0): [0, 5], ('minecraft:oak_planks', 0): [2, 7]}, 'eliminateAir': True} +comp = compFactory.CreateBlock(levelId) +palette = comp.GetBlankBlockPalette() +palette.DeserializeBlockPalette(dataDict) +blockGeometryComp = compFactory.CreateBlockGeometry(levelId) +geometryName = blockGeometryComp.CombineBlockPaletteToGeometry(palette,"my_block_geometry") +``` + +然后需要将调色板绑定在实体上,但是绑定刚体是欧拉角,也就是说我们还需要将四元数转成欧拉角 + +好在,ModSDK提供了这个简单的方法,物理引擎也有获取客户端刚体的四元数数据 + +```python +actorRenderComp = compFactory.CreateActorRender(entityId) +comp = compFactory.CreatePhysx(entityId) +q = Quaternion(comp.GetQuaternion()) +# AddActorBlockGeometry 在 3.7 新增了一个参数, 会控制先旋转后偏移,还是先偏移后旋转。默认是False +# 为了做风车,我们设置为 True,也就是先旋转再偏移 +actorRenderComp.AddActorBlockGeometry(geometryName, (-2, 0, 0), q.EulerAngles().ToTuple(), True) +self.mSkeletons.add(entityId) +``` + +此时刚体的方块调色板就已经绑定在实体上了,但是这个我们查看 PhysX Visual Debugger 时,发现刚体变动了,但是调色板方块没有变化 + +所以我们也要对客户端表现进行调整 + +同样需要重写 Update 方法,每tick修改方块调色板的旋转角度 + +```python +def Update(self): + for entityId in self.mSkeletons: + comp = compFactory.CreatePhysx(entityId) + q = comp.GetQuaternion() + if q: + q = Quaternion(q) + actorRenderComp = compFactory.CreateActorRender(entityId) + actorRenderComp.SetActorBlockGeometryRotation("my_block_geometry", q.EulerAngles().ToTuple()) +``` + +当全部完成后,就可以做到风车围绕着一个自定义实体进行旋转,然后推动实体进行移动了 + +并且你也可以站在这个刚体上,但是站在刚体上,刚体并不会带着玩家一起移动,开发者们可以自行思考解决办法来处理这个问题! + +![img_5.png](./picture/physx/img_5.png) + +### 思考 + +虽然我们现在是在用 Update 的方式去动态的调整刚体旋转和外观旋转 + +但是进入游戏后会发现,用此方法来旋转会有一点的顿挫感,虽然影响不是很大,但如果你需要追求细致,可能还不算太完美 + +或许还可以通过 `GameRenderTickEvent` 来调整,但是这个方法笔者并没有使用过,所以需要开发者们自行思考研究 diff --git a/package-lock.json b/package-lock.json index a2327dd4..77eff61a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -431,456 +431,6 @@ } } }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.1.tgz", - "integrity": "sha512-kfYGy8IdzTGy+z0vFGvExZtxkFlA4zAxgKEahG9KE1ScBjpQnFsNOX8KTU5ojNru5ed5CVoJYXFtoxaq5nFbjQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.1.tgz", - "integrity": "sha512-dp+MshLYux6j/JjdqVLnMglQlFu+MuVeNrmT5nk6q07wNhCdSnB7QZj+7G8VMUGh1q+vj2Bq8kRsuyA00I/k+Q==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.1.tgz", - "integrity": "sha512-50tM0zCJW5kGqgG7fQ7IHvQOcAn9TKiVRuQ/lN0xR+T2lzEFvAi1ZcS8DiksFcEpf1t/GYOeOfCAgDHFpkiSmA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.1.tgz", - "integrity": "sha512-GCj6WfUtNldqUzYkN/ITtlhwQqGWu9S45vUXs7EIYf+7rCiiqH9bCloatO9VhxsL0Pji+PF4Lz2XXCES+Q8hDw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.1.tgz", - "integrity": "sha512-5hEZKPf+nQjYoSr/elb62U19/l1mZDdqidGfmFutVUjjUZrOazAtwK+Kr+3y0C/oeJfLlxo9fXb1w7L+P7E4FQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.1.tgz", - "integrity": "sha512-hxVnwL2Dqs3fM1IWq8Iezh0cX7ZGdVhbTfnOy5uURtao5OIVCEyj9xIzemDi7sRvKsuSdtCAhMKarxqtlyVyfA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.1.tgz", - "integrity": "sha512-1MrCZs0fZa2g8E+FUo2ipw6jw5qqQiH+tERoS5fAfKnRx6NXH31tXBKI3VpmLijLH6yriMZsxJtaXUyFt/8Y4A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.1.tgz", - "integrity": "sha512-0IZWLiTyz7nm0xuIs0q1Y3QWJC52R8aSXxe40VUxm6BB1RNmkODtW6LHvWRrGiICulcX7ZvyH6h5fqdLu4gkww==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.1.tgz", - "integrity": "sha512-NdKOhS4u7JhDKw9G3cY6sWqFcnLITn6SqivVArbzIaf3cemShqfLGHYMx8Xlm/lBit3/5d7kXvriTUGa5YViuQ==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.1.tgz", - "integrity": "sha512-jaN3dHi0/DDPelk0nLcXRm1q7DNJpjXy7yWaWvbfkPvI+7XNSc/lDOnCLN7gzsyzgu6qSAmgSvP9oXAhP973uQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.1.tgz", - "integrity": "sha512-OJykPaF4v8JidKNGz8c/q1lBO44sQNUQtq1KktJXdBLn1hPod5rE/Hko5ugKKZd+D2+o1a9MFGUEIUwO2YfgkQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.1.tgz", - "integrity": "sha512-nGfornQj4dzcq5Vp835oM/o21UMlXzn79KobKlcs3Wz9smwiifknLy4xDCLUU0BWp7b/houtdrgUz7nOGnfIYg==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.1.tgz", - "integrity": "sha512-1osBbPEFYwIE5IVB/0g2X6i1qInZa1aIoj1TdL4AaAb55xIIgbg8Doq6a5BzYWgr+tEcDzYH67XVnTmUzL+nXg==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.1.tgz", - "integrity": "sha512-/6VBJOwUf3TdTvJZ82qF3tbLuWsscd7/1w+D9LH0W/SqUgM5/JJD0lrJ1fVIfZsqB6RFmLCe0Xz3fmZc3WtyVg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.1.tgz", - "integrity": "sha512-nSut/Mx5gnilhcq2yIMLMe3Wl4FK5wx/o0QuuCLMtmJn+WeWYoEGDN1ipcN72g1WHsnIbxGXd4i/MF0gTcuAjQ==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.1.tgz", - "integrity": "sha512-cEECeLlJNfT8kZHqLarDBQso9a27o2Zd2AQ8USAEoGtejOrCYHNtKP8XQhMDJMtthdF4GBmjR2au3x1udADQQQ==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.1.tgz", - "integrity": "sha512-xbfUhu/gnvSEg+EGovRc+kjBAkrvtk38RlerAzQxvMzlB4fXpCFCeUAYzJvrnhFtdeyVCDANSjJvOvGYoeKzFA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.1.tgz", - "integrity": "sha512-O96poM2XGhLtpTh+s4+nP7YCCAfb4tJNRVZHfIE7dgmax+yMP2WgMd2OecBuaATHKTHsLWHQeuaxMRnCsH8+5g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.1.tgz", - "integrity": "sha512-X53z6uXip6KFXBQ+Krbx25XHV/NCbzryM6ehOAeAil7X7oa4XIq+394PWGnwaSQ2WRA0KI6PUO6hTO5zeF5ijA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.1.tgz", - "integrity": "sha512-Na9T3szbXezdzM/Kfs3GcRQNjHzM6GzFBeU1/6IV/npKP5ORtp9zbQjvkDJ47s6BCgaAZnnnu/cY1x342+MvZg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.1.tgz", - "integrity": "sha512-T3H78X2h1tszfRSf+txbt5aOp/e7TAz3ptVKu9Oyir3IAOFPGV6O9c2naym5TOriy1l0nNf6a4X5UXRZSGX/dw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.1.tgz", - "integrity": "sha512-2H3RUvcmULO7dIE5EWJH8eubZAI4xw54H1ilJnRNZdeo8dTADEZ21w6J22XBkXqGJbe0+wnNJtw3UXRoLJnFEg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.1.tgz", - "integrity": "sha512-GE7XvrdOzrb+yVKB9KsRMq+7a2U/K5Cf/8grVFRAGJmfADr/e/ODQ134RK2/eeHqYV5eQRFxb1hY7Nr15fv1NQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.1.tgz", - "integrity": "sha512-uOxSJCIcavSiT6UnBhBzE8wy3n0hOkJsBOzy7HDAuTDE++1DJMRRVCPGisULScHL+a/ZwdXPpXD3IyFKjA7K8A==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.1.tgz", - "integrity": "sha512-Y1EQdcfwMSeQN/ujR5VayLOJ1BHaK+ssyk0AEzPjC+t1lITgsnccPqFjb6V+LsTp/9Iov4ysfjxLaGJ9RPtkVg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, "node_modules/@iconify-json/simple-icons": { "version": "1.2.28", "resolved": "https://registry.npmjs.org/@iconify-json/simple-icons/-/simple-icons-1.2.28.tgz",