Minecraft – Check if player is not in the air or on a specific block

minecraft-commandsminecraft-java-edition

In Minecraft 1.14.4, I was wondering if it was possible to use a command block to execute if a player is neither on a specified type of block or in the air.

For instance:

/execute if entity @p ~ ~-1 ~ (is not grass or air) run ...

If you need clarification on my question feel free to ask.

Best Answer

/execute if entity is for checking for entities. /execute if block is for checking for blocks. So you want /execute at @a unless block ~ ~-1 ~ air unless block ~ ~-1 ~ grass ….