This question already has an answer here:

I have been trying to make a safezone for a map. I want to make it kill any mobs that come into the safezone except for villagers (for trading) and players within a certain radius.

I have looked at quite a few of the questions on here and haven't found the answer I'm looking for. Some people suggested using scoreboards and I find them extremely complicated. I don't know if they have a range function. I have seen some people say to make multiple kill commands and string them up, but I can't do that because I have the Mo' Creatures mod installed.

I am running Minecraft 1.10.2.

If anyone needs extra info on something comment and ask about it as I don't know what else to say in the question. Please don't be harsh like some people have been to me in the past.

marked as duplicate by Schism, Gigazelle, Lore Friendly, dly, Virusbomb Aug 20 '18 at 13:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


execute @e[type=!player,x=,y=,z=,r=] ~ ~ ~ kill @s[type=!villager] Just add the coordinates and the radius you need in the first target selector.

  • Very clever way to do it in one command, bravo! – Fabian Röling Nov 12 '17 at 17:58
  • @Bot-Ethan If you get an error message, maybe you're playing in an older version? If yes, then you should mention that in the question. – Fabian Röling Nov 12 '17 at 17:59
  • 3
    Btw, in 1.13 you should be able to just write "type=!player,type=!villager". But not in 1.12.2. – Fabian Röling Nov 12 '17 at 18:02

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