Inflict damage when player is hit by minecart
Is it possible to test when a player gets hit by a minecart, then inflict damage on the person hit by the minecart based on the speed of the minecart? If testing for the speed of the minecart isn't possible, that's okay. This is as far as I got with this:
/testfor @e[type=MinecartRideable]
Obviously, this command block would be running on a constant redstone loop, and would feed into the command block testing for the player, then into the command block that does damage to the player, unfortunately, I just can't figure out how to test for the player in the same location as the minecart. Does anyone know how to do this? Is it possible? As always, any help is appreciated, thanks!
Pictures about "Inflict damage when player is hit by minecart"



Do you take damage from Minecarts?
With no armor on, and no potion effects, a minecart at top speed would instantly kill a player when hitting them. As with all damage, armor and enchantments can reduce this. Slower minecarts do less damage, and if the cart is going at about walking speed it doesn't do damage at all.How do you use commands to damage a player in Minecraft?
If a minecart is pushed onto or falls onto tracks, it "snaps" to those tracks. When riding a minecart, if the minecart lands on a rail, the player does not take any fall damage.Do entities in Minecarts take fall damage?
To damage a player, set that player's damage scoreboard to how much damage you want to apply(negatives heal players), then run the function editor:deal_damage as the player you want to damage and you are done.20 Ways To Defeat The Warden
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Andrea Piacquadio, Alexander Suhorucov, RF._.studio, Pixabay
