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?

  • Which version of Minecraft are you playing? Is it 1.12- or 1.13+?
    – One 2 Many
    Jul 26, 2020 at 16:24

1 Answer 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.

To do this, you must use /data to get the player's position, transform the values, and put them onto the cow. For performance reasons, we will use a storage test:main for working with our data:

data modify storage test:main CowLeash.old set from entity @s Pos
execute store result test:main CowLeash.new.X int 1.0 run data get storage test:main CowLeash.old[0]
execute store result test:main CowLeash.new.Y int 1.0 run data get storage test:main CowLeash.old[1]
execute store result test:main CowLeash.new.Z int 1.0 run data get storage test:main CowLeash.old[2]
data modify entity @e[type=cow,tag=target,limit=1] Leash set from storage test:main CowLeash.new
  • I'm not the op but I would like a workaround please.
    – f1r3br4nd
    Dec 1, 2020 at 14:37
  • 1
    @f1r3br4nd Two years later, I'm back with a workaround. If you are still looking for one, that is. If not, then I hope I helped someone out there.
    – One 2 Many
    Oct 16, 2022 at 6:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .