Skip to content

MeleeWeaponEnchantment ​

abstract class · pocketmine\item\enchantment\MeleeWeaponEnchantment · source

Extends Enchantment

Classes extending this class can be applied to weapons and activate when used by a mob to attack another mob in melee combat.

Methods ​

getDamageBonus() ​

php
abstract public function getDamageBonus(int $enchantmentLevel) : float

Returns the amount of additional damage caused by this enchantment to applicable targets.

isApplicableTo() ​

php
abstract public function isApplicableTo(\pocketmine\entity\Entity $victim) : bool

Returns whether this melee enchantment has an effect on the target entity. For example, Smite only applies to undead mobs.

onPostAttack() ​

php
public function onPostAttack(\pocketmine\entity\Entity $attacker, \pocketmine\entity\Entity $victim, int $enchantmentLevel) : void

Called after damaging the entity to apply any post damage effects to the target.

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