How Would I go About Making Custom Code to Check if a Jukebox is Playing Music?

Started by Artistmonster24 on

Topic category: Help with modding (Java Edition)

Last seen on 21:34, 5. Sep 2021
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How Would I go About Making Custom Code to Check if a Jukebox is Playing Music?

       I made a post in the past about "how to sense if a jukebox is playing music" and learned that I would need to do some custom coding. The problem is, I don't know where to begin! I am trying to make it where on my mob's update tick, if it senses a jukebox playing music, it plays a custom animation. How would I do this with custom code? Thanks for your time.

Last seen on 15:38, 1. Dec 2022
Joined Oct 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The jukebox has an NBT tag…
Fri, 02/12/2021 - 14:14

The jukebox has an NBT tag called RecordItem.
RecordItem has mostly 2 sub-tags: id and Count.

Jukebox has the following data:
{ x: ?, y: ?, z: ?, RecordItem: { id: "minecraft:music_disc_11", Count:1b } }

You could check for these NBT tags.

I hope I could help you even a little bit :)