2016-04-02 11:55:54 +08:00
|
|
|
#!/usr/bin/env bash
|
2015-12-30 12:40:32 +08:00
|
|
|
|
|
|
|
PS1="$"
|
2016-04-03 07:34:27 +08:00
|
|
|
basedir=$(realpath "$1")
|
2016-04-02 11:55:54 +08:00
|
|
|
workdir="$basedir/work"
|
|
|
|
minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
|
|
|
decompiledir="$workdir/$minecraftversion"
|
|
|
|
classdir="$decompiledir/classes"
|
2015-12-30 12:40:32 +08:00
|
|
|
|
|
|
|
echo "Extracting NMS classes..."
|
|
|
|
if [ ! -d "$classdir" ]; then
|
|
|
|
mkdir -p "$classdir"
|
|
|
|
cd "$classdir"
|
|
|
|
jar xf "$decompiledir/$minecraftversion-mapped.jar" net/minecraft/server
|
|
|
|
if [ "$?" != "0" ]; then
|
|
|
|
cd "$basedir"
|
|
|
|
echo "Failed to extract NMS classes."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Decompiling classes..."
|
|
|
|
if [ ! -d "$decompiledir/net/minecraft/server" ]; then
|
|
|
|
cd "$basedir"
|
2016-04-02 11:55:54 +08:00
|
|
|
java -jar "$workdir/BuildData/bin/fernflower.jar" -dgs=1 -hdc=0 -asc=1 -udv=0 "$classdir" "$decompiledir"
|
2015-12-30 12:40:32 +08:00
|
|
|
if [ "$?" != "0" ]; then
|
|
|
|
echo "Failed to decompile classes."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|