1159 lines
30 KiB
Markdown
1159 lines
30 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 | 是否成功 |
|
||
|
||
- 示例
|
||
|
||
```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
|
||
|
||
- 描述
|
||
|
||
增加生物[渲染控制器](/mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.html#_7-自定义渲染控制器)
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <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
|
||
|
||
- 描述
|
||
|
||
增加生物渲染需要的[材质](/mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.html#_3-自定义材质)
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| actorIdentifier | str | 生物的identifier |
|
||
| materialKey | str | 材质key |
|
||
| materialName | str | 材质名称 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 添加是否成功 |
|
||
|
||
- 备注
|
||
- 调用该接口后需要调用RebuildActorRender才会生效
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
|
||
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")
|
||
```
|
||
|
||
|
||
|
||
## BindEntityToEntity
|
||
|
||
<span style="display:inline;color:#7575f9">客户端</span>
|
||
|
||
method in mod.client.component.modelCompClient.ModelComponentClient
|
||
|
||
- 描述
|
||
|
||
绑定骨骼模型跟随其他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()
|
||
```
|
||
|
||
|
||
|
||
## 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)
|
||
```
|
||
|
||
|
||
|
||
## 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()
|
||
```
|
||
|
||
|
||
|
||
## 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')
|
||
```
|
||
|
||
|
||
|
||
## 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
|
||
|
||
- 描述
|
||
|
||
删除生物[渲染控制器](/mcguide/20-玩法开发/15-自定义游戏内容/3-自定义生物/01-自定义基础生物.html#_7-自定义渲染控制器)
|
||
|
||
- 参数
|
||
|
||
| 参数名 | <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")
|
||
```
|
||
|
||
|
||
|
||
## 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()
|
||
```
|
||
|
||
|
||
|
||
## 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))
|
||
```
|
||
|
||
|
||
|
||
## 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 | 返回是否设置成功 |
|
||
|
||
- 备注
|
||
- 当设置为True时,生物的名字显示遵循游戏默认的渲染逻辑,即普通生物需要中心点指向生物才显示名字,玩家则是会一直显示名字
|
||
|
||
- 示例
|
||
|
||
```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组件单独设置某个实体的血条颜色及是否显示 |
|
||
|
||
- 返回值
|
||
|
||
| <div style="width: 4em">数据类型</div> | 说明 |
|
||
| :--- | :--- |
|
||
| bool | 设置是否成功 |
|
||
|
||
- 示例
|
||
|
||
```python
|
||
import mod.client.extraClientApi as clientApi
|
||
comp = clientApi.GetEngineCompFactory().CreateGame(levelId)
|
||
comp.ShowHealthBar(True)
|
||
```
|
||
|
||
|
||
|