Basic paperweight init

This commit is contained in:
lexikiq
2021-06-17 03:03:07 -04:00
parent c23c1a4323
commit cb960b3659
42 changed files with 477 additions and 754 deletions

6
.editorconfig Normal file
View File

@@ -0,0 +1,6 @@
[*.java]
charset=utf-8
end_of_line=lf
insert_final_newline=true
indent_style=space
indent_size=4

7
.gitattributes vendored Normal file
View File

@@ -0,0 +1,7 @@
* text=auto
*.sh text eol=lf
gradlew text eol=lf
*.bat text eol=crlf
*.jar binary

66
.gitignore vendored
View File

@@ -1,11 +1,55 @@
# Concrete
.gradle/
build/
# Eclipse stuff
.classpath
.project
.settings/
# VSCode stuff
.vscode/
# netbeans
nbproject/
nbactions.xml
# we use maven!
build.xml
# maven
target/
dependency-reduced-pom.xml
# vim
.*.sw[a-p]
# various other potential build files
build/
bin/
dist/
manifest.mf
# Mac filesystem dust
.DS_Store/
.DS_Store
# intellij
*.iml
*.ipr
*.iws
.idea/
out/
# Linux temp files
*~
# other stuff
run/
Parchment-Server
Parchment-API
mc-dev
.idea
testserver
run
current-paper
!gradle/wrapper/gradle-wrapper.jar
# Compiled class file
*.class
@@ -19,16 +63,6 @@ current-paper
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# IntelliJ
*.iml
*.ipr
*.iws
.idea/
out/
# Maven
target/
# Package Files #
*.jar
*.war

7
.gitmodules vendored
View File

@@ -1,7 +0,0 @@
[submodule "Paper"]
path = Paper
url = https://github.com/PaperMC/Paper
branch = master
[submodule "work/Paperclip"]
path = work/Paperclip
url = https://github.com/ProjectEdenGG/Paperclip

1
Paper

Submodule Paper deleted from c649585082

63
build.gradle.kts Normal file
View File

@@ -0,0 +1,63 @@
plugins {
java
id("com.github.johnrengelman.shadow") version "7.0.0" apply false
id("io.papermc.paperweight.patcher") version "1.0.4"
}
repositories {
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/") {
content {
onlyForConfigurations("paperclip")
}
}
maven("https://maven.quiltmc.org/repository/release/") {
content {
onlyForConfigurations("remapper")
}
}
}
dependencies {
remapper("org.quiltmc:tiny-remapper:0.4.1")
paperclip("io.papermc:paperclip:2.0.0-SNAPSHOT@jar")
}
subprojects {
apply(plugin = "java")
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(16))
}
}
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
options.release.set(16)
}
repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/groups/public/")
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://ci.emc.gs/nexus/content/groups/aikar/")
maven("https://repo.aikar.co/content/groups/aikar")
maven("https://repo.md-5.net/content/repositories/releases/")
maven("https://hub.spigotmc.org/nexus/content/groups/public/")
}
}
paperweight {
serverProject.set(project(":Parchment-Server"))
usePaperUpstream(providers.gradleProperty("paperRef")) {
withPaperPatcher {
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("Parchment-API"))
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("Parchment-Server"))
}
}
}

6
gradle.properties Normal file
View File

@@ -0,0 +1,6 @@
group = me.lexikiq.parchment
version = 1.17-R0.1-SNAPSHOT
mcVersion = 1.17
packageVersion = 1_17_R1
paperRef = 98994a0aa1e72c851b9ea6fb26fcd15ca02a0f6a

View File

@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored Executable file
View File

@@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored Normal file
View File

@@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

175
parchment
View File

