prismarine-web-client
prismarine-web-client copied to clipboard
Sounds
Add sounds (shouldn't be that difficult considering mineflayer has an event for hard coded sounds too)
how to do it:
- check license
turns out a lot of MC sound effects are under CC0 Public Domain Dedication: https://www.minecraft.net/en-us/attribution/sound/ For C418’s music, he wants attribution and a link to his download page make sure that we filter only the sounds that we verified the licence
- retrieve from mojang the list of files at build time :
- versions https://launchermeta.mojang.com/mc/game/version_manifest.json
- file list https://launchermeta.mojang.com/v1/packages/436877ffaef948954053e1a78a366b8b7c204a91/1.16.5.json
- asset index https://launchermeta.mojang.com/v1/packages/3a5d110a6ab102c7083bae4296d2de4b8fcf92eb/1.16.json
retrieve actual song directly in browser:
const aa = document.createElement('audio')
const ss = document.createElement('source')
ss.setAttribute('src', "http://resources.download.minecraft.net/e3/e367d1dfa1ce07374e0aeaecbfb1526142a0dcc1")
ss.setAttribute('type', 'audio/ogg')
aa.appendChild(ss)
aa.setAttribute('autoplay', "true")
bypass CORS
(reference https://github.com/PrismarineJS/node-minecraft-wrap/blob/master/lib/launcher_download.js )
we'd need in addition a "event => sound that should be played mapping" actually as said by AwesomestCode , we can use the mineflayer event for that
lot of id of sounds, would need the id => file name mapping
Most sounds would require audio spatialization (it's a nice link to have here btw), but it'd be impossible to avoid CORS policies if we use that
Sound isn't playing inside the game because of this:
The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu