|
51 | 51 | use pocketmine\nbt\tag\Short; |
52 | 52 | use pocketmine\nbt\tag\String; |
53 | 53 | use pocketmine\Network; |
54 | | -use pocketmine\network\protocol\MoveEntityPacket; |
55 | 54 | use pocketmine\network\protocol\MovePlayerPacket; |
56 | 55 | use pocketmine\network\protocol\RemoveEntityPacket; |
57 | 56 | use pocketmine\network\protocol\SetEntityDataPacket; |
58 | | -use pocketmine\network\protocol\SetEntityMotionPacket; |
59 | 57 | use pocketmine\network\protocol\SetTimePacket; |
60 | 58 | use pocketmine\Player; |
61 | 59 | use pocketmine\plugin\Plugin; |
@@ -594,28 +592,23 @@ public function updateMovement(){ |
594 | 592 | $pk->yaw = $this->yaw; |
595 | 593 | $pk->pitch = $this->pitch; |
596 | 594 | $pk->bodyYaw = $this->yaw; |
| 595 | + Server::broadcastPacket($this->hasSpawned, $pk); |
597 | 596 | }else{ |
598 | | - //TODO: add to move list |
599 | | - $pk = new MoveEntityPacket(); |
600 | | - $pk->entities = [ |
601 | | - [$this->id, $this->x, $this->y + $this->getEyeHeight(), $this->z, $this->yaw, $this->pitch] |
602 | | - ]; |
| 597 | + foreach($this->hasSpawned as $player){ |
| 598 | + $player->addEntityMovement($this->id, $this->x, $this->y + $this->getEyeHeight(), $this->z, $this->yaw, $this->pitch); |
| 599 | + } |
603 | 600 | } |
604 | 601 |
|
605 | | - Server::broadcastPacket($this->hasSpawned, $pk); |
606 | 602 | } |
607 | 603 |
|
608 | 604 | if(($this->lastMotionX != $this->motionX or $this->lastMotionY != $this->motionY or $this->lastMotionZ != $this->motionZ)){ |
609 | 605 | $this->lastMotionX = $this->motionX; |
610 | 606 | $this->lastMotionY = $this->motionY; |
611 | 607 | $this->lastMotionZ = $this->motionZ; |
612 | 608 |
|
613 | | - $pk = new SetEntityMotionPacket(); |
614 | | - $pk->entities = [ |
615 | | - [$this->getID(), $this->motionX, $this->motionY, $this->motionZ] |
616 | | - ]; |
617 | | - |
618 | | - Server::broadcastPacket($this->hasSpawned, $pk); |
| 609 | + foreach($this->hasSpawned as $player){ |
| 610 | + $player->addEntityMotion($this->id, $this->motionX, $this->motionY, $this->motionZ); |
| 611 | + } |
619 | 612 |
|
620 | 613 | if($this instanceof Player){ |
621 | 614 | $this->motionX = 0; |
@@ -1152,11 +1145,7 @@ public function setMotion(Vector3 $motion){ |
1152 | 1145 |
|
1153 | 1146 | if(!$this->justCreated){ |
1154 | 1147 | if($this instanceof Player){ |
1155 | | - $pk = new SetEntityMotionPacket(); |
1156 | | - $pk->entities = [ |
1157 | | - [0, $this->motionX, $this->motionY, $this->motionZ] |
1158 | | - ]; |
1159 | | - $this->dataPacket($pk); |
| 1148 | + $this->addEntityMotion(0, $this->motionX, $this->motionY, $this->motionZ); |
1160 | 1149 | } |
1161 | 1150 | $this->updateMovement(); |
1162 | 1151 | } |
|
0 commit comments