<?php

namespace bedwars\entity;

use pocketmine\network\protocol\AddEntityPacket;

use pocketmine\event\entity\EntityDamageEvent;

use pocketmine\Player;

use pocketmine\entity\Entity;

class IconBlock extends Entity {
    
    /** 
    * TODO:
    */
    public function attack($damager, EntityDamageEvent $source) {}

	/***
	* @param Player $player
	*/
	public function spawnTo(Player $player) {
        if (isset($this->hasSpawned[$id = $player->getLoaderId()]) or ($player == $this)) {
        	return false;
        }
        
        $this->hasSpawned[$player->getLoaderId()] = $player;
        
        $pk = new AddEntityPacket();
        $pk->type = 66;
        $pk->eid = $this->getId();
        $pk->x = $this->x;
        $pk->y = $this->y;
        $pk->z = $this->z;
        $pk->speedX = 0;
        $pk->speedY = 0;
        $pk->speedZ = 0;
        $pk->yaw = 0;
        $pk->pitch = 0;
        $pk->metadata = array(
            15 => [0, 1],
            23 => [7, -1],
            24 => [0, 0],
            20 => [2, (int) $this->namedtag["ItemMETA"]],
        );
        $player->dataPacket($pk);
    }
}
?>