diff --git a/src/entity/Living.php b/src/entity/Living.php index 3c13b7fea..27cf829aa 100644 --- a/src/entity/Living.php +++ b/src/entity/Living.php @@ -503,20 +503,18 @@ abstract class Living extends Entity{ if(mt_rand() / mt_getrandmax() > $this->knockbackResistanceAttr->getValue()){ $f = 1 / $f; - $motion = clone $this->motion; + $motionX = $this->motion->x / 2; + $motionY = $this->motion->y / 2; + $motionZ = $this->motion->z / 2; + $motionX += $x * $f * $base; + $motionY += $base; + $motionZ += $z * $f * $base; - $motion->x /= 2; - $motion->y /= 2; - $motion->z /= 2; - $motion->x += $x * $f * $base; - $motion->y += $base; - $motion->z += $z * $f * $base; - - if($motion->y > $base){ - $motion->y = $base; + if($motionY > $base){ + $motionY = $base; } - $this->setMotion($motion); + $this->setMotion(new Vector3($motionX, $motionY, $motionZ)); } }