mirror of
https://github.com/songoda/SongodaCore.git
synced 2025-01-25 00:31:22 +01:00
chore!: Delete deprecated RotationUtils class
Judging by the GitHub search none of the plugins is using it anymore
This commit is contained in:
parent
2add5b642f
commit
c241224b64
@ -1,44 +0,0 @@
|
||||
package com.craftaro.core.utils;
|
||||
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
/**
|
||||
* @deprecated No replacement available
|
||||
*/
|
||||
@Deprecated
|
||||
public class RotationUtils {
|
||||
public static float faceToYaw(BlockFace face) {
|
||||
switch (face) {
|
||||
case EAST:
|
||||
return -90;
|
||||
case WEST:
|
||||
return 90;
|
||||
case NORTH:
|
||||
return 180;
|
||||
|
||||
case SOUTH:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static BlockFace yawToFace(float face) {
|
||||
switch (Math.round((face + 360) / 90) * 90) {
|
||||
case 0:
|
||||
case 360:
|
||||
return BlockFace.SOUTH;
|
||||
case 180:
|
||||
case 540:
|
||||
return BlockFace.NORTH;
|
||||
case 270:
|
||||
case 630:
|
||||
return BlockFace.EAST;
|
||||
case 90:
|
||||
case 450:
|
||||
return BlockFace.WEST;
|
||||
default:
|
||||
// idk
|
||||
return BlockFace.SOUTH;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package com.craftaro.core.utils;
|
||||
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class RotationUtilsTest {
|
||||
@Test
|
||||
void faceToYaw() {
|
||||
assertEquals(180, RotationUtils.faceToYaw(BlockFace.NORTH));
|
||||
assertEquals(-90, RotationUtils.faceToYaw(BlockFace.EAST));
|
||||
assertEquals(0, RotationUtils.faceToYaw(BlockFace.SOUTH));
|
||||
assertEquals(90, RotationUtils.faceToYaw(BlockFace.WEST));
|
||||
|
||||
assertEquals(0, RotationUtils.faceToYaw(BlockFace.UP));
|
||||
assertEquals(0, RotationUtils.faceToYaw(BlockFace.DOWN));
|
||||
}
|
||||
|
||||
@Test
|
||||
void yawToFace() {
|
||||
assertEquals(BlockFace.NORTH, RotationUtils.yawToFace(180 - 25));
|
||||
assertEquals(BlockFace.NORTH, RotationUtils.yawToFace(180));
|
||||
assertEquals(BlockFace.NORTH, RotationUtils.yawToFace(180 + 25));
|
||||
|
||||
assertEquals(BlockFace.EAST, RotationUtils.yawToFace(-90 - 25));
|
||||
assertEquals(BlockFace.EAST, RotationUtils.yawToFace(-90));
|
||||
assertEquals(BlockFace.EAST, RotationUtils.yawToFace(-90 + 25));
|
||||
|
||||
assertEquals(BlockFace.SOUTH, RotationUtils.yawToFace(-25));
|
||||
assertEquals(BlockFace.SOUTH, RotationUtils.yawToFace(0));
|
||||
assertEquals(BlockFace.SOUTH, RotationUtils.yawToFace(25));
|
||||
|
||||
assertEquals(BlockFace.WEST, RotationUtils.yawToFace(90 - 25));
|
||||
assertEquals(BlockFace.WEST, RotationUtils.yawToFace(90));
|
||||
assertEquals(BlockFace.WEST, RotationUtils.yawToFace(90 + 25));
|
||||
|
||||
assertEquals(BlockFace.SOUTH, RotationUtils.yawToFace(Float.MAX_VALUE));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user