What is the command to kill all mobs?
I'm building a mini-game on a flat world and slimes are spawning on it. They keep setting off TNT and other traps, forcing me to rebuild every time.
What is a command that I can use to kill all mobs?
Best Answer
Set the difficulty to peaceful in the options menu
Pictures about "What is the command to kill all mobs?"



Kill Command Explained
More answers regarding what is the command to kill all mobs?
Answer 2
Type and enter /gamerule doMobSpawning false
Answer 3
If you're willing to start a new superflat world, you can create custom superflat terrain that doesn't consist of 4 layers. The reason why slimes spawn so often in superflat worlds is because you're actually really close to the void.
If you generate a new superflat world that starts at Y level 64, you won't have any slimes spawn.
Answer 4
If you want to kill every single entity, then do this:
/kill @e
Just slimes? Do this:
/kill @e[type=minecraft:slime]
Don't want the death animation or for them to split? Do this:
/execute at @e[type=minecraft:slime] run tp @e[type=minecraft:slime] ~ -1000 ~
I can't take credit for that last tp command, credit for that goes to ExpertCoder14
Answer 5
Put this in a command block ( /kill @e[type=Slime] ), put the command block on repeat, and then place a redstone block next to it.
Answer 6
There are a variety of ways to stop slimes from spawning in your area:
- Turn the game difficulty to Peaceful. (Not suggested if you have other hostile mobs to be used in the traps.)
- Check out my answer here on removing slimes on a superflat world.
Answer 7
Do /kill @e to kill all entity including dropped items, started TNTs, arrows, yourself and minecarts.
Do /kill @e[type=minecraft:slime] to kill all slimes.
Do /kill @e[type=!minecraft:player] (not !=) to kill everything that is not a player. Note that this removes started TNTs, arrows, minecarts and dropped items too.
EDIT:
- If you only want to kill every living creature except player, do
/gamemode peacefulor/gamerule doMobSpawning falseas suggested in other answers. - Also suggested by others, if you do not want the slimes to split after killing them or other mobs leaving lots of dropped items on the ground, use
/execute at x run tp x ~ -1000 ~wherexis one of@e,@e[type!=minecraft:player]or@e[type=minecraft:slime]or other choices you may choose. - Do
kill @e[distance=..r]to kill everything within the radius ofr. This can be helpful if you are only playing games in a certain area.
NOTE:
- These commands are tested in 1.16.4, Java Edition. BUT NOT ANY ELSE VERSIONS.
Answer 8
Put this in a command block:
/kill @e [type = Slime]
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Ivan Babydov, Anete Lusina, Brett Sayles, Ivan Babydov
