Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-14 20:10:05 +01:00
Update scripts for NMS repackaging
Dieser Commit ist enthalten in:
Ursprung
d4532f7e70
Commit
b28d461145
@ -73,7 +73,7 @@ if [ ! -d "$classdir" ]; then
|
|||||||
mkdir -p "$classdir"
|
mkdir -p "$classdir"
|
||||||
cd "$classdir"
|
cd "$classdir"
|
||||||
set +e
|
set +e
|
||||||
jar xf "$decompiledir/$minecraftversion-mapped.jar" net/minecraft/server
|
jar xf "$decompiledir/$minecraftversion-mapped.jar" net/minecraft
|
||||||
if [ "$?" != "0" ]; then
|
if [ "$?" != "0" ]; then
|
||||||
cd "$basedir"
|
cd "$basedir"
|
||||||
echo "Failed to extract NMS classes."
|
echo "Failed to extract NMS classes."
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
(
|
(
|
||||||
set -e
|
set -e
|
||||||
nms="net/minecraft/server"
|
nms="net/minecraft"
|
||||||
export MODLOG=""
|
export MODLOG=""
|
||||||
PS1="$"
|
PS1="$"
|
||||||
basedir="$(cd "$1" && pwd -P)"
|
basedir="$(cd "$1" && pwd -P)"
|
||||||
@ -24,6 +24,7 @@ function import {
|
|||||||
if [[ ! -f "$target" ]]; then
|
if [[ ! -f "$target" ]]; then
|
||||||
export MODLOG="$MODLOG Imported $file from mc-dev\n";
|
export MODLOG="$MODLOG Imported $file from mc-dev\n";
|
||||||
#echo "Copying $base to $target"
|
#echo "Copying $base to $target"
|
||||||
|
mkdir -p "$(dirname "$target")"
|
||||||
cp "$base" "$target" || exit 1
|
cp "$base" "$target" || exit 1
|
||||||
else
|
else
|
||||||
echo "UN-NEEDED IMPORT: $file"
|
echo "UN-NEEDED IMPORT: $file"
|
||||||
@ -59,10 +60,9 @@ function importLibrary {
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
files=$(cat "$basedir/Spigot-Server-Patches/"* | grep "+++ b/src/main/java/net/minecraft/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\///g')
|
||||||
|
|
||||||
files=$(cat "$basedir/Spigot-Server-Patches/"* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
nonnms=$(grep -R "new file mode" -B 1 "$basedir/Spigot-Server-Patches/" | grep -v "new file mode" | grep -oE "net\/minecraft\/**\/.*.java" | grep -oE "[A-Za-z]+?.java$" --color=none | sed 's/.java//g')
|
||||||
|
|
||||||
nonnms=$(grep -R "new file mode" -B 1 "$basedir/Spigot-Server-Patches/" | grep -v "new file mode" | grep -oE "net\/minecraft\/server\/.*.java" | grep -oE "[A-Za-z]+?.java$" --color=none | sed 's/.java//g')
|
|
||||||
function containsElement {
|
function containsElement {
|
||||||
local e
|
local e
|
||||||
for e in "${@:2}"; do
|
for e in "${@:2}"; do
|
||||||
@ -74,7 +74,8 @@ set +e
|
|||||||
for f in $files; do
|
for f in $files; do
|
||||||
containsElement "$f" ${nonnms[@]}
|
containsElement "$f" ${nonnms[@]}
|
||||||
if [ "$?" == "1" ]; then
|
if [ "$?" == "1" ]; then
|
||||||
if [ ! -f "$workdir/Spigot/Spigot-Server/src/main/java/net/minecraft/server/$f.java" ]; then
|
if [ ! -f "$workdir/Spigot/Spigot-Server/src/main/java/net/minecraft/$f" ]; then
|
||||||
|
f="$(echo "$f" | sed 's/.java//g')"
|
||||||
if [ ! -f "$decompiledir/$nms/$f.java" ]; then
|
if [ ! -f "$decompiledir/$nms/$f.java" ]; then
|
||||||
echo "$(color 1 31) ERROR!!! Missing NMS$(color 1 34) $f $(colorend)";
|
echo "$(color 1 31) ERROR!!! Missing NMS$(color 1 34) $f $(colorend)";
|
||||||
else
|
else
|
||||||
|
@ -7,8 +7,8 @@ basedir="$(cd "$1" && pwd -P)"
|
|||||||
workdir="$basedir/work"
|
workdir="$basedir/work"
|
||||||
minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
minecraftversion=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
|
||||||
spigotdecompiledir="$workdir/Minecraft/$minecraftversion/spigot"
|
spigotdecompiledir="$workdir/Minecraft/$minecraftversion/spigot"
|
||||||
nms="$spigotdecompiledir/net/minecraft/server"
|
nms="$spigotdecompiledir"
|
||||||
cb="src/main/java/net/minecraft/server"
|
cb="src/main/java"
|
||||||
gitcmd="git -c commit.gpgsign=false"
|
gitcmd="git -c commit.gpgsign=false"
|
||||||
|
|
||||||
# https://stackoverflow.com/a/38595160
|
# https://stackoverflow.com/a/38595160
|
||||||
@ -45,31 +45,31 @@ done
|
|||||||
echo "Applying CraftBukkit patches to NMS..."
|
echo "Applying CraftBukkit patches to NMS..."
|
||||||
cd "$workdir/CraftBukkit"
|
cd "$workdir/CraftBukkit"
|
||||||
$gitcmd checkout -B patched HEAD >/dev/null 2>&1
|
$gitcmd checkout -B patched HEAD >/dev/null 2>&1
|
||||||
rm -rf "$cb"
|
rm -rf "$cb/net"
|
||||||
mkdir -p "$cb"
|
|
||||||
# create baseline NMS import so we can see diff of what CB changed
|
# create baseline NMS import so we can see diff of what CB changed
|
||||||
for file in $(ls nms-patches)
|
while IFS= read -r -d '' file
|
||||||
do
|
do
|
||||||
patchFile="nms-patches/$file"
|
patchFile="$file"
|
||||||
file="$(echo "$file" | cut -d. -f1).java"
|
file="$(echo "$file" | cut -d "/" -f2- | cut -d. -f1).java"
|
||||||
|
mkdir -p "$(dirname $cb/"$file")"
|
||||||
cp "$nms/$file" "$cb/$file"
|
cp "$nms/$file" "$cb/$file"
|
||||||
done
|
done < <(find nms-patches -type f -print0)
|
||||||
$gitcmd add src
|
$gitcmd add src
|
||||||
$gitcmd commit -m "Minecraft $ $(date)" --author="Vanilla <auto@mated.null>"
|
$gitcmd commit -m "Minecraft $ $(date)" --author="Vanilla <auto@mated.null>"
|
||||||
|
|
||||||
# apply patches
|
# apply patches
|
||||||
for file in $(ls nms-patches)
|
while IFS= read -r -d '' file
|
||||||
do
|
do
|
||||||
patchFile="nms-patches/$file"
|
patchFile="$file"
|
||||||
file="$(echo "$file" | cut -d. -f1).java"
|
file="$(echo "$file" | cut -d "/" -f2- | cut -d. -f1).java"
|
||||||
|
|
||||||
echo "Patching $file < $patchFile"
|
echo "Patching $file < $patchFile"
|
||||||
set +e
|
set +e
|
||||||
strip_cr "$nms/$file" > /dev/null
|
strip_cr "$nms/$file" > /dev/null
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
"$patch" -s -d src/main/java/ "net/minecraft/server/$file" < "$patchFile"
|
"$patch" -d src/main/java -p 1 < "$patchFile"
|
||||||
done
|
done < <(find nms-patches -type f -print0)
|
||||||
|
|
||||||
$gitcmd add src
|
$gitcmd add src
|
||||||
$gitcmd commit -m "CraftBukkit $ $(date)" --author="CraftBukkit <auto@mated.null>"
|
$gitcmd commit -m "CraftBukkit $ $(date)" --author="CraftBukkit <auto@mated.null>"
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren