Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Usage: Block placeAt = findOpenBlock(chunk.getX() * 16 + randomX, chunk.getZ() * 16 + randomZ, world);
- // randomX and randomZ are 0-15 values
- public static Block findOpenBlock(int x, int z, World world){
- Block current = world.getBlockAt(x,0,z);
- Block last = current;
- for(int y=1;y<world.getMaxHeight();y++){
- current = world.getBlockAt(x,y,z);
- if(current.getType()== Material.AIR && last.getType()==Material.STONE)
- break;
- last = current;
- }
- return current;
- }
Advertisement
Add Comment
Please, Sign In to add comment