Skip to content

渲染 ​

AddPlayerAnimation ​

客户端玩家渲染 动画注册 动画资源开发补充

能力:动画 · 自定义姿势 · 玩家

向玩家渲染定义添加动画资源。

关联流程:玩家自定义动画接线
  1. 注册动画与控制器:AddPlayerAnimation、AddPlayerAnimationController
  2. 接入状态:AddPlayerAnimationIntoState

需要动画 JSON 和状态驱动;第一人称抬手与现有资源包、模型的组合必须按目标包体核验。

渲染

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

增加玩家渲染动画

  • 参数
参数名数据类型说明
animationKeystr动画键
animationNamestr动画名称
  • 返回值
数据类型说明
bool是否成功
  • 备注

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 该接口的animationName参数不能传入带有大写字母的字符串,否则动画将注册失败。

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.AddPlayerAnimation("move.arms", "animation.player.move.arms_custom")

AddPlayerAnimationController ​

客户端玩家渲染 动画控制器 控制器注册开发补充

能力:动画 · 自定义姿势 · 玩家

为玩家渲染添加动画控制器。

关联流程:玩家自定义动画接线
  1. 注册动画与控制器:AddPlayerAnimation、AddPlayerAnimationController
  2. 接入状态:AddPlayerAnimationIntoState

需要动画 JSON 和状态驱动;第一人称抬手与现有资源包、模型的组合必须按目标包体核验。

渲染

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

增加玩家渲染动画控制器

  • 参数
参数名数据类型说明
animationControllerKeystr动画控制器键
animationControllerNamestr动画控制器名称
  • 返回值
数据类型说明
bool是否成功
  • 备注

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.AddPlayerAnimationController("root", "controller.animation.player.root_custom")

AddPlayerAnimationIntoState ​

客户端玩家渲染 动画状态 状态修改开发补充

能力:动画 · 自定义姿势 · 玩家

向指定动画控制器状态中添加动画或控制器。

关联流程:玩家自定义动画接线
  1. 注册动画与控制器:AddPlayerAnimation、AddPlayerAnimationController
  2. 接入状态:AddPlayerAnimationIntoState

需要动画 JSON 和状态驱动;第一人称抬手与现有资源包、模型的组合必须按目标包体核验。

渲染

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

在玩家的动画控制器中的状态添加动画或者动画控制器

  • 参数
参数名数据类型说明
animationControllerNamestr动画控制器名称,如root(controller.animation.player.root)
stateNamestr动画状态名称,如first_person
animationNamestr添加的动画名称或动画控制器名称,如first_person_attack_controller_new
conditionstr动画控制表达式,默认为空,如query.mod.index > 0
  • 返回值
数据类型说明
bool是否成功
  • 备注

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.AddPlayerAnimationIntoState("root", "first_person", "first_person_attack_controller_new", "query.mod.index > 0")

AddPlayerGeometry ​

客户端玩家渲染 几何体注册 模型资源开发补充

添加玩家渲染使用的几何体。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

增加玩家渲染几何体

  • 参数
参数名数据类型说明
geometryKeystr渲染几何体键,如玩家默认几何体default
geometryNamestr渲染几何体名称,如玩家默认几何体geometry.humanoid.custom
  • 返回值
数据类型说明
bool是否成功
  • 备注

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.AddPlayerGeometry("default", "geometry.player.custom")

AddPlayerParticleEffect ​

客户端玩家渲染 粒子资源 资源注册开发补充

添加玩家粒子特效资源定义。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

增加玩家特效资源

  • 参数
参数名数据类型说明
effectKeystr特效资源Key,如bee.entity.json中的nectar_dripping
effectNamestr特效资源名称,如minecraft:nectar_drip_particle
  • 返回值
数据类型说明
bool是否成功
  • 备注

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.AddPlayerParticleEffect("nectar_dripping", "minecraft:nectar_drip_particle")

AddPlayerRenderController ​

客户端玩家渲染 渲染控制器 控制器注册开发补充

添加玩家渲染控制器。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

增加玩家渲染控制器

  • 参数
