將指定的戰利品放入物品欄或世界。
語法[]
- Java版
loot <目标> <来源>
- 其中:
<目标>
:give <players>
- 給予玩家物品,忽略空物品堆。
insert <targetPos>
- 將物品分配到容器方塊中。
spawn <targetPos>
- 生成物品實體。
replace block <targetPos> <slot> [<count>]
- 將物品分配到容器方塊中。
replace entity <entities> <slot> [<count>]
- 將物品分配到多個實體中。
<来源>
:fish <loot_table> <pos> [<tool>|mainhand|offhand]
loot <loot_table>
kill <target>
mine <pos> [<tool>|mainhand|offhand]
- 基岩版
loot <目标> <来源>
- 其中:
<目标>
:give <player: target>
- 給予玩家物品,忽略空物品堆。
insert <position: x y z>
- 將物品分配到容器方塊中,忽略空物品堆。
spawn <position: x y z>
- 生成物品實體,忽略空物品堆。
replace block <position: x y z> slot.container <slotId: int> [count: int]
- 將物品分配到容器方塊中。
replace entity <entity: target> <slotType: EntityEquipmentSlot> <slotId: int> [count: int]
- 將物品分配到多個實體中。
<来源>
:kill <entity: target> [<tool>|mainhand|offhand: string]
loot <loot_table: string> [<tool>|mainhand|offhand: string]
參數[]
JE:<loot_table>
:resource_location
BE:loot_table: string
:string
JE:<tool>
:item_stack
- 指定用來挖掘或釣魚的物品。
- 必須為物品參數(不支援物品標籤)。
BE:"<tool>|mainhand|offhand": string
:string
- 指定用來殺死生物或取得戰利品的工具。
- 必須為字串。可以為
mainhand
(使用執行者慣用手的物品)、offhand
(使用執行者非慣用手的物品),或指定物品ID。
JE:<target>
:entity
BE:entity: target
:actor(來源為kill
)
- 指定要模擬殺死的實體。
- 必須為玩家名、目標選擇器或UUID。且目標選擇器只允許1個實體。
JE:<players>
:entity
BE:player: target
:player
JE:<pos>
:block_pos和<targetPos>
:block_pos(模式為replace block
或insert
)
BE:<position: x y z>
:CommandPositionFloat (模式為insert
)
JE:<targetPos>
:block_pos
BE:position: x y z
:CommandPositionFloat(模式為spawn
)
- 指定要生成物品的位置。
- 必須為三維座標,元素為浮點數。允許波浪號與脱字號標記。
JE:<entities>
:entity
BE:entity: target
:CommandSelector<Actor>
JE:<count>
:integer
BE:count: int
:int
- 指定要填充的連續欄位數。
- 必須為32位元整型數值。在Java版中,必須在0和2147483647(含)之間。
JE:<slot>
:item_slot
BE:slotType: EntityEquipmentSlot
:enum,slot.container
和slotId: int
:int
- 指定要修改的物品欄欄位,有效值取決於修改內容,參見命令/item和命令/replaceitem。
效果[]
命令 | 觸發條件 | Java版 | 基岩版 |
---|---|---|---|
任意 | 參數不正確 | 無法解析 | 無法解析 |
/... fish ... <pos> | <pos> 或position: x y z 位於世界外或未被載入 | 執行失敗 | 執行失敗 |
/... mainhand | 命令執行者不是實體 | ||
/... mainhand | 命令執行者死亡 | N/A | |
/... kill ... | 目標死亡 | ||
<target> 或entity: target 無法解析為單個實體(指定的玩家必須線上) | 執行失敗 | ||
目標無戰利品表 | N/A | ||
/... loot ... | loot_table: string 非有效的戰利品表 | ||
/loot replace entity ... | <entities> 或entity: target 無法解析為實體(指定的玩家必須線上) | 執行失敗 | |
目標無指定欄位 | 執行成功 | ||
slotId: int 大於最大實體所擁有的最高欄位id | |||
/loot give ... | <entities> 或player: target 無法解析為玩家(指定的玩家必須線上) | 執行失敗 | |
/loot insert ... | <targetPos> 或position: x y z 位於世界外或未被載入 | ||
指定方塊不是容器 | |||
/loot replace block <targetPos> <slot> <count>... | 指定方塊無指定<slot> | N/A | |
指定的容器無法容納下所有物品 | 執行出錯 | ||
指定的<count> 與<slot> 超過了該容器的欄位數量上限 | |||
任意 | 執行成功時 | 按照指定的戰利品表和方式隨機抽取物品,並跌落到指定位置或指定方塊/實體的物品欄位中 |
輸出[]
命令 | 版本 | 條件 | 成功次數 | /execute store success ... | /execute store result ... |
---|---|---|---|---|---|
任意 | Java版 | 執行失敗 | 0 | 0 | 0 |
/loot spawn ... | 執行成功 | 1 | 1 | 跌落的物品堆的數量 | |
/loot give ... | 執行成功 | 1 | 1 | 每位玩家被給予的物品組數 | |
/loot insert ... | 執行成功 | 1 | 1 | 容器被插入的物品組數 | |
/loot replace block ... | 執行成功 | 1 | 1 | 容器被替換的物品組數 | |
執行出錯 | 0 | 不變 | 不變 | ||
/loot replace entity ... | 執行成功 | 1 | 1 | 每個實體被替換的物品組數 | |
執行出錯 | 0 | 不變 | 不變 |
歷史[]
Java版 | |||||
---|---|---|---|---|---|
1.14 | 18w43a | 加入了/drop 。 | |||
18w44a | 刪除了<来源> 中的award。 | ||||
18w45a | 將/drop 重新命名為/loot 並重做。 | ||||
基岩版 | |||||
1.18.0 | 1.18.0.21 | 加入了/loot 。 | |||
1.18.0.22 | 移除了/loot 。 | ||||
1.18.10 | 1.18.10.21 | 重新加入了/loot 。 | |||
1.18.30 | 1.18.20.21 | 加入了give 語法。 | |||
1.18.30.20 | 加入了insert 語法。 | ||||
1.19.0 | 1.19.0.30 | 加入了replace entity 語法。 | |||
1.19.40 | 1.19.40.20 | 加入了replace block 語法。 |
參見[]
/give
— 不透過戰利品表,直接給予玩家指定物品。
語言