turt2live

Untitled

May 2nd, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. // Usage: Block placeAt = findOpenBlock(chunk.getX() * 16 + randomX, chunk.getZ() * 16 + randomZ, world);
  2. // randomX and randomZ are 0-15 values
  3.  
  4.    public static Block findOpenBlock(int x, int z, World world){
  5.         Block current = world.getBlockAt(x,0,z);
  6.         Block last = current;
  7.        
  8.         for(int y=1;y<world.getMaxHeight();y++){
  9.             current = world.getBlockAt(x,y,z);
  10.             if(current.getType()== Material.AIR && last.getType()==Material.STONE)
  11.                 break;
  12.             last = current;
  13.         }
  14.        
  15.         return current;
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment