Looping over each block between loc1 and loc2?

Discussion in 'Plugin Development' started by qlimax5000, May 25, 2014.

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

    qlimax5000

    Basicly, i have 1 loc and a radius.

    I then create 2 locs from:
    original loc x = x + radius
    original loc z = z + radius

    and loc2 =
    original loc x = x - radius
    original loc z = z - radius

    Any help?
     
  2. Offline

    mythbusterma

    I believe the Bukkit World object has a method getBlocksInRadius (Location l, int radius), or something similar. Check the JavaDoc for it. Hope that helps. (Also, a method getBlocksInRange(Location max, Location min) again, or something of that nature)
     
  3. Offline

    qlimax5000

    mythbusterma
    Thanks, i'll have a look.

    Bump.

    mythbusterma
    So after some seaching i'm unable to locate the function you're talking about. Have you found it for can anyone else help me?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  4. Offline

    fireblast709

    qlimax5000 doesn't need anything more than some simple iterations
    Code:java
    1. for(int x = minX; x <= maxX; x++)
    2. for(int y = minY; y <= maxY; y++)
    3. for(int z = minZ; z <= maxZ; z++)
    4. {
    5. Block b = loc.add(x, y, z).getBlock();
    6. loc.subtract(x, y, z);
    7. }
     
  5. Offline

    mythbusterma

    I could've sworn there was a method for this, Oh well.
     
Thread Status:
Not open for further replies.

Share This Page