This commit is contained in:
Shoghi Cervantes 2015-06-19 13:42:20 +02:00
parent f7e6246dc2
commit b856e5e909
No known key found for this signature in database
GPG Key ID: 78464DB0A7837F89
2 changed files with 13 additions and 0 deletions

View File

@ -580,6 +580,10 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
return $this->port; 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 * @return bool
*/ */

View File

@ -1637,6 +1637,15 @@ class Level implements ChunkManager, Metadatable{
++$realCount; ++$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){ if($realCount > 0){
return false; //Entity in block return false; //Entity in block
} }