Angle struct
An angle packed into one byte, in 256ths of a turn, as the protocol sends entity rotations in spawn, move, look and head rotation packets.
public struct Angle : INetworkSerializable<Angle>, IEquatable<Angle>
In Obsidian.API.
Remarks
Packing loses up to 1.4 degrees, so entities keep their rotation as float degrees (IEntity.Yaw, IEntity.Pitch) and pack it only to send it.
Constructors
Angle(byte)
public Angle(byte value);An angle packed into one byte, in 256ths of a turn, as the protocol sends entity rotations in spawn, move, look and head rotation packets.
Remarks
Packing loses up to 1.4 degrees, so entities keep their rotation as float degrees (IEntity.Yaw, IEntity.Pitch) and pack it only to send it.
Properties
public float Degrees { get; set; }public byte Value { get; set; }Methods
public bool Equals(Angle other);public override bool Equals(object obj);public override int GetHashCode();NormalizeToByte(float)
public static byte NormalizeToByte(float value);Packs value degrees into 256ths of a turn, as vanilla's Mth.packDegrees does: floored, then wrapped into a byte, so -90 is 192 and 360 is 0.
Remarks
The value narrows through Int32 to keep the wrap: since .NET 11, a float cast straight to a byte saturates instead, which would turn every negative angle into 0.
public static Angle Read(INetStreamReader reader);public static void Write(Angle value, INetStreamWriter writer);Operators
implicit operator Angle(float)
public static implicit operator Angle(float degree);Packs degree as Angle.NormalizeToByte does.
public static implicit operator float(Angle angle);public static bool operator !=(Angle left, Angle right);public static bool operator ==(Angle left, Angle right);