Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Location getNext(Location loc, int id)
- {
- if(id==0)
- {
- System.err.println("Cannot iterate over air! (wtf!)");
- return null;
- }
- for(int x=-1; x<=1; x++){
- for(int z=-1; z<=1; z++){
- for(int y=-1; y<=1; y++){
- if((x==-1 || x==1)&&(z==-1||z==1))
- {
- Location newloc = new Location(loc.getWorld(), loc.getBlockX()+x, loc.getBlockY()+y, loc.getBlockZ()+z);
- int locid = loc.getWorld().getBlockTypeIdAt(newloc);
- if(locid==id)
- {
- if(!this.l.contains(newloc))
- {
- this.cloc = newloc;
- this.l.add(newloc);
- System.out.println("A damn fine iterator: " + newloc.getBlockX() + "," + newloc.getBlockZ());
- return newloc;
- }
- }
- }
- }
- }
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement