I know it’s possible to make command blocks that only activate when a certain item is used, but I don’t know how to do it. Any advice? The item in question is a goat horn by the way.

  • RoscoeSFOPB
    link
    fedilink
    English
    arrow-up
    1
    ·
    10 months ago

    Is there a way to set it up so it only activates if a item with a specific name is dropped or set it up so only the person who dropped the item is teleported?

    • PositionAcrobatic769B
      link
      fedilink
      English
      arrow-up
      1
      ·
      10 months ago

      Yes you can

      /execute as u/a[distance=…2] if entity u/e[type=item,nbt={Item:{id:“minecraft:(item)***“,tag:{display:{Name:'{“text”:”***(Your Item Name)”}'}}}}] run tp u/s ~ ~ ~

      u can also if player drop the item. The item destroy and get back
      Detect when a player drops an item:
      /execute as u/a[nbt={SelectedItem:{id:“minecraft:(item)***“,tag:{display:{Name:'{“text”:”***(Your Item Name)”}'}}}}] at u/s run tp u/e[type=item,sort=nearest,limit=1] ~ ~ ~

      Destroy the item:
      /kill u/e[type=item,sort=nearest,limit=1]

      I don’t know if it’s work in multiplayer, please verification the command