Skip to content

Commit

Permalink
Merge pull request #2121 from embeddedt/fix/getfacing-parity
Browse files Browse the repository at this point in the history
Fix parity issue in Sodium's getFacing optimization
  • Loading branch information
IMS212 authored Oct 12, 2023
2 parents dff676d + da8f367 commit eeafb59
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public class DirectionMixin {
@SuppressWarnings({ "StatementWithEmptyBody", "JavadocReference" })
@Overwrite
public static Direction getFacing(float x, float y, float z) {
// Vanilla quirk: return NORTH if all coordinates are zero
if (x == 0 && y == 0 && z == 0)
return Direction.NORTH;

// First choice in ties: negative, positive; Y, Z, X
var yM = Math.abs(y);
var zM = Math.abs(z);
Expand Down

0 comments on commit eeafb59

Please sign in to comment.