DamageSource
Importing the class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
Methods
canBypassCreative
Checks if the damage can bypass creative mode.
Return Type: boolean
getDamageLocation
Gets the location where the damage occurred.
Return Type: MCVector3d?
getDamageType
Gets the type of damage.
Return Type: string
getHungerDamage
Gets the amount of exhaustion to add to the player's hunger bar if they get hit by this damage.
Return Type: float
getImmediateSource
Gets the immediate source of the damage, like an arrow.
Return Type: MCEntity
getTrueSource
Gets the true source of the damage, like the player who shot the arrow.
Return Type: MCEntity
isAbsoluteDamage
Checks if the damage is absolute.
Return Type: boolean
isCreativePlayer
Gets whether the damage was inflicted by a creative player.
Return Type: boolean
isDifficultyScaled
Gets whether the damage changes strength based on the current difficulty.
Return Type: boolean
isExplosionDamage
Checks if the damage is caused by an explosion.
Return Type: boolean
isFireDamage
Checks if the damage is caused by fire or burning.
Return Type: boolean
isMagicDamage
Checks if the damage is caused by magic.
Return Type: boolean
isProjectileDamage
Checks if the damage is caused by a projectile.
Return Type: boolean
isUnblockableDamage
Checks if the damage can be blocked.
Return Type: boolean