pocketmine\level\ChunkManager::setBlockIdAt PHP Method

setBlockIdAt() public method

Sets the raw block id.
public setBlockIdAt ( integer $x, integer $y, integer $z, integer $id )
$x integer
$y integer
$z integer
$id integer 0-255
    public function setBlockIdAt(int $x, int $y, int $z, int $id);

Usage Example

Example #1
0
 public function placeObject(ChunkManager $level, $x, $y, $z, Random $random)
 {
     if ($this->leavesBottomY === -1 or $this->leavesMaxRadius === -1) {
         $this->findRandomLeavesSize($random);
     }
     $level->setBlockIdAt($x, $y - 1, $z, Block::DIRT);
     $leavesRadius = 0;
     for ($yy = $this->totalHeight; $yy >= $this->leavesBottomY; --$yy) {
         for ($xx = -$leavesRadius; $xx <= $leavesRadius; ++$xx) {
             for ($zz = -$leavesRadius; $zz <= $leavesRadius; ++$zz) {
                 if (abs($xx) != $leavesRadius or abs($zz) != $leavesRadius or $leavesRadius <= 0) {
                     $level->setBlockIdAt($x + $xx, $y + $yy, $z + $zz, Block::LEAVES);
                     $level->setBlockDataAt($x + $xx, $y + $yy, $z + $zz, $this->type);
                 }
             }
         }
         if ($leavesRadius > 0 and $yy === $y + $this->leavesBottomY + 1) {
             --$leavesRadius;
         } elseif ($leavesRadius < $this->leavesMaxRadius) {
             ++$leavesRadius;
         }
     }
     for ($yy = 0; $yy < $this->totalHeight - 1; ++$yy) {
         $level->setBlockIdAt($x, $y + $yy, $z, Block::TRUNK);
         $level->setBlockDataAt($x, $y + $yy, $z, $this->type);
     }
 }
All Usage Examples Of pocketmine\level\ChunkManager::setBlockIdAt