pocketmine\entity\Arrow::__construct PHP Метод

__construct() публичный Метод

public __construct ( pocketmine\level\format\FullChunk $chunk, CompoundTag $nbt, Entity $shootingEntity = null, $critical = false )
$chunk pocketmine\level\format\FullChunk
$nbt pocketmine\nbt\tag\CompoundTag
$shootingEntity Entity
    public function __construct(FullChunk $chunk, CompoundTag $nbt, Entity $shootingEntity = null, $critical = false)
    {
        $this->isCritical = (bool) $critical;
        if (!isset($nbt->Potion)) {
            $nbt->Potion = new ShortTag("Potion", 0);
        }
        parent::__construct($chunk, $nbt, $shootingEntity);
        $this->potionId = $this->namedtag["Potion"];
    }

Usage Example

Пример #1
0
 public function __construct(FullChunk $chunk, Compound $nbt, $r = 255, $g = 255, $b = 255, Entity $shootingEntity = null, $critical = false)
 {
     parent::__construct($chunk, $nbt, $shootingEntity, $critical);
     if (!isset($this->namedtag["r"])) {
         $this->namedtag["r"] = new Int("r", $r);
     }
     if (!isset($this->namedtag["g"])) {
         $this->namedtag["g"] = new Int("g", $g);
     }
     if (!isset($this->namedtag["b"])) {
         $this->namedtag["b"] = new Int("b", $b);
     }
 }