Living: changed bad parameter name

This commit is contained in:
Dylan K. Taylor 2021-07-22 15:46:08 +01:00
parent e803ca0e06
commit 77138c5c06
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -507,7 +507,7 @@ abstract class Living extends Entity{
$this->broadcastAnimation(new HurtAnimation($this)); $this->broadcastAnimation(new HurtAnimation($this));
} }
public function knockBack(float $x, float $z, float $base = 0.4, ?float $verticalLimit = 0.4) : void{ public function knockBack(float $x, float $z, float $force = 0.4, ?float $verticalLimit = 0.4) : void{
$f = sqrt($x * $x + $z * $z); $f = sqrt($x * $x + $z * $z);
if($f <= 0){ if($f <= 0){
return; return;
@ -518,11 +518,11 @@ abstract class Living extends Entity{
$motionX = $this->motion->x / 2; $motionX = $this->motion->x / 2;
$motionY = $this->motion->y / 2; $motionY = $this->motion->y / 2;
$motionZ = $this->motion->z / 2; $motionZ = $this->motion->z / 2;
$motionX += $x * $f * $base; $motionX += $x * $f * $force;
$motionY += $base; $motionY += $force;
$motionZ += $z * $f * $base; $motionZ += $z * $f * $force;
$verticalLimit ??= $base; $verticalLimit ??= $force;
if($motionY > $verticalLimit){ if($motionY > $verticalLimit){
$motionY = $verticalLimit; $motionY = $verticalLimit;
} }