Is there a way to use relative commands in NBT tags?

I know you can use ~ to tell your current location, but when i do this:

/summon minecraft:cow ~ ~2 ~ {Leash:{X:36,Y:82,Z:-434},NoAI:1,Age:-25000,Silent:1}

and i replace the X,Y,Z with relative coordinates, it doesn't work. Why?


Solution 1:

You can't use relative coordinates in NBT.

The X, Y, and Z coordinates are raw integers. A ~ is not recognized as an integer symbol and therefore throws an error.

Comment below if you want me to give a workaround.