How can I get a circle of blocks based on 1 block location

Discussion in 'Spigot Plugin Development' started by Pladetor, Apr 16, 2017.

  1. Hello, If you didn't understand what my question is let me explain:
    If I mine 1 block I wan't to make all of the blocks around him (In a circle shape) break too. I already know how to make them break but I don't know how to get them because I don't understand how to get a circle around 1 block/ (didn't learn sin and cos yet) I at least think that I need to use sin and cos. Can someone help me please?
  2. Code (Text):
    for (int i = 0; i < 360; i++) {
      int y = block.getY();
      int x = block.getX() + Math.sin((double) i) * radius;
        int z = block.getZ() + Math.cos((double) i) * radius;
      Location loc = new Location(block.getWorld(), x, y, z);
      Block b = loc.getBlock();
      if (b != null) {
  3. radius = ?
  4. Radius is the distance between the middlepoint (the block you break) and the furthest point from your block. If you don't know what radius is you should go back to learning 6th grade math
  5. I don't really remember 6th grade math .-.
    Thanks for the help! :D