This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
campicus's profile picture

play a mod sound with speaker

Started by campicus, 09 October 2018 - 10:34 AM
campicus #1
Posted 09 October 2018 - 12:34 PM
So I've learnt how to play a sound with a speaker peripheral:


s = peripheral.wrap("top")
s.playSound("minecraft:weather.rain")

However, it would be cool if you could play sounds from other mods:


-- this does not work
s = peripheral.wrap("top")
s.playSound("draconicevolution:charge")

I got that sound name from the draconic evolution 'sounds.jar' file:

  "charge": {
	"category": "block",
	"sounds": [
	  {
		"name": "draconicevolution:charge",
		"stream": false
	  }
	]
  }
My questions is, is it possible to play sounds from other mods through the CC speaker? If so, how?

Thanks!
Bomb Bloke #2
Posted 10 October 2018 - 02:26 AM
As far as I can tell, no, it's not possible to do this at present. I'm sure SquidDev will correct me if I'm wrong, but I'm getting "no such sound" errors when passing in strings that the "playsound" server command works with - only vanilla sounds seem to work through speakers.
campicus #3
Posted 10 October 2018 - 02:30 AM
As far as I can tell, no, it's not possible to do this at present. I'm sure SquidDev will correct me if I'm wrong, but I'm getting "no such sound" errors when passing in strings that the "playsound" server command works with - only vanilla sounds seem to work through speakers.
Well darn… thanks for your help :)/>
SquidDev #4
Posted 10 October 2018 - 07:35 AM
It should be using the same code as playsound to locate sounds - I'll have a look to see if I can find what we're doing wrong.
SquidDev #5
Posted 10 October 2018 - 09:12 AM
I've put together a PR which should fix it - could you try this jar and confirm it works?
campicus #6
Posted 10 October 2018 - 11:01 AM
I've put together a PR which should fix it - could you try this jar and confirm it works?

It works!