Fixed player knockback not working since 531c6344fe6bd920ef2b6639b7ff649cfe8bf11c

player knockback silently depended on the chunk packet broadcast system sending the player's motion back to itself, which broadcasting to hasSpawned will not do.
This commit is contained in:
Dylan K. Taylor 2020-10-08 21:56:08 +01:00
parent 15a2fd6e4f
commit a91710b199

View File

@ -90,6 +90,7 @@ use pocketmine\nbt\tag\ListTag;
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\AnimatePacket;
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
use pocketmine\network\mcpe\protocol\SetActorMotionPacket;
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection;
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataFlags;
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties;
@ -1261,6 +1262,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
public function setMotion(Vector3 $motion) : bool{
if(parent::setMotion($motion)){
$this->broadcastMotion();
$this->networkSession->sendDataPacket(SetActorMotionPacket::create($this->id, $motion));
return true;
}