Skip to content

Instantly share code, notes, and snippets.

@Kilobyte22
Last active October 13, 2020 17:47
Show Gist options
  • Save Kilobyte22/5943442 to your computer and use it in GitHub Desktop.
Save Kilobyte22/5943442 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Preparation:
# create folder addbuildfiles. put your recources (like mcmod.info, images) here
# create folder out. Heres your build output
# create file VERSION. put version here. replace dots with spaces. This version number is 3 parts big (like 1 2 3 (which is 1.2.3), not 1 2 3 4 or 1 2)
# done.
MODNAME="<put your mod name here>"
echo "Reading version file..."
ver=(`cat 'VERSION'`)
verstr="${ver[0]}.${ver[1]}.${ver[2]}"
echo "Done, building Version... ${verstr}"
start=`date +%s`
echo "Recompiling..."
python runtime/recompile.py "$@" || exit
echo "Done, Reobfuscating"
python runtime/reobfuscate.py --srgnames || exit
echo "Done, copying additional files to output dir..."
pwd
cp -r addbuildfiles/* reobf/minecraft/
echo "Done, packing jar as ${MODNAME}_${verstr}.jar"
cd "reobf/minecraft"
sed -i s/\$\{VERSION\}/$version/ mcmod.info
find . -name "*" | zip "../../out/${MODNAME}_${verstr}.jar" -@
echo "Done, updating version file"
ver[2]=$((ver[2] + 1))
cd ../..
echo "${ver[0]} ${ver[1]} ${ver[2]}" > VERSION
end=`date +%s`
diff=$((end - start))
echo "Done, Took $diff Seconds"
# for KDE users
# kdialog --title "Build done" --passivepopup "Build of ${MODNAME}_${verstr}.jar done in $diff Seconds."
notify-send "Build done" "Build of ${MODNAME}_${verstr}.jar done in $diff Seconds."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment