Minecraft:Commands/kill: Difference between revisions
More actions
Remove broken links to missing pages |
Fix template calls: add MC/ prefix |
||
| Line 1: | Line 1: | ||
{{Redirect|Kill|the action of killing|Death}} | {{MC/Redirect|Kill|the action of killing|Death}} | ||
{{Infobox command | {{Infobox command | ||
| name = kill | | name = kill | ||
| Line 15: | Line 15: | ||
When the command kills mob(s), it issues the appropriate death message. Players and mobs killed this way drop loot, and slimes and magma cubes that are not of minimum size spawn smaller ones. Non-mob entities disappear if they are targeted. | When the command kills mob(s), it issues the appropriate death message. Players and mobs killed this way drop loot, and slimes and magma cubes that are not of minimum size spawn smaller ones. Non-mob entities disappear if they are targeted. | ||
{{ | {{MC/In|java}}, ender dragons killed by this command will skip their death animation and immediately open the exit portal. | ||
{{ | {{MC/In|bedrock}}, players in Creative mode cannot be killed using this command. | ||
==Syntax== | ==Syntax== | ||
| Line 29: | Line 29: | ||
==Arguments== | ==Arguments== | ||
{{ | {{MC/Argument|targets|entity|target: target|CommandSelector<Actor>}} | ||
: Specifies the target(s) to kill. If not specified, defaults to the player who executed the command. | : Specifies the target(s) to kill. If not specified, defaults to the player who executed the command. | ||
: {{ | : {{MC/Arg desc|je=entity|amount=multiple|type=entities|be=actor}} | ||
==Result== | ==Result== | ||
| Line 45: | Line 45: | ||
==Output== | ==Output== | ||
{{Output table}} | {{MC/Output table}} | ||
{{Output table|edition=je|On fail|0|0|0}} | {{MC/Output table|edition=je|On fail|0|0|0}} | ||
{{Output table|On success|1|1|the number of targeted entities}} | {{MC/Output table|On success|1|1|the number of targeted entities}} | ||
{{Output table|edition=be|On fail|0}} | {{MC/Output table|edition=be|On fail|0}} | ||
{{Output table|On success|the number of entities that are killed}} | {{MC/Output table|On success|the number of entities that are killed}} | ||
{{Output table}} | {{MC/Output table}} | ||
==Examples== | ==Examples== | ||
| Line 59: | Line 59: | ||
* To kill all entities except players (if there are too many entities, some won’t be killed.) : <code>kill @e[type=!player]</code> | * To kill all entities except players (if there are too many entities, some won’t be killed.) : <code>kill @e[type=!player]</code> | ||
* To kill all creepers within 10 blocks: | * To kill all creepers within 10 blocks: | ||
**{{ | **{{MC/El|je|short=1}}: <code>kill @e[distance=..10,type=creeper]</code><br> | ||
**{{ | **{{MC/El|be|short=1}}: <code>kill @e[r=10,type=creeper]</code> | ||
* To kill all arrows that are stuck in a [[Minecraft:target]]: <code>kill @e[type=arrow,nbt={inBlockState:{Name:"minecraft:target"}}]</code>{{only|je}} | * To kill all arrows that are stuck in a [[Minecraft:target]]: <code>kill @e[type=arrow,nbt={inBlockState:{Name:"minecraft:target"}}]</code>{{only|je}} | ||
| Line 66: | Line 66: | ||
=== ''Java Edition'' === | === ''Java Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{HistoryLine|java alpha}} | |{{MC/HistoryLine|java alpha}} | ||
|{{HistoryLine||v1.2.6|Added {{ | |{{HistoryLine||v1.2.6|Added {{MC/Cmd|kill|link=none}}. It currently deals {{hp|1000}} damage.}} | ||
|{{HistoryLine|java}} | |{{MC/HistoryLine|java}} | ||
|{{HistoryLine||1.3.1|dev=12w16a|{{ | |{{HistoryLine||1.3.1|dev=12w16a|{{MC/Cmd|kill|link=none}} is now usable in singleplayer.|Parsing of the command is now more strict, rejecting extra characters after the command name (such as {{MC/Cmd|killme|link=none}} or {{MC/Cmd|killed|link=none}}). However, arguments are still ignored, meaning {{MC/Cmd|kill playername|link=none}} still only kills the executor.|{{MC/Cmd|kill|link=none}} now uses void damage instead of generic damage, bypassing armor. The death message is now "<var>player</var> fell out of the world" instead of "<var>player</var> died".|{{MC/Cmd|kill|link=none}} now prints the message "Ouch! That looked like it hurt" on execution.}} | ||
|{{HistoryLine||1.6.1|dev=13w24b|{{ | |{{HistoryLine||1.6.1|dev=13w24b|{{MC/Cmd|kill|link=none}} now deals 3.4×10{{MC/^|38}} damage.}} | ||
|{{HistoryLine||1.8|dev=14w02a|Added <code>(player{{!}}entity)</code> argument to {{ | |{{HistoryLine||1.8|dev=14w02a|Added <code>(player{{!}}entity)</code> argument to {{MC/Cmd|kill|link=none}}.|Replaced the "Ouch! That looked like it hurt" message with "Killed <var>player</var>".}} | ||
|{{HistoryLine|||dev=14w02c|To fix {{bug|MC-44371}}, {{ | |{{HistoryLine|||dev=14w02c|To fix {{bug|MC-44371}}, {{MC/Cmd|kill|link=none}} now directly kills non-living targets.}} | ||
|{{HistoryLine||1.13|dev=17w45a|<code><target></code> argument is no longer optional.}} | |{{MC/HistoryLine||1.13|dev=17w45a|<code><target></code> argument is no longer optional.}} | ||
|{{HistoryLine||1.15|dev=19w38a|<code><target></code> argument is once again optional.}} | |{{MC/HistoryLine||1.15|dev=19w38a|<code><target></code> argument is once again optional.}} | ||
|{{HistoryLine||1.20|dev=Pre-release 1|<code>/kill</code> now uses <code>generic_kill</code> type damage instead of void damage.}} | |{{MC/HistoryLine||1.20|dev=Pre-release 1|<code>/kill</code> now uses <code>generic_kill</code> type damage instead of void damage.}} | ||
}} | }} | ||
=== ''Bedrock Edition'' === | === ''Bedrock Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{HistoryLine|pocket alpha}} | |{{MC/HistoryLine|pocket alpha}} | ||
|{{HistoryLine||v0.16.0|dev=build 1|Added {{ | |{{HistoryLine||v0.16.0|dev=build 1|Added {{MC/Cmd|kill|link=none}}.}} | ||
}} | }} | ||
| Line 89: | Line 89: | ||
== Navigation == | == Navigation == | ||
{{Navbox commands}} | {{MC/Navbox commands}} | ||
de:Befehl/kill | de:Befehl/kill | ||
Revision as of 20:11, 9 April 2026
Template:Hatnote Template:Infobox command
Kills and removes entities (players, mobs, items, etc.).
Usage
Directly kills living targets compulsorily (directly removes the entity) and prompts Killed <entity display name>, or Killed <number> entities if multiple entities are killed, which is irrespective of any of the targeted mob(s)' protective effects (Minecraft:armor, Protection and Resistance). However, the damage can be adjusted by the ender dragon. Totems of undying can't be triggered when their owner(s) die(s) because of this command.
When the command kills mob(s), it issues the appropriate death message. Players and mobs killed this way drop loot, and slimes and magma cubes that are not of minimum size spawn smaller ones. Non-mob entities disappear if they are targeted.
in Template:Editions, ender dragons killed by this command will skip their death animation and immediately open the exit portal.
in Template:Editions, players in Creative mode cannot be killed using this command.
Syntax
- Java Edition
kill [<targets>]
- Bedrock Edition
kill [target: target]
Arguments
Template:El: <targets>: entity
Template:El: target: target: CommandSelector<Actor>
- Specifies the target(s) to kill. If not specified, defaults to the player who executed the command.
- {{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|entity}}{{#vardefine:be-arg|entity}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
Result
Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table
Output
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|0}}{{#vardefine:output3-{{#var:output-table-lines}}|0}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|je}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|1}}{{#vardefine:output3-{{#var:output-table-lines}}|the number of targeted entities}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|be}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}} {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|the number of entities that are killed}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}
Examples
- To kill the player executing the command:
kill @sorkill - To kill the player Steve:
kill Steve - To kill item entities:
kill @e[type=item] - To kill all entities except players (if there are too many entities, some won’t be killed.) :
kill @e[type=!player] - To kill all creepers within 10 blocks:
- REDIRECT Template:Edition
Template:Rcat: kill @e[distance=..10,type=creeper]
- REDIRECT Template:Edition
Template:Rcat: kill @e[r=10,type=creeper]
- To kill all arrows that are stuck in a Minecraft:target:
kill @e[type=arrow,nbt={inBlockState:{Name:"minecraft:target"}}]Template:Only
History
Java Edition
Bedrock Edition
External links
de:Befehl/kill es:Comandos/kill fr:Commandes/kill it:Comandi/kill ja:コマンド/kill ko:명령어/kill pt:Comandos/kill ru:Команды консоли/kill uk:Команди консолі/kill zh:命令/kill