當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ChunkManager::updateBlockLight方法代碼示例

本文整理匯總了PHP中pocketmine\level\ChunkManager::updateBlockLight方法的典型用法代碼示例。如果您正苦於以下問題:PHP ChunkManager::updateBlockLight方法的具體用法?PHP ChunkManager::updateBlockLight怎麽用?PHP ChunkManager::updateBlockLight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pocketmine\level\ChunkManager的用法示例。


在下文中一共展示了ChunkManager::updateBlockLight方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: populate

 public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random)
 {
     $this->level = $level;
     $amount = $random->nextRange(0, $this->randomAmount + 1) + $this->baseAmount;
     for ($i = 0; $i < $amount; ++$i) {
         $x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);
         $z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);
         $y = $this->getHighestWorkableBlock($x, $z);
         //echo "Fire to $x, $y, $z\n";
         if ($y !== -1 and $this->canGroundFireStay($x, $y, $z)) {
             $this->level->setBlockIdAt($x, $y, $z, Block::FIRE);
             $this->level->updateBlockLight($x, $y, $z);
         }
     }
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:15,代碼來源:GroundFire.php

示例2: flowIntoBlock

 private function flowIntoBlock($x, $y, $z, $newFlowDecay)
 {
     if ($this->level->getBlockIdAt($x, $y, $z) === Block::AIR) {
         $this->level->setBlockIdAt($x, $y, $z, Block::LAVA);
         $this->level->setBlockDataAt($x, $y, $z, $newFlowDecay);
         $this->level->updateBlockLight($x, $y, $z);
         $this->lavaSpread($x, $y, $z);
     }
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:9,代碼來源:NetherLava.php

示例3: placeObject

 public function placeObject(ChunkManager $level, $x, $y, $z)
 {
     $clusterSize = (int) $this->type->clusterSize;
     $angle = $this->random->nextFloat() * M_PI;
     $offset = VectorMath::getDirection2D($angle)->multiply($clusterSize)->divide(8);
     $x1 = $x + 8 + $offset->x;
     $x2 = $x + 8 - $offset->x;
     $z1 = $z + 8 + $offset->y;
     $z2 = $z + 8 - $offset->y;
     $y1 = $y + $this->random->nextBoundedInt(3) + 2;
     $y2 = $y + $this->random->nextBoundedInt(3) + 2;
     for ($count = 0; $count <= $clusterSize; ++$count) {
         $seedX = $x1 + ($x2 - $x1) * $count / $clusterSize;
         $seedY = $y1 + ($y2 - $y1) * $count / $clusterSize;
         $seedZ = $z1 + ($z2 - $z1) * $count / $clusterSize;
         $size = ((sin($count * (M_PI / $clusterSize)) + 1) * $this->random->nextFloat() * $clusterSize / 16 + 1) / 2;
         $startX = (int) ($seedX - $size);
         $startY = (int) ($seedY - $size);
         $startZ = (int) ($seedZ - $size);
         $endX = (int) ($seedX + $size);
         $endY = (int) ($seedY + $size);
         $endZ = (int) ($seedZ + $size);
         //echo "ORE: $startX, $startY, $startZ,, $endX, $endY, $endZ\n";
         for ($x = $startX; $x <= $endX; ++$x) {
             $sizeX = ($x + 0.5 - $seedX) / $size;
             $sizeX *= $sizeX;
             if ($sizeX < 1) {
                 for ($y = $startY; $y <= $endY; ++$y) {
                     $sizeY = ($y + 0.5 - $seedY) / $size;
                     $sizeY *= $sizeY;
                     if ($y > 0 and $sizeX + $sizeY < 1) {
                         for ($z = $startZ; $z <= $endZ; ++$z) {
                             $sizeZ = ($z + 0.5 - $seedZ) / $size;
                             $sizeZ *= $sizeZ;
                             if ($sizeX + $sizeY + $sizeZ < 1 and $level->getBlockIdAt($x, $y, $z) === 0) {
                                 $level->setBlockIdAt($x, $y, $z, $this->type->material->getId());
                                 if ($this->type->material->getDamage() !== 0) {
                                     $level->setBlockDataAt($x, $y, $z, $this->type->material->getDamage());
                                 }
                                 $level->updateBlockLight($x, $y, $z);
                                 //echo "Placed to $x, $y, $z\n";
                             }
                         }
                     }
                 }
             }
         }
     }
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:49,代碼來源:NetherOreTop.php

示例4: generateBranches

 private function generateBranches(ChunkManager $level, int $x, int $y, int $z, array $groups)
 {
     foreach ($groups as $group) {
         $baseY = $group[1];
         if ($baseY - $y >= $this->totalHeight * 0.2) {
             $base = new Vector3($x, $baseY, $z);
             $branch = new VectorIterator($level, $base, $group[0]);
             while ($branch->valid()) {
                 $branch->next();
                 $pos = $branch->current();
                 $level->setBlockIdAt((int) $pos->x, (int) $pos->y, (int) $pos->z, Block::LOG);
                 $level->updateBlockLight((int) $pos->x, (int) $pos->y, (int) $pos->z);
             }
         }
     }
 }
開發者ID:iTXTech,項目名稱:Genisys,代碼行數:16,代碼來源:BigTree.php


注:本文中的pocketmine\level\ChunkManager::updateBlockLight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。