Boss Music - Skizzium/Project-Lib GitHub Wiki

What's a boss battle or a boss without music? Boring, that's what it is. That's why Boss Utilities adds the option to have a looped boss theme that is bound to the boss bar. The plan is to add on to this very small system bit by bit and eventually add a custom sound engine that will synchronize your music across all players. How cool is that?

Usage

"Ok, but how do I use it?", I hear you asking. It's very simple! All you need to do is set the boss event property for music to the desired music (It needs to be a SoundEvent. The rest is handled by the library). Here's an example for ya:

private final PL_ServerBossEvent bossBar = new PL_ServerBossEvent(this, this.getDisplayName(), new PL_BossEvent.BossEventProperties().music(SoundEvents.MUSIC_DISC_PIGSTE).color(PL_BossEvent.PL_BossBarColor.PINK));

In our example, we're making a new pink boss bar which uses the vanilla SoundEvent for the Pigstep music disc. If you want to change the music depending on something else, you can always call PL_ServerBossEvent#setMusic and pass your new SoundEvent. If you just want to stop the music altogether, you can pass null and, thanks to our dark magic, the game won't crash!