From 72f6104763ea5502453de9bbbd9378f41aa8b682 Mon Sep 17 00:00:00 2001 From: Pierce Date: Thu, 22 Aug 2019 10:58:30 -0400 Subject: [PATCH] HOTFIX 1.14.4. Native and library rule check --- components/handler.js | 21 +++++++++++++++++++++ package.json | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/components/handler.js b/components/handler.js index b823db9..26af2ee 100644 --- a/components/handler.js +++ b/components/handler.js @@ -172,6 +172,24 @@ class Handler { }); } + parseRule(lib) { + if(lib.rules) { + if (lib.rules.length > 1) { + if (lib.rules[0].action === 'allow' && + lib.rules[1].action === 'disallow' && + lib.rules[1].os.name === 'osx') { + return this.getOS() === 'osx'; + } else { + return true; + } + } else { + if (lib.rules[0].action === 'allow' && lib.rules[0].os) return this.getOS() !== 'osx'; + } + } else { + return false + } + } + getNatives() { return new Promise(async(resolve) => { const nativeDirectory = this.options.overrides.natives || path.join(this.options.root, 'natives', this.version.id); @@ -181,6 +199,8 @@ class Handler { await Promise.all(this.version.libraries.map(async (lib) => { if (!lib.downloads.classifiers) return; + if (this.parseRule(lib)) return; + const native = this.getOS() === 'osx' ? lib.downloads.classifiers['natives-osx'] || lib.downloads.classifiers['natives-macos'] : lib.downloads.classifiers[`natives-${this.getOS()}`]; @@ -283,6 +303,7 @@ class Handler { await Promise.all(this.version.libraries.map(async (_lib) => { if(!_lib.downloads.artifact) return; + if(this.parseRule(_lib)) return; const libraryPath = _lib.downloads.artifact.path; const libraryUrl = _lib.downloads.artifact.url; diff --git a/package.json b/package.json index ae74d49..a945e50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minecraft-launcher-core", - "version": "3.8.1", + "version": "3.9.0", "description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS", "main": "index.js", "dependencies": {