Minecraft – How to check if a player is in the air with /testfor

minecraft-commandsminecraft-java-edition

I'm interested in negating fall damage with command blocks by giving players Resistance as they're falling. How can I use /testfor to tell whether a player is on the ground or in the air?

Best Answer

Try this:

testfor <player> {OnGround:1b}

Tests for specified player on the ground, then make a comparator to a NOT gate (Block with a redstone torch on it)