Solved Spwan entity in a radius

Discussion in 'Plugin Development' started by ToastHelmi, Aug 14, 2013.

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

    ToastHelmi

    Hey I'm trying to spawn mobs in a radius but all my mobs spawn in one row
    this is the code im using
    Code:java
    1. final Location PlayerLocation = e.getPlayer().getLocation();
    2. Location spawnLoc;
    3. Random r = new Random();
    4. for(int i =0 ; i< 10; i++)
    5. {
    6. spawnLoc = PlayerLocation;
    7. int x = r.nextInt(60)-30,y=r.nextInt(60)-30;
    8. p.getLogger().warning("[x:"+x+";y:"+y+"]");
    9. spawnLoc.add(x, y, 0);
    10. spawnLoc.setY(spawnLoc.getWorld().getHighestBlockAt(spawnLoc).getLocation().getY());
    11. spawnLoc.getWorld().spawn(spawnLoc, Skeleton.class);
    12. }
     
  2. Offline

    newboyhun

    ToastHelmi
    int x = r.nextInt(60)-30,y=r.nextInt(60)-30; > int x = r.nextInt(60)-30,z=r.nextInt(60)-30;

    spawnLoc.add(x, y, 0); > spawnLoc.add(x, 0, z);
     
Thread Status:
Not open for further replies.

Share This Page