PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
|
Public Member Functions | |
__construct (Entity $entity, private int $cause, float $damage, private array $modifiers=[]) | |
call () | |
canBeReducedByArmor () | |
getAttackCooldown () | |
getBaseDamage () | |
getCause () | |
getEntity () | |
getEventName () | |
getFinalDamage () | |
getModifier (int $type) | |
getModifiers () | |
getOriginalBaseDamage () | |
getOriginalModifier (int $type) | |
getOriginalModifiers () | |
isApplicable (int $type) | |
isCancelled () | |
setAttackCooldown (int $attackCooldown) | |
setBaseDamage (float $damage) | |
setModifier (float $damage, int $type) | |
Static Public Member Functions | |
static | hasHandlers () |
Public Attributes | |
const | CAUSE_BLOCK_EXPLOSION = 9 |
const | CAUSE_CONTACT = 0 |
const | CAUSE_CUSTOM = 14 |
const | CAUSE_DROWNING = 8 |
const | CAUSE_ENTITY_ATTACK = 1 |
const | CAUSE_ENTITY_EXPLOSION = 10 |
const | CAUSE_FALL = 4 |
const | CAUSE_FALLING_BLOCK = 16 |
const | CAUSE_FIRE = 5 |
const | CAUSE_FIRE_TICK = 6 |
const | CAUSE_LAVA = 7 |
const | CAUSE_MAGIC = 13 |
const | CAUSE_PROJECTILE = 2 |
const | CAUSE_STARVATION = 15 |
const | CAUSE_SUFFOCATION = 3 |
const | CAUSE_SUICIDE = 12 |
const | CAUSE_VOID = 11 |
const | MODIFIER_ABSORPTION = 5 |
const | MODIFIER_ARMOR = 1 |
const | MODIFIER_ARMOR_ENCHANTMENTS = 6 |
const | MODIFIER_ARMOR_HELMET = 11 |
const | MODIFIER_CRITICAL = 7 |
const | MODIFIER_PREVIOUS_DAMAGE_COOLDOWN = 10 |
const | MODIFIER_RESISTANCE = 4 |
const | MODIFIER_STRENGTH = 2 |
const | MODIFIER_TOTEM = 8 |
const | MODIFIER_WEAKNESS = 3 |
const | MODIFIER_WEAPON_ENCHANTMENTS = 9 |
Protected Attributes | |
Entity | $entity |
string | $eventName = null |
Called when an entity takes damage. @phpstan-extends EntityEvent<Entity>
Definition at line 36 of file EntityDamageEvent.php.
pocketmine\event\entity\EntityDamageEvent::__construct | ( | Entity | $entity, |
private int | $cause, | ||
float | $damage, | ||
private array | $modifiers = [] ) |
float[] | $modifiers |
Definition at line 79 of file EntityDamageEvent.php.
References pocketmine\event\entity\EntityEvent\$entity.
|
inherited |
pocketmine\event\entity\EntityDamageEvent::canBeReducedByArmor | ( | ) |
Returns whether an entity can use armour points to reduce this type of damage.
Definition at line 154 of file EntityDamageEvent.php.
pocketmine\event\entity\EntityDamageEvent::getAttackCooldown | ( | ) |
Returns the cooldown in ticks before the target entity can be attacked again.
Definition at line 174 of file EntityDamageEvent.php.
pocketmine\event\entity\EntityDamageEvent::getBaseDamage | ( | ) |
Returns the base amount of damage applied, before modifiers.
Definition at line 97 of file EntityDamageEvent.php.
Referenced by pocketmine\entity\Living\applyDamageModifiers().
pocketmine\event\entity\EntityDamageEvent::getCause | ( | ) |
Definition at line 90 of file EntityDamageEvent.php.
|
inherited |
Reimplemented in pocketmine\event\entity\EntityDeathEvent, pocketmine\event\entity\EntityShootBowEvent, pocketmine\event\entity\ItemDespawnEvent, pocketmine\event\entity\ItemSpawnEvent, pocketmine\event\entity\ProjectileHitEvent, pocketmine\event\entity\ProjectileLaunchEvent, and pocketmine\event\player\PlayerDeathEvent.
Definition at line 43 of file EntityEvent.php.
References pocketmine\event\entity\EntityEvent\$entity.
pocketmine\event\entity\EntityDamageEvent::getFinalDamage | ( | ) |
Definition at line 147 of file EntityDamageEvent.php.
pocketmine\event\entity\EntityDamageEvent::getModifier | ( | int | $type | ) |
Definition at line 135 of file EntityDamageEvent.php.
pocketmine\event\entity\EntityDamageEvent::getModifiers | ( | ) |
Definition at line 131 of file EntityDamageEvent.php.
pocketmine\event\entity\EntityDamageEvent::getOriginalBaseDamage | ( | ) |
Returns the original base amount of damage applied, before alterations by plugins.
Definition at line 113 of file EntityDamageEvent.php.
pocketmine\event\entity\EntityDamageEvent::getOriginalModifier | ( | int | $type | ) |
Definition at line 124 of file EntityDamageEvent.php.
pocketmine\event\entity\EntityDamageEvent::getOriginalModifiers | ( | ) |
Definition at line 120 of file EntityDamageEvent.php.
|
staticinherited |
pocketmine\event\entity\EntityDamageEvent::isApplicable | ( | int | $type | ) |
Definition at line 143 of file EntityDamageEvent.php.
|
inherited |
Returns whether this instance of the event is currently cancelled.
If it is cancelled, only downstream handlers that declare @handleCancelled
will be called with this event.
pocketmine\event\entity\EntityDamageEvent::setAttackCooldown | ( | int | $attackCooldown | ) |
Sets the cooldown in ticks before the target entity can be attacked again.
NOTE: This value is not used in non-Living entities
Definition at line 183 of file EntityDamageEvent.php.
pocketmine\event\entity\EntityDamageEvent::setBaseDamage | ( | float | $damage | ) |
Sets the base amount of damage applied, optionally recalculating modifiers.
TODO: add ability to recalculate modifiers when this is set
Definition at line 106 of file EntityDamageEvent.php.
pocketmine\event\entity\EntityDamageEvent::setModifier | ( | float | $damage, |
int | $type ) |
Definition at line 139 of file EntityDamageEvent.php.
|
protectedinherited |
@phpstan-var TEntity
Definition at line 37 of file EntityEvent.php.
Referenced by pocketmine\event\entity\EntityDamageByBlockEvent\__construct(), pocketmine\event\entity\EntityDamageByChildEntityEvent\__construct(), pocketmine\event\entity\EntityDamageByEntityEvent\__construct(), pocketmine\event\entity\EntityDamageEvent\__construct(), pocketmine\event\entity\EntityDeathEvent\__construct(), pocketmine\event\entity\EntityExplodeEvent\__construct(), pocketmine\event\player\PlayerDeathEvent\__construct(), pocketmine\event\entity\EntityDeathEvent\getEntity(), pocketmine\event\entity\EntityEvent\getEntity(), pocketmine\event\entity\EntityShootBowEvent\getEntity(), pocketmine\event\entity\ItemDespawnEvent\getEntity(), pocketmine\event\entity\ItemSpawnEvent\getEntity(), pocketmine\event\entity\ProjectileHitEvent\getEntity(), and pocketmine\event\entity\ProjectileLaunchEvent\getEntity().
|
protectedinherited |
const pocketmine\event\entity\EntityDamageEvent::CAUSE_BLOCK_EXPLOSION = 9 |
Definition at line 60 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_CONTACT = 0 |
Definition at line 51 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_CUSTOM = 14 |
Definition at line 65 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_DROWNING = 8 |
Definition at line 59 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_ENTITY_ATTACK = 1 |
Definition at line 52 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_ENTITY_EXPLOSION = 10 |
Definition at line 61 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_FALL = 4 |
Definition at line 55 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_FALLING_BLOCK = 16 |
Definition at line 67 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_FIRE = 5 |
Definition at line 56 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_FIRE_TICK = 6 |
Definition at line 57 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_LAVA = 7 |
Definition at line 58 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_MAGIC = 13 |
Definition at line 64 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_PROJECTILE = 2 |
Definition at line 53 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_STARVATION = 15 |
Definition at line 66 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_SUFFOCATION = 3 |
Definition at line 54 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_SUICIDE = 12 |
Definition at line 63 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::CAUSE_VOID = 11 |
Definition at line 62 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_ABSORPTION = 5 |
Definition at line 43 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_ARMOR = 1 |
Definition at line 39 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_ARMOR_ENCHANTMENTS = 6 |
Definition at line 44 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_ARMOR_HELMET = 11 |
Definition at line 49 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_CRITICAL = 7 |
Definition at line 45 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_PREVIOUS_DAMAGE_COOLDOWN = 10 |
Definition at line 48 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_RESISTANCE = 4 |
Definition at line 42 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_STRENGTH = 2 |
Definition at line 40 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_TOTEM = 8 |
Definition at line 46 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_WEAKNESS = 3 |
Definition at line 41 of file EntityDamageEvent.php.
const pocketmine\event\entity\EntityDamageEvent::MODIFIER_WEAPON_ENCHANTMENTS = 9 |
Definition at line 47 of file EntityDamageEvent.php.