mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
EntityDamageEvent: break API
The general purpose of this is to split up base damage from modifiers. - Added methods getBaseDamage(), setBaseDamage(), getOriginalBaseDamage(), getModifiers(), getOriginalModifiers() - setDamage() renamed to setModifier() and type is now mandatory - getDamage() renamed to getModifier() and type is now mandatory - getOriginalDamage() renamed to getOriginalModifier() and type is now mandatory - Removed MODIFIER_BASE constant - Constructors now accept: float baseDamage, float[] modifiers instead of just float[] modifiers
This commit is contained in:
@ -2506,7 +2506,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
if(!$this->isSprinting() and !$this->isFlying() and $this->fallDistance > 0 and !$this->hasEffect(Effect::BLINDNESS) and !$this->isUnderwater()){
|
||||
$ev->setDamage($ev->getFinalDamage() / 2, EntityDamageEvent::MODIFIER_CRITICAL);
|
||||
$ev->setModifier($ev->getFinalDamage() / 2, EntityDamageEvent::MODIFIER_CRITICAL);
|
||||
}
|
||||
|
||||
$target->attack($ev);
|
||||
@ -2518,7 +2518,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
return true;
|
||||
}
|
||||
|
||||
if($ev->getDamage(EntityDamageEvent::MODIFIER_CRITICAL) > 0){
|
||||
if($ev->getModifier(EntityDamageEvent::MODIFIER_CRITICAL) > 0){
|
||||
$pk = new AnimatePacket();
|
||||
$pk->action = AnimatePacket::ACTION_CRITICAL_HIT;
|
||||
$pk->entityRuntimeId = $target->getId();
|
||||
|
Reference in New Issue
Block a user