/damage

This article is about the command. For the mechanic, see Damage.
/damage
Permission level
required
  • 2 ‌
  • 1 ‌
Restrictions

Cheat only

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.

Balloon Damaged with a source entity, the balloon swings.
Bat When damaged, a sleeping bat begins flying.
End Crystal Controlled by the Ender Dragon's fight system.
Enderman Teleports away.
Guardian 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.
Shulker Teleports away.
Squid 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
Player Players in Creative mode cannot be damaged even with the "falling out of the world" damage type.
Agent /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.
Armor Stand 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 / 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 / on an armor stand with the damage source being a player in Creative mode removes it.

Explosions can always destroy the armor stand. The /kill command can always kill the armor stand.

/ commands with the cause of suicide, block_explosion, or entity_explosion make the armor stand drop its held items and destroy itself.

Void damage can always kill the armor stand.

/ commands with the void cause always remove the armor stand.

Armor stands are set on fire when in lava or fire.

/ commands with the fire cause set the armor stand on fire and reduce its health value by 0.5.

Armor stands are damaged when on fire.

If cause is fire, and the armor stand is not in a lava or fire block, / 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 / 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 / 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 landing sound when an armor stand is damaged with the fall cause.

Balloon 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. /kill can always kill the balloon. This has the side-effect that the damage causes self_destruct, projectile, fire, fire_tick, lava, or magma destroy the balloon.

Boat Punching a boat is always considered as hurting it.

Running / 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 / 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 / on a boat with the damage source being a player in Creative mode destroys the boat, regardless of whether amount: int is 0 or not.

Camera A camera cannot be damaged.

Using / 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 / on a camera with the source being a player removes it.

End Crystal Hurting an end crystal means making it explode.

Running / on an end crystal makes it explode, regardless of whether amount: int is 0 or not, and is never considered to have successfully damaged it.

Ender Dragon Hardcoded behavior: An ender dragon is immune to arrows when perching, and makes arrows catch fire.

/ with the damage source being an arrow cannot hurt a perching dragon, but the arrow is still set on fire despite the command not being successful.

A damage command with suffocation 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 block_explosion as a cause, can hurt an ender dragon and can be detected or controlled with behavior packs.

/kill can always kill an ender dragon.

A damage command with the cause of self_destruct always kills an ender dragon and is considered successful, regardless of whether amount: int is 0 or not.

Enderman Projectiles, except potions, cannot hurt an enderman.

If the cause is projectile and the source is not a potion entity, / 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.

Experience Orb A player cannot damage an experience orb.

Running / 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.

Falling Block Applying / on a falling block is always considered to have successfully damaged it, and cannot be detected or controlled with behavior packs.

Applying / on a falling block with the source being piston 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).

Ghast 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 amount: int is. It cannot be detected or controlled with behavior packs.

Painting and Leash Knot Pushing a painting or leash knot destroys the entity.

Paintings and lead knots are always destroyed when applying / 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 amount: int is 0 or not, but it cannot be detected or controlled with behavior packs.

Item A player cannot damage an item.

Applying / 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.

Minecart Punshing a minecart is always considered as damaging it.

Running / 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.

/ 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 / 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.

Minecart with TNT / 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.

NPC NPCs cannot be damaged.

Using / on an NPC is never considered to have successfully damaged it, and cannot be detected or controlled with behavior packs.

Only the void, /kill, or world builder can remove it.

If the cause is void or self_destruct, or the cause is entity_attack and the source is a world builder, / removes the NPC. Otherwise, it does nothing.

Primed TNT Primed TNT cannot be damaged.

Using / on primed TNT is never considered to have successfully damaged it.

/kill can always kill primed TNT.

A damage command with the cause of self_destruct always kills the primed TNT, regardless of whether amount: int is 0 or not.

Shulker A shulker teleports if it is in lava or fire.

Applying / on a shulker with the cause being lava or fire 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 / on a closed shulker with the cause being projectile cannot damage it. It is considered unsuccessful and cannot be detected or controlled with behavior packs.

Small fireball A small fireball cannot be hit.

Using / on a small fireball is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs.

Trident A trident cannot be damaged.

Using / on a trident is never considered to have successfully damaged it.

A trident cannot be affected by an explosion.

Using / on a trident with cause being block_explosion or entity_explosion cannot be detected or controlled with behavior packs.

Wither Skull A wither skull cannot be damaged.

Using / on a wither skull is never considered to have successfully damaged it.

A black wither skull cannot be hit.

Using / on a black wither skull is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs.

Wither Drowning and falling cannot hurt a wither.

If the cause is drowning or fall, / 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 self_destruct 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 entity_attack, and the source is a mob, / makes the source mob suffer knockback.

When spawning, a wither cannot be damaged by anything except for the void.

If a wither is spawing and the source is not the void, 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, / 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, / with the cause being projectile 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>‌ or cause:DamageCause‌ arguments (see Syntax below).


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.

JE: <amount>: float

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.

BE: amount: int: int

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_type registry.
For Bedrock Edition, all possible arguments are listed on the official add-on documentation.

JE: <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 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.

JE: <cause>: entity

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

CommandTriggerJava EditionBedrock Edition
AnyThe 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.
AnyOtherwiseSuccessful

Output

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
AnyJava EditionOn fail000
On success111
Bedrock EditionOn fail0N/AN/A
On successThe number of entities who are considered to have successfully took the damage.N/AN/A

Example

  • Make a villager named villager_1 deal 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.423w06aAdded /damage.
Pre-release 2Striders and blazes now have a weakness to freezing damage.
Bedrock Edition
1.18.10beta 1.18.10.26Added /damage.
1.20.70Preview 1.20.70.21Renamed the suicide damage type to self_destruct.

Navigation