Last active
February 6, 2024 02:17
-
-
Save storycraft/7813dd0186e85daa393e1df9cfa19f2a to your computer and use it in GitHub Desktop.
Convert uuid string to minecraft nbt uuid (int array)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toNBTUUID(uuid) { | |
return `[I;${uuid.replace(/-/g, '').match(/.{8}/g).map(str => Number.parseInt(str, 16)).map(num => num & 0x80000000 ? num - 0xffffffff - 1 : num).join(',')}]`; | |
} | |
// toNBTUUID('0e9b65dd-3dce-4a3f-8a13-3299a91ceac7'); | |
// -> [I;245065181,1036929599,-1978453351,-1457722681] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks dude ❤