网易我的世界论坛

标题: 【教程】Mod SDK库使用说明 [打印本页]

作者: 雾都漫游者    时间: 2019-9-20 10:20
标题: 【教程】Mod SDK库使用说明
本帖最后由 雾都漫游者 于 2019-9-25 09:44 编辑

MC Studio版本0.11.0 更新了一项新功能:在关卡编辑器,通过菜单“脚本”->“安装Mod SDK库”可添加伪代码库,为编写代码提供智能提示。
需要注意:当前仍为测试版本,且针对的SDK版本是1.15的,所以暂时不能用这个库来开发要在1.14上线的组件。
以下是使用教程,如果有任何建议,请在此帖后面回复,谢谢大家。
-----------------------------
[attach]911788[/attach][attach]911787[/attach]






作者: MC和编程    时间: 2019-9-22 09:07
为何我的MC Studio还在0.10.6?
作者: 雾都漫游者    时间: 2019-9-23 09:40
MC和编程 发表于 2019-9-22 09:07
为何我的MC Studio还在0.10.6?

预计这两天更新,上周碰到些问题需要修复
作者: 黑曜石网络    时间: 2019-10-9 14:21
在ide导入这个包后,无法过开发者后台机审,麻烦把这个加下白名单
作者: 雾都漫游者    时间: 2019-10-10 20:15
黑曜石网络 发表于 2019-10-9 14:21
在ide导入这个包后,无法过开发者后台机审,麻烦把这个加下白名单

谢谢反馈,明天会更新
作者: 雾都漫游者    时间: 2019-10-10 20:31
黑曜石网络 发表于 2019-10-9 14:21
在ide导入这个包后,无法过开发者后台机审,麻烦把这个加下白名单

你这个组件ID是多少,我们验证一下
作者: 黑曜石网络    时间: 2019-10-12 10:45
雾都漫游者 发表于 2019-10-10 20:31
你这个组件ID是多少,我们验证一下

4632071407474619211

组件ID,用于测试用的。
作者: 黑曜石网络    时间: 2019-10-12 10:46
给的提示是引用一个空的函数的返回值
作者: Minehero-境界    时间: 2019-10-12 10:54
黑曜石网络 发表于 2019-10-12 10:46
给的提示是引用一个空的函数的返回值

是不是函数没有返回任何东西然后赋值给另一个变量了
作者: 黑曜石网络    时间: 2019-10-12 16:55
Minehero-境界 发表于 2019-10-12 10:54
是不是函数没有返回任何东西然后赋值给另一个变量了

是的
作者: 黑曜石网络    时间: 2019-10-21 10:36
组件ID:4632511119295203360, 失败原因: [ { "code_check": [ { "message": "method already defined line 196", "obj": "ModServerSystem.setEntityHealth", "column": 4, "path": "/tmp/PackScripts/item_4632511119295203360_4_v4_80wfxp7a/behavior_Pack/aviationScripts/modServer/serverSystem.py", "line": 412, "message-id": "E0102", "type": "error", "symbol": "function-redefined", "module": "aviationScripts.modServer.serverSystem" } ], "module_check": null, "api_check": null, "file": "/tmp/PackScripts/item_4632511119295203360_4_v4_80wfxp7a/behavior_Pack/aviationScripts/modServer/serverSystem.py" }, { "code_check": [ { "message": "Module 'aviationScripts.modClient.data.ClientData' has no 'ButtonPos' member; maybe 'ButtonPos7'?", "obj": "AviationUIScreen.Init", "column": 49, "path": "/tmp/PackScripts/item_4632511119295203360_4_v4_80wfxp7a/behavior_Pack/aviationScripts/modClient/ui/aviation.py", "line": 33, "message-id": "E1101", "type": "error", "symbol": "no-member", "module": "aviationScripts.modClient.ui.aviation" }, { "message": "Module 'aviationScripts.modClient.data.ClientData' has no 'ButtonPos' member; maybe 'ButtonPos7'?", "obj": "AviationUIScreen.Init", "column": 74, "path": "/tmp/PackScripts/item_4632511119295203360_4_v4_80wfxp7a/behavior_Pack/aviationScripts/modClient/ui/aviation.py", "line": 33, "message-id": "E1101", "type": "error", "symbol": "no-member", "module": "aviationScripts.modClient.ui.aviation" }, { "message": "Module 'aviationScripts.modClient.data.ClientData' has no 'ButtonPos' member; maybe 'ButtonPos7'?", "obj": "AviationUIScreen.Init", "column": 49, "path": "/tmp/PackScripts/item_4632511119295203360_4_v4_80wfxp7a/behavior_Pack/aviationScripts/modClient/ui/aviation.py", "line": 34, "message-id": "E1101", "type": "error", "symbol": "no-member", "module": "aviationScripts.modClient.ui.aviation" }, { "message": "Module 'aviationScripts.modClient.data.ClientData' has no 'ButtonPos' member; maybe 'ButtonPos7'?", "obj": "AviationUIScreen.Init", "column": 74, "path": "/tmp/PackScripts/item_4632511119295203360_4_v4_80wfxp7a/behavior_Pack/aviationScripts/modClient/ui/aviation.py", "line": 34, "message-id": "E1101", "type": "error", "symbol": "no-member", "module": "aviationScripts.modClient.ui.aviation" }, { "message": "Module 'aviationScripts.modClient.data.ClientData' has no 'ButtonPos' member; maybe 'ButtonPos7'?", "obj": "AviationUIScreen.Init", "column": 49, "path": "/tmp/PackScripts/item_4632511119295203360_4_v4_80wfxp7a/behavior_Pack/aviationScripts/modClient/ui/aviation.py", "line": 35, "message-id": "E1101", "type": "error", "symbol": "no-member", "module": "aviationScripts.modClient.ui.aviation" }, { "message": "Module 'aviationScripts.modClient.data.ClientData' has no 'ButtonPos' member; maybe 'ButtonPos7'?", "obj": "AviationUIScreen.Init", "column": 74, "path": "/tmp/PackScripts/item_4632511119295203360_4_v4_80wfxp7a/behavior_Pack/aviationScripts/modClient/ui/aviation.py", "line": 35, "message-id": "E1101", "type": "error", "symbol": "no-member", "module": "aviationScripts.modClient.ui.aviation" } ], "module_check": null, "api_check": null, "file": "/tmp/PackScripts/item_4632511119295203360_4_v4_80wfxp7a/behavior_Pack/aviationScripts/modClient/ui/aviation.py" } ]
作者: 黑曜石网络    时间: 2019-10-23 16:14
雾都漫游者 发表于 2019-10-10 20:31
你这个组件ID是多少,我们验证一下

