I have a big map. And I would like to make this map circle. What I need do? I think, that I need create function, witch will delete excess chunks, and after that, I need delete other unnecessary block. Is it true?)
assuming so, you would need the radius of the circle, and remove everything outside of it one problem, anything outside of the circle is infinitely big which can be countered by not actually removing everything, but just from your sight creating a circular strip of void
Now i have this, but chunks don't change :c PHP: public function cuteCircleMap($level) { # Map radius, in block's $radius = 1000; # Chunk count $mapChunks = array('x' => 128, 'y' => 128); # Дальше все будет вычисляться само $spawnPoint = array('x' => $mapChunks['x'] * 8, // Умножаем на 16, делим на 2 'y' => $mapChunks['y'] * 8); for ($chunkX = 0; $chunkX < $mapChunks['x']; $chunkX++) { for ($chunkY = 0; $chunkY < $mapChunks['y']; $chunkY++) { $level->loadChunk($chunkX, $chunkY, false); // Позиция центра чанка $fixedChunkPosition = array('x' => $chunkX * 16 + 8, 'y' => $chunkY * 16 + 8); $distance = sqrt(pow($spawnPoint['x'] - $fixedChunkPosition['x'],2) + pow($spawnPoint['y'] - $fixedChunkPosition['y'],2)); echo("Chunk ".$chunkX .":". $chunkY." distance:".round($distance)." ". "progress:".(round(($chunkY + $chunkX*$mapChunks['x'])*100/($mapChunks['x']*$mapChunks['y'])))."%\n"); if ($distance > $radius) { $newChunk = Chunk::getEmptyChunk($chunkX, $chunkY); $level->setChunk($chunkX, $chunkY, $newChunk); } $level->unloadChunk($chunkX, $chunkY, true); } } } Can I delete chunks? I don't find how can I do this in pmmp :c
SUCCESSFULLY!!! 2048 * 2048 for 30 seconds :3 Yeea PHP: public function cuteCircleMap($level) { # Радиус вырезаемой карты, в блоках $radius = 1024; # Количество чанков $mapChunks = array('x' => 128, 'y' => 128); # Дальше все будет вычисляться само $spawnPoint = array('x' => $mapChunks['x'] * 8, // Умножаем на 16, делим на 2 'y' => $mapChunks['y'] * 8); for ($chunkX = 0; $chunkX < $mapChunks['x']; $chunkX++) { for ($chunkY = 0; $chunkY < $mapChunks['y']; $chunkY++) { // Позиция центра чанка $fixedChunkPosition = array('x' => $chunkX * 16 + 8, 'y' => $chunkY * 16 + 8); $distance = sqrt(pow($spawnPoint['x'] - $fixedChunkPosition['x'],2) + pow($spawnPoint['y'] - $fixedChunkPosition['y'],2)); echo("Chunk ".$chunkX .":". $chunkY." distance:".round($distance)." ". "progress:".(round(($chunkY + $chunkX*$mapChunks['x'])*100/($mapChunks['x']*$mapChunks['y'])))."%\n"); if ($distance - 12 > $radius) { $newChunk = Chunk::getEmptyChunk($chunkX, $chunkY); $newChunk->setGenerated(true); $level->getProvider()->setChunk($chunkX, $chunkY, $newChunk); $level->getProvider()->saveChunk($chunkX, $chunkY); } if (abs($distance - $radius) < 12) { $chunk = $level->getChunk($chunkX, $chunkY); for ($x = $chunkX * 16; $x < $chunkX * 16 + 16; $x++) { for ($y = $chunkY * 16; $y < $chunkY * 16 + 16; $y++) { $distance = sqrt(pow($spawnPoint['x'] - $x,2) + pow($spawnPoint['y'] - $y,2)); if ($distance > $radius) { for ($z = 0; $z < 256; $z++) { $chunk->setBlockId($x - $chunkX * 16, $z, $y - $chunkY * 16, 0); } } } } $level->unloadChunk($chunkX, $chunkY); } } } }
Consider modifying the world generator. That would work better. Just extend the normal generator but override if the chunk is beyond your radius, setting everything as 0:0.