I am working on a plugin that requires moving npcs. However, I can't seem to get the Human I created to update after setting a new movement or rotation. The setRotation method calls the scheduleUpdate method which doesnt seem to update by calling it manually, and the setMovement method calls updateMovement which cant be called manually. Any thoughts? I have the following code for now where $watch and $follow are both an instance of Player Code: public function onPlayerMove(PlayerMoveEvent $event) { if (isset($this->clones[$event->getPlayer()->getName()])) { $watch = $this->clones[$event->getPlayer()->getName()]["watch"]; $follow = $this->clones[$event->getPlayer()->getName()]["follow"]; if ($watch !== null) { foreach ($this->clones[$event->getPlayer()->getName()] as $clone) { if ($clone instanceof Human) { $clone->setRotation($event->getPlayer()->getYaw(), $event->getPlayer()->getPitch()); // messing with setting rotation for now. // will work on actually watching target player once I find my problem // entity wont update unless I hit them? } } } if ($follow !== null) { foreach ($this->clones[$event->getPlayer()->getName()] as $clone) { if ($clone instanceof Human) { $clone->setMotion($event->getPlayer()->getMotion()); // entity wont update unless I hit them? } } } } }
Did you try to use the MoveEntityPacket ? https://github.com/pmmp/PocketMine-...ne/network/mcpe/protocol/MoveEntityPacket.php
No, although I am not too sure how to use that. If you could link me an example of where it is used I would really appreciate it
They are just instances of Human. I don't think you will need it, but the full source for the plugin I am making is right here: https://github.com/Smarticles101/Clones
Okay, the issue that you have is that you are not using your own entity class to move the entity with onTick() or move()
May I suggest looking at slapper to understand what I mean https://github.com/jojoe77777/Slapper/blob/master/src/slapper/entities/SlapperHuman.php https://github.com/RevivalPMMP/Pure...lpmmp/pureentities/entity/BaseEntity.php#L244