mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-26 18:11:40 +01:00
Fix issue when finding direction with MathUtils when yaw < 0
This commit is contained in:
parent
7eee0c788f
commit
9e7f05c311
@ -30,7 +30,7 @@ public class MathUtils {
|
||||
|
||||
public static Direction getHorizontalDirection(float yawInDegrees) {
|
||||
// +45f gives a 90° angle for the direction (-1° and 1° are towards the same direction)
|
||||
int directionIndex = (int) ((yawInDegrees+45f) / 90f);
|
||||
int directionIndex = (int) Math.floor(((yawInDegrees+45f) / 90f));
|
||||
if(directionIndex < 0) {
|
||||
directionIndex = Direction.HORIZONTAL.length-directionIndex;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user