指定したエンティティにダメージを与える。
使用法[]
このコマンドは単純にエンティティの体力を変更するわけではなく、エンティティにダメージを与える状況を再現するロジックを直接呼び出す。そのため多くの未定義動作がある。
コマンドによる出力テキスト、結果、戻り値は体力が変更されたかどうかとは関係なく、事実未定義である。
amount: int
は必ずしも実際のダメージの減少量とは一致せず、ワールドの難易度、防具、ステータス効果、エンティティの特性などにより増減する。
ダメージを受けると、エンティティはノックバックや敵対といったダメージを受けた時の反応をする。ダメージの発生源のエンティティも同様で、例えば矢が消滅したりする。
未定義動作は事前の警告なく変更される可能性があり、その場合Add-onやマップが正常に動作しなくなる恐れがあるので、以下の未定義動作の利用は自らの責任で行うこと。
Hardcoded reaction
- Mobs
- Knocked back.
- Get into invulnerable cooldown period.
- etc.
- Balloon
- Damaged with an source entity, the balloon swings.
- Bat
- When damaged, sleeping bat begins flying.
- Ender crystal
- Controlled by dragon fight system.
- Enderman
- Teleports away.
- Guardian
- While its spikes are extended, if the damager is a mob and the cause isn't
magic
,block_explosion
, orprojectile
, it deals thorn damage on the damager. - Horse
- Opens mouth.
- Shulker
- Teleport somewhere.
- Squid
- If source is entity, spawns ink particles.
Hardcoded behaviors
When amount: int
is 0, entities are always considered successfully damaged. If not 0, only entities (except armor stand, npc, camera), boats, painting, leash knot, falling block and minecarts may be recognized as successfully damaged.
Some behaviors are data driven (e.g. ender crystal's explosion, fireball's rebounding). These data driven behaviors have no effect on damage command's output text, result, and return value. Only hardcoded behaviors can affect them.
- Player
- Players in creative mode cannot be damaged.
- [情報提供依頼]
- Agent
- Hardcoded behavior:
/kill
command can always kill the agent.- Side effect: Damage command with the cause of
suicide
always removes the agent, regardless of whetheramount: int
is 0 or not.
- Side effect: Damage command with the cause of
- Armor Stand
- Clicking the armor stand is not considered as hurting it.
- Applying
/damage
command on an armor stand cannot reduce its health value (except forfire
andfire_tick
causes), and is never considered to have damaged it successfully. It also cannot be detected or controlled with behavior packs.
- Applying
- Double-punching an armor stand in Survival mode destroys it.
- Running
/damage
twice within 5 gameticks on an armor stand with the damager being a player in survival mode makes the armor stand drop its held items and destroy itself.
- Running
- Punching an armor stand in creative mode removes it.
- Running
/damage
on an armor stand with the damager being a player in creative mode removes it.
- Running
- Explosions can always destroy the armor stand. The
/kill
command can always kill the armor stand./damage
commands with the cause ofsuicide
,block_explosion
, orentity_explosion
makes the armor stand drop its held items and destroy itself.
- Void damage can always kill the armor stand.
/damage
commands with thevoid
cause always remove the armor stand.
- Armor stands are set on fire when in lava or fire.
/damage
commands with thefire
cause sets the armor stand on fire and reduces its health value by 0.5.
- Armor stands are damaged when on fire.
- If cause is
fire
, and the armor stand is not in a lava or fire block,/damage
commands reduce its health value by 1.0.
- If cause is
- If an arrow hit an armor stand, the armor stand will be destroyed and the arrow will also disappear.
- Running
/damage
commands on an armor stand with the source being an arrow causes the armor stand to be destroyed and the arrow disappeared.
- Running
- If an trident hit an armor stand, the armor stand will be destroyed.
- Running
/damage
commands on an armor stand with the source being a trident causes the armor stand to be destroyed.
- Running
- When a armor stand falls onto the ground, a landing sound is played.
- Broadcasts landing sound when a armor stand is damaged with the
fall
cause.
- Broadcasts landing sound when a armor stand is damaged with the
- Balloon
- Hardcoded behavior: Clicking balloon isn't considered as hurting it.
- Side effect: Running damage command on a balloon cannot reduce its health value, and is never considered to have successfully damaged it.
- Hardcoded behavior: Projectile, fire, lava and magma can always destroy the balloon. kill command can always kill the balloon.
- Side effect: Damage command with the cause of
suicide
,projectile
,fire
,fire_tick
,lava
, ormagma
destroys the balloon.
- Side effect: Damage command with the cause of
- Boat
- Hardcoded behavior: Clicking boat is always considered as hurting it.
- Side effect: Running damage command on a boat is always considered to have successfully damaged it. But it cannot be detected or controlled with behavior packs.
- Hardcoded behavior: Boat uses Structural Integrity to control whether it should break or not, instead of health points. A boat has 40 points of Structural Integrity.
- Damage command changes its Structural Integrity value, instead of its health value.
- Hardcoded behavior: Unknown
- Side effect: Applying damage command on a boat with the damager being an enderpearl, the boat's Structural Integrity is reduced, but isn't destroyed even if Structural Integrity becomes less than 0.
- Hardcoded behavior: Clicking a boat in creative mode means removing it.
- Side effect: Running damage command on a boat with the damager being a player in creative mode can remove the boat, regardless of whether
amount: int
is 0 or not.
- Side effect: Running damage command on a boat with the damager being a player in creative mode can remove the boat, regardless of whether
- End Crystal
- Hardcoded behavior: Hurting an end crystal means make it exploding.
- Side effect: Running damage command on an end crystal makes it exploding, regardless of whether
amount: int
is 0 or not, and is never[要検証] considered to have successfully damaged it.
- Side effect: Running damage command on an end crystal makes it exploding, regardless of whether
- Ender Dragon
- Hardcoded behavior: Ender dragon is immune to arrows when perching, and makes arrows on fire.
- Side effect: Damage command with source being an arrow cannot hurt a perching dragon, but makes the arrow on fire. And isn't considered successfull.
- Hardcoded behavior: Damage command with
suffocation
can't hurt an ender dragon and is considered unsuccessfull. - Hardcoded behavior: Only players can hurt ender dragon.
- Side effect: Only with source being player, or cause being
block_explosion
can hurt it and can be detected or controlled with behavior packs.
- Side effect: Only with source being player, or cause being
- Hardcoded behavior:
/kill
command can always kill the ender dragon.- Side effect: Damage command with the cause of
suicide
always kills the ender dragon and is considered successful, regardless of whetheramount: int
is 0 or not.
- Side effect: Damage command with the cause of
- Enderman
- Hardcoded behavior: Projectiles except potions cannot hurt enderman.
- Side effect: If cause is
projectile
and source is not a potion entity, damage command makes the enderman teleport away without hurt, and it cannot be detected or controlled with behavior packs. Only if the enderman has successfully teleported away, is it considered to have successfully damaged it.
- Side effect: If cause is
- Experience orb
- Hardcoded behavior: Player can't hurt it.
- Side effect: Running damage command on an exp orb can reduce its health value, but is never considered to have successfully damaged it, and cannot be detected or controlled with behavior packs.
- Falling block
- Hardcoded behavior: Unknown
- Undefined behavior: Applying damage command on a falling block that is falling is always considered to have successfully damaged it, and cannot be detected or controlled with behavior packs.
- Undefined behavior: Applying damage command on a falling block with the source being
piston
always destroys it, and drops item of the block that the falling block is in (instead of what block the falling block is).
- Ghast
- Hardcoded behavior: A fireball deals 1000 damage to a ghast if the fireball was rebounded by a player.
- Side effect: Running damage command on a ghast with the damager is a fireball that has been hit by player, deals 1000 damage, regardless of what
amount: int
is. And it cannot be detected or controlled with behavior packs.
- Side effect: Running damage command on a ghast with the damager is a fireball that has been hit by player, deals 1000 damage, regardless of what
- Painting and leash knot
- Hardcoded behavior: Hitting them can destroy them.
- Side effect: Painting and lead knot are always destroyed when applying damage command on them, and drop item if the damager is not a player in creative mode. It is always considered to have successfully damaged it, regardless of whether
amount: int
is 0 or not. But it cannot be detected or controlled with behavior packs.
- Side effect: Painting and lead knot are always destroyed when applying damage command on them, and drop item if the damager is not a player in creative mode. It is always considered to have successfully damaged it, regardless of whether
- Item
- Hardcoded behavior: Player can't hurt it.
- Side effect: Applying damage command on an item can reduce its health value, but is never considered to have successfully damaged it, and cannot be detected or controlled with behavior packs.
- Minecart
- Hardcoded behavior: Clicking minecart is always considered as hurting it.
- Side effect: Running damage command on a minecart is always considered to have successfully damaged it.
- Hardcoded behavior: Minecart uses Structural Integrity to control whether it should break or not, instead health value. A minecart has 5 Structural Integrity.
- Damage command changes its Structural Integrity value, instead of its health value.
- Enderpearl can reduce minecart's Structural Integrity, but cannot make it destroyed.
- Hardcoded behavior: Unknown
- Side effect: Applying damage command on a minecart with the damager being an enderpearl, the minecart's Structural Integrity is reduced, but isn't destroyed even if Structural Integrity becomes less than 0.
- TNT minecart
- Damage command with cause being
projectile
and source being an arrow that is on fire, or a small fire ball, or cause beingfire
orlava
, primes the tnt minecart and is considered successfull. But it is never considered to have successfully damaged it, and cannot be detected or controlled with behavior packs. - Otherwise, it behaviors as minecart.
- NPC
- Hardcoded behavior: NPC cannot be hurt.
- Side effect: Using damage command on an NPC is never considered to have successfully damaged it, and cannot be detected or controlled with behavior packs.
- Hardcoded behavior: only void, kill command, or world builder can remove it.
- Side effect: If the cause being
void
orsuicide
, or the cause beingentity_attack
and the source being a world builder, damage command removes the NPC, otherwise does nothing.
- Side effect: If the cause being
- Primed TNT
- Hardcoded behavior: Tnt cannot be hurt.
- Side effect: Using damage command on a TNT is never considered to have successfully damaged it.
- Hardcoded behavior:
/kill
command can always kill the tnt.- Side effect: Damage command with the cause of
suicide
always kills the tnt, regardless of whetheramount: int
is 0 or not.
- Side effect: Damage command with the cause of
- Skulker
- Hardcoded behavior: Shulker teleports if in lava or fire.
- Side effect: Applying damage command on a shulker with cause being
lava
orfire
can't damage it and makes the shulker teleport away. It is considered unsuccessfull, and cannot be detected or controlled with behavior packs.
- Side effect: Applying damage command on a shulker with cause being
- Hardcoded behavior: Projectile cannot hurt it when it is closed.
- Side effect: Applying damage command on a closed shulker with cause being
projectile
can't damage it. It is considered unsuccessfull, and cannot be detected or controlled with behavior packs.
- Side effect: Applying damage command on a closed shulker with cause being
- Small fireball
- Hardcoded behavior: Small fireball cannot be hit.
- Side effect: Using damage command on a small fireball is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs.
- Trident
- Hardcoded behavior: Trident cannot be hurt.
- Side effect: Using damage command on a trident is never considered to have successfully damaged it.
- Defined behavior: Trident cannot be affected by explosion.
- Side effect: Using damage command on a trident with cause being
block_explosion
orentity_explosion
cannot be detected or controlled with behavior packs.
- Side effect: Using damage command on a trident with cause being
- Camera
- Hardcoded behavior: Camera cannot be hurt.
- Side effect: Using damage command on a camera is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs.
- Hardcoded behavior: Trident cannot be affected by explosion.
- Side effect: Using damage command on a camera with source being a player removes it.
- Wither skull
- Hardcoded behavior: Wither skull cannot be hurt.
- Side effect: Using damage command on a wither skull is never considered to have successfully damaged it.
- Hardcoded behavior: Black wither skull cannot be hit.
- Side effect: Using damage command on a black wither skull is never considered to have successfully damaged it and cannot be detected or controlled with behavior packs.
- Wither
- Hardcoded behavior: Drowning and fall cannot hurt the wither.
- Side effect: If cause is
drowning
orfall
, 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.
- Side effect: If cause is
- Hardcoded behavior: Wither cannot damage another wither.
- Side effect: If cause is not
suicide
and source is a wither, 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.
- Side effect: If cause is not
- Hardcoded behavior:
- Side effect: If the wither is in spawning antimation, cause is
entity_attack
, and source is a mob, damage command makes the source mob knockbacked.
- Side effect: If the wither is in spawning antimation, cause is
- Hardcoded behavior: When spawning, the wither can't be hurt by anything, except void.
- Side effect: If the wither is spawing and source is not
void
, 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.
- Side effect: If the wither is spawing and source is not
- Hardcoded behavior: When dying, the wither can't be hurt.
- Side effect: If the wither is dying, 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.
- Hardcoded behavior: When having "wither armor", wither is immune to arrows.
- Side effect: If the wither is in "wither armor" state, damage command with the cause being
projectile
and the source being an arrow does nothing on the wither. And it is not considered to have successfully damaged it. It cannot be detected or controlled with behavior packs.
- Side effect: If the wither is in "wither armor" state, damage command with the cause being
構文[]
- Java Edition
damage <target> <amount> [<damageType>] [at <location>]
damage <target> <amount> [<damageType>] [at <location>]
- Bedrock Edition
damage <target: target> <amount: int> <cause: DamageCause> entity <damager: target>
damage <target: target> <amount: int> [cause: DamageCause]
引数[]
- JE:
<target>
:エンティティ
BE:target: target
:エンティティ - ダメージを受けるエンティティを指定する。Java Editionでは単体、Bedrock Editionでは複数のエンティティを指定できる。
- プレイヤー名、ターゲットセレクターまたはUUID[Java Edition限定]で指定する。Java Editionでは,ターゲットセレクターは単一のものである必要がある。
- JE:
<damageType>
:名前空間付ID
BE:cause: DamageCause
:文字列(引用符無し) - ダメージの種類を指定する。特に死亡メッセージに関わる。
- 名前空間IDで指定する。
- Bedrock Editionで指定可能な引数の一覧はon the official add-on documentationを参照。
名前 | 説明 | 備考 |
---|---|---|
all
|
任意のダメージ。 | [情報提供依頼] |
anvil
|
落下中の金床によるダメージ。ヘルメットにより軽減される。 | [情報提供依頼] |
block-explosion
|
ブロックの爆発によるダメージ。 | 防具により軽減され、爆発耐性のエンチャントのレベルに応じてさらに軽減される。 |
charging
|
[情報提供依頼] | [情報提供依頼] |
contact
|
サボテンやスイートベリーの低木といったブロックとの接触によるダメージ。 | 防具により軽減され、ダメージ軽減のエンチャントのレベルに応じてさらに軽減される。 |
drowning
|
溺没や降雨によるダメージ。 | [情報提供依頼] |
entity-attack
|
Mobの近接攻撃によるダメージ。 | 防具により軽減され、ダメージ軽減のエンチャントのレベルに応じてさらに軽減される。 |
entity-explosion
|
Mobの爆発によるダメージ。 | 防具により軽減され、爆発耐性のエンチャントのレベルに応じてさらに軽減される。 |
fall
|
高所からの落下やエンダーパールの使用によるダメージ。 | 落下耐性やダメージ軽減のエンチャントが付与された防具により軽減される。Mobによっては落下ダメージを軽減あるいは受けない。 |
falling_block
|
[情報提供依頼] | [情報提供依頼] |
fire
|
炎の中や火のついた焚き火の上にいることによるダメージ。 | [情報提供依頼] |
fire_tick
|
炎上によるダメージ。 | 火炎耐性やダメージ軽減のエンチャントが付与された防具により軽減される。ブレイズ、ガスト、マグマキューブ、ストライダー、ウィザー、ウィザースケルトン、ゾンビピグリンは炎上ダメージを受けない。 |
fireworks
|
ロケット花火によるダメージ。 | [情報提供依頼] |
fly_into_wall
|
エリトラで飛行中にブロックに衝突することによるダメージ。 | [情報提供依頼] |
freezing
|
粉雪の中にいることによるダメージ。 | [情報提供依頼] |
lava
|
溶岩によるダメージ。 | [情報提供依頼] |
lightning
|
稲妻によるダメージ。 | [情報提供依頼] |
magic
|
ポーション、ドラゴンの息、エヴォーカーの牙、ガーディアンによるダメージ。 | [情報提供依頼] |
magma
|
マグマブロックによるダメージ。 | [情報提供依頼] |
override
|
エンティティの体力を上書きする。 | [情報提供依頼] |
piston
|
ピストンによるダメージ。 | [情報提供依頼] |
projectile
|
矢などの発射物によるダメージ。 | [情報提供依頼] |
stalactite
|
落下中の鍾乳石によるダメージ。 | [情報提供依頼] |
stalagmite
|
石筍によるダメージ。 | [情報提供依頼] |
starve
|
飢餓によるダメージ。 | [情報提供依頼] |
suffocation
|
窒息によるダメージ。 | [情報提供依頼] |
suicide
|
/kill によるダメージ。
|
[情報提供依頼] |
temperature
|
スノウゴーレムがバイオームの気温から受けるダメージ。 | [情報提供依頼] |
thorns
|
棘の鎧によるダメージ。 | [情報提供依頼] |
void
|
奈落によるダメージ。 | [情報提供依頼] |
wither
|
衰弱によるダメージ。 | [情報提供依頼] |
- JE:
<location>
:3次元座標・ベクトル - ネザーでのベッドの爆発など、エンティティ以外によるダメージの発生源の座標を指定する。
- 浮動小数点数で構成される3次元座標でなければならない。チルダ・キャレット表記法を使用できる。
- JE:
<entity>
:エンティティ
BE:damager: target
:エンティティ - ダメージの発生源のエンティティを指定する。
- プレイヤー名、ターゲットセレクターまたはUUID[Java Edition限定]で指定する。Java Editionでは,ターゲットセレクターは単一のものである必要がある。
- JE:
<cause>
:エンティティ - 矢を放ったスケルトンなど、ダメージの発生源の原因となるエンティティを指定する。
- プレイヤー名、ターゲットセレクターまたはUUIDで指定する。また、ターゲットセレクターは単一のものである必要がある。
結果[]
コマンド | トリガー | Bedrock Edition |
---|---|---|
任意 | 引数が正しく指定されていない場合 | 構文解析不能 |
amount: int が0未満 | 失敗 | |
選択されたエンティティすべてについて以下の条件を少なくとも1つ満たした場合
| ||
/... entity ... | damager: target が複数の対象に適合した場合 | |
任意 | 成功時 | 対象にダメージを与える。 |
出力[]
コマンド | エディション | 状況 | 成功回数 |
---|---|---|---|
任意 | Bedrock Edition | 失敗時 | 0 |
成功時 | 正常にダメージを受けたエンティティの数 |
例[]
villager_1
という名前の村人から近くのアイアンゴーレムに1のダメージを与える。/damage @e[type=iron_golem] 1 entity_attack entity @e[type=villager, name="villager_1"]
歴史[]
Java Edition | |||||
---|---|---|---|---|---|
1.19.4 | 23w06a | /damage が追加された。 | |||
Bedrock Edition | |||||
1.18.10 | beta 1.18.10.26 | /damage が追加された。 |