|
modMain.py
- # -*- coding: utf-8 -*-
- from common.mod import Mod
- import mod.client.extraClientApi as clientApi
- import mod.server.extraServerApi as serverApi
- from modCommon import modConfig
- from typing import Any, Dict, List, Optional, Tuple, Union
- @Mod.Binding(name="ActorBlockGeometryMod", version="0.0.1")
- class NeteaseModVf4JPaVx(object):
- def __init__(self):
- pass
- @Mod.InitServer()
- def ActorBlockGeometryModServerInit(self):
- serverApi.RegisterSystem(modConfig.modName, modConfig.modServerSystem, modConfig.modServerSystemCls)
- @Mod.DestroyServer()
- def ActorBlockGeometryModServerDestroy(self):
- pass
- @Mod.InitClient()
- def ActorBlockGeometryModClientInit(self):
- clientApi.RegisterSystem(modConfig.modName, modConfig.modClientSystem, modConfig.modClientSystemCls)
- @Mod.DestroyClient()
- def ActorBlockGeometryModClientDestroy(self):
- pass
复制代码
报错如下:- [2023-08-15 00:51:11,079] [INFO][Developer] start readStudio
- LoadWindowsAddonPy: ActorBlockGeometryFFFDDScripts.modMain
- Traceback (most recent call last):
- File "mod/common/minecraftMod.py", line 802, in ImportModMain
- File "redirect.py", line 104, in load_module
- File "ActorBlockGeometryFFFDDScripts.modMain", line 7, in <module>
- ImportError: No module named typing
复制代码 另外,有注意到ModAPI的Python代码中也有导入typing,但不会出现问题,例如:
system.serverSystem.py
- # -*- coding: utf-8 -*-
- from typing import Union
- from typing import List
- from mod.common.system.baseSystem import BaseSystem
- from typing import Tuple
- class ServerSystem(BaseSystem):
- def BroadcastToAllClient(self, eventName, eventData):
- # type: (str, dict) -> None
- """
- 服务器广播事件到所有客户端
- """
- pass
- def NotifyToMultiClients(self, targetIdList, eventName, eventData):
- # type: (List[str], str, dict) -> None
- """
- 服务器发送事件到指定一批客户端,相比于在for循环内使用NotifyToClient性能更好
- """
- pass
- def NotifyToClient(self, targetId, eventName, eventData):
- # type: (str, str, dict) -> None
- """
- 服务器发送事件到指定客户端
- """
- pass
- def CreateEngineEntityByTypeStr(self, engineTypeStr, pos, rot, dimensionId=0, isNpc=False):
- # type: (str, Tuple[float,float,float], Tuple[float,float], int, bool) -> Union[str,None]
- """
- 创建指定identifier的实体
- """
- pass
- def CreateEngineItemEntity(self, itemDict, dimensionId=0, pos=(0, 0, 0)):
- # type: (dict, int, Tuple[float,float,float]) -> Union[str,None]
- """
- 用于创建物品实体(即掉落物),返回物品实体的entityId
- """
- pass
- def DestroyEntity(self, entityId):
- # type: (str) -> bool
- """
- 销毁实体
- """
- pass
复制代码
|
|