Having trouble testing for mobs with command blocks

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


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.


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.