Trying to have a levitation effect applied to any player when and only when that player holds a specific item (in this case, a renamed feather). Pre-1.13 it worked using a string of command blocks that tagged a player using scoreboards and applied the effect to that player, but like many of the command blocks in this world, the 1.13 update broke them. I realised that I should be able to use the execute if command, but I cannot seem to get it to work - it seems to either apply it to the player closest to the command block (even when another player is the only holding the item) or it applies it to all players.

Command currently looks like this:

execute if entity @a[nbt={SelectedItem:{id:"minecraft:feather",tag:{display:{Name:"\"Levitator\""}}}}] run effect give @p minecraft:levitation 1 4

I tried modifying that by nesting it with various combinations of execute as and execute at, but it still seemed to have the same issues (it would always execute relative to the command block not the player).

Any ideas on how to get this to work?

  • I know you have to use /execute as @a if entity @s[nbt={allYourNbt}] run YOUR COMMAND. I'm not sure if the format of the name should be changed, since those are json components in 1.13 iirc. But at least you can try my first suggestion.
    – D-Inventor
    Commented Oct 6, 2018 at 8:48

1 Answer 1


Currently your command says "if anyone is holding the item, apply levitation to the nearest player.". Instead, you can put your first selector in the effect command, so that it applies levitation to the players holding the item:

effect give @a[nbt={SelectedItem:{id:"minecraft:feather",tag:{display:{Name:"\"Levitator\""}}}}] minecraft:levitation 1 4

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