initEntity() protected method

protected initEntity ( )
Example #1
0
 protected function initEntity()
 {
     parent::initEntity();
     $this->setMaxHealth(5);
     $this->setHealth($this->namedtag["Health"]);
     if (isset($this->namedtag->Age)) {
         $this->age = $this->namedtag["Age"];
     }
     if (isset($this->namedtag->PickupDelay)) {
         $this->pickupDelay = $this->namedtag["PickupDelay"];
     }
     if (isset($this->namedtag->Owner)) {
         $this->owner = $this->namedtag["Owner"];
     }
     if (isset($this->namedtag->Thrower)) {
         $this->thrower = $this->namedtag["Thrower"];
     }
     if (!isset($this->namedtag->Item)) {
         $this->close();
         return;
     }
     assert($this->namedtag->Item instanceof CompoundTag);
     $this->item = NBT::getItemHelper($this->namedtag->Item);
     $this->server->getPluginManager()->callEvent(new ItemSpawnEvent($this));
 }
Example #2
0
 protected function initEntity()
 {
     parent::initEntity();
     if (isset($this->namedtag->remove)) {
         //flag check
         $this->kill();
     }
 }
Example #3
0
 public function initEntity()
 {
     if (isset($this->namedtag->Movement)) {
         $this->setMovement($this->namedtag["Movement"]);
     }
     $this->dataProperties[self::DATA_NO_AI] = [self::DATA_TYPE_BYTE, 1];
     Entity::initEntity();
 }
Example #4
0
 public function initEntity()
 {
     parent::initEntity();
     if (isset($this->namedtag->Experience)) {
         $this->experience = $this->namedtag["Experience"];
     } else {
         $this->close();
     }
 }
Example #5
0
 protected function initEntity()
 {
     parent::initEntity();
     $this->setMaxHealth(1);
     $this->setHealth(1);
     if (isset($this->namedtag->Age)) {
         $this->age = $this->namedtag["Age"];
     }
 }
Example #6
0
 protected function initEntity()
 {
     parent::initEntity();
     if (isset($this->namedtag->Fuse)) {
         $this->fuse = $this->namedtag["Fuse"];
     } else {
         $this->fuse = 80;
     }
 }
Example #7
0
 protected function initEntity()
 {
     parent::initEntity();
     if (isset($this->namedtag->HealF)) {
         $this->namedtag->Health = new ShortTag("Health", (int) $this->namedtag["HealF"]);
         unset($this->namedtag->HealF);
     } elseif (!isset($this->namedtag->Health) or !$this->namedtag->Health instanceof ShortTag) {
         $this->namedtag->Health = new ShortTag("Health", $this->getMaxHealth());
     }
     $this->setHealth($this->namedtag["Health"]);
 }
Example #8
0
 protected function initEntity()
 {
     parent::initEntity();
     if (isset($this->namedtag->HealF)) {
         $this->namedtag->Health = new ShortTag("Health", (int) $this->namedtag["HealF"]);
         unset($this->namedtag->HealF);
     } elseif (!isset($this->namedtag->Health) or !$this->namedtag->Health instanceof ShortTag) {
         $this->namedtag->Health = new ShortTag("Health", $this->getMaxHealth());
     }
     if (!isset($this->namedtag->MaxHealth) or !$this->namedtag->MaxHealth instanceof ShortTag) {
         $this->namedtag->MaxHealth = new ShortTag("MaxHealth", $this->getMaxHealth());
     }
     $this->setMaxHealth($this->namedtag["MaxHealth"]);
     $this->setHealth($this->getAttributeMap()->getAttribute(Attribute::HEALTH)->setMaxValue($this->getMaxHealth())->setValue($this->namedtag["Health"]));
 }
Example #9
0
 protected function initEntity()
 {
     parent::initEntity();
     if (isset($this->namedtag->TileID)) {
         $this->blockId = $this->namedtag["TileID"];
     } elseif (isset($this->namedtag->Tile)) {
         $this->blockId = $this->namedtag["Tile"];
         $this->namedtag["TileID"] = new Int("TileID", $this->blockId);
     }
     if (isset($this->namedtag->Data)) {
         $this->damage = $this->namedtag["Data"];
     }
     if ($this->blockId === 0) {
         $this->close();
         return;
     }
     $this->setDataProperty(self::DATA_BLOCK_INFO, self::DATA_TYPE_INT, $this->getBlock() | $this->getDamage() << 8);
 }
Example #10
0
 protected function initEntity()
 {
     parent::initEntity();
     $this->setMaxHealth(5);
     $this->setHealth($this->namedtag["Health"]);
     if (isset($this->namedtag->Age)) {
         $this->age = $this->namedtag["Age"];
     }
     if (isset($this->namedtag->PickupDelay)) {
         $this->pickupDelay = $this->namedtag["PickupDelay"];
     }
     if (isset($this->namedtag->Owner)) {
         $this->owner = $this->namedtag["Owner"];
     }
     if (isset($this->namedtag->Thrower)) {
         $this->thrower = $this->namedtag["Thrower"];
     }
     $this->item = ItemItem::get($this->namedtag->Item["id"], $this->namedtag->Item["Damage"], $this->namedtag->Item["Count"]);
     $this->server->getPluginManager()->callEvent(new ItemSpawnEvent($this));
 }
Example #11
0
 public function initEntity()
 {
     $this->setMaxHealth(1);
     parent::initEntity();
 }
Example #12
0
 public function initEntity()
 {
     parent::initEntity();
 }
Example #13
0
 public function initEntity()
 {
     if (isset($this->namedtag->Movement)) {
         $this->setMovement($this->namedtag["Movement"]);
     }
     $this->dataProperties = [self::DATA_FLAGS => [self::DATA_TYPE_BYTE, 0], self::DATA_AIR => [self::DATA_TYPE_SHORT, 300], self::DATA_NAMETAG => [self::DATA_TYPE_STRING, ""], self::DATA_SHOW_NAMETAG => [self::DATA_TYPE_BYTE, 1], self::DATA_SILENT => [self::DATA_TYPE_BYTE, 0], self::DATA_NO_AI => [self::DATA_TYPE_BYTE, 0]];
     Entity::initEntity();
 }