Files
netease-modsdk-wiki/docs/mconline/10-addon教程/第07章:自定义生物/课程12.继承鸡的动画.md
2025-03-17 13:24:39 +08:00

76 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
front:
hard: 进阶
time: 20分钟
---
# 继承鸡的动画
#### 作者:境界
将green_head_duck.geo.json放入材质包中models文件夹的entity文件夹内。
将green_head_duck.png放入材质包中textures文件夹内的entity文件夹里。
在材质包中的entity文件夹里新建一个green_head_duck.entity.json文件。
```
{
"format_version": "1.10.0",
"minecraft:client_entity": {
"description": {
"identifier": "design:green_head_duck",
"render_controllers": [
"controller.render.default"
],
"textures": {
"default": "textures/entity/green_head_duck"
},
"geometry": {
"default": "geometry.green_head_duck"
},
"materials": {
"default": "entity_alphatest"
},
"animations": {
"move": "animation.chicken.move",
"look_at_target": "animation.common.look_at_target"
},
"scripts": {
"animate": [
{ "move": "query.modified_move_speed" },
"look_at_target"
]
},
"spawn_egg": {
"base_color": "#256143",
"overlay_color": "#dd9238"
}
}
}
}
```
1首先我们将名称域定义为design:green_head_duck。
2接着我们使用原版默认的基础渲染控制器"controller.render.default",它会控制生物渲染成一份由一个模型、一张贴图、一份材质组合的生物形象。
3接着在textures中我们将贴图资源路径指向存放在textures/entity里的green_head_duck贴图请注意在这里你不需要写出贴图文件后缀名。
4在geometry中我们将模型资源指向前面做好的几何体模型上。在项目一开始时我们导出的模型是由鸡模型魔改而成因此打开水鸭模型时模型的名称域依旧是geometry.chicken为了避免资源冲突需要提前将这里改为geometry.green_head_duck。
5在materials中将材质设置为entity_alphatest它将允许生物使用带有透明通道的贴图。
6在animations下加载鸡的移动动画和注视动画。
7在scripts/animate下将动画加载上去。
8在spawn_egg里我们新增两个属性键值一个是"base_color",值为"#256143"这是代表着一种深绿色的颜色色量而值代表蛋的基础颜色。新增一个“overlay_color“值为"#dd9238",而值代表蛋的斑点颜色。