From 4edadd764c9ca15b79c48e25ab8edc1924afd752 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sun, 24 Aug 2014 14:30:43 +0200 Subject: [PATCH] Improved Level::getBlock() --- src/pocketmine/Player.php | 5 +---- src/pocketmine/level/Level.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index c1d7d4234..4b9c88ca4 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -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]); } } diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 6b37c2eeb..941602d72 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -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)); } /**