[CI-SKIP] Download mojang libraries sources so we can modify them
This commit is contained in:
parent
997190c3e0
commit
f90c38b8f5
2 changed files with 63 additions and 0 deletions
|
@ -20,7 +20,46 @@ forgefloweroptions="-dgs=1 -hdc=0 -asc=1 -udv=1 -jvn=1"
|
|||
forgeflowercachefile="$decompiledir/forgeflowercache"
|
||||
forgeflowercachevalue="$forgeflowerurl - $forgeflowerversion - $forgefloweroptions";
|
||||
classdir="$decompiledir/classes"
|
||||
versionjson="$workdir/Minecraft/$minecraftversion/$minecraftversion.json"
|
||||
|
||||
if [ ! -f "$versionjson" ]; then
|
||||
echo "Downloading $minecraftversion JSON Data"
|
||||
verescaped=$(echo ${minecraftversion} | sed 's/\./\\./g')
|
||||
jsonurl=$(curl -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | grep -oE "https://.*?${verescaped}.json")
|
||||
curl -o "$versionjson" "$jsonurl"
|
||||
echo "$versionjson - $jsonurl"
|
||||
fi
|
||||
|
||||
function downloadLibraries {
|
||||
group=$1
|
||||
groupesc=$(echo ${group} | sed 's/\./\\./g')
|
||||
grouppath=$(echo ${group} | sed 's/\./\//g')
|
||||
libdir="$decompiledir/libraries/${group}/"
|
||||
mkdir -p "$libdir"
|
||||
shift
|
||||
for lib in "$@"
|
||||
do
|
||||
jar="$libdir/${lib}-sources.jar"
|
||||
destlib="$libdir/${lib}"
|
||||
if [ ! -f "$jar" ]; then
|
||||
libesc=$(echo ${lib} | sed 's/\./\\]./g')
|
||||
ver=$(grep -oE "${groupesc}:${libesc}:[0-9\.]+" "$versionjson" | sed "s/${groupesc}:${libesc}://g")
|
||||
echo "Downloading ${group}:${lib}:${ver} Sources"
|
||||
curl -s -o "$jar" "https://libraries.minecraft.net/${grouppath}/${lib}/${ver}/${lib}-${ver}-sources.jar"
|
||||
set +e
|
||||
grep "<html>" "$jar" && grep -oE "<title>.*?</title>" "$jar" && rm "$jar" && echo "Failed to download $jar" && exit 1
|
||||
set -e
|
||||
fi
|
||||
|
||||
if [ ! -d "$destlib/$grouppath" ]; then
|
||||
echo "Extracting $group:$lib Sources"
|
||||
mkdir -p "$destlib"
|
||||
(cd "$destlib" && jar xf "$jar")
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
downloadLibraries "com.mojang" datafixerupper authlib brigadier
|
||||
|
||||
# prep folders
|
||||
mkdir -p "$workdir/ForgeFlower"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue