Minecraft:Commands/damage
More actions
Template:Infobox command Applies a set amount of damage to the specified entities.
Usage
- REDIRECT Template:Command
Template:Redr applies damage to entities with health or an equivalent statistic. The <damageType>Template:Only or cause: DamageTypeTemplate:Only argument is used to specify the kind of damage which will be applied to the entity.
When being applied to an applicable entity,
- REDIRECT Template:Command
Template:Redr uses the same underlying logic when applying damage as is used elsewhere in the game. As such, the damage specified by the <damageType>Template:Only or cause: DamageTypeTemplate:Only argument is not the exact amount of damage which will be applied to the entity. The resulting damage is affected by statistics which would otherwise modify or nullify said damage based on the damage source and type of damage (for instance players in creative mode are invulnerable to most types of damage, and damage types categorized as fire damage will be nullified by fire resistance and weakened by fire protection). Entities will also react to damage inflicted by
- REDIRECT Template:Command
Template:Redr in the same manner they would if said damage was inflicted through normal means (for instance, endermen will teleport away if the damage source is categorized as a projectile).
Undefined behavior
| Mob | Behavior |
|---|---|
| All mobs | Knocked back.
Begins an invulnerable cooldown period. |
|
Damaged with a source entity, the balloon swings. |
|
When damaged, a sleeping bat begins flying. |
|
Controlled by the Ender Dragon's fight system. |
|
Teleports away. |
|
While its spikes are extended, if the damage source is a mob and the cause isn't
Template:Redr, or
Template:Redr, it deals thorn damage to the damage source. |
|
Teleports away. |
|
If the damage source is an entity, it spawns ink particles. |
Hardcoded behaviors
When
- REDIRECT Template:Code
Template:Redr is 0, entities are always considered successfully damaged. If not 0, only entities (except armor stands, NPCs, and Minecraft:camera), boats, paintings, leash knots, falling blocks, and minecarts may be recognized as successfully damaged.
Some behaviors are data-driven (e.g. end crystal explosion, fireball rebounding). These data-driven behaviors do not affect the command's output text, result, and return value. Only hardcoded behaviors can affect them.
| Mob | Behavior |
|---|---|
|
Players in Creative mode are invulnerable by most types of damage excluding generic_kill and out_of_world (refer to damage types)
|
|
Template:Redr command can always kill the agent. This has the side-effect that
Template:Redr with the cause of
Template:Redr always removes the agent, regardless of whether
Template:Redr is 0 or not. |
|
Applying
Template:Redr command on an armor stand cannot reduce its health value (except for
Template:Redr and
Template:Redr causes), and is never considered to have damaged it successfully. It also cannot be detected or controlled with behavior packs. Punching an armor stand is not considered as having damaged it. Punching an armor stand twice in Survival mode destroys it. Running
Template:Redr twice within 5 game ticks on an armor stand with the damage source being a player in Survival mode makes the armor stand drop its held items and destroy itself. Punching an armor stand in Creative mode removes it. Running
Template:Redr on an armor stand with the damage source being a player in Creative mode removes it. Explosions can always destroy the armor stand. The
Template:Redr command can always kill the armor stand.
Template:Redr commands with the cause of
Template:Redr, or
Template:Redr make the armor stand drop its held items and destroy itself. Void damage can always kill the armor stand.
Template:Redr commands with the
Template:Redr cause always remove the armor stand. Armor stands are set on fire when in lava or fire.
Template:Redr commands with the
Template:Redr cause the armor stand to be set on fire and reduce its health value by 0.5. Armor stands are damaged when on fire. If the cause is
Template:Redr, and the armor stand is not in a lava or fire block,
Template:Redr commands reduce its health value by 1.0. If an arrow hits an armor stand, the armor stand is destroyed, and the arrow disappears. Running
Template:Redr commands on an armor stand with the source being an arrow causes the armor stand to be destroyed and the arrow to disappear. If a trident hits an armor stand, the armor stand is destroyed. Running
Template:Redr commands on an armor stand with the damage source being a trident causes the armor stand to be destroyed. When an armor stand falls onto the ground, a landing sound is played. Broadcasts a landing sound when an armor stand is damaged with the
Template:Redr cause. |
|
Clicking a balloon isn't considered as hurting it. This has the side-effect that running
Template:Redr on a balloon cannot reduce its health value, and is never considered to have successfully damaged it. Projectiles, fire, lava, and magma can always destroy the balloon.
Template:Redr can always kill the balloon. This has the side-effect that the damage causes
Template:Redr, or
Template:Redr destroy the balloon. |
|
Punching a boat is always considered as hurting it.
Running
Template:Redr on a boat is always considered to have successfully damaged it, but it cannot be detected or controlled with behavior packs. Boat uses Structural Integrity instead of health points to control whether it should break or not. A boat has 40 points of Structural Integrity. Damage command changes its Structural Integrity value instead of its health value. When applying
Template:Redr on a boat with the damage source being an ender pearl, the boat's Structural Integrity is reduced, but isn't destroyed even if Structural Integrity becomes less than 0. Punching a boat in Creative mode destroys it. Running
Template:Redr on a boat with the damage source being a player in Creative mode destroys the boat, regardless of whether
Template:Redr is 0 or not. |
|
A camera cannot be damaged.
Using
Template:Redr on a camera is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs. A camera cannot be affected by an explosion. Using
Template:Redr on a camera with the source being a player removes it. |
|
Hurting an end crystal means making it explode.
Running
Template:Redr on an end crystal makes it explode, regardless of whether
Template:Redr is 0 or not, and is never{{ #vardefine: verifyedition | }} #vardefine: verifyedition | }} considered to have successfully damaged it. |
|
Hardcoded behavior: An ender dragon is immune to arrows when perching, and makes arrows catch fire.
Template:Redr with the damage source being an Minecraft:arrow cannot hurt a perching dragon, but the arrow is still set on fire despite the command not being successful. A damage command with
Template:Redr cannot hurt an ender dragon and is always considered unsuccessful. Only players can hurt an ender dragon. Only a player as the source, or the
Template:Redr as a cause, can hurt an ender dragon and can be detected or controlled with behavior packs.
Template:Redr can always kill an ender dragon. A damage command with the cause of
Template:Redr always kills an ender dragon and is considered successful, regardless of whether
Template:Redr is 0 or not. |
|
Projectiles, except potions, cannot hurt an enderman.
If the cause is
Template:Redr and the source is not a potion entity,
Template:Redr makes an enderman teleport away without being hurt, and it cannot be detected or controlled with behavior packs. If the enderman has successfully teleported away, the command is considered to have successfully damaged the entity. |
|
A player cannot damage an experience orb.
Running
Template:Redr on an experience orb can reduce its health value, but is never considered to have successfully damaged it, and cannot be detected or controlled with behavior packs. |
|
Applying
Template:Redr on a falling block is always considered to have successfully damaged it, and cannot be detected or controlled with behavior packs. Applying
Template:Redr on a falling block with the source being
Template:Redr always destroys it, and drops an item of the block that the falling block is in (instead of the item form of the falling block). |
|
A fireball deals 1000 damage to a ghast if the fireball was rebounded by a player.
Running a damage command on a ghast with a fireball that has been hit by the player as the damage source deals 1000 damage, regardless of what
Template:Redr is. It cannot be detected or controlled with behavior packs. |
|
Pushing a painting or a leash knot destroys the entity.
Paintings and lead knots are always destroyed when applying
Template:Redr on them, and drop items if the damage source is not a player in Creative mode. It is always considered to have successfully damaged it, regardless of whether
Template:Redr is 0 or not, but it cannot be detected or controlled with behavior packs. |
| Script error: No such module "SpriteFile". | A player cannot damage an item.
Applying
Template:Redr on an item can reduce its health value, but is never considered to have successfully damaged it, and cannot be detected or controlled with behavior packs. |
|
Punching a minecart is always considered as damaging it.
Running
Template:Redr on a minecart is always considered to have successfully damaged it. A minecart uses Structural Integrity to control whether it should break or not, instead of its health value. A minecart has a Structural Integrity of 5.
Template:Redr changes a minecart's Structural Integrity value instead of its health value. An ender pearl can reduce a minecart's Structural Integrity, but cannot destroy it. Applying
Template:Redr on a minecart with the damage source being an ender pearl reduces Structural Integrity, but doesn't destroy it even if its Structural Integrity becomes less than 0. |
|
Template:Redr with the cause being
Template:Redr and the damage source being an Minecraft:arrow that is on fire or a small fireball, or with the cause being
Template:Redr, primes the minecart and is considered successful. It is never considered to have successfully damaged it, and cannot be detected or controlled with behavior packs. Otherwise behaves as a regular Minecraft:minecart. |
|
NPCs cannot be damaged.
Using
Template:Redr on an NPC is never considered to have successfully damaged it, and cannot be detected or controlled with behavior packs. Only the void,
Template:Redr, or world builder can remove it. If the cause is
Template:Redr, or the cause is
Template:Redr and the source is a world builder,
Template:Redr removes the NPC. Otherwise, it does nothing. |
|
Primed TNT cannot be damaged.
Using
Template:Redr on primed TNT is never considered to have successfully damaged it.
Template:Redr can always kill primed TNT. A damage command with the cause of
Template:Redr always kills the primed TNT, regardless of whether
Template:Redr is 0 or not. |
|
A shulker teleports if it is in lava or fire.
Applying
Template:Redr on a shulker with the cause being
Template:Redr cannot damage it and makes the shulker teleport away. It is considered unsuccessful and cannot be detected or controlled with behavior packs. Projectiles cannot hurt a shulker when it is closed. Applying
Template:Redr on a closed shulker with the cause being
Template:Redr cannot damage it. It is considered unsuccessful and cannot be detected or controlled with behavior packs. |
|
A small fireball cannot be hit.
Using
Template:Redr on a small fireball is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs. |
|
A trident cannot be damaged.
Using
Template:Redr on a trident is never considered to have successfully damaged it. A trident cannot be affected by an explosion. Using
Template:Redr on a trident with cause being
Template:Redr cannot be detected or controlled with behavior packs. |
|
A wither skull cannot be damaged.
Using
Template:Redr on a wither skull is never considered to have successfully damaged it. A black wither skull cannot be hit. Using
Template:Redr on a black wither skull is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs. |
|
Drowning and falling cannot hurt a wither.
If the cause is
Template:Redr does nothing on a wither and it is not considered to have successfully damaged it. It cannot be detected or controlled with behavior packs. A wither cannot damage another wither. If the cause is not
Template:Redr and the source is another wither, a damage command does nothing on a wither, and it is not considered to have successfully damaged it. It cannot be detected or controlled with behavior packs. If a wither is in its spawning animation, the cause is
Template:Redr, and the source is a mob,
Template:Redr makes the source mob suffer knockback. When spawning, a wither cannot be damaged by anything except for the void. If a wither is spawning, and the source is not the
Template:Redr, a damage command does nothing on the wither, and it is not considered to have successfully damaged it. It cannot be detected or controlled with behavior packs. When dying, a wither cannot be damaged. If a wither is dying,
Template:Redr does nothing on a wither, and it is not considered to have successfully damaged it. It cannot be detected or controlled with behavior packs. In its armored state, a wither is immune to arrows. If the wither is in its armored state,
Template:Redr with the cause being
Template:Redr and the damage source being an arrow does nothing to a wither, and it is not considered to have successfully damaged it. It cannot be detected or controlled with behavior packs. |
Damage types
Below are the types of damage that can be applied. These are used for the <damageType>Template:Only or cause:DamageCauseTemplate:Only arguments (see Syntax below).
| Damage type | Notes |
|---|---|
| arrow | |
| bad_respawn_point | |
| cactus | |
| campfire | |
| cramming | bypasses: • armor • shields • wolf armor |
| dragon_breath | bypasses: • armor • shields |
| drown | bypasses: • armor • shields • wolf armor |
| dry_out | |
| explosion | |
| fall | bypasses: • armor • shields |
| falling_anvil | bypasses: • shields |
| falling_block | |
| falling_stalactite | bypasses: • shields |
| fireball | |
| fly_into_wall | bypasses: • armor • shields |
| freeze | bypasses: • armor • shields • wolf armor |
| generic | bypasses: • armor • shields |
| generic_kill | bypasses: • invulnerability • armor • resistance effect • shields • wolf armor |
| hot_floor | |
| in_fire | |
| in_wall | bypasses: • armor • shields • wolf armor |
| indirect_magic | bypasses: • armor • shields • wolf armor |
| lava | |
| lightning_bolt | |
| magic | bypasses: • armor • shields • wolf armor |
| mob_attack | |
| mob_attack_no_aggro | |
| mob_projectile | |
| on_fire | bypasses: • armor • shields |
| out_of_world | bypasses: • invulnerability • armor • resistance effect • shields • wolf armor |
| outside_border | bypasses: • armor • shields • wolf armor |
| player_attack | |
| player_explosion | |
| sonic_boom | bypasses: • armor • enchantments • shields |
| spit | |
| stalagmite | bypasses: • armor • shields |
| starve | bypasses: • armor • effects (including resistance) • shields • wolf armor |
| sting | |
| sweet_berry_bush | |
| thorns | bypasses: • wolf armor |
| thrown | |
| trident | |
| unattributed_fireball | |
| wind_charge | |
| wither | bypasses: • armor • shields • wolf armor |
| wither_skull |
| Name | Description | Notes |
|---|---|---|
|
Caused by a falling Minecraft:anvil. | Reduced damage to targets wearing a helmet. |
|
Caused by the explosion of a block. | Reduced damage to targets equipped with armor, with extra reduction per tier of Blast Protection. |
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
Caused by contact with a damage-inflicting block (e.g. cactus and sweet berry bushes). | Reduced damage to targets equipped with armor, with extra reduction per tier of Protection. |
|
Caused by drowning or rain. | <more information needed></more information needed>
|
|
Caused by a melee attack from a mob. | Reduced damage to targets equipped with armor, with extra reduction per tier of Protection. |
|
Caused by the explosion of a mob. | Reduced damage to targets equipped with armor, with extra reduction per tier of Blast Protection. |
|
Caused by falling from a higher ground, or teleporting with an ender pearl. | 0
}}Template:HatnoteReduced damage to targets equipped with Feather Falling or Protection armor. Some mobs are immune to or take less fall damage. |
|
|
<more information needed></more information needed>
|
|
Caused by standing in Minecraft:fire. | <more information needed></more information needed>
|
|
Caused by being on fire. | Reduced damage to targets equipped with Fire Protection or Protection. Blazes, ghasts, magma cubes, Minecraft:withers, wither skeletons and zombified piglins are immune to burning. |
|
Caused by a firework rocket. | <more information needed></more information needed>
|
|
Caused by colliding with a block when flying with an Minecraft:elytra. | <more information needed></more information needed>
|
|
Caused by standing in powder snow. | <more information needed></more information needed>
|
|
Caused by Minecraft:lava. | <more information needed></more information needed>
|
|
Caused by lightning. | <more information needed></more information needed>
|
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
Caused by potions, dragon breath, evocation fangs or guardians. | <more information needed></more information needed>
|
|
Caused by magma blocks. | <more information needed></more information needed>
|
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
Override this entity's health value. | <more information needed></more information needed>
|
|
Caused by Minecraft:pistons. | <more information needed></more information needed>
|
|
Caused by projectiles, such as arrows. | <more information needed></more information needed>
|
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
Caused by
|
<more information needed></more information needed>
|
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
Caused by stalactites. | <more information needed></more information needed>
|
|
Caused by stalagmites. | <more information needed></more information needed>
|
|
Caused by hunger. | <more information needed></more information needed>
|
|
Caused by suffocation. | <more information needed></more information needed>
|
|
Snow golem damaged by biome temperature. | <more information needed></more information needed>
|
|
Caused by thorns. | <more information needed></more information needed>
|
|
Caused by the void. | <more information needed></more information needed>
|
|
Caused by a Minecraft:wither. | <more information needed></more information needed>
|
Syntax
- Java Edition
damage <target> <amount> [<damageType>] [at <location>]damage <target> <amount> [<damageType>] [by <entity>] [from <cause>]
- Bedrock Edition
damage <target: target> <amount: int> <cause: DamageCause> entity <damager: target>damage <target: target> <amount: int> [cause: DamageCause]
Arguments
Template:El: <target>: entity
Template:El: target: target: CommandSelector<Actor>
- Specifies the entityTemplate:Only or entitiesTemplate:Only to damage.
- {{#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|}}
- REDIRECT Template:Edition
Template:Rcat: <amount>: float
- Specifies the amount of damage to inflict.
- {{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|float}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
- REDIRECT Template:Edition
Template:Rcat: amount: int: int
- Specifies the amount of damage to inflict.
- {{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|integer}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}} Should be between 0 and 2147483647 (both inclusive).
Template:El: <damageType>: resource
Template:El: cause: DamageCause: enum
- Specifies the damage typeTemplate:Only or type of damageTemplate:Only. Affects death messages and difficulty scaling, among other things.
- in Template:Editions, if not specified, defaults to
minecraft:generic. - {{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|resource}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
- For Minecraft:Bedrock Edition, all possible arguments are listed on the official add-on documentation.
- REDIRECT Template:Edition
Template:Rcat: <location>: vec3
- Specifies the location the damage originated at if the cause of the damage is not an entity (e.g., the position of the Minecraft:bed that exploded in the Nether).
- {{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|vec3}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
Template:El: <entity>: entity
Template:El: damager: target: CommandSelector<Actor>
- Specifies the entity who dealt the damage.
- {{#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|}}
- REDIRECT Template:Edition
Template:Rcat: <cause>: entity
- Specifies the cause of the damage (for example, the skeleton that shot the Minecraft:arrow).
- {{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|entity}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
Results
Template:Result table 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}}|1}}{{#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 who are considered to have successfully took the damage.}}{{#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|}}
Example
- Make a villager named
villager_1deal Template:Hp damage to the nearest iron golem:
History
Java Edition
Bedrock Edition
External links
de:Befehl/damage es:Comandos/damage ja:コマンド/damage ko:명령어/damage pt:Comandos/damage ru:Команды консоли/damage zh:命令/damage