
命令
/loot
根据战利品表、生物的掉落物、方块的掉落物或钓鱼收获生成物品,并放入玩家的物品栏、容器、实体的栏位或地面上。
| /loot (give <players>|insert <targetPos>|spawn <targetPos>) fish <loot_table> <pos> |
| /loot (give <players>|insert <targetPos>|spawn <targetPos>) fish <loot_table> <pos> (mainhand|offhand) |
| /loot (give <players>|insert <targetPos>|spawn <targetPos>) fish <loot_table> <pos> <tool> |
| /loot (give <players>|insert <targetPos>|spawn <targetPos>) (kill <target>|loot <loot_table>) |
| /loot (give <players>|insert <targetPos>|spawn <targetPos>) mine <pos> |
| /loot (give <players>|insert <targetPos>|spawn <targetPos>) mine <pos> (mainhand|offhand) |
| /loot (give <players>|insert <targetPos>|spawn <targetPos>) mine <pos> <tool> |
| /loot replace (block <targetPos>|entity <entities>) <slot> <count> fish <loot_table> <pos> |
| /loot replace (block <targetPos>|entity <entities>) <slot> <count> fish <loot_table> <pos> (mainhand|offhand) |
| /loot replace (block <targetPos>|entity <entities>) <slot> <count> fish <loot_table> <pos> <tool> |
| /loot replace (block <targetPos>|entity <entities>) <slot> <count> (kill <target>|loot <loot_table>) |
| /loot replace (block <targetPos>|entity <entities>) <slot> <count> mine <pos> |
| /loot replace (block <targetPos>|entity <entities>) <slot> <count> mine <pos> (mainhand|offhand) |
| /loot replace (block <targetPos>|entity <entities>) <slot> <count> mine <pos> <tool> |
| /loot replace (block <targetPos>|entity <entities>) <slot> fish <loot_table> <pos> |
| /loot replace (block <targetPos>|entity <entities>) <slot> fish <loot_table> <pos> (mainhand|offhand) |
| /loot replace (block <targetPos>|entity <entities>) <slot> fish <loot_table> <pos> <tool> |
| /loot replace (block <targetPos>|entity <entities>) <slot> (kill <target>|loot <loot_table>) |
| /loot replace (block <targetPos>|entity <entities>) <slot> mine <pos> |
| /loot replace (block <targetPos>|entity <entities>) <slot> mine <pos> (mainhand|offhand) |
| /loot replace (block <targetPos>|entity <entities>) <slot> mine <pos> <tool> |
| 参数 | 值的类型 | 输入内容 |
|---|---|---|
| <players> | 目标选择器 | 对于 give:获得物品的玩家。一名或多名玩家。 |
| <loot_table> | 战利品表 | 对于 loot 和 fish:要抽取的战利品表,用 minecraft:chests/simple_dungeon 这样的 ID 或内联战利品表定义给出。 |
| <pos> | 方块位置 | 对于 mine:生成其掉落物的方块。对于 fish:进行钓鱼的位置。 |
| <tool> | 物品 | 对于 mine 和 fish:用作工具的物品,例如 minecraft:diamond_pickaxe。也可以改用字面值 mainhand 和 offhand。 |
| <target> | 目标选择器 | 对于 kill:生成其掉落物的单个实体。仅限一个实体。 |
| <targetPos> | 方块位置 | 对于 insert 和 replace block:容器的位置。对于spawn:物品掉落的精确坐标。 |
| <slot> | 物品槽位 | 对于replace:要填充的第一个栏位,例如container.0到container.53、hotbar.0到hotbar.8、inventory.0到inventory.26、weapon.mainhand、weapon.offhand、armor.head、armor.chest、armor.legs、armor.feet。 |
| <count> | 整数 | 对于replace:要写入的栏位数量,0或更多。省略时等于生成的堆叠数。至少为0。 |
| <entities> | 目标选择器 | 对于replace entity:其栏位被填充的实体。一个或多个实体。 |
| 权限等级 | 2:管理员、开启作弊的世界、命令方块和函数 |
| 适用于 | 开启作弊的单人游戏、多人游戏服务器上的管理员、命令方块和函数。 |
| 结果 | 当交付了一组物品时提示“掉落了<count>个<item>”,否则提示“掉落了<number>个物品”;kill和mine来源还会指出所使用的战利品表。/execute store 保存的数字是已送出的物品堆叠数量(如果什么都没有生成或什么都放不下,则为0)。 |
| 结构 | 该命令总是先写目标再写来源:先是物品去向(give、insert、spawn、replace block、replace entity),再是物品来源(loot、kill、mine、fish)。 |
| 目标:give | 把生成的每组物品添加到每个所选玩家的物品栏中。放不下的物品不会掉落到地上。 |
| 目标:insert | 将物品分配到该位置的容器中,填满空槽位并补满相同的堆叠。如果方块没有物品栏,则会以“目标位置不是容器”而失败。 |
| 目标:spawn | 将物品作为物品实体掉落在该位置,并带有正常的拾取延迟。 |
| 目标:replace | 从给定的栏位开始,把物品写入容器方块或一个或多个实体的连续栏位。不带数量时,写入的栏位数与生成的物品堆叠数相同。带数量时,恰好写入这么多个栏位,生成的战利品之外的栏位会被清空。 |
| 来源:loot | 像箱子那样抽取指定的战利品表,位置为命令的执行位置。 |
| 来源:kill | 生成所选实体被杀死时会掉落的物品,但不伤害它。执行命令的对象算作击杀者,因此玩家执行时会获得击杀玩家的掉落物。如果实体没有战利品表,则失败。 |
| 来源:mine | 生成该位置的方块被挖掘时会掉落的物品,但不破坏方块。不带工具时按徒手挖掘;mainhand 和 offhand 使用执行命令者手持的物品;物品 id 则以该物品作为工具。如果方块没有战利品表,则失败。 |
| 来源:fish | 在指定位置将战利品表作为钓鱼收获进行抽取,可选使用工具(物品ID、mainhand或offhand)。 |
| 手持物品 | mainhand和offhand只有在命令由生物实体执行时才有效;否则会失败并提示“该实体无法持有任何物品”。 |
| 已加载位置 | 使用的每个方块位置都必须位于世界中已加载的部分,否则命令会失败并提示“该位置尚未被加载”。 |
/loot give @s loot minecraft:chests/simple_dungeon抽取地牢箱子的战利品表,并将物品放入你的物品栏。
/loot spawn ~ ~1 ~ kill @e[type=minecraft:zombie,limit=1,sort=nearest]在你上方一格处掉落最近的实体(僵尸)的战利品,但不杀死它。
/loot give @p mine ~ ~-1 ~ mainhand给予最近的玩家下方方块被你主手中的物品挖掘时会掉落的东西。
/loot insert ~ ~-1 ~ loot minecraft:chests/desert_pyramid用沙漠神殿箱子的战利品填充你脚下的容器。
/loot replace block ~ ~-1 ~ container.0 27 loot minecraft:chests/end_city_treasure用末地城战利品覆盖你下方箱子的27个槽位,没有获得物品的槽位会被清空。
/loot replace entity @s hotbar.0 9 fish minecraft:gameplay/fishing ~ ~ ~ minecraft:fishing_rod用在你所在位置钓到的渔获替换你的快捷栏(工具:钓鱼竿)。



