#Got custom music discs to work, but they all play the same soundtrack for some reason

27 messages · Page 1 of 1 (latest)

crude vale
#
const musicDiscProperties = {
  bad_deeds_inst: { duration: 142, disc_texture: 'kubejs:item/music_disc_bad_deeds' },
  boo_hoo: { duration: 183, disc_texture: 'kubejs:item/music_disc_boo_hoo' },
  from_the_shadows: { duration: 127, disc_texture: 'kubejs:item/music_disc_from_the_shadows' },
  get_away_inst: { duration: 237, disc_texture: 'kubejs:item/music_disc_get_away' },
  heart_of_the_wicked: { duration: 227, disc_texture: 'kubejs:item/music_disc_heart_of_the_wicked' },
  mirror_mirror_inst: { duration: 182, disc_texture: 'kubejs:item/music_disc_mirror_mirror' },
  open_up_inst: { duration: 189, disc_texture: 'kubejs:item/music_disc_open_up' },
  silent_night: { duration: 189, disc_texture: 'kubejs:item/music_disc_silent_night' },
  worst_nightmare_inst: { duration: 154, disc_texture: 'kubejs:item/music_disc_worst_nightmare' }
}
let musicDisc = [
  'bad_deeds_inst',
  'boo_hoo',
  'from_the_shadows',
  'get_away_inst',
  'heart_of_the_wicked',
  'mirror_mirror_inst',
  'open_up_inst',
  'silent_night',
  'worst_nightmare_inst'
]

StartupEvents.registry('sound_event', event => {
  for (let element of musicDisc) {
    event.create('music_disc.' + element)
  }
})

StartupEvents.registry('item', event => {
  for (let element of musicDisc) {
    event.create('kubejs:music_disc_' + element, 'music_disc')
      .song('kubejs:records/' + element, musicDiscProperties[element].duration)
      .analogOutput(1)
      .texture(musicDiscProperties[element].disc_texture)
      .tag('minecraft:music_discs')
      .tag('minecraft:creeper_drop_music_discs')
  }
})
unborn urchinBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

next spokeBOT
#

Paste version of sounds.json from @crude vale

crude vale
#

Also double checked file names

crude vale
#

or should I just not be using... I forgot the term for this.

The only reason I'm doing it like this is that it's easier to add customization (also how I generated and tinted every singularity item)

crude vale
#

I really don't know what is causing it to play the from_the_shadows .ogg file on 1.19.2 but not work on 1.20.1 at all

sounds.json also matches

#

I thought it was generating out of order but that's not the case

marsh tendon
crude vale
#

I can't exactly use Object.keys().forEach() with the way I'm doing it

#

And what I wrote is based off that example

marsh tendon
#

:/

crude vale
#

Just found out that the default soundtrack is 11.ogg for unknown music discs

#

That would explain why they were all playing it

crude vale
#

IT WORKS

#

I JUST NEEDED TO REMOVE MUSIC_DISC.

#

OH MY GOD

#

WHY

#

I also can't use another folder inside kubejs/sounds so that's a bit disappointing

#

And yes I did fix the typo in my sounds.json file but it's a bit weird I can't follow sound event naming conventions with . or utilize a different resource location within the sounds folder

crude vale
#

Would like to know if this is an issue related to KJS or just something that's not allowed

marsh tendon
#

minecraft doesn‘t allow punctuation in file names, just _

#

it does allow folders, but you have to specify the directory, instead of just the name of the file

crude vale
marsh tendon
#

weird

crude vale
#
  "boo_hoo": {
    "sounds": [
      {
        "name": "kubejs:boo_hoo",
        "stream": true
      }
    ]
  }
#

This works

#

But this doesn't

  "music_disc.boo_hoo": {
    "sounds": [
      {
        "name": "kubejs:records/boo_hoo",
        "stream": true
      }
    ]
  }