1
Command block help
i was just wondering what command would you use if you wanted to give status effects to someone if they're holding a certain item. for example, if you hold a rabbits foot in your hand, you'll gain jump boost.
Create an account or sign in to comment.
5
2
/execute if entity @a[nbt={SelectedItem:{id:"minecraft:rabbit_foot",Count:1b}}] run command
or
/execute as @a[nbt={SelectedItem:{id:"minecraft:rabbit_foot",Count:1b}}] at @s run
or
/execute as @a[nbt={SelectedItem:{id:"minecraft:rabbit_foot",Count:1b}}] at @s run
1
I would recommend the second one, because in your effect commands(I'll be using your example) you can do effect give @s jump_boost 1 2 and it will only effect the player who is holding the rabbits foot, making the command multiplayer friendly. The first command works fine, but even if you don't play on making your map multiplayer compatible, someone will player it with two players and it's always best to offer the most support possible for that.
(full command would be /execute as @a[nbt={SelectedItem:{id:"minecraft:rabbit_foot",Count:1b}}] at @s run effect give @s jump_boost 1 2
(full command would be /execute as @a[nbt={SelectedItem:{id:"minecraft:rabbit_foot",Count:1b}}] at @s run effect give @s jump_boost 1 2
1
you think this command will work on console?
1
Basically what CrazyCow means is that it doesnt work on console, only on Java.
This is due to no nbt support for console/bedrock edition
This is due to no nbt support for console/bedrock edition
1
It should work in functions, command blocks and anywhere else as long as you're 1.13+