SplashPotion: measure distance from eye height instead of base

this fixes effect durations being off (mostly), closes #2650
there are still some minor differences, but this is closer matching than the previous version.
This commit is contained in:
Dylan K. Taylor 2019-02-03 11:32:47 +00:00
parent 0b7ff6f2e7
commit 791b4d8ef3

View File

@ -85,7 +85,7 @@ class SplashPotion extends Throwable{
if(!$this->willLinger()){
foreach($this->level->getNearbyEntities($this->boundingBox->expandedCopy(4.125, 2.125, 4.125), $this) as $entity){
if($entity instanceof Living and $entity->isAlive()){
$distanceSquared = $entity->distanceSquared($this);
$distanceSquared = $entity->add(0, $entity->getEyeHeight(), 0)->distanceSquared($this);
if($distanceSquared > 16){ //4 blocks
continue;
}