Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How do I make an item that gives potion effects when held?

Writer Mia Lopez

I want to have a clock where if it is held, you turn invisible. I know it has something to do with tags and whatnot, but I can't seem to wrap my head around it. Everything I try fails.

I am in Minecraft 1.15.2.

1

1 Answer

For only curtain clocks make you invisible:

Put into an active repeating command block:

/execute as @a[nbt={SelectedItem:{id:"minecraft:clock",Count:1b,tag:{makesYouInvisible:1b}}}] at @s run effect give @s minecraft:invisibility 2 0 true

To give yourself the clock that will make you invisible:

/give @p minecraft:clock{makesYouInvisible:1b} 1

For every clock make you invisible:

Put into an active repeating command block:

/execute as @a[nbt={SelectedItem:{id:"minecraft:clock"}}] at @s run effect give @s minecraft:invisibility 2 0 true
1