Minecraft Wiki
Advertisement
Gear (item)
This article is a work in progress. 
Please help in the expansion or creation of this article by expanding or improving it. The talk page may contain suggestions.
Brush
This article needs cleanup to comply with the style guide. [discuss]
Please help improve this page. The talk page may contain suggestions.
Reason: Grammar mistakes and typos

Applies a set amount of damage to the specified entities.

Usage[]

This command does not simply change a entity health value. Instead, it directly calls the underlying logic in the game to simulate the situation of causing damage to the entity. So this command has many undefined behaviors.

The output text, result, and return value of the damage command are not related to whether the health value is changed. In fact, they are undefined.

The amount: int is not the final amount of reduced health value. The reduced health value is usually less than or greater than the amount: int due to world difficulty, armors, status effects, or the target entity itself, etc.

When damaged, the entity may react accordingly, such as being knocked back, becoming angry, etc. The damager entity may also react in certain ways, such as the arrow's disappearing.

Undefined behaviors may be changed at any time without warning. When this happens, your addons or maps may cease to work. Use these undefined behaviors at your own risk.

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‌[Java Edition only] or entities‌[Bedrock Edition only] to damage.
Must be a player name, a target selector or a UUID[Java Edition only]. In Java Edition, the target selector must be in single type.

<amount>: float

Specifies the amount of damage to inflict.
Must be a Single-precision floating-point format number. And it must be greater than or equal to 0.0.

amount: int: int

Specifies the amount of damage to inflict.
Must be a 32-bit integer number. And it must be between 0.0 and 2147483647 (inclusive).

JE<damageType>: resource
BE: cause: DamageCause: enum

Specifies the damage type[Java Edition only] or type of damage‌[Bedrock Edition only]. Affects death messages and difficulty scaling, among other things.
Must be an existing registered resource location in correct 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 a three-dimensional coordinates with 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[Java Edition only]. 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[]

CommandTriggerBedrock Edition
anythe arguments are not specified correctly Unparseable
amount: int is lower than 0 Failed
All the selected targets meet one or more of the following conditions:
  • amount: int is not 0, and it is considered by game that the command is not successfully damaging the entity.
  • amount: int is not 0, and the entity is not a vanilla entity or has no hardcoded behavior on damaging.
/... entity ...if damager: target targeting multiple targets
anyOtherwiseSuccessful

Output[]

CommandEditionSituationSuccess Count
anyBedrock EditionOn fail0
On successthe number of entities who are considered to have successfully took the damage.

Example[]

  • Make a villager named villager_1 deal 1♥ damage to a nearby iron golem:
    • /damage @e[type=iron_golem, limit=1] 1 generic by @e[type=villager, limit=1, name="villager_1"][Java Edition only]
    • /damage @e[type=iron_golem, c=1] 1 entity_attack entity @e[type=villager, c=1, name="villager_1"][Bedrock Edition only]

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