组件ID:4634814314477920847(RedstoneArmor)

以第一段报错为例:

  1. {
  2.   "code_check": [
  3.     {
  4.       "message": "Assigning to function call which doesn't return",
  5.       "obj": "",
  6.       "column": 0,
  7.       "path": "/tmp/PackScripts/item_4634814314477920847_1_v1_ck0n1o3h/behavior_Packs/redstoneArmorScripts/modServer/__init__.py",
  8.       "line": 6,
  9.       "message-id": "E1111",
  10.       "type": "error",
  11.       "symbol": "assignment-from-no-return",
  12.       "module": "redstoneArmorScripts.modServer"
  13.     },
  14.     {
  15.       "message": "Assigning to function call which doesn't return",
  16.       "obj": "",
  17.       "column": 0,
  18.       "path": "/tmp/PackScripts/item_4634814314477920847_1_v1_ck0n1o3h/behavior_Packs/redstoneArmorScripts/modServer/__init__.py",
  19.       "line": 7,
  20.       "message-id": "E1111",
  21.       "type": "error",
  22.       "symbol": "assignment-from-no-return",
  23.       "module": "redstoneArmorScripts.modServer"
  24.     },
  25.     {
  26.       "message": "Assigning to function call which doesn't return",
  27.       "obj": "",
  28.       "column": 0,
  29.       "path": "/tmp/PackScripts/item_4634814314477920847_1_v1_ck0n1o3h/behavior_Packs/redstoneArmorScripts/modServer/__init__.py",
  30.       "line": 8,
  31.       "message-id": "E1111",
  32.       "type": "error",
  33.       "symbol": "assignment-from-no-return",
  34.       "module": "redstoneArmorScripts.modServer"
  35.     }
  36.   ],
  37.   "module_check": null,
  38.   "api_check": null,
  39.   "file": "/tmp/PackScripts/item_4634814314477920847_1_v1_ck0n1o3h/behavior_Packs/redstoneArmorScripts/modServer/__init__.py"
  40. }
复制代码


behavior_Packs/redstoneArmorScripts/modServer/__init__.py 的前八行分别是:

  1. # -*- coding: utf-8 -*-

  2. import mod.server.extraServerApi as serverApi
  3. from redstoneArmorScripts.modCommon import *

  4. ServerSystem = serverApi.GetServerSystemCls()
  5. SystemName = serverApi.GetEngineSystemName()
  6. Namespace = serverApi.GetEngineNamespace()
复制代码


GetServerSystemCls,GetEngineSystemName,和 GetEngineNamespace 均为官方 SDK 文档中提到的的内容,根本不应存在函数没有返回任何东西然后赋值给另一个变量,也就是 assignment-from-no-return 这样的问题。

作者: 雾都漫游者    时间: 2019-11-5 17:52
黑曜石网络 发表于 2019-10-23 16:14
组件ID:4634814314477920847(RedstoneArmor)

以第一段报错为例:

今天更新解决了这个问题,可以再试下




欢迎光临 网易我的世界论坛 (https://mc.netease.com/) Powered by Discuz! X3.3