Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Commands/damage: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Remove broken links to missing pages
SyncBot (talk | contribs)
Fix template calls: add MC/ prefix
 
Line 9: Line 9:


== Usage ==
== Usage ==
{{cmd|damage}} applies damage to entities with health or an equivalent statistic. The <code><damageType></code>{{only|java|short=1}} or <code>cause: DamageType</code>{{only|bedrock|short=1}} argument is used to specify the kind of damage which will be applied to the entity.
{{MC/Cmd|damage}} applies damage to entities with health or an equivalent statistic. The <code><damageType></code>{{only|java|short=1}} or <code>cause: DamageType</code>{{only|bedrock|short=1}} argument is used to specify the kind of damage which will be applied to the entity.


When being applied to an applicable entity, {{cmd|damage}} uses the same underlying logic when applying damage as is used elsewhere in the game. As such, the damage specified by the <code><damageType></code>{{only|java|short=1}} or <code>cause: DamageType</code>{{only|bedrock|short=1}}  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 {{cmd|damage}} 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).
When being applied to an applicable entity, {{MC/Cmd|damage}} uses the same underlying logic when applying damage as is used elsewhere in the game. As such, the damage specified by the <code><damageType></code>{{only|java|short=1}} or <code>cause: DamageType</code>{{only|bedrock|short=1}}  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 {{MC/Cmd|damage}} 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===
===Undefined behavior===


{{-}}
{{MC/-}}
{| class="wikitable sortable" data-description="Undefined behavior"
{| class="wikitable sortable" data-description="Undefined behavior"
! Mob
! Mob
Line 24: Line 24:
Begins an invulnerable cooldown period.
Begins an invulnerable cooldown period.
|-
|-
| {{EntityLink|Balloon}}{{only|education|bedrock|short=1}}
| {{MC/Entitylink|Balloon}}{{only|education|bedrock|short=1}}
| Damaged with a source entity, the balloon swings.
| Damaged with a source entity, the balloon swings.
|-
|-
| {{EntityLink|Bat}}
| {{MC/Entitylink|Bat}}
| When damaged, a sleeping bat begins flying.
| When damaged, a sleeping bat begins flying.
|-
|-
| {{EntityLink|End Crystal}}
| {{MC/Entitylink|End Crystal}}
| Controlled by the Ender Dragon's fight system.
| Controlled by the Ender Dragon's fight system.
|-
|-
| {{EntityLink|Enderman}}
| {{MC/Entitylink|Enderman}}
| Teleports away.
| Teleports away.
|-
|-
| {{EntityLink|Guardian}}
| {{MC/Entitylink|Guardian}}
| While its spikes are extended, if the damage source is a mob and the cause isn't {{cd|magic}}, {{cd|block_explosion}}, or {{cd|projectile}}, it deals thorn damage to the damage source.
| While its spikes are extended, if the damage source is a mob and the cause isn't {{MC/Cd|magic}}, {{MC/Cd|block_explosion}}, or {{MC/Cd|projectile}}, it deals thorn damage to the damage source.
|-
|-
| {{EntityLink|Shulker}}
| {{MC/Entitylink|Shulker}}
| Teleports away.
| Teleports away.
|-
|-
| {{EntityLink|Squid}}
| {{MC/Entitylink|Squid}}
| If the damage source is an entity, it spawns ink particles.
| If the damage source is an entity, it spawns ink particles.
|}
|}


