0

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.

5
  • 2
    In 99.9% of cases "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. Commented Apr 13, 2019 at 1:44
  • No, I had not tried the data detection alone. Let me try that command and the item detection really quickly.
    – xTerrene
    Commented Apr 13, 2019 at 2:13
  • Aha! I have found the issue; apparently, for the {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".
    – xTerrene
    Commented Apr 13, 2019 at 2:16
  • Do you, by chance, know what the pound sign in front of item/block names mean? For example; #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
    – xTerrene
    Commented Apr 13, 2019 at 2:30
  • 1
    You can write an answer yourself and mark it as accepted if your original problem is solved, not many people read the comments. The # means that what follows is a tag, like "#minecraft:wool", which allows you to do "execute if block ~ ~-1 ~ #wool instead of one command with execute if block ~ ~-1 ~ blue_wool, one with execute 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". Commented Apr 13, 2019 at 11:31

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.