1

I wanted to know if the @r command works with the [name=] specification, aim trying to make a underwater map with randomized fish using invisible squids and i want to only select the ones named squid (meaning the unnamed ones since a squid's default name is squid)

  • I thought an entity had no name unless it had a Name NBT tag... – RetroCraft Jan 20 '15 at 2:21
1

Yes it does, but you have to specify the type of mob it is, or it won't target entities. As per the wiki:

When used without the type argument, @r always targets a random player. The type argument can be used to target non-player entities [...]

Here is a example:

/tp @r[type=Squid,name=Random] ~ ~3 ~

This would teleport a random Squid with the name "Random" 3 blocks up. Hope this helps!

  • Welcome to the Site! Good first answer. I didn't believe @r could target entities, you so I looked it up on the wiki. Turns out you are right, so I took the liberty of adding the relevant section to your answer for all the other doubters. Feel free to roll-back if you don't like it though. (To do so, click on "edited TIME ago" to see the edit history and click "rollback".) – MrLemon Jan 21 '15 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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