1

Command block help

andreTdigital's Avatar andreTdigital7/19/19 2:27 am
1 emeralds 162 5
7/20/2019 5:30 am
HoboMaggot's Avatar HoboMaggot
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's Avatar
andreTdigital
Level 4 : Apprentice Collective
19

Create an account or sign in to comment.

5

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

Website

© 2010 - 2024
www.planetminecraft.com

Welcome