Class AbstractDamageSource
java.lang.Object
org.spongepowered.api.event.cause.entity.damage.source.common.AbstractDamageSource
- All Implemented Interfaces:
DamageSource
An abstract implementation of
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.spongepowered.api.event.cause.entity.damage.source.DamageSource
DamageSource.Builder, DamageSource.DamageSourceBuilder<T extends DamageSource,B extends DamageSource.DamageSourceBuilder<T, B>>, DamageSource.Factory -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDamageSource(AbstractDamageSourceBuilder<?, ?> builder) -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets whether thisDamageSourceis considered to damage creative, or otherwise "normally unharmable" players.doubleGets the amount of exhaustion thisDamageSourcewill add to the entity, generally only to players.booleanGets whether thisDamageSource's damage is absolute and will ignore potion effects and enchantments.booleanGets whether thisDamageSourcewill deal damage that bypasses any armor.booleanGets whether thisDamageSourceis an explosion.booleanisMagic()Gets whether thisDamageSourceis considered to be magical damage, such as potions, or other sources.booleanGets whether thisDamageSource's damage is scaled byDifficulty.type()Gets theDamageTypeof this source.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.spongepowered.api.event.cause.entity.damage.source.DamageSource
isFire
-
Constructor Details
-
AbstractDamageSource
-
-
Method Details
-
type
Description copied from interface:DamageSourceGets theDamageTypeof this source.- Specified by:
typein interfaceDamageSource- Returns:
- The damage type
-
isAbsolute
public boolean isAbsolute()Description copied from interface:DamageSourceGets whether thisDamageSource's damage is absolute and will ignore potion effects and enchantments.- Specified by:
isAbsolutein interfaceDamageSource- Returns:
- If this damage source deals absolute damage
-
isBypassingArmor
public boolean isBypassingArmor()Description copied from interface:DamageSourceGets whether thisDamageSourcewill deal damage that bypasses any armor.- Specified by:
isBypassingArmorin interfaceDamageSource- Returns:
- True if this damage source bypasses armor
-
isScaledByDifficulty
public boolean isScaledByDifficulty()Description copied from interface:DamageSourceGets whether thisDamageSource's damage is scaled byDifficulty.- Specified by:
isScaledByDifficultyin interfaceDamageSource- Returns:
- True if the damage from this source is scaled
-
isExplosive
public boolean isExplosive()Description copied from interface:DamageSourceGets whether thisDamageSourceis an explosion.- Specified by:
isExplosivein interfaceDamageSource- Returns:
- True if this damage source is an explosion
-
isMagic
public boolean isMagic()Description copied from interface:DamageSourceGets whether thisDamageSourceis considered to be magical damage, such as potions, or other sources.- Specified by:
isMagicin interfaceDamageSource- Returns:
- If this damage is magic based
-
doesAffectCreative
public boolean doesAffectCreative()Description copied from interface:DamageSourceGets whether thisDamageSourceis considered to damage creative, or otherwise "normally unharmable" players. Usually associated withDamageTypes.VOID.- Specified by:
doesAffectCreativein interfaceDamageSource- Returns:
- If this damage should affect creative players
-
exhaustion
public double exhaustion()Description copied from interface:DamageSourceGets the amount of exhaustion thisDamageSourcewill 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.
- Specified by:
exhaustionin interfaceDamageSource- Returns:
- The increase in exhaustion
-