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?
Best Answer
All you have to do is /kill @e[type=YourMob]
If you want to kill all mobs except yourself do:
1.12: /kill @e[type=!Player]
1.13: /kill @e[type=!minecraft:player]
Pictures about "How do I use the /kill command to ONLY kill mobs?"



Quick Answer about "How do I use the /kill command to ONLY kill mobs?"
How do you kill specific mobs in Minecraft?
Minecraft kill command But should you want to kill another player, use \u201c/kill <player>\u201d. And to kill a certain type of mob, \u201c/kill @e[type=mobType]\u201d.How do you kill all mobs with KILL command?
As stated above, you will just need to type /kill @e to kill everything in the game, including yourself. If you want to prevent yourself from killing additional entities make sure to exclude yourself and other entities from the command by typing \u201ctype=! player\u201d after you type @e.Kill Command Explained
More answers regarding how do I use the /kill command to ONLY kill mobs?
Answer 2
I have a similar problem in my world - how I resolved it was hooking up several command blocks to a hopper clock:

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.
Answer 3
You can do /kill @e[type=Slime] And you can do /gamerule doMobLoot false so they wont drop anything
Answer 4
It isn't that hard, but you don't actually need a Command Loop to get rid of the mobs. Simply do /gamerule doMobSpawning false and it will resolve it. After that, the only mobs that can still spawn are the ones spawned by you. 
With Command Blocks takes more time to do because have to do 2 commands.
First, do this command: /gamerule doEntityDrops false this command stops mobs from dropping items, then on the Command Block, set the command: /kill @e[type=mob].
This is what I know, and I hope I helped you.
Good luck with your map, hope to see it done and play it soon!?
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Anete Lusina, Brett Sayles, Sora Shimazaki, Vanessa Loring
