From 39b125771663b5359b0aa1cac1f2da47ef794944 Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Tue, 16 Mar 2021 17:35:55 +0100 Subject: [PATCH] Use revision file --- revision.txt | 1 + scripts/decompile.sh | 3 ++- scripts/remap.sh | 18 ++++++++++-------- 3 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 revision.txt diff --git a/revision.txt b/revision.txt new file mode 100644 index 000000000..ed888f0d3 --- /dev/null +++ b/revision.txt @@ -0,0 +1 @@ +R0.2 \ No newline at end of file diff --git a/scripts/decompile.sh b/scripts/decompile.sh index d90a6de9d..53a761bcc 100755 --- a/scripts/decompile.sh +++ b/scripts/decompile.sh @@ -5,6 +5,7 @@ set -e PS1="$" basedir="$(cd "$1" && pwd -P)" workdir="$basedir/work" +revision="$(cat "$basedir"/revision.txt | tr -d '\n')" minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4) windows="$([[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]] && echo "true" || echo "false")" decompiledir="$workdir/Minecraft/$minecraftversion" @@ -73,7 +74,7 @@ if [ ! -d "$classdir" ]; then mkdir -p "$classdir" cd "$classdir" set +e - jar xf "$decompiledir/$minecraftversion-mapped.jar" net/minecraft + jar xf "$decompiledir/$minecraftversion-$revision-mapped.jar" net/minecraft if [ "$?" != "0" ]; then cd "$basedir" echo "Failed to extract NMS classes." diff --git a/scripts/remap.sh b/scripts/remap.sh index 5fb81db1f..3caf44a58 100755 --- a/scripts/remap.sh +++ b/scripts/remap.sh @@ -5,7 +5,8 @@ set -e PS1="$" basedir="$(cd "$1" && pwd -P)" workdir="$basedir/work" -minecraftversion="$(cat "${workdir}/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)"-R0.2 +revision="$(cat "$basedir"/revision.txt | tr -d '\n')" +minecraftversion="$(cat "${workdir}/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)" minecraftserverurl=$(cat "${workdir}/BuildData/info.json" | grep serverUrl | cut -d '"' -f 4) minecrafthash=$(cat "${workdir}/BuildData/info.json" | grep minecraftHash | cut -d '"' -f 4) accesstransforms="$workdir/BuildData/mappings/"$(cat "${workdir}/BuildData/info.json" | grep accessTransforms | cut -d '"' -f 4) @@ -43,9 +44,10 @@ if [ "$checksum" != "$minecrafthash" ]; then exit 1 fi +# These specialsource commands are from https://hub.spigotmc.org/stash/projects/SPIGOT/repos/builddata/browse/info.json echo "Applying class mappings..." -if [ ! -f "$jarpath-cl.jar" ]; then - java -jar "$workdir/BuildData/bin/SpecialSource-2.jar" map --only . --only net/minecraft --auto-lvt BASIC --auto-member SYNTHETIC -i "$jarpath.jar" -m "$classmappings" -o "$jarpath-cl.jar" 1>/dev/null +if [ ! -f "$jarpath-$revision-cl.jar" ]; then + java -jar "$workdir/BuildData/bin/SpecialSource-2.jar" map --only . --only net/minecraft --only com/minecraft/math --auto-lvt BASIC --auto-member SYNTHETIC -i "$jarpath.jar" -m "$classmappings" -o "$jarpath-$revision-cl.jar" 1>/dev/null if [ "$?" != "0" ]; then echo "Failed to apply class mappings." exit 1 @@ -53,8 +55,8 @@ if [ ! -f "$jarpath-cl.jar" ]; then fi echo "Applying member mappings..." -if [ ! -f "$jarpath-m.jar" ]; then - java -jar "$workdir/BuildData/bin/SpecialSource-2.jar" map --only . --only net/minecraft --auto-member LOGGER --auto-member TOKENS -i "$jarpath-cl.jar" -m "$membermappings" -o "$jarpath-m.jar" 1>/dev/null +if [ ! -f "$jarpath-$revision-m.jar" ]; then + java -jar "$workdir/BuildData/bin/SpecialSource-2.jar" map --only . --only net/minecraft --only com/minecraft/math --auto-member LOGGER --auto-member TOKENS -i "$jarpath-$revision-cl.jar" -m "$membermappings" -o "$jarpath-$revision-m.jar" 1>/dev/null if [ "$?" != "0" ]; then echo "Failed to apply member mappings." exit 1 @@ -62,8 +64,8 @@ if [ ! -f "$jarpath-m.jar" ]; then fi echo "Creating remapped jar..." -if [ ! -f "$jarpath-mapped.jar" ]; then - java -jar "$workdir/BuildData/bin/SpecialSource.jar" --only . --only net/minecraft -i "$jarpath-m.jar" --access-transformer "$accesstransforms" -m "$packagemappings" -o "$jarpath-mapped.jar" 1>/dev/null +if [ ! -f "$jarpath-$revision-mapped.jar" ]; then + java -jar "$workdir/BuildData/bin/SpecialSource.jar" --only . --only net/minecraft --only com/minecraft/math -i "$jarpath-$revision-m.jar" --access-transformer "$accesstransforms" -m "$packagemappings" -o "$jarpath-$revision-mapped.jar" 1>/dev/null if [ "$?" != "0" ]; then echo "Failed to create remapped jar." exit 1 @@ -72,7 +74,7 @@ fi echo "Installing remapped jar..." cd "$workdir/CraftBukkit" # Need to be in a directory with a valid POM at the time of install. -mvn install:install-file -q -Dfile="$jarpath-mapped.jar" -Dpackaging=jar -DgroupId=io.papermc -DartifactId=minecraft-server -Dversion="$minecraftversion-SNAPSHOT" +mvn install:install-file -q -Dfile="$jarpath-$revision-mapped.jar" -Dpackaging=jar -DgroupId=io.papermc -DartifactId=minecraft-server -Dversion="$minecraftversion-$revision-SNAPSHOT" if [ "$?" != "0" ]; then echo "Failed to install remapped jar." exit 1