I am building a musical chairs Minecraft map, and I was wondering if there is a way to kill all players who aren't riding in a minecart?
-
1You should usually not mark answers as accepted too soon, that discourages other answers. And especially in this case, the answer you marked as accepted does not actually solve the question properly (there are many cases where it fails), but there is indeed a straightforward, 100% working solution to what you want (which I'm writing currently).– Fabian RölingCommented May 6, 2020 at 7:09
2 Answers
The tag you're looking for is RootVehicle
:
/kill @a[nbt=!{RootVehicle:{Entity:{id:"minecraft:minecart"}}}]
The closest thing I can think of is setting up your minecarts like this (with the rails):
Then enter /execute positioned as @a if block ~ ~-1 ~ grass_block run kill @p
Replace grass_block
with your floor material (assuming that the material under the minecarts are the same).
When a player is in a minecart, the block under them will be the rail instead of the floor block (in this case, grass_block
). Those who are standing on the floor (the block under them is the floor block) will be killed.
However, there is only one problem. Players can survive by jumping. One solution is to make the whole room 2 blocks high, or to put barrier blocks above the players' heads.
-
I don't think you need to surround it with quartz slabs though. As long as the minecart stays in one spot.– fwooshCommented May 5, 2020 at 21:49
-
Is my English really that bad? Anyway, the quartz slabs were just for keeping it in place while I tried different things, I just didn't remove when taking the screenshot.– RyanCommented May 8, 2020 at 6:56