Implemented Absorption effect

This is a little buggy due to a client-sided bug. https://bugs.mojang.com/browse/MCPE-20520
TODO: add attribute save/restore
This commit is contained in:
Dylan K. Taylor
2017-03-21 13:23:57 +00:00
parent c21768df26
commit 940b20c191
3 changed files with 46 additions and 1 deletions

View File

@ -85,6 +85,14 @@ abstract class Living extends Entity implements Damageable{
$this->attributeMap->getAttribute(Attribute::HEALTH)->setMaxValue($amount);
}
public function getAbsorption() : int{
return (int) $this->attributeMap->getAttribute(Attribute::ABSORPTION)->getValue();
}
public function setAbsorption(int $absorption){
$this->attributeMap->getAttribute(Attribute::ABSORPTION)->setValue($absorption);
}
public function saveNBT(){
parent::saveNBT();
$this->namedtag->Health = new ShortTag("Health", $this->getHealth());