更新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

@@ -228,6 +228,36 @@ print(comp.GetPlayerCurLevelExp(playerId))
## GetPlayerCurrentExhaustionValue
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.playerCompServer.PlayerCompServer
- 描述
获取玩家foodExhaustionLevel的当前消耗度。详见<a href="https://zh.minecraft.wiki/w/%E9%A5%A5%E9%A5%BF#%E6%9C%BA%E5%88%B6">消耗度介绍</a>
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| float | 玩家foodExhaustionLevel的当前消耗度, |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)
value = comp.GetPlayerCurrentExhaustionValue()
```
## GetPlayerExp
<span style="display:inline;color:#ff5555">服务端</span><span style="display:inline;color:#7575f9">客户端</span>
@@ -699,6 +729,38 @@ comp.SetEnchantmentSeed(32)
## SetPlayerCurrentExhaustionValue
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.playerCompServer.PlayerCompServer
- 描述
设置玩家foodExhaustionLevel的当前消耗度。详见<a href="https://zh.minecraft.wiki/w/%E9%A5%A5%E9%A5%BF#%E6%9C%BA%E5%88%B6">消耗度介绍</a>
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| value | float | 当前消耗度 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | 是否设置成功 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreatePlayer(playerId)
result = comp.SetPlayerCurrentExhaustionValue(2.0)
```
## SetPlayerHealthLevel
<span style="display:inline;color:#ff5555">服务端</span>

View File

