I am pretty new to JSON in minecraft and I wonder how I can teleport my dog named Jack S. Eye to me? I was thinking something like /tp @e[name=Jack S. Eye] @p, but it doesn't work (I understand that I probably need some kind of quotation around the name). And please answer in detail, because I don't know anything about this kind of hardcore in-game programming.

I have tried /tp @e[name=Jack_S._Eye] @p, /tp @e[name=Jack S. Eye] @p, and /tp @e[name="Jack S. Eye"] @p. I don't know what I am doing wrong?


You must not have any spaces in a target selector.

Minecraft commands are parsed by first splitting the input into "words" at spaces. The first word is the command itself, and the other words are used for the various positional arguments.

/tp @e[name=Jack S. Eye] @p

is split into "/tp","@e[name=Jack","S.","Eye]","@p" The second argument for /tp is a target selector, and the game will try to parse @e[name=Jack as such, and fail.

There is currently no way to target an entity with a multi-word name using a target selector directly.

What you can do is rename your dog, e.g. "JackS.Eye" or "Jack_S._Eye", but that's a weird workaround, and you might not want to do that. But there's a better way.

Tag your dog with something other than a name.

The best alternative is simply tagging your dog with a scoreboard tag, and use the tag= target selector argument to target the dog, rather than it's name.

/scoreboard players tag @e[type=Wolf] add JackSEye {CustomName:"Jack S. Eye"}

This will add JackSEye to the list of scoreboard tags of every Wolf/Dog in the game called "Jack S. Eye". You can then run /tp @e[tag=JackSEye] @p to teleport the dog to the player.

"But wait a minute!", you might think now, "If commands are split by whitespace, why can there by whitespace in the data tag argument of the scoreboard command?". Well, because data tags are one of the exceptions to the one word rule. Since they are always the last positional argument (for this very reason), the game simply re-combines them into a single thing while parsing.

Not the answer you're looking for? Browse other questions tagged or ask your own question.