Merge branch 'php/7.0' into mcpe-1.2

This commit is contained in:
Dylan K. Taylor
2017-09-03 15:02:41 +01:00
16 changed files with 108 additions and 82 deletions

View File

@ -1739,26 +1739,22 @@ class Level implements ChunkManager, Metadatable{
if($hand->isSolid() === true and $hand->getBoundingBox() !== null){
$entities = $this->getCollidingEntities($hand->getBoundingBox());
$realCount = 0;
foreach($entities as $e){
if($e instanceof Arrow or $e instanceof DroppedItem){
if($e instanceof Arrow or $e instanceof DroppedItem or ($e instanceof Player and $e->isSpectator())){
continue;
}
++$realCount;
return false; //Entity in block
}
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;
return false; //Inside player BB
}
}
}
if($realCount > 0){
return false; //Entity in block
}
}