Interface DamageSource
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceUtility class to make building aDamageSourceeasier.
- 
Method SummaryModifier and TypeMethodDescriptionstatic DamageSource.Builderbuilder(DamageType damageType) Create a newDamageSource.Builder.Get theEntitythat caused the damage to occur.Get theLocationfrom where the damage originated.Get theDamageType.Get theEntitythat directly caused the damage.floatGet the amount of hunger exhaustion caused by this damage.Get theLocationfrom where the damage originated.booleanGet if this damage is indirect.booleanGets if this source of damage scales with difficulty.
- 
Method Details- 
getDamageTypeGet theDamageType.- Returns:
- the damage type
 
- 
getCausingEntityGet theEntitythat caused the damage to occur.Not to be confused with getDirectEntity(), the causing entity is the entity to which the damage is ultimately attributed if the receiver is killed. If, for example, the receiver was damaged by a projectile, the shooter/thrower would be returned.- Returns:
- an Entity or null
 
- 
getDirectEntityGet theEntitythat directly caused the damage.Not to be confused with getCausingEntity(), the direct entity is the entity that actually inflicted the damage. If, for example, the receiver was damaged by a projectile, the projectile would be returned.- Returns:
- an Entity or null
 
- 
getDamageLocationGet theLocationfrom where the damage originated. This will only be present if an entity did not cause the damage.- Returns:
- the location, or null if none
 
- 
getSourceLocationGet theLocationfrom where the damage originated.This is a convenience method to get the final location of the damage. This method will attempt to return the damage location. If this is null, thecausing entity locationwill be returned. Finally if there is no damage location nor a causing entity, null will be returned.- Returns:
- the source of the location or null.
 
- 
isIndirectboolean isIndirect()Get if this damage is indirect.Damage is considered indirect if getCausingEntity()is not equal togetDirectEntity(). This will be the case, for example, if a skeleton shot an arrow or a player threw a potion.- Returns:
- trueif is indirect,- falseotherwise.
 
- 
getFoodExhaustionfloat getFoodExhaustion()Get the amount of hunger exhaustion caused by this damage.- Returns:
- the amount of hunger exhaustion caused.
 
- 
scalesWithDifficultyboolean scalesWithDifficulty()Gets if this source of damage scales with difficulty.- Returns:
- Trueif scales.
 
- 
builderCreate a newDamageSource.Builder.- Parameters:
- damageType- the- DamageTypeto use
- Returns:
- a DamageSource.Builder
 
 
-