跳转到内容
WikilyWIKILY
全部游戏23 个 Wiki · 选择你的游戏
计算器战利品表

切换游戏

23 个 Wiki · 选择你的游戏
战利品表构建器

计算器

战利品表构建器

为数据包创建战利品表:随机池、带权重的物品、数量、附魔、名称和概率,并查看每个物品的确切概率。

战利品表

文件放在数据包的 data/example/loot_table/chests/treasure.json。

随机池 1

diamond diamond
名称(可选)
颜色
iron_ingot iron_ingot
名称(可选)
颜色
diamond_sword diamond_sword
名称(可选)
颜色

玩家会得到什么

物品获得概率平均数量
diamond32.6%0.75
iron_ingot92.9%7.5
diamond_sword56.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/treasure

42 个字符

适用于 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 的箱子在首次打开时自动填充
已在游戏中检查构建器能写出的每种表都在数据包中加载并在游戏中掉落过
加入创作者社区建设 Minecraft Java Edition Wiki 的伙伴们都在我们的 Discord。欢迎提问或推荐页面。加入 Discord (在新标签页打开 Discord)