How do you make slimes not spawn randomly

Solution 1:

I see two simple ways of doing this:

  • Use /gamerule doMobSpawning false to disable spawning of all mobs in your superflat world.
  • Use a repeating command block to /tp @e[type=minecraft:slime] ~ -1000 ~, so that they don't split into multiple slimes.
  • Set the difficulty to peaceful.

Solution 2:

TL;DR; Use 2 repeating command blocks which contains the following:

  1. /kill @e[type=minecraft:slime]
  2. /kill @e[type=minecraft:item,name=Slimeball]

Apart from @ExpertCoder14's answer, you can also use another repeating command block with /kill @e[type=minecraft:slime].

Although this doesn't stop slime from spawning, it at least gets rid of it, though it could be a mess dealing with, because remember, there are slimeballs when slime are killed.

It is easily managed with another repeating command block with /kill @e[type=minecraft:item,name=Slimeball], and you can get rid of them.

Problem solved, no more slimes in the way.