From 50a76633694ed6ddaaa1eb364041c003ad4de441 Mon Sep 17 00:00:00 2001 From: brandon15811 Date: Mon, 13 Jan 2020 21:31:36 -0600 Subject: [PATCH 1/3] Create .sonarcloud.properties --- .sonarcloud.properties | 1 + 1 file changed, 1 insertion(+) create mode 100644 .sonarcloud.properties diff --git a/.sonarcloud.properties b/.sonarcloud.properties new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/.sonarcloud.properties @@ -0,0 +1 @@ + From 07cf4eb7a9804c39b42da35e14c9bc4404bb53c5 Mon Sep 17 00:00:00 2001 From: brandon15811 Date: Mon, 13 Jan 2020 21:46:38 -0600 Subject: [PATCH 2/3] Revert "Create .sonarcloud.properties" This reverts commit 50a76633694ed6ddaaa1eb364041c003ad4de441. --- .sonarcloud.properties | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .sonarcloud.properties diff --git a/.sonarcloud.properties b/.sonarcloud.properties deleted file mode 100644 index 8b1378917..000000000 --- a/.sonarcloud.properties +++ /dev/null @@ -1 +0,0 @@ - From d9bbab54f4608954a8ac0fffa88c2f32c07669f1 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 14 Jan 2020 13:08:18 +0000 Subject: [PATCH 3/3] Entity: fixing position and velocity sync on start/stop movement, closes #3133 the delta for velocity sync is WAYYYYYY too big, but that's a task for another commit. --- src/pocketmine/entity/Entity.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index dca8a8ee8..c46fa9e2a 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1212,15 +1212,19 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ } protected function updateMovement(bool $teleport = false) : void{ - //TODO: hack for client-side AI interference: prevent client sided movement when motion is 0 - $this->setImmobile($this->motion->x == 0 and $this->motion->y == 0 and $this->motion->z == 0); - $diffPosition = ($this->x - $this->lastX) ** 2 + ($this->y - $this->lastY) ** 2 + ($this->z - $this->lastZ) ** 2; $diffRotation = ($this->yaw - $this->lastYaw) ** 2 + ($this->pitch - $this->lastPitch) ** 2; $diffMotion = $this->motion->subtract($this->lastMotion)->lengthSquared(); - if($teleport or $diffPosition > 0.0001 or $diffRotation > 1.0){ + $still = $this->motion->lengthSquared() == 0.0; + $wasStill = $this->lastMotion->lengthSquared() == 0.0; + if($wasStill !== $still){ + //TODO: hack for client-side AI interference: prevent client sided movement when motion is 0 + $this->setImmobile($still); + } + + if($teleport or $diffPosition > 0.0001 or $diffRotation > 1.0 or (!$wasStill and $still)){ $this->lastX = $this->x; $this->lastY = $this->y; $this->lastZ = $this->z; @@ -1231,7 +1235,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ $this->broadcastMovement($teleport); } - if($diffMotion > 0.0025 or ($diffMotion > 0.0001 and $this->motion->lengthSquared() <= 0.0001)){ //0.05 ** 2 + if($diffMotion > 0.0025 or $wasStill !== $still){ //0.05 ** 2 $this->lastMotion = clone $this->motion; $this->broadcastMotion();