finally music actionbar fix

This commit is contained in:
ChomeNS 2022-11-29 20:26:20 +07:00
parent 48d54532a5
commit fbec2003be

View file

@ -45,12 +45,12 @@ function inject (bot) {
if (!bot.music.queue.length) return
bot.music.song = bot.music.queue[0]
time = Date.now() - startTime
bot.core.run('minecraft:title @a[tag=!nomusic] actionbar ' + JSON.stringify(toComponent()))
while (bot.music.song.notes[noteIndex]?.time <= time) {
const note = bot.music.song.notes[noteIndex]
const floatingPitch = 2 ** ((note.pitch - 12) / 12.0)
bot.core.run(`minecraft:execute as @a[tag=!nomusic] at @s run playsound ${soundNames[note.instrument]} record @s ~ ~ ~ ${note.volume} ${floatingPitch}`)
noteIndex++
bot.core.run('minecraft:title @a[tag=!nomusic] actionbar ' + JSON.stringify(toComponent()))
if (noteIndex >= bot.music.song.notes.length) {
if (bot.music.loop === 1) {
resetTime()