Look ma, no Bukkit API in the core package

This commit is contained in:
dfsek
2020-12-11 17:30:17 -07:00
parent 7ee1d2c391
commit 5bf699cba9
345 changed files with 1352 additions and 2642 deletions
@@ -0,0 +1,51 @@
package com.dfsek.terra.structure;
import net.jafama.FastMath;
public enum Rotation {
CW_90(90), CW_180(180), CCW_90(270), NONE(0);
private final int degrees;
Rotation(int degrees) {
this.degrees = degrees;
}
public static Rotation fromDegrees(int deg) {
switch(FastMath.floorMod(deg, 360)) {
case 0:
return Rotation.NONE;
case 90:
return Rotation.CW_90;
case 180:
return Rotation.CW_180;
case 270:
return Rotation.CCW_90;
default:
throw new IllegalArgumentException();
}
}
public int getDegrees() {
return degrees;
}
public Rotation inverse() {
switch(this) {
case NONE:
return NONE;
case CCW_90:
return CW_90;
case CW_90:
return CCW_90;
case CW_180:
return CW_180;
default:
throw new IllegalArgumentException();
}
}
public enum Axis {
X, Y, Z
}
}