EntityDamageByEntityEvent
Extends EntityDamageEvent
Called when an entity takes damage from another entity.
Methods
__construct()
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
protected function addAttackerModifiers(\pocketmine\entity\Entity $damager) : voidgetArmorEffectivenessReduction() 5.46.0
public function getArmorEffectivenessReduction() : floatReturns 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()
public function getDamager() : ?\pocketmine\entity\EntityReturns the attacking entity, or null if the attacker has been killed or closed.
getKnockBack()
public function getKnockBack() : floatReturns the force with which the victim will be knocked back from the attacking entity.
getVerticalKnockBackLimit()
public function getVerticalKnockBackLimit() : floatReturns 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
public function setArmorEffectivenessReduction(float $reduction) : voidsetKnockBack()
public function setKnockBack(float $knockBack) : voidSets 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()
public function setVerticalKnockBackLimit(float $verticalKnockBackLimit) : voidSets 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.