@@ -1,175 +0,0 @@
#!/usr/bin/env bash
# exit immediately if a command exits with a non-zero status
set -e
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}")
basedir=$(dirname "$SOURCE")
. "$basedir"/scripts/init.sh
paperstash() {
STASHED=$(git stash)
}
paperunstash() {
if [[ "$STASHED" != "No local changes to save" ]] ; then
git stash pop
fi
}
case "$1" in
"rb" | "rbp" | "rebuild")
(
set -e
cd "$basedir"
scripts/rebuildpatches.sh "$basedir"
)
;;
"p" | "patch" | "apply")
(
set -e
cd "$basedir"
if [ "$2" != "fast" ]; then
scripts/upstream.sh
fi
scripts/apply.sh "$basedir"
)
;;
"b" | "bu" | "build")
(
basedir
mvn -N install
cd ${FORK_NAME}-API && mvn -e clean install
cd ../Paper/Paper-MojangAPI && mvn -e clean install
cd ../../${FORK_NAME}-Server && mvn -e clean install
)
;;
"jar" | "paperclip")
(
basedir
cd "$basedir"
if [ "$2" != "fast" ]; then
scripts/upstream.sh
fi
./scripts/apply.sh "$basedir"
cd "$basedir"
mvn -N install
cd ${FORK_NAME}-Common && mvn -e clean install
cd ../${FORK_NAME}-API && mvn -e clean install
cd ../Paper/Paper-MojangAPI && mvn -e clean install
cd ../../${FORK_NAME}-Server && mvn -e clean install
cd "$basedir"
./scripts/paperclip.sh
)
;;
"i" | "install")
(
basedir
mvn -N install
cd ${FORK_NAME}-Common
mvn clean install
cd ../${FORK_NAME}-API
mvn clean install
cd ../Paper/Paper-MojangAPI
mvn clean install
cd ../../${FORK_NAME}-Server
mvn clean install
)
;;
"ghjar")
(
# github install because workflows are dumb
basedir
cd "$basedir"
if [ "$2" != "fast" ]; then
scripts/upstream.sh
fi
./scripts/apply.sh "$basedir"
cd "$basedir"
mvn -N install
cd ${FORK_NAME}-Common && mvn -e clean install -Dmaven.javadoc.skip=true
cd ../${FORK_NAME}-API && mvn -e clean install -Dmaven.javadoc.skip=true
cd ../Paper/Paper-MojangAPI && mvn -e clean install
cd ../../${FORK_NAME}-Server && mvn -e clean install
cd "$basedir"
./scripts/paperclip.sh
)
;;
"d" | "deploy")
(
basedir
mvn -N deploy
cd ${FORK_NAME}-Common
mvn clean deploy
cd ../${FORK_NAME}-API
mvn clean deploy
cd ../${FORK_NAME}-Server
mvn clean deploy
)
;;
"up" | "upstream")
(
cd "$basedir"
scripts/upstream.sh "$2"
)
;;
"r" | "root")
cd "$basedir"
;;
"a" | "api")
cd "$basedir/Parchment-API"
;;
"s" | "server")
cd "$basedir/Parchment-Server"
;;
"setup")
if [[ -f ~/.bashrc ]] ; then
NAME="parchment"
if [[ ! -z "${2+x}" ]] ; then
NAME="$2"
fi
(grep "alias $NAME=" ~/.bashrc > /dev/null) && (sed -i "s|alias $NAME=.*|alias $NAME='. $SOURCE'|g" ~/.bashrc) || (echo "alias $NAME='. $SOURCE'" >> ~/.bashrc)
alias "$NAME=. $SOURCE"
echo "You can now just type '$NAME' at any time to access the paper tool."
fi
;;
*)
echo "Parchment build tool command. This provides a variety of commands to build and manage the PaperMC build"
echo "environment. For all of the functionality of this command to be available, you must first run the"
echo "'setup' command. View below for details. For essential building and patching, you do not need to do the setup."
echo ""
echo " Normal commands:"
echo " * rb, rebuild | Rebuild patches, can be called from anywhere."
echo " * p, patch | Apply all patches to top of Paper without building it. Can be run from anywhere."
echo " * up, upstream | Build Paper upstream, pass arg up to update paper. Can be run from anywhere."
echo " * b, build | Build API and Server but no deploy. Can be ran anywhere."
echo " * j, jar | Apply all patches and build the project, parchment-paperclip.jar will be output. Can be run from anywhere."
echo " * i, install | Build and install API jar and build Server. Can be ran anywhere."
echo " * d, deploy | Deploy the API, Server, and Common."
echo ""
echo " These commands require the setup command before use:"
echo " * r, root | Change directory to the root of the project."
echo " * a. api | Move to the Paper-API directory."
echo " * s, server | Move to the Paper-Server directory."
echo " * e, edit | Use to edit a specific patch, give it the argument \"server\" or \"api\""
echo " | respectively to edit the correct project. Use the argument \"continue\" after"
echo " | the changes have been made to finish and rebuild patches. Can be called from anywhere."
echo ""
echo " * setup | Add an alias to .bashrc to allow full functionality of this script. Run as:"
echo " | . ./parchment setup"
echo " | After you run this command you'll be able to just run 'parchment' from anywhere."
echo " | The default name for the resulting alias is 'parchment', you can give an argument to override"
echo " | this default, such as:"
echo " | . ./parchment setup example"
echo " | Which will allow you to run 'example' instead."
;;
esac
unset -f paperstash
unset -f paperunstash

