They use packets in this plugin I tried this to move the entity: PHP: public function onPlayerMove(PlayerMoveEvent $event) {$player = $event->getPlayer();$entity = $player->getLevel()->getEntity($this->id);$speed = 1;$x = $player->x;$y = $player->y;$z = $player->z;if($x ** 2 + $z ** 2 < 0.7){$motionX = 0;$motionZ = 0;}else{$diff = abs($x) + abs($z);$motionX = $speed * 0.15 * ($x / $diff);$motionZ = $speed * 0.15 * ($z / $diff);}$entity->move($motionX, $y, $motionZ);
Is the entity a real entity or a fake one sent to the client? btw you need to call $entity->updateMovement() to send the movement
Now I get this error: Code: Call to protected method pocketmine\entity\Entity::updateMovement() *And the entity is not visible (only If I use the move stuff)
Oh my bad use $entity->level->addEntityMotion() instead, if you want to add yaw and pitch use $entity->level->addEntityMovement()
I found something. But I get only errors. PHP: $entity->level->addEntityMotion($id, $motionX, $y, $motionZ); Code: Argument 5 passed to pocketmine\level\Level::addEntityMotion() must be of the type float
Level::addEntityMotion(int $chunkX, int $chunkZ, int $entityId, float $x, float $y, float $z) example: $entity->level->addEntityMotion($entity->chunk->getX(),$entity->chunk->getZ(),$entity->getId(),$motionX,0,$motionZ)