1

The command works in chat but not in a repeating, always active command block. I even set the block to "requires redstone" and back to always active to try and fix it. The command in question is

/execute as @p[tag=Soda,hasitem={item=bow,location=slot.weapon.mainhand}] run execute if block ~ ~-1 ~ air run effect @e[r=10] slow_falling 1 1 true

The error message in the command block says:

Failed to execute 'execute' as {my username}

2
  • Question closed. Nobody has answered and I have given up. I know it's not a case of people not seeing the question because multiple people have suggested edits and approved of those edits with mod power without a single person answering the question. Jun 15, 2023 at 15:56
  • It's been 18 hours and the question has 16 views. People aren't always available all the time. Have a little faith.
    – Corsaka
    Jun 15, 2023 at 16:18

1 Answer 1

1

The check if block ~ ~-1 ~ air is done relative to who/what executes the root command. When executed from a command block with a block below it, the check will always fail.

To do the check relative to the selected player, add at @s after as @p[tag=Soda,hasitem={item=bow,location=slot.weapon.mainhand}]:

/execute as @p[tag=Soda,hasitem={item=bow,location=slot.weapon.mainhand}] at @s run execute if block ~ ~-1 ~ air run effect @e[r=10] slow_falling 1 1 true

Or, simplified to one execute:

/execute as @p[tag=Soda,hasitem={item=bow,location=slot.weapon.mainhand}] at @s if block ~ ~-1 ~ air run effect @e[r=10] slow_falling 1 1 true

You must log in to answer this question.

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