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 updateBlock2(Block $block, Level $level, $blockType)
 {
     $players = $level->getPlayers();
     foreach ($players as $p) {
         $pk = new UpdateBlockPacket();
         $pk->x = $block->getX();
         $pk->y = $block->getY();
         $pk->z = $block->getZ();
         $pk->block = $blockType;
         $pk->meta = 0;
         $p->dataPacket($pk);
         $level->setBlockIdAt($block->getX(), $block->getY(), $block->getZ(), $blockType);
         $pos = new Position($block->x, $block->y, $block->z);
         $block = $level->getBlock($pos, true);
         $direct = true;
         $update = true;
         $level->setBlock($pos, $block, $direct, $update);
     }
 }
Example #2
0
 public function fdx($x, $y, $z, Level $level, $liu = false)
 {
     //$this->getLogger()->info(TextFormat::GREEN."fdx!");
     for ($i = 1; $i < mt_rand(2, 4); $i++) {
         $level->setBlockIdAt($x + $i - 2, $y - 1, $z + 1, 0);
         $level->setBlockIdAt($x + $i - 2, $y - 1, $z, 0);
         $level->setBlockIdAt($x + $i - 2, $y - 1, $z - 1, 0);
         $level->setBlockIdAt($x + $i - 2, $y - 1, $z - 1, 0);
         $level->setBlockIdAt($x + $i - 2, $y - 1, $z + 1, 0);
         $level->setBlockIdAt($x + $i - 2, $y + 2, $z + 1, 0);
         $level->setBlockIdAt($x + $i - 2, $y + 2, $z, 0);
         $level->setBlockIdAt($x + $i - 2, $y + 2, $z - 1, 0);
     }
     for ($i = 1; $i < mt_rand(3, 6); $i++) {
         $level->setBlockIdAt($x + $i - 3, $y + 1, $z + 2, 0);
         $level->setBlockIdAt($x + $i - 3, $y + 1, $z + 1, 0);
         $level->setBlockIdAt($x + $i - 3, $y + 1, $z, 0);
         $level->setBlockIdAt($x + $i - 3, $y + 1, $z - 1, 0);
         $level->setBlockIdAt($x + $i - 3, $y + 1, $z - 2, 0);
         $level->setBlockIdAt($x + $i - 3, $y, $z + 2, 0);
         $level->setBlockIdAt($x + $i - 3, $y, $z + 1, 0);
         $level->setBlockIdAt($x + $i - 3, $y, $z, 0);
         $level->setBlockIdAt($x + $i - 3, $y, $z - 1, 0);
         $level->setBlockIdAt($x + $i - 3, $y, $z - 2, 0);
     }
     if ($liu) {
         $l = mt_rand(0, 1) == 0 ? new Water() : new Lava();
         $i = mt_rand(3, 6);
         $level->setBlock(new Vector3($x + $i - 3, $y + 1, $z + 3), $l);
     }
 }