I have already created the entity: PHP: public function spawnBot($x, $y, $z, $world, $nametag) { $chunk = $world->getChunk($x>>4, $z>>4); $nbt = $this->getNBT($x, $y, $z, 0, 0); $bot = Entity::createEntity("Zombie", $chunk, $nbt); $bot->setNameTag($nametag); $bot->spawnToAll(); $this->getLogger()->critical("PocketBot has been spawned"); } But I have no idea how to add movement to it. Also, how do I get a specific entity in a world? My current code: PHP: public function getBot() { $level = $this->getBotLevel(); foreach($level->getEntities() as $entity) { if($entity->getX() == $this->getBotX() && $entity->getY() == $this->getBotY() && $entity->getZ() == $this->getBotZ()) { return $entity; } } } But it doesn't work.
Try, teleporting it back and then again and again. Or you can create a movement pattern and create a task that's teleport the Zombie to the pattern for teleport use $bot->teleport // I'm trying the same thing. I;ll post an update when i figue it out.
Teleporting is one of the worst ways to make a mob walk/move. It looks glitchy. There is a way to make the mob walk, but I'm not entirely sure how to do i t.
How about this??? https://github.com/milk0417/EntityManager , It has an API idk.. Anyway take a look at it alright.
Thanks, but I'm still having trouble actually getting the entity. My current code doesn't return the entity. And addEntityMotion() & addEntityMovement() require and entity ID. How do I give my mob an entity ID or get its current one?
PHP: $bot->getId() returns its entity ID. When you have its ID (look above), you can use $level->getEntity($id);