Add BlockFace#fromDirection

This commit is contained in:
NxDs 2023-02-11 00:32:44 +01:00
parent aebf72de90
commit cc39a90857

View File

@ -32,4 +32,21 @@ public enum BlockFace {
case EAST -> 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;
};
}
}