-
-
Save legoboy0215/39990e8eb0f5d27a2c90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$world = $this->getServer()->getDefaultLevel(); | |
$radius = 136; | |
$total = (($radius * 2) + 1) ** 2; | |
$count = 0; | |
$bList = clone \pocketmine\block\Block::$list; | |
$search = []; | |
$replace = []; | |
for($i = 0; $i < 256; ++$i){ | |
if($bList[$i] === null){ | |
$search[] = chr($i); | |
$replace[] = "\x00"; | |
} | |
} | |
$reflection = new \ReflectionClass(\pocketmine\level\format\generic\BaseFullChunk::class); | |
$blocks = $reflection->getProperty("blocks"); | |
$blocks->setAccessible(true); | |
for($chunkX = -$radius; $chunkX <= $radius; ++$chunkX){ | |
for($chunkZ = -$radius; $chunkZ <= $radius; ++$chunkZ){ | |
$chunk = $world->getChunk($chunkX, $chunkZ, false); | |
if($chunk !== null){ | |
$blocks->setValue($chunk, str_replace($search, $replace, $chunk->getBlockIdArray())); | |
$chunk->setChanged(); | |
$world->setChunk($chunkX, $chunkZ, $chunk, false); | |
$world->saveChunks(); | |
} | |
$world->unloadChunk($chunkX, $chunkZ, false); | |
++$count; | |
} | |
echo "[".round(($count/$total) * 100, 0)."%] $count/$total\n"; | |
} | |
$world->save(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment