Waternode

Untitled

Jun 21st, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1.     public ArrayList<Location> getAllPointsBetween(Location point1, Location point2) {
  2.         int xMultiplier = 1;
  3.         int yMultiplier = 1;
  4.         int zMultiplier = 1;
  5.  
  6.         if(point1.getX() > point2.getBlockX()) {
  7.             xMultiplier *= -1;
  8.         }
  9.  
  10.         if(point1.getY() > point2.getBlockY()) {
  11.             yMultiplier *= -1;
  12.         }
  13.  
  14.         if(point1.getZ() > point2.getBlockZ()) {
  15.             zMultiplier *= -1;
  16.         }
  17.  
  18.         ArrayList<Location> points = new ArrayList<Location>();
  19.         for(int x = 0; x < Math.abs(point1.getBlockX() - point2.getBlockX()); x += xMultiplier) {
  20.             for(int y = 0; y < Math.abs(point1.getBlockY() - point2.getBlockY()); y += yMultiplier) {
  21.                 for(int z = 0; x < Math.abs(point1.getBlockX() - point2.getBlockX()); z += zMultiplier) {
  22.                     points.add(new Location(point1.getWorld(), x, y, z));
  23.                 }
  24.             }
  25.         }
  26.  
  27.         return points;
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment