mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 04:00:29 +00:00
Entity: added getEyePos()
This commit is contained in:
@@ -1171,6 +1171,10 @@ abstract class Entity extends Location{
|
||||
return $this->eyeHeight;
|
||||
}
|
||||
|
||||
public function getEyePos() : Vector3{
|
||||
return new Vector3($this->x, $this->y + $this->getEyeHeight(), $this->z);
|
||||
}
|
||||
|
||||
public function onCollideWithPlayer(Player $player) : void{
|
||||
|
||||
}
|
||||
|
@@ -96,7 +96,7 @@ class SplashPotion extends Throwable{
|
||||
if(!$this->willLinger()){
|
||||
foreach($this->world->getNearbyEntities($this->boundingBox->expandedCopy(4.125, 2.125, 4.125), $this) as $entity){
|
||||
if($entity instanceof Living and $entity->isAlive()){
|
||||
$distanceSquared = $entity->add(0, $entity->getEyeHeight(), 0)->distanceSquared($this);
|
||||
$distanceSquared = $entity->getEyePos()->distanceSquared($this);
|
||||
if($distanceSquared > 16){ //4 blocks
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user