Files
netease-modsdk-wiki/docs/mconline/10-addon教程/第12章:更完善的自定义掉落物/课程06.简易教学②自定义多次筛选同个奖励池.md
boybook 760c2dd9ad 2.6
2025-12-01 20:59:16 +08:00

72 lines
1.5 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/6_1.b9815060.jpg
hard: 进阶
time: 10分钟
---
# 简易教学②:自定义多次筛选同个奖励池
#### 作者:境界
![](./images/6_1.jpg)
1创建一个在行为包主目录中loot_tables文件夹下的战利品配置文件。
2根据内容格式写入
```
{
"pools": [
{
"rolls": {
"min":1,
"max":2
},
"entries": []
}
]
}
```
由于我们希望多次筛选同一个战利品池但希望是在一个随机的区间里因此筛选次数最小值填1最大次数填2则最终筛选次数会在1~2次之间。
3插入战利品内容
```
{
"pools":[
{
"rolls":{
"min":1,
"max":2
},
"entries":[
{
"type":"item",
"name":"minecraft:diamond_sword",
"weight":1
},
{
"type":"item",
"name":"minecraft:stone",
"weight":4
}
]
}
]
}
```
投放两个物品类型的战利品将物品名称设置为minecraft:diamond_sword钻石剑和minecraft:stone圆石。同时更加昂贵的钻石剑的权重被设置为了1普通的圆石设置为4这样单次抽取战利品的概率里钻石剑抽中的概率为1/ (1 + 4) * 100% = 25%。