Improved Level::getBlock()

This commit is contained in:
Shoghi Cervantes 2014-08-24 14:30:43 +02:00
parent 01ebe74974
commit 4edadd764c
2 changed files with 11 additions and 5 deletions

View File

@ -728,10 +728,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$entity->despawnFrom($this);
}
}
/*$pk = new UnloadChunkPacket();
$pk->chunkX = $X;
$pk->chunkZ = $Z;
$this->dataPacket($pk);*/
unset($this->usedChunks[$index]);
}
}

View File

@ -698,7 +698,16 @@ class Level implements ChunkManager, Metadatable{
$this->getChunkAt($pos->x >> 4, $pos->z >> 4, true)->getBlock($pos->x & 0x0f, $pos->y & 0x7f, $pos->z & 0x0f, $blockId, $meta);
}
return Block::get($blockId, $meta, Position::fromObject(clone $pos, $this));
if($blockId === 0){
$air = new Air();
$air->x = $pos->x;
$air->y = $pos->y;
$air->z = $pos->z;
$air->level = $this;
return $air;
}
return Block::get($blockId, $meta, Position::fromObject($pos, $this));
}
/**