===Hardcoded behaviors===
===Hardcoded behaviors===
When {{cd|amount: int}} is 0, entities are always considered successfully damaged. If not 0, only entities (except armor stands, [[Minecraft:NPC|NPCs]], and [[Minecraft:camera]]), boats, paintings, leash knots, falling blocks, and minecarts may be recognized as successfully damaged.
When {{MC/Cd|amount: int}} is 0, entities are always considered successfully damaged. If not 0, only entities (except armor stands, [[Minecraft:NPC|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.
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.
Line 55: Line 55:
! Behavior
! Behavior
|-
|-
| {{EntityLink|Player}}
| {{MC/Entitylink|Player}}
| Players in Creative mode are invulnerable by most types of damage excluding {{Code|generic_kill}} and {{Code|out_of_world}} (refer to damage types)
| Players in Creative mode are invulnerable by most types of damage excluding {{MC/Code|generic_kill}} and {{MC/Code|out_of_world}} (refer to damage types)
|-
|-
| {{EntityLink|Agent}}{{only|education|bedrock|short=1}}
| {{MC/Entitylink|Agent}}{{only|education|bedrock|short=1}}
| {{cmd|kill}} command can always kill the agent. This has the side-effect that {{cmd|damage}} with the cause of {{cd|self_destruct}} always removes the agent, regardless of whether {{cd|amount: int}} is 0 or not.
| {{MC/Cmd|kill}} command can always kill the agent. This has the side-effect that {{MC/Cmd|damage}} with the cause of {{MC/Cd|self_destruct}} always removes the agent, regardless of whether {{MC/Cd|amount: int}} is 0 or not.
|-
|-
| {{EntityLink|Armor Stand}}
| {{MC/Entitylink|Armor Stand}}
| Applying {{cmd|damage}} command on an armor stand cannot reduce its health value (except for {{cd|fire}} and {{cd|fire_tick}} causes), and is never considered to have damaged it successfully. It also cannot be detected or controlled with behavior packs.
| Applying {{MC/Cmd|damage}} command on an armor stand cannot reduce its health value (except for {{MC/Cd|fire}} and {{MC/Cd|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 is not considered as having damaged it.
Line 68: Line 68:
Punching an armor stand twice in Survival mode destroys it.
Punching an armor stand twice in Survival mode destroys it.


Running {{cmd|damage}} 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.
Running {{MC/Cmd|damage}} 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.
Punching an armor stand in Creative mode removes it.


Running {{cmd|damage}} on an armor stand with the damage source being a player in Creative mode removes it.
Running {{MC/Cmd|damage}} on an armor stand with the damage source being a player in Creative mode removes it.


Explosions can always destroy the armor stand. The {{cmd|kill}} command can always kill the armor stand.
Explosions can always destroy the armor stand. The {{MC/Cmd|kill}} command can always kill the armor stand.


{{cmd|damage}} commands with the cause of {{cd|suicide}}, {{cd|block_explosion}}, or {{cd|entity_explosion}} make the armor stand drop its held items and destroy itself.
{{MC/Cmd|damage}} commands with the cause of {{MC/Cd|suicide}}, {{MC/Cd|block_explosion}}, or {{MC/Cd|entity_explosion}} make the armor stand drop its held items and destroy itself.


Void damage can always kill the armor stand.
Void damage can always kill the armor stand.


{{cmd|damage}} commands with the {{cd|void}} cause always remove the armor stand.
{{MC/Cmd|damage}} commands with the {{MC/Cd|void}} cause always remove the armor stand.


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


{{cmd|damage}} commands with the {{cd|fire}} cause the armor stand to be set on fire and reduce its health value by 0.5.
{{MC/Cmd|damage}} commands with the {{MC/Cd|fire}} cause the armor stand to be set on fire and reduce its health value by 0.5.


Armor stands are damaged when on fire.
Armor stands are damaged when on fire.


If the cause is {{cd|fire}}, and the armor stand is not in a lava or fire block, {{cmd|damage}} commands reduce its health value by 1.0.
If the cause is {{MC/Cd|fire}}, and the armor stand is not in a lava or fire block, {{MC/Cmd|damage}} commands reduce its health value by 1.0.


If an arrow hits an armor stand, the armor stand is destroyed, and the arrow disappears.
If an arrow hits an armor stand, the armor stand is destroyed, and the arrow disappears.


Running {{cmd|damage}} commands on an armor stand with the source being an arrow causes the armor stand to be destroyed and the arrow to disappear.
Running {{MC/Cmd|damage}} 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.
If a trident hits an armor stand, the armor stand is destroyed.


Running {{cmd|damage}} commands on an armor stand with the damage source being a trident causes the armor stand to be destroyed.
Running {{MC/Cmd|damage}} 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.
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 {{cd|fall}} cause.
Broadcasts a landing sound when an armor stand is damaged with the {{MC/Cd|fall}} cause.
|-
|-
| {{EntityLink|Balloon}}{{only|education|bedrock|short=1}}
| {{MC/Entitylink|Balloon}}{{only|education|bedrock|short=1}}
| Clicking a balloon isn't considered as hurting it. This has the side-effect that running {{cmd|damage}} on a balloon cannot reduce its health value, and is never considered to have successfully damaged it.
| Clicking a balloon isn't considered as hurting it. This has the side-effect that running {{MC/Cmd|damage}} 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. {{cmd|kill}} can always kill the balloon. This has the side-effect that the damage causes {{cd|self_destruct}}, {{cd|projectile}}, {{cd|fire}}, {{cd|fire_tick}}, {{cd|lava}}, or {{cd|magma}} destroy the balloon.
Projectiles, fire, lava, and magma can always destroy the balloon. {{MC/Cmd|kill}} can always kill the balloon. This has the side-effect that the damage causes {{MC/Cd|self_destruct}}, {{MC/Cd|projectile}}, {{MC/Cd|fire}}, {{MC/Cd|fire_tick}}, {{MC/Cd|lava}}, or {{MC/Cd|magma}} destroy the balloon.
|-
|-
| {{EntityLink|Boat}}
| {{MC/Entitylink|Boat}}
| Punching a boat is always considered as hurting it.
| Punching a boat is always considered as hurting it.


Running {{cmd|damage}} on a boat is always considered to have successfully damaged it, but it cannot be detected or controlled with behavior packs.
Running {{MC/Cmd|damage}} 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.
Boat uses Structural Integrity instead of health points to control whether it should break or not. A boat has 40 points of Structural Integrity.
Line 116: Line 116:
Damage command changes its Structural Integrity value instead of its health value.
Damage command changes its Structural Integrity value instead of its health value.


When applying {{cmd|damage}} 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.
When applying {{MC/Cmd|damage}} 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.
Punching a boat in Creative mode destroys it.


Running {{cmd|damage}} on a boat with the damage source being a player in Creative mode destroys the boat, regardless of whether {{cd|amount: int}} is 0 or not.
Running {{MC/Cmd|damage}} on a boat with the damage source being a player in Creative mode destroys the boat, regardless of whether {{MC/Cd|amount: int}} is 0 or not.
|-
|-
| {{EntityLink|Camera}}{{only|education|bedrock|short=1}}
| {{MC/Entitylink|Camera}}{{only|education|bedrock|short=1}}
| A camera cannot be damaged.
| A camera cannot be damaged.


Using {{cmd|damage}} on a camera is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs.
Using {{MC/Cmd|damage}} 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.
A camera cannot be affected by an explosion.


Using {{cmd|damage}} on a camera with the source being a player removes it.
Using {{MC/Cmd|damage}} on a camera with the source being a player removes it.
|-
|-
| {{EntityLink|End Crystal}}
| {{MC/Entitylink|End Crystal}}
| Hurting an end crystal means making it explode.
| Hurting an end crystal means making it explode.


Running {{cmd|damage}} on an end crystal makes it explode, regardless of whether {{cd|amount: int}} is 0 or not, and is never{{verify}} considered to have successfully damaged it.
Running {{MC/Cmd|damage}} on an end crystal makes it explode, regardless of whether {{MC/Cd|amount: int}} is 0 or not, and is never{{MC/Verify}} considered to have successfully damaged it.
|-
|-
| {{EntityLink|Ender Dragon}}
| {{MC/Entitylink|Ender Dragon}}
| Hardcoded behavior: An ender dragon is immune to arrows when perching, and makes arrows catch fire.
| Hardcoded behavior: An ender dragon is immune to arrows when perching, and makes arrows catch fire.


{{cmd|damage}} 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.
{{MC/Cmd|damage}} 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 {{cd|suffocation}} cannot hurt an ender dragon and is always considered unsuccessful.
A damage command with {{MC/Cd|suffocation}} cannot hurt an ender dragon and is always considered unsuccessful.


Only players can hurt an ender dragon.
Only players can hurt an ender dragon.


Only a player as the source, or the {{cd|block_explosion}} as a cause, can hurt an ender dragon and can be detected or controlled with behavior packs.
Only a player as the source, or the {{MC/Cd|block_explosion}} as a cause, can hurt an ender dragon and can be detected or controlled with behavior packs.


{{cmd|kill}} can always kill an ender dragon.
{{MC/Cmd|kill}} can always kill an ender dragon.


A damage command with the cause of {{cd|self_destruct}} always kills an ender dragon and is considered successful, regardless of whether {{cd|amount: int}} is 0 or not.
A damage command with the cause of {{MC/Cd|self_destruct}} always kills an ender dragon and is considered successful, regardless of whether {{MC/Cd|amount: int}} is 0 or not.
|-
|-
| {{EntityLink|Enderman}}
| {{MC/Entitylink|Enderman}}
| Projectiles, except potions, cannot hurt an enderman.
| Projectiles, except potions, cannot hurt an enderman.


If the cause is {{cd|projectile}} and the source is not a potion entity, {{cmd|damage}} 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.
If the cause is {{MC/Cd|projectile}} and the source is not a potion entity, {{MC/Cmd|damage}} 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.
|-
|-
| {{EntityLink|Experience Orb}}
| {{MC/Entitylink|Experience Orb}}
| A player cannot damage an experience orb.
| A player cannot damage an experience orb.


Running {{cmd|damage}} 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.
Running {{MC/Cmd|damage}} 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.
|-
|-
| {{EntityLink|Falling Block}}
| {{MC/Entitylink|Falling Block}}
| Applying {{cmd|damage}} on a falling block is always considered to have successfully damaged it, and cannot be detected or controlled with behavior packs.
| Applying {{MC/Cmd|damage}} on a falling block is always considered to have successfully damaged it, and cannot be detected or controlled with behavior packs.


Applying {{cmd|damage}} on a falling block with the source being {{cd|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).
Applying {{MC/Cmd|damage}} on a falling block with the source being {{MC/Cd|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).
|-
|-
| {{EntityLink|Ghast}}
| {{MC/Entitylink|Ghast}}
| A fireball deals 1000 damage to a ghast if the fireball was rebounded by a player.
| 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 {{cd|amount: int}} is. It cannot be detected or controlled with behavior packs.
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 {{MC/Cd|amount: int}} is. It cannot be detected or controlled with behavior packs.
|-
|-
| {{EntityLink|Painting}} and {{EntityLink|Leash Knot}}
| {{MC/Entitylink|Painting}} and {{MC/Entitylink|Leash Knot}}
| Pushing a painting or a leash knot destroys the entity.
| Pushing a painting or a leash knot destroys the entity.


Paintings and lead knots are always destroyed when applying {{cmd|damage}} 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 {{cd|amount: int}} is 0 or not, but it cannot be detected or controlled with behavior packs.
Paintings and lead knots are always destroyed when applying {{MC/Cmd|damage}} 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 {{MC/Cd|amount: int}} is 0 or not, but it cannot be detected or controlled with behavior packs.
|-
|-
| {{EnvLink|Item}}
| {{MC/EnvLink|Item}}
| A player cannot damage an item.
| A player cannot damage an item.


Applying {{cmd|damage}} 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.
Applying {{MC/Cmd|damage}} 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.
|-
|-
| {{EntityLink|Minecart}}
| {{MC/Entitylink|Minecart}}
| Punching a minecart is always considered as damaging it.
| Punching a minecart is always considered as damaging it.


Running {{cmd|damage}} on a minecart is always considered to have successfully damaged it.
Running {{MC/Cmd|damage}} 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.
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.


{{cmd|damage}} changes a minecart's Structural Integrity value instead of its health value.
{{MC/Cmd|damage}} 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.
An ender pearl can reduce a minecart's Structural Integrity, but cannot destroy it.


Applying {{cmd|damage}} 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.
Applying {{MC/Cmd|damage}} 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.
|-
|-
| {{EntityLink|Minecart with TNT}}
| {{MC/Entitylink|Minecart with TNT}}
| {{cmd|damage}} with the cause being {{cd|projectile}} and the damage source being an [[Minecraft:arrow]] that is on fire or a small fireball, or with the cause being {{cd|fire}} or {{cd|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.
| {{MC/Cmd|damage}} with the cause being {{MC/Cd|projectile}} and the damage source being an [[Minecraft:arrow]] that is on fire or a small fireball, or with the cause being {{MC/Cd|fire}} or {{MC/Cd|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 [[Minecraft:minecart]].
Otherwise behaves as a regular [[Minecraft:minecart]].
|-
|-
| {{EntityLink|NPC}}{{only|education|bedrock|short=1}}
| {{MC/Entitylink|NPC}}{{only|education|bedrock|short=1}}
| NPCs cannot be damaged.
| NPCs cannot be damaged.


Using {{cmd|damage}} on an NPC is never considered to have successfully damaged it, and cannot be detected or controlled with behavior packs.
Using {{MC/Cmd|damage}} on an NPC is never considered to have successfully damaged it, and cannot be detected or controlled with behavior packs.


Only the void, {{cmd|kill}}, or world builder can remove it.
Only the void, {{MC/Cmd|kill}}, or world builder can remove it.


If the cause is {{cd|void}} or {{cd|self_destruct}}, or the cause is {{cd|entity_attack}} and the source is a world builder, {{cmd|damage}} removes the NPC. Otherwise, it does nothing.
If the cause is {{MC/Cd|void}} or {{MC/Cd|self_destruct}}, or the cause is {{MC/Cd|entity_attack}} and the source is a world builder, {{MC/Cmd|damage}} removes the NPC. Otherwise, it does nothing.
|-
|-
| {{EntityLink|Primed TNT}}
| {{MC/Entitylink|Primed TNT}}
| Primed TNT cannot be damaged.
| Primed TNT cannot be damaged.


Using {{cmd|damage}} on primed TNT is never considered to have successfully damaged it.
Using {{MC/Cmd|damage}} on primed TNT is never considered to have successfully damaged it.


{{cmd|kill}} can always kill primed TNT.
{{MC/Cmd|kill}} can always kill primed TNT.


A damage command with the cause of {{cd|self_destruct}} always kills the primed TNT, regardless of whether {{cd|amount: int}} is 0 or not.
A damage command with the cause of {{MC/Cd|self_destruct}} always kills the primed TNT, regardless of whether {{MC/Cd|amount: int}} is 0 or not.
|-
|-
| {{EntityLink|Shulker}}
| {{MC/Entitylink|Shulker}}
| A shulker teleports if it is in lava or fire.
| A shulker teleports if it is in lava or fire.


Applying {{cmd|damage}} on a shulker with the cause being {{cd|lava}} or {{cd|fire}} cannot damage it and makes the shulker teleport away. It is considered unsuccessful and cannot be detected or controlled with behavior packs.
Applying {{MC/Cmd|damage}} on a shulker with the cause being {{MC/Cd|lava}} or {{MC/Cd|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.
Projectiles cannot hurt a shulker when it is closed.


Applying {{cmd|damage}} on a closed shulker with the cause being {{cd|projectile}} cannot damage it. It is considered unsuccessful and cannot be detected or controlled with behavior packs.
Applying {{MC/Cmd|damage}} on a closed shulker with the cause being {{MC/Cd|projectile}} cannot damage it. It is considered unsuccessful and cannot be detected or controlled with behavior packs.
|-
|-
| {{EntityLink|Small fireball}}
| {{MC/Entitylink|Small fireball}}
| A small fireball cannot be hit.
| A small fireball cannot be hit.


Using {{cmd|damage}} on a small fireball is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs.
Using {{MC/Cmd|damage}} on a small fireball is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs.
|-
|-
| {{EntityLink|Trident}}
| {{MC/Entitylink|Trident}}
| A trident cannot be damaged.
| A trident cannot be damaged.


Using {{cmd|damage}} on a trident is never considered to have successfully damaged it.
Using {{MC/Cmd|damage}} on a trident is never considered to have successfully damaged it.


A trident cannot be affected by an explosion.
A trident cannot be affected by an explosion.


Using {{cmd|damage}} on a trident with cause being {{cd|block_explosion}} or {{cd|entity_explosion}} cannot be detected or controlled with behavior packs.
Using {{MC/Cmd|damage}} on a trident with cause being {{MC/Cd|block_explosion}} or {{MC/Cd|entity_explosion}} cannot be detected or controlled with behavior packs.
|-
|-
| {{EntityLink|Wither Skull}}
| {{MC/Entitylink|Wither Skull}}
| A wither skull cannot be damaged.
| A wither skull cannot be damaged.


Using {{cmd|damage}} on a wither skull is never considered to have successfully damaged it.
Using {{MC/Cmd|damage}} on a wither skull is never considered to have successfully damaged it.


A black wither skull cannot be hit.
A black wither skull cannot be hit.


Using {{cmd|damage}} on a black wither skull is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs.
Using {{MC/Cmd|damage}} on a black wither skull is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs.
|-
|-
| {{EntityLink|Wither}}
| {{MC/Entitylink|Wither}}
| Drowning and falling cannot hurt a wither.
| Drowning and falling cannot hurt a wither.


If the cause is {{cd|drowning}} or {{cd|fall}}, {{cmd|damage}} 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 the cause is {{MC/Cd|drowning}} or {{MC/Cd|fall}}, {{MC/Cmd|damage}} 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.
A wither cannot damage another wither.


If the cause is not {{cd|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 the cause is not {{MC/Cd|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 {{cd|entity_attack}}, and the source is a mob, {{cmd|damage}} makes the source mob suffer knockback.
If a wither is in its spawning animation, the cause is {{MC/Cd|entity_attack}}, and the source is a mob, {{MC/Cmd|damage}} makes the source mob suffer knockback.


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


If a wither is spawning, and the source is not the {{cd|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.
If a wither is spawning, and the source is not the {{MC/Cd|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.
When dying, a wither cannot be damaged.


If a wither is dying, {{cmd|damage}} 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 dying, {{MC/Cmd|damage}} 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.
In its armored state, a wither is immune to arrows.


If the wither is in its armored state, {{cmd|damage}} with the cause being {{cd|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.
If the wither is in its armored state, {{MC/Cmd|damage}} with the cause being {{MC/Cd|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 ==
== Damage types ==
Below are the types of damage that can be applied. These are used for the {{code|<damageType>}}{{only|je}} or {{code|cause:DamageCause}}{{only|be}} arguments (see Syntax below).
Below are the types of damage that can be applied. These are used for the {{MC/Code|<damageType>}}{{only|je}} or {{MC/Code|cause:DamageCause}}{{only|be}} arguments (see Syntax below).


{|class = "wikitable collapsed collapsible"
{|class = "wikitable collapsed collapsible"
Line 380: Line 380:
!Notes
!Notes
|-
|-
|{{cd|anvil}}
|{{MC/Cd|anvil}}
|Caused by a falling [[Minecraft:anvil]].
|Caused by a falling [[Minecraft:anvil]].
|Reduced damage to targets wearing a helmet.
|Reduced damage to targets wearing a helmet.
|-
|-
|{{cd|block-explosion}}
|{{MC/Cd|block-explosion}}
|Caused by the explosion of a block.
|Caused by the explosion of a block.
|Reduced damage to targets equipped with armor, with extra reduction per tier of Blast Protection.
|Reduced damage to targets equipped with armor, with extra reduction per tier of Blast Protection.
|-
|-
|{{cd|campfire}}
|{{MC/Cd|campfire}}
|{{Info needed}}
|{{MC/Info needed}}
|{{Info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|charging}}
|{{MC/Cd|charging}}
|{{Info needed}}
|{{MC/Info needed}}
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|contact}}
|{{MC/Cd|contact}}
|Caused by contact with a damage-inflicting block (e.g. cactus and sweet berry bushes).
|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.
|Reduced damage to targets equipped with armor, with extra reduction per tier of Protection.
|-
|-
|{{cd|drowning}}
|{{MC/Cd|drowning}}
|Caused by drowning or rain.
|Caused by drowning or rain.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|entity-attack}}
|{{MC/Cd|entity-attack}}
|Caused by a melee attack from a mob.
|Caused by a melee attack from a mob.
|Reduced damage to targets equipped with armor, with extra reduction per tier of Protection.
|Reduced damage to targets equipped with armor, with extra reduction per tier of Protection.
|-
|-
|{{cd|entity-explosion}}
|{{MC/Cd|entity-explosion}}
|Caused by the explosion of a mob.
|Caused by the explosion of a mob.
|Reduced damage to targets equipped with armor, with extra reduction per tier of Blast Protection.
|Reduced damage to targets equipped with armor, with extra reduction per tier of Blast Protection.
|-
|-
|{{cd|fall}}
|{{MC/Cd|fall}}
|Caused by falling from a higher ground, or teleporting with an ender pearl.
|Caused by falling from a higher ground, or teleporting with an ender pearl.
|{{main|Damage#Fall_damage}}Reduced damage to targets equipped with Feather Falling or Protection armor. Some mobs are immune to or take less fall damage.
|{{MC/Main|Damage#Fall_damage}}Reduced damage to targets equipped with Feather Falling or Protection armor. Some mobs are immune to or take less fall damage.
|-
|-
|{{cd|falling_block}}
|{{MC/Cd|falling_block}}
|{{more info needed}}
|{{MC/More info needed}}
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|fire}}
|{{MC/Cd|fire}}
|Caused by standing in [[Minecraft:fire]].
|Caused by standing in [[Minecraft:fire]].
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|fire_tick}}
|{{MC/Cd|fire_tick}}
|Caused by being on fire.
|Caused by being on fire.
| Reduced damage to targets equipped with Fire Protection or Protection. Blazes, ghasts, magma cubes, [[Minecraft:wither]]s, wither skeletons and zombified piglins are immune to burning.
| Reduced damage to targets equipped with Fire Protection or Protection. Blazes, ghasts, magma cubes, [[Minecraft:wither]]s, wither skeletons and zombified piglins are immune to burning.
|-
|-
|{{cd|fireworks}}
|{{MC/Cd|fireworks}}
|Caused by a firework rocket.
|Caused by a firework rocket.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|fly_into_wall}}
|{{MC/Cd|fly_into_wall}}
|Caused by colliding with a block when flying with an [[Minecraft:elytra]].
|Caused by colliding with a block when flying with an [[Minecraft:elytra]].
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|freezing}}
|{{MC/Cd|freezing}}
|Caused by standing in powder snow.  
|Caused by standing in powder snow.  
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|lava}}
|{{MC/Cd|lava}}
|Caused by [[Minecraft:lava]].
|Caused by [[Minecraft:lava]].
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|lightning}}
|{{MC/Cd|lightning}}
|Caused by lightning.
|Caused by lightning.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|mace-smash}}
|{{MC/Cd|mace-smash}}
|{{Info needed}}
|{{MC/Info needed}}
|{{Info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|magic}}
|{{MC/Cd|magic}}
|Caused by potions, dragon breath, evocation fangs or guardians.
|Caused by potions, dragon breath, evocation fangs or guardians.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|magma}}
|{{MC/Cd|magma}}
|Caused by magma blocks.  
|Caused by magma blocks.  
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|none}}
|{{MC/Cd|none}}
|{{Info needed}}
|{{MC/Info needed}}
|{{Info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|override}}
|{{MC/Cd|override}}
|Override this entity's health value.
|Override this entity's health value.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|piston}}
|{{MC/Cd|piston}}
|Caused by [[Minecraft:piston]]s.
|Caused by [[Minecraft:piston]]s.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|projectile}}
|{{MC/Cd|projectile}}
|Caused by projectiles, such as arrows.
|Caused by projectiles, such as arrows.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|ram_attack}}
|{{MC/Cd|ram_attack}}
|{{Info needed}}
|{{MC/Info needed}}
|{{Info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|self_destruct}}
|{{MC/Cd|self_destruct}}
|Caused by {{cmd|kill}}.  
|Caused by {{MC/Cmd|kill}}.  
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|sonic_boom}}
|{{MC/Cd|sonic_boom}}
|{{Info needed}}
|{{MC/Info needed}}
|{{Info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|soul_campfire}}
|{{MC/Cd|soul_campfire}}
|{{Info needed}}
|{{MC/Info needed}}
|{{Info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|stalactite}}
|{{MC/Cd|stalactite}}
|Caused by stalactites.
|Caused by stalactites.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|stalagmite}}
|{{MC/Cd|stalagmite}}
|Caused by stalagmites.
|Caused by stalagmites.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|starve}}
|{{MC/Cd|starve}}
|Caused by hunger.
|Caused by hunger.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|suffocation}}
|{{MC/Cd|suffocation}}
|Caused by suffocation.  
|Caused by suffocation.  
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|temperature}}
|{{MC/Cd|temperature}}
|Snow golem damaged by biome temperature.
|Snow golem damaged by biome temperature.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|thorns}}
|{{MC/Cd|thorns}}
|Caused by thorns.
|Caused by thorns.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|void}}
|{{MC/Cd|void}}
|Caused by the void.
|Caused by the void.
|{{info needed}}
|{{MC/Info needed}}
|-
|-
|{{cd|wither}}
|{{MC/Cd|wither}}
|Caused by a [[Minecraft:wither]].
|Caused by a [[Minecraft:wither]].
|{{info needed}}
|{{MC/Info needed}}
|}
|}


