From 4f17beef9332ff82e17b0c2a6c1bf1ce79de793b Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sat, 10 Apr 2021 08:58:30 +1000 Subject: [PATCH] SPIGOT-6416: Add BlockFace#isCartesian() By: md_5 --- .../main/java/org/bukkit/block/BlockFace.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/block/BlockFace.java b/paper-api/src/main/java/org/bukkit/block/BlockFace.java index 2fed469b67..fe83ed9bf6 100644 --- a/paper-api/src/main/java/org/bukkit/block/BlockFace.java +++ b/paper-api/src/main/java/org/bukkit/block/BlockFace.java @@ -84,6 +84,26 @@ public enum BlockFace { return direction; } + /** + * Returns true if this face is aligned with one of the unit axes in 3D + * Cartesian space (ie NORTH, SOUTH, EAST, WEST, UP, DOWN). + * + * @return Cartesian status + */ + public boolean isCartesian() { + switch (this) { + case NORTH: + case SOUTH: + case EAST: + case WEST: + case UP: + case DOWN: + return true; + default: + return false; + } + } + @NotNull public BlockFace getOppositeFace() { switch (this) {