aboutsummaryrefslogtreecommitdiff
path: root/meta.jq
diff options
context:
space:
mode:
authorCaroline Larimore <caroline@larimo.re>2025-08-17 14:59:02 -0700
committerCaroline Larimore <caroline@larimo.re>2025-08-17 14:59:02 -0700
commit9e1e7bec816a249dd26abb5fcb53e70e898859a3 (patch)
treececfcc90d660c15f21e4e16d7e0489d008446b74 /meta.jq
Initial Commit
Diffstat (limited to 'meta.jq')
-rw-r--r--meta.jq64
1 files changed, 64 insertions, 0 deletions
diff --git a/meta.jq b/meta.jq
new file mode 100644
index 0000000..2dd6a54
--- /dev/null
+++ b/meta.jq
@@ -0,0 +1,64 @@
+def apply_optional: if has("rules") then
+ {
+ "rules": [.rules[] | {
+ "action": .action,
+ "match": del(.action)
+ }],
+ "value": del(.rules)
+ } as $optional
+ | if $optional.rules[].match | inside($info[0]) then
+ $optional.value
+ else
+ empty
+ end
+end;
+
+def replace_placeholders: {
+ "auth_player_name": $auth[0].player_name,
+ "auth_uuid": $auth[0].uuid,
+ "auth_xuid": $auth[0].xuid,
+ "auth_access_token": $auth[0].access_token,
+ "user_type": $auth[0].type,
+
+ "version_name": .id,
+ "version_type": .type,
+
+ "assets_index_name": .assets,
+ "assets_root": "assets",
+ "game_directory": "run",
+ "natives_directory": "natives",
+
+ "classpath": (. as $root | [
+ .libraries[] | apply_optional | "libraries/" + .downloads.artifact.path
+ ] + ["versions/\($root.id)/client.jar"] | join(":")),
+ "clientid": "idfk",
+
+ # log4j config path
+ "path": "versions/\(.id)/log4j.xml",
+
+ "launcher_name": "mcsh",
+ "launcher_version": "v0.1.0"
+} as $strings | walk(if type == "string" then
+ gsub("\\${(?<key>.*)}"; "\($strings[.key] // "${\(.key)}")")
+end);
+
+replace_placeholders | {
+ "args": .arguments | to_entries | [.[] | {
+ "key": .key,
+ "value": .value | [
+ .[] | if type == "object" then
+ apply_optional | .value
+ end
+ ] | flatten
+ }] | from_entries, # as $args | $args + {"jvm": [.logging.client.argument] + $args.jvm}),
+ "libraries": [.libraries[] | apply_optional | {
+ "name": .name,
+ "path": .downloads.artifact.path,
+ "url": .downloads.artifact.url
+ }],
+ "asset_index": .assetIndex.url,
+ "java_version": .javaVersion.majorVersion,
+ "client_url": .downloads.client.url,
+ "main_class": .mainClass,
+ "logging_config": .logging.client.file.url
+}