Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public static List<Block> getBlocksInRange(World world, int posX, int posY, int posZ, int horizontalRadius, int verticalRadius)
  2. {
  3. int lowest = posY - verticalRadius;
  4. int highest = posY + verticalRadius;
  5. int xMin = posX - horizontalRadius;
  6. int xMax = posX + horizontalRadius;
  7. int zMin = posZ - horizontalRadius;
  8. int zMax = posZ + horizontalRadius;
  9. ArrayList<Block> arraylist = new ArrayList<Block>();
  10.  
  11. for(int y = lowest; y <= highest; y++)
  12. {
  13. for(int x = xMin; x <= xMax; x++)
  14. {
  15. for(int z = zMin; z <= zMax; z++)
  16. {
  17. if(world.getBlock(x, y, z) != null && !(world.getBlock(x, y, z) instanceof BlockAir))
  18. {
  19. arraylist.add(world.getBlock(x, y, z));
  20. }
  21. }
  22. }
  23. }
  24. System.out.println(arraylist);
  25. return arraylist;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement