Minecraft – How to combine the effects of both scanning a block under a player and if they’re holding an item

minecraft-commandsminecraft-java-edition

I'm attempting to create a map with a "lobby" of sorts that will contain rules and more. The issue, of course, is that it's going to be relatively long, so I am trying to make a "Dash" feather that will give Speed II to those holding it, so long as they're in the actual lobby.

The problem is, I'm not getting any results with the command execute as @a at @s if block ~ ~-1 ~ minecraft:smooth_quartz run execute if entity @a[nbt={SelectedItem:{id:"minecraft:feather",display:{Name:"\"text\":\"Dash\""}}}] run effect give @s speed 9999 2 true, and no errors are being reported by the command block for me to debug.

I'm assuming it's probably an issue with the {display:{Name:...}} tag, seeing as I've always had issues with that, but I can't figure any way to change that. I've tried everything from erasing the quote escapes in Name's value to changing the amount of curly brackets, but to no avail. I'm currently using 1.14 Pre-release 2.

Edit:// I've done some more work with different commands and I've found that it is in fact a problem with at least the second half of the execute command; on other command blocks, I can use the block detection part (execute as @a at @s if block ~ ~-1 ~ minecraft:smooth_quartz run <command>) perfectly fine.

Best Answer

Found out the issue was that {display:{Name:...}} is not standalone. It also requires the {tag:...} NBT wrapping it, causing the command not to work correctly because there is no display tag by itself.