Paper/scripts/makemcdevsrc.sh
Aikar d089acb3bd
Switch to using ForgeFlower for Paper Only mc-dev imports
ForgeFlower is better than Spigots FernFlower at decompiling the source.

However, in order to maintain the CraftBukkit patches, we must keep
using spigots for the primary.

However, for any file that we import on top of Spigots imported files
there is nothing stopping us from using better decompiled files.

So these changes will use ForgeFlower to maintain a better set of
decomped files, so anything we add on top of Paper can start off
in a better spot.
2018-08-31 23:47:57 -04:00

30 lines
797 B
Bash
Executable File

#!/usr/bin/env bash
(
set -e
PS1="$"
basedir="$(cd "$1" && pwd -P)"
cd "$basedir"
workdir="$basedir/work"
minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
decompiledir="$workdir/Minecraft/$minecraftversion"
nms="$decompiledir/forge/net/minecraft/server"
papernms="Paper-Server/src/main/java/net/minecraft/server"
mcdevsrc="${decompiledir}/src/net/minecraft/server"
rm -rf "${mcdevsrc}"
mkdir -p "${mcdevsrc}"
cp ${nms}/*.java "${mcdevsrc}/"
for file in "${nms}/"*
do
file=${file##*/}
# test if in Paper folder - already imported
if [ -f "${papernms}/${file}" ]; then
# remove from mcdevsrc folder
rm -f "${mcdevsrc}/${file}"
fi
done
echo "Built $decompiledir/src to be included in your project for src access";
)