Added supported features to not polute traits

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2024-03-27 12:30:06 +02:00
parent bec6650d02
commit 74fddd3673
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 12 additions and 10 deletions

View File

@ -35,6 +35,7 @@ from meta.model.mojang import (
MojangVersion,
LegacyOverrideIndex,
LibraryPatches,
SUPPORTED_FEATURES,
)
APPLY_SPLIT_NATIVES_WORKAROUND = True
@ -198,22 +199,20 @@ def adapt_new_style_arguments(arguments):
pprint(arg)
return " ".join(foo)
def adapt_new_style_arguments_to_traits(arguments):
foo = []
# we ignore the jvm arguments entirely.
# grab the object, log the errors
for arg in arguments.game:
if not isinstance(arg, str):
try:
for rule in arg["rules"]:
for k,v in rule["features"].items():
if rule["action"] == "allow" and v:
foo.append(f"feature:{k}")
except:
print("something did not go as planed")
pprint(arg)
if isinstance(arg, dict):
for rule in arg["rules"]:
for k, v in rule["features"].items():
if rule["action"] == "allow" and v and k in SUPPORTED_FEATURES:
foo.append(f"feature:{k}")
return foo
def is_macos_only(rules: Optional[MojangRules]):
allows_osx = False
allows_all = False
@ -503,7 +502,9 @@ def main():
v.minecraft_arguments = adapt_new_style_arguments(mojang_version.arguments)
if not v.additional_traits:
v.additional_traits = []
v.additional_traits.extend(adapt_new_style_arguments_to_traits(mojang_version.arguments))
v.additional_traits.extend(
adapt_new_style_arguments_to_traits(mojang_version.arguments)
)
out_filename = os.path.join(
LAUNCHER_DIR, MINECRAFT_COMPONENT, f"{v.version}.json"
)

View File

@ -18,6 +18,7 @@ SUPPORTED_LAUNCHER_VERSION = 21
SUPPORTED_COMPLIANCE_LEVEL = 1
DEFAULT_JAVA_MAJOR = 8 # By default, we should recommend Java 8 if we don't know better
COMPATIBLE_JAVA_MAPPINGS = {16: [17]}
SUPPORTED_FEATURES = ["is_quick_play_multiplayer"]
"""
Mojang index files look like this: