Solved How to select multiple blocks around one block?

Discussion in 'Spigot Plugin Development' started by Orangemaster123, May 28, 2017.

  1. I am making a paintball gun. Right now if the snowball that comes out of the gun hits a block, it turns that block to a random colour of wool. But i want it not to just do that to one block, but multiple blocks around where the snowball landed. Is there anyway to do this. This is how i'm selecting the block now.

    Code (Text):

    Location loc1 = entity.getLocation();

            Vector vec = entity.getVelocity();

            Location loc = new Location(loc1.getWorld(), loc1.getX()+vec.getX(), loc1.getY()+vec.getY(), loc1.getZ()+vec.getZ());

     
     
  2. Run three for loops that loop through all the blocks around it by adding/subtracting x, y, and z coords. Also, be sure to clone the location before adding or subtracting values to it.
     
    • Useful Useful x 1
  3. Thank you this has worked. :)