Music Player
JoyMart includes a built-in background music player that plays NBS (Note Block Studio) songs through Minecraft's native note-block sounds — no resource pack required.
How it works
- Songs are loaded from
.nbsfiles in theplugins/JoyMart/music/directory - The
NbsSongparser extracts the tempo and per-tick notes - A per-player scheduled task advances one NBS tick at a time (paced by the song's tempo)
- Each note is played through
Player#playSoundusing Minecraft's built-in note-block sounds (e.g.BLOCK_NOTE_BLOCK_HARP,BLOCK_NOTE_BLOCK_BASS, etc.) - Each player has their own scheduled task and playback state, so different players can listen to different songs simultaneously
NBS tempo and tick scheduling
- NBS tempo is stored as ticks-per-second × 100 (so
1000means 10 tps) - The server runs at 20 ticks/second, so one NBS tick takes
2000 / temposerver ticks - That ratio is rounded to the nearest whole tick and used as the
runTaskTimerperiod - Tempos up to 2000 (20 tps) are exact; higher tempos play slightly slower (rounded up to 1 server tick per NBS tick)
WARNING
Because the server is fixed at 20 ticks/second, songs with a tempo above 2000 (i.e. 20 tps) cannot be reproduced exactly — actual playback will be slightly slower than the configured value.
Adding songs
- Obtain
.nbsfiles (created with Open Note Block Studio or similar tools) - Place them in the
plugins/JoyMart/music/directory - Restart the server or run
/gba reload - Players can access the music player GUI from the JoyMart main menu
Music Player GUI
- Accessed from the JoyMart main menu
- Shows a list of loaded songs
- Players can play, stop, and switch songs independently
- Song names fall back to the file name (without extension) if the NBS file has no in-file title
TIP
Each player's playback state is independent, so multiple players can listen to different tracks at the same time without interfering with each other.
Inspiration
The music player was inspired by JukeBox - Music Plugin. JoyMart's implementation is independently written from scratch — NBS parsing, per-player scheduling, and the GUI are all original code.