1

Command block help

andreTdigital •7/19/19 2:27 am
•
260
•
7/20/2019 5:30 am
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.
Posted by
andreTdigital
Level 4 : Apprentice Collective
18

  Have something to say?

Join • Sign in

5

HoboMaggot
• 07/19/2019 3:32 am
• Level 56 : Grandmaster Blob
/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
2
CrazyCowMM
• 07/19/2019 11:33 am
• Level 54 : Grandmaster Cowboy
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
1
andreTdigital
• 07/20/2019 12:41 am
• Level 4 : Apprentice Collective
you think this command will work on console?
1
HoboMaggot
• 07/20/2019 5:30 am
• Level 56 : Grandmaster Blob
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
1
CrazyCowMM
• 07/20/2019 1:36 am
• Level 54 : Grandmaster Cowboy
It should work in functions, command blocks and anywhere else as long as you're 1.13+
1

Welcome