Applies a specified amount of damage to targeted entities, with optional damage type and source entity.
/damage <target> <amount> [<damageType>] [at <location>] /damage <target> <amount> [<damageType>] [by <entity>] [from <cause>]
| Name | Required | Description |
|---|---|---|
| target | Yes | The entity/entities to deal damage to. |
| amount | Yes | Amount of damage to apply (in half-hearts). |
| damageType | No | The damage type identifier (e.g., minecraft:mob_attack, minecraft:fire). Affects armor, enchantment resistance, and death messages. |
| entity | No | The entity to credit as the direct attacker (used with by). |
| cause | No | The entity to credit as the indirect cause (used with from). |
| location | No | The coordinates for location-based damage (used with at). |
/damage @e[type=zombie,limit=1] 5 /damage @p 3 minecraft:fire /damage @e[type=pig] 10 minecraft:mob_attack by @p
by and from can produce correct death messages referencing the attacker.damage_type registry.