pocketmine\block\TNT::prime PHP Метод

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

public prime ( Player $player = null )
$player pocketmine\Player
    public function prime(Player $player = null)
    {
        $this->meta = 1;
        if ($player != null and $player->isCreative()) {
            $dropItem = false;
        } else {
            $dropItem = true;
        }
        $mot = (new Random())->nextSignedFloat() * M_PI * 2;
        $tnt = Entity::createEntity("PrimedTNT", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new CompoundTag("", ["Pos" => new ListTag("Pos", [new DoubleTag("", $this->x + 0.5), new DoubleTag("", $this->y), new DoubleTag("", $this->z + 0.5)]), "Motion" => new ListTag("Motion", [new DoubleTag("", -sin($mot) * 0.02), new DoubleTag("", 0.2), new DoubleTag("", -cos($mot) * 0.02)]), "Rotation" => new ListTag("Rotation", [new FloatTag("", 0), new FloatTag("", 0)]), "Fuse" => new ByteTag("Fuse", 80)]), $dropItem);
        $tnt->spawnToAll();
        $this->level->addSound(new TNTPrimeSound($this));
    }