HOTFIX 1.14.4. Native and library rule check

This commit is contained in:
Pierce 2019-08-22 10:58:30 -04:00
parent 77532e2166
commit 72f6104763
2 changed files with 22 additions and 1 deletions

View file

@ -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;

View file

@ -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": {