# I need cut a circle map

Discussion in 'Facepalm' started by gistrec, Jun 29, 2017.

1. ### gistrecWitch

Messages:
68
GitHub:
gistrec
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?)

2. ### Thunder33345ModeratorStaff Member

Messages:
2,137
GitHub:
Thunder33345
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

gistrec likes this.
3. ### gistrecWitch

Messages:
68
GitHub:
gistrec
I am trying
I will write the results later

4. ### gistrecWitch

Messages:
68
GitHub:
gistrec
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

5. ### gistrecWitch

Messages:
68
GitHub:
gistrec
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);                }            }        }    } ```