How do I kill a slime without it splitting?
Solution 1:
There are two commands to run: (I'm assuming you're playing on 1.13+ version)
/execute as @e[type=slime] run data modify entity @s Size set value 0
/kill @e[type=slime]
The first command turns all slimes in the currently rendered chunks into baby slimes, the second one just kills them directly.
Another approach is to teleport the slimes to void, it's simpler and you don't need to deal with any drops.
/tp @e[type=slime] ~ -100 ~
Solution 2:
You could teleport it far away or into the void. You could also preform multiple kill commands. Those are two ways of solving it. If you want the death animation then kill it then teleport all the slimes far away or into the void.
Solution 3:
So I see two solutions:
-
Have a pit of lava, or if its lava slimes a deep hole that they cant jump out of, or that goes through the bedrock, or a closed room they can't escape from and teleport them to that pit. Or even, teleport them below the bedrock, if possible.
-
or make a command that kills all slimes, and in a way just make it run every .25s for a few seconds. So the slime die, separate, and then the next instance of the run comes through and kills the separated. Running it like 10 times in a row you make sure to get through the invicibility frames they may have when they are separating.
-
Or, if you want to see the kill animation (and not see them die and die again), mix both things. Run the /kill, so the player can see them die, and small time later just teleport all of them to the trash room.
Both are a little botched solutions, but I don't think you can straight kill a slime without it separating.