mrkirby153

Untitled

Nov 26th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1.  public static boolean overlap(Location center) {
  2.         int size = MainConfiguration.villageSize();
  3.         System.out.println("[o] Adding blocks to arraylist");
  4.         ArrayList<Location> overlapped = new ArrayList<Location>();
  5.         for (Map.Entry<String, ArrayList<Location>> entry : villages.entrySet()) {
  6.             ArrayList<Location> l = entry.getValue();
  7.             for (Location l1 : l) {
  8.                 overlapped.add(l1);
  9.             }
  10.         }
  11.         System.out.println("[o] Checking overlap");
  12.         World world = center.getWorld();
  13.         int cx = center.getBlockX();
  14.         int cy = center.getBlockY();
  15.         int cz = center.getBlockZ();
  16.         for (int x = -size; x <= size; x++) {
  17.             for (int z = -size; z <= size; z++) {
  18.                 for (int y = 0; y <= 256; y++) {
  19.                     Location l = new Location(world, cx + x, cy + y, cz + z);
  20.                     if (overlapped.contains(l)) {
  21.                         System.out.println("[o] Done overlap!");
  22.                         return true;
  23.                     }
  24.                 }
  25.             }
  26.  
  27.         }
  28.         System.out.println("[o] Done no overlap");
  29.         return false;
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment