Files
netease-modsdk-wiki/docs/mconline/10-addon教程/第12章:更完善的自定义掉落物/课程04.战利品条件.md
boybook 760c2dd9ad 2.6
2025-12-01 20:59:16 +08:00

62 lines
1.8 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/3_1.ea877fdd.jpg
hard: 进阶
time: 20分钟
---
# 战利品条件
#### 作者:境界
![](./images/4_1.jpg)
当开发者希望筛选组合必须满足条件时才会掉落战利品,可以使用战利品条件功能。
```json
{
"conditions": [
{
"condition": "has_mark_variant",//当该生物的minecraft:mark_variant值为几时条件通过可以筛选
"value": 1
},
{
"condition": "entity_properties",//当该生物因着火或者落地而被击败时
"value": {
"on_ground": false,
"on_fire": false
}
},
{
"condition": "killed_by_player",//当该生物是被玩家击败的
},
{
"condition": "killed_by_player_or_pets",//当该生物是被玩家或玩家的宠物击败的
},
{
"condition": "random_chance_with_looting",//当随机值满足时且掠夺附魔会增加随机概率取值范围在0.0~1.0
"chance": 0.0,
"looting_multiplier": 0.0
},
{
"condition": "random_difficulty_chance",//当难度为下列某一难度时值越大越容易被筛选到取值范围在0.0~1.0
"default_chance": 0, //若没有设置游戏难度,则此段生效
"peaceful": 0,//若游戏难度为和平难度
"easy": 0,//若游戏难度为简单难度
"normal": 0,//若游戏难度为正常难度
"hard": 0//若游戏难度为困难难度
},
{
"condition": "random_regional_difficulty_chance", //将最大区域难度随机机会满足指定值时取值范围在0.0~1.0
max_chance: 0.0
}
]
}
```