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, waitbuilderprotected AbstractDamageSource(AbstractDamageSourceBuilder<?,?> builder)
public DamageType getType()
DamageSourceDamageType of this source.getType in interface DamageSourcepublic boolean isAbsolute()
DamageSourceDamageSource's damage is absolute and
will ignore potion effects and enchantments.isAbsolute in interface DamageSourcepublic boolean isBypassingArmor()
DamageSourceDamageSource will deal damage that
bypasses any armor.isBypassingArmor in interface DamageSourcepublic boolean isScaledByDifficulty()
DamageSourceDamageSource's damage is scaled by
Difficulty.isScaledByDifficulty in interface DamageSourcepublic boolean isExplosive()
DamageSourceDamageSource is an explosion.isExplosive in interface DamageSourcepublic boolean isMagic()
DamageSourceDamageSource is considered to be magical
damage, such as potions, or other sources.isMagic in interface DamageSourcepublic boolean doesAffectCreative()
DamageSourceDamageSource is considered to damage creative, or
otherwise "normally unharmable" players. Usually associated with
DamageTypes.VOID.doesAffectCreative in interface DamageSourcepublic double getExhaustion()
DamageSourceDamageSource 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