chore!: Delete deprecated RotationUtils class

Judging by the GitHub search none of the plugins is using it anymore
This commit is contained in:
Christian Koop 2024-03-26 21:26:08 +01:00
parent 2add5b642f
commit c241224b64
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
2 changed files with 0 additions and 84 deletions

View File

@ -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;
}
}
}

View File

@ -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));
}
}