Line 537: Line 537:
==Arguments==
==Arguments==


{{argument|target|entity|target: target|CommandSelector<Actor>}}
{{MC/Argument|target|entity|target: target|CommandSelector<Actor>}}
: Specifies the entity{{only|java}} or entities{{only|be}} to damage.
: Specifies the entity{{only|java}} or entities{{only|be}} to damage.
: {{arg desc|je=entity|amount=single|type=entities|be=actor}}
: {{MC/Arg desc|je=entity|amount=single|type=entities|be=actor}}


{{el|je|short=1}}: {{argument|amount|float}}
{{MC/El|je|short=1}}: {{MC/Argument|amount|float}}
: Specifies the amount of damage to inflict.
: Specifies the amount of damage to inflict.
: {{arg desc|je=float|min=0.0}}
: {{MC/Arg desc|je=float|min=0.0}}


{{el|be|short=1}}: {{argument|amount: int|int|be=1}}
{{MC/El|be|short=1}}: {{MC/Argument|amount: int|int|be=1}}
: Specifies the amount of damage to inflict.
: Specifies the amount of damage to inflict.
: {{arg desc|be=int}} Should be between 0 and 2147483647 (both inclusive).
: {{MC/Arg desc|be=int}} Should be between 0 and 2147483647 (both inclusive).


