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.
run execute
" can just be deleted. Did you try the item detection alone? You can also throw the item on the ground and execute/data get entity @e[type=item,sort=nearest,limit=1]
to see its NBT data.{display:{Name:...}}
section, I also have to wrap it in the{tag:...}
NBT, hence why it wasn't working since there is no NBT tag "display" by itself on entity "item".#minecraft:stick
. I'm trying to find a way to now remove the effect if they aren't on the block so that I don't have to wait the 1 second I changed the duration to#
means that what follows is a tag, like "#minecraft:wool", which allows you to do "execute if block ~ ~-1 ~ #wool
instead of one command withexecute if block ~ ~-1 ~ blue_wool
, one withexecute if block ~ ~-1 ~ green_wool
and so on. By default there is not "stick" tag, but you could add one with a data pack. For removing the effect when they are no longer on the block, just change "if" to "unless".