Player: Remove obsolete maxDiff parameter from canInteract()

This commit is contained in:
Dylan K. Taylor 2017-12-22 20:38:39 +00:00
parent a8bf2191b9
commit a5c3fbdd7a

View File

@ -1743,11 +1743,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* *
* @param Vector3 $pos * @param Vector3 $pos
* @param $maxDistance * @param $maxDistance
* @param float $maxDiff default 0.71 (approximately sqrt(2) / 2, half of the diagonal width of a block)
* *
* @return bool * @return bool
*/ */
public function canInteract(Vector3 $pos, $maxDistance, float $maxDiff = 0.71) : bool{ public function canInteract(Vector3 $pos, $maxDistance) : bool{
$eyePos = $this->getPosition()->add(0, $this->getEyeHeight(), 0); $eyePos = $this->getPosition()->add(0, $this->getEyeHeight(), 0);
if($eyePos->distanceSquared($pos) > $maxDistance ** 2){ if($eyePos->distanceSquared($pos) > $maxDistance ** 2){
return false; return false;
@ -1756,7 +1755,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$dV = $this->getDirectionVector(); $dV = $this->getDirectionVector();
$eyeDot = $dV->dot($eyePos); $eyeDot = $dV->dot($eyePos);
$targetDot = $dV->dot($pos); $targetDot = $dV->dot($pos);
return ($targetDot - $eyeDot) >= -$maxDiff; return ($targetDot - $eyeDot) >= 0;
} }
protected function initHumanData(){ protected function initHumanData(){