How do I use the /kill command to ONLY kill mobs?

I have a Redstone Power loop that connects to a Command Block that is set to kill all entities except for myself (/kill @e[type=!Player]), because I’m building a creative map, but don’t want slimes all over the place. Problem is if I want to place an Item Frame than the Command Block kills it.

So, is there anyway to exclude items from getting deleted, or make it so it will only target mobs?

  • Does the last villager trade allways boost your reputation in village?
  • Why is =! not working in testfor command?
  • Is there an SMP Server Command to change weather conditions?
  • How do I power Redstone through a block?
  • What's the best way to protect your house from Endermen stealing your walls?
  • What's the point of leveling up in Minecraft?
  • How do I add plugins to my Bukkit SMP server?
  • Is there a faster and more reliable way to install a mod?
  • How do I give myself a specific sword using commands?
  • io.netty.channel.ConnectTimoutException when connecting to Mineplex
  • Minecraft save-all timer
  • How do I find slimes in Minecraft?
  • 4 Solutions collect form web for “How do I use the /kill command to ONLY kill mobs?”

    The simplest way to handle this is with a gamerule. If you don’t want any mobs bothering you in your creative world, just turn off spawns with /gamerule doMobSpawning false. No mobs will spawn, which will allow you to have a quiet creative world, free from cows, pigs, sheep, chickens, slimes, etc, while also allowing yourself to do science on mobs at will. Mobs will spawn only when you want them to.

    If you’re really committed to the idea of doing this with /kill, however, you can do this one of two ways. You can set up individual command blocks to kill each type of mob, which might be a small set of command blocks if your main problem is slimes.

    Alternatively, you can use the methods described in this answer to select exceptions. It uses a scoreboard to set a score for all entities to 1, and simultaneously sets the score of all exceptions to 0. From there, you can select the set of all mobs excluding any exceptions you want with @e[score_select_min=1].

    The simplest and most flexible way to keep slimes from bothering you though is to turn off mob spawning altogether.

    All you have to do is /kill @e[type=YourMob] , and if you want to kill all mobs except yourself, do /kill @e[type=!Player].

    I have a similar problem in my world – how I resolved it was hooking up several command blocks to a hopper clock:

    enter image description here

    Each command block contains a command to kill a certain enemy type:

    /kill @e[type=Slime,r=60]

    I only need to worry about zombies, zombie villagers, creepers, skeletons, endermen, spiders, and witches; so I only have 7 command blocks hooked up here. You’re welcome to hook up as many more as you see fit.

    You can do /kill @e[type=Slime]
    And you can do /gamerule doMobLoot false so they wont drop anything

    We love Playing Games, especially Video Games.