Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. public Location getNext(Location loc, int id)
  2.     {
  3.     if(id==0)
  4.     {
  5.         System.err.println("Cannot iterate over air! (wtf!)");
  6.         return null;
  7.     }
  8.     for(int x=-1; x<=1; x++){
  9.         for(int z=-1; z<=1; z++){
  10.             for(int y=-1; y<=1; y++){
  11.         if((x==-1 || x==1)&&(z==-1||z==1))
  12.         {
  13.         Location newloc = new Location(loc.getWorld(), loc.getBlockX()+x, loc.getBlockY()+y, loc.getBlockZ()+z);
  14.         int locid = loc.getWorld().getBlockTypeIdAt(newloc);
  15.         if(locid==id)
  16.         {
  17.         if(!this.l.contains(newloc))
  18.         {
  19.         this.cloc = newloc;
  20.         this.l.add(newloc);
  21.         System.out.println("A damn fine iterator: " + newloc.getBlockX() + "," + newloc.getBlockZ());
  22.         return newloc;
  23.         }
  24.         }
  25.         }
  26.         }
  27.         }
  28.     }
  29.     return null;
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement