mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Living: fix knockback condition, take 2
onGround doesn't necessarily reflect 0 motion, because something else could change the motion prior to the onGround flag getting updated - for example 2 knockbacks in a row.
This commit is contained in:
parent
76174f1920
commit
0081e30a89
@ -577,14 +577,17 @@ abstract class Living extends Entity implements Damageable{
|
||||
$motion = clone $this->motion;
|
||||
|
||||
$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($this->onGround){
|
||||
$motion->y /= 2;
|
||||
$motion->y += $base;
|
||||
|
||||
if($motion->y > 0.4){ //this is hardcoded in vanilla
|
||||
$motion->y = 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setMotion($motion);
|
||||
|
Loading…
x
Reference in New Issue
Block a user