I'm trying to create a pokeball in Minecraft but I was wondering if there is any way for the command block to test for all mobs in a certain radius and give a different output depending on the mob without having to test for each mob individually with individual command blocks

  • 2
    Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins!
    – Frank
    Apr 25, 2017 at 14:41

2 Answers 2


update for 1.13;

/execute if entity @e[type=!player,distance=5] run <command>

you can potentially stack if/unless statements in there if you want more, but this is the shortened way.


You could use

/testfor @e[type=!player,r=RADIUS]

This will test for all mobs that are not players in the chosen RADIUS.

Otherwise there is no way to do what you are asking besides doing individual mobs.

You must log in to answer this question.

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