mirror of
https://github.com/unmojang/meta.git
synced 2025-09-24 03:31:03 -04:00
Support initial XBox compliance level
This commit is contained in:
parent
bac4de1ad9
commit
e990741b18
@ -313,7 +313,7 @@ if found_any_lwjgl3:
|
||||
lwjglSharedData.recommended = ['3.1.2']
|
||||
lwjglSharedData.write()
|
||||
|
||||
with open("upstream/mojang/version_manifest.json", 'r', encoding='utf-8') as localIndexFile:
|
||||
with open("upstream/mojang/version_manifest_v2.json", 'r', encoding='utf-8') as localIndexFile:
|
||||
localVersionlist = MojangIndexWrap(json.load(localIndexFile))
|
||||
|
||||
mcSharedData = MultiMCSharedPackageData(uid = 'net.minecraft', name = 'Minecraft')
|
||||
|
23
metautil.py
23
metautil.py
@ -118,6 +118,8 @@ class MojangIndexEntry(JsonObject):
|
||||
time = ISOTimestampProperty()
|
||||
type = StringProperty()
|
||||
url = StringProperty()
|
||||
sha1 = StringProperty(exclude_if_none=True, default=None)
|
||||
complianceLevel = IntegerProperty(exclude_if_none=True, default=None)
|
||||
|
||||
class MojangIndex(JsonObject):
|
||||
latest = DictProperty(StringProperty)
|
||||
@ -223,6 +225,7 @@ class MojangVersionFile (JsonObject):
|
||||
type = StringProperty(exclude_if_none=True, default=None)
|
||||
inheritsFrom = StringProperty(exclude_if_none=True, default=None)
|
||||
logging = DictProperty(MojangLogging, exclude_if_none=True, default=None)
|
||||
complianceLevel = IntegerProperty(exclude_if_none=True, default=None)
|
||||
|
||||
|
||||
CurrentMultiMCFormatVersion = 1
|
||||
@ -263,6 +266,16 @@ class MultiMCVersionFile (VersionedJsonObject):
|
||||
addTweakers = ListProperty(StringProperty, name="+tweakers", exclude_if_none=True, default=None)
|
||||
order = IntegerProperty(exclude_if_none=True, default=None)
|
||||
|
||||
class UnknownComplianceLevelException(Exception):
|
||||
"""Exception raised for unknown Mojang compliance level
|
||||
|
||||
Attributes:
|
||||
message -- explanation of the error
|
||||
"""
|
||||
def __init__(self, message):
|
||||
self.message = message
|
||||
|
||||
|
||||
# Convert Mojang version file object to a MultiMC version file object
|
||||
def MojangToMultiMC (file, name, uid, version):
|
||||
mmcFile = MultiMCVersionFile(
|
||||
@ -294,6 +307,16 @@ def MojangToMultiMC (file, name, uid, version):
|
||||
mmcFile.releaseTime = file.releaseTime
|
||||
# time should not be set.
|
||||
mmcFile.type = file.type
|
||||
maxSupportedLevel = 1
|
||||
if file.complianceLevel:
|
||||
if file.complianceLevel == 0:
|
||||
pass
|
||||
elif file.complianceLevel == 1:
|
||||
if not mmcFile.addTraits:
|
||||
mmcFile.addTraits = []
|
||||
mmcFile.addTraits.append("XR:Initial")
|
||||
else:
|
||||
raise UnknownComplianceLevelException("Unsupported Mojang compliance level: %d. Max supported is: %d" % (file.complianceLevel, maxSupportedLevel))
|
||||
return mmcFile
|
||||
|
||||
class MultiMCSharedPackageData(VersionedJsonObject):
|
||||
|
@ -45,7 +45,7 @@ cd "${BASEDIR}"
|
||||
|
||||
if [ "${DEPLOY_TO_GIT}" = true ] ; then
|
||||
cd "${BASEDIR}/${UPSTREAM_DIR}"
|
||||
git add mojang/version_manifest.json mojang/versions/* mojang/assets/* || fail_in
|
||||
git add mojang/version_manifest_v2.json mojang/versions/* mojang/assets/* || fail_in
|
||||
git add forge/*.json forge/version_manifests/*.json forge/installer_manifests/*.json forge/files_manifests/*.json forge/installer_info/*.json || fail_in
|
||||
git add fabric/loader-installer-json/*.json fabric/meta-v2/*.json fabric/jars/*.json || fail_in
|
||||
git add liteloader/*.json || fail_in
|
||||
|
@ -29,14 +29,14 @@ def get_file(path, url):
|
||||
# get the local version list
|
||||
localVersionlist = None
|
||||
try:
|
||||
with open("upstream/mojang/version_manifest.json", 'r', encoding='utf-8') as localIndexFile:
|
||||
with open("upstream/mojang/version_manifest_v2.json", 'r', encoding='utf-8') as localIndexFile:
|
||||
localVersionlist = MojangIndexWrap(json.load(localIndexFile))
|
||||
except:
|
||||
localVersionlist = MojangIndexWrap({})
|
||||
localIDs = set(localVersionlist.versions.keys())
|
||||
|
||||
# get the remote version list
|
||||
r = sess.get('https://launchermeta.mojang.com/mc/game/version_manifest.json')
|
||||
r = sess.get('https://launchermeta.mojang.com/mc/game/version_manifest_v2.json')
|
||||
r.raise_for_status()
|
||||
main_json = r.json()
|
||||
remoteVersionlist = MojangIndexWrap(main_json)
|
||||
@ -68,5 +68,5 @@ for assetId, assetUrl in iter(assets.items()):
|
||||
print("assets", assetId, assetUrl)
|
||||
get_file( "upstream/mojang/assets/" + assetId + '.json', assetUrl)
|
||||
|
||||
with open("upstream/mojang/version_manifest.json", 'w', encoding='utf-8') as f:
|
||||
with open("upstream/mojang/version_manifest_v2.json", 'w', encoding='utf-8') as f:
|
||||
json.dump(main_json, f, sort_keys=True, indent=4)
|
||||
|
Loading…
x
Reference in New Issue
Block a user