How can I make a command that makes all my wolves sit and stand?

I've started a new Minecraft world and decided that I wanted to reach functional invulnerability by having like 50 unnamed wolves follow me around. However, this comes with a few issues, because having them follow around all the time makes it impossible to loot desert temples, they die by the dozen whenever I jump into a ravine, etc. It is a hassle to make them all sit and stand up, so I tried making a command that makes them all sit.

Here's what I tried so far:

Now the key to this seems to be the /data command. The command:

/data merge entity @e[name=JackLondon,limit=1] {Sitting:1}

allows me to make JackLondon the wolf sit, which is great.

The issue is that the /data command does not readily work with more than one entity at a time and I haven't found a way to circumvent that. I also haven't found a way to make it affect multiple unnamed entities.

Any code that allows me to make wolves or pets in general sit and stand all at once would be welcome.

2

1 Answer

You can use /execute to make every wolf execute the /data command and modify its own NBT data:

/execute as @e[type=wolf] run data merge entity @s {Sitting:1b}
5

You Might Also Like