Channel Icon

Crazy Ozz

Official Channel Website

Command Block

How to Detect if a Player is Sneaking in Minecraft

Minecraft Java Edition 1.21+ and 26+ (Execute Command Sneak Detection)

In this tutorial, you will learn how to detect if a player is sneaking in Minecraft Java Edition 1.21+ and 26+ using the /execute command. This method is perfect for creating automatic systems such as effects, messages, secret doors, minigames, and custom mechanics that activate when the player crouches.

Use the command below to detect when the player is sneaking, based on the eyes being "lower than normal".

execute as @a at @s anchored eyes positioned ^ ^ ^ positioned ~ ~-1.27 ~ if entity @s[distance=..0.1] run say I'm sneaking!

Remember that it is executed for all players.

And you can place any command you want after run.

Discover CastroTools

Looking for more online tools? CastroTools offers a JSON formatter, QR code generator, image and audio converters, password generator, calculators, and much more, all free and easy to use.

🚀 Explore CastroTools

Still have questions? Watch the video below