/damage
/damage| Permission level required |
|
|---|---|
| Restrictions |
Cheat only |
{
"title": "<code>/damage</code>",
"rows": [
{
"field": "\n* 2 <sup class=\"noprint nowrap Inline-Template \" title=\"\">[<i><span title=\"This statement only applies to Java Edition\">(link to Java Edition article, displayed as JE) only</span></i>]</sup>\n* 1 <sup class=\"noprint nowrap Inline-Template \" title=\"\">[<i><span title=\"This statement only applies to Bedrock Edition\">(link to Bedrock Edition article, displayed as BE) only</span></i>]</sup>",
"label": "(link to Permission level article, displayed as Permission level<br>required)"
},
{
"field": "(link to Option article, displayed as Cheat) only<br>",
"label": "(link to Commands#Restrictions article, displayed as Restrictions)"
}
],
"invimages": [],
"images": []
}
Applies a set amount of damage to the specified entities.
Usage
/ applies damage to entities with health or an equivalent statistic. The <damageType> or cause: DamageType argument is used to specify the kind of damage which will be applied to the entity.
When being applied to an applicable entity, / uses the same underlying logic when applying damage as is used elsewhere in the game. As such, the damage specified by the <damageType> or cause: DamageType 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 / 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 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 magic, block_explosion, or projectile, it deals thorn damage to the damage source.
| |
| Teleports away. | |
| If the damage source is an entity, spawns ink particles. |
Hardcoded behaviors
When amount: int is 0, entities are always considered successfully damaged. If not 0, only entities (except armor stands, NPCs, and 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 have no effect on the command's output text, result, and return value. Only hardcoded behaviors can affect them.
| Mob | Behavior |
|---|---|
| Players in Creative mode cannot be damaged even with the "falling out of the world" damage type. | |
/kill command can always kill the agent. This has the side-effect that / with the cause of self_destruct always removes the agent, regardless of whether amount: int is 0 or not.
| |
Applying / command on an armor stand cannot reduce its health value (except for fire and fire_tick 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 Punching an armor stand in Creative mode removes it. Running Explosions can always destroy the armor stand. The
Void damage can always kill the armor stand.
Armor stands are set on fire when in lava or fire.
Armor stands are damaged when on fire. If cause is If an arrow hits an armor stand, the armor stand is destroyed and the arrow disappears. Running If a trident hits an armor stand, the armor stand is destroyed. Running When an armor stand falls onto the ground, a landing sound is played. Broadcasts landing sound when an armor stand is damaged with the | |
Clicking a balloon isn't considered as hurting it. This has the side-effect that running / 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. | |
| Punching a boat is always considered as hurting it.
Running 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 Punching a boat in Creative mode destroys it. Running | |
| A camera cannot be damaged.
Using A camera cannot be affected by an explosion. Using | |
| Hurting an end crystal means making it explode.
Running | |
| Hardcoded behavior: An ender dragon is immune to arrows when perching, and makes arrows catch fire.
A damage command with Only players can hurt an ender dragon. Only a player as the source, or the
A damage command with the cause of | |
| Projectiles, except potions, cannot hurt an enderman.
If the cause is | |
| A player cannot damage an experience orb.
Running | |
Applying / on a falling block is always considered to have successfully damaged it, and cannot be detected or controlled with behavior packs.
Applying | |
| 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 | |
| Pushing a painting or leash knot destroys the entity.
Paintings and lead knots are always destroyed when applying | |
| A player cannot damage an item.
Applying | |
| Punshing a minecart is always considered as damaging it.
Running 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.
An ender pearl can reduce a minecart's Structural Integrity, but cannot destroy it. Applying | |
/ with the cause being projectile and the damage source being an arrow that is on fire or a small fireball, or with the cause being fire or lava, 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 minecart. | |
| NPCs cannot be damaged.
Using Only the void, If the cause is | |
| Primed TNT cannot be damaged.
Using
A damage command with the cause of | |
| A shulker teleports if it is in lava or fire.
Applying Projectiles cannot hurt a shulker when it is closed. Applying | |
| A small fireball cannot be hit.
Using | |
| A trident cannot be damaged.
Using A trident cannot be affected by an explosion. Using | |
| A wither skull cannot be damaged.
Using A black wither skull cannot be hit. Using | |
| Drowning and falling cannot hurt a wither.
If the cause is A wither cannot damage another wither. If the cause is not If a wither is in its spawning animation, the cause is When spawning, a wither cannot be damaged by anything except for the void. If a wither is spawing and the source is not the When dying, a wither cannot be damaged. If a wither is dying, In its armored state, a wither is immune to arrows. If the wither is in its armored state, |
Damage types
Below are the types of damage that can be applied. These are used for the <damageType> or cause:DamageCause 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 |
|---|---|---|
all
|
Any damage | |
anvil
|
Caused by a falling anvil. | Reduced damage to targets wearing a helmet. |
block-explosion
|
Caused by the explosion of a block. | Reduced damage to targets equipped with armor, with extra reduction per tier of Blast Protection. |
charging
|
| |
contact
|
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. |
drowning
|
Caused by drowning or rain. | |
entity-attack
|
Caused by a melee attack from a mob. | Reduced damage to targets equipped with armor, with extra reduction per tier of Protection. |
entity-explosion
|
Caused by the explosion of a mob. | Reduced damage to targets equipped with armor, with extra reduction per tier of Blast Protection. |
fall
|
Caused by falling from a higher ground, or teleporting with an ender pearl. | Main article: Damage § Fall_damage Reduced damage to targets equipped with Feather Falling or Protection armor. Some mobs are immune to or take less fall damage.
|
falling_block
|
| |
fire
|
Caused by standing in fire. | |
fire_tick
|
Caused by being on fire. | Reduced damage to targets equipped with Fire Protection or Protection. Blazes, ghasts, magma cubes, withers, wither skeletons and zombified piglins are immune to burning. |
fireworks
|
Caused by a firework rocket. | |
fly_into_wall
|
Caused by colliding with a block when flying with an elytra. | |
freezing
|
Caused by standing in powder snow. | |
lava
|
Caused by lava. | |
lightning
|
Caused by lightning. | |
magic
|
Caused by potions, dragon breath, evocation fangs or guardians. | |
magma
|
Caused by magma blocks. | |
override
|
Override this entity's health value. | |
piston
|
Caused by pistons. | |
projectile
|
Caused by projectiles, such as arrows. | |
stalactite
|
Caused by stalactites. | |
stalagmite
|
Caused by stalagmites. | |
starve
|
Caused by hunger. | |
suffocation
|
Caused by suffocation. | |
self_destruct
|
Caused by /kill.
|
|
temperature
|
Snow golem damaged by biome temperature. | |
thorns
|
Caused by thorns. | |
void
|
Caused by the void. | |
wither
|
Caused by a wither. | |
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
JE: <target>: entity
BE: target: target: CommandSelector<Actor>
- Specifies the entity or entities to damage.
- Must be a player name, a target selector or a UUID. In Java Edition, the target selector must be in single type.
- Specifies the amount of damage to inflict.
- Must be a [Float]Single-precision floating-point number (from -(2-2-23)×2127 (≈-3.4×1038) to (2-2-23)2×127 (≈3.4×1038) ). And it must be greater than or equal to 0.0.
- Specifies the amount of damage to inflict.
- Must be a [Int]32-bit integer number (from -2147483648 (-231) to 2147483647 (231-1) ). Should be between 0 and 2147483647 (both inclusive).
JE: <damageType>: resource
BE: cause: DamageCause: enum
- Specifies the damage type or type of damage. Affects death messages and difficulty scaling, among other things.
- In Java Edition, if not specified, defaults to
minecraft:generic. - Must be an existing registered resource location in
minecraft:damage_typeregistry. - For Bedrock Edition, all possible arguments are listed on the official add-on documentation.
- Specifies the location the damage originated at if the cause of the damage is not an entity (e.g., the position of the bed that exploded in the Nether).
- Must be three-dimensional coordinates with double-precision floating-point number elements. Accepts tilde and caret notations.
JE: <entity>: entity
BE: damager: target: CommandSelector<Actor>
- Specifies the entity who dealt the damage.
- Must be a player name, a target selector or a UUID. In Java Edition, the target selector must be in single type.
- Specifies the cause of the damage (for example, the skeleton that shot the arrow).
- Must be a player name, a target selector or a UUID. And the target selector must be in single type.
Results
| Command | Trigger | Java Edition | Bedrock Edition |
|---|---|---|---|
| Any | The arguments are not specified correctly. | Unparseable | Unparseable |
amount or amount: int is lower than or equal to 0. | Failed | Failed | |
amount or amount: int is greater than 0 and the damage is considered not having successfully damaged the entity. | |||
amount: int is greater than 0 and the entity is not a vanilla entity or has no hardcoded damage behavior. | |||
/damage ... by ... /damage ... entity ... | source or damager: target targets multiple entities. | ||
| Any | Otherwise | Successful | |
Output
| Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
|---|---|---|---|---|---|
| Any | Java Edition | On fail | 0 | 0 | 0 |
| On success | 1 | 1 | 1 | ||
| Bedrock Edition | On fail | 0 | N/A | N/A | |
| On success | The number of entities who are considered to have successfully took the damage. | N/A | N/A |
Example
- Make a villager named
villager_1deal 1HP damage to the nearest iron golem:/damage @e[type=iron_golem, sort=nearest, limit=1] 1 generic by @e[type=villager, limit=1, name="villager_1"]/damage @e[type=iron_golem, c=1] 1 entity_attack entity @e[type=villager, c=1, name="villager_1"]
History
| Java Edition | |||||||
|---|---|---|---|---|---|---|---|
| 1.19.4 | 23w06a | Added /damage. | |||||
| Pre-release 2 | Striders and blazes now have a weakness to freezing damage. | ||||||
| Bedrock Edition | |||||||
| 1.18.10 | beta 1.18.10.26 | Added /damage. | |||||
| 1.20.70 | Preview 1.20.70.21 | Renamed the suicide damage type to self_destruct. | |||||