Files
netease-modsdk-wiki/docs/mconline/10-addon教程/第06章:认识Addon/课程08.简单教学②:修改牛的掉落物为鸡的掉落物.md
2025-03-17 13:24:39 +08:00

50 lines
1.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: https://mc.res.netease.com/pc/zt/20201109161633/mc-dev/assets/img/8_1.325675fb.png
hard: 入门
time: 10分钟
---
# 简单教学②:修改牛的掉落物为鸡的掉落物
#### 作者:境界
在《开始认识行为包》章节已知,通过游戏根目录/data/behavior_packs/vanilla/entities中可以找到原版牛的行为文件。开发者也可以下载原版Add-on附加包模板通常压缩包内会携带behavior_packs文件夹与前面提到的游戏根目录下所寻找的行为文件夹相对应。
![](./images/8_1.png)
```
{
"format_version": "1.16.0",
"minecraft:entity": {
"description": {
},
"component_groups": {
"minecraft:cow_adult": {
"minecraft:loot": {
"table": "loot_tables/entities/cow.json"
}
}
},
"components": {
},
"events": {}
}
}
```
![](./images/8_2.png)
minecraft:loot是管理生物掉落物表的组件。table的参数指向loot_tables文件夹下的一个表文件路径。根据路径提示打开loot_tables文件夹再打开entities文件夹可以看到里面存放了所有实体的掉落品文件其中也包括生物鸡的掉落物品文件。将loot_tables/entities/cow.json改为loot_tables/entities/chicken.json即可完成把牛的掉落物修改为鸡的掉落物。