diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 28c32fd5f..fd5bc6e10 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -269,7 +269,7 @@ class Server{ * @return int */ public function getViewDistance(){ - return $this->getConfigInt("view-distance", 8); + return min(11, max($this->getConfigInt("view-distance", 7), 4)); } /** diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index da1991fb3..ebb9b31c8 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -401,8 +401,9 @@ class Level implements ChunkManager, Metadatable{ $x = mt_rand(0, 15); $y = mt_rand(0, 15); $z = mt_rand(0, 15); - if($section->getBlockId($x, $y, $z) !== 0){ - $this->getBlock(new Vector3($X * 16 + $x, $Y * 16 + $y, $Z * 16 + $z))->onUpdate(self::BLOCK_UPDATE_RANDOM); + if(($blockId = $section->getBlockId($x, $y, $z)) !== 0){ + $block = Block::get($blockId, $section->getBlockData($x, $y, $z), new Position($X * 16 + $x, $Y * 16 + $y, $Z * 16 + $z, $this)); + $block->onUpdate(self::BLOCK_UPDATE_RANDOM); } } }