Minecraft – Destroy all entities in a volume in 1.12

minecraft-commandsminecraft-java-edition

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?

Best Answer