Minecraft – How to make a wolf tamed by an arbitrary player using command blocks

minecraft-commandsminecraft-java-edition

In a map I'm making, I have a shop where players can buy rewards for collecting points (things like upgraded stats, items, etc.). One thing I'd like to have is a pet shop, where the player can buy a dog, cat, horse, or skeleton horse. When they buy one, it should become tamed by the player who bought it. There's a data tag on these mobs called OwnerUUID, which must be set to the owner's UUID to make this work…so how can I set it to a player's UUID when anyone could be playing the map, and any player could buy an animal? In other words, how do I calculate the player's UUID and set a data tag to it if their username/account is unknown? If there's no way to do this, how can I make an animal tamed another way with command blocks?

Best Answer

I don't know why so many players say this isn't possible. In fact, it is simple!

Just enter this command into a command block:

/summon Wolf ~ ~1 ~ {Owner:Notch}

Of course, the name Notch could be replaced with the player's name that you wanted to have it tamed to. @p does not work! (The command will generate a tamed wolf one block above the command block, tamed to the person of your liking.)