-
New Feature
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
None
-
This server is running CraftBukkit version 3467-Spigot-ffceeae-e6cc7c7 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT)
-
Yes
Set<Block> getAdjacentBlocks(Set<BlockFace> blockFaces) convenience method in Block.
Often, one wants to get various surrounding blocks of a block, which requires the quite verbose construct of a set of BlockFaces, a for loop over them with getRelative(BlockFace) and then a isEmpty() check on each block to see if it is just air.
A getAdjacentBlocks() method could improve code clarity quite a lot in this case.
// Actual counting example with predefined faces from my plugin: return faces.stream() .map(block::getRelative) // Actual block there, not air. .filter(b -> !b.isEmpty()) .count(); // vs return block.getAdjacentBlocks(faces).size();