参数名数据类型说明
renderControllerNamestr渲染控制器名称
conditionstr渲染控制器条件
  • 返回值
数据类型说明
bool添加是否成功
  • 备注

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.AddPlayerRenderController('custom_render_controller_name', 'query.mod.condition')

AddPlayerRenderMaterial ​

客户端玩家渲染 材质注册 渲染资源开发补充

添加玩家渲染使用的材质。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

增加玩家渲染需要的材质

  • 参数
参数名数据类型说明
materialKeystr材质key
materialNamestr材质名称
  • 返回值
数据类型说明
bool添加是否成功
  • 备注

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.AddPlayerRenderMaterial('custom_material_key', 'custom_material_name')

AddPlayerScriptAnimate ​

客户端玩家渲染 动画脚本 动画绑定开发补充

向玩家客户端定义的动画脚本节点添加动画或控制器。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

在玩家的客户端实体定义(minecraft:client_entity)json中的scripts/animate节点添加动画/动画控制器

  • 参数
参数名数据类型说明
animateNamestr动画/动画控制器名称,如look_at_target
conditionstr动画/动画控制器控制表达式,默认为空,如query.mod.index > 0
autoReplacebool是否覆盖已存在的动画/动画控制器,默认值为False
  • 返回值
数据类型说明
bool是否成功
  • 备注

  • 该接口只对CreateActorRender时传入的playerId起效果

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.AddPlayerAnimationController("animation_controller_short_name", "controller.animation.player.root_custom")
comp.AddPlayerScriptAnimate("animation_controller_short_name", "query.mod.index > 0")

AddPlayerSoundEffect ​

客户端玩家渲染 音效资源 资源注册开发补充

添加玩家音效资源定义。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

增加玩家音效资源

  • 参数
参数名数据类型说明
soundKeystr音效资源Key
soundNamestr音效资源名称
  • 返回值
数据类型说明
bool是否成功
  • 备注

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 音效在RP/entities/player.entity.json # minecraft:client_entity / description中的定义如下: "sound_effects": { "sound_thunder": "ambient.weather.thunder" # ambient.weather.thunder是sound_definitions中定义 } 如果在动作中同步播放音频,可以在RP/animations/player.animation_controllers.json # animation_controllers / controller.animation.player.root中定义如下: "dripping": { "sound_effects": [ { "effect": "sound_thunder" } ], "transitions": [ { "third_person": "!query.mod.is_powered" } ] },

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.AddPlayerSoundEffect("sound_thunder", "ambient.weather.thunder")

AddPlayerTexture ​

客户端玩家渲染 贴图注册 渲染资源开发补充

添加玩家渲染使用的贴图。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

增加玩家渲染贴图

  • 参数
参数名数据类型说明
textureKeystr贴图键
textureNamestr贴图路径
  • 返回值
数据类型说明
bool是否成功
  • 备注

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.AddPlayerTexture("default", "textures/misc/missing_texture")

RebuildPlayerRender ​

客户端玩家渲染 渲染重建 资源应用开发补充

重建玩家渲染数据,使相关渲染定义重新生效。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

重建玩家的数据渲染器

  • 参数
参数名数据类型说明
clearBindParticlebool是否清除粒子,默认为False
  • 返回值
数据类型说明
bool重建是否成功
  • 备注

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.RebuildPlayerRender()

RemovePlayerAnimationController ​

客户端玩家渲染 动画控制器 控制器移除开发补充

移除玩家动画控制器。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

移除玩家渲染动画控制器

  • 参数
参数名数据类型说明
animationControllKeystr动画控制器键
  • 返回值
数据类型说明
bool是否成功
  • 备注

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.RemovePlayerAnimationController("root")

RemovePlayerAnimationFromState ​

客户端玩家渲染 动画状态 状态修改开发补充

从控制器状态中移除动画或动画控制器。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

在玩家的动画控制器中的状态移除动画或者动画控制器

  • 参数
参数名数据类型说明
animationControllerNamestr动画控制器名称,如root(controller.animation.player.root)
stateNamestr动画状态名称,如first_person
animationNamestr要移除的动画名称或动画控制器名称,如first_person_attack_controller_new
  • 返回值
