A simple Dragonfly-MC plugin that lets players load and play Note Block Studio (.nbs) songs in-game.
- The limitation for note keys below F#3 has been resolved. You can now play low-pitched notes without any problem.
- You can now control the note volume using the velocity property (see JSON examples).
- The
PlaySoundmethod has been updated to use direct packet session writing, allowing packets to be sent directly to the player.
- Import the package, and make sure there is a
noteblockfolder in your project directory:
package main
import (
_ "github.com/redstonecraftgg/df-noteblockplayer"
// other imports
)- Put your
.nbsfiles or JSON files (you can create these with NoteblockParser) inside thenoteblockfolder.
You can play songs in two ways:
- To play a song, use
/playnoteblock <your file name>. You can also use/playnbor/pnbas shortcuts. - To stop the song, use
/stopnoteblock. Shortcuts are/stopnband/snb.
You can also play a song from your code with the PlayNoteblock() function:
err := PlayNoteblock(p.H(), "my_song.nbs")
if err != nil {
// handle error
}To stop a song, you can use the StopNoteblock() function. You can also use the lower-level stopSong(eh *world.EntityHandle) function if needed.
success := StopNoteblock(p.H())
if success {
// The song was successfully stopped
} else {
// No song was playing
}- Playing custom noteblock instruments from resource packs is not yet supported (this feature may be added in a future version).