public interface DamageSource
Cause for damage on the Entity being
damaged. Usually the DamageSource will have different properties
based on the source of damage, such as EntityDamageSources,
BlockDamageSources, and FallingBlockDamageSources.
Almost always, the DamageSource will be the first element in
the Cause of the event. Any additional modifiers that "aid" the
Cause of the event will be listed subsequently.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
DamageSource.Builder |
static interface |
DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>> |
| Modifier and Type | Method and Description |
|---|---|
static DamageSource.Builder |
builder()
Creates a new
builder to build a DamageSource. |
boolean |
doesAffectCreative()
Gets whether this
DamageSource is considered to damage creative, or
otherwise "normally unharmable" players. |
double |
getExhaustion()
Gets the amount of exhaustion this
DamageSource will
add to the entity, generally only to players. |
DamageType |
getType()
Gets the
DamageType of this source. |
boolean |
isAbsolute()
Gets whether this
DamageSource's damage is absolute and
will ignore potion effects and enchantments. |
boolean |
isBypassingArmor()
Gets whether this
DamageSource will deal damage that
bypasses any armor. |
boolean |
isExplosive()
Gets whether this
DamageSource is an explosion. |
boolean |
isMagic()
Gets whether this
DamageSource is considered to be magical
damage, such as potions, or other sources. |
boolean |
isScaledByDifficulty()
Gets whether this
DamageSource's damage is scaled by
Difficulty. |
static DamageSource.Builder builder()
builder to build a DamageSource.DamageType getType()
DamageType of this source.boolean isAbsolute()
DamageSource's damage is absolute and
will ignore potion effects and enchantments.boolean isBypassingArmor()
DamageSource will deal damage that
bypasses any armor.boolean isScaledByDifficulty()
DamageSource's damage is scaled by
Difficulty.boolean isExplosive()
DamageSource is an explosion.boolean isMagic()
DamageSource is considered to be magical
damage, such as potions, or other sources.boolean doesAffectCreative()
DamageSource is considered to damage creative, or
otherwise "normally unharmable" players. Usually associated with
DamageTypes.VOID.double getExhaustion()
DamageSource will
add to the entity, generally only to players.
In vanilla gameplay this is set to 0.1 by default and overridden to 0 if the source is set to be absolute or as overriding armor.