View File

@@ -0,0 +1,56 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MiniDigger <admin@minidigger.me>
Date: Sat, 12 Jun 2021 16:40:34 +0200
Subject: [PATCH] Build changes
diff --git a/build.gradle.kts b/build.gradle.kts
index f111042223f0d7974785c37245bb60b75388163e..043e5f4a0914fab856f98d39262a7c28c327460f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -19,8 +19,8 @@ repositories {
}
dependencies {
- implementation(project(":Paper-API"))
- implementation(project(":Paper-MojangAPI"))
+ implementation(project(":Parchment-API")) // Parchment
+ implementation("com.destroystokyo.paper:paper-mojangapi:1.16.5-R0.1-SNAPSHOT") // Parchment
// Paper start
implementation("org.jline:jline-terminal-jansi:3.12.1")
implementation("net.minecrell:terminalconsoleappender:1.2.0")
@@ -119,7 +119,7 @@ tasks.test {
fun TaskContainer.registerRunTask(
name: String, block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) {
- group = "paper"
+ group = "paperweight"
standardInput = System.`in`
workingDir = rootProject.layout.projectDirectory.dir(
providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c6747f49ae8ddc9fc1bad82ab480f85d0883da5d..804eb17da12b816438a4d4c39fc330c4869cea1d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1649,7 +1649,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
- return "Paper"; //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return "Parchment"; //Parchment - Parchment > //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
}
public SystemReport fillSystemReport(SystemReport systemreport) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8a98bd1018afd934696fedbed24e271ab6b75f51..84c456ef6a375d84ab52e11a58a4e6fe602733c0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -230,7 +230,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
- private final String serverName = "Paper"; // Paper
+ private final String serverName = "Parchment"; // Parchment // Paper
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");

51
pom.xml
View File

@@ -1,51 +0,0 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>me.lexikiq</groupId>
<artifactId>parchment-parent</artifactId>
<version>dev-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Parchment (Parent)</name>
<repositories>
<repository>
<id>aikar</id>
<url>https://repo.aikar.co/content/groups/aikar/</url>
</repository>
<repository>
<id>velocity-snapshots</id>
<url>https://nexus.velocitypowered.com/repository/velocity-artifacts-snapshots/</url>
</repository>
</repositories>
<build>
<defaultGoal>install</defaultGoal>
<finalName>${project.artifactId}</finalName>
</build>
<modules>
<module>Parchment-Common</module>
<module>Parchment-API</module>
<module>Parchment-Server</module>
<module>Paper${file.separator}Paper-MojangAPI</module> <!-- We don't plan on patching this, so this hack is good enough. -->
</modules>
<distributionManagement>
<snapshotRepository>
<id>projecteden-repo</id>
<url>https://sonatype.projecteden.gg/repository/maven-snapshots</url>
</snapshotRepository>
</distributionManagement>
<profiles>
<profile>
<!-- Skips trying to deploy Paper-MojangAPI -->
<id>deploy</id>
<modules>
<module>Parchment-Common</module>
<module>Parchment-API</module>
<module>Parchment-Server</module>
</modules>
</profile>
</profiles>
</project>

View File

@@ -1,92 +0,0 @@
#!/usr/bin/env bash
# get base dir regardless of execution location
# resolve shell-specifics
case "$(echo "$SHELL" | sed -E 's|/usr(/local)?||g')" in
"/bin/zsh")
RCPATH="$HOME/.zshrc"
SOURCE="${BASH_SOURCE[0]:-${(%):-%N}}"
;;
*)
RCPATH="$HOME/.bashrc"
if [[ -f "$HOME/.bash_aliases" ]]; then
RCPATH="$HOME/.bash_aliases"
fi
SOURCE="${BASH_SOURCE[0]}"
;;
esac
# get base dir regardless of execution location
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
. $(dirname $SOURCE)/init.sh
PS1="$"
paperVer=$(cat current-paper)
gpgsign="$(git config commit.gpgsign || echo "false")"
echo "Rebuilding Forked projects.... "
function applyPatch {
what=$1
what_name=$(basename $what)
target=$2
branch=$3
patch_folder=$4
cd "$basedir/$what"
git fetch --all
git branch -f upstream "$branch" >/dev/null
cd "$basedir"
if [ ! -d "$basedir/$target" ]; then
mkdir "$basedir/$target"
cd "$basedir/$target"
git init
git remote add origin "$5"
cd "$basedir"
fi
cd "$basedir/$target"
# Disable GPG signing before AM, slows things down and doesn't play nicely.
# There is also zero rational or logical reason to do so for these sub-repo AMs.
# Calm down kids, it's re-enabled (if needed) immediately after, pass or fail.
git config commit.gpgsign false
echo "Resetting $target to $what_name..."
git remote rm upstream > /dev/null 2>&1
git remote add upstream "$basedir/$what" >/dev/null 2>&1
git checkout master 2>/dev/null || git checkout -b master
git fetch upstream >/dev/null 2>&1
git reset --hard upstream/upstream
echo " Applying patches to $target..."
git am --abort >/dev/null 2>&1
git am --3way --ignore-whitespace "$basedir/patches/$patch_folder/"*.patch
if [ "$?" != "0" ]; then
echo " Something did not apply cleanly to $target."
echo " Please review above details and finish the apply then"
echo " save the changes with rebuildPatches.sh"
exit 1
else
echo " Patches applied cleanly to $target"
fi
}
function enableCommitSigningIfNeeded {
if [[ "$gpgsign" == "true" ]]; then
git config commit.gpgsign true
fi
}
echo "Importing MC-DEV"
./scripts/importmcdev.sh "$basedir" || exit 1
(
(applyPatch Paper/Paper-API ${FORK_NAME}-API HEAD api $API_REPO &&
applyPatch Paper/Paper-Server ${FORK_NAME}-Server HEAD server $SERVER_REPO) || exit 1
enableCommitSigningIfNeeded
) || (
echo "Failed to apply patches"
enableCommitSigningIfNeeded
exit 1
) || exit 1

View File

@@ -1,40 +0,0 @@
#!/usr/bin/env bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
. $(dirname $SOURCE)/init.sh
cd $basedir
paperVer=$(cat current-paper)
minecraftversion=$(cat $basedir/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
decompile="Paper/work/Minecraft/$minecraftversion/spigot"
mkdir -p mc-dev/src/net/minecraft
cd mc-dev
if [ ! -d ".git" ]; then
git init
fi
rm src/net/minecraft/*.java
cp -r $basedir/$decompile/net/minecraft/* src/net/minecraft
base="$basedir/Paper/Paper-Server/src/main/java/net/minecraft"
cd $basedir/mc-dev/src/net/minecraft/
for file in $(/bin/ls $base)
do
if [ -f "$file" ]; then
rm -f "$file"
fi
done
cd $basedir/mc-dev
git add . -A
git commit . -m "mc-dev"
git tag -a "$paperVer" -m "$paperVer" 2>/dev/null
pushRepo . $MCDEV_REPO $paperVer

View File

@@ -1,130 +0,0 @@
#!/usr/bin/env bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
. $(dirname $SOURCE)/init.sh
workdir="$basedir"/Paper/work
minecraftversion=$(cat "$basedir"/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
decompiledir=$workdir/Minecraft/$minecraftversion/spigot
nms="net/minecraft"
export MODLOG=""
cd "$basedir"
function containsElement {
local e
for e in "${@:2}"; do
[[ "$e" == "$1" ]] && return 0;
done
return 1
}
export importedmcdev=""
function import {
if [ -f "$basedir/Paper/Paper-Server/src/main/java/$nms/$1.java" ]; then
echo "ALREADY IMPORTED $1"
return 0
fi
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";
mkdir -p "$(dirname "$target")"
echo "$(bashColor 1 32) Copying $(bashColor 1 34)$base $(bashColor 1 32)to$(bashColor 1 34) $target $(bashColorReset)"
cp "$base" "$target"
else
echo "$(bashColor 1 33) UN-NEEDED IMPORT STATEMENT:$(bashColor 1 34) $file $(bashColorReset)"
fi
}
function importLibrary {
group=$1
lib=$2
prefix=$3
shift 3
for file in "$@"; do
file="$prefix/$file"
target="$basedir/Paper/Paper-Server/src/main/java/$file"
targetdir=$(dirname "$target")
mkdir -p "${targetdir}"
base="$workdir/Minecraft/$minecraftversion/libraries/${group}/${lib}/$file"
if [ ! -f "$base" ]; then
echo "Missing $base"
exit 1
fi
export MODLOG="$MODLOG Imported $file from $lib\n";
sed 's/\r$//' "$base" > "$target" || exit 1
done
}
(
cd Paper/Paper-Server/
lastlog=$(git log -1 --oneline)
if [[ "$lastlog" = *"Parchment-Extra mc-dev Imports"* ]]; then
git reset --hard HEAD^
fi
)
files=$(cat patches/server/* | grep "+++ b/src/main/java/net/minecraft/" | sort | uniq | sed 's/\+\+\+ b\/src\/main\/java\/net\/minecraft\///g')
nonnms=$(grep -R "new file mode" -B 1 "$basedir/patches/server/" | grep -v "new file mode" | grep -oE --color=none "net\/minecraft\/.*.java" | sed 's/.*\/net\/minecraft\///g')
for f in $files; do
containsElement "$f" ${nonnms[@]}
if [ "$?" == "1" ]; then
if [ ! -f "$basedir/Paper/Paper-Server/src/main/java/net/minecraft/$f" ]; then
f="$(echo "$f" | sed 's/.java//g')"
if [ ! -f "$decompiledir/$nms/$f.java" ]; then
echo "$(bashColor 1 31) ERROR!!! Missing NMS$(bashColor 1 34) $f $(bashColorReset)";
error=true
else
import $f
fi
fi
fi
done
if [ -n "$error" ]; then
exit 1
fi
###############################################################################################
###############################################################################################
#################### ADD TEMPORARY ADDITIONS HERE #############################################
###############################################################################################
###############################################################################################
# import Foo
import world/item/context/BlockActionContext
import world/level/block/BlockRespawnAnchor
import server/commands/CommandPlaySound
########################################################
########################################################
########################################################
# LIBRARY IMPORTS
# These must always be mapped manually, no automatic stuff
#
# # group # lib # prefix # many files
#importLibrary com.mojang datafixerupper com/mojang/datafixers/util Either.java
importLibrary com.mojang brigadier com/mojang/brigadier CommandDispatcher.java
importLibrary com.mojang brigadier com/mojang/brigadier/tree LiteralCommandNode.java
importLibrary com.mojang brigadier com/mojang/brigadier/suggestion SuggestionsBuilder.java
importLibrary com.mojang brigadier com/mojang/brigadier/arguments BoolArgumentType.java
################
(
cd Paper/Paper-Server/
rm -rf nms-patches
git add src -A
echo -e "Parchment-Extra mc-dev Imports\n\n$MODLOG" | git commit src -F -
exit 0
)

View File

@@ -1,65 +0,0 @@
#!/usr/bin/env bash
# BEGIN config
FORK_NAME="Parchment"
API_REPO=""
SERVER_REPO=""
PAPER_API_REPO=""
PAPER_SERVER_REPO=""
MCDEV_REPO=""
# END config
sourceBase=$(dirname $SOURCE)/../
cd "${basedir:-$sourceBase}"
basedir=$(pwd -P)
cd -
function bashColor {
if [ $2 ]; then
echo -e "\e[$1;$2m"
else
echo -e "\e[$1m"
fi
}
function bashColorReset {
echo -e "\e[m"
}
function cleanupPatches {
cd "$1"
for patch in *.patch; do
gitver=$(tail -n 2 $patch | grep -ve "^$" | tail -n 1)
diffs=$(git diff --staged $patch | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index|Date\: )")
testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver")
if [ "x$testver" != "x" ]; then
diffs=$(echo "$diffs" | tail -n +3)
fi
if [ "x$diffs" == "x" ] ; then
git reset HEAD $patch >/dev/null
git checkout -- $patch >/dev/null
fi
done
}
function pushRepo {
if [ "$(git config minecraft.push-${FORK_NAME})" == "1" ]; then
echo "Pushing - $1 ($3) to $2"
(
cd "$1"
git remote rm emc-push > /dev/null 2>&1
git remote add emc-push $2 >/dev/null 2>&1
git push emc-push $3 -f
)
fi
}
function basedir {
cd "$basedir"
}
function gethead {
(
cd "$1"
git log -1 --oneline
)
}

View File

@@ -1,26 +0,0 @@
#!/usr/bin/env bash
# Copied from https://github.com/PaperMC/Paper/blob/d54ce6c17fb7a35238d6b9f734d30a4289886773/scripts/paperclip.sh
# License from Paper applies to this file
(
set -e
basedir="$(cd "$1" && pwd -P)"
workdir="$basedir/Paper/work"
altworkdir="$basedir/work"
mcver=$(cat "$workdir/BuildData/info.json" | grep minecraftVersion | cut -d '"' -f 4)
paperjar="$basedir/Parchment-Server/target/parchment-$mcver.jar"
vanillajar="$workdir/Minecraft/$mcver/$mcver.jar"
(
cd "$altworkdir/Paperclip"
mvn clean package "-Dmcver=$mcver" "-Dpaperjar=$paperjar" "-Dvanillajar=$vanillajar"
)
cp "$altworkdir/Paperclip/assembly/target/paperclip-${mcver}.jar" "$basedir/parchment-paperclip.jar"
echo ""
echo ""
echo ""
echo "Build success!"
echo "Copied final jar to $(cd "$basedir" && pwd -P)/parchment-paperclip.jar"
) || exit 1

View File

@@ -1,15 +0,0 @@
#!/usr/bin/env bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
. $(dirname $SOURCE)/init.sh
minecraftversion=$(cat $basedir/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
basedir
pushRepo ${FORK_NAME}-API $API_REPO master:$minecraftversion
pushRepo ${FORK_NAME}-Server $SERVER_REPO master:$minecraftversion

View File

@@ -1,43 +0,0 @@
#!/usr/bin/env bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
. $(dirname $SOURCE)/init.sh
PS1="$"
echo "Rebuilding patch files from current fork state..."
function savePatches {
what=$1
cd $basedir/$what/
mkdir -p $basedir/patches/$2
if [ -d ".git/rebase-apply" ]; then
# in middle of a rebase, be smarter
echo "REBASE DETECTED - PARTIAL SAVE"
last=$(cat ".git/rebase-apply/last")
next=$(cat ".git/rebase-apply/next")
declare -a files=("$basedir/patches/$2/"*.patch)
for i in $(seq -f "%04g" 1 1 $last)
do
if [ $i -lt $next ]; then
rm "${files[`expr $i - 1`]}"
fi
done
else
rm $basedir/patches/$2/*.patch
fi
git format-patch --no-signature --zero-commit --full-index --no-stat -N -o $basedir/patches/$2 upstream/upstream
cd $basedir
git add -A $basedir/patches/$2
echo " Patches saved for $what to patches/$2"
}
savePatches ${FORK_NAME}-API api
savePatches ${FORK_NAME}-Server server
$basedir/scripts/push.sh

View File

@@ -1,64 +0,0 @@
#!/usr/bin/env bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
. $(dirname $SOURCE)/init.sh
git submodule update --init --recursive
if [[ "$1" == up* ]]; then
(
cd "$basedir/Paper/"
git fetch && git reset --hard origin/master
cd ../
git add Paper
)
fi
paperVer=$(gethead Paper)
cd "$basedir/Paper/"
./paper patch
cd "Paper-Server"
mcVer=$(mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=minecraft_version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }')
basedir
. "$basedir"/scripts/importmcdev.sh
minecraftversion=$(cat "$basedir"/Paper/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
version=$(echo -e "Paper: $paperVer\nmc-dev:$importedmcdev")
tag="${minecraftversion}-${mcVer}-$(echo -e $version | shasum | awk '{print $1}')"
echo "$tag" > "$basedir"/current-paper
"$basedir"/scripts/generatesources.sh
cd Paper/
function tag {
(
cd $1
if [ "$2" == "1" ]; then
git tag -d "$tag" 2>/dev/null
fi
echo -e "$(date)\n\n$version" | git tag -a "$tag" -F - 2>/dev/null
)
}
echo "Tagging as $tag"
echo -e "$version"
forcetag=0
if [ "$(cat "$basedir"/current-paper)" != "$tag" ]; then
forcetag=1
fi
tag Paper-API $forcetag
tag Paper-Server $forcetag
pushRepo Paper-API $PAPER_API_REPO $tag
pushRepo Paper-Server $PAPER_SERVER_REPO $tag

View File

@@ -1,28 +0,0 @@
#!/usr/bin/env bash
(
set -e
PS1="$"
function changelog() {
base=$(git ls-tree HEAD $1 | cut -d' ' -f3 | cut -f1)
cd $1 && git log --oneline ${base}...HEAD
}
paper=$(changelog Paper)
updated=""
logsuffix=""
if [ ! -z "$paper" ]; then
logsuffix="$logsuffix\n\nPaper Changes:\n$paper"
if [ -z "$updated" ]; then updated="Paper"; else updated="$updated/Paper"; fi
fi
disclaimer="Upstream has released updates that appears to apply and compile correctly"
if [ ! -z "$1" ]; then
disclaimer="$@"
fi
log="${UP_LOG_PREFIX}Updated Upstream ($updated)\n\n${disclaimer}${logsuffix}"
echo -e "$log" | git commit -F -
) || exit 1

10
settings.gradle.kts Normal file
View File

@@ -0,0 +1,10 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven("https://papermc.io/repo/repository/maven-public/")
}
}
rootProject.name = "Parchment"
include("Parchment-Common", "Parchment-API", "Parchment-Server")

Submodule work/Paperclip deleted from 1da6da880a