summaryrefslogtreecommitdiffstats
path: root/applyPatches.sh
blob: 27936e7368e7f0f0c196c0e7c5e7feda98ea48e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

if [ -z "$1" ]
then
    echo "Please run this script again with the clean decompile sources as an argument. In most cases this will be ../work/decompile-XXXX"
    exit
fi

nms=$1/net/minecraft/server
cb=src/main/java/net/minecraft/server
#clean up and rebuild
rm -rf $cb
mkdir -p $cb
for file in $(/bin/ls nms-patches)
do
    patchFile="nms-patches/$file"
    file="$(echo $file | cut -d. -f1).java"

    echo "Patching $file < $patchFile"
    sed -i 's/\r//' "$nms/$file"

    cp "$nms/$file" "$cb/$file"
    patch -d src/main/java/ "net/minecraft/server/$file" < "$patchFile"
done