New implementation of sending/setting/getting entity data, added effect saving

This commit is contained in:
Shoghi Cervantes
2015-03-17 00:01:54 +01:00
parent 85c5714cbf
commit 2ae80031f0
12 changed files with 285 additions and 200 deletions

View File

@ -40,6 +40,8 @@ abstract class Projectile extends Entity{
private $hadCollision = false;
protected function initEntity(){
parent::initEntity();
$this->setMaxHealth(1);
$this->setHealth(1);
if(isset($this->namedtag->Age)){
@ -52,17 +54,6 @@ abstract class Projectile extends Entity{
return $entity instanceof Living and !$this->onGround;
}
public function getData(){
$flags = 0;
$flags |= $this->fireTicks > 0 ? 1 : 0;
return [
0 => ["type" => 0, "value" => $flags],
1 => ["type" => 1, "value" => $this->airTicks],
16 => ["type" => 0, "value" => 0] //Is critical
];
}
public function saveNBT(){
parent::saveNBT();
$this->namedtag->Age = new Short("Age", $this->age);