mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Improved Absorption, now only applies to living entities, now controllable by plugins
This commit is contained in:
@ -892,21 +892,7 @@ abstract class Entity extends Location implements Metadatable{
|
||||
|
||||
$this->setLastDamageCause($source);
|
||||
|
||||
$damage = $source->getFinalDamage();
|
||||
|
||||
$absorption = $this->getAbsorption();
|
||||
if($absorption > 0){
|
||||
if($absorption > $damage){
|
||||
//Use absorption health before normal health.
|
||||
$this->setAbsorption($absorption - $damage);
|
||||
$damage = 0;
|
||||
}else{
|
||||
$this->setAbsorption(0);
|
||||
$damage -= $absorption;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setHealth($this->getHealth() - $damage);
|
||||
$this->setHealth($this->getHealth() - $source->getFinalDamage());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -953,14 +939,6 @@ abstract class Entity extends Location implements Metadatable{
|
||||
}
|
||||
}
|
||||
|
||||
public function getAbsorption() : float{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function setAbsorption(float $absorption){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EntityDamageEvent $type
|
||||
*/
|
||||
|
Reference in New Issue
Block a user