{{argument|damageType|resource|cause: DamageCause|enum}}
{{MC/Argument|damageType|resource|cause: DamageCause|enum}}
: Specifies the damage type{{only|java}} or type of damage{{only|be}}. Affects death messages and difficulty scaling, among other things.
: Specifies the damage type{{only|java}} or type of damage{{only|be}}. Affects death messages and difficulty scaling, among other things.
: {{IN|je}}, if not specified, defaults to <code>minecraft:generic</code>.
: {{MC/In|je}}, if not specified, defaults to <code>minecraft:generic</code>.
: {{arg desc|je=resource|registry=minecraft:damage_type}}
: {{MC/Arg desc|je=resource|registry=minecraft:damage_type}}
: For [[Minecraft:Bedrock Edition]], all possible arguments are listed [https://learn.microsoft.com/en-us/minecraft/creator/commands/commands/damage?view=minecraft-bedrock-stable on the official add-on documentation].
: For [[Minecraft:Bedrock Edition]], all possible arguments are listed [https://learn.microsoft.com/en-us/minecraft/creator/commands/commands/damage?view=minecraft-bedrock-stable on the official add-on documentation].


{{el|je|short=1}}: {{argument|location|vec3}}
{{MC/El|je|short=1}}: {{MC/Argument|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).
: 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).
: {{arg desc|je=vec3}}
: {{MC/Arg desc|je=vec3}}


{{argument|entity|entity|damager: target|CommandSelector<Actor>}}
{{MC/Argument|entity|entity|damager: target|CommandSelector<Actor>}}
: Specifies the entity who dealt the damage.
: Specifies the entity who dealt the damage.
: {{arg desc|je=entity|amount=single|type=entities|be=actor}}
: {{MC/Arg desc|je=entity|amount=single|type=entities|be=actor}}


{{el|je|short=1}}: {{argument|cause|entity}}
{{MC/El|je|short=1}}: {{MC/Argument|cause|entity}}
: Specifies the cause of the damage (for example, the skeleton that shot the [[Minecraft:arrow]]).
: Specifies the cause of the damage (for example, the skeleton that shot the [[Minecraft:arrow]]).
: {{arg desc|je=entity|amount=single|type=entities}}
: {{MC/Arg desc|je=entity|amount=single|type=entities}}


==Results==
==Results==
{{Result table}}
{{Result table}}
{{Result table|The arguments are not specified correctly.|unparseable|unparseable}}
{{Result table|The arguments are not specified correctly.|unparseable|unparseable}}
{{Result table|{{cd|amount}} or {{cd|amount: int}} is lower than or equal to 0.|fail|fail}}
{{Result table|{{MC/Cd|amount}} or {{MC/Cd|amount: int}} is lower than or equal to 0.|fail|fail}}
{{Result table|{{cd|amount}} or {{cd|amount: int}} is greater than 0 and the damage is considered not having successfully damaged the entity.||}}
{{Result table|{{MC/Cd|amount}} or {{MC/Cd|amount: int}} is greater than 0 and the damage is considered not having successfully damaged the entity.||}}
{{Result table|{{cd|amount: int}} is greater than 0 and the entity is not a vanilla entity or has no hardcoded damage behavior.{{verify}}{{only|bedrock|short=1}}||}}
{{Result table|{{MC/Cd|amount: int}} is greater than 0 and the entity is not a vanilla entity or has no hardcoded damage behavior.{{MC/Verify}}{{only|bedrock|short=1}}||}}
{{Result table|cmd=/damage ... by ...{{only|java|short=1}} /damage ... entity ...{{only|bedrock|short=1}}|{{cd|source}} or {{cd|damager: target}} targets multiple entities.||}}
{{Result table|cmd=/damage ... by ...{{only|java|short=1}} /damage ... entity ...{{only|bedrock|short=1}}|{{MC/Cd|source}} or {{MC/Cd|damager: target}} targets multiple entities.||}}
{{Result table|cmd=|succeed}}
{{Result table|cmd=|succeed}}
{{Result table}}
{{Result table}}


==Output==
==Output==
{{Output table}}
{{MC/Output table}}
{{Output table|edition=je|On fail|0|0|0}}
{{MC/Output table|edition=je|On fail|0|0|0}}
{{Output table|On success|1|1|1}}
{{MC/Output table|On success|1|1|1}}
{{Output table|edition=be|On fail|0}}
{{MC/Output table|edition=be|On fail|0}}
{{Output table|On success|The number of entities who are considered to have successfully took the damage.}}
{{MC/Output table|On success|The number of entities who are considered to have successfully took the damage.}}
{{Output table}}
{{MC/Output table}}


== Example ==
== Example ==
Line 593: Line 593:
=== ''Java Edition'' ===
=== ''Java Edition'' ===
{{HistoryTable
{{HistoryTable
|{{HistoryLine|java}}
|{{MC/HistoryLine|java}}
|{{HistoryLine||1.19.4|dev=23w06a|Added {{cmd|damage|link=none}}.}}
|{{HistoryLine||1.19.4|dev=23w06a|Added {{MC/Cmd|damage|link=none}}.}}
|{{HistoryLine|||dev=Pre-release 2|Striders and blazes now have a weakness to freezing damage.}}
|{{MC/HistoryLine|||dev=Pre-release 2|Striders and blazes now have a weakness to freezing damage.}}
}}
}}


=== ''Bedrock Edition'' ===
=== ''Bedrock Edition'' ===
{{HistoryTable
{{HistoryTable
|{{HistoryLine|bedrock}}
|{{MC/HistoryLine|bedrock}}
|{{HistoryLine||1.18.10|dev=beta 1.18.10.26|Added {{cmd|damage|link=none}}.}}
|{{HistoryLine||1.18.10|dev=beta 1.18.10.26|Added {{MC/Cmd|damage|link=none}}.}}
|{{HistoryLine||1.20.70|dev=Preview 1.20.70.21|Renamed the <code>suicide</code> damage type to <code>self_destruct</code>.}}
|{{MC/HistoryLine||1.20.70|dev=Preview 1.20.70.21|Renamed the <code>suicide</code> damage type to <code>self_destruct</code>.}}
}}
}}


Line 610: Line 610:


== Navigation ==
== Navigation ==
{{Navbox commands}}
{{MC/Navbox commands}}


de:Befehl/damage
de:Befehl/damage

Latest revision as of 20:09, 9 April 2026

Template:Infobox command Applies a set amount of damage to the specified entities.

Usage

  1. 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,

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

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

  1. REDIRECT Template:EntityLinkTemplate:Only
Damaged with a source entity, the balloon swings.
  1. REDIRECT Template:EntityLink
When damaged, a sleeping bat begins flying.
  1. REDIRECT Template:EntityLink
Controlled by the Ender Dragon's fight system.
  1. REDIRECT Template:EntityLink
Teleports away.
  1. REDIRECT Template:EntityLink
While its spikes are extended, if the damage source is a mob and the cause isn't
  1. REDIRECT Template:Code

Template:Redr,

  1. REDIRECT Template:Code

Template:Redr, or

  1. REDIRECT Template:Code

Template:Redr, it deals thorn damage to the damage source.

  1. REDIRECT Template:EntityLink
Teleports away.
  1. REDIRECT Template:EntityLink
If the damage source is an entity, it spawns ink particles.

Hardcoded behaviors

When

  1. 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
  1. REDIRECT Template:EntityLink
Players in Creative mode are invulnerable by most types of damage excluding generic_kill and out_of_world (refer to damage types)
  1. REDIRECT Template:EntityLinkTemplate:Only
  1. REDIRECT Template:Command

Template:Redr command can always kill the agent. This has the side-effect that

  1. REDIRECT Template:Command

Template:Redr with the cause of

  1. REDIRECT Template:Code

Template:Redr always removes the agent, regardless of whether

  1. REDIRECT Template:Code

Template:Redr is 0 or not.

  1. REDIRECT Template:EntityLink
Applying
  1. REDIRECT Template:Command

Template:Redr command on an armor stand cannot reduce its health value (except for

  1. REDIRECT Template:Code

Template:Redr and

  1. REDIRECT Template:Code

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

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Command

Template:Redr command can always kill the armor stand.

  1. REDIRECT Template:Command

Template:Redr commands with the cause of

  1. REDIRECT Template:Code

Template:Redr,

  1. REDIRECT Template:Code

Template:Redr, or

  1. REDIRECT Template:Code

Template:Redr make the armor stand drop its held items and destroy itself.

Void damage can always kill the armor stand.

  1. REDIRECT Template:Command

Template:Redr commands with the

  1. REDIRECT Template:Code

Template:Redr cause always remove the armor stand.

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

  1. REDIRECT Template:Command

Template:Redr commands with the

  1. REDIRECT Template:Code

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

  1. REDIRECT Template:Code

Template:Redr, and the armor stand is not in a lava or fire block,

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Code

Template:Redr cause.

  1. REDIRECT Template:EntityLinkTemplate:Only
Clicking a balloon isn't considered as hurting it. This has the side-effect that running
  1. REDIRECT Template:Command

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.

  1. REDIRECT Template:Command

Template:Redr can always kill the balloon. This has the side-effect that the damage causes

  1. REDIRECT Template:Code

Template:Redr,

  1. REDIRECT Template:Code

Template:Redr,

  1. REDIRECT Template:Code

Template:Redr,

  1. REDIRECT Template:Code

Template:Redr,

  1. REDIRECT Template:Code

Template:Redr, or

  1. REDIRECT Template:Code

Template:Redr destroy the balloon.

  1. REDIRECT Template:EntityLink
Punching a boat is always considered as hurting it.

Running

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Command

Template:Redr on a boat with the damage source being a player in Creative mode destroys the boat, regardless of whether

  1. REDIRECT Template:Code

Template:Redr is 0 or not.

  1. REDIRECT Template:EntityLinkTemplate:Only
A camera cannot be damaged.

Using

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Command

Template:Redr on a camera with the source being a player removes it.

  1. REDIRECT Template:EntityLink
Hurting an end crystal means making it explode.

Running

  1. REDIRECT Template:Command

Template:Redr on an end crystal makes it explode, regardless of whether

  1. REDIRECT Template:Code

Template:Redr is 0 or not, and is never{{

 #vardefine: verifyedition | 

}}<verify for {{#var:verifyedition}}></verify for {{#var:verifyedition}}>{{

 #vardefine: verifyedition | 

}} considered to have successfully damaged it.

  1. REDIRECT Template:EntityLink
Hardcoded behavior: An ender dragon is immune to arrows when perching, and makes arrows catch fire.
  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Code

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

  1. REDIRECT Template:Code

Template:Redr as a cause, can hurt an ender dragon and can be detected or controlled with behavior packs.

  1. REDIRECT Template:Command

Template:Redr can always kill an ender dragon.

A damage command with the cause of

  1. REDIRECT Template:Code

Template:Redr always kills an ender dragon and is considered successful, regardless of whether

  1. REDIRECT Template:Code

Template:Redr is 0 or not.

  1. REDIRECT Template:EntityLink
Projectiles, except potions, cannot hurt an enderman.

If the cause is

  1. REDIRECT Template:Code

Template:Redr and the source is not a potion entity,

  1. REDIRECT Template:Command

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.

  1. REDIRECT Template:EntityLink
A player cannot damage an experience orb.

Running

  1. REDIRECT Template:Command

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.

  1. REDIRECT Template:EntityLink
Applying
  1. REDIRECT Template:Command

Template:Redr on a falling block is always considered to have successfully damaged it, and cannot be detected or controlled with behavior packs.

Applying

  1. REDIRECT Template:Command

Template:Redr on a falling block with the source being

  1. REDIRECT Template:Code

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

  1. REDIRECT Template:EntityLink
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

  1. REDIRECT Template:Code

Template:Redr is. It cannot be detected or controlled with behavior packs.

  1. REDIRECT Template:EntityLink and
  2. REDIRECT Template:EntityLink
Pushing a painting or a leash knot destroys the entity.

Paintings and lead knots are always destroyed when applying

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Code

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

  1. REDIRECT Template:Command

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.

  1. REDIRECT Template:EntityLink
Punching a minecart is always considered as damaging it.

Running

  1. REDIRECT Template:Command

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.

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Command

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.

  1. REDIRECT Template:EntityLink
  1. REDIRECT Template:Command

Template:Redr with the cause being

  1. REDIRECT Template:Code

Template:Redr and the damage source being an Minecraft:arrow that is on fire or a small fireball, or with the cause being

  1. REDIRECT Template:Code

Template:Redr or

  1. REDIRECT Template:Code

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.

  1. REDIRECT Template:EntityLinkTemplate:Only
NPCs cannot be damaged.

Using

  1. REDIRECT Template:Command

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,

  1. REDIRECT Template:Command

Template:Redr, or world builder can remove it.

If the cause is

  1. REDIRECT Template:Code

Template:Redr or

  1. REDIRECT Template:Code

Template:Redr, or the cause is

  1. REDIRECT Template:Code

Template:Redr and the source is a world builder,

  1. REDIRECT Template:Command

Template:Redr removes the NPC. Otherwise, it does nothing.

  1. REDIRECT Template:EntityLink
Primed TNT cannot be damaged.

Using

  1. REDIRECT Template:Command

Template:Redr on primed TNT is never considered to have successfully damaged it.

  1. REDIRECT Template:Command

Template:Redr can always kill primed TNT.

A damage command with the cause of

  1. REDIRECT Template:Code

Template:Redr always kills the primed TNT, regardless of whether

  1. REDIRECT Template:Code

Template:Redr is 0 or not.

  1. REDIRECT Template:EntityLink
A shulker teleports if it is in lava or fire.

Applying

  1. REDIRECT Template:Command

Template:Redr on a shulker with the cause being

  1. REDIRECT Template:Code

Template:Redr or

  1. REDIRECT Template:Code

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

  1. REDIRECT Template:Command

Template:Redr on a closed shulker with the cause being

  1. REDIRECT Template:Code

Template:Redr cannot damage it. It is considered unsuccessful and cannot be detected or controlled with behavior packs.

  1. REDIRECT Template:EntityLink
A small fireball cannot be hit.

Using

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:EntityLink
A trident cannot be damaged.

Using

  1. REDIRECT Template:Command

Template:Redr on a trident is never considered to have successfully damaged it.

A trident cannot be affected by an explosion.

Using

  1. REDIRECT Template:Command

Template:Redr on a trident with cause being

  1. REDIRECT Template:Code

Template:Redr or

  1. REDIRECT Template:Code

Template:Redr cannot be detected or controlled with behavior packs.

  1. REDIRECT Template:EntityLink
A wither skull cannot be damaged.

Using

  1. REDIRECT Template:Command

Template:Redr on a wither skull is never considered to have successfully damaged it.

A black wither skull cannot be hit.

Using

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:EntityLink
Drowning and falling cannot hurt a wither.

If the cause is

  1. REDIRECT Template:Code

Template:Redr or

  1. REDIRECT Template:Code

Template:Redr,

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Code

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

  1. REDIRECT Template:Code

Template:Redr, and the source is a mob,

  1. REDIRECT Template:Command

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

  1. REDIRECT Template:Code

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,

  1. REDIRECT Template:Command

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,

  1. REDIRECT Template:Command

Template:Redr with the cause being

  1. REDIRECT Template:Code

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


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|}}
  1. 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|}}
  1. 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.
  1. 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|}}
  1. 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

History

Java Edition

Template:HistoryTable

Bedrock Edition

Template:HistoryTable

External links

Navigation

All editions
Removed
Template:El only
Debug
Removed
Template:Els only
Template:El only
Removed
Template:El only
Removed
Template:Els only
Removed
Joke
Related

de:Befehl/damage es:Comandos/damage ja:コマンド/damage ko:명령어/damage pt:Comandos/damage ru:Команды консоли/damage zh:命令/damage