forked from TacoSpigot/TacoSpigot
-
Notifications
You must be signed in to change notification settings - Fork 2
/
importmcdev.sh
executable file
·47 lines (40 loc) · 1.01 KB
/
importmcdev.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
nms="net/minecraft/server"
export MODLOG=""
PS1="$"
basedir=`pwd`
workdir=$basedir/Paper/work
minecraftversion=$(cat Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
decompiledir=$workdir/Minecraft/$minecraftversion
export importedmcdev=""
function import {
export importedmcdev="$importedmcdev $1"
file="${1}.java"
target="$basedir/Paper/Paper-Server/src/main/java/$nms/$file"
base="$decompiledir/$nms/$file"
if [[ ! -f "$target" ]]; then
export MODLOG="$MODLOG Imported $file from mc-dev\n";
echo "Copying $base to $target"
cp "$base" "$target"
fi
}
(
cd Paper/Paper-Server/
lastlog=$(git log -1 --oneline)
if [[ "$lastlog" = *"mc-dev Imports"* ]]; then
git reset --hard HEAD^
fi
)
# Sources to import
import IBlockState
import BlockState
import BlockStateBoolean
import BlockStateEnum
import BlockStateInteger
import BlockStateList
import PacketEncoder
(
cd Paper/Paper-Server/
git add src -A
echo -e "mc-dev Imports\n\n$MODLOG" | git commit src -F -
)