From 225377ea056ebbd4a7d229e7e9b4472368ebddd1 Mon Sep 17 00:00:00 2001 From: Alpyne Date: Mon, 20 Jul 2020 20:18:38 -0700 Subject: [PATCH] Add create-branch.sh --- create-branch.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 create-branch.sh diff --git a/create-branch.sh b/create-branch.sh new file mode 100644 index 0000000..291338c --- /dev/null +++ b/create-branch.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +# USAGE: bash create-branch.sh + +mc_version_manifest='https://launchermeta.mojang.com/mc/game/version_manifest.json' +enigma='java -jar enigma/enigma-cli/build/libs/enigma-cli-0.21+local-all.jar' + +# check dependencies. this script requires jq +if [ $(dpkg-query -W -f='${Status}' jq 2>/dev/null | grep -c "ok installed") -eq 0 ]; +then + echo "'jq' is not installed, run 'sudo apt-get install jq' to use this script" + exit +fi + +# new branch +echo "Creating branch '$1'" +git checkout -b $1 + +# find our version.json file +echo 'Reading version_manifest.json...' +json_file=$(curl -s $mc_version_manifest | jq -r --arg version $1 '.versions[] | select(.id == $version).url') + +# find jar and mappings url +echo "Reading $1.json..." +json_file_contents=$(curl -s $json_file) +client_jar=$(echo $json_file_contents | jq -r '.downloads.client.url') +client_mappings=$(echo $json_file_contents | jq -r '.downloads.client_mappings.url') + +# download client.jar +echo "Downloading client.jar..." +curl -# -o client.jar $client_jar + +# download client.txt +echo "Downloading ProGuard mappings: client.txt..." +curl -# -o client.txt $client_mappings + +# remove current src directory +rm -rf src + +echo "Converting ProGuard mappings to Engima mappings: client.mappings..." +$enigma convert-mappings proguard client.txt enigma_file client.mappings + +mkdir src + +echo "Decompiling client.jar..." +$enigma decompile procyon client.jar src client.mappings + +echo "Committing changes..." +git add * +git commit -m "Update to $1"