From 731dd8c7dfdd24c2024c12285f2366d2fe5a0ea6 Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Tue, 5 Mar 2024 07:07:08 +0300 Subject: [PATCH] added knockback for players --- src/entity/Entity.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/entity/Entity.php b/src/entity/Entity.php index 78967e1b..6942f240 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -1251,6 +1251,11 @@ class Entity extends Position } // attackedAtYaw = (float)((Math.atan2($d1, $d) * 180D) / 3.1415927410125732D) > $this->knockBack($d, $d1); + if($this->isPlayer()){ + $pk = new SetEntityMotionPacket(); + $pk->entities = [[0, $this->speedX, $this->speedY, $this->speedZ]]; + $this->player->directDataPacket($pk, 0); + } $this->knockbackTime = 10; $this->sendMotion();