From 3544dded0527d84d92541c4de3ebc68b9fd2bd8e Mon Sep 17 00:00:00 2001 From: Pierce Date: Sat, 3 Oct 2020 01:16:03 -0700 Subject: [PATCH] [HOTFIX] Legacy audio fix --- components/handler.js | 19 +++++++++++++------ package.json | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/components/handler.js b/components/handler.js index 0d630ed..e8bd279 100644 --- a/components/handler.js +++ b/components/handler.js @@ -175,7 +175,14 @@ class Handler { // Copy assets to legacy if it's an older Minecraft version. 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', { type: 'assets-copy', @@ -191,12 +198,12 @@ class Handler { const legacyAsset = asset.split('/') legacyAsset.pop() - if (!fs.existsSync(path.join(assetDirectory, 'legacy', legacyAsset.join('/')))) { - fs.mkdirSync(path.join(assetDirectory, 'legacy', legacyAsset.join('/')), { recursive: true }) + if (!fs.existsSync(path.join(legacyDirectory, legacyAsset.join('/')))) { + fs.mkdirSync(path.join(legacyDirectory, legacyAsset.join('/')), { recursive: true }) } - if (!fs.existsSync(path.join(assetDirectory, 'legacy', asset))) { - fs.copyFileSync(path.join(subAsset, hash), path.join(assetDirectory, 'legacy', asset)) + if (!fs.existsSync(path.join(legacyDirectory, asset))) { + fs.copyFileSync(path.join(subAsset, hash), path.join(legacyDirectory, asset)) } counter++ this.client.emit('progress', { @@ -479,7 +486,7 @@ class Handler { : type.arguments.game const assetRoot = path.resolve(this.options.overrides.assetRoot || path.join(this.options.root, 'assets')) const assetPath = this.isLegacy() - ? path.join(assetRoot, 'legacy') + ? path.join(this.options.root, 'resources') : path.join(assetRoot) const minArgs = this.options.overrides.minArgs || this.isLegacy() ? 5 : 11 diff --git a/package.json b/package.json index a218825..b2a4124 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minecraft-launcher-core", - "version": "3.15.0", + "version": "3.15.1", "description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS", "main": "index.js", "dependencies": {