public abstract class AbstractDamageSource extends Object implements DamageSource
DamageSource
to allow plugins to create
their own damage sources without having to implement all the required
methods.
Note that extending this class at the least is a requirement for custom damage sources as not doing so will simply not work.
DamageSource.Builder, DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T,B>>
Modifier | Constructor and Description |
---|---|
protected |
AbstractDamageSource(AbstractDamageSourceBuilder<?,?> builder) |
Modifier and Type | Method and Description |
---|---|
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 . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
builder
protected AbstractDamageSource(AbstractDamageSourceBuilder<?,?> builder)
public DamageType getType()
DamageSource
DamageType
of this source.getType
in interface DamageSource
public boolean isAbsolute()
DamageSource
DamageSource
's damage is absolute and
will ignore potion effects and enchantments.isAbsolute
in interface DamageSource
public boolean isBypassingArmor()
DamageSource
DamageSource
will deal damage that
bypasses any armor.isBypassingArmor
in interface DamageSource
public boolean isScaledByDifficulty()
DamageSource
DamageSource
's damage is scaled by
Difficulty
.isScaledByDifficulty
in interface DamageSource
public boolean isExplosive()
DamageSource
DamageSource
is an explosion.isExplosive
in interface DamageSource
public boolean isMagic()
DamageSource
DamageSource
is considered to be magical
damage, such as potions, or other sources.isMagic
in interface DamageSource
public boolean doesAffectCreative()
DamageSource
DamageSource
is considered to damage creative, or
otherwise "normally unharmable" players. Usually associated with
DamageTypes.VOID
.doesAffectCreative
in interface DamageSource
public double getExhaustion()
DamageSource
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.
getExhaustion
in interface DamageSource