
计算器
战利品表构建器
为数据包创建战利品表:随机池、带权重的物品、数量、附魔、名称和概率,并查看每个物品的确切概率。
战利品表
文件放在数据包的 data/example/loot_table/chests/treasure.json。
随机池 1
名称(可选)
名称(可选)
玩家会得到什么
| 物品 | 获得概率 | 平均数量 |
|---|---|---|
| diamond | 32.6% | 0.75 |
| iron_ingot | 92.9% | 7.5 |
| diamond_sword | 56.6% | 0.75 |
数据包文件
data/example/loot_table/chests/treasure.json
{
"type": "minecraft:chest",
"pools": [
{
"rolls": {
"type": "minecraft:uniform",
"min": 2,
"max": 4
},
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:diamond",
"modifier": {
"type": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 1,
"max": 3
}
}
},
{
"type": "minecraft:item",
"name": "minecraft:iron_ingot",
"weight": 5,
"modifier": {
"type": "minecraft:set_count",
"count": {
"type": "minecraft:uniform",
"min": 2,
"max": 6
}
}
},
{
"type": "minecraft:item",
"name": "minecraft:diamond_sword",
"weight": 2,
"modifier": {
"type": "minecraft:enchant_with_levels",
"levels": {
"type": "minecraft:uniform",
"min": 20,
"max": 39
},
"options": "#minecraft:on_random_loot"
}
}
]
}
]
}命令
/loot give @s loot example:chests/treasure42 个字符
适用于 Java版 26.3。此工具写出的每种形式都经过了游戏自身的命令解析器检查。
或者一个首次打开时自动填充的箱子: /setblock ~ ~ ~ chest{LootTable:"example:chests/treasure"}
| set_count | 数量:一个数或从-到 |
| enchant_randomly | 该物品可附的一个随机附魔 |
| enchant_with_levels | 像附魔台一样按这些等级附魔 |
| set_enchantments | 这些附魔及等级 |
| set_damage | 剩余耐久,0 到 1 |
| set_name | 物品的名称 |
| 文件 | 战利品表放在数据包的 data/<namespace>/loot_table/<路径>.json,按 ID 调用,如 example:chests/treasure |
| 26.3 的格式 | 条目的函数写作 "modifier"(一个对象或列表),条件写作带 "type" 的 "condition" |
| 抽取 | 每次抽取先保留条件通过的条目,再按权重选出一个;从-到的抽取次数是均匀抽出的整数 |
| 概率 | 条目上的 "random_chance" 每次抽取都重新判定;随机池上的则决定该池是否被抽取 |
| 使用 | /loot give @s loot <id> 立即给予物品;带 LootTable 的箱子在首次打开时自动填充 |
| 已在游戏中检查 | 构建器能写出的每种表都在数据包中加载并在游戏中掉落过 |




