diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index eb6d12014..1feafad18 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -580,6 +580,10 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade return $this->port; } + public function getNextPosition(){ + return $this->newPosition !== null ? new Position($this->newPosition->x, $this->newPosition->y, $this->newPosition->z, $this->level) : $this->getPosition(); + } + /** * @return bool */ diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index bc236432e..441d664ef 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1637,6 +1637,15 @@ class Level implements ChunkManager, Metadatable{ ++$realCount; } + if($player !== null){ + if(($diff = $player->getNextPosition()->subtract($player->getPosition())) and $diff->lengthSquared() > 0.00001){ + $bb = $player->getBoundingBox()->getOffsetBoundingBox($diff->x, $diff->y, $diff->z); + if($hand->getBoundingBox()->intersectsWith($bb)){ + ++$realCount; + } + } + } + if($realCount > 0){ return false; //Entity in block }