mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-09 04:12:01 +01:00
ff560e687c
* Update build.yml
* Remove 3rd party patches
* Add Upsteam Submodules
* Fix patches
* ?
* Fix patches
* Add Fast Init script
* Lots of stuff
also it's broke
* more broken
* fixes
* mor stuff
* gfhfgh
hg
* fix patch
* fix up script
* update submodule
* add papercut
* update tuinity
* update gitmodules
* fix var name
* fix more var stuff
* some how it's not deleting shit anymore
* should now use the branch it just made
why are we doing this again?
* now it does thing thing
* return previous so YAPFA can use it
* ok now it really does the thing
* for REAL it does the thing
* don't do the thing because it causes too many problems
* fix api
* work
* use better patching for YAPFA patches
* fix better patching
* more fixes
* new patches stuff
* remove old 3rd parry patches add removed akarin patches
* make new branch for making patches
* hopefully build patches correctly
* fix gitignore and add config patches
* remove papercut files
* fix some weirdness
* fix bug
* time to do some fixin' 👀
* New Patch System Rebased Patches
* fix full build
* exit 1
* fix
* Remove patch
* Hopefully fix compile errors
* fixes
* this might work
* don't use rej for our patches
* tmp disable cache
* some times case sensitivity is dumb
* my sanity is at an all time low :)
* dfg
* readd cahce
* fix?
* Update Upstream
* fix perms
* fix
* fix api
* Redo API
* rm folders
* fix villager brain patch
* emc explosion pref
* fixed aikar's shit
* betterfix
* fix lagggg
* Origami
* Origami Fixes
* Update readme
* test async path finding
* WIP Async Path Finding
* WIP fix async path finding
* same as bellow
* same
* update to newer funcs
* fix newer funcs
* fix author
* Updates, Fixes, and new patches
* fixes
* possibly async flying path finding
* minor asnyc pathfinding fix
* test remove non asnyc path finder
* WIP make all path finding async
* Rename everything
* Exec flag
* Rebuild hashes
* remove dupe patch
* fix?
* Fix packages, redirect config
* old nav class is now async and back
* add getchatcolor.getbyid and handle patches with a . in them better
Co-authored-by: tr7zw <tr7zw@live.de>
Co-authored-by: Unknown <unknown@example.com>
Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
163 lines
6.0 KiB
Bash
Executable File
163 lines
6.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
#maintask=$2
|
|
#if [[ $maintask == "0" ]]; then
|
|
# TASKTITLE="Import Sources"
|
|
#else
|
|
# TASKTITLE="Import Sources (Subtask)"
|
|
#fi
|
|
|
|
# SCRIPT HEADER start
|
|
basedir=$1
|
|
echo "$2"
|
|
source "$basedir/scripts/functions.sh"
|
|
echo " "
|
|
echo "----------------------------------------"
|
|
echo " $(bashcolor 1 32)Task$(bashcolorend) - $TASKTITLE"
|
|
echo " This will import unimported newly added/mod sources to Paper workspace"
|
|
echo "----------------------------------------"
|
|
# SCRIPT HEADER end
|
|
|
|
# For a description of this script, see updateUpstream.sh.
|
|
paperworkdir="$basedir/Tuinity/Paper/work"
|
|
forkname="$2"
|
|
paperserverdir="$basedir/Yatopia-Server"
|
|
papersrcdir="$basedir/Yatopia-Server/src/main/java"
|
|
papernmsdir="$papersrcdir/net/minecraft/server"
|
|
|
|
(
|
|
# fast-fail if Paper not set
|
|
if [ ! -d "$papernmsdir" ]; then
|
|
echo " $(bashcolor 1 31)Exception$(bashcolorend) - Paper sources not generated, run updateUpstream.sh to setup."
|
|
exit 1
|
|
fi
|
|
)
|
|
|
|
minecraftversion=$(cat "$basedir"/Tuinity/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
|
|
decompiledir=$paperworkdir/Minecraft/$minecraftversion/spigot
|
|
|
|
nms="net/minecraft/server"
|
|
export IMPORT_LOG="" # for commit message, list all files and source for libs
|
|
basedir
|
|
|
|
function importToPaperWorkspace {
|
|
if [ -f "$papernmsdir/$1.java" ]; then
|
|
# echo " $(bashcolor 1 33)Skipped$(bashcolorend) - Already imported $1.java"
|
|
return 0
|
|
fi
|
|
|
|
file="$1.java"
|
|
target="$papernmsdir/$file"
|
|
base="$decompiledir/$nms/$file"
|
|
|
|
if [[ ! -f "$target" ]]; then
|
|
export IMPORT_LOG="$IMPORT_LOG Import: $file\n";
|
|
echo "Import: $file"
|
|
cp "$base" "$target"
|
|
fi
|
|
}
|
|
|
|
function importLibraryToPaperWorkspace {
|
|
group=$1
|
|
lib=$2
|
|
prefix=$3
|
|
shift 3
|
|
for file in "$@"; do
|
|
file="$prefix/$file"
|
|
target="$papersrcdir/$file"
|
|
targetdir=$(dirname "$target")
|
|
mkdir -p "${targetdir}"
|
|
|
|
base="$paperworkdir/Minecraft/$minecraftversion/libraries/${group}/${lib}/$file"
|
|
if [ ! -f "$base" ]; then
|
|
echo " $(bashcolor 1 31)Exception$(bashcolorend) - Cannot find file $file.java of lib $lib in group $group to import, re-decomplie or remove the import."
|
|
exit 1
|
|
fi
|
|
|
|
export IMPORT_LOG="$IMPORT_LOG Import: $file from lib $lib\n";
|
|
echo "Import: $file ($lib)"
|
|
sed 's/\r$//' "$base" > "$target" || exit 1
|
|
done
|
|
}
|
|
|
|
(
|
|
# Reset to last NORMAL commit if already have imported before
|
|
cd "$paperserverdir"
|
|
lastcommit=$(git log -1 --pretty=oneline --abbrev-commit)
|
|
if [[ "$lastcommit" = *"Extra dev imports of $forkname"* ]]; then
|
|
git reset --hard HEAD^
|
|
fi
|
|
)
|
|
|
|
# Filter and import every files which have patch to modify
|
|
|
|
if [[ $forkname != "Yatopia" ]]; then
|
|
if [[ $forkname != null ]]; then
|
|
echo "test: $forkname == Purpur"
|
|
patchedFiles=$(cat patches/$forkname/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
|
patchedFilesNonNMS=$(cat patches/$forkname/server/* | grep "create mode " | grep -Po "src/main/java/net/minecraft/server/(.*?).java" | sort | uniq | sed 's/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
|
else
|
|
echo "test: $forkname == Yatopia"
|
|
patchedFiles=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
|
patchedFilesNonNMS=$(cat patches/server/* | grep "create mode " | grep -Po "src/main/java/net/minecraft/server/(.*?).java" | sort | uniq | sed 's/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
|
fi
|
|
else
|
|
echo "test: $forkname == Yatopia"
|
|
patchedFiles=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/server/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
|
patchedFilesNonNMS=$(cat patches/server/* | grep "create mode " | grep -Po "src/main/java/net/minecraft/server/(.*?).java" | sort | uniq | sed 's/src\/main\/java\/net\/minecraft\/server\///g' | sed 's/.java//g')
|
|
fi
|
|
(
|
|
cd "$paperserverdir"
|
|
#$gitcmd fetch --all &> /dev/null
|
|
# Create the upstream branch in Paper project with current state
|
|
#$gitcmd checkout master >/dev/null 2>&1 # possibly already in
|
|
#if [[ $3 != "Yatopia" ]]; then
|
|
#if [[ $3 != null ]]; then
|
|
#$gitcmd branch -D ${3}-upstream &>/dev/null
|
|
#$gitcmd branch -f ${3}-upstream HEAD && $gitcmd checkout ${3}-upstream
|
|
#else
|
|
#$gitcmd branch -D upstream &>/dev/null
|
|
#$gitcmd branch -f upstream HEAD && $gitcmd checkout upstream
|
|
#fi
|
|
#else
|
|
#$gitcmd branch -D upstream &>/dev/null
|
|
#$gitcmd branch -f upstream HEAD && $gitcmd checkout upstream
|
|
#fi
|
|
)
|
|
|
|
basedir
|
|
for f in $patchedFiles; do
|
|
containsElement "$f" ${patchedFilesNonNMS[@]}
|
|
if [ "$?" == "1" ]; then
|
|
if [ ! -f "$papersrcdir/$nms/$f.java" ]; then
|
|
if [ ! -f "$decompiledir/$nms/$f.java" ]; then
|
|
echo " $(bashcolor 1 31)Exception$(bashcolorend) - Cannot find NMS file $f.java to import, re-decomplie or remove the import."
|
|
exit 1
|
|
else
|
|
importToPaperWorkspace $f
|
|
fi
|
|
fi
|
|
fi
|
|
done
|
|
|
|
# NMS import format:
|
|
# importToPaperWorkspace MinecraftServer
|
|
|
|
# Library import format (multiple files are supported):
|
|
# importLibraryToPaperWorkspace com.mojang datafixerupper com/mojang/datafixers/util Either.java
|
|
# Submit imports by commit with file descriptions
|
|
(
|
|
cd "$paperserverdir"
|
|
# rm -rf nms-patches
|
|
git add . &> /dev/null
|
|
echo -e "Extra dev imports of $forkname\n\n$IMPORT_LOG"
|
|
git commit -m "Extra dev imports of $forkname"
|
|
echo " $(bashcolor 1 32)Succeed$(bashcolorend) - Sources have been imported to Paper/Paper-Server (branch upstream)"
|
|
|
|
if [[ $maintask != "0" ]]; then # this is magical
|
|
echo "----------------------------------------"
|
|
echo " Subtask finished"
|
|
echo "----------------------------------------"
|
|
fi
|
|
)
|