@@ -106,8 +106,8 @@ method in mod.client.component.cameraCompClient.CameraComponentClient
| startPos | tuple(float,float,float) | 轨迹起点默认为None表示以调用[StartCameraMotion](#StartCameraMotion)的位置作为起点。 |
| relativeCoord | bool | 是否使用相对坐标设置起点和终点默认为False。 |
| isLoop | bool | 是否循环若设为True则相机会在起点和终点之间往复运动默认为False。 |
| targetRot | tuple(float,float) | 相机到达targetPos时的朝向受参数relativeCoord影响默认为None表示使用调用[StartCameraMotion](#StartCameraMotion)时的朝向。 |
| startRot | tuple(float,float) | 相机到达startPos时的朝向受参数relativeCoord影响默认为None表示使用调用[StartCameraMotion](#StartCameraMotion)时的朝向。 |
| targetRot | tuple(float,float,float) | 相机到达targetPos时的朝向受参数relativeCoord影响默认为None表示使用调用[StartCameraMotion](#StartCameraMotion)时的朝向。 |
| startRot | tuple(float,float,float) | 相机到达startPos时的朝向受参数relativeCoord影响默认为None表示使用调用[StartCameraMotion](#StartCameraMotion)时的朝向。 |
| useVelocityDir | bool | 是否使用运动中的速度方向作为朝向默认为False若为True则参数targetRot和startRot无效 |
| ease | TimeEaseType | 时间变化函数, 默认值为clientApi.GetMinecraftEnum().TimeEaseType.linear, 参数不在枚举值中也当作linear |
@@ -131,8 +131,8 @@ method in mod.client.component.cameraCompClient.CameraComponentClient
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateCamera(levelId)
target = (5, 0, 0)
rot1 = (0, 0)
rot2 = (0, 360)
rot1 = (0, 0, 0)
rot2 = (0, 360, 0)
mID = comp.AddCameraTrackMotion(target, 3.0, startPos=None, relativeCoord=True, isLoop=False, targetRot=rot1, startRot=rot2, useVelocityDir=True, ease = clientApi.GetMinecraftEnum().TimeEaseType.linear)
```
@@ -604,7 +604,7 @@ method in mod.client.component.cameraCompClient.CameraComponentClient
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| lockPos | tuple(float,float,float) | 世界坐标 |
| lockRot | tuple(float,float) | 摄像机的角度(俯仰角偏航角) |
| lockRot | tuple(float,float,float) | 摄像机的角度(俯仰角,偏航角,横滚角 |
- 返回值
@@ -622,7 +622,7 @@ method in mod.client.component.cameraCompClient.CameraComponentClient
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateCamera(levelId)
# 把摄像机固定在(0, 6, 0)并且30度俯视朝向世界z轴正方向
comp.LockCamera((0, 6, 0), (30, 0))
comp.LockCamera((0, 6, 0), (30, 0, 0))
```

View File

@@ -370,8 +370,8 @@ method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| geometryKey | str | 贴图键 |
| geometryName | str | 贴图路径 |
| textureKey | str | 贴图键 |
| textureName | str | 贴图路径 |
- 返回值
@@ -620,7 +620,7 @@ method in mod.client.component.modelCompClient.ModelComponentClient
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| skin | str | 贴图路径以textures\models为当前路径的相对路径 |
| skin | str | 贴图路径以textures/models为当前路径的相对路径 |
- 返回值
@@ -631,6 +631,7 @@ method in mod.client.component.modelCompClient.ModelComponentClient
- 备注
- 会覆盖原有皮肤包括4d皮肤。但会被骨骼模型覆盖
- 只能修改Steve模型的皮肤不能修改Alex模型的皮肤
- 如需修改细手臂模型皮肤,请使用[AddPlayerTexture](#addplayertexture)修改default键对应的贴图
- 示例

View File

@@ -27,6 +27,7 @@ sidebarDepth: 1
| [GetArmorValue](属性.md#getarmorvalue) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家护甲值 |
| [GetEnchantmentSeed](属性.md#getenchantmentseed) | <span style="display:inline;color:#ff5555">服务端</span> | 获取玩家的附魔种子,该种子会决定附魔台上准备附魔的装备的附魔项 |
| [GetPlayerCurLevelExp](属性.md#getplayercurlevelexp) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家当前等级需要的经验值 |
| [GetPlayerCurrentExhaustionValue](属性.md#getplayercurrentexhaustionvalue) | <span style="display:inline;color:#ff5555">服务端</span> | 获取玩家foodExhaustionLevel的当前消耗度。详见<a href="https://zh.minecraft.wiki/w/%E9%A5%A5%E9%A5%BF#%E6%9C%BA%E5%88%B6">消耗度介绍</a> |
| [GetPlayerExp](属性.md#getplayerexp) | <span style="display:inline;color:#ff5555">服务端</span> | 获取玩家当前等级下的经验值 |
| [GetPlayerExp](属性.md#getplayerexp) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家当前等级下的经验值 |
| [GetPlayerHealthLevel](属性.md#getplayerhealthlevel) | <span style="display:inline;color:#ff5555">服务端</span> | 获取玩家健康临界值当饥饿值大于等于健康临界值时会自动恢复血量开启饥饿值且开启自然恢复时有效。原版默认值为18 |
@@ -42,6 +43,7 @@ sidebarDepth: 1
| [IsPlayerNaturalRegen](属性.md#isplayernaturalregen) | <span style="display:inline;color:#ff5555">服务端</span> | 是否开启玩家自然恢复,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效。原版默认开启 |
| [IsPlayerNaturalStarve](属性.md#isplayernaturalstarve) | <span style="display:inline;color:#ff5555">服务端</span> | 是否开启玩家饥饿掉血,当饥饿值小于饥饿临界值时会自动恢复血量,开启饥饿值且开启饥饿掉血时有效。原版默认开启 |
| [SetEnchantmentSeed](属性.md#setenchantmentseed) | <span style="display:inline;color:#ff5555">服务端</span> | 设置玩家的附魔种子,该种子会决定附魔台上准备附魔的装备的附魔项 |
| [SetPlayerCurrentExhaustionValue](属性.md#setplayercurrentexhaustionvalue) | <span style="display:inline;color:#ff5555">服务端</span> | 设置玩家foodExhaustionLevel的当前消耗度。详见<a href="https://zh.minecraft.wiki/w/%E9%A5%A5%E9%A5%BF#%E6%9C%BA%E5%88%B6">消耗度介绍</a> |
| [SetPlayerHealthLevel](属性.md#setplayerhealthlevel) | <span style="display:inline;color:#ff5555">服务端</span> | 设置玩家健康临界值,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效.原版默认值为18 |
| [SetPlayerHealthTick](属性.md#setplayerhealthtick) | <span style="display:inline;color:#ff5555">服务端</span> | 设置玩家自然恢复速度,当饥饿值大于等于健康临界值时会自动恢复血量,开启饥饿值且开启自然恢复时有效.原版默认值为80刻即每4秒恢复1点血量 |
| [SetPlayerHunger](属性.md#setplayerhunger) | <span style="display:inline;color:#ff5555">服务端</span> | 设置玩家饥饿度。 |
@@ -70,7 +72,7 @@ sidebarDepth: 1
| [EndSprinting](行为.md#endsprinting) | <span style="display:inline;color:#7575f9">客户端</span> | 使本地玩家结束向前疾跑/冲刺状态 |
| [GetEntityRider](行为.md#getentityrider) | <span style="display:inline;color:#ff5555">服务端</span> | 获取骑乘者正在骑乘的实体的id。 |
| [GetEntityRider](行为.md#getentityrider) | <span style="display:inline;color:#7575f9">客户端</span> | 获取骑乘者正在骑乘的实体的id。 |
| [GetInteracteCenterOffset](行为.md#getinteractecenteroffset) | <span style="display:inline;color:#ff5555">服务端</span> | 获取玩家[服务端交互中心](../../../1-ModAPI/更新信息/2.8.md#玩家摄像机)的偏移 |
| [GetInteracteCenterOffset](行为.md#getinteractecenteroffset) | <span style="display:inline;color:#ff5555">服务端</span> | 获取玩家[服务端交互中心](../../更新信息/2.8.md#玩家摄像机)的偏移 |
| [GetIsBlocking](行为.md#getisblocking) | <span style="display:inline;color:#ff5555">服务端</span> | 获取玩家激活盾牌状态 |
| [GetPickCenterOffset](行为.md#getpickcenteroffset) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家设置的第三人称下客户端交互中心的偏移 |
| [GetPickRange](行为.md#getpickrange) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家客户端的交互距离 |
@@ -82,8 +84,8 @@ sidebarDepth: 1
| [GetPlayerRespawnPos](行为.md#getplayerrespawnpos) | <span style="display:inline;color:#ff5555">服务端</span> | 获取玩家复活点 |
| [GetRelevantPlayer](行为.md#getrelevantplayer) | <span style="display:inline;color:#ff5555">服务端</span> | 获取附近玩家id列表 |
| [IsEntityRiding](行为.md#isentityriding) | <span style="display:inline;color:#ff5555">服务端</span> | 检查玩家是否骑乘。 |
| [IsInScaffolding](行为.md#isinscaffolding) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否脚手架有交叉 |
| [IsOnLadder](行为.md#isonladder) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否梯子/藤蔓有交叉 |
| [IsInScaffolding](行为.md#isinscaffolding) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否脚手架 |
| [IsOnLadder](行为.md#isonladder) | <span style="display:inline;color:#7575f9">客户端</span> | 获取玩家是否梯子/藤蔓 |
| [IsPlayerCanFly](行为.md#isplayercanfly) | <span style="display:inline;color:#ff5555">服务端</span> | 获取玩家能否飞行 |
| [IsPlayerFlying](行为.md#isplayerflying) | <span style="display:inline;color:#ff5555">服务端</span> | 获取玩家是否在飞行 |
| [OpenWorkBench](行为.md#openworkbench) | <span style="display:inline;color:#ff5555">服务端</span> | 在玩家当前位置打开工作台UI不依赖于工作台方块 |

View File

@@ -424,7 +424,7 @@ method in mod.server.component.playerCompServer.PlayerCompServer
- 描述
获取玩家[服务端交互中心](../../../1-ModAPI/更新信息/2.8.md#玩家摄像机)的偏移
获取玩家[服务端交互中心](../../更新信息/2.8.md#玩家摄像机)的偏移
- 参数
@@ -1547,9 +1547,6 @@ method in mod.server.component.playerCompServer.PlayerCompServer
| :--- | :--- |
| bool | 是否设置成功 |
- 备注
- 备注如需限制玩家跳跃请使用SetPlayerJumpable
- 示例
```python