Mostly phase out EmptySubChunk

copy-on-write and zero-layer SubChunk objects are much easier to manage and have less cognitive overhead.

obviously, the goal is to get rid of EmptySubChunk completely, but right now it does still serve a purpose (filling in dummy values for reading out-of-bounds on chunks), and that's a problem that takes a little more work to fix.
This commit is contained in:
Dylan K. Taylor
2019-10-22 21:40:13 +01:00
parent b7d1d11eb4
commit 02ff8d671b
10 changed files with 58 additions and 68 deletions

View File

@@ -64,7 +64,6 @@ use pocketmine\utils\Limits;
use pocketmine\utils\ReversePriorityQueue;
use pocketmine\world\biome\Biome;
use pocketmine\world\format\Chunk;
use pocketmine\world\format\EmptySubChunk;
use pocketmine\world\format\io\exception\CorruptedChunkException;
use pocketmine\world\format\io\WritableWorldProvider;
use pocketmine\world\generator\Generator;
@@ -983,7 +982,7 @@ class World implements ChunkManager{
foreach($chunk->getSubChunks() as $Y => $subChunk){
if(!($subChunk instanceof EmptySubChunk)){
if(!$subChunk->isEmptyFast()){
$k = mt_rand(0, 0xfffffffff); //36 bits
for($i = 0; $i < 3; ++$i){
$x = $k & 0x0f;