1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Villager Spawn

Discussion in 'Development' started by Draglor56, Apr 23, 2020.

  1. Draglor56

    Draglor56 Silverfish

    Messages:
    24
    Hello I'm looking everywhere as I can a Villager spawning by code because I can't do Villager spawning in-game. Can someone help me?
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Do you want villagers that just stand there, or do you want villagers with AI like in vanilla Minecraft?
     
  3. Draglor56

    Draglor56 Silverfish

    Messages:
    24
    I want a Villagar which only stand there.
     
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
  5. Draglor56

    Draglor56 Silverfish

    Messages:
    24
    I want to make a BedWars plugin and if I reset the map the Villager would be deleted
     
  6. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    Why not backup the map after you spawn the slappers?
     
    GamakCZ likes this.
  7. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    PHP:
    /** @var \pocketmine\level\Position $pos */
    $villager = new \pocketmine\entity\Villager($pos->getLevel(), \pocketmine\entity\Villager::createBaseNBT($pos, new \pocketmine\math\Vector3(0,0,0)));
    $villager->spawnToAll();
     
    wolfdale and HimbeersaftLP like this.
  8. Draglor56

    Draglor56 Silverfish

    Messages:
    24
    Can I give the Villager a name and can I set the yaw?
     
  9. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    yep.
    PHP:
    $villager->setNameTag("Awesome villager name");
    $villager->setYaw(45);
     
    HimbeersaftLP likes this.
  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.