[HOTFIX] Legacy audio fix

This commit is contained in:
Pierce 2020-10-03 01:16:03 -07:00
parent 00fbb5a4af
commit 3544dded05
2 changed files with 14 additions and 7 deletions

View file

@ -175,7 +175,14 @@ class Handler {
// Copy assets to legacy if it's an older Minecraft version. // Copy assets to legacy if it's an older Minecraft version.
if (this.isLegacy()) { if (this.isLegacy()) {
this.client.emit('debug', `[MCLC]: Copying assets over to ${path.join(assetDirectory, 'legacy')}`) if (fs.existsSync(path.join(assetDirectory, 'legacy'))) {
this.client.emit('debug', '[MCLC]: The \'legacy\' directory is no longer used as Minecraft looks ' +
'for the resouces folder regardless of what is passed in the assetDirecotry launch option. I\'d ' +
`recommend removing the directory (${path.join(assetDirectory, 'legacy')})`)
}
const legacyDirectory = path.join(this.options.root, 'resources')
this.client.emit('debug', `[MCLC]: Copying assets over to ${legacyDirectory}`)
this.client.emit('progress', { this.client.emit('progress', {
type: 'assets-copy', type: 'assets-copy',
@ -191,12 +198,12 @@ class Handler {
const legacyAsset = asset.split('/') const legacyAsset = asset.split('/')
legacyAsset.pop() legacyAsset.pop()
if (!fs.existsSync(path.join(assetDirectory, 'legacy', legacyAsset.join('/')))) { if (!fs.existsSync(path.join(legacyDirectory, legacyAsset.join('/')))) {
fs.mkdirSync(path.join(assetDirectory, 'legacy', legacyAsset.join('/')), { recursive: true }) fs.mkdirSync(path.join(legacyDirectory, legacyAsset.join('/')), { recursive: true })
} }
if (!fs.existsSync(path.join(assetDirectory, 'legacy', asset))) { if (!fs.existsSync(path.join(legacyDirectory, asset))) {
fs.copyFileSync(path.join(subAsset, hash), path.join(assetDirectory, 'legacy', asset)) fs.copyFileSync(path.join(subAsset, hash), path.join(legacyDirectory, asset))
} }
counter++ counter++
this.client.emit('progress', { this.client.emit('progress', {
@ -479,7 +486,7 @@ class Handler {
: type.arguments.game : type.arguments.game
const assetRoot = path.resolve(this.options.overrides.assetRoot || path.join(this.options.root, 'assets')) const assetRoot = path.resolve(this.options.overrides.assetRoot || path.join(this.options.root, 'assets'))
const assetPath = this.isLegacy() const assetPath = this.isLegacy()
? path.join(assetRoot, 'legacy') ? path.join(this.options.root, 'resources')
: path.join(assetRoot) : path.join(assetRoot)
const minArgs = this.options.overrides.minArgs || this.isLegacy() ? 5 : 11 const minArgs = this.options.overrides.minArgs || this.isLegacy() ? 5 : 11

View file

@ -1,6 +1,6 @@
{ {
"name": "minecraft-launcher-core", "name": "minecraft-launcher-core",
"version": "3.15.0", "version": "3.15.1",
"description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS", "description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {