2289 lines
66 KiB
Markdown
2289 lines
66 KiB
Markdown
---
|
||
sidebarDepth: 1
|
||
---
|
||
# 渲染
|
||
|
||
## AddActorAnimation
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加生物渲染动画
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 实体identifier |
|
||
| animationKey | str | 动画键 |
|
||
| animationName | str | 动画名称 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 某些动画资源可能用到了molang表达式,在添加动画时请务必确保这些molang表达式也存在。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddActorAnimation("minecraft:pig", "custom_move", "animation.pig.custom_move")
|
||
```
|
||
|
||
|
||
|
||
## AddActorAnimationController
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加生物渲染动画控制器
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 生物的identifier |
|
||
| animationControllerKey | str | 动画控制器键 |
|
||
| animationControllerName | str | 动画控制器名称 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.AddActorAnimationController("minecraft:skeleton", "controller__use_item_progress", "controller.animation.humanoid.use_item_progress")
|
||
```
|
||
|
||
|
||
|
||
## AddActorBlockGeometry
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
为实体添加方块几何体模型。
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| geometryName | str | 几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id |
|
||
| offset | tuple(float,float,float) | 方块几何体模型相对实体的位置偏移值,可选参数,默认为(0, 0, 0)。 |
|
||
| rotation | tuple(float,float,float) | 方块几何体模型相对实体的旋转角度,可选参数,默认为(0, 0, 0),分别表示绕x,y,z轴的旋转角度,旋转顺序按z,x,y顺序旋转。 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 添加是否成功,成功返回True,失败返回False。如果实体已经拥有了相同名称的模型,则也会返回True |
|
||
|
||
- 备注
|
||
- 请在确保世界已经初始化完成后(例如,监听UiInitFinished事件)再调用该接口,否则过早调用会导致接口执行失败。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
blockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)
|
||
actorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender("-4294967295")
|
||
# 合并方块并转换为名叫"my_block_geometry"的方块几何体模型
|
||
geometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],"my_block_geometry")
|
||
# 添加到实体id为-4294967295的实体中
|
||
print actorRenderComp.AddActorBlockGeometry(geometryName)
|
||
```
|
||
|
||
|
||
|
||
## AddActorGeometry
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加生物渲染几何体
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 生物实体identifier |
|
||
| geometryKey | str | 渲染几何体的键,如default |
|
||
| geometryName | str | 渲染几何体名称,如熊猫几何体geometry.panda |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用RebuildActorRender才会生效
|
||
动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图。建议先修改生物的动画以及动画控制器后再修改生物的几何。
|
||
- 某些生物受初始动画影响,几何体会有初始偏移,会导致修改几何体后表现异常。若修改后的几何体没有当前动画需要的骨骼时,会触发报错。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddActorGeometry("minecraft:sheep", "default", "geometry.panda")
|
||
```
|
||
|
||
|
||
|
||
## AddActorParticleEffect
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加生物特效资源
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 实体identifier |
|
||
| effectKey | str | 特效资源Key,如bee.entity.json中的nectar_dripping |
|
||
| effectName | str | 特效资源名称,如minecraft:nectar_drip_particle |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddActorParticleEffect("minecraft:villager", "nectar_dripping", "minecraft:nectar_drip_particle")
|
||
```
|
||
|
||
|
||
|
||
## AddActorRenderController
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加生物<a href="../../../../mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.html#_7-自定义渲染控制器">渲染控制器</a>
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 生物identifier |
|
||
| renderControllerName | str | 渲染控制器名称 |
|
||
| condition | str | 渲染控制器条件,当该条件成立时,renderControllerName指向的渲染控制器才会生效 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 添加是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用RebuildActorRender才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddActorRenderController('minecraft:villager', 'custom_render_controller_name', 'query.mod.condition')
|
||
```
|
||
|
||
|
||
|
||
## AddActorRenderControllerArray
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加生物渲染控制器列表中字典arrays元素
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 实体identifier |
|
||
| renderControllerName | str | 实体生物渲染控制器名称 |
|
||
| arrayType | int | 渲染控制器arrays类型([渲染控制器arrays类型枚举](../../枚举值/RenderControllerArrayType.md)) |
|
||
| arrayName | str | 数组名称 |
|
||
| expression | str | 待添加元素表达式 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 该接口增加render_controller->arrays—>materials/textures/geometries->array.***中的元素
|
||
- 调用该接口后需要调用RebuildActorRender才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.AddActorRenderControllerArray("minecraft:pig", "controller.render.pig", clientApi.GetMinecraftEnum().RenderControllerArrayType.Texture, "Array.skins", "Texture.test")
|
||
```
|
||
|
||
|
||
|
||
## AddActorRenderMaterial
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加生物渲染需要的<a href="../../../../mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.html#_3-自定义材质">材质</a>
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 生物的identifier |
|
||
| materialKey | str | 材质的键 |
|
||
| materialName | str | 材质名称 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 添加是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用RebuildActorRender才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddActorRenderMaterial('minecraft:villager', 'custom_material_key', 'custom_material_name')
|
||
```
|
||
|
||
|
||
|
||
## AddActorScriptAnimate
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
在生物的客户端实体定义(minecraft:client_entity)json中的scripts/animate节点添加动画/动画控制器
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 实体identifier |
|
||
| animateName | str | 动画/动画控制器名称,如look_at_target |
|
||
| condition | str | 动画/动画控制器控制表达式,默认为空,如query.mod.index > 0 |
|
||
| autoReplace | bool | 是否覆盖已存在的动画/动画控制器,默认值为False |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 对于已经存在的生物,在调用CreateActorRender时需要传生物Id才能马上生效,对于不存在的生物,直接传levelId即可。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.AddActorAnimationController("minecraft:pig", "animation_controller_short_name", "controller.animation.pig.custom_animation_controller")
|
||
comp.AddActorScriptAnimate("minecraft:pig", "animation_controller_short_name", "query.mod.index > 0")
|
||
```
|
||
|
||
|
||
|
||
## AddActorSoundEffect
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加生物音效资源
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 实体identifier |
|
||
| soundKey | str | 音效资源Key |
|
||
| soundName | str | 音效资源名称 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 目前只支持在动作(animation)中播放音效,不支持在动作控制器(animation controller)中播放音效。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddActorSoundEffect("minecraft:villager", "sound_thunder", "ambient.weather.thunder")
|
||
```
|
||
|
||
|
||
|
||
## AddActorTexture
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加生物渲染贴图
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 生物实体identifier |
|
||
| textureKey | str | 贴图键 |
|
||
| texturePath | str | 贴图路径 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用RebuildActorRender才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddActorTexture("minecraft:sheep", "default", "textures/entity/panda/panda")
|
||
```
|
||
|
||
|
||
|
||
## AddAnimationControllerToOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加单个生物渲染动画控制器
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 生物的entityId |
|
||
| animationControllerKey | str | 动画控制器键 |
|
||
| animationControllerName | str | 动画控制器名称 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.AddAnimationControllerToOneActor(entityId, "controller__use_item_progress", "controller.animation.humanoid.use_item_progress")
|
||
```
|
||
|
||
|
||
|
||
## AddAnimationToOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加单个生物渲染动画
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 实体entityId |
|
||
| animationKey | str | 动画键 |
|
||
| animationName | str | 动画名称 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效
|
||
- 某些动画资源可能用到了molang表达式,在添加动画时请务必确保这些molang表达式也存在。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddAnimationToOneActor(entityId, "custom_move", "animation.armor_stand.default_pose")
|
||
```
|
||
|
||
|
||
|
||
## AddGeometryToOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加单个生物渲染几何体
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 生物实体entityId |
|
||
| geometryKey | str | 渲染几何体的键,如default |
|
||
| geometryName | str | 渲染几何体名称,如熊猫几何体geometry.panda |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效
|
||
动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图。建议先修改生物的动画以及动画控制器后再修改生物的几何。
|
||
- 某些生物受初始动画影响,几何体会有初始偏移,会导致修改几何体后表现异常。若修改后的几何体没有当前动画需要的骨骼时,会触发报错。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddGeometryToOneActor(entityId, "default", "geometry.panda")
|
||
```
|
||
|
||
|
||
|
||
## AddParticleEffectToOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加生物特效资源
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 实体entityId |
|
||
| effectKey | str | 特效资源Key,如bee.entity.json中的nectar_dripping |
|
||
| effectName | str | 特效资源名称,如minecraft:nectar_drip_particle |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddParticleEffectToOneActor(entityId, "nectar_dripping", "minecraft:nectar_drip_particle")
|
||
```
|
||
|
||
|
||
|
||
## AddRenderControllerToOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加单个生物<a href="../../../../mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.html#_7-自定义渲染控制器">的渲染控制器</a>
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 生物entityId |
|
||
| renderControllerName | str | 渲染控制器名称 |
|
||
| condition | str | 渲染控制器条件,当该条件成立时,renderControllerName指向的渲染控制器才会生效 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 添加是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddRenderControllerToOneActor(entityId, 'controller.render.llama', 'query.mod.condition')
|
||
```
|
||
|
||
|
||
|
||
## AddRenderMaterialToOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加单个生物渲染需要的<a href="../../../../mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.html#_3-自定义材质">材质</a>
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 生物的entityId |
|
||
| materialKey | str | 材质的键 |
|
||
| materialName | str | 材质名称 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 添加是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddRenderMaterialToOneActor(entityId, 'custom_material_key', 'custom_material_name')
|
||
```
|
||
|
||
|
||
|
||
## AddScriptAnimateToOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
在单个生物的客户端实体定义(minecraft:client_entity)json中的scripts/animate节点添加动画/动画控制器
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 实体entityId |
|
||
| animateName | str | 动画/动画控制器名称,如look_at_target |
|
||
| condition | str | 动画/动画控制器控制表达式,默认为空,如query.mod.index > 0 |
|
||
| autoReplace | bool | 是否覆盖已存在的动画/动画控制器,默认值为False |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.AddAnimationControllerToOneActor(entityId, animation_controller_short_name", "controller.animation.pig.custom_animation_controller")
|
||
comp.AddScriptAnimateToOneActor(entityId, "animation_controller_short_name", "query.mod.index > 0")
|
||
```
|
||
|
||
|
||
|
||
## AddSoundEffectToOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加单个生物的音效资源
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 实体entityId |
|
||
| soundKey | str | 音效资源Key |
|
||
| soundName | str | 音效资源名称 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 目前只支持在动作(animation)中播放音效,不支持在动作控制器(animation controller)中播放音效。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddSoundEffectToOneActor(entityId, "sound_thunder", "ambient.weather.thunder")
|
||
```
|
||
|
||
|
||
|
||
## AddTextureToOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
增加单个生物的渲染贴图
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 生物实体entityId |
|
||
| textureKey | str | 贴图键 |
|
||
| texturePath | str | 贴图路径 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.AddTextureToOneActor(entityId, "default", "textures/entity/panda/panda")
|
||
```
|
||
|
||
|
||
|
||
## BindEntityToEntity
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.modelCompClient.ModelComponentClient
|
||
|
||
- 描述
|
||
|
||
绑定骨骼模型跟随其他entity,如果当前entity是本地玩家,摄像机也跟随其他entity
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| bindEntityId | str | 绑定跟随的实体Id |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | False表示失败,True表示成功 |
|
||
|
||
- 备注
|
||
- 本接口只实现视觉效果,本质上实体还是在原地,因此需要调用接口设置实体的位置到其他entity的位置上,否则当实体本身不在摄像机范围内的时候就会不进行渲染了。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
# 将entityId的实体绑定至bindEntityId的实体
|
||
comp = clientApi.GetEngineCompFactory().CreateModel(entityId)
|
||
comp.BindEntityToEntity(bindEntityId)
|
||
```
|
||
|
||
|
||
|
||
## ClearActorBlockGeometry
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
删除实体中所有的方块几何体模型。
|
||
|
||
- 参数
|
||
|
||
无
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 删除是否成功,成功返回True,失败返回False。 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
blockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)
|
||
actorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender("-4294967295")
|
||
# 合并方块并转换为名叫"my_block_geometry"的方块几何体模型
|
||
geometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],"my_block_geometry")
|
||
# 添加到实体id为-4294967295的实体中
|
||
print actorRenderComp.AddActorBlockGeometry(geometryName)
|
||
# 清空实体中所有的方块几何体
|
||
print actorRenderComp.ClearActorBlockGeometry()
|
||
```
|
||
|
||
|
||
|
||
## CopyActorGeometryFromPlayer
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
将渲染几何体从某个玩家拷贝到某类生物identifier上
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| fromPlayerId | str | 源玩家id |
|
||
| toActorIdentifier | str | 拷贝到的生物identifier |
|
||
| fromGeometryKey | str | 源渲染几何体的键 |
|
||
| newGeometryKey | str | 拷贝后新渲染几何体的键 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用RebuildActorRender才会生效
|
||
动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图。建议先修改生物的动画以及动画控制器后再修改生物的几何。
|
||
- 某些生物受初始动画影响,几何体会有初始偏移,会导致修改几何体后表现异常。若修改后的几何体没有当前动画需要的骨骼时,会触发报错。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.CopyActorGeometryFromPlayer(playerId, "minecraft:sheep", "default", "default")
|
||
```
|
||
|
||
|
||
|
||
## CopyActorRenderMaterialFromPlayer
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
将渲染<a href="../../../../mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.html#_3-自定义材质">材质</a>从某个玩家拷贝到某类生物identifier上
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| fromPlayerId | str | 源玩家id |
|
||
| toActorIdentifier | str | 拷贝到的生物identifier |
|
||
| fromMaterialKey | str | 源材质的键 |
|
||
| newMaterialKey | str | 拷贝后新材质的键 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 添加是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用RebuildActorRender才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.CopyActorRenderMaterialFromPlayer(playerId, 'minecraft:sheep', 'default', 'default')
|
||
```
|
||
|
||
|
||
|
||
## CopyActorTextureFromPlayer
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
将贴图从某个玩家拷贝到某类生物identifier上
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| fromPlayerId | str | 源玩家id |
|
||
| toActorIdentifier | str | 拷贝到的生物identifier |
|
||
| fromTextureKey | str | 贴图键 |
|
||
| newTextureKey | str | 拷贝后新贴图的键 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用RebuildActorRender才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.CopyActorTextureFromPlayer(playerId, "minecraft:sheep", "default", "default")
|
||
```
|
||
|
||
|
||
|
||
## CopyPlayerGeometryToOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
将渲染几何体从某个玩家拷贝到某个生物上
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| fromPlayerId | str | 源玩家id |
|
||
| fromGeometryKey | str | 源渲染几何体的键 |
|
||
| newGeometryKey | str | 拷贝后新渲染几何体的键 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效
|
||
动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图。建议先修改生物的动画以及动画控制器后再修改生物的几何。
|
||
- 该接口使用时,会将这类生物当前的客户端数据拷贝一份,独立给这个实体使用(如果这个实体已经独自持有客户端数据则不会再次拷贝)
|
||
- 当生物离开再出现在视野时,不会恢复oneActor类渲染接口的设置,需要开发者监听[AddEntityClientEvent](../../事件/世界.md#addentityclientevent)再次设置entity类渲染接口进行恢复
|
||
- 某些生物受初始动画影响,几何体会有初始偏移,会导致修改几何体后表现异常。若修改后的几何体没有当前动画需要的骨骼时,会触发报错。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.CopyPlayerGeometryToOneActor(playerId, "default", "default")
|
||
```
|
||
|
||
|
||
|
||
## CopyPlayerRenderMaterialToOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
将渲染<a href="../../../../mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.html#_3-自定义材质">材质</a>从某个玩家拷贝到某个生物上
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| fromPlayerId | str | 源玩家id |
|
||
| fromMaterialKey | str | 源材质的键 |
|
||
| newMaterialKey | str | 拷贝后新材质的键 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 添加是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效
|
||
- 该接口使用时,会将这类生物当前的客户端数据拷贝一份,独立给这个实体使用(如果这个实体已经独自持有客户端数据则不会再次拷贝)
|
||
- 当生物离开再出现在视野时,不会恢复oneActor类渲染接口的设置,需要开发者监听[AddEntityClientEvent](../../事件/世界.md#addentityclientevent)再次设置entity类渲染接口进行恢复
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.CopyPlayerRenderMaterialToOneActor(playerId, 'default', 'default')
|
||
```
|
||
|
||
|
||
|
||
## CopyPlayerTextureToOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
将贴图从某个玩家拷贝到某个生物上
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| fromPlayerId | str | 源玩家id |
|
||
| fromTextureKey | str | 贴图键 |
|
||
| newTextureKey | str | 拷贝后新贴图的键 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效
|
||
- 该接口使用时,会将这类生物当前的客户端数据拷贝一份,独立给这个实体使用(如果这个实体已经独自持有客户端数据则不会再次拷贝)
|
||
- 当生物离开再出现在视野时,不会恢复oneActor类渲染接口的设置,需要开发者监听[AddEntityClientEvent](../../事件/世界.md#addentityclientevent)再次设置entity类渲染接口进行恢复
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.CopyPlayerTextureToOneActor(playerId, "default", "default")
|
||
```
|
||
|
||
|
||
|
||
## DeleteActorBlockGeometry
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
删除实体中指定方块几何体模型。
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| geometryName | str | 几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 删除是否成功,成功返回True,失败返回False。 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
blockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)
|
||
actorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender("-4294967295")
|
||
# 合并方块并转换为名叫"my_block_geometry"的方块几何体模型
|
||
geometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],"my_block_geometry")
|
||
# 添加到实体id为-4294967295的实体中
|
||
print actorRenderComp.AddActorBlockGeometry(geometryName)
|
||
# 删除刚才添加的方块几何体
|
||
print actorRenderComp.DeleteActorBlockGeometry(geometryName)
|
||
```
|
||
|
||
|
||
|
||
## GetActorRenderParams
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
获取实体(包括玩家)渲染参数
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 实体Id |
|
||
| paramTypeStr | str | 渲染参数类型,可选类型有"textures","geometry","materials","animations","render_controllers","particle_effects","sound_effects" |
|
||
| getValue | bool | 是否获取详细值,默认为False。该参数对render_controllers无效 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| list(str) | 参数列表,如获取失败则返回None |
|
||
|
||
- 备注
|
||
- 无法用于获取Player的ColorTexture
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
textureKeys = comp.GetActorRenderParams(entityId, "textures")
|
||
```
|
||
|
||
|
||
|
||
## GetEntityExtraUniforms
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
获取在实体shader当中使用的自定义变量的值。该自定义变量包含EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量。
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| uniformIndex | int | 需要设置的自定义变量的下标,值范围为1~4。分别对应EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4。 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| tuple(float,float,float,float) | 返回的对应自定义变量的值。获取失败则返回None。 |
|
||
|
||
- 备注
|
||
- 此接口是针对使用了原版BB模型的实体,使用了骨骼模型的实体和玩家请使用SetExtraUniformValue接口进行动态设置。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
actorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
# 获取实体id为entityId的实体正在使用的自定义变量EXTRA_ACTOR_UNIFORM2的值
|
||
print actorRenderComp.GetEntityExtraUniforms(2)
|
||
# 获取实体id为entityId的实体正在使用的自定义变量EXTRA_ACTOR_UNIFORM4的值
|
||
print actorRenderComp.GetEntityExtraUniforms(4)
|
||
```
|
||
|
||
|
||
|
||
## GetEntityRenderDistance
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
获取玩家的实体可渲染距离。玩家周围的实体指这个区块内的实体,也包含玩家自身。实体的渲染距离指,实体的位置到玩家相机位置的距离。可渲染距离指,如果实体的渲染距离在可渲染距离之内,则实体会被渲染出来,如果在距离以外,则实体不会被渲染出来。仅对本地玩家有效。
|
||
|
||
- 参数
|
||
|
||
无
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| float | 实体可渲染距离。如果获取失败,则返回-1 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
actorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
|
||
# 获取当前玩家的实体可渲染距离
|
||
print actorRenderComp.GetEntityRenderDistance()
|
||
```
|
||
|
||
|
||
|
||
## GetEntityUIExtraUniforms
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
获取在实体shader当中使用的UI自定义变量的值,该变量可在微软UI纸娃娃(paperdoll)及网易版纸娃娃(neteasepaperdoll)上使用identifier渲染某一类生物实体时使用。该自定义变量包含EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量。
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityIdentifier | str | 需要设置的实体identifier。如果获取玩家,则填写minecraft:player。 |
|
||
| uniformIndex | int | 需要设置的自定义变量的下标,值范围为1~4。分别对应EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4。 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| tuple(float,float,float,float) | 返回的对应自定义变量的值。获取失败则返回None。 |
|
||
|
||
- 备注
|
||
- 此接口是针对使用了原版BB模型的实体,使用了骨骼模型的实体和玩家请使用SetExtraUniformValue接口进行动态设置。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
actorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(None)
|
||
# 获取苦力怕正在使用的UI自定义变量EXTRA_ACTOR_UNIFORM2的值
|
||
print actorRenderComp.GetEntityUIExtraUniforms("minecraft:creeper", 2)
|
||
# 获取玩家正在使用的UI自定义变量EXTRA_ACTOR_UNIFORM4的值
|
||
print actorRenderComp.GetEntityUIExtraUniforms("minecraft:player",4)
|
||
```
|
||
|
||
|
||
|
||
## GetNotRenderAtAll
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
获取实体是否不渲染
|
||
|
||
- 参数
|
||
|
||
无
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | True表示不渲染 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
notRender = comp.GetNotRenderAtAll()
|
||
```
|
||
|
||
|
||
|
||
## IsShowName
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.nameCompClient.NameComponentClient
|
||
|
||
- 描述
|
||
|
||
获取生物名字是否按照默认游戏逻辑显示(包括玩家)
|
||
|
||
- 参数
|
||
|
||
无
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 返回是否按照默认游戏逻辑显示 |
|
||
|
||
- 备注
|
||
- 获取的值仅代表实体名字是否显示,但是最终是否显示还会受到全局名字是否显示影响,详见接口HideNameTag
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateName(entityId)
|
||
comp.IsShowName()
|
||
```
|
||
|
||
|
||
|
||
## RebuildActorRender
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
重建生物的数据渲染器(该接口不支持玩家,玩家请使用RebuildPlayerRender)
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 实体identifier |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 重建是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.RebuildActorRender('minecraft:villager')
|
||
```
|
||
|
||
|
||
|
||
## RebuildRenderForOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
使用完entity类渲染接口后,重建单个生物渲染控制器(该接口不支持玩家,玩家请使用RebuildPlayerRender)
|
||
|
||
- 参数
|
||
|
||
无
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 重建是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.RebuildRenderForOneActor()
|
||
```
|
||
|
||
|
||
|
||
## RemoveActorAnimationController
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
移除生物渲染动画控制器
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 生物的identifier |
|
||
| animationControllKey | str | 动画控制器键,注意,该值需要在json中动画控制器键加上前缀“controller__” |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.RemoveActorAnimationController("minecraft:villager", "controller__use_item_progress")
|
||
```
|
||
|
||
|
||
|
||
## RemoveActorGeometry
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
删除生物渲染几何体
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 生物实体identifier |
|
||
| geometryKey | str | 渲染几何体名称,如熊猫几何体geometry.panda |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用RebuildActorRender才会生效
|
||
动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
# geometry definition in panda.entity.json
|
||
# "geometry": {
|
||
# "default": "geometry.panda"
|
||
# },
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.RemoveActorGeometry("minecraft:panda", "default")
|
||
```
|
||
|
||
|
||
|
||
## RemoveActorRenderController
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
删除生物<a href="../../../../mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.html#_7-自定义渲染控制器">渲染控制器</a>
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 生物identifier |
|
||
| renderControllerName | str | 渲染控制器名称 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 删除是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用RebuildActorRender才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.RemoveActorRenderController('minecraft:villager', 'custom_render_controller_name')
|
||
```
|
||
|
||
|
||
|
||
## RemoveActorTexture
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
删除生物渲染贴图
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 生物实体identifier |
|
||
| textureKey | str | 贴图键,如default |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用RebuildActorRender才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
# texture definition in panda.entity.json
|
||
# "textures": {
|
||
# "default": "textures/entity/panda/panda",
|
||
# "lazy": "textures/entity/panda/panda_lazy",
|
||
# "worried": "textures/entity/panda/panda_worried",
|
||
# "playful": "textures/entity/panda/panda_playful",
|
||
# "brown": "textures/entity/panda/panda_brown",
|
||
# "weak": "textures/entity/panda/panda_sneezy",
|
||
# "aggressive": "textures/entity/panda/panda_aggressive"
|
||
# }
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.RemoveActorTexture("minecraft:panda", "default")
|
||
```
|
||
|
||
|
||
|
||
## RemoveAnimationControllerForOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
移除单个生物渲染动画控制器
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 生物的entityId |
|
||
| animationControllKey | str | 动画控制器键,注意,该值需要在json中动画控制器键加上前缀“controller__” |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.RemoveAnimationControllerForOneActor(entityId, "controller__use_item_progress")
|
||
```
|
||
|
||
|
||
|
||
## RemoveGeometryForOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
删除单个生物的渲染几何体
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 生物实体entityId |
|
||
| geometryKey | str | 渲染几何体名称,如熊猫几何体geometry.panda |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效
|
||
动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
# geometry definition in panda.entity.json
|
||
# "geometry": {
|
||
# "default": "geometry.panda"
|
||
# },
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.RemoveGeometryForOneActor("0", "default")
|
||
```
|
||
|
||
|
||
|
||
## RemoveRenderControllerForOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
删除单个生物<a href="../../../../mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.html#_7-自定义渲染控制器">的渲染控制器</a>
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 生物entityId |
|
||
| renderControllerName | str | 渲染控制器名称 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 删除是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.RemoveRenderControllerForOneActor('0', 'custom_render_controller_name')
|
||
```
|
||
|
||
|
||
|
||
## RemoveTextureForOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
删除单个生物的渲染贴图
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityId | str | 生物实体entityId |
|
||
| textureKey | str | 贴图键,如default |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用[RebuildRenderForOneActor](#rebuildrenderforoneactor)才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.RemoveTextureForOneActor("0", "default")
|
||
```
|
||
|
||
|
||
|
||
## ResetActorRender
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
重置实体渲染接口,包括动画、动画控制器、渲染控制器、贴图、材质、特效资源、音效资源等。
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 生物的identifier |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否成功 |
|
||
|
||
- 备注
|
||
- 该接口目前只对生物生效,无法对玩家实体生效。只有修改过的实体才能reset成功,并且reset后在有新修改前,都无法reset成功。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(levelId)
|
||
comp.ResetActorRender("minecraft:sheep")
|
||
```
|
||
|
||
|
||
|
||
## ResetBindEntity
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.modelCompClient.ModelComponentClient
|
||
|
||
- 描述
|
||
|
||
取消目标entity的绑定实体,取消后不再跟随任何其他entity
|
||
|
||
- 参数
|
||
|
||
无
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | False表示失败,True表示成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateModel(entityId)
|
||
comp.ResetBindEntity()
|
||
```
|
||
|
||
|
||
|
||
## ResetRenderForOneActor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
将调用OneActor类渲染接口(CopyPlayerTextureToOneActor、CopyPlayerRenderMaterialToOneActor等)的生物重置回种群
|
||
|
||
- 参数
|
||
|
||
无
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 重置是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.ResetRenderForOneActor()
|
||
```
|
||
|
||
|
||
|
||
## SetActorAllBlockGeometryVisible
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
设置实体中所有的方块几何体模型是否显示。
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| visible | bool | 设置是否显示或隐藏,True表示显示,False表示隐藏 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 设置是否成功,成功返回True,失败返回False。 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
blockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)
|
||
actorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender("-4294967295")
|
||
# 合并方块并转换为名叫"my_block_geometry"的方块几何体模型
|
||
geometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],"my_block_geometry")
|
||
# 添加到实体id为-4294967295的实体中
|
||
print actorRenderComp.AddActorBlockGeometry(geometryName)
|
||
# 隐藏所有的方块几何体
|
||
print actorRenderComp.SetActorAllBlockGeometryVisible(False)
|
||
```
|
||
|
||
|
||
|
||
## SetActorBlockGeometryVisible
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
设置实体中指定的方块几何体模型是否显示。
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| geometryName | str | 几何体模型的名称,用于标识每个几何体模型,相当于是该模型的id |
|
||
| visible | bool | 设置是否显示或隐藏,True表示显示,False表示隐藏 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 设置是否成功,成功返回True,失败返回False。 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
blockGeometryComp = clientApi.GetEngineCompFactory().CreateBlockGeometry(levelId)
|
||
actorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender("-4294967295")
|
||
# 合并方块并转换为名叫"my_block_geometry"的方块几何体模型
|
||
geometryName = blockGeometryComp.CombineBlockFromPosListToGeometry([(200,64,200),(201,65,202)],"my_block_geometry")
|
||
# 添加到实体id为-4294967295的实体中
|
||
print actorRenderComp.AddActorBlockGeometry(geometryName)
|
||
# 隐藏刚才添加的方块几何体
|
||
print actorRenderComp.SetActorBlockGeometryVisible(geometryName, False)
|
||
```
|
||
|
||
|
||
|
||
## SetAlwaysShowName
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.nameCompClient.NameComponentClient
|
||
|
||
- 描述
|
||
|
||
设置生物名字是否一直显示,瞄准点不指向生物时也能显示
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| show | bool | True为显示 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 返回是否设置成功 |
|
||
|
||
- 备注
|
||
- 该接口只对普通生物生效,对玩家设置不起作用
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateName(entityId)
|
||
# 不显示头上的名字
|
||
comp.SetAlwaysShowName(False)
|
||
```
|
||
|
||
|
||
|
||
## SetColor
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.healthCompClient.HealthComponentClient
|
||
|
||
- 描述
|
||
|
||
设置血条的颜色及背景色
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| front | tuple(float,float,float,float) | 血条颜色的RGBA值,范围0-1 |
|
||
| back | tuple(float,float,float,float) | 背景颜色的RGBA值,范围0-1 |
|
||
|
||
- 返回值
|
||
|
||
无
|
||
|
||
- 备注
|
||
- 必须用game组件设置ShowHealthBar时才能显示血条!!
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateHealth(entityId)
|
||
comp.SetColor((0, 0, 0, 1), (1, 1, 1, 1))
|
||
```
|
||
|
||
|
||
|
||
## SetEntityExtraUniforms
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
设置可在实体shader当中使用的自定义变量的值。该自定义变量总共可设置EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量,向量的默认值为(1.0,1.0,1.0,1.0)。
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| uniformIndex | int | 需要设置的自定义变量的下标,值范围为1~4。分别对应EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4。 |
|
||
| data | tuple(float,float,float,float) | 需要设置的自定义变量的值。 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 设置是否成功,成功返回True,否则返回False |
|
||
|
||
- 备注
|
||
- 此接口是针对使用了原版BB模型的实体,使用了骨骼模型的实体和玩家请使用SetExtraUniformValue接口进行动态设置。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
actorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
# 对实体id为entityId的实体设置自定义变量EXTRA_ACTOR_UNIFORM1的值
|
||
print actorRenderComp.SetEntityExtraUniforms(1, (2.5,2.5,2.5,2.5))
|
||
# 对实体id为entityId的实体设置自定义变量EXTRA_ACTOR_UNIFORM3的值
|
||
print actorRenderComp.SetEntityExtraUniforms(3, (3.0,3.0,3.0,3.0))
|
||
# 接下来,我们在实体的vertex shader或是fragment shader中做如下声明及使用:
|
||
#
|
||
# // .. 省略其他代码
|
||
# // 声明这两个自定义变量
|
||
# uniform vec4 EXTRA_ACTOR_UNIFORM1;
|
||
# uniform vec4 EXTRA_ACTOR_UNIFORM3;
|
||
#
|
||
# void main() {
|
||
# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM1;
|
||
# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM3;
|
||
# // .. do what you want ..
|
||
# }
|
||
```
|
||
|
||
|
||
|
||
## SetEntityRenderDistance
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
设置玩家周围的实体的可渲染距离。玩家周围的实体指这个区块内的实体,也包含玩家自身。实体的渲染距离指,实体的位置到玩家相机位置的距离。可渲染距离指,如果实体的渲染距离在可渲染距离之内,则实体会被渲染出来,如果在距离以外,则实体不会被渲染出来。仅对本地玩家有效。
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| distance | float | 实体的可渲染距离,有效值范围为大于等于0。如果小于0,则使用原版游戏内的默认可渲染距离。 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 设置是否成功,成功返回True,失败返回False。 |
|
||
|
||
- 备注
|
||
- 需要特别注意,该渲染距离指的是实体的位置到玩家相机的位置,而非玩家的位置。当玩家相机视觉上下转动或是左右转动时,玩家相机的位置是绕以相机中心为球心的球形表面进行旋转。因此视觉转动时,玩家相机位置与实体之间距离也会进行改变,导致该实体的渲染距离改变。一些玩法会改变相机位置制作来超远或者超过视角的,可能会出现看不到玩家自身模型的问题。此时可以调用该接口来调整渲染距离,从而使得玩家自身可见或不可见。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
actorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
|
||
# 设置实体的可渲染距离为48
|
||
print actorRenderComp.SetEntityRenderDistance(48)
|
||
```
|
||
|
||
|
||
|
||
## SetEntityUIExtraUniforms
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
设置可在实体shader当中使用的UI自定义变量的值,可在微软UI纸娃娃(paperdoll)及网易版纸娃娃(neteasepaperdoll)上使用identifier渲染某一类生物实体时使用。该自定义变量总共可设置EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4,总共4组,每组为一个vec4(float, float, float ,float)类型的向量,向量的默认值为(1.0,1.0,1.0,1.0)。
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| entityIdentifier | str | 需要设置的实体identifier。如果需要对玩家设置,则填写minecraft:player。 |
|
||
| uniformIndex | int | 需要设置的自定义变量的下标,值范围为1~4。分别对应EXTRA_ACTOR_UNIFORM1,EXTRA_ACTOR_UNIFORM2,EXTRA_ACTOR_UNIFORM3,EXTRA_ACTOR_UNIFORM4。 |
|
||
| data | tuple(float,float,float,float) | 需要设置的自定义变量的值。 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 设置是否成功,成功返回True,否则返回False |
|
||
|
||
- 备注
|
||
- 此接口是针对使用了原版BB模型的实体,使用了骨骼模型的实体和玩家请使用SetExtraUniformValue接口进行动态设置。
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
actorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(None)
|
||
# 对苦力怕设置自定义变量EXTRA_ACTOR_UNIFORM1的值
|
||
print actorRenderComp.SetEntityUIExtraUniforms("minecraft:creeper", 1, (2.5,2.5,2.5,2.5))
|
||
# 对玩家实体设置自定义变量EXTRA_ACTOR_UNIFORM3的值
|
||
print actorRenderComp.SetEntityUIExtraUniforms("minecraft:player", 3, (3.0,3.0,3.0,3.0))
|
||
# 接下来,我们在实体的vertex shader或是fragment shader中做如下声明及使用:
|
||
#
|
||
# // .. 省略其他代码
|
||
# // 声明这两个自定义变量
|
||
# uniform vec4 EXTRA_ACTOR_UNIFORM1;
|
||
# uniform vec4 EXTRA_ACTOR_UNIFORM3;
|
||
#
|
||
# void main() {
|
||
# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM1;
|
||
# vec4 my_custom_value = EXTRA_ACTOR_UNIFORM3;
|
||
# // .. do what you want ..
|
||
# }
|
||
```
|
||
|
||
|
||
|
||
## SetHealthBarDeviation
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.healthCompClient.HealthComponentClient
|
||
|
||
- 描述
|
||
|
||
设置某个entity血条的相对高度
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| health_bar_deviation | float | 血条的相对高度 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 是否设置成功 |
|
||
|
||
- 备注
|
||
- 必须用game组件设置ShowHealthBar时才能显示血条;血条默认在生物AABB上方1.5高度处
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateHealth(entityId)
|
||
# 设置血条的相对高度
|
||
comp.SetHealthBarDeviation(1.0)
|
||
```
|
||
|
||
|
||
|
||
## SetNameDeeptest
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.gameCompClient.GameComponentClient
|
||
|
||
- 描述
|
||
|
||
设置名字是否透视
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| deeptest | bool | True为不透视。默认情况下为透视 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 设置是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateGame(levelId)
|
||
# 设置为不透视
|
||
comp.SetNameDeeptest(True)
|
||
```
|
||
|
||
|
||
|
||
## SetNotRenderAtAll
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.actorRenderCompClient.ActorRenderCompClient
|
||
|
||
- 描述
|
||
|
||
设置是否关闭实体渲染
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| notRender | bool | True表示不渲染该实体 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 设置是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
# 不渲染单个实体 entityId
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(entityId)
|
||
comp.SetNotRenderAtAll(True)
|
||
# 重新开始渲染该实体
|
||
comp.SetNotRenderAtAll(False)
|
||
```
|
||
|
||
|
||
|
||
## SetRenderLocalPlayer
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.gameCompClient.GameComponentClient
|
||
|
||
- 描述
|
||
|
||
设置本地玩家是否渲染
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| render | bool | True为渲染 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 设置是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateGame(levelId)
|
||
# 不渲染本地玩家
|
||
comp.SetRenderLocalPlayer(False)
|
||
```
|
||
|
||
|
||
|
||
## SetShowName
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.nameCompClient.NameComponentClient
|
||
|
||
- 描述
|
||
|
||
设置生物名字是否按照默认游戏逻辑显示(包括玩家)
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| show | bool | True为显示 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 返回是否设置成功 |
|
||
|
||
- 备注
|
||
- 1. 当设置为True时,生物的名字显示遵循游戏默认的渲染逻辑,即普通生物需要中心点指向生物才显示名字,玩家则是会一直显示名字
|
||
2. 但设置为False时,生物名字不再显示。
|
||
3. 生物名字显示与否还会受到全局名字显示与否影响,详见接口HideNameTag
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateName(entityId)
|
||
# 不显示头上的名字
|
||
comp.SetShowName(False)
|
||
```
|
||
|
||
|
||
|
||
## ShowHealth
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.healthCompClient.HealthComponentClient
|
||
|
||
- 描述
|
||
|
||
设置某个entity是否显示血条,默认为显示
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| show | bool | 设置是否显示 |
|
||
|
||
- 返回值
|
||
|
||
无
|
||
|
||
- 备注
|
||
- 必须用game组件设置ShowHealthBar时才能显示血条!!
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateHealth(entityId)
|
||
# 设置该entity不显示血条
|
||
comp.ShowHealth(False)
|
||
```
|
||
|
||
|
||
|
||
## ShowHealthBar
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.gameCompClient.GameComponentClient
|
||
|
||
- 描述
|
||
|
||
设置是否显示血条
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| show | bool | True为显示。开启后可用health组件的SetColor、ShowHealth接口,单独设置某个实体的血条颜色及是否显示 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 设置是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateGame(levelId)
|
||
comp.ShowHealthBar(True)
|
||
```
|
||
|
||
|
||
|