Get UUID
This library data pack provides the ability to convert UUIDs from integer array format (for example, [I; -1401042019, -1289797294, -1229027734, 88525518]) to hexadecimal format (for example, ac7dcb9d-b31f-4152-b6be-866a0546cace).
Usage
The library includes two main functions:
- function
gu:generate- saves the hexadecimal UUID of the executing entity in the NBT storagegu:main out - function
gu:convert- converts the decimal UUID passed as a function macro argument (for example,{UUID:[I; -1401042019, -1289797294, -1229027734, 88525518]}) to hexadecimal format and saves the result in the NBT storagegu:main out
Usage Examples
Getting player UUID:
/function gu:generate
After executing the command, the UUID will be available for viewing via /data get storage gu:main out
Getting mob UUID:
/execute as @n[type=cow] run function gu:generate
This command will save the hexadecimal UUID of the nearest cow in the storage
Direct array conversion:
/function gu:convert {UUID:[I; 1, 2, 3, 4]}
Converts the specified integer array to a hexadecimal UUID