Villager Spawning Randomly

Discussion in 'Plugin Development' started by HGPDev, Apr 6, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    HGPDev

    Hi,
    Bizzy with a plugin for a while and i cant figure out how to spawn villagers randomly in a specified arena.
    Anyone knows how? timtower ?
     
  2. Offline

    timtower Administrator Administrator Moderator

    HGPDev
    Random random = new Random();
    int x = random.nextInt(maxValue);
    int y = random.nextInt(maxValue);
    int z= random.nextInt(maxValue);
    Location loc = new Location(world,x,y,z);
    world.spawnEntity(loc,EntityType.VILLAGER);

    I think
     
    HGPDev and Funergy like this.
  3. Offline

    Code0

    That code should work fine.
     
  4. Offline

    HGPDev

    timtower likes this.
Thread Status:
Not open for further replies.

Share This Page