1

In Minecraft 1.12, I'm trying to destroy all mobs and items in a volume, but not players. So far, I have the following command, but in my test world, it won't necessarily kill all mobs, especially slimes spawned as a result of killing larger slimes:

/kill @e[x=1000,z=-2500,dx=10,dz=-10]

Can anyone advise?

Clarification: I mean that when I use the kill command to kill a slime, the resulting smaller slimes seem invulnerable to subsequent kill commands. I don't feel that should be the case. Also, I'd love to use coordinates relative to the command block if possible. And my command does not despawn loose items.

The context is that I'm trying to build a Tardis-like structure that uses commands and structure blocks. But when I replace the structure with a similar volume of air, the chests leave items behind and the mobs also stay behind. I'm hoping to save the structure (including mobs), delete entities (items and mobs), then replace with air to make the structure disappear cleanly.

UPDATE: I'm now using this command:

kill @e[type=!minecraft:player,x=1000,z=-2500,dx=10,dz=-10]

I realized I can't precede it with a slash for it to work in a command block. Don't know why it killed the first time and not subsequent times before, but now it kills every time, including slimes. It still doesn't destroy loose items, though. Any tips? Also, can I do coordinates relative to the command block?

3

Smaller slimes spawn after the big ones die, so you have to kill them again afterwards. The same applies to items. The alternative would be to teleport them under y-level -64, that way they are instantly deleted.

  • What I mean is that when I use the kill command to kill a slime, the resulting smaller slimes are invulnerable to subsequent kill commands. I'll try to edit and clarify the question. I didn't think of teleporting them into the void. Good idea! – awpulley Jul 16 at 2:43
  • You need to wait a little bit before killing the new ones, I think they only spawn after the death animation of the bigger one ends. That's one second or so, I wasn't able to measure it properly and the wiki doesn't mention it. – Fabian Röling Jul 16 at 5:56
1

If you don't want the slimes to spawn ever again you should first disable mob spawning using /gamerule doMobSpawning false and then execute the kill command in a repeating command block for about 30 seconds (or infinitely if you prefer). Please do note that the gamerule command will disable the mob spawning for the whole world.

EDIT: I did not notice 'but not players.' The kill command would be

/kill @e[type=!minecraft:player,x=1000,z=-2500,dx=10,dz=-10]
  • Thanks for the !minecraft:player bit! – awpulley Jul 16 at 2:45
1

What I do if I don't want to kill me but do want to kill everything else is drink a potion of fire protection and then dig a hole filled with lava and a ladder leading out at the side. I then do a /tp @e ? ? ? and then climb up the ladder because I'm fireproof.

  • Trying to do this with just commands, but thanks! – awpulley Jul 16 at 2:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.