-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wangzhizhou
committed
Aug 16, 2021
1 parent
6ea8237
commit 9a56e8f
Showing
10 changed files
with
116 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# -*- coding: utf8 -*- | ||
import os | ||
import json | ||
import re | ||
from ..utils.utils import makedirs | ||
|
||
# https://fabricmc.net/use/ | ||
|
||
class Fabric: | ||
|
||
_configuration = None | ||
|
||
@classmethod | ||
def json_configuration(cls, config): | ||
if Fabric._configuration == None: | ||
fabric_json_path = os.path.join(config.game_version_client_versions_dir(), config.lastVersionId, config.lastVersionId + '.json') | ||
if 'fabric' in config.lastVersionId.lower() and os.path.exists(fabric_json_path): | ||
with open(fabric_json_path, 'r') as f: | ||
Fabric._configuration = json.load(f) | ||
return Fabric._configuration | ||
|
||
@classmethod | ||
def library_fabric_jar_paths(cls, config): | ||
ret = [] | ||
for (url, file_path) in Fabric.downloadLibrariesMap(config).items(): | ||
ret.append(file_path) | ||
return ret | ||
|
||
@classmethod | ||
def jvmOpts(cls, config): | ||
ret = [] | ||
for o in Fabric.json_configuration(config).get('arguments').get('jvm'): | ||
o = re.sub(r'\s','',o) | ||
ret.append(o) | ||
return ret | ||
|
||
@classmethod | ||
def downloadLibrariesMap(cls, config): | ||
ret = {} | ||
for l in Fabric.json_configuration(config).get('libraries'): | ||
name = l.get('name') | ||
splits = name.split(':') | ||
splits = splits[0].split('.') + splits[1:] | ||
file_name = '-'.join(splits[-2:]) + '.jar' | ||
dir_path = os.path.join(config.game_version_client_library_dir(),*splits) | ||
makedirs(dir_path) | ||
url_path ='/'.join(splits + [file_name]) | ||
url = l.get('url') + url_path | ||
ret[url] = os.path.join(dir_path, file_name) | ||
return ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
import os | ||
import json | ||
|
||
# https://www.optifine.net/downloads | ||
|
||
class OptiFine: | ||
|
||
_configuration = None | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ | |
'PaperAPI', | ||
'Spigot', | ||
'BMCLAPI', | ||
'Fabric', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters