How to Detect Blocks Below the Player in Minecraft
Minecraft Java Edition 1.21+ and 26+ – Execute Command to Detect Blocks
Want to automatically detect which blocks are below players in Minecraft?
In this tutorial, you will learn how to use the execute if block command to check blocks under each player individually.
Perfect for creating automatic effects, traps, minigames, and custom systems using Command Blocks on Java Edition 1.21+ and 26+.
To detect blocks below each player, run the following command for every player individually
execute as @a at @s if block ~ ~-1 ~ minecraft:redstone_block run effect give @s minecraft:slowness 1 1 true
You can place this in a Repeat command block set to Always Active
This way, the check is constantly performed, and the effect command at the end is applied to the player who steps on a redstone block
Simply replace it with any block of your choice and, after run, use any command you want