Skip to content

Commit

Permalink
Merge pull request #1048 from Axionize/blockface-get-horizontal
Browse files Browse the repository at this point in the history
add getHorizontalID
  • Loading branch information
booky10 authored Nov 7, 2024
2 parents 6f490a7 + 1877bae commit 4167c94
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 4167c94

Please sign in to comment.