diff --git a/src/main/java/net/minestom/server/instance/block/BlockFace.java b/src/main/java/net/minestom/server/instance/block/BlockFace.java index 680486866..ec69fe236 100644 --- a/src/main/java/net/minestom/server/instance/block/BlockFace.java +++ b/src/main/java/net/minestom/server/instance/block/BlockFace.java @@ -60,4 +60,21 @@ public enum BlockFace { return BlockFace.WEST; } } + + /** + * Get the BlockFace corresponding to the given {@link Direction}. + * + * @param direction the direction + * @return the corresponding BlockFace + */ + public static BlockFace fromDirection(Direction direction) { + return switch (direction) { + case UP -> TOP; + case DOWN -> BOTTOM; + case NORTH -> NORTH; + case SOUTH -> SOUTH; + case WEST -> WEST; + case EAST -> EAST; + }; + } }