I was tired of the sheer mass of bats I had in my intentionally dimly lit tunnel, so I typed in that command. Then I died. Then I saw that all my pets and animals were also gone. I'm playing in 1.14.2, is there a bug I do not know of or am I doing it wrong?
Minecraft – Why does kill @e[type=!minecraft:bat] kill every mob
minecraft-commandsminecraft-java-edition
Related Topic
- Minecraft – How to get minecraft’s accurate ‘x’ and ‘y’ rotations
- Minecraft Bedrock Command block selecting a target with coordinates syntax help
- Minecraft – Chunks and Redstone
- Minecraft – How to test for a named barrel/chest? (1.14.4)
- Minecraft – Add sounds to a resource pack, not replace them
- Minecraft – The paragraph symbol to change text color in Minecraft won’t appear
Best Answer
Your selector,
@e[type=!minecraft:bat]
includes a!
, which inverts the selection. In this case, the kill command killed every entity that was not a bat, when you really wanted@e[type=minecraft:bat]
. Unfortunately, unless you have a backup, there's no real way to recover from this as far as I know.