Check rules for natives (makes Fabric work again.. OwO')
This commit is contained in:
parent
dd687d451a
commit
76dcc5a689
@ -14,6 +14,9 @@ gamePath=$+sp$
|
||||
# Override the OS name. Choose windows, linux or macos, if the detection doesn't work right.
|
||||
osName=
|
||||
|
||||
# Override JVM architecture (x86/amd64)
|
||||
jvmArch=
|
||||
|
||||
# Default version to choose
|
||||
#version=b1.8.1
|
||||
|
||||
|
@ -113,6 +113,21 @@ def parseJavaLibraryName(libName):
|
||||
libFilePath = libSplit[0].replace(".","/").replace(":","/") + "/" + libVersion + "/" +libName+ "-" +libVersion+ ".jar"
|
||||
return libPath,libName,libVersion,libFilePath
|
||||
|
||||
def checkRules(ruleList):
|
||||
action = "disallow"
|
||||
for rule in ruleList:
|
||||
if "os" in rule:
|
||||
if "name" in rule["os"]:
|
||||
if rule["os"]["name"] == "osx": rule["os"]["name"] = "macos"
|
||||
if lv["osName"] != rule["os"]["name"]: continue
|
||||
|
||||
if "arch" in ruleList["os"]:
|
||||
if lv["jvmArch"] != rule["os"]["arch"]: continue
|
||||
|
||||
action = rule["action"]
|
||||
|
||||
return action
|
||||
|
||||
def processVersion(versionsPath,libraryPath,nativePath,version):
|
||||
versionPath = p(versionsPath,version)
|
||||
clientJson = readJsonFile(p(versionPath,version + ".json"))
|
||||
@ -126,6 +141,7 @@ def processVersion(versionsPath,libraryPath,nativePath,version):
|
||||
l = {}
|
||||
l["path"],l["name"],l["version"],l["filePath"] = parseJavaLibraryName(library["name"])
|
||||
l["type"] = "library"
|
||||
l["data"] = library
|
||||
|
||||
if "downloads" in library:
|
||||
# Libraries
|
||||
@ -197,6 +213,12 @@ def main():
|
||||
lv["osName"] = platform.system().lower()
|
||||
if lv["osName"] == "darwin": lv["osName"] = "macos"
|
||||
|
||||
if lv["jvmArch"] == "":
|
||||
if "64-Bit" in subprocess.check_output([lv["java"],"-version"]).decode("utf-8"):
|
||||
lv["jvmArch"] = "amd64"
|
||||
else:
|
||||
lv["jvmArch"] = "x86"
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
for arg in sys.argv[1:]:
|
||||
argSplit = arg.split("=",1)
|
||||
@ -223,7 +245,7 @@ def main():
|
||||
clientJson,libraries,arguments = processVersion(versionsPath,libraryPath,nativePath,lv["version"])
|
||||
|
||||
versionPath = p(lv["gamePath"],"versions",lv["version"])
|
||||
nativesOutPath = p(versionPath,"natives-" +lv["osName"])
|
||||
nativesOutPath = p(versionPath,"natives-" +lv["osName"]+ "." +lv["jvmArch"])
|
||||
assetsPath = p(lv["gamePath"],"assets")
|
||||
|
||||
print("\nDownloading libraries...")
|
||||
@ -259,6 +281,7 @@ def main():
|
||||
if not os.path.isdir(nativesOutPath): os.makedirs(nativesOutPath)
|
||||
for library in libraries:
|
||||
if library["type"] == "native":
|
||||
if "rules" in library and checkRules(library["rules"]) == "disallow": continue
|
||||
subprocess.run(["7z","x",library["filePathOS"],"-o" +nativesOutPath,"-aos"],check=True,stdout=subprocess.DEVNULL)
|
||||
|
||||
launcherVariables = {}
|
||||
|
Loading…
Reference in New Issue
Block a user