using System; using LibAC.Utilities; namespace LibAC.NBT.API { public class NbtUUID { public long MSB { get; } public long LSB { get; } public static readonly NbtUUID ZERO = new NbtUUID(UUID.ZERO); public NbtUUID(long msb, long lsb) { MSB = msb; LSB = lsb; } public NbtUUID(UUID uuid) { byte[] uuidBytes = uuid.GetBytes(); MSB = BitConverter.ToInt64(uuidBytes, 0); LSB = BitConverter.ToInt64(uuidBytes, 8); } public long GetMostSignificantBits() => MSB; public long GetLeastSignificantBits() => LSB; public UUID ToUUID() { byte[] bytes = new byte[16]; BitConverter.GetBytes(MSB).CopyTo(bytes, 0); BitConverter.GetBytes(LSB).CopyTo(bytes, 8); return new UUID(bytes); } public override string ToString() { return ToUUID().ToString(); } } }