
Get Current Song
This simple FabricMC mod provides the ability to find out which musical composition is currently playing in Minecraft using special commands.
Available Commands
The mod adds two useful commands to the game:
/getsong
— displays detailed information about the current melody, including its title and author/getsongid
— shows the identifier of the playing composition
It's worth noting that similar information can be viewed on the debug screen (F3).
For Resource Pack Developers
If your resource pack contains custom music, it's recommended to add information about the compositions to the getcurrentsong/song_names.json
file. The structure of the JSON object looks as follows:
{
"name": "composition title (required string parameter)",
"composer": "composer's name (required string parameter)",
"soundtrack": "album title (optional string parameter)",
"trackNumber": "track number in album (optional numeric parameter)"
}
Important: if the album title is specified, the track number must also be specified, and vice versa.
For Mod Developers
To connect this mod's API via Gradle, add the following lines to your build.gradle
:
repositories {
// Other Maven repositories can be located above or below the Modrinth repository
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}
dependencies {
modApi "maven.modrinth:getcurrentsong:1.0.1"
}
After connecting the API, you'll be able to get information about musical compositions from resource packs using the following methods of the SongNameDatabase
class (package io.github.gaming32.getcurrentsong
):
SongNameDatabase#isInitialized
— returnstrue
if information about compositions is loaded. Attempting to read from the database when the value isfalse
may lead to incorrect resultsSongNameDatabase#getSong
— gets data about a composition by name or identifiernet.minecraft.util.Identifier
, returning aSongNameDatabase.SongInfo
object ornull
if the composition is not found in the database