From 0081e30a896a730f9598353353f6ee258803850e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 23 Jun 2018 14:30:26 +0100 Subject: [PATCH 1/2] 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. --- src/pocketmine/entity/Living.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index 6202e9ee4..bb39d4c5c 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -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); From d3e54db1462a312a9b075a9f761a60c4e48e35c9 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 23 Jun 2018 16:41:21 +0100 Subject: [PATCH 2/2] ExperienceOrb: stop tracking targets if they die while being tracked --- src/pocketmine/entity/object/ExperienceOrb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/entity/object/ExperienceOrb.php b/src/pocketmine/entity/object/ExperienceOrb.php index c73edb414..729f9509c 100644 --- a/src/pocketmine/entity/object/ExperienceOrb.php +++ b/src/pocketmine/entity/object/ExperienceOrb.php @@ -165,7 +165,7 @@ class ExperienceOrb extends Entity{ } $currentTarget = $this->getTargetPlayer(); - if($currentTarget !== null and $currentTarget->distanceSquared($this) > self::MAX_TARGET_DISTANCE ** 2){ + if($currentTarget !== null and (!$currentTarget->isAlive() or $currentTarget->distanceSquared($this) > self::MAX_TARGET_DISTANCE ** 2)){ $currentTarget = null; }