How do I make an item to make a sound once it equipped in main hand or off-hand?

Started by BeePlay on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make an item to make a sound once it equipped in main hand or off-hand?

I am doing new mod now and I need to do an item that does a sound if it equipped in main hand or off-hand. How do I do that?

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try using the "Play sound"…
Wed, 07/09/2025 - 16:44

Try using the "Play sound" block in the "While item is in inventory ticks" procedure, where you monitor the presence of the item in your main hand and offhand using an NBT variable.

When you're holding the item and the variable is false, play the sound and set the variable to true. When you're no longer holding the item, set the variable to false.