Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static List<Block> getBlocksInRange(World world, int posX, int posY, int posZ, int horizontalRadius, int verticalRadius)
- {
- int lowest = posY - verticalRadius;
- int highest = posY + verticalRadius;
- int xMin = posX - horizontalRadius;
- int xMax = posX + horizontalRadius;
- int zMin = posZ - horizontalRadius;
- int zMax = posZ + horizontalRadius;
- ArrayList<Block> arraylist = new ArrayList<Block>();
- for(int y = lowest; y <= highest; y++)
- {
- for(int x = xMin; x <= xMax; x++)
- {
- for(int z = zMin; z <= zMax; z++)
- {
- if(world.getBlock(x, y, z) != null && !(world.getBlock(x, y, z) instanceof BlockAir))
- {
- arraylist.add(world.getBlock(x, y, z));
- }
- }
- }
- }
- System.out.println(arraylist);
- return arraylist;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement