Minecraft:Commands/damage: Difference between revisions
More actions
imported>Dxsarster m →Hardcoded behaviors: Mistake saying that creative mode is immune to all damage types which is very much not true |
Fix template calls: add MC/ prefix |
||
| (One intermediate revision by the same user not shown) | |||
| Line 9: | Line 9: | ||
== Usage == | == Usage == | ||
{{ | {{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, {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Balloon}}{{only|education|bedrock|short=1}} | ||
| Damaged with a source entity, the balloon swings. | | Damaged with a source entity, the balloon swings. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Bat}} | ||
| When damaged, a sleeping bat begins flying. | | When damaged, a sleeping bat begins flying. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|End Crystal}} | ||
| Controlled by the | | Controlled by the Ender Dragon's fight system. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Enderman}} | ||
| Teleports away. | | Teleports away. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Guardian}} | ||
| While its spikes are extended, if the damage source is a mob and the cause isn't {{ | | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Shulker}} | ||
| Teleports away. | | Teleports away. | ||
|- | |- | ||
| {{ | | {{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 {{ | 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. | 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. | ||
{| class="wikitable sortable" data-description="Hardcoded behavior" | {| class="wikitable sortable" data-description="Hardcoded behavior" | ||
| Line 55: | Line 55: | ||
! Behavior | ! Behavior | ||
|- | |- | ||
| {{ | | {{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 | | 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) | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Agent}}{{only|education|bedrock|short=1}} | ||
| {{ | | {{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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Armor Stand}} | ||
| Applying {{ | | 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 {{ | 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 {{ | 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 {{ | Explosions can always destroy the armor stand. The {{MC/Cmd|kill}} command can always kill the armor stand. | ||
{{ | {{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. | ||
{{ | {{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. | ||
{{ | {{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 {{ | 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 {{ | 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 {{ | 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 {{ | Broadcasts a landing sound when an armor stand is damaged with the {{MC/Cd|fall}} cause. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Balloon}}{{only|education|bedrock|short=1}} | ||
| Clicking a balloon isn't considered as hurting it. This has the side-effect that running {{ | | 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. {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Boat}} | ||
| Punching a boat is always considered as hurting it. | | Punching a boat is always considered as hurting it. | ||
Running {{ | 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 {{ | 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 {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Camera}}{{only|education|bedrock|short=1}} | ||
| A camera cannot be damaged. | | A camera cannot be damaged. | ||
Using {{ | 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 {{ | Using {{MC/Cmd|damage}} on a camera with the source being a player removes it. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|End Crystal}} | ||
| Hurting an end crystal means making it explode. | | Hurting an end crystal means making it explode. | ||
Running {{ | 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. | ||
|- | |- | ||
| {{ | | {{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. | ||
{{ | {{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 {{ | 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 {{ | 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. | ||
{{ | {{MC/Cmd|kill}} can always kill an ender dragon. | ||
A damage command with the cause of {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Enderman}} | ||
| Projectiles, except | | Projectiles, except potions, cannot hurt an enderman. | ||
If the cause is {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Experience Orb}} | ||
| A player cannot damage an experience orb. | | A player cannot damage an experience orb. | ||
Running {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Falling Block}} | ||
| Applying {{ | | 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 {{ | 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). | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Ghast}} | ||
| A | | 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 | 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. | ||
|- | |- | ||
| {{ | | {{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 {{ | 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 {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Minecart}} | ||
| Punching a minecart is always considered as damaging it. | | Punching a minecart is always considered as damaging it. | ||
Running {{ | 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. | ||
{{ | {{MC/Cmd|damage}} changes a minecart's Structural Integrity value instead of its health value. | ||
An | An ender pearl can reduce a minecart's Structural Integrity, but cannot destroy it. | ||
Applying {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Minecart with TNT}} | ||
| {{ | | {{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]]. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|NPC}}{{only|education|bedrock|short=1}} | ||
| NPCs cannot be damaged. | | NPCs cannot be damaged. | ||
Using {{ | 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 | Only the void, {{MC/Cmd|kill}}, or world builder can remove it. | ||
If the cause is {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Primed TNT}} | ||
| Primed TNT cannot be damaged. | | Primed TNT cannot be damaged. | ||
Using {{ | Using {{MC/Cmd|damage}} on primed TNT is never considered to have successfully damaged it. | ||
{{ | {{MC/Cmd|kill}} can always kill primed TNT. | ||
A damage command with the cause of {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Shulker}} | ||
| A shulker teleports if it is in lava or fire. | | A shulker teleports if it is in lava or fire. | ||
Applying {{ | 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 {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Small fireball}} | ||
| A small fireball cannot be hit. | | A small fireball cannot be hit. | ||
Using {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Trident}} | ||
| A trident cannot be damaged. | | A trident cannot be damaged. | ||
Using {{ | 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 {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Wither Skull}} | ||
| A wither skull cannot be damaged. | | A wither skull cannot be damaged. | ||
Using {{ | 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 {{ | 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. | ||
|- | |- | ||
| {{ | | {{MC/Entitylink|Wither}} | ||
| Drowning and falling cannot hurt a wither. | | Drowning and falling cannot hurt a wither. | ||
If the cause is {{ | 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 {{ | 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 {{ | 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 {{ | 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, {{ | 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, {{ | 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 {{ | 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 | ||
|- | |- | ||
|{{ | |{{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. | ||
|- | |- | ||
|{{ | |{{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 | |Reduced damage to targets equipped with armor, with extra reduction per tier of Blast Protection. | ||
|- | |- | ||
|{{ | |{{MC/Cd|campfire}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|charging}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{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 | |Reduced damage to targets equipped with armor, with extra reduction per tier of Protection. | ||
|- | |- | ||
|{{ | |{{MC/Cd|drowning}} | ||
|Caused by drowning or rain. | |Caused by drowning or rain. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{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 | |Reduced damage to targets equipped with armor, with extra reduction per tier of Protection. | ||
|- | |- | ||
|{{ | |{{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 | |Reduced damage to targets equipped with armor, with extra reduction per tier of Blast Protection. | ||
|- | |- | ||
|{{ | |{{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. | ||
|{{ | |{{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. | ||
|- | |- | ||
|{{ | |{{MC/Cd|falling_block}} | ||
|{{ | |{{MC/More info needed}} | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|fire}} | ||
|Caused by standing in [[Minecraft:fire]]. | |Caused by standing in [[Minecraft:fire]]. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|fire_tick}} | ||
|Caused by being on fire. | |Caused by being on fire. | ||
| Reduced damage to targets equipped with | | 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. | ||
|- | |- | ||
|{{ | |{{MC/Cd|fireworks}} | ||
|Caused by a | |Caused by a firework rocket. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{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]]. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|freezing}} | ||
|Caused by standing in | |Caused by standing in powder snow. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|lava}} | ||
|Caused by [[Minecraft:lava]]. | |Caused by [[Minecraft:lava]]. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|lightning}} | ||
|Caused by | |Caused by lightning. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|mace-smash}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|magic}} | ||
|Caused by potions, dragon breath, evocation fangs or guardians. | |Caused by potions, dragon breath, evocation fangs or guardians. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|magma}} | ||
|Caused by | |Caused by magma blocks. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|none}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|override}} | ||
|Override this entity's health value. | |Override this entity's health value. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|piston}} | ||
|Caused by [[Minecraft:piston]]s. | |Caused by [[Minecraft:piston]]s. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|projectile}} | ||
|Caused by | |Caused by projectiles, such as arrows. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|ram_attack}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|self_destruct}} | ||
|Caused by {{ | |Caused by {{MC/Cmd|kill}}. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|sonic_boom}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|soul_campfire}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|{{Info needed}} | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|stalactite}} | ||
|Caused by | |Caused by stalactites. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|stalagmite}} | ||
|Caused by | |Caused by stalagmites. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|starve}} | ||
|Caused by | |Caused by hunger. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|suffocation}} | ||
|Caused by | |Caused by suffocation. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|temperature}} | ||
|Snow golem damaged by biome temperature. | |Snow golem damaged by biome temperature. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|thorns}} | ||
|Caused by | |Caused by thorns. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|void}} | ||
|Caused by the | |Caused by the void. | ||
|{{ | |{{MC/Info needed}} | ||
|- | |- | ||
|{{ | |{{MC/Cd|wither}} | ||
|Caused by a [[Minecraft:wither]]. | |Caused by a [[Minecraft:wither]]. | ||
|{{ | |{{MC/Info needed}} | ||
|} | |} | ||
| Line 537: | Line 537: | ||
==Arguments== | ==Arguments== | ||
{{ | {{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. | ||
: {{ | : {{MC/Arg desc|je=entity|amount=single|type=entities|be=actor}} | ||
{{ | {{MC/El|je|short=1}}: {{MC/Argument|amount|float}} | ||
: Specifies the amount of damage to inflict. | : Specifies the amount of damage to inflict. | ||
: {{ | : {{MC/Arg desc|je=float|min=0.0}} | ||
{{ | {{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. | ||
: {{ | : {{MC/Arg desc|be=int}} Should be between 0 and 2147483647 (both inclusive). | ||
{{ | {{MC/Argument|damageType|resource|cause: DamageCause|enum}} | ||
: Specifies the | : Specifies the damage type{{only|java}} or type of damage{{only|be}}. Affects death messages and difficulty scaling, among other things. | ||
: {{ | : {{MC/In|je}}, if not specified, defaults to <code>minecraft:generic</code>. | ||
: {{ | : {{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]. | ||
{{ | {{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 | : 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). | ||
: {{ | : {{MC/Arg desc|je=vec3}} | ||
{{ | {{MC/Argument|entity|entity|damager: target|CommandSelector<Actor>}} | ||
: Specifies the entity who dealt the damage. | : Specifies the entity who dealt the damage. | ||
: {{ | : {{MC/Arg desc|je=entity|amount=single|type=entities|be=actor}} | ||
{{ | {{MC/El|je|short=1}}: {{MC/Argument|cause|entity}} | ||
: Specifies the cause of the damage (for example, the | : Specifies the cause of the damage (for example, the skeleton that shot the [[Minecraft:arrow]]). | ||
: {{ | : {{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|{{ | {{Result table|{{MC/Cd|amount}} or {{MC/Cd|amount: int}} is lower than or equal to 0.|fail|fail}} | ||
{{Result table|{{ | {{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|{{ | {{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}}|{{ | {{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 {{ | |{{HistoryLine||1.19.4|dev=23w06a|Added {{MC/Cmd|damage|link=none}}.}} | ||
|{{HistoryLine|||dev=Pre-release 2| | |{{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 {{ | |{{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 | |||
es:Comandos/damage | |||
ja:コマンド/damage | |||
ko:명령어/damage | |||
pt:Comandos/damage | |||
ru:Команды консоли/damage | |||
zh:命令/damage | |||
Latest revision as of 20:09, 9 April 2026
Template:Infobox command Applies a set amount of damage to the specified entities.
Usage
- 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,
- 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
- 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. |
|
Damaged with a source entity, the balloon swings. |
|
When damaged, a sleeping bat begins flying. |
|
Controlled by the Ender Dragon's fight system. |
|
Teleports away. |
|
While its spikes are extended, if the damage source is a mob and the cause isn't
Template:Redr, or
Template:Redr, it deals thorn damage to the damage source. |
|
Teleports away. |
|
If the damage source is an entity, it spawns ink particles. |
Hardcoded behaviors
When
- 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 |
|---|---|
|
Players in Creative mode are invulnerable by most types of damage excluding generic_kill and out_of_world (refer to damage types)
|
|
Template:Redr command can always kill the agent. This has the side-effect that
Template:Redr with the cause of
Template:Redr always removes the agent, regardless of whether
Template:Redr is 0 or not. |
|
Applying
Template:Redr command on an armor stand cannot reduce its health value (except for
Template:Redr and
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
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
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
Template:Redr command can always kill the armor stand.
Template:Redr commands with the cause of
Template:Redr, or
Template:Redr make the armor stand drop its held items and destroy itself. Void damage can always kill the armor stand.
Template:Redr commands with the
Template:Redr cause always remove the armor stand. Armor stands are set on fire when in lava or fire.
Template:Redr commands with the
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
Template:Redr, and the armor stand is not in a lava or fire block,
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
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
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
Template:Redr cause. |
|
Clicking a balloon isn't considered as hurting it. This has the side-effect that running
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.
Template:Redr can always kill the balloon. This has the side-effect that the damage causes
Template:Redr, or
Template:Redr destroy the balloon. |
|
Punching a boat is always considered as hurting it.
Running
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
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
Template:Redr on a boat with the damage source being a player in Creative mode destroys the boat, regardless of whether
Template:Redr is 0 or not. |
|
A camera cannot be damaged.
Using
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
Template:Redr on a camera with the source being a player removes it. |
|
Hurting an end crystal means making it explode.
Running
Template:Redr on an end crystal makes it explode, regardless of whether
Template:Redr is 0 or not, and is never{{ #vardefine: verifyedition | }} #vardefine: verifyedition | }} considered to have successfully damaged it. |
|
Hardcoded behavior: An ender dragon is immune to arrows when perching, and makes arrows catch fire.
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
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
Template:Redr as a cause, can hurt an ender dragon and can be detected or controlled with behavior packs.
Template:Redr can always kill an ender dragon. A damage command with the cause of
Template:Redr always kills an ender dragon and is considered successful, regardless of whether
Template:Redr is 0 or not. |
|
Projectiles, except potions, cannot hurt an enderman.
If the cause is
Template:Redr and the source is not a potion entity,
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. |
|
A player cannot damage an experience orb.
Running
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. |
|
Applying
Template:Redr on a falling block is always considered to have successfully damaged it, and cannot be detected or controlled with behavior packs. Applying
Template:Redr on a falling block with the source being
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). |
|
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
Template:Redr is. It cannot be detected or controlled with behavior packs. |
|
Pushing a painting or a leash knot destroys the entity.
Paintings and lead knots are always destroyed when applying
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
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
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. |
|
Punching a minecart is always considered as damaging it.
Running
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.
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
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. |
|
Template:Redr with the cause being
Template:Redr and the damage source being an Minecraft:arrow that is on fire or a small fireball, or with the cause being
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. |
|
NPCs cannot be damaged.
Using
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,
Template:Redr, or world builder can remove it. If the cause is
Template:Redr, or the cause is
Template:Redr and the source is a world builder,
Template:Redr removes the NPC. Otherwise, it does nothing. |
|
Primed TNT cannot be damaged.
Using
Template:Redr on primed TNT is never considered to have successfully damaged it.
Template:Redr can always kill primed TNT. A damage command with the cause of
Template:Redr always kills the primed TNT, regardless of whether
Template:Redr is 0 or not. |
|
A shulker teleports if it is in lava or fire.
Applying
Template:Redr on a shulker with the cause being
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
Template:Redr on a closed shulker with the cause being
Template:Redr cannot damage it. It is considered unsuccessful and cannot be detected or controlled with behavior packs. |
|
A small fireball cannot be hit.
Using
Template:Redr on a small fireball is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs. |
|
A trident cannot be damaged.
Using
Template:Redr on a trident is never considered to have successfully damaged it. A trident cannot be affected by an explosion. Using
Template:Redr on a trident with cause being
Template:Redr cannot be detected or controlled with behavior packs. |
|
A wither skull cannot be damaged.
Using
Template:Redr on a wither skull is never considered to have successfully damaged it. A black wither skull cannot be hit. Using
Template:Redr on a black wither skull is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs. |
|
Drowning and falling cannot hurt a wither.
If the cause is
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
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
Template:Redr, and the source is a mob,
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
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,
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,
Template:Redr with the cause being
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).
| Damage type | Notes |
|---|---|
| arrow | |
| bad_respawn_point | |
| cactus | |
| campfire | |
| cramming | bypasses: • armor • shields • wolf armor |
| dragon_breath | bypasses: • armor • shields |
| drown | bypasses: • armor • shields • wolf armor |
| dry_out | |
| explosion | |
| fall | bypasses: • armor • shields |
| falling_anvil | bypasses: • shields |
| falling_block | |
| falling_stalactite | bypasses: • shields |
| fireball | |
| fly_into_wall | bypasses: • armor • shields |
| freeze | bypasses: • armor • shields • wolf armor |
| generic | bypasses: • armor • shields |
| generic_kill | bypasses: • invulnerability • armor • resistance effect • shields • wolf armor |
| hot_floor | |
| in_fire | |
| in_wall | bypasses: • armor • shields • wolf armor |
| indirect_magic | bypasses: • armor • shields • wolf armor |
| lava | |
| lightning_bolt | |
| magic | bypasses: • armor • shields • wolf armor |
| mob_attack | |
| mob_attack_no_aggro | |
| mob_projectile | |
| on_fire | bypasses: • armor • shields |
| out_of_world | bypasses: • invulnerability • armor • resistance effect • shields • wolf armor |
| outside_border | bypasses: • armor • shields • wolf armor |
| player_attack | |
| player_explosion | |
| sonic_boom | bypasses: • armor • enchantments • shields |
| spit | |
| stalagmite | bypasses: • armor • shields |
| starve | bypasses: • armor • effects (including resistance) • shields • wolf armor |
| sting | |
| sweet_berry_bush | |
| thorns | bypasses: • wolf armor |
| thrown | |
| trident | |
| unattributed_fireball | |
| wind_charge | |
| wither | bypasses: • armor • shields • wolf armor |
| wither_skull |
| Name | Description | Notes |
|---|---|---|
|
Caused by a falling Minecraft:anvil. | Reduced damage to targets wearing a helmet. |
|
Caused by the explosion of a block. | Reduced damage to targets equipped with armor, with extra reduction per tier of Blast Protection. |
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
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. |
|
Caused by drowning or rain. | <more information needed></more information needed>
|
|
Caused by a melee attack from a mob. | Reduced damage to targets equipped with armor, with extra reduction per tier of Protection. |
|
Caused by the explosion of a mob. | Reduced damage to targets equipped with armor, with extra reduction per tier of Blast Protection. |
|
Caused by falling from a higher ground, or teleporting with an ender pearl. | 0
}}Template:HatnoteReduced damage to targets equipped with Feather Falling or Protection armor. Some mobs are immune to or take less fall damage. |
|
|
<more information needed></more information needed>
|
|
Caused by standing in Minecraft:fire. | <more information needed></more information needed>
|
|
Caused by being on fire. | Reduced damage to targets equipped with Fire Protection or Protection. Blazes, ghasts, magma cubes, Minecraft:withers, wither skeletons and zombified piglins are immune to burning. |
|
Caused by a firework rocket. | <more information needed></more information needed>
|
|
Caused by colliding with a block when flying with an Minecraft:elytra. | <more information needed></more information needed>
|
|
Caused by standing in powder snow. | <more information needed></more information needed>
|
|
Caused by Minecraft:lava. | <more information needed></more information needed>
|
|
Caused by lightning. | <more information needed></more information needed>
|
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
Caused by potions, dragon breath, evocation fangs or guardians. | <more information needed></more information needed>
|
|
Caused by magma blocks. | <more information needed></more information needed>
|
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
Override this entity's health value. | <more information needed></more information needed>
|
|
Caused by Minecraft:pistons. | <more information needed></more information needed>
|
|
Caused by projectiles, such as arrows. | <more information needed></more information needed>
|
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
Caused by
|
<more information needed></more information needed>
|
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
<more information needed></more information needed>
|
<more information needed></more information needed>
|
|
Caused by stalactites. | <more information needed></more information needed>
|
|
Caused by stalagmites. | <more information needed></more information needed>
|
|
Caused by hunger. | <more information needed></more information needed>
|
|
Caused by suffocation. | <more information needed></more information needed>
|
|
Snow golem damaged by biome temperature. | <more information needed></more information needed>
|
|
Caused by thorns. | <more information needed></more information needed>
|
|
Caused by the void. | <more information needed></more information needed>
|
|
Caused by a Minecraft:wither. | <more information needed></more information needed>
|
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|}}
- 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|}}
- 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.
- 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|}}
- 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
- Make a villager named
villager_1deal Template:Hp damage to the nearest iron golem:
History
Java Edition
Bedrock Edition
External links
de:Befehl/damage es:Comandos/damage ja:コマンド/damage ko:명령어/damage pt:Comandos/damage ru:Команды консоли/damage zh:命令/damage