Improved Absorption, now only applies to living entities, now controllable by plugins

This commit is contained in:
Dylan K. Taylor
2017-04-30 19:29:10 +01:00
parent aa9fd1b4f9
commit cb7911ee9c
3 changed files with 7 additions and 24 deletions

View File

@ -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
*/