Add BlockFace#fromDirection

(cherry picked from commit cc39a90857)
This commit is contained in:
NxDs 2023-02-10 18:32:44 -05:00 committed by mworzala
parent e9e58e4fce
commit 82725b5e32
No known key found for this signature in database
GPG Key ID: B148F922E64797C7

View File

@ -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;
};
}
}