数据类型说明
bool是否成功。controller/state 不存在或参数错误返False;动画不在该state中视为幂等成功,返True。
  • 备注

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.RemovePlayerAnimationFromState("root", "first_person", "first_person_attack_controller_new")

RemovePlayerGeometry ​

客户端玩家渲染 几何体移除 模型资源开发补充

删除玩家渲染使用的几何体。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

删除玩家渲染几何体

  • 参数
参数名数据类型说明
geometryKeystr渲染几何体名称键,如玩家默认几何体default
  • 返回值
数据类型说明
bool是否成功
  • 备注

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 动画和贴图都是与几何体密切相关的,改变几何体也需要改变动画与贴图

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 示例

python
import mod.client.extraClientApi as clientApi
# geometry definition in player.entity.json
"geometry": {
    "default": "geometry.humanoid.custom",
    "cape": "geometry.cape"
}
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.RemovePlayerGeometry("default")

RemovePlayerRenderController ​

客户端玩家渲染 渲染控制器 控制器移除开发补充

删除玩家渲染控制器。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

删除玩家渲染控制器

  • 参数
参数名数据类型说明
renderControllerNamestr渲染控制器名称
  • 返回值
数据类型说明
bool删除是否成功
  • 备注

  • 调用该接口后需要调用RebuildPlayerRender才会生效

  • 该玩家重新进入视野时仍会生效,引擎会自动重新调用一遍

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
comp.RemovePlayerRenderController('custom_render_controller_name')

ResetSkin ​

客户端玩家皮肤 皮肤还原 外观重置开发补充

恢复玩家默认皮肤。

客户端

method in mod.client.component.modelCompClient.ModelComponentClient

  • 描述

还原默认皮肤

  • 参数
参数名数据类型说明
isStevebool是否还原成Steve默认皮肤, 默认为True。当isSteve为False时,则还原成资源中心中购买并穿戴的皮肤
  • 返回值
数据类型说明
bool设置是否成功
python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateModel(playerId)
comp.ResetSkin()

SetPlayerItemInHandVisible ​

客户端手持物品 模型显示 可见性设置开发补充

控制玩家手持物品模型是否显示。

客户端

method in mod.client.component.actorRenderCompClient.ActorRenderCompClient

  • 描述

设置是否隐藏玩家的手持物品模型显示

  • 参数
参数名数据类型说明
visiblebool设置是否显示或隐藏,True表示显示,False表示隐藏
modeint设置隐藏手持物品在哪一个视角模式生效。mode=0时,表示第一人称和第三人称下均隐藏手持物品;mode=1时表示仅隐藏第三人称下的手持物品;mode=2时表示仅隐藏第一人称下的手持物品。默认值为0。填入0,1,2以外的数值会被强制设置为0
  • 返回值
数据类型说明
bool设置是否成功,成功返回True,失败返回False。
  • 示例
python
import mod.client.extraClientApi as clientApi
actorRenderComp = clientApi.GetEngineCompFactory().CreateActorRender(playerId)
# 隐藏指定玩家的手持物品模型显示
print actorRenderComp.SetPlayerItemInHandVisible(False, 0)

SetSkin ​

客户端玩家皮肤 皮肤设置 外观替换开发补充

更换原版自定义皮肤。

客户端

method in mod.client.component.modelCompClient.ModelComponentClient

  • 描述

更换原版自定义皮肤

  • 参数
参数名数据类型说明
skinstr贴图路径,以textures/models为当前路径的相对路径
  • 返回值
数据类型说明
bool设置是否成功
  • 备注

  • 会覆盖原有皮肤(包括4d皮肤)。但会被骨骼模型覆盖

  • 只能修改Steve模型的皮肤,不能修改Alex模型的皮肤

  • 如需修改细手臂模型皮肤,请使用AddPlayerTexture修改default键对应的贴图

  • 示例

python
import mod.client.extraClientApi as clientApi
comp = clientApi.GetEngineCompFactory().CreateModel(playerId)
comp.SetSkin("kagura")