Commits

md_5 authored bb27a6c7231
SPIGOT-6416: Add BlockFace#isCartesian()
No tags

src/main/java/org/bukkit/block/BlockFace.java

Modified
77 77 */
78 78 @NotNull
79 79 public Vector getDirection() {
80 80 Vector direction = new Vector(modX, modY, modZ);
81 81 if (modX != 0 || modY != 0 || modZ != 0) {
82 82 direction.normalize();
83 83 }
84 84 return direction;
85 85 }
86 86
87 + /**
88 + * Returns true if this face is aligned with one of the unit axes in 3D
89 + * Cartesian space (ie NORTH, SOUTH, EAST, WEST, UP, DOWN).
90 + *
91 + * @return Cartesian status
92 + */
93 + public boolean isCartesian() {
94 + switch (this) {
95 + case NORTH:
96 + case SOUTH:
97 + case EAST:
98 + case WEST:
99 + case UP:
100 + case DOWN:
101 + return true;
102 + default:
103 + return false;
104 + }
105 + }
106 +
87 107 @NotNull
88 108 public BlockFace getOppositeFace() {
89 109 switch (this) {
90 110 case NORTH:
91 111 return BlockFace.SOUTH;
92 112
93 113 case SOUTH:
94 114 return BlockFace.NORTH;
95 115
96 116 case EAST:

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut