2

Recently, Minecraft had removed the /testfor command, which broke these sets of commands that I was trying to execute today.

/testfor @p[r=10] {SelectedItem:{id:"minecraft:feather",tag:{display:{Name:"Roc's Feather",Lore:[Jump higher using this feather.]}}}}`

Now normally, from Minecraft 1.13 onwards, the new /execute command would've been the replacement for the /testfor command, but as I soon found out, the command failed to detect my Roc's Feather and thus could not execute an /effect command that gave me a Jump Boost, for 1 second, at level 3.

I tried remaking my feather from scratch with this command here:

/give @p minecraft:feather{display:{Name:"{\"text\":\"Roc's Feather\",\"color\":\"light_purple\",\"bold\":true,\"italic\":true,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false}",Lore:["{\"text\":\"Jump higher using this feather.\",\"bold\":false,\"italic\":true,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false}"]}} 1

But the execute command I placed did not detect this type of uniqueness.

/execute if entity @p[distance=10,nbt={SelectedItem:{id:"minecraft:feather",Count:1b,tag:{display:{Name:"{\"text\":\"Roc's Feather\",\"color\":\"light_purple\",\"bold\":true,\"italic\":true,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false}",Lore:["{\"text\":\"Jump higher using this feather.\",\"bold\":false,\"italic\":true,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false}"]}}}}] run effect give @s minecraft:jump_boost 1 3 true

Can somebody tell me what I'm doing wrong here because I cannot even tell what's the issue.

  • Why would you want to use r=10000000000? I'm pretty sure the lore also previously had to be in quotation marks. Can you reduce the command to the minimum reproduction example, please? It's extremely long, with such a length a simple typo is the most likely cause for every error. – Fabian Röling Mar 26 at 21:30
  • Lowered the distance numbers for you. – Scorbunny Mar 27 at 2:52
  • Just out of curiosity, how were you targeting the player that is holding the feather, or was this intended to be single player only? I ask because I previously would have done this with scoreboard tags, and that method, for the most part, would not need to be changed with 1.13. Also, I have a general distaste for using testfor. – MBraedley Mar 27 at 14:45
  • Zelda map. Nice. – inakilbss Apr 2 at 13:26
3

One thing you might try in that final command is to change it from saying @a[distance=10] to @a[distance=..10] because in 1.13 they changed it so that ..10 is less than 10, 10 is exactly 10, and 10.. is greater than ten, with 1..10 being between 1 and 10. So unless you are exactly 10 blocks away nothing will happen.

1

there are three things actually;

  1. keep in mind that you also need quotes around your text formatting, eg; {\"bold\":\"true\"}.
  2. you don't necessarily need to add formatting if they're false; those tags don't exist if they're false, really, and just clog up your text.
  3. currently, saying distance=10 is looking for everyone at exactly 10 blocks. if you want people at more than 10, you need 10.., and for less, ..10.

hope this helps!

  • I tried your method. Unfortunately the command block wasn't able to detect my feather despite the changes I made that I followed. – Scorbunny Apr 22 at 12:47
1

I was pretty obsessed with this problem so I did some tinkering.

I eventually whittled down to the command:

/execute as @p[distance=..10,nbt={SelectedItem:{id:"minecraft:feather"}}] run effect give @s minecraft:jump_boost 1 3 true

This includes suggestions from the other answers, but there are a few notable changes here. Firstly note that I'm not using the complete name of the item, for the sake of quick debugging.

Nextly, I wasn't sure what a count:1b meant, rather than 1, so I eliminated it. I'd love to know.

Most importantly, I changed from execute if entity @p[...] to execute as @p[...]. I did this because I noticed that in the latter half of the execute command (run effect give @s ...), that there is the @s target. This fails because the executor of the command is the command block, not the player. As @s gives the effect to the caster (here the command block), no player receives the effect. I changed the former half of the command (execute if entity ...) to execute as @p[...] here to make the player into the caster, effectively making @s the player.

I was further tempted to then try the simplified command, which was successful:

/effect give @p[distance=..10,nbt={SelectedItem:{id:"minecraft:feather"}}] minecraft:jump_boost 1 3 true

The distance constraint seems excessive at this point, but I left it for creator's sake.

Thank you for loving one of my favourite games, Link's Awakening, and for inspiring me to help bring the spirit of LA into my Minecraft world. I hope to see great content from you in the future.

New contributor
Samuel Waggoner is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • After more research, I've learned a few more things: For the count, 1b is the formally correct way to specify a count of 1. The 'b' indicates that the number is in the bytes format, rather than an integer. – Samuel Waggoner Jun 14 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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