/// <summary> /// Returns the closest horizontal face from given angle (0 degree = east). Uses HORIZONTALS_ANGLEORDER /// </summary> /// <param name="radiant"></param> /// <returns></returns> public static BlockFacing HorizontalFromAngle(float radiant) { int index = GameMath.Mod(((int)(Math.Round(radiant * GameMath.RAD2DEG / 90))), 4); return(HORIZONTALS_ANGLEORDER[index]); }
/// <summary> /// A not so fast, but higher quality than oaatHash(). See also https://en.wikipedia.org/wiki/MurmurHash. Includes a modulo operation. /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="z"></param> /// <param name="mod"></param> /// <returns></returns> public static int MurmurHash3Mod(int x, int y, int z, int mod) { return(GameMath.Mod(MurmurHash3(x, y, z), mod)); }
/// <summary> /// Returns the face if current face would be horizontally clockwise rotated, only works for horizontal faces /// </summary> /// <returns></returns> public BlockFacing GetCW() { return(HORIZONTALS_ANGLEORDER[GameMath.Mod(horizontalAngleIndex - 1, 4)]); }