I'm having trouble detecting a block below the player when the player is riding a vehicle.

execute at @a if block ~ ~ ~ minecraft:rail run tellraw @s "Teste"

This command works only if the player is by foot.

I've tried adjusting the Y with no success.

1 Answer 1


If you press F3 + B while riding the minecard, you will notice your hitbox going bellow the block. Try detecing "above you" (higher ~Y). The following worked:

/execute as @a at @s if block ~ ~1 ~ minecraft:rail run say @s

Also, note that doing @s with only at @a will not work as exepected, make sure to add as @a before and use at @s instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .