Skip to content

EntityDamageByEntityEvent ​

class · pocketmine\event\entity\EntityDamageByEntityEvent · source

Extends EntityDamageEvent

Called when an entity takes damage from another entity.

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Entity $damager, \pocketmine\entity\Entity $entity, int $cause, float $damage, array $modifiers = [], float $knockBack = \pocketmine\entity\Living::DEFAULT_KNOCKBACK_FORCE, float $verticalKnockBackLimit = \pocketmine\entity\Living::DEFAULT_KNOCKBACK_VERTICAL_LIMIT)

addAttackerModifiers() protected ​

php
protected function addAttackerModifiers(\pocketmine\entity\Entity $damager) : void

getArmorEffectivenessReduction() 5.46.0 ​

php
public function getArmorEffectivenessReduction() : float

Returns the fraction of armor effectiveness the victim loses against this attack, e.g. 0.15 per level of Breach: armor that would reduce damage by 50% only reduces it by 35% against Breach I.

getDamager() ​

php
public function getDamager() : ?\pocketmine\entity\Entity

Returns the attacking entity, or null if the attacker has been killed or closed.

getKnockBack() ​

php
public function getKnockBack() : float

Returns the force with which the victim will be knocked back from the attacking entity.

getVerticalKnockBackLimit() ​

php
public function getVerticalKnockBackLimit() : float

Returns the maximum upwards velocity the victim may have after being knocked back. This ensures that the victim doesn't fly up into the sky when high levels of knockback are applied.

setArmorEffectivenessReduction() 5.46.0 ​

php
public function setArmorEffectivenessReduction(float $reduction) : void

setKnockBack() ​

php
public function setKnockBack(float $knockBack) : void

Sets the force with which the victim will be knocked back from the attacking entity. Larger values will knock the victim back further. Negative values will pull the victim towards the attacker.

setVerticalKnockBackLimit() ​

php
public function setVerticalKnockBackLimit(float $verticalKnockBackLimit) : void

Sets the maximum upwards velocity the victim may have after being knocked back. Larger values will allow the victim to fly higher if the knockback force is also large.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.