How to spawn an entity.

Discussion in 'Development' started by Minetron26, Jul 10, 2019.

  1. Minetron26

    Minetron26 Witch

    Messages:
    53
    GitHub:
    minetron26
    Hello, I would like to know, how to generate an entity, I have already tried it, but it says: Call to a member function spawnTo() on null.
     
  2. wolfdale

    wolfdale Zombie

    Messages:
    373
    Can you show your attempt? Most likely you got the wrong entity id
     
    Minetron26 likes this.
  3. Minetron26

    Minetron26 Witch

    Messages:
    53
    GitHub:
    minetron26
    Yes, maybe, here is my attempt:
    PHP:
    $position = new Position($x$y$z$player->getLevel());
    $nbt Entity::createBaseNBT($position);
    $entity Entity::createEntity(10$player->getLevel(), $nbt);
    $entity->spawnToAll();
     
  4. jasonwynn10

    jasonwynn10 Wither Skeleton Poggit Reviewer

    Messages:
    1,406
    GitHub:
    jasonwynn10
    Are you sure entity id 10 is registered? PocketMine is missing most entities, so mobs are not registered by default
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.