mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-07 10:31:51 +00:00
Fixed squid health attribute errors
This commit is contained in:
parent
a356e36340
commit
e7406ba096
@ -339,6 +339,7 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
$this->invulnerable = $this->namedtag["Invulnerable"] > 0 ? true : false;
|
$this->invulnerable = $this->namedtag["Invulnerable"] > 0 ? true : false;
|
||||||
|
|
||||||
$this->attributeMap = new AttributeMap();
|
$this->attributeMap = new AttributeMap();
|
||||||
|
$this->addAttributes();
|
||||||
|
|
||||||
$this->chunk->addEntity($this);
|
$this->chunk->addEntity($this);
|
||||||
$this->level->addEntity($this);
|
$this->level->addEntity($this);
|
||||||
@ -642,8 +643,6 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
|
|
||||||
$this->scheduleUpdate();
|
$this->scheduleUpdate();
|
||||||
|
|
||||||
$this->addAttributes();
|
|
||||||
|
|
||||||
if(isset($this->namedtag->ActiveEffects)){
|
if(isset($this->namedtag->ActiveEffects)){
|
||||||
foreach($this->namedtag->ActiveEffects->getValue() as $e){
|
foreach($this->namedtag->ActiveEffects->getValue() as $e){
|
||||||
$amplifier = $e["Amplifier"] & 0xff; //0-255 only
|
$amplifier = $e["Amplifier"] & 0xff; //0-255 only
|
||||||
|
@ -68,7 +68,7 @@ abstract class Living extends Entity implements Damageable{
|
|||||||
public function setHealth($amount){
|
public function setHealth($amount){
|
||||||
$wasAlive = $this->isAlive();
|
$wasAlive = $this->isAlive();
|
||||||
parent::setHealth($amount);
|
parent::setHealth($amount);
|
||||||
$this->attributeMap->getAttribute(Attribute::HEALTH)->setValue($this->getHealth());
|
$this->attributeMap->getAttribute(Attribute::HEALTH)->setValue($this->getHealth(), true);
|
||||||
if($this->isAlive() and !$wasAlive){
|
if($this->isAlive() and !$wasAlive){
|
||||||
$pk = new EntityEventPacket();
|
$pk = new EntityEventPacket();
|
||||||
$pk->eid = $this->getId();
|
$pk->eid = $this->getId();
|
||||||
|
@ -43,8 +43,8 @@ class Squid extends WaterAnimal implements Ageable{
|
|||||||
private $switchDirectionTicker = 0;
|
private $switchDirectionTicker = 0;
|
||||||
|
|
||||||
public function initEntity(){
|
public function initEntity(){
|
||||||
|
$this->setMaxHealth(10);
|
||||||
parent::initEntity();
|
parent::initEntity();
|
||||||
$this->setMaxHealth(5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user