Select specific vanilla music track

Started by TheOriginalGoatMan2 on

Topic category: Help with modding (Java Edition)

Last seen on 07:49, 31. Aug 2024
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Select specific vanilla music track

I am attempting to make a utility mod, and one of the big features I was planning to do was adding a music disc for every vanilla soundtrack that didn't already have one. However, I've been met with a huge issue: you can't specify the vanilla .ogg you want to play from a music disc, only the event (music.creative, music.game, music.nether.soul_sand_valley, etc). The issue with this is that this does not cover every track. It chooses a random one from the event, plays it for a few seconds, and then stops it. Is there any workaround for this? I'm also not going to reupload every single vanilla .ogg file as part of the mod, that's way too much effort and will bloat the file size exponentially.

 

Playing music through procedures has the same issue, you are unable to choose a specific track. Procedures don't seem to have the issue where the music cuts off after a few seconds, however.

Last seen on 20:43, 20. Aug 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yeah, the built in sound…
Fri, 12/29/2023 - 12:32

Yeah, the built in sound system doesn't like referencing specific vanilla sounds. The two alternatives are to either download and reupload each of the music tracks you want to make a disc out of as new, individual tracks, (which takes up quite a bit of file space. You can either extract them yourself or use an external tool like MCAsset); or to use commands, which can reference specific tracks. However, since vanilla music discs don't use commands, you would then need to make some sort of custom disc system that runs a sound command instead of directly playing a sound. (Along with the associated logic for block breaking, stopping the sound, ejecting the disc, etc; which could also be complicated.) Neither option is ideal, but there might be a better way? There may be some sort of custom code you could use to replace the randomized sound reference with a call for a specific sfx, though I can't think of anything else in the game that would do this.