更新3.4API

This commit is contained in:
boybook
2025-06-27 23:59:47 +08:00
parent c0f98b179b
commit 12738a142c
52 changed files with 1146 additions and 292 deletions

View File

@@ -474,6 +474,66 @@ fps = comp.GetFps()
## GetHostPlayerId
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
### 服务端接口
<span id="s0"></span>
method in mod.server.extraServerApi
- 描述
获取房主的entityId
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| str | 房主的entityId,若房主未加入则返回None |
- 示例
```python
import mod.server.extraServerApi as serverApi
serverApi.GetHostPlayerId()
```
### 客户端接口
<span id="c0"></span>
method in mod.client.extraClientApi
- 描述
获取房主的entityId
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| str | 房主的entityId,若房主未加入则返回None |
- 示例
```python
import mod.client.extraClientApi as clientApi
clientApi.GetHostPlayerId()
```
## GetMinecraftEnum
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>

View File

@@ -67,6 +67,70 @@ direction = clientApi.GetDirFromRot((0, 0))
## GetIntPos
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
### 服务端接口
<span id="s0"></span>
method in mod.server.extraServerApi
- 描述
获取坐标所在方块的位置,即浮点数坐标向下取整后的整数坐标。
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| pos | tuple(float,float,float) | 坐标元组 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| tuple(int,int,int) | 坐标所在方块的位置 |
- 示例
```python
import mod.server.extraServerApi as serverApi
serverApi.GetIntPos((1.2,1.3,1.4))
```
### 客户端接口
<span id="c0"></span>
method in mod.client.extraClientApi
- 描述
获取坐标所在方块的位置,即浮点数坐标向下取整后的整数坐标。
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| pos | tuple(float,float,float) | 坐标元组 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| tuple(int,int,int) | 坐标所在方块的位置 |
- 示例
```python
import mod.client.extraClientApi as clientApi
clientApi.GetIntPos((1.2,1.3,1.4))
```
## GetLocalPosFromWorld
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>

View File

@@ -86,6 +86,8 @@ sidebarDepth: 1
| --- | --- | --- |
| [GetDirFromRot](数学.md#getdirfromrot) | <span style="display:inline;color:#ff5555">服务端</span> | 通过旋转角度获取朝向 |
| [GetDirFromRot](数学.md#getdirfromrot) | <span style="display:inline;color:#7575f9">客户端</span> | 通过旋转角度获取朝向 |
| [GetIntPos](数学.md#getintpos) | <span style="display:inline;color:#ff5555">服务端</span> | 获取坐标所在方块的位置,即浮点数坐标向下取整后的整数坐标。 |
| [GetIntPos](数学.md#getintpos) | <span style="display:inline;color:#7575f9">客户端</span> | 获取坐标所在方块的位置,即浮点数坐标向下取整后的整数坐标。 |
| [GetLocalPosFromWorld](数学.md#getlocalposfromworld) | <span style="display:inline;color:#ff5555">服务端</span> | 获取基于实体的世界坐标对应的局部坐标 |
| [GetLocalPosFromWorld](数学.md#getlocalposfromworld) | <span style="display:inline;color:#7575f9">客户端</span> | 获取基于实体的世界坐标对应的局部坐标 |
| [GetRotFromDir](数学.md#getrotfromdir) | <span style="display:inline;color:#ff5555">服务端</span> | 通过朝向获取旋转角度 |
@@ -111,6 +113,8 @@ sidebarDepth: 1
| [GetChinese](工具.md#getchinese) | <span style="display:inline;color:#7575f9">客户端</span> | 获取langStr对应的中文可参考PC开发包中\handheld\localization\handheld\data\resource_packs\vanilla\texts\zh_CN.lang |
| [GetClipboardContent](工具.md#getclipboardcontent) | <span style="display:inline;color:#7575f9">客户端</span> | 获取系统剪贴板内容 |
| [GetFps](工具.md#getfps) | <span style="display:inline;color:#7575f9">客户端</span> | 获取fps |
| [GetHostPlayerId](工具.md#gethostplayerid) | <span style="display:inline;color:#ff5555">服务端</span> | 获取房主的entityId |
| [GetHostPlayerId](工具.md#gethostplayerid) | <span style="display:inline;color:#7575f9">客户端</span> | 获取房主的entityId |
| [GetMinecraftEnum](工具.md#getminecraftenum) | <span style="display:inline;color:#ff5555">服务端</span> | 用于获取[枚举值文档](../../枚举值/索引.md)中的枚举值 |
| [GetMinecraftEnum](工具.md#getminecraftenum) | <span style="display:inline;color:#7575f9">客户端</span> | 用于获取[枚举值文档](../../枚举值/索引.md)中的枚举值 |
| [GetModConfigJson](工具.md#getmodconfigjson) | <span style="display:inline;color:#7575f9">客户端</span> | 以字典形式返回指定路径的json格式配置文件的内容文件必须放置在资源包的/modconfigs目录下 |