Songs - skyjay1/GreekFantasy GitHub Wiki
Introduction
Users can change or add their own songs using datapacks. This is done by providing a datapack with a JSON file for the song that is added or changed. The JSON file must be located at data/[modid]/songs/[song_name].json
. The JSON file must specify:
Name
name
("translation.key"): text containing either the name of the song or a translation key to the name of the song
- Example:
"name": "song.mycoolsong.name"
(looks up translation key "song.mycoolsong.name") - Example:
"name": "My Cool Song"
(translation not supported)
Credits
credits
("translation.key"): text containing either the author(s) of the song or a translation key to the author(s) of the song
- Example:
"credits": "song.mycoolsong.credits"
(looks up translation key "song.mycoolsong.credits") - Example:
"credits": "2020 John Doe"
Speed
interval
(number) the number of ticks between playing each note
- Example:
"interval": 5
(results in 20/5=4 notes per second)
Length
length
(number) the number of notes in whichever array is longer (treble or bass)
- Example:
"length": 126
- Optional in 1.18+
Treble
treble
(array): all of the notes to play at full volume. Values are 0-24. Notes with a value of 0 will not be played.
- Example:
"treble": [ 0,0,0,0, 11,15,17,0, 11,15,17,0, 11,15,17,22, 20,0,17,18, 17,13,10,0, 8,10,13,10, 0,0,0,0 ]
Bass
bass
(array): all of the notes to play at half volume. Values are 0-24. Notes with a value of 0 will not be played. If the array is shorter than the specified length
, the remaining notes are filled in with 0s.
- Example:
"bass": [ 2,9,2,9,2,9,2,9, 3,8,3,8,3,8,3,8 ]
Example Song JSON
Here is a full example of a valid song JSON, this one located at data/greekfantasy/songs/annoying.json
{
"name": "song.the_worst_song.name",
"credits": "Me, Myself, and I",
"interval": 2,
"length": 32,
"treble": [
0,0,0,0, 11,11,11,11, 15,15,15,15, 17,17,17,17, 20,20,20,20, 22,22,22,22, 24,24,24,24, 0,0,0,0
],
"bass": [
2,9,2,9, 2,9,2,9, 3,8,3,8, 3,8,3,8, 2,9,2,9, 2,9,2,9, 3,8,3,8, 3,8,3,8
]
}
Resources
Note: The lowest F# (0) cannot be played because 0 is interpreted as "no note"