### StartNavTo Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/玩家/导航.md Starts a visual navigation system that guides the player using sequence frames. ```APIDOC ## StartNavTo ### Description Provides a navigation system based on GetNavPath that generates sequence frames along the path to guide the player, with automatic re-navigation if the player deviates. ### Method mod.client.extraClientApi.StartNavTo ### Parameters - **pos** (tuple(float,float,float)) - Required - Target coordinates - **sfxPath** (str) - Required - Path to sequence frame assets - **callback** (function) - Required - Callback function triggered upon arrival - **sfxIntl** (float) - Optional - Interval between frames (default: 2) - **sfxMaxNum** (int) - Optional - Max concurrent frames (default: 16) - **sfxScale** (tuple(float,float)) - Optional - Frame scale (default: (0.5, 0.5)) - **maxIteration** (int) - Optional - Max A* iterations (default: 800) - **isSwimmer** (bool) - Optional - Target in water (default: False) - **fps** (int) - Optional - Frame rate (default: 20) - **playIntl** (int) - Optional - Interval between frame starts (default: 8) - **duration** (int) - Optional - Duration of single frame (default: 60) - **oneTurnDuration** (int) - Optional - Interval between rounds (default: 90) - **sfxDepthTest** (bool) - Optional - Enable depth testing (default: False) ### Response - **int** - Returns 0 (success), -1 (blocked/too far), 1 (param error), 2 (chunk not loaded), 3 (target is solid block). ``` -------------------------------- ### ServerChatEvent Example Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/事件/世界.md Example of handling the ServerChatEvent. This snippet demonstrates basic setup for server-side chat event handling. ```python # ServerSystem import mod.server.extraServerApi as serverApi from mod_log import logger as logger ``` -------------------------------- ### GetCommonConfig Configuration Example Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/2-Apollo/4-SDK/5-功能服API.md Example structure of the server common configuration returned by GetCommonConfig. ```json { "apolloid":111, "extra_redis":{ }, "game_id":0, "game_key":"game_key", "gas_server_url":"http://127.0.0.1:111", "log_debug_level":true, "master":{ "app_type":"master", "app_version":"1.21.0.release20210401", "gb":8, "ip":"127.0.0.1", "keep_alive_period":30, "master_port":0, "mods":"", "port":8000, "serverid":0, "type":"master" }, "mongo":null, "mysql":{ "database":"test_db", "host":"127.0.0.1", "password":"test_password", "port":3306, "user":"test_user" }, "redis":{ "host":"127.0.0.1", "password":"", "port":6379 }, "review_stage":0, "serverlist":[ { "app_type":"proxy", "app_version":"1.21.0.release20210401", "gb":8, "ip":"127.0.0.1", "log_debug_level":false, "master_port":11003, "max_players":0, "mods":"", "optimum_players":0, "port":11002, "save":false, "serverid":2000, "type":"proxy" }, { "app_type":"lobby", "app_version":"1.21.0.release20210401", "gb":8, "ip":"127.0.0.1", "log_debug_level":false, "master_port":13003, "max_players":200, "mods":"neteaseRound", "optimum_players":0, "port":13002, "save":false, "serverid":4000, "type":"lobby" } ], "servicelist":[ ], } ``` -------------------------------- ### StartMemProfile (Client) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/调试.md Starts memory profiling on the client. This function is only supported on PC. After starting, call StopMemProfile to generate a function memory flame graph. ```APIDOC ## StartMemProfile (Client) ### Description Starts memory profiling on the client. This function is only supported on PC. After starting, call StopMemProfile to generate a function memory flame graph. The generated flame graph can be opened with a browser, Chrome is recommended. ### Method N/A (Client API) ### Endpoint N/A (Client API) ### Parameters None ### Request Body None ### Response #### Success Response (200) - **bool** - Execution result ### Response Example ```json { "result": true } ``` ### Example ```python import mod.client.extraClientApi as clientApi clientApi.StartMemProfile() # Call modfunc() or other logic # Then call StopMemProfile with a file name # clientApi.StopMemProfile(fileName) ``` ``` -------------------------------- ### StartYappiProfile Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/2-Apollo/4-SDK/7-公共API.md Starts server-side script performance profiling. ```APIDOC ## StartYappiProfile ### Description Starts server-side script performance profiling. After starting, call StopYappiProfile(path) to generate a function performance flame graph at the specified path. ### Response - **bool** - Execution result ### Request Example ```python import apolloCommon.commonNetgameApi as commonNetgameApi commonNetgameApi.StartYappiProfile() ``` ``` -------------------------------- ### PlayFromStart Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/3-PresetAPI/预设对象/零件/相机轨迹CameraTrackPart.md Starts playing the camera movement trajectory from the beginning. ```APIDOC ## PlayFromStart ### Description 从头开始播放相机运动轨迹 ### Method 客户端方法 ### Parameters 无 ### Response 无 ``` -------------------------------- ### StartProfile (Server) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/调试.md Starts performance profiling on the server. This function is only supported on PC. After starting, call StopProfile to generate a function performance flame graph. The generated flame graph can be opened with a browser, Chrome is recommended. ```APIDOC ## StartProfile (Server) ### Description Starts performance profiling on the server. This function is only supported on PC. After starting, call StopProfile to generate a function performance flame graph. The generated flame graph can be opened with a browser, Chrome is recommended. ### Method N/A (Server API) ### Endpoint N/A (Server API) ### Parameters None ### Request Body None ### Response #### Success Response (200) - **bool** - Execution result ### Response Example ```json { "result": true } ``` ### Example ```python import mod.server.extraServerApi as serverApi serverApi.StartProfile() # Call modfunc() or other logic # Then call StopProfile # serverApi.StopProfile() ``` ``` -------------------------------- ### Start Camera Motion Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/玩家/摄像机.md Starts a specific camera motion. This will synchronize player orientation with camera changes. Use DepartCamera to prevent this. ```Python import mod.client.extraClientApi as clientApi comp = clientApi.GetEngineCompFactory().CreateCamera(levelId) comp.StartCameraMotion(mID) ``` -------------------------------- ### StartProfile (Client) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/调试.md Starts performance profiling on the client. This function is only supported on PC. After starting, call StopProfile to generate a function performance flame graph. The generated flame graph can be opened with a browser, Chrome is recommended. ```APIDOC ## StartProfile (Client) ### Description Starts performance profiling on the client. This function is only supported on PC. After starting, call StopProfile to generate a function performance flame graph. The generated flame graph can be opened with a browser, Chrome is recommended. ### Method N/A (Client API) ### Endpoint N/A (Client API) ### Parameters None ### Request Body None ### Response #### Success Response (200) - **bool** - Execution result ### Response Example ```json { "result": true } ``` ### Example ```python import mod.client.extraClientApi as clientApi clientApi.StartProfile() # Call modfunc() or other logic # Then call StopProfile # clientApi.StopProfile() ``` ``` -------------------------------- ### StartPlayerMotion Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/玩家/索引.md Starts a specific motion controller on the player on the server. ```APIDOC ## StartPlayerMotion ### Description Starts a specific motion controller on the player on the server. ### Method Not specified (Server-side operation) ### Endpoint Not specified ### Parameters None explicitly defined in source. ### Request Example None provided. ### Response None explicitly defined in source. ``` -------------------------------- ### Start Server Coroutine with Function Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/工具.md Starts a coroutine by passing a function. The function will execute from the beginning. A callback can be specified for post-execution actions. ```python import server.extraServerApi as serverApi def callback(): print "callback" def coroutineTest(): for i in xrange(1000): print i yield #传入函数,函数将从头开始执行 serverApi.StartCoroutine(coroutineTest, callback) ``` -------------------------------- ### StartMultiProfile (Server & Client) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/调试.md Starts performance profiling on both server and client sides. This function is only supported on PC. After starting, call StopMultiProfile to generate a function performance flame graph. Data accuracy may be affected due to dual-end collection; using the single-end StartProfile is recommended. ```APIDOC ## StartMultiProfile (Server & Client) ### Description Starts performance profiling on both server and client sides. This function is only supported on PC. After starting, call StopMultiProfile to generate a function performance flame graph. Data accuracy may be affected due to dual-end collection; using the single-end StartProfile is recommended. ### Method N/A (Server & Client API) ### Endpoint N/A (Server & Client API) ### Parameters None ### Request Body None ### Response #### Success Response (200) - **bool** - Execution result ### Response Example ```json { "result": true } ``` ### Example (Server) ```python import mod.server.extraServerApi as serverApi serverApi.StartMultiProfile() # Call modfunc() or other logic # Then call StopMultiProfile # serverApi.StopMultiProfile() ``` ### Example (Client) ```python import mod.client.extraClientApi as clientApi clientApi.StartMultiProfile() # Call modfunc() or other logic # Then call StopMultiProfile # clientApi.StopMultiProfile() ``` ``` -------------------------------- ### Start Client Server Multi-Profiling Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/调试.md Starts simultaneous script performance profiling on both server and client. Call StopMultiProfile to generate a flame graph. Data accuracy may be affected; prefer single-end profiling if possible. Only supported on PC. ```python import mod.client.extraClientApi as clientApi clientApi.StartMultiProfile() modfunc()# 处理对应的逻辑 # 之后通过计时器或者其他触发方式调用StopMultiProfile clientApi.StopMultiProfile() ``` -------------------------------- ### StartPlayerMotion Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/Api索引表.md Starts a specific motion controller on the player. ```APIDOC ## StartPlayerMotion ### Description Starts a specific motion controller on the player. ### Method Not specified (Server-side) ### Endpoint Not specified ### Parameters Not specified ### Request Example Not specified ### Response Not specified ``` -------------------------------- ### Camera Motion Start Client Event Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/事件/玩家.md Fired on the client when a camera motion starts. This event is triggered after a motion controller is added to the camera and begins its execution. ```lua function CameraMotionStartClientEvent(motionId) -- Client-side logic when camera motion starts end ``` -------------------------------- ### StartCameraMotion Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/玩家/索引.md Starts a specific motion controller on the camera. ```APIDOC ## StartCameraMotion ### Description Starts a specific motion controller on the camera. ### Method Not specified (Client-side function) ### Endpoint Not applicable ### Parameters None explicitly defined in the source. ### Request Example None provided. ### Response None explicitly defined in the source. ``` -------------------------------- ### Play Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/特效/粒子.md Starts playing the particle effect. ```APIDOC ## Play ### Description Starts playing the particle effect. ### Method Method in mod.client.component.particleControlComp.ParticleControlComp ### Response - **bool** - Whether the operation was successful. ### Request Example ```python import mod.client.extraClientApi as clientApi comp = clientApi.GetEngineCompFactory().CreateParticleControl(particleEntityId) comp.Play() ``` ``` -------------------------------- ### StartRecordEvent Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/2-Apollo/4-SDK/5-功能服API.md Starts recording network event statistics. ```APIDOC ## StartRecordEvent ### Description Starts recording script event statistics between the lobby/game server and the functional server. Use StopRecordEvent to retrieve the statistics. ### Response - **bool** - Execution result ``` -------------------------------- ### Start Server and Client Multi-Profiling Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/调试.md Starts simultaneous script performance profiling on both server and client. Call StopMultiProfile to generate a flame graph. Data accuracy may be affected; prefer single-end profiling if possible. Only supported on PC. ```python import mod.server.extraServerApi as serverApi serverApi.StartMultiProfile() modfunc()# 处理对应的逻辑 # 之后通过计时器或者其他触发方式调用StopMultiProfile serverApi.StopMultiProfile() ``` -------------------------------- ### RegisterRpcMethod Example Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/2-Apollo/4-SDK/8-服务器通信.md Demonstrates registering an RPC method for service/master communication. Ensure the module is configured in deploy.json. ```python #service同master通信示例.service同service通信与此类似,这里不重复了 #service mod class testService(ServiceSystem): def __init__(self,namespace,systemName): ServiceSystem.__init__(self, namespace, systemName) #注册service方法,注意一个事件只能注册一次,否则后面监听函数会覆盖前面监听函数 self.RegisterRpcMethod('idv_service','PlayerJoinOKEvent', self.OnPlayerJoinOK) def OnPlayerJoinOK(self, serverId, callbackId, args): #args的结果为:{'uid':123, 'name':'nickname'} print 'OnPlayerJoinOK', args response = {} response['result'] = 1 self.ResponseToServer(serverId, callbackId, response) #master mod class masterServer(MasterSystem): def __init__(self, namespace, systemName): MasterSystem.__init__(self, namespace, systemName) def OnCallback(self, suc, args): #若成功:suc=True,args= {'result' : 1} #若超时,则suc为False if not suc: print 'OnCallback timeout' return print 'OnCallback success', args def testNotifyService(self): player = {} player['uid'] = 123 player['name'] = 'nickname' self.RequestToService("idv_service", "PlayerJoinOKEvent", data, self.OnCallback, 2) ``` -------------------------------- ### StartDatabaseProfile Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/2-Apollo/4-SDK/7-公共API.md Starts recording statistics for database connection pool requests. After starting, calling StopDatabaseMysqlProfile(db) will provide database connection pool request records between the two function calls. ```APIDOC ## StartDatabaseProfile ### Description Starts recording statistics for database connection pool requests. After starting, calling StopDatabaseMysqlProfile(db) will provide database connection pool request records between the two function calls. ### Method Not specified (assumed to be a function call) ### Endpoint Not applicable (local function) ### Parameters #### Path Parameters - **db** (str) - Required - The type of database connection pool (e.g., 'mysql', 'redis', 'mongo'). ### Request Example ```python import apolloCommon.commonNetgameApi as commonNetgameApi commonNetgameApi.StartDatabaseProfile("mysql") ``` ### Response #### Success Response (200) - **bool** - Execution result #### Response Example ```json { "result": true } ``` ``` -------------------------------- ### CreateExperienceOrb Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/世界/索引.md Creates a server-side experience orb. ```APIDOC ## CreateExperienceOrb ### Description Creates a server-side experience orb. ### Method Not specified (assumed to be a function call in an SDK) ### Endpoint Not applicable (SDK function) ### Parameters None explicitly defined in the source. ### Request Example None provided. ### Response None explicitly defined in the source. ``` -------------------------------- ### Get All Children Paths Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/自定义UI/UI界面.md Recursively retrieves the paths of all child nodes starting from the specified parent path. ```python # get panel's all children path node.GetAllChildrenPath("/panel") ``` -------------------------------- ### Preset.Model.Effect.EffectObject.EffectObject.Play Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/3-PresetAPI/更新信息/1.23.4.md Starts the playback of a visual effect. ```APIDOC ## Preset.Model.Effect.EffectObject.EffectObject.Play ### Description Initiates the playback of a configured visual effect. ### Method Play ### Endpoint N/A (Method of EffectObject) ### Parameters None explicitly documented. ### Request Example N/A ### Response N/A ``` -------------------------------- ### StartRecordEvent (Server) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/调试.md Starts recording script event transmissions between the server and client. This function is only available in Apollo environments and supports rental servers and Apollo network servers (not single-machine environments). After starting, call StopRecordEvent to get statistics. ```APIDOC ## StartRecordEvent (Server) ### Description Starts recording script event transmissions between the server and client. This function is only available in Apollo environments and supports rental servers and Apollo network servers (not single-machine environments). After starting, call StopRecordEvent to get statistics. ### Method N/A (Server API) ### Endpoint N/A (Server API) ### Parameters None ### Request Body None ### Response #### Success Response (200) - **bool** - Execution result ### Response Example ```json { "result": true } ``` ### Example ```python import mod.server.extraServerApi as serverApi suc = serverApi.StartRecordEvent() # After a period, call StopRecordEvent # result = serverApi.StopRecordEvent() # for eventName, data in result.iteritems(): # print "event[{}] send={} sendSize={} recv={} recvSize={}".format(eventName, data["send_num"], data["send_size"], data["recv_num"], data["recv_size"]) ``` ``` -------------------------------- ### Enable Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/实体/官方聊天扩展.md 启用官方聊天扩展功能。仅在联机大厅和网络服中生效,建议在ClientLoadAddonsFinishServerEvent事件中调用。 ```python import mod.server.extraServerApi as serverApi comp = serverApi.GetEngineCompFactory().CreateChatExtension(playerId) comp.Enable() ``` -------------------------------- ### StartRecordEvent (Apollo) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/索引.md Apollo: Starts recording of script event transmissions between server and client. Call StopRecordEvent to get statistics. ```APIDOC ## POST /api/debug/startRecordEvent (Apollo) ### Description Apollo: Starts recording of script event transmissions between server and client. Call StopRecordEvent to get statistics. Only supported in leased line and Apollo network server environments. ### Method POST ### Endpoint /api/debug/startRecordEvent ### Parameters ### Request Body ### Request Example ### Response #### Success Response (200) - **status** (string) - The status of the operation. #### Response Example ```json { "status": "recording started" } ``` ``` -------------------------------- ### StartMultiProfile (Client) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/Api索引表.md Starts server and client script performance profiling on PC. Call StopMultiProfile to generate a flame graph at fileName. Dual-end collection may have data discrepancies; StartProfile is recommended for single-end analysis. This is only supported on PC. ```APIDOC ## StartMultiProfile (Client) ### Description Starts server and client script performance profiling on PC. Call StopMultiProfile to generate a flame graph at fileName. Dual-end collection may have data discrepancies; StartProfile is recommended for single-end analysis. This is only supported on PC. ### Method POST ### Endpoint /debug/startMultiProfile/client ### Parameters #### Request Body - **fileName** (string) - Required - The path to save the generated flame graph. ``` -------------------------------- ### Get Entity Links Tag Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/实体/属性.md Fetches entities linked to a given entity. For example, if the entity is a horse, this will return information about the rider. ```python import mod.server.extraServerApi as serverApi comp = serverApi.GetEngineCompFactory().CreateEntityDefinitions(entityId) result = comp.GetEntityLinksTag() ``` -------------------------------- ### Get ScrollView Position Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/自定义UI/UI控件.md Retrieves the position of the topmost content within a ScrollView. This indicates the current visible starting point of the scrollable content. ```python # we want get scroll_view pos scrollViewPath = "/scroll_view0" scrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView() scrollViewUIControl.GetScrollViewPos() ``` -------------------------------- ### Get Fog Length - Python Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/世界/渲染.md Retrieves the fog range, returning a tuple of the start and end values for the fog effect. This method is part of the FogCompClient component. ```python import mod.client.extraClientApi as clientApi comp = clientApi.GetEngineCompFactory().CreateFog(levelId) start,end = comp.GetFogLength() ``` -------------------------------- ### ClientSystem.CreateEngineSfx Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/特效/序列帧.md 根据资源路径创建序列帧特效。 ```APIDOC ## CreateEngineSfx ### Description 创建序列帧特效,创建后需调用play函数播放。 ### Parameters #### Request Body - **path** (str) - Required - 特效资源路径 - **pos** (tuple(float,float,float)) - Optional - 创建位置 - **rot** (tuple(float,float,float)) - Optional - 角度 - **scale** (tuple(float,float,float)) - Optional - 缩放系数 ### Response #### Success Response (200) - **frameEntityId** (int/None) - 返回创建的序列帧实体ID ``` -------------------------------- ### StartChunkProfile Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/2-Apollo/4-SDK/6-大厅与游戏服API.md Starts server-side chunk read/write performance profiling. ```APIDOC ## StartChunkProfile ### Description Starts server-side chunk read/write performance profiling. Note that this has a significant performance impact and should not be enabled long-term. ### Response #### Success Response (200) - **result** (bool) - Execution success status. ### Response Example ```python suc = lobbyGameApi.StartChunkProfile() ``` ``` -------------------------------- ### ClientSystem.CreateEngineSfxFromEditor Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/特效/序列帧.md 使用编辑器配置创建序列帧特效。 ```APIDOC ## CreateEngineSfxFromEditor ### Description 使用资源包中effects/xxx.json配置创建序列帧。 ### Parameters #### Request Body - **path** (str) - Required - 特效配置路径 - **pos** (tuple(float,float,float)) - Optional - 创建位置 - **rot** (tuple(float,float,float)) - Optional - 角度 - **scale** (tuple(float,float,float)) - Optional - 缩放系数 ### Response #### Success Response (200) - **frameEntityId** (int/None) - 返回创建的序列帧实体ID ``` -------------------------------- ### StartRecordPacket (Apollo) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/索引.md Apollo: Starts recording of engine packet transmissions between server and client. Call StopRecordPacket to get statistics. Only supported in leased line and Apollo network server environments. ```APIDOC ## POST /api/debug/startRecordPacket (Apollo) ### Description Apollo: Starts recording of engine packet transmissions between server and client. Call StopRecordPacket to get statistics. Only supported in leased line and Apollo network server environments. ### Method POST ### Endpoint /api/debug/startRecordPacket ### Parameters ### Request Body ### Request Example ### Response #### Success Response (200) - **status** (string) - The status of the operation. #### Response Example ```json { "status": "recording started" } ``` ``` -------------------------------- ### NotifyToServerNode Example Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/2-Apollo/4-SDK/8-服务器通信.md Demonstrates how a Master system sends an event to a specific Lobby or Game server. ```python #master给某个服务器发消息的示例 #master mod class testMaster(MasterSystem): def __init__(self,namespace,systemName): MasterSystem.__init__(self, namespace, systemName) def testNotifyServer(self): player = {} player['uid'] = 123 player['name'] = 'nickname' self.NotifyToServerNode(4000, "PlayerJoinEvent", data) #lobby mod,服务器id为4000 class lobbyServer(ServerSystem): def __init__(self, namespace, systemName): ServerSystem.__init__(self, namespace, systemName) self.ListenForEvent('masterNamespace', 'masterSystem', 'PlayerJoinEvent', self, self.OnPlayerJoin) def OnPlayerJoin(self, args): #args的结果为:{'uid':123, 'name':'nickname'} print 'OnPlayerJoin', args ``` -------------------------------- ### Get Molang Variable Value (Client) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/方块/方块实体.md Retrieves the value of a specific Molang variable for a custom block entity. The variable name must start with 'variable.' and contain no more than two dots. ```python import mod.client.extraClientApi as clientApi comp = clientApi.GetEngineCompFactory().CreateBlockInfo(levelId) comp.GetBlockEntityMolangValue(pos, "query.mod.idle") ``` -------------------------------- ### StartRecordEvent Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/Api索引表.md Starts statistical collection of script event sending and receiving between server and client. Call StopRecordEvent to get statistics. Supported only in rental server and Apollo network server environments (not single-machine environment). ```APIDOC ## StartRecordEvent ### Description Starts statistical collection of script event sending and receiving between server and client. Call StopRecordEvent to get statistics. Supported only in rental server and Apollo network server environments (not single-machine environment). ### Method POST ### Endpoint /debug/startRecordEvent ``` -------------------------------- ### OpenShopWindow Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/商城.md Opens the Netease shop window. Note: Not valid on PC. ```APIDOC ## OpenShopWindow ### Description Opens the Netease shop window. Note: Not valid on PC (Apollo PC users should use the shop plugin). ### Method Client-side method: mod.client.component.neteaseShopCompClient.NeteaseShopCompClient.OpenShopWindow() ### Request Example ```python import client.extraClientApi as clientApi comp = clientApi.GetEngineCompFactory().CreateNeteaseShop(levelId) comp.OpenShopWindow() ``` ``` -------------------------------- ### UI Item Layer Configuration Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/物品.md Example JSON configuration for displaying custom item layers in a UI. This setup requires specific image controls for each layer (top_layer_3, top_layer_2, etc.) to be present in the UI element. ```json "customItemLayer@common.item_renderer_additional_layer": { "bindings": [ { "binding_name": "#visible", "binding_condition": "always" }, { "binding_name": "#uv", "binding_condition": "always_when_visible" }, { "binding_name": "#uv_size", "binding_condition": "always_when_visible" }, { "binding_name": "#texture", "binding_condition": "always_when_visible" } ] }, "itemImg" : { "anchor_from" : "center", "anchor_to" : "center", "controls" : [ { "top_layer_3@neteaseCommonUI.customItemLayer": { "$item_renderer_additional_layer_layer": 3 } }, { "top_layer_2@neteaseCommonUI.customItemLayer": { "$item_renderer_additional_layer_layer": 2 } }, { "top_layer_1@neteaseCommonUI.customItemLayer": { "$item_renderer_additional_layer_layer": 1 } }, { "bottom_layer_1@neteaseCommonUI.customItemLayer": { "$item_renderer_additional_layer_layer": -1 } }, { "bottom_layer_2@neteaseCommonUI.customItemLayer": { "$item_renderer_additional_layer_layer": -2 } }, { "itemNum@neteaseCommonUI.itemNum" : {} } ], "layer" : 3, "offset" : [ 0, 0 ], "renderer" : "inventory_item_renderer", "size" : [ 24, 24 ], "type" : "custom", "visible" : true } ``` -------------------------------- ### 从编辑器配置创建序列帧 Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/特效/序列帧.md 使用CreateEngineSfxFromEditor加载资源包中的特效配置并进行播放。 ```python import mod.client.extraClientApi as clientApi class MyClientSystem(ClientSystem): # 创建 def createSfxFromEditor(self): frameEntityId = self.CreateEngineSfxFromEditor("effects/mySfx.json") frameAniTransComp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId) frameAniTransComp.SetPos((10,10,10)) frameAniTransComp.SetRot((0,0,0)) frameAniTransComp.SetScale((1,1,1)) frameAniControlComp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId) frameAniControlComp.Play() # 删除 def removeSfx(self, frameEntityId): self.DestroyEntity(frameEntityId) ``` -------------------------------- ### Start Server Event Recording Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/调试.md Begins recording script event transmission statistics between server and client. Call StopRecordEvent to get statistics on script events sent and received between two function calls. Only supported in leased server and Apollo network server environments. ```python import mod.server.extraServerApi as serverApi suc = serverApi.StartRecordEvent() # 之后通过计时器或者其他触发方式调用StopRecordEvent result = serverApi.StopRecordEvent() for eventName, data in result.iteritems(): print "event[{}] send={} sendSize={} recv={} recvSize={}".format(eventName, data["send_num"], data["send_size"], data["recv_num"], data["recv_size"]) ``` -------------------------------- ### PlayerPreset Overview Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/3-PresetAPI/预设对象/预设/玩家预设PlayerPreset.md Provides an overview of the PlayerPreset class, including its inheritance and a description of its purpose and usage. ```APIDOC ## PlayerPreset Overview ### Description PlayerPreset (玩家预设) is a special type of entity preset that is bound to a player. Each AddOn (editor work) is allowed to create only one player preset. If a player simultaneously enables multiple AddOns that use player presets, only the first player preset will be loaded. ### Inheritance ```mermaid classDiagram EntityPreset <|-- PlayerPreset link EntityPreset "../../../../mcdocs/3-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/EntityPreset.html" PlayerObject <|-- PlayerPreset link PlayerObject "../../../../mcdocs/3-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/%E7%8E%A9%E5%AE%B6%E5%AF%B9%E8%B1%A1PlayerObject.html" PresetBase <|-- EntityPreset link PresetBase "../../../../mcdocs/3-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/PresetBase.html" EntityObject <|-- EntityPreset link EntityObject "../../../../mcdocs/3-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%A2%84%E8%AE%BE/EntityObject.html" TransformObject <|-- PresetBase link TransformObject "../../../../mcdocs/3-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/TransformObject.html" SdkInterface <|-- PresetBase link SdkInterface "../../../../mcdocs/3-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/SDKInterface.html" GameObject <|-- TransformObject link GameObject "../../../../mcdocs/3-PresetAPI/%E9%A2%84%E8%AE%BE%E5%AF%B9%E8%B1%A1/%E9%80%9A%E7%94%A8/%E6%B8%B8%E6%88%8F%E5%AF%B9%E8%B1%A1GameObject.html" PlayerPreset: 玩家预设 PlayerObject: 玩家对象 PlayerObject: (点击跳转) EntityPreset: 实体预设 EntityPreset: (点击跳转) GameObject: 游戏对象 GameObject: (点击跳转) EntityObject: 实体对象 EntityObject: (点击跳转) SdkInterface: SDK接口封装 SdkInterface: (点击跳转) TransformObject: 变换对象 TransformObject: (点击跳转) PresetBase: 预设基类 PresetBase: (点击跳转) ``` ### Member Variables | Variable Name | Data Type | Description | | :------------ | :-------- | :---------- | | entityId | str | Player ID | ``` -------------------------------- ### Get Entities In Square Area (Server) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/世界/地图.md Retrieves a list of entity IDs within a square area defined by start and end positions in a specific dimension. The entityId parameter is deprecated. Collision detection uses the Separating Axis Theorem, and coordinates refer to vertex positions. ```python import mod.server.extraServerApi as serverApi comp = serverApi.GetEngineCompFactory().CreateGame(levelId) comp.GetEntitiesInSquareArea(None, (0,0,0), (100,100,100), 0) ``` -------------------------------- ### Get Entities In Square Area (Client) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/世界/地图.md Fetches a list of entity IDs within a square area defined by start and end positions. The entityId parameter is deprecated. This method operates within the player's current dimension. Collision detection uses the Separating Axis Theorem, and coordinates refer to vertex positions. ```python import mod.client.extraClientApi as clientApi comp = clientApi.GetEngineCompFactory().CreateGame(levelId) comp.GetEntitiesInSquareArea(None, (0,0,0), (100,100,100)) ``` -------------------------------- ### CreateExperienceOrb Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/3-PresetAPI/预设对象/通用/SDK接口封装SdkInterface.md Creates a new experience orb. ```APIDOC ## CreateExperienceOrb ### Description Creates a new experience orb at a specific position. ### Parameters #### Path Parameters - **playerId** (int) - Required - Exclusive player ID - **exp** (int) - Required - Experience value - **position** (tuple) - Required - (x, y, z) coordinates - **isSpecial** (bool) - Required - Whether it is a special orb ### Response - **bool** - Success status ### Request Example self.CreateExperienceOrb(playerId, 25, (10,10,10), False) ``` -------------------------------- ### RegisterRpcMethodForMod Example Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/2-Apollo/4-SDK/8-服务器通信.md Demonstrates registering an RPC method specifically for mod-based service communication. ```python #service同master通信示例.service同service通信与此类似,这里不重复了 #service mod class testService(ServiceSystem): def __init__(self,namespace,systemName): ServiceSystem.__init__(self, namespace, systemName) #注册service方法,注意一个事件只能注册一次,否则后面监听函数会覆盖前面监听函数 self.RegisterRpcMethodForMod('PlayerJoinOKEvent', self.OnPlayerJoinOK) def OnPlayerJoinOK(self, serverId, callbackId, args): #args的结果为:{'uid':123, 'name':'nickname'} print 'OnPlayerJoinOK', args response = {} response['result'] = 1 self.ResponseToServer(serverId, callbackId, response) #master mod class masterServer(MasterSystem): def __init__(self, namespace, systemName): MasterSystem.__init__(self, namespace, systemName) def OnCallback(self, suc, args): #若成功:suc=True,args= {'result' : 1} #若超时,则suc为False if not suc: print 'OnCallback timeout' return print 'OnCallback success', args def testNotifyService(self): player = {} player['uid'] = 123 player['name'] = 'nickname' self.RequestToServiceMod("idv_service", "PlayerJoinOKEvent", data, self.OnCallback, 2) ``` -------------------------------- ### Get Setting Instance Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/自定义UI/通用设置.md Retrieves the general setting instance for the current module. Returns None if not registered. It's recommended to register the instance before getting it, and avoid getting it during initialization. ```python import mod.client.extraClientApi as clientApi levelId = clientApi.GetLevelId() comp = clientApi.GetEngineCompFactory().CreateNeteaseWindow(levelId) settingInst = comp.GetSettingInst() if settingInst: settingInst.AddText("text_uid_01", "这是一段文字").AddToggle("toggle_uid_01", "开关按钮", False, callbackFunction) ``` -------------------------------- ### GetSystem (Server) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/System.md Retrieves a registered system instance on the server. ```APIDOC ## GetSystem (Server) ### Description Gets a registered system. ### Method GET ### Endpoint mod.server.extraServerApi.GetSystem ### Parameters #### Query Parameters - **nameSpace** (str) - Required - The namespace, recommended to be the mod name. - **systemName** (str) - Required - The system name, a custom name that can use English, Pinyin, and underscores. It is recommended to be as personalized as possible. ### Response #### Success Response (200) - **ServerSystem** (type) - Returns an instance of the specific system. ### Request Example ```python import mod.server.extraServerApi as serverApi serverSystem = serverApi.GetSystem("TutorialMod", "TutorialServerSystem") ``` ``` -------------------------------- ### Get Touch Position (Client) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/控制.md Gets the screen coordinates of a touch input. This can be used in conjunction with TapBeforeClientEvent or TapOrHoldReleaseClientEvent. ```python import mod.client.extraClientApi as clientApi def GetTouchPosTest(): touchX, touchY = clientApi.GetTouchPos() ``` -------------------------------- ### StartDatabaseProfile Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/2-Apollo/4-SDK/7-公共API.md Starts recording database connection pool request statistics. Use with StopDatabaseMysqlProfile to analyze performance. ```python import apolloCommon.commonNetgameApi as commonNetgameApi commonNetgameApi.StartDatabaseProfile("mysql") ``` -------------------------------- ### GlobalCommandServerEvent Parameter Examples Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/事件/世界.md Examples of the event argument dictionary for commands executed by entities versus command blocks. ```python { 'cancel' : False, 'entityId' : '-8589934591', 'command' : '/kill @e', 'dimension' : 0, 'blockPos' : (227,66,569) } ``` ```python { 'cancel' : False, 'command' : '/say I am a command_block', 'dimension' : 0, 'blockPos' : (226,64,579) } ``` -------------------------------- ### StartMemProfile (Server) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/索引.md Server-side: Starts memory profiling for scripts. Generates a flame graph upon calling StopMemProfile. Only supported on PC. ```APIDOC ## POST /api/debug/startMemProfile (Server) ### Description Server-side: Starts memory profiling for scripts. Generates a flame graph upon calling StopMemProfile. Only supported on PC. ### Method POST ### Endpoint /api/debug/startMemProfile ### Parameters ### Request Body - **fileName** (string) - Required - The path where the flame graph will be saved. ### Request Example ```json { "fileName": "/tmp/memprofile.html" } ``` ### Response #### Success Response (200) - **status** (string) - The status of the operation. #### Response Example ```json { "status": "profiling started" } ``` ``` -------------------------------- ### StartMemProfile (Client) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/通用/索引.md Client-side: Starts memory profiling for scripts. Generates a flame graph upon calling StopMemProfile. Only supported on PC. ```APIDOC ## POST /api/debug/startMemProfile (Client) ### Description Client-side: Starts memory profiling for scripts. Generates a flame graph upon calling StopMemProfile. Only supported on PC. ### Method POST ### Endpoint /api/debug/startMemProfile ### Parameters ### Request Body - **fileName** (string) - Required - The path where the flame graph will be saved. ### Request Example ```json { "fileName": "/tmp/memprofile.html" } ``` ### Response #### Success Response (200) - **status** (string) - The status of the operation. #### Response Example ```json { "status": "profiling started" } ``` ``` -------------------------------- ### Get ScrollView Percent Value Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/自定义UI/UI控件.md Gets the current scroll position of a ScrollView as a percentage. This is useful for tracking scroll progress. ```python # we want get scroll_view percent scrollViewPath = "/scroll_view0" scrollViewUIControl = uiNode.GetBaseUIControl(scrollViewPath).asScrollView() scrollViewUIControl.GetScrollViewPercentValue() ``` -------------------------------- ### Get Controller Layout Mapping Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/游戏设置.md Retrieves the controller binding mapping for a player. Specify layoutType to get keyboard/mouse or gamepad mappings. ```python import mod.client.extraClientApi as clientApi comp = clientApi.GetEngineCompFactory().CreatePlayerView(levelId) comp.GetControllerLayout(1) #获取手柄的绑定映射 ``` -------------------------------- ### PushScreen Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/Api索引表.md Creates a UI using stack management. ```APIDOC ## PushScreen ### Description Creates a UI using stack management. ### Method Not specified (assumed client-side call) ### Endpoint Not specified ### Parameters None specified ### Request Example None specified ### Response None specified ``` -------------------------------- ### Get All Scoreboard Objects (Server) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/世界/记分板.md Retrieves a list of all general scoreboard objectives on the server. This is used to get information about the scoreboard criteria. ```python import mod.server.extraServerApi as serverApi comp = serverApi.GetEngineCompFactory().CreateGame(levelId) print(comp.GetAllScoreboardObjects()) ``` -------------------------------- ### Get Block Light Level Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/世界/地图.md Gets the light level of a block at a specific position and dimension on the server. Only works for loaded chunks. ```python import mod.server.extraServerApi as serverApi comp = serverApi.GetEngineCompFactory().CreateBlockInfo(levelId) lightlevel = comp.GetBlockLightLevel((x,y,z), 0) ``` -------------------------------- ### 创建并控制序列帧特效 Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/特效/序列帧.md 通过ClientSystem创建序列帧特效,并使用FrameAniTrans和FrameAniControl组件进行属性设置与播放。 ```python import mod.client.extraClientApi as clientApi class MyClientSystem(ClientSystem): # 创建 def createSfx(self): frameEntityId = self.CreateEngineSfx("textures/sfxs/snow_3") frameAniTransComp = clientApi.GetEngineCompFactory().CreateFrameAniTrans(frameEntityId) frameAniTransComp.SetPos((10,10,10)) frameAniTransComp.SetRot((0,0,0)) frameAniTransComp.SetScale((1,1,1)) frameAniControlComp = clientApi.GetEngineCompFactory().CreateFrameAniControl(frameEntityId) frameAniControlComp.Play() # 删除 def removeSfx(self, frameEntityId): self.DestroyEntity(frameEntityId) ``` -------------------------------- ### Get First-Person Height Offset Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/玩家/摄像机.md Gets the height offset for the first-person camera perspective. This value can differ when swimming, gliding, or in a normal state. ```python import mod.client.extraClientApi as clientApi comp = clientApi.GetEngineCompFactory().CreateCamera(levelId) heightOffset = comp.GetFpHeight() ``` -------------------------------- ### Get Dimension Time (Client) Source: https://github.com/mcneteasedevs/mc-netease-sdk/blob/main/1-ModAPI/接口/世界/时间.md Gets the elapsed time in frames for the current dimension on the client. This allows for client-side time tracking and calculations. ```Python import mod.client.extraClientApi as clientApi comp = clientApi.GetEngineCompFactory().CreateDimension(levelId) # 从游戏开始经过的总帧数 passedTime = comp.GetLocalTime() # 当前游戏天内的帧数 timeOfDay = passedTime % 24000 # 从游戏开始经过的游戏天数 day = passedTime / 24000 ```