Skip to content

Commit

Permalink
add getHorizontalID
Browse files Browse the repository at this point in the history
  • Loading branch information
You committed Nov 5, 2024
1 parent c24f2d7 commit 1877bae
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,32 @@ public BlockFace getCW() {
}
}

/** Returns int representing cardinal directions with south as the starting index at 0. UP and DOWN return -1
* <p>
* Used by Mojang for calculations involving mob AI, decorations, paintings, item frames, maps,
* structure generation, campfires, stairs, connecting blocks, and flowerbeds.
* Also used for getting Directions and Blockfaces as Rotations.
*
* @return int horizontal id
*/
public int getHorizontalID() {
switch (this) {
case DOWN:
case UP:
return -1;
case NORTH:
return 2;
case SOUTH:
return 0;
case WEST:
return 1;
case EAST:
return 3;
default:
throw new IllegalArgumentException("Invalid blockface input for getHorizontalID");
}
}

public short getFaceValue() {
return faceValue;
}
Expand Down

0 comments on commit 1877bae

Please sign in to comment.