0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Add helper methods for center and range instead of min and max

This commit is contained in:
Alexander01998 2023-02-07 18:40:51 +01:00
parent 2d717fe0f8
commit 728b849216

View File

@ -137,6 +137,12 @@ public enum BlockUtils
return blocks;
}
public static ArrayList<BlockPos> getAllInBox(BlockPos center, int range)
{
return getAllInBox(center.add(-range, -range, -range),
center.add(range, range, range));
}
public static Stream<BlockPos> getAllInBoxStream(BlockPos from, BlockPos to)
{
BlockPos min = new BlockPos(Math.min(from.getX(), to.getX()),
@ -175,4 +181,10 @@ public enum BlockUtils
return stream.limit(limit);
}
public static Stream<BlockPos> getAllInBoxStream(BlockPos center, int range)
{
return getAllInBoxStream(center.add(-range, -range, -range),
center.add(range, range, range));
}
}