Compare commits
101 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4226a1891 | ||
|
|
67fbb12ac6 | ||
|
|
c8fb92aa1c | ||
|
|
745ad5f5ec | ||
|
|
30cb112a1f | ||
|
|
f0af4c4a47 | ||
|
|
00d0546253 | ||
|
|
b2bd357fa1 | ||
|
|
4f38df3a86 | ||
|
|
b349445305 | ||
|
|
1c9c208630 | ||
|
|
c0339695f2 | ||
|
|
14575216df | ||
|
|
ac92226367 | ||
|
|
08b0b99099 | ||
|
|
ff5d7eeea5 | ||
|
|
a85661d795 | ||
|
|
19995071a3 | ||
|
|
7513492ac3 | ||
|
|
f2efa03460 | ||
|
|
128eaee010 | ||
|
|
13dcd67dab | ||
|
|
c7c48f43ce | ||
|
|
4ba9f92ee8 | ||
|
|
34e46f1f2e | ||
|
|
dd0cf087a7 | ||
|
|
af48f69929 | ||
|
|
27dfe607d0 | ||
|
|
27b6e63860 | ||
|
|
20eb06bf00 | ||
|
|
442bfbc106 | ||
|
|
62f0bf8fb1 | ||
|
|
7a00395624 | ||
|
|
11e4c346e0 | ||
|
|
f9ccfb334c | ||
|
|
11c497aaf3 | ||
|
|
404fc76d6a | ||
|
|
33a9f946c8 | ||
|
|
bc7c3c582b | ||
|
|
dbd451d716 | ||
|
|
233e2ad297 | ||
|
|
0f543491f8 | ||
|
|
25f895f7b4 | ||
|
|
8297dd7053 | ||
|
|
a58622c682 | ||
|
|
fbcc0c8d7e | ||
|
|
7079ea5c72 | ||
|
|
5a042b7890 | ||
|
|
5de00a857b | ||
|
|
4a4988c41c | ||
|
|
61ca246d3e | ||
|
|
5349f5efca | ||
|
|
1e49000508 | ||
|
|
c10c214be6 | ||
|
|
f56e62551a | ||
|
|
c86fdfed02 | ||
|
|
1e67babfd1 | ||
|
|
cc4707ca24 | ||
|
|
5f8b7c1634 | ||
|
|
cdbf9dd0c0 | ||
|
|
f543fd9c9e | ||
|
|
9badc96ea9 | ||
|
|
7a57b7161e | ||
|
|
032462c78b | ||
|
|
34286527e1 | ||
|
|
67d6c32cd7 | ||
|
|
f2fde3abbe | ||
|
|
433dac7ed2 | ||
|
|
ae9187f3ec | ||
|
|
3a846f9469 | ||
|
|
453e83da00 | ||
|
|
ac12b75cf0 | ||
|
|
c6c1bac6ff | ||
|
|
92ade31e1a | ||
|
|
b52c6cf4a1 | ||
|
|
c0390c4da4 | ||
|
|
69b45eb0d3 | ||
|
|
f367ca28fd | ||
|
|
fb955ce090 | ||
|
|
0f82d8a3ce | ||
|
|
5e77896e2b | ||
|
|
9ad8ed7904 | ||
|
|
5ac0f49670 | ||
|
|
f23535bc3b | ||
|
|
719f0e7e5f | ||
|
|
81965b216b | ||
|
|
493c4f73fb | ||
|
|
517a07fde4 | ||
|
|
85f6e901d2 | ||
|
|
cc53d330c9 | ||
|
|
341529dcfb | ||
|
|
582d2af78f | ||
|
|
1bc915e6d8 | ||
|
|
9ffb9a2959 | ||
|
|
976cf01c7d | ||
|
|
bb61118ebd | ||
|
|
59d80138c2 | ||
|
|
3a858c547c | ||
|
|
1b6c470981 | ||
|
|
f60832eac3 | ||
|
|
c1ab15d472 |
32
.github/workflows/build.yml
vendored
32
.github/workflows/build.yml
vendored
@@ -1,32 +0,0 @@
|
||||
name: Patch and Build
|
||||
on: [ push, pull_request ]
|
||||
jobs:
|
||||
build:
|
||||
# Only run on PRs if the source branch is on someone else's repo
|
||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Git Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
- name: Cache Gradle
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/gradle.properties') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v2.3.0
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '16'
|
||||
- name: Configure Git User Details
|
||||
run: git config --global user.email "actions@github.com" && git config --global user.name "Github Actions"
|
||||
- name: Apply Patches
|
||||
run: ./gradlew applyPatches --stacktrace
|
||||
- name: Build
|
||||
run: ./gradlew build --stacktrace
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,5 +1,9 @@
|
||||
.gradle
|
||||
/build/
|
||||
.idea
|
||||
run
|
||||
slice-api
|
||||
slice-server
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
|
||||
18
build-data/reobf-mappings-patch.tiny
Normal file
18
build-data/reobf-mappings-patch.tiny
Normal file
@@ -0,0 +1,18 @@
|
||||
# We would like for paperweight to generate 100% perfect reobf mappings (and deobf mappings for that matter).
|
||||
# But unfortunately it's not quite there yet - and it may be some time before that happens. Generating perfect mappings
|
||||
# from Spigot's mappings is extremely difficult due to Spigot's bad tooling and bad mappings. To add insult to injury
|
||||
# we remap Spigot's _source code_ which is a lot more complex and error-prone than bytecode remapping. So with all that
|
||||
# said, this file exists to help fill in the gap.
|
||||
#
|
||||
# We will continue to improve paperweight and will work on fixing these issues so they don't come up in the first place,
|
||||
# but these mappings exist to prevent these issues from holding everything else in Paper up while we work through all
|
||||
# of these issues. Due to the complex nature of mappings generation and the debugging difficulty involved it may take
|
||||
# a significant amount of time for us to track down every possible issue, so this file will likely be around and in
|
||||
# use - at least in some capacity - for a long time.
|
||||
#
|
||||
# If you are adding mappings patches which are correcting for issues in paperweight's reobf mappings generation,
|
||||
# unrelated to any changes in your patches, we ask that you PR the mapping to Paper so more users can benefit rather
|
||||
# than keep the fix for your own fork. If the mappings patch is there to correct reobf for changes made in your patches,
|
||||
# then obviously it doesn't make any sense to PR them upstream.
|
||||
|
||||
tiny 2 0 mojang+yarn spigot
|
||||
@@ -3,21 +3,23 @@ import io.papermc.paperweight.util.constants.*
|
||||
plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "7.1.0" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.2.0"
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.3.9"
|
||||
}
|
||||
|
||||
val paperMavenPublicUrl = "https://papermc.io/repo/repository/maven-public/"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://papermc.io/repo/repository/maven-public/") {
|
||||
content { onlyForConfigurations(PAPERCLIP_CONFIG) }
|
||||
maven(paperMavenPublicUrl) {
|
||||
content { onlyForConfigurations(configurations.paperclip.name) }
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
remapper("net.fabricmc:tiny-remapper:0.6.0:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:1.5.498.12")
|
||||
paperclip("io.papermc:paperclip:2.0.1")
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.2:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:1.5.605.7")
|
||||
paperclip("io.papermc:paperclip:3.0.2")
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@@ -26,7 +28,7 @@ allprojects {
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(16))
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +36,7 @@ allprojects {
|
||||
subprojects {
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
options.release.set(16)
|
||||
options.release.set(17)
|
||||
}
|
||||
tasks.withType<Javadoc> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
@@ -45,28 +47,23 @@ subprojects {
|
||||
|
||||
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/")
|
||||
maven(paperMavenPublicUrl)
|
||||
}
|
||||
}
|
||||
|
||||
paperweight {
|
||||
serverProject.set(project(":Slice-Server"))
|
||||
serverProject.set(project(":slice-server"))
|
||||
|
||||
remapRepo.set("https://maven.fabricmc.net/")
|
||||
decompileRepo.set("https://files.minecraftforge.net/maven/")
|
||||
remapRepo.set(paperMavenPublicUrl)
|
||||
decompileRepo.set(paperMavenPublicUrl)
|
||||
|
||||
usePaperUpstream(providers.gradleProperty("paperRef")) {
|
||||
withPaperPatcher {
|
||||
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
|
||||
apiOutputDir.set(layout.projectDirectory.dir("Slice-API"))
|
||||
apiOutputDir.set(layout.projectDirectory.dir("slice-api"))
|
||||
|
||||
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
|
||||
serverOutputDir.set(layout.projectDirectory.dir("Slice-Server"))
|
||||
serverOutputDir.set(layout.projectDirectory.dir("slice-server"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,13 +77,9 @@ tasks.generateDevelopmentBundle {
|
||||
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
|
||||
libraryRepositories.set(
|
||||
listOf(
|
||||
"https://libraries.minecraft.net/",
|
||||
"https://maven.quiltmc.org/repository/release/",
|
||||
"https://repo.aikar.co/content/groups/aikar",
|
||||
"https://ci.emc.gs/nexus/content/groups/aikar/",
|
||||
"https://papermc.io/repo/repository/maven-public/",
|
||||
"https://repo.velocitypowered.com/snapshots/",
|
||||
"https://ysera.dyndns.org:444/releases/"
|
||||
"https://repo.maven.apache.org/maven2/",
|
||||
"https://test.lokamc.org:444/releases", // This should be a repo hosting your API (in this example, 'com.example.paperfork:slice-api'),
|
||||
paperMavenPublicUrl
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -98,7 +91,7 @@ allprojects {
|
||||
repositories {
|
||||
maven {
|
||||
name = "Ysera"
|
||||
url = uri("https://ysera.dyndns.org:444/releases")
|
||||
url = uri("https://test.lokamc.com:444/releases")
|
||||
// See Gradle docs for how to provide credentials to PasswordCredentials
|
||||
// https://docs.gradle.org/current/samples/sample_publishing_credentials.html
|
||||
credentials(PasswordCredentials::class)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
group=com.lokamc.slice
|
||||
version=1.17.1-R0.1-SNAPSHOT
|
||||
version=1.19.2-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion=1.17.1
|
||||
paperRef=bf23668bc56a31ccf9ff7c7b290bb0442afebff6
|
||||
mcVersion=1.19.2
|
||||
paperRef=96fdafd9354f1d27d56ccc1cf7276f1552182659
|
||||
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
234
gradlew
vendored
Executable file
234
gradlew
vendored
Executable file
@@ -0,0 +1,234 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original 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 POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${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 "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# 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 ;; #(
|
||||
MSYS* | 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" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
89
gradlew.bat
vendored
Normal file
89
gradlew.bat
vendored
Normal 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
|
||||
@@ -1,15 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 08:33:45 -0500
|
||||
Date: Fri, 12 Aug 2022 08:16:16 -0500
|
||||
Subject: [PATCH] Add PlayerShieldDisableEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f0f3a57a0ce76b4736219c6ece52b8bc47a7a4ec
|
||||
index 0000000000000000000000000000000000000000..d4bda54582228377c902e4743168e084e1bf8b2d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
|
||||
@@ -0,0 +1,50 @@
|
||||
@@ -0,0 +1,60 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
@@ -27,11 +27,13 @@ index 0000000000000000000000000000000000000000..f0f3a57a0ce76b4736219c6ece52b8bc
|
||||
+public class PlayerShieldDisableEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Entity damager;
|
||||
+ private int cooldown;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ public PlayerShieldDisableEvent(@NotNull final Player player, @Nullable final Entity damager) {
|
||||
+ public PlayerShieldDisableEvent(@NotNull final Player player, @Nullable final Entity damager, int cooldown) {
|
||||
+ super(player);
|
||||
+ this.damager = damager;
|
||||
+ this.cooldown = cooldown;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
@@ -39,6 +41,14 @@ index 0000000000000000000000000000000000000000..f0f3a57a0ce76b4736219c6ece52b8bc
|
||||
+ return damager;
|
||||
+ }
|
||||
+
|
||||
+ public int getCooldown() {
|
||||
+ return cooldown;
|
||||
+ }
|
||||
+
|
||||
+ public void setCooldown(int cooldown) {
|
||||
+ this.cooldown = cooldown;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 15:20:16 -0500
|
||||
Subject: [PATCH] Multiple Entries with Scoreboards
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
index d5b39fb4fc16a342b5661e08df1506858168d20d..9ec00b045fe85701ce29c0ad10eb9921733107b3 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.scoreboard;
|
||||
|
||||
+import java.util.Collection; // Paper
|
||||
import java.util.Set;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -317,6 +318,20 @@ public interface Team {
|
||||
*/
|
||||
void addEntry(@NotNull String entry) throws IllegalStateException, IllegalArgumentException;
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * This puts a collection of entries onto this team for the scoreboard which results in one
|
||||
+ * packet for the updates rather than a packet-per-entry.
|
||||
+ * <p>
|
||||
+ * Entries on other teams will be removed from their respective teams.
|
||||
+ *
|
||||
+ * @param entries the entries to add
|
||||
+ * @throws IllegalArgumentException if entries are null
|
||||
+ * @throws IllegalStateException if this team has been unregistered
|
||||
+ */
|
||||
+ void addEntries(@NotNull Collection<String> entries) throws IllegalStateException, IllegalArgumentException;
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Removes the player from this team.
|
||||
*
|
||||
@@ -340,6 +355,19 @@ public interface Team {
|
||||
*/
|
||||
boolean removeEntry(@NotNull String entry) throws IllegalStateException, IllegalArgumentException;
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Removes a collection of entries from this team which results in one
|
||||
+ * packet for the updates rather than a packet-per-entry.
|
||||
+ *
|
||||
+ * @param entries the entries to remove
|
||||
+ * @return if any of the entries were a part of this team
|
||||
+ * @throws IllegalArgumentException if entry is null
|
||||
+ * @throws IllegalStateException if this team has been unregistered
|
||||
+ */
|
||||
+ boolean removeEntries(@NotNull Collection<String> entries) throws IllegalStateException, IllegalArgumentException;
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Unregisters this team from the Scoreboard
|
||||
*
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Wed, 22 Sep 2021 09:41:27 -0500
|
||||
Subject: [PATCH] Set BlockData without light update
|
||||
Date: Fri, 12 Aug 2022 08:20:02 -0500
|
||||
Subject: [PATCH] Set BlockData without light updates
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index ad8bce01ba459a036cd4ebbbe4fc974021924fe2..6ef43ae39a8ad4ed0e9a7bf68c17840576e235ea 100644
|
||||
index 9930ebe7a23d306c602840fd43652fbdaba481b3..ed65bb8867bc2b8e67726dee07a82ac3671b0306 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -287,6 +287,28 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
@@ -297,6 +297,28 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
*/
|
||||
void setBlockData(@NotNull BlockData data, boolean applyPhysics);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 09:00:51 -0500
|
||||
Date: Fri, 12 Aug 2022 09:54:07 -0500
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 29 Sep 2021 08:40:37 -0500
|
||||
Date: Fri, 12 Aug 2022 10:40:48 -0500
|
||||
Subject: [PATCH] Add provided Material to getDrops
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index cd63406809aadbcc53857aaef31053915278dfc0..ab4982d52185bbc80d506da2a961345d46710efa 100644
|
||||
index 814bad7830fd0ceb741a4b31685dd2576a0a57c2..1e0e90b64f39125c82d87bab970afbd90072944d 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -602,6 +602,20 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
@@ -665,6 +665,20 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
@NotNull
|
||||
Collection<ItemStack> getDrops(@NotNull ItemStack tool, @Nullable Entity entity);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 16:36:29 -0500
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 12 Aug 2022 10:41:44 -0500
|
||||
Subject: [PATCH] Add Player to SpongeAbsorbEvent
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 18 Oct 2021 08:52:40 -0500
|
||||
Subject: [PATCH] World Instance Flag
|
||||
Date: Fri, 12 Aug 2022 10:45:51 -0500
|
||||
Subject: [PATCH] Add World Instance flag
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 4f673e9123145dc78564dc3eef0edf75795dafc2..c840fccc7d5eab215886c3281be3a6257fa01aad 100644
|
||||
index e8c0c853eb52d1473c20231660355f77b1f7e016..02e524f718566a13880c9417518ebaeca816a8fc 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -2606,6 +2606,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@@ -2591,6 +2591,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
*/
|
||||
public void setAutoSave(boolean value);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Tue, 7 Dec 2021 07:59:41 -0600
|
||||
Date: Fri, 12 Aug 2022 10:52:37 -0500
|
||||
Subject: [PATCH] Add player data saving events
|
||||
|
||||
|
||||
65
patches/api/0008-Add-PlayerGetRespawnLocationEvent.patch
Normal file
65
patches/api/0008-Add-PlayerGetRespawnLocationEvent.patch
Normal file
@@ -0,0 +1,65 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 12 Aug 2022 11:00:39 -0500
|
||||
Subject: [PATCH] Add PlayerGetRespawnLocationEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7eca4d6929fc7a75974d182c1ea692d3823a19c0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java
|
||||
@@ -0,0 +1,53 @@
|
||||
+package org.bukkit.event.player;
|
||||
+
|
||||
+import org.apache.commons.lang3.Validate;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a respawn event tries to determine the location of a respawn
|
||||
+ */
|
||||
+public class PlayerGetRespawnLocationEvent extends PlayerEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private Location respawnLocation;
|
||||
+
|
||||
+ public PlayerGetRespawnLocationEvent(@NotNull final Player respawnPlayer) {
|
||||
+ super(respawnPlayer);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the current respawn location
|
||||
+ *
|
||||
+ * @return Location current respawn location
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getRespawnLocation() {
|
||||
+ return this.respawnLocation;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the new respawn location
|
||||
+ *
|
||||
+ * @param respawnLocation new location for the respawn
|
||||
+ */
|
||||
+ public void setRespawnLocation(@NotNull Location respawnLocation) {
|
||||
+ Validate.notNull(respawnLocation, "Respawn location can not be null");
|
||||
+ Validate.notNull(respawnLocation.getWorld(), "Respawn world can not be null");
|
||||
+
|
||||
+ this.respawnLocation = respawnLocation;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,52 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 30 Nov 2021 12:04:50 -0600
|
||||
Subject: [PATCH] PlayerTrackEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerTrackEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerTrackEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0532a7986a8091e82f1fc64b9654be26d6c8ea5e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerTrackEntityEvent.java
|
||||
@@ -0,0 +1,40 @@
|
||||
+package org.bukkit.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player tracks an entity.
|
||||
+ */
|
||||
+public class PlayerTrackEntityEvent extends PlayerEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Entity tracked;
|
||||
+
|
||||
+ public PlayerTrackEntityEvent(@NotNull final Player player, @NotNull final Entity tracked) {
|
||||
+ super(player);
|
||||
+ this.tracked = tracked;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity newly tracked by the Player
|
||||
+ *
|
||||
+ * @return Entity the player is now tracking
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getTracked() {
|
||||
+ return tracked;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
35
patches/api/0009-Set-multiple-Team-settings-at-once.patch
Normal file
35
patches/api/0009-Set-multiple-Team-settings-at-once.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 13 Aug 2022 08:40:03 -0500
|
||||
Subject: [PATCH] Set multiple Team settings at once
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
index 06a5d3177ca7ab90c3fd9d2053b2ec5e887c7c62..31e2756c134462debfcfa768d2d0ccb988046d72 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
@@ -532,6 +532,24 @@ public interface Team {
|
||||
boolean hasEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException;
|
||||
// Paper end
|
||||
|
||||
+ //Slice start
|
||||
+ /**
|
||||
+ * Fully set all team options, combining all 5 options into one packet send, rather than one packet sent
|
||||
+ * for every single option change.
|
||||
+ * @param displayName New display name
|
||||
+ * @param prefix New prefix
|
||||
+ * @param suffix New suffix
|
||||
+ * @param color new color
|
||||
+ * @param options A Paired list of options
|
||||
+ * @throws IllegalStateException
|
||||
+ */
|
||||
+ void teamOptions(net.kyori.adventure.text.Component displayName,
|
||||
+ net.kyori.adventure.text.Component prefix,
|
||||
+ net.kyori.adventure.text.Component suffix,
|
||||
+ net.kyori.adventure.text.format.NamedTextColor color,
|
||||
+ java.util.List<org.apache.commons.lang3.tuple.Pair<Option, OptionStatus>> options) throws IllegalStateException;
|
||||
+ //Slice end
|
||||
+
|
||||
/**
|
||||
* Represents an option which may be applied to this team.
|
||||
*/
|
||||
30
patches/api/0010-Smooth-Teleports.patch
Normal file
30
patches/api/0010-Smooth-Teleports.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 13 Aug 2022 08:58:21 -0500
|
||||
Subject: [PATCH] Smooth Teleports
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index de960716478477ce199526b8f860cfafa1541ee9..adddf2c924e9fb3650b88c8ea64644f26bd533da 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2780,6 +2780,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
String getClientBrandName();
|
||||
// Paper end
|
||||
|
||||
+ /**
|
||||
+ * This abuses some of how Minecraft works and allows teleporting a player to another world without
|
||||
+ * triggering typical respawn packets. All of natural state of chunk resends, entity adds/removes, etc still
|
||||
+ * happen but the visual "refresh" of a world change is hidden. Depending on the destination location/world,
|
||||
+ * this can act as a "smooth teleport" to a world if the new world is very similar looking to the old one.
|
||||
+ *
|
||||
+ * @param location New location to teleport this Player to
|
||||
+ */
|
||||
+ // Slice start
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental
|
||||
+ void teleportWithoutRespawn(Location location);
|
||||
+ // Slice end
|
||||
+
|
||||
// Paper start - Teleport API
|
||||
/**
|
||||
* Sets the player's rotation.
|
||||
149
patches/api/0011-Equipment-Packet-Caching.patch
Normal file
149
patches/api/0011-Equipment-Packet-Caching.patch
Normal file
@@ -0,0 +1,149 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 18 Nov 2022 08:02:12 -0600
|
||||
Subject: [PATCH] Equipment Packet Caching
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index ead90b002034c463983af948a4fb882109b8d3a2..aa58f8c94e967465e79f85f08b45b86e1bce7803 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -1107,4 +1107,11 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount);
|
||||
// Paper end
|
||||
+
|
||||
+ // Slice start
|
||||
+ /**
|
||||
+ * @param p The player to send this entity's equipment packet to
|
||||
+ */
|
||||
+ void sendEquipment(Player p);
|
||||
+ // Slice end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityEquipmentItemLookup.java b/src/main/java/org/bukkit/event/entity/EntityEquipmentItemLookup.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6c329ca3c22d1fd712041334c5c1e7bd7e7201ac
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityEquipmentItemLookup.java
|
||||
@@ -0,0 +1,54 @@
|
||||
+package org.bukkit.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when requesting a cached equipment item lookup
|
||||
+ */
|
||||
+public class EntityEquipmentItemLookup extends EntityEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final String tag;
|
||||
+ private final EquipmentSlot equipmentSlot;
|
||||
+ private ItemStack itemStack;
|
||||
+
|
||||
+ public EntityEquipmentItemLookup(@NotNull final Entity entity, @NotNull String tag, @NotNull EquipmentSlot slot, @NotNull final ItemStack itemStack) {
|
||||
+ super(entity);
|
||||
+ this.tag = tag;
|
||||
+ this.equipmentSlot = slot;
|
||||
+ this.itemStack = itemStack;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return itemStack;
|
||||
+ }
|
||||
+
|
||||
+ public void setItemStack(ItemStack itemStack) {
|
||||
+ this.itemStack = itemStack;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public EquipmentSlot getEquipmentSlot() {
|
||||
+ return equipmentSlot;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getTag() {
|
||||
+ return tag;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerReceiveEquipmentEvent.java b/src/main/java/org/bukkit/event/player/PlayerReceiveEquipmentEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..513d62342d8e29e8d3c92fe932d0d77f659cf2f1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerReceiveEquipmentEvent.java
|
||||
@@ -0,0 +1,61 @@
|
||||
+package org.bukkit.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player is about to receive an equipment packet about another player
|
||||
+ */
|
||||
+public class PlayerReceiveEquipmentEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Entity tracked;
|
||||
+ private boolean cancel;
|
||||
+ private String tag;
|
||||
+
|
||||
+ public PlayerReceiveEquipmentEvent(@NotNull final Player player, @NotNull final Entity tracked) {
|
||||
+ super(player);
|
||||
+ this.tracked = tracked;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the tracked entity
|
||||
+ *
|
||||
+ * @return Entity the player is now tracking
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getTracked() {
|
||||
+ return tracked;
|
||||
+ }
|
||||
+
|
||||
+ public String getTag() {
|
||||
+ return tag;
|
||||
+ }
|
||||
+
|
||||
+ public void setTag(String tag) {
|
||||
+ this.tag = tag;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
21
patches/api/0012-AntiXray-Bypass.patch
Normal file
21
patches/api/0012-AntiXray-Bypass.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 18 Nov 2022 08:03:20 -0600
|
||||
Subject: [PATCH] AntiXray Bypass
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index adddf2c924e9fb3650b88c8ea64644f26bd533da..78f9ae7f6a8c625cb66e3b241adfdec25d5b2497 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2560,6 +2560,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
boolean hasResourcePack();
|
||||
|
||||
+ // Slice start
|
||||
+ void toggleAntiXrayBypass(boolean bypass);
|
||||
+ // Slice end
|
||||
+
|
||||
/**
|
||||
* Gets a copy of this players profile
|
||||
* @return The players profile object
|
||||
95
patches/api/0013-PlayerPreChunkLoadEvent.patch
Normal file
95
patches/api/0013-PlayerPreChunkLoadEvent.patch
Normal file
@@ -0,0 +1,95 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 18 Nov 2022 08:06:32 -0600
|
||||
Subject: [PATCH] PlayerPreChunkLoadEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerPreChunkLoadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerPreChunkLoadEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b5cc9538a70c7ce0b494d4878d51b52134c2fd75
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/packet/PlayerPreChunkLoadEvent.java
|
||||
@@ -0,0 +1,69 @@
|
||||
+package io.papermc.paper.event.packet;
|
||||
+
|
||||
+import org.bukkit.Chunk;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Is called when a {@link Player} is about to receive a {@link Chunk}
|
||||
+ * <p>
|
||||
+ * Can be cancelled, but only use if you really really mean it.
|
||||
+ */
|
||||
+public class PlayerPreChunkLoadEvent extends Event implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final World world;
|
||||
+ private final int chunkX;
|
||||
+ private final int chunkZ;
|
||||
+ private final Player player;
|
||||
+ private boolean cancel;
|
||||
+
|
||||
+ public PlayerPreChunkLoadEvent(World world, int chunkX, int chunkZ, @NotNull Player player) {
|
||||
+ this.world = world;
|
||||
+ this.chunkX = chunkX;
|
||||
+ this.chunkZ = chunkZ;
|
||||
+ this.player = player;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public World getWorld() {
|
||||
+ return world;
|
||||
+ }
|
||||
+
|
||||
+ public int getChunkX() {
|
||||
+ return chunkX;
|
||||
+ }
|
||||
+
|
||||
+ public int getChunkZ() {
|
||||
+ return chunkZ;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index adb5fcbacf5fa284e4c6efc1dcc0f30f3932761c..27f6db119f0c720e191ba7f9b64d8aded972a8f9 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -515,6 +515,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
//@Deprecated // Paper
|
||||
public boolean refreshChunk(int x, int z);
|
||||
|
||||
+ it.unimi.dsi.fastutil.longs.LongOpenHashSet getSentChunks(Player p); // Slice
|
||||
+
|
||||
/**
|
||||
* Gets whether the chunk at the specified chunk coordinates is force
|
||||
* loaded.
|
||||
@@ -1,25 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 08:25:29 -0500
|
||||
From: MiniDigger <admin@minidigger.me>
|
||||
Date: Fri, 12 Aug 2022 08:07:34 -0500
|
||||
Subject: [PATCH] Build Changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index f442236efe30d7d9e0c6a8dfb0f040540dc62753..bcdeb5a1c3c10d86d116dbf4257eb7b9d12f4426 100644
|
||||
index d5d49bb2b47c889e12d17dc87b8c439a60b3fe67..7c6c8d46a322d5a7406e68fb3288591661e6bf55 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -22,8 +22,8 @@ repositories {
|
||||
@@ -7,8 +7,12 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":Paper-API"))
|
||||
- implementation(project(":Paper-MojangAPI"))
|
||||
+ implementation(project(":Slice-API")) // Slice
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.17.1-R0.1-SNAPSHOT") // Slice
|
||||
- implementation(project(":paper-api"))
|
||||
- implementation(project(":paper-mojangapi"))
|
||||
+ // Slice start
|
||||
+ implementation(project(":slice-api"))
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.19.2-R0.1-SNAPSHOT") {
|
||||
+ exclude("io.papermc.paper", "paper-api")
|
||||
+ }
|
||||
+ // Slice end
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -75,7 +75,7 @@ tasks.jar {
|
||||
@@ -61,7 +65,7 @@ tasks.jar {
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
@@ -28,33 +32,33 @@ index f442236efe30d7d9e0c6a8dfb0f040540dc62753..bcdeb5a1c3c10d86d116dbf4257eb7b9
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
@@ -202,7 +202,7 @@ tasks.test {
|
||||
fun TaskContainer.registerRunTask(
|
||||
name: String, block: JavaExec.() -> Unit
|
||||
@@ -133,7 +137,7 @@ fun TaskContainer.registerRunTask(
|
||||
name: String,
|
||||
block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
- group = "paper"
|
||||
+ group = "paperweight"
|
||||
mainClass.set("org.bukkit.craftbukkit.Main")
|
||||
standardInput = System.`in`
|
||||
workingDir = rootProject.layout.projectDirectory.dir(
|
||||
providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
|
||||
workingDir = rootProject.layout.projectDirectory
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 5a4172faaf960d48939d6a485719041987df9242..402367f10b126c7d527e5a2b5319d331dce81857 100644
|
||||
index 710ca7d3a5659953f64bc6dccdd93b43300961cc..6f11e51dd4626c079d67a6fb5359e0736946629a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1729,7 +1729,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1654,7 +1654,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
- return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
+ return "Slice"; //Slice - Slice > //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
+ return "Slice"; // Slice - Slice > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport details) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 99a94898316b0601f55b333c15a9926eae24f8a2..f20dc9edfa15fd7705570830955d1b82b4fd59e3 100644
|
||||
index bfc4ee36befb925ab4eb6b96f5c1aa6c76bf711f..5aa66a1afeefb8ea8ff0987fbc3777c1c6c7b83e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -251,7 +251,7 @@ import javax.annotation.Nullable; // Paper
|
||||
@@ -261,7 +261,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
|
||||
@@ -1,35 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 08:33:45 -0500
|
||||
Date: Fri, 12 Aug 2022 08:16:16 -0500
|
||||
Subject: [PATCH] Add PlayerShieldDisableEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 8a864238e154e2131834d013652746b7e7a78c97..806975b124bf91ae560dc3a0289f3a298373546d 100644
|
||||
index 49b983064ea810382b6112f5dc7f93ba4e5710bd..efa3d635251fcf2b3293f9ad25ff1f2500445e80 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1588,6 +1588,7 @@ public abstract class Mob extends LivingEntity {
|
||||
@@ -1660,7 +1660,10 @@ public abstract class Mob extends LivingEntity {
|
||||
float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F;
|
||||
|
||||
if (this.random.nextFloat() < f) {
|
||||
+ if (!new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) player.getBukkitEntity(), getBukkitEntity()).callEvent()) return; // Slice
|
||||
player.getCooldowns().addCooldown(Items.SHIELD, 100);
|
||||
- player.getCooldowns().addCooldown(Items.SHIELD, 100);
|
||||
+ //Slice start
|
||||
+ io.papermc.paper.event.player.PlayerShieldDisableEvent shieldDisableEvent = new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) player.getBukkitEntity(), getBukkitEntity(), 100);
|
||||
+ if (!shieldDisableEvent.callEvent()) return; // Slice
|
||||
+ player.getCooldowns().addCooldown(Items.SHIELD, shieldDisableEvent.getCooldown());
|
||||
this.level.broadcastEntityEvent(player, (byte) 30);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index cea92f1dc663bf0648b2bd877d86ca380a517bc9..a1d1d8b5fbb5d7f8e980b4c116b8fec34f8878d5 100644
|
||||
index 61597ebe2f9faff43994c475074b87d11905e582..2ebb2e95241caf0393ed5db8f02776f566b88960 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -936,7 +936,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -972,7 +972,7 @@ public abstract class Player extends LivingEntity {
|
||||
protected void blockUsingShield(LivingEntity attacker) {
|
||||
super.blockUsingShield(attacker);
|
||||
if (attacker.getMainHandItem().getItem() instanceof AxeItem) {
|
||||
if (attacker.canDisableShield()) {
|
||||
- this.disableShield(true);
|
||||
+ this.disableShield(true, attacker); // Slice
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1403,6 +1403,12 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1456,6 +1456,12 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
public void disableShield(boolean sprinting) {
|
||||
@@ -42,12 +46,17 @@ index cea92f1dc663bf0648b2bd877d86ca380a517bc9..a1d1d8b5fbb5d7f8e980b4c116b8fec3
|
||||
float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F;
|
||||
|
||||
if (sprinting) {
|
||||
@@ -1410,6 +1416,8 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1463,7 +1469,12 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
if (this.random.nextFloat() < f) {
|
||||
+ org.bukkit.entity.Entity finalAttacker = attacker != null ? attacker.getBukkitEntity() : null; // Slice
|
||||
+ if (!new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) getBukkitEntity(), finalAttacker).callEvent()) return; // Slice
|
||||
this.getCooldowns().addCooldown(Items.SHIELD, 100);
|
||||
- this.getCooldowns().addCooldown(Items.SHIELD, 100);
|
||||
+ // Slice start
|
||||
+ org.bukkit.entity.Entity finalAttacker = attacker != null ? attacker.getBukkitEntity() : null;
|
||||
+ io.papermc.paper.event.player.PlayerShieldDisableEvent shieldDisableEvent = new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) getBukkitEntity(), finalAttacker, 100);
|
||||
+ if (!shieldDisableEvent.callEvent()) return;
|
||||
+ this.getCooldowns().addCooldown(Items.SHIELD, shieldDisableEvent.getCooldown());
|
||||
+ // Slice end
|
||||
this.stopUsingItem();
|
||||
this.level.broadcastEntityEvent(this, (byte) 30);
|
||||
}
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 15:20:15 -0500
|
||||
Subject: [PATCH] Multiple Entries with Scoreboards
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
|
||||
index 4c9660176e783999301565790b8cf6f47b0d02a2..3f1b093ae766c6e219ee233a75c64f0c522cc6c2 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
|
||||
@@ -42,6 +42,12 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi
|
||||
return new ClientboundSetPlayerTeamPacket(team.getName(), operation == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, Optional.empty(), ImmutableList.of(playerName));
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static ClientboundSetPlayerTeamPacket createMultiplePlayerPacket(PlayerTeam team, Collection<String> players, ClientboundSetPlayerTeamPacket.Action operation) {
|
||||
+ return new ClientboundSetPlayerTeamPacket(team.getName(), operation == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, Optional.empty(), players);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public ClientboundSetPlayerTeamPacket(FriendlyByteBuf buf) {
|
||||
this.name = buf.readUtf(16);
|
||||
this.method = buf.readByte();
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerScoreboard.java b/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
index 130a928f156961bae9ca184b3ca31004dbba1012..5d42967b1d9cbceb004566c0c503df21d1bb5c51 100644
|
||||
--- a/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
+++ b/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
@@ -3,6 +3,7 @@ package net.minecraft.server;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Iterator;
|
||||
+import java.util.Collection; // Paper
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
@@ -92,6 +93,19 @@ public class ServerScoreboard extends Scoreboard {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean addPlayersToTeam(Collection<String> players, PlayerTeam team) {
|
||||
+ if (super.addPlayersToTeam(players, team)) {
|
||||
+ this.sendAll(ClientboundSetPlayerTeamPacket.createMultiplePlayerPacket(team, players, ClientboundSetPlayerTeamPacket.Action.ADD));
|
||||
+ this.setDirty();
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void removePlayerFromTeam(String playerName, PlayerTeam team) {
|
||||
super.removePlayerFromTeam(playerName, team);
|
||||
@@ -99,6 +113,19 @@ public class ServerScoreboard extends Scoreboard {
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean removePlayersFromTeam(Collection<String> players, PlayerTeam team) {
|
||||
+ if (super.removePlayersFromTeam(players, team)) {
|
||||
+ this.sendAll(ClientboundSetPlayerTeamPacket.createMultiplePlayerPacket(team, players, ClientboundSetPlayerTeamPacket.Action.REMOVE));
|
||||
+ this.setDirty();
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void onObjectiveAdded(Objective objective) {
|
||||
super.onObjectiveAdded(objective);
|
||||
diff --git a/src/main/java/net/minecraft/world/scores/Scoreboard.java b/src/main/java/net/minecraft/world/scores/Scoreboard.java
|
||||
index 3e75ea4d5a6c83ca570b29e3c1a5d51fb132379a..246bb45d73c3948fae081662995ada7cdb49822d 100644
|
||||
--- a/src/main/java/net/minecraft/world/scores/Scoreboard.java
|
||||
+++ b/src/main/java/net/minecraft/world/scores/Scoreboard.java
|
||||
@@ -224,6 +224,28 @@ public class Scoreboard {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public boolean addPlayersToTeam(Collection<String> players, PlayerTeam team) {
|
||||
+ boolean anyAdded = false;
|
||||
+ for (String playerName : players) {
|
||||
+ if (playerName.length() > 40) {
|
||||
+ net.minecraft.server.MinecraftServer.LOGGER.warn("The player name '" + playerName + "' is too long!");
|
||||
+ } else {
|
||||
+ if (this.getPlayersTeam(playerName) != null) {
|
||||
+ this.removePlayerFromTeam(playerName);
|
||||
+ }
|
||||
+
|
||||
+ this.teamsByPlayer.put(playerName, team);
|
||||
+ if (team.getPlayers().add(playerName)) {
|
||||
+ anyAdded = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return anyAdded;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public boolean removePlayerFromTeam(String playerName) {
|
||||
PlayerTeam playerTeam = this.getPlayersTeam(playerName);
|
||||
if (playerTeam != null) {
|
||||
@@ -243,6 +265,24 @@ public class Scoreboard {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public boolean removePlayersFromTeam(Collection<String> players, PlayerTeam team) {
|
||||
+ boolean anyRemoved = false;
|
||||
+ for (String playerName : players) {
|
||||
+ if (this.getPlayersTeam(playerName) != team) {
|
||||
+ net.minecraft.server.MinecraftServer.LOGGER.warn("Player " + playerName + " is either on another team or not on any team. Cannot remove from team '" + team.getName() + "'.");
|
||||
+ } else {
|
||||
+ this.teamsByPlayer.remove(playerName);
|
||||
+ if (team.getPlayers().remove(playerName)) {
|
||||
+ anyRemoved = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return anyRemoved;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public Collection<String> getTeamNames() {
|
||||
return this.teamsByName.keySet();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
index 2b87a652798cb632fe76bf20e9e7f8cb8bfb3b7b..f097e9fbdac1a572c12cc0299774455c75e373e9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.craftbukkit.scoreboard;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
+import java.util.Collection; // Paper
|
||||
import java.util.Set;
|
||||
import net.minecraft.world.scores.PlayerTeam;
|
||||
import net.minecraft.world.scores.Team.Visibility;
|
||||
@@ -226,6 +227,16 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
scoreboard.board.addPlayerToTeam(entry, team);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void addEntries(Collection<String> entries) throws IllegalStateException, IllegalArgumentException {
|
||||
+ Validate.notNull(entries, "Entries cannot be null");
|
||||
+ CraftScoreboard scoreboard = checkState();
|
||||
+
|
||||
+ scoreboard.board.addPlayersToTeam(entries, team);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException {
|
||||
Validate.notNull(player, "OfflinePlayer cannot be null");
|
||||
@@ -245,6 +256,25 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean removeEntries(Collection<String> entries) throws IllegalStateException, IllegalArgumentException {
|
||||
+ Validate.notNull(entries, "Entry cannot be null");
|
||||
+ CraftScoreboard scoreboard = this.checkState();
|
||||
+
|
||||
+ boolean anyRemoved = false;
|
||||
+ Collection<String> teamPlayers = this.team.getPlayers();
|
||||
+ for (String entry : entries) {
|
||||
+ if (teamPlayers.remove(entry)) {
|
||||
+ anyRemoved = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ scoreboard.board.removePlayersFromTeam(entries, team);
|
||||
+ return anyRemoved;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException {
|
||||
Validate.notNull(player, "OfflinePlayer cannot be null");
|
||||
@@ -1,36 +1,36 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Wed, 22 Sep 2021 09:41:27 -0500
|
||||
Subject: [PATCH] Set BlockData without light update
|
||||
Date: Fri, 12 Aug 2022 08:20:02 -0500
|
||||
Subject: [PATCH] Set BlockData without light updates
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
index 21d1e0c9c471e9e556b5bd70166a769b46105c7a..d46dc12001bd46596c3bb2e24144bbe4d2d3a5e1 100644
|
||||
index 877498729c66de9aa6a27c9148f7494d7895615c..63959d7f15c682c2935f872d50de03fdacf95db4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -241,7 +241,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
@@ -235,7 +235,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
Block.dropResources(iblockdata, this.level, pos, tileentity, breakingEntity, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
- return this.setBlock(pos, Blocks.AIR.defaultBlockState(), 3, maxUpdateDepth);
|
||||
+ return this.setBlock(pos, Blocks.AIR.defaultBlockState(), 3, maxUpdateDepth, true);
|
||||
+ return this.setBlock(pos, Blocks.AIR.defaultBlockState(), 3, maxUpdateDepth, true); // Slice
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
@@ -310,7 +310,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) { // Slice
|
||||
if (!this.ensureCanWrite(pos)) {
|
||||
return false;
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 9cafd000b3533ed9fd35df2ec880f55e262084fb..8420d615867faa717266d1edfa5a469df1b1e43f 100644
|
||||
index 3cbf801b2e5420c0e870f73788deb550e49ad54d..264a6bc9f174a42dfeed4822dbb1bd3cc608d108 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -541,12 +541,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -508,12 +508,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,16 +46,16 @@ index 9cafd000b3533ed9fd35df2ec880f55e262084fb..8420d615867faa717266d1edfa5a469d
|
||||
// CraftBukkit start - tree generation
|
||||
if (this.captureTreeGeneration) {
|
||||
// Paper start
|
||||
@@ -593,7 +593,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -560,7 +560,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
} else {
|
||||
BlockState iblockdata2 = this.getBlockState(pos);
|
||||
|
||||
- if ((flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock((BlockGetter) this, pos) != iblockdata1.getLightBlock((BlockGetter) this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
|
||||
+ if (checkLight && (flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock((BlockGetter) this, pos) != iblockdata1.getLightBlock((BlockGetter) this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
|
||||
- if ((flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock(this, pos) != iblockdata1.getLightBlock(this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
|
||||
+ if (checkLight && (flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock(this, pos) != iblockdata1.getLightBlock(this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
|
||||
this.getProfiler().push("queueCheckLight");
|
||||
this.getChunkSource().getLightEngine().checkBlock(pos);
|
||||
this.getProfiler().pop();
|
||||
@@ -740,7 +740,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -708,7 +708,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
Block.dropResources(iblockdata, this, pos, tileentity, breakingEntity, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@@ -63,9 +63,9 @@ index 9cafd000b3533ed9fd35df2ec880f55e262084fb..8420d615867faa717266d1edfa5a469d
|
||||
+ boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth, true);
|
||||
|
||||
if (flag1) {
|
||||
this.gameEvent(breakingEntity, GameEvent.BLOCK_DESTROY, pos);
|
||||
this.gameEvent(GameEvent.BLOCK_DESTROY, pos, GameEvent.Context.of(breakingEntity, iblockdata));
|
||||
diff --git a/src/main/java/net/minecraft/world/level/LevelWriter.java b/src/main/java/net/minecraft/world/level/LevelWriter.java
|
||||
index b6825cd32033cac34c74af1f8c980ed7fb97a754..d2dfbfa0d58b94ce583992aa56f5b0e28d4b31f2 100644
|
||||
index 134e5ec79bf2dddd4e31930f8a7cb2c02fa29518..fd72d278a2719911a46b6bc9e7da2dc24bbe681e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/LevelWriter.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/LevelWriter.java
|
||||
@@ -7,10 +7,14 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
@@ -86,23 +86,36 @@ index b6825cd32033cac34c74af1f8c980ed7fb97a754..d2dfbfa0d58b94ce583992aa56f5b0e2
|
||||
|
||||
boolean removeBlock(BlockPos pos, boolean move);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 8c30e28b97ac7e8b54322c903e0b75ee8135620b..64cc26d146afba7c6ecb0d3052776837a41a5618 100644
|
||||
index 7b71073027f4cf79736546500ededdfbb83d968e..0402cad6877e66ea3b5a77bfb9204a52fe795fec 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -197,7 +197,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -196,7 +196,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
world.destroyBlock(pos, (flags & 32) == 0, (Entity) null, maxUpdateDepth);
|
||||
}
|
||||
} else {
|
||||
- world.setBlock(pos, newState, flags & -33, maxUpdateDepth);
|
||||
+ world.setBlock(pos, newState, flags & -33, maxUpdateDepth, true);
|
||||
+ world.setBlock(pos, newState, flags & -33, maxUpdateDepth, true); // Slice
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
index 09be3f188f9710fa71c5db67023e654739721f21..8de249142fbb53426ee1ee2b655dffc1c66f711f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
@@ -280,7 +280,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
net.minecraft.world.level.block.state.BlockState old = this.getHandle().getBlockState(pos);
|
||||
|
||||
- CraftBlock.setTypeAndData(world, pos, old, ((CraftBlockData) blockData).getState(), true);
|
||||
+ CraftBlock.setTypeAndData(world, pos, old, ((CraftBlockData) blockData).getState(), true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 6f01af8cc3f9ed4d2eaa3304990ca33f8692a453..f374d5d6fc3ac9187236d141931c3c57ddd57865 100644
|
||||
index 350cbf64c17938021002d5fd67176c44b398231e..b74846b94853a86dbb1506ef8f54a9816af657d1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -178,11 +178,20 @@ public class CraftBlock implements Block {
|
||||
@@ -189,15 +189,20 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public void setBlockData(BlockData data, boolean applyPhysics) {
|
||||
@@ -116,28 +129,44 @@ index 6f01af8cc3f9ed4d2eaa3304990ca33f8692a453..f374d5d6fc3ac9187236d141931c3c57
|
||||
+ this.setTypeAndData(((CraftBlockData) data).getState(), applyPhysics, checkLight);
|
||||
}
|
||||
|
||||
public boolean setTypeAndData(final net.minecraft.world.level.block.state.BlockState blockData, final boolean applyPhysics) {
|
||||
+ return setTypeAndData(blockData, applyPhysics, true);
|
||||
+ }
|
||||
+
|
||||
+ public boolean setTypeAndData(final net.minecraft.world.level.block.state.BlockState blockData, final boolean applyPhysics, boolean checkLight) {
|
||||
net.minecraft.world.level.block.state.BlockState old = this.getNMS();
|
||||
- boolean setTypeAndData(final net.minecraft.world.level.block.state.BlockState blockData, final boolean applyPhysics) {
|
||||
- return CraftBlock.setTypeAndData(this.world, this.position, this.getNMS(), blockData, applyPhysics);
|
||||
+ boolean setTypeAndData(final net.minecraft.world.level.block.state.BlockState blockData, final boolean applyPhysics, boolean checkLight) {
|
||||
+ return CraftBlock.setTypeAndData(this.world, this.position, this.getNMS(), blockData, applyPhysics, checkLight);
|
||||
}
|
||||
|
||||
- public static boolean setTypeAndData(LevelAccessor world, BlockPos position, net.minecraft.world.level.block.state.BlockState old, net.minecraft.world.level.block.state.BlockState blockData, boolean applyPhysics) {
|
||||
+ public static boolean setTypeAndData(LevelAccessor world, BlockPos position, net.minecraft.world.level.block.state.BlockState old, net.minecraft.world.level.block.state.BlockState blockData, boolean applyPhysics, boolean checkLight) {
|
||||
// SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in tile entity cleanup
|
||||
if (old.hasBlockEntity() && blockData.getBlock() != old.getBlock()) { // SPIGOT-3725 remove old tile entity if block changes
|
||||
@@ -197,7 +206,7 @@ public class CraftBlock implements Block {
|
||||
// SPIGOT-4612: faster - just clear tile
|
||||
@@ -211,7 +216,7 @@ public class CraftBlock implements Block {
|
||||
if (applyPhysics) {
|
||||
return this.world.setBlock(position, blockData, 3);
|
||||
return world.setBlock(position, blockData, 3);
|
||||
} else {
|
||||
- boolean success = this.world.setBlock(position, blockData, 2 | 16 | 1024); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
+ boolean success = this.world.setBlock(position, blockData, 2 | 16 | 1024, checkLight); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
if (success && this.world instanceof net.minecraft.world.level.Level) {
|
||||
this.world.getMinecraftWorld().sendBlockUpdated(
|
||||
- boolean success = world.setBlock(position, blockData, 2 | 16 | 1024); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
+ boolean success = world.setBlock(position, blockData, 2 | 16 | 1024, checkLight); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
if (success && world instanceof net.minecraft.world.level.Level) {
|
||||
world.getMinecraftWorld().sendBlockUpdated(
|
||||
position,
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
index a8ab1d3ee81664193be39d2735d6495136e0e310..fd4f00fa38b2d90e13937f114d96ea37bbc6dcdb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
@@ -213,7 +213,7 @@ public class CraftBlockState implements BlockState {
|
||||
}
|
||||
|
||||
net.minecraft.world.level.block.state.BlockState newBlock = this.data;
|
||||
- block.setTypeAndData(newBlock, applyPhysics);
|
||||
+ block.setTypeAndData(newBlock, applyPhysics, true);
|
||||
if (access instanceof net.minecraft.world.level.Level) {
|
||||
this.world.getHandle().sendBlockUpdated(
|
||||
position,
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
index 950d4381459d31d02acf55c4aef4f5e33367748b..0b09b06b3d9fe2cce5c6cbf70a4b84ff8edc2085 100644
|
||||
index b303eb2989be28dadf183d12a4bd706e43d1fa98..72496af0bdd05f83ec9e6bbbfde01ae79f61cc96 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
@@ -231,7 +231,7 @@ public class DummyGeneratorAccess implements WorldGenLevel {
|
||||
@@ -246,7 +246,7 @@ public class DummyGeneratorAccess implements WorldGenLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 12 Aug 2022 08:23:13 -0500
|
||||
Subject: [PATCH] Ignore durability change equipment updates
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 529ea9094c0c7b6263c13b3b7a2d1e652f7bc29e..b9fbbd5d775af0ce7d9eba97e14046233c64b0fd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3103,7 +3103,7 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
|
||||
- if (this.equipmentHasChanged(itemstack, itemstack1)) {
|
||||
+ if (!net.minecraft.world.item.ItemStack.isSameIgnoreDurability(itemstack, itemstack1)) { // Slice
|
||||
// Paper start - PlayerArmorChangeEvent
|
||||
if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.ARMOR) {
|
||||
final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 8450a22b0fc6e8dc5cad0f61ac52a82b3cd3791e..6ed921621f66dc4bfec66a307db24defb3caf380 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -720,6 +720,26 @@ public final class ItemStack {
|
||||
return left == right ? true : (!left.isEmpty() && !right.isEmpty() ? left.sameItem(right) : false);
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public static boolean isSameIgnoreDurability(ItemStack left, ItemStack right) {
|
||||
+ if (left == right) return true;
|
||||
+
|
||||
+ boolean rightEmpty = right.isEmpty();
|
||||
+ boolean leftEmpty = left.isEmpty();
|
||||
+ if (leftEmpty && rightEmpty) return true;
|
||||
+
|
||||
+ if (!leftEmpty && !rightEmpty) {
|
||||
+ return left.sameItemStackIgnoreDurability(right);
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ public boolean sameItemStackIgnoreDurability(ItemStack stack) {
|
||||
+ return this.isDamageableItem() ? !stack.isEmpty() && this.is(stack.getItem()) : this.sameItem(stack);
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
public boolean sameItem(ItemStack stack) {
|
||||
return !stack.isEmpty() && this.is(stack.getItem());
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 09:08:06 -0500
|
||||
Subject: [PATCH] Allow opening covered chests
|
||||
Date: Fri, 12 Aug 2022 08:28:00 -0500
|
||||
Subject: [PATCH] Alllow opening covered chests
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
index 1891cfb8f7ebae5a95a55f706bb04f8206121d32..d24c22e0dd84344021a77d24926c2934e71d40ff 100644
|
||||
index c6b57d45383441aa35510e759ce3cb82bc98f305..0f6dc8ab64f2422f636c2792be06f31bafefe3f8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
@@ -356,9 +356,10 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
|
||||
@@ -355,9 +355,10 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
|
||||
}
|
||||
|
||||
private static boolean isBlockedChestByBlock(BlockGetter world, BlockPos pos) {
|
||||
@@ -23,10 +23,10 @@ index 1891cfb8f7ebae5a95a55f706bb04f8206121d32..d24c22e0dd84344021a77d24926c2934
|
||||
|
||||
private static boolean isCatSittingOnChest(LevelAccessor world, BlockPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
index 7e45c97acce83a9fe8ada486e9fcdafe58769736..80e30b978455890506ef555773983dd4058185e3 100644
|
||||
index 7385e91f32f070e86a4e0fd3d214f55d832c7979..4911b099f865b9202286f51087e5c00ffeaa95a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
@@ -77,10 +77,10 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
|
||||
@@ -76,10 +76,10 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
|
||||
PlayerEnderChestContainer playerEnderChestContainer = player.getEnderChestInventory();
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
if (playerEnderChestContainer != null && blockEntity instanceof EnderChestBlockEntity) {
|
||||
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 08:56:42 -0500
|
||||
Subject: [PATCH] Don't send equipment updates if only durability changed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index cbdff14b26f67b5040c13659f9d64d9ec4c7eaed..bd054a883ecb15260aec27c81ad79e774fca69a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3007,7 +3007,7 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
|
||||
- if (!ItemStack.matches(itemstack1, itemstack)) {
|
||||
+ if (!ItemStack.isSameIgnoreDurability(itemstack1, itemstack)) {
|
||||
// Paper start - PlayerArmorChangeEvent
|
||||
if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.ARMOR) {
|
||||
final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 09:29:09 -0500
|
||||
Subject: [PATCH] Don't send fire packets if player has Fire Resistance
|
||||
Date: Fri, 12 Aug 2022 08:28:40 -0500
|
||||
Subject: [PATCH] Don't send fire packets if player has FR
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 94857a736d2a16e8ade286c6f2ddf8bd798008eb..ea85fc39b77aece9c9544ec01348eafa233355d1 100644
|
||||
index 1eaab1f6923e6aa34b643293347348e5cc19af3c..127b87e687a5dcfb6dcdc09e9efc08114933e91b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -760,7 +760,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
@@ -845,7 +845,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
this.checkOutOfWorld();
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 29 Sep 2021 08:40:37 -0500
|
||||
Date: Fri, 12 Aug 2022 10:40:48 -0500
|
||||
Subject: [PATCH] Add provided Material to getDrops
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index f374d5d6fc3ac9187236d141931c3c57ddd57865..9ed8586a3e973ba8da340b82440be8f7369ef8ca 100644
|
||||
index b74846b94853a86dbb1506ef8f54a9816af657d1..5835e60581240602e24a3eadbae084dd4717b9a1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -552,7 +552,18 @@ public class CraftBlock implements Block {
|
||||
@@ -616,7 +616,18 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getDrops(ItemStack item, Entity entity) {
|
||||
@@ -28,7 +28,7 @@ index f374d5d6fc3ac9187236d141931c3c57ddd57865..9ed8586a3e973ba8da340b82440be8f7
|
||||
net.minecraft.world.item.ItemStack nms = CraftItemStack.asNMSCopy(item);
|
||||
|
||||
// Modelled off EntityHuman#hasBlock
|
||||
@@ -563,6 +574,7 @@ public class CraftBlock implements Block {
|
||||
@@ -627,6 +638,7 @@ public class CraftBlock implements Block {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 16:36:29 -0500
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 12 Aug 2022 10:41:43 -0500
|
||||
Subject: [PATCH] Add Player to SpongeAbsorbEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
index 1ef8eadd4e59f2e5d2bbd84f6f9bcf37b59db5bd..ea711757413e2580a5806e0063b3e4fa5d4eddbb 100644
|
||||
index 7304b2659eb45bc4bc9fa7c43e6ca07221d0fc73..63e385993022b6e708e981982c18060273d3e019 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
@@ -110,7 +110,8 @@ public class SpongeBlock extends Block {
|
||||
@@ -109,7 +109,8 @@ public class SpongeBlock extends Block {
|
||||
if (!blocks.isEmpty()) {
|
||||
final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 09:00:50 -0500
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 71fca6c915f90a771e6139b985ebc51c7923778c..96a7ae08649294062f856c67e49a793feb63ca37 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -738,6 +738,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (iblockdata.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
+ // Paper start
|
||||
+ PendingBlockEvent blockEvent = pendingPlayerBlockEvents.get(pos);
|
||||
+ if (blockEvent != null && blockEvent.sourceBlock != null) {
|
||||
+ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event =
|
||||
+ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this, pos),
|
||||
+ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(),
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.at(this, blockEvent.sourceBlock));
|
||||
+ event.callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
FluidState fluid = this.getFluidState(pos);
|
||||
// Paper start - while the above setAir method is named same and looks very similar
|
||||
// they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent,
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
index b1b6072ffff0e1cc2e9e1a585ad882bc70697d92..f2eb493d99c2eb826d8b85adbc3dc6799c575f31 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
@@ -106,8 +106,11 @@ public class DoublePlantBlock extends BushBlock {
|
||||
|
||||
Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos);
|
||||
if (blockEvent != null) {
|
||||
- //Would fire a future BlockDestroyedByNeighborEvent here, but must have this conditional block
|
||||
- //because it's important to remove from pendingPlayerBlockEvents
|
||||
+ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event =
|
||||
+ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition1),
|
||||
+ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(),
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.at(world, pos));
|
||||
+ if (!event.callEvent()) return;
|
||||
}
|
||||
|
||||
if (iblockdata1.is(state.getBlock()) && iblockdata1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER) {
|
||||
@@ -1,26 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 18 Oct 2021 08:52:40 -0500
|
||||
Subject: [PATCH] World Instance Flag
|
||||
Date: Fri, 12 Aug 2022 10:45:51 -0500
|
||||
Subject: [PATCH] Add World Instance flag
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index d40a367670ccea01978cabf7d45f3c1a690662fc..d9d7edebbdb65990ade0c8e3c0e8bddd80927c2e 100644
|
||||
index 54c2b7fba83d6f06dba95b1bb5b487a02048d6e6..274a8deb22d0d6d07d1e6278935000756ae37ac5 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -200,6 +200,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
public final UUID uuid;
|
||||
public boolean hasPhysicsEvent = true; // Paper
|
||||
public boolean hasEntityMoveEvent = false; // Paper
|
||||
+ public boolean instance; // Slice
|
||||
private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
|
||||
public static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||
return new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||
}
|
||||
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 858e29ad77aee8a1b7797c2d82902abbfd662da2..135bb95bda500f24ceef664dc522dd02570822fe 100644
|
||||
index f8d321e925bf2708e51590542325c1bdc67d5964..0c8ec5c60d123e1fc7984dc45ba2df16612314b3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1197,6 +1197,18 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1266,6 +1266,18 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
world.noSave = !value;
|
||||
}
|
||||
|
||||
@@ -38,4 +38,4 @@ index 858e29ad77aee8a1b7797c2d82902abbfd662da2..135bb95bda500f24ceef664dc522dd02
|
||||
+
|
||||
@Override
|
||||
public void setDifficulty(Difficulty difficulty) {
|
||||
this.getHandle().serverLevelData.setDifficulty(net.minecraft.world.Difficulty.byId(difficulty.getValue()));
|
||||
this.getHandle().getServer().setDifficulty(this.getHandle(), net.minecraft.world.Difficulty.byId(difficulty.getValue()), true); // Paper - don't skip other difficulty-changing logic
|
||||
@@ -1,50 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 6 Oct 2021 11:03:01 -0500
|
||||
Date: Fri, 12 Aug 2022 10:48:03 -0500
|
||||
Subject: [PATCH] Packet obfuscation and reduction
|
||||
|
||||
Minecraft is overzealous about packet updates for Entities. In Loka's case, we want to reduce as many unnecessary
|
||||
packet updates as possible. This patch is likely to be updated over and over in terms of reducing packet sends.
|
||||
|
||||
In summary, this patch creates the concept of a "foreignValue" of a packet's data. We treat packets in two ways:
|
||||
1) The packet sent to the player itself (the normal way). This always has all of the values as usual.
|
||||
2) The packet data as seen by any other (foreign) players.
|
||||
|
||||
This patch adds the ability to set a "foreignValue" for an entity value so as to obfuscate data received by other players.
|
||||
The current packets modified/obfuscated are the following:
|
||||
|
||||
# Health - Foreign Players will only receive packets that say the player is "alive or dead (max health or 0 health).
|
||||
# This reduces the amount of health packet updates as well which is great for players in combat.
|
||||
|
||||
# Air Level - Foreign players will only ever see a player as having full oxygen
|
||||
# Air level packets are sent PER-TICK, and as such a player with any change in air level will only spam themselves
|
||||
# with packets instead of every single player within tracking distance
|
||||
|
||||
# Score - Foreign players will only see a player's score as 0 and will not update due to gathering xp orbs, etc.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
index 3e17f6131bf590d7c4a16b79c1c145cb4f565bc9..e1233fa58d068448d0accef7a7f6725fcb902848 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
@@ -22,6 +22,13 @@ public class ClientboundSetEntityDataPacket implements Packet<ClientGamePacketLi
|
||||
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public ClientboundSetEntityDataPacket(int id, List<SynchedEntityData.DataItem<?>> packedItems) {
|
||||
+ this.id = id;
|
||||
+ this.packedItems = packedItems;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
public ClientboundSetEntityDataPacket(FriendlyByteBuf buf) {
|
||||
this.id = buf.readVarInt();
|
||||
this.packedItems = SynchedEntityData.unpack(buf);
|
||||
diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
index 4df12454001f0de5f358c88d876e34c35a736c42..72c74d2369a36b14f1103aa74b096f50e7990f4d 100644
|
||||
index 37e193f57938047c8b886ed7d2816411392f94b4..e37c72e90e53908cb2f529265df54c22a692219a 100644
|
||||
--- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
@@ -136,6 +136,11 @@ public class SynchedEntityData {
|
||||
@@ -135,6 +135,11 @@ public class SynchedEntityData {
|
||||
}
|
||||
|
||||
public <T> void set(EntityDataAccessor<T> key, T value) {
|
||||
@@ -56,7 +20,7 @@ index 4df12454001f0de5f358c88d876e34c35a736c42..72c74d2369a36b14f1103aa74b096f50
|
||||
SynchedEntityData.DataItem<T> datawatcher_item = this.getItem(key);
|
||||
|
||||
if (ObjectUtils.notEqual(value, datawatcher_item.getValue())) {
|
||||
@@ -145,6 +150,11 @@ public class SynchedEntityData {
|
||||
@@ -144,6 +149,11 @@ public class SynchedEntityData {
|
||||
this.isDirty = true;
|
||||
}
|
||||
|
||||
@@ -68,25 +32,22 @@ index 4df12454001f0de5f358c88d876e34c35a736c42..72c74d2369a36b14f1103aa74b096f50
|
||||
}
|
||||
|
||||
// CraftBukkit start - add method from above
|
||||
@@ -200,6 +210,28 @@ public class SynchedEntityData {
|
||||
@@ -185,6 +195,25 @@ public class SynchedEntityData {
|
||||
return list;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ @Nullable
|
||||
+ public List<SynchedEntityData.DataItem<?>> packForeignDirty(List<DataItem<?>> unpackedData) {
|
||||
+ List<SynchedEntityData.DataItem<?>> list = null;
|
||||
+
|
||||
+ for (DataItem<?> dataItem : unpackedData) {
|
||||
+ DataItem<?> item = itemsById.get(dataItem.accessor.getId());
|
||||
+ if (item.isDirty(true)) {
|
||||
+ item.setForeignDirty(false);
|
||||
+
|
||||
+ public List<SynchedEntityData.DataValue<?>> packForeignDirty() {
|
||||
+ List<SynchedEntityData.DataValue<?>> list = null;
|
||||
+ for (DataItem<?> dataItem : this.itemsById.values()) {
|
||||
+ if (dataItem.isDirty(true)) {
|
||||
+ dataItem.setForeignDirty(false);
|
||||
+ if (list == null) {
|
||||
+ list = Lists.newArrayList();
|
||||
+ list = new ArrayList();
|
||||
+ }
|
||||
+
|
||||
+ list.add(item.copy(true));
|
||||
+ list.add(dataItem.value());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@@ -95,26 +56,26 @@ index 4df12454001f0de5f358c88d876e34c35a736c42..72c74d2369a36b14f1103aa74b096f50
|
||||
+ // Slice end
|
||||
+
|
||||
@Nullable
|
||||
public List<SynchedEntityData.DataItem<?>> getAll() {
|
||||
List<SynchedEntityData.DataItem<?>> list = null;
|
||||
@@ -313,11 +345,14 @@ public class SynchedEntityData {
|
||||
final EntityDataAccessor<T> accessor;
|
||||
public List<SynchedEntityData.DataValue<?>> getNonDefaultValues() {
|
||||
List<SynchedEntityData.DataValue<?>> list = null;
|
||||
@@ -291,11 +320,14 @@ public class SynchedEntityData {
|
||||
T value;
|
||||
private final T initialValue;
|
||||
private boolean dirty;
|
||||
+ @Nullable T foreignValue = null; // Slice
|
||||
+ private boolean foreignDirty; // Slice
|
||||
|
||||
public DataItem(EntityDataAccessor<T> data, T value) {
|
||||
this.accessor = data;
|
||||
this.initialValue = value;
|
||||
this.value = value;
|
||||
this.dirty = true;
|
||||
+ this.foreignDirty = true; // Slice
|
||||
}
|
||||
|
||||
public EntityDataAccessor<T> getAccessor() {
|
||||
@@ -343,5 +378,34 @@ public class SynchedEntityData {
|
||||
public SynchedEntityData.DataItem<T> copy() {
|
||||
return new SynchedEntityData.DataItem<>(this.accessor, this.accessor.getSerializer().copy(this.value));
|
||||
@@ -325,6 +357,35 @@ public class SynchedEntityData {
|
||||
public SynchedEntityData.DataValue<T> value() {
|
||||
return SynchedEntityData.DataValue.create(this.accessor, this.value);
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
@@ -146,38 +107,40 @@ index 4df12454001f0de5f358c88d876e34c35a736c42..72c74d2369a36b14f1103aa74b096f50
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
}
|
||||
|
||||
public static record DataValue<T>(int id, EntityDataSerializer<T> serializer, T value) { // CraftBukkit - decompile error
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 1c6bf5a3014beaf5f9c1c38aed4cf3225e50b8bb..6e9c5e210270647205499801b235849d20776156 100644
|
||||
index 190e9761087baec5827d722a8281f0ffb6798341..6d5a3bf7f93ea96d8615aaab2f88c40f524aa888 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -368,7 +368,19 @@ public class ServerEntity {
|
||||
SynchedEntityData datawatcher = this.entity.getEntityData();
|
||||
@@ -367,7 +367,20 @@ public class ServerEntity {
|
||||
|
||||
if (datawatcher.isDirty()) {
|
||||
- this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false));
|
||||
if (list != null) {
|
||||
this.trackedDataValues = datawatcher.getNonDefaultValues();
|
||||
- this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), list));
|
||||
+
|
||||
+ // Slice start
|
||||
+ ClientboundSetEntityDataPacket dataPacket = new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false);
|
||||
+ ClientboundSetEntityDataPacket dataPacket = new ClientboundSetEntityDataPacket(this.entity.getId(), list);
|
||||
+ if (this.entity instanceof ServerPlayer serverPlayer) {
|
||||
+ serverPlayer.connection.send(dataPacket);
|
||||
+ }
|
||||
+
|
||||
+ //Get the packedData that the original packet has, and then determine if any of those are changed in
|
||||
+ //the foreign version. If null, nothing to notify foreign trackers about.
|
||||
+ List<SynchedEntityData.DataItem<?>> dirtyItems = datawatcher.packForeignDirty(dataPacket.getUnpackedData());
|
||||
+ List<SynchedEntityData.DataValue<?>> dirtyItems = datawatcher.packForeignDirty();
|
||||
+ if (dirtyItems != null) {
|
||||
+ this.broadcast(new ClientboundSetEntityDataPacket(this.entity.getId(), dirtyItems));
|
||||
+ broadcast.accept(new ClientboundSetEntityDataPacket(this.entity.getId(), dirtyItems));
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
if (this.entity instanceof LivingEntity) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 78cb0786e741f8ef8611460dab64d0e2448fb6cf..587411322e75b08b7f6c2f18a22256ff9bf526ad 100644
|
||||
index 127b87e687a5dcfb6dcdc09e9efc08114933e91b..282cee03458ce6fa16896d988ac4d1dc887e5501 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2953,7 +2953,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
if (event.isCancelled()) {
|
||||
@@ -3129,7 +3129,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID);
|
||||
return;
|
||||
}
|
||||
- this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount());
|
||||
@@ -186,10 +149,10 @@ index 78cb0786e741f8ef8611460dab64d0e2448fb6cf..587411322e75b08b7f6c2f18a22256ff
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 51fd9bca61888861b58966a69cd1b63c742c44ca..3ed6e5d0c50c259c3df2b0cf84e2fb7ccf64def3 100644
|
||||
index 2ebb2e95241caf0393ed5db8f02776f566b88960..8b27a118c28baaaf4356174dd55351982560b548 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -633,7 +633,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -637,7 +637,7 @@ public abstract class Player extends LivingEntity {
|
||||
public void increaseScore(int score) {
|
||||
int j = this.getScore();
|
||||
|
||||
@@ -197,17 +160,17 @@ index 51fd9bca61888861b58966a69cd1b63c742c44ca..3ed6e5d0c50c259c3df2b0cf84e2fb7c
|
||||
+ this.entityData.set(Player.DATA_SCORE_ID, j + score, 0); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAutoSpinAttack(int riptideTicks) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 4ff4143f3a7cd89ef92f4b8882fa3e5addfe0f06..83495f9a7d92cd42c2f367891a0a04870a4a1577 100644
|
||||
index b32f44beab2c9790ee2da8403e362e8b3ecc6175..2c3b361d604b30cc114ecaa9874bc1f6cdcae22a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2004,7 +2004,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2323,7 +2323,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
this.sendHealthUpdate();
|
||||
}
|
||||
}
|
||||
- this.getHandle().getEntityData().set(LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth());
|
||||
+ this.getHandle().getEntityData().set(LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth(), isDead() ? 0f : 20f); // Slice
|
||||
- this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth());
|
||||
+ this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth(), isDead() ? 0f : 20f); // Slice
|
||||
|
||||
this.getHandle().maxHealthCache = getMaxHealth();
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Tue, 7 Dec 2021 07:59:41 -0600
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 12 Aug 2022 10:52:36 -0500
|
||||
Subject: [PATCH] Add player data saving events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index b03eacbef3cf15b70ec012af0870975d3e8e8cba..d792f9ad494f01d6ca78704a9fadf445e0d4e65e 100644
|
||||
index 58b093bb1de78ee3b3b2ea364aa50474883f443a..0989c7deef13ee202560fb2f44cbd273f9817f91 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -606,6 +606,8 @@ public class ServerPlayerGameMode {
|
||||
enuminteractionresult1 = stack.placeItem(itemactioncontext, hand);
|
||||
@@ -590,6 +590,8 @@ public class ServerPlayerGameMode {
|
||||
enuminteractionresult1 = stack.useOn(itemactioncontext, hand);
|
||||
}
|
||||
|
||||
+ world.pendingPlayerBlockEvents.remove(blockposition); // Paper
|
||||
@@ -18,10 +18,10 @@ index b03eacbef3cf15b70ec012af0870975d3e8e8cba..d792f9ad494f01d6ca78704a9fadf445
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, blockposition, itemstack1);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
index 9f3355dbbbab1ab88cf2b7034130c2888e38d7a7..ec43aa3661bc891a17670aec54d3f009c29b463b 100644
|
||||
index 72946e324c575ef39f3939225b96b68f724da460..cc6eded233655888664cab9808c7c3ecd07c5cce 100644
|
||||
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
@@ -201,7 +201,12 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
@@ -202,7 +202,12 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ index 9f3355dbbbab1ab88cf2b7034130c2888e38d7a7..ec43aa3661bc891a17670aec54d3f009
|
||||
Map<StatType<?>, JsonObject> map = Maps.newHashMap();
|
||||
ObjectIterator objectiterator = this.stats.object2IntEntrySet().iterator();
|
||||
|
||||
@@ -227,7 +232,7 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
@@ -228,7 +233,7 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
|
||||
jsonobject1.add("stats", jsonobject);
|
||||
jsonobject1.addProperty("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
|
||||
@@ -45,7 +45,7 @@ index 9f3355dbbbab1ab88cf2b7034130c2888e38d7a7..ec43aa3661bc891a17670aec54d3f009
|
||||
|
||||
private static <T> ResourceLocation getKey(Stat<T> stat) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
index 35c39aed9583275ef25d32c783715798b52bdb63..258813e65b521dccb19f4f3248588a7106a1e24b 100644
|
||||
index 601f8099f74e81c17600566b3c9b7a6dd39c9bcb..cde84f45b67b88ecc410cdff924170b5b5366823 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
@@ -33,6 +33,7 @@ public class PlayerDataStorage {
|
||||
102
patches/server/0012-Add-PlayerGetRespawnLocationEvent.patch
Normal file
102
patches/server/0012-Add-PlayerGetRespawnLocationEvent.patch
Normal file
@@ -0,0 +1,102 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 12 Aug 2022 11:00:39 -0500
|
||||
Subject: [PATCH] Add PlayerGetRespawnLocationEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index f381bf9064be548a4a603e0042886d8a5e70ba5b..673930ebb5027b71bc4a780ecd354108ed8c7226 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -817,49 +817,57 @@ public abstract class PlayerList {
|
||||
|
||||
// CraftBukkit start - fire PlayerRespawnEvent
|
||||
if (location == null) {
|
||||
- // boolean isBedSpawn = false; // Paper - moved up
|
||||
- ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
|
||||
- if (worldserver1 != null) {
|
||||
- Optional optional;
|
||||
+ // Slice start
|
||||
+ Player respawnPlayer = entityplayer1.getBukkitEntity();
|
||||
+ org.bukkit.event.player.PlayerGetRespawnLocationEvent preRespawnEvent = new org.bukkit.event.player.PlayerGetRespawnLocationEvent(respawnPlayer);
|
||||
+ preRespawnEvent.callEvent();
|
||||
+ location = preRespawnEvent.getRespawnLocation();
|
||||
|
||||
- if (blockposition != null) {
|
||||
- optional = net.minecraft.world.entity.player.Player.findRespawnPositionAndUseSpawnBlock(worldserver1, blockposition, f, flag1, true); // Paper - Fix SPIGOT-5989
|
||||
- } else {
|
||||
- optional = Optional.empty();
|
||||
- }
|
||||
+ if (location == null) {
|
||||
+ // Slice end
|
||||
+ // boolean isBedSpawn = false; // Paper - moved up
|
||||
+ ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
|
||||
+ if (worldserver1 != null) {
|
||||
+ Optional optional;
|
||||
+
|
||||
+ if (blockposition != null) {
|
||||
+ optional = net.minecraft.world.entity.player.Player.findRespawnPositionAndUseSpawnBlock(worldserver1, blockposition, f, flag1, true); // Paper - Fix SPIGOT-5989
|
||||
+ } else {
|
||||
+ optional = Optional.empty();
|
||||
+ }
|
||||
|
||||
- if (optional.isPresent()) {
|
||||
- BlockState iblockdata = worldserver1.getBlockState(blockposition);
|
||||
- boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
|
||||
- isAnchorSpawn = flag3; // Paper - Fix anchor respawn acting as a bed respawn from the end portal
|
||||
- Vec3 vec3d = (Vec3) optional.get();
|
||||
- float f1;
|
||||
+ if (optional.isPresent()) {
|
||||
+ BlockState iblockdata = worldserver1.getBlockState(blockposition);
|
||||
+ boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
|
||||
+ isAnchorSpawn = flag3; // Paper - Fix anchor respawn acting as a bed respawn from the end portal
|
||||
+ Vec3 vec3d = (Vec3) optional.get();
|
||||
+ float f1;
|
||||
|
||||
- if (!iblockdata.is(BlockTags.BEDS) && !flag3) {
|
||||
- f1 = f;
|
||||
- } else {
|
||||
- Vec3 vec3d1 = Vec3.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
||||
+ if (!iblockdata.is(BlockTags.BEDS) && !flag3) {
|
||||
+ f1 = f;
|
||||
+ } else {
|
||||
+ Vec3 vec3d1 = Vec3.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
||||
|
||||
- f1 = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
- }
|
||||
+ f1 = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ }
|
||||
|
||||
- entityplayer1.setRespawnPosition(worldserver1.dimension(), blockposition, f, flag1, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // Paper - PlayerSetSpawnEvent
|
||||
- flag2 = !flag && flag3;
|
||||
- isBedSpawn = true;
|
||||
- location = new Location(worldserver1.getWorld(), vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
|
||||
- } else if (blockposition != null) {
|
||||
- entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
- entityplayer1.setRespawnPosition(null, null, 0f, false, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed // Paper - PlayerSetSpawnEvent
|
||||
+ entityplayer1.setRespawnPosition(worldserver1.dimension(), blockposition, f, flag1, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // Paper - PlayerSetSpawnEvent
|
||||
+ flag2 = !flag && flag3;
|
||||
+ isBedSpawn = true;
|
||||
+ location = new Location(worldserver1.getWorld(), vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
|
||||
+ } else if (blockposition != null) {
|
||||
+ entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
+ entityplayer1.setRespawnPosition(null, null, 0f, false, false); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed // Paper - PlayerSetSpawnEvent
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
|
||||
- if (location == null) {
|
||||
- worldserver1 = this.server.getLevel(Level.OVERWORLD);
|
||||
- blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
- location = new Location(worldserver1.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F), worldserver1.levelData.getSpawnAngle(), 0.0F); // Paper - use world spawn angle
|
||||
+ if (location == null) {
|
||||
+ worldserver1 = this.server.getLevel(Level.OVERWORLD);
|
||||
+ blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
+ location = new Location(worldserver1.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F), worldserver1.levelData.getSpawnAngle(), 0.0F); // Paper - use world spawn angle
|
||||
+ }
|
||||
}
|
||||
|
||||
- Player respawnPlayer = entityplayer1.getBukkitEntity();
|
||||
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, com.google.common.collect.ImmutableSet.<org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag>builder().add(respawnFlags)); // Paper - Fix anchor respawn acting as a bed respawn from the end portal
|
||||
this.cserver.getPluginManager().callEvent(respawnEvent);
|
||||
// Spigot Start
|
||||
149
patches/server/0013-Set-multiple-Team-settings-at-once.patch
Normal file
149
patches/server/0013-Set-multiple-Team-settings-at-once.patch
Normal file
@@ -0,0 +1,149 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 13 Aug 2022 08:40:09 -0500
|
||||
Subject: [PATCH] Set multiple Team settings at once
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/scores/PlayerTeam.java b/src/main/java/net/minecraft/world/scores/PlayerTeam.java
|
||||
index 9464054912e19fc78dd965b71fce20a18564b351..1624a0f8ea211a4c43fd01612674ca501c10d7e6 100644
|
||||
--- a/src/main/java/net/minecraft/world/scores/PlayerTeam.java
|
||||
+++ b/src/main/java/net/minecraft/world/scores/PlayerTeam.java
|
||||
@@ -28,6 +28,7 @@ public class PlayerTeam extends Team {
|
||||
private ChatFormatting color = ChatFormatting.RESET;
|
||||
private Team.CollisionRule collisionRule = Team.CollisionRule.ALWAYS;
|
||||
private final Style displayNameStyle;
|
||||
+ private boolean updateTeamChangeInstantly = true; // Slice
|
||||
|
||||
public PlayerTeam(Scoreboard scoreboard, String name) {
|
||||
this.scoreboard = scoreboard;
|
||||
@@ -36,6 +37,12 @@ public class PlayerTeam extends Team {
|
||||
this.displayNameStyle = Style.EMPTY.withInsertion(name).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal(name)));
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public void setUpdateTeamChangeInstantly(boolean updateTeamChangeInstantly) {
|
||||
+ this.updateTeamChangeInstantly = updateTeamChangeInstantly;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
public Scoreboard getScoreboard() {
|
||||
return this.scoreboard;
|
||||
}
|
||||
@@ -64,13 +71,13 @@ public class PlayerTeam extends Team {
|
||||
throw new IllegalArgumentException("Name cannot be null");
|
||||
} else {
|
||||
this.displayName = displayName;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
}
|
||||
|
||||
public void setPlayerPrefix(@Nullable Component prefix) {
|
||||
this.playerPrefix = prefix == null ? CommonComponents.EMPTY : prefix;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
public Component getPlayerPrefix() {
|
||||
@@ -79,7 +86,7 @@ public class PlayerTeam extends Team {
|
||||
|
||||
public void setPlayerSuffix(@Nullable Component suffix) {
|
||||
this.playerSuffix = suffix == null ? CommonComponents.EMPTY : suffix;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
public Component getPlayerSuffix() {
|
||||
@@ -113,7 +120,7 @@ public class PlayerTeam extends Team {
|
||||
|
||||
public void setAllowFriendlyFire(boolean friendlyFire) {
|
||||
this.allowFriendlyFire = friendlyFire;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,7 +130,7 @@ public class PlayerTeam extends Team {
|
||||
|
||||
public void setSeeFriendlyInvisibles(boolean showFriendlyInvisible) {
|
||||
this.seeFriendlyInvisibles = showFriendlyInvisible;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,12 +145,12 @@ public class PlayerTeam extends Team {
|
||||
|
||||
public void setNameTagVisibility(Team.Visibility nameTagVisibilityRule) {
|
||||
this.nameTagVisibility = nameTagVisibilityRule;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
public void setDeathMessageVisibility(Team.Visibility deathMessageVisibilityRule) {
|
||||
this.deathMessageVisibility = deathMessageVisibilityRule;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,7 +160,7 @@ public class PlayerTeam extends Team {
|
||||
|
||||
public void setCollisionRule(Team.CollisionRule collisionRule) {
|
||||
this.collisionRule = collisionRule;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
public int packOptions() {
|
||||
@@ -176,7 +183,7 @@ public class PlayerTeam extends Team {
|
||||
|
||||
public void setColor(ChatFormatting color) {
|
||||
this.color = color;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
index 67efb0d38ae369ff5254f7b1ec85d32d4eee8291..e4110e3a60242b958c9983a090b28aae540b2bdf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
@@ -347,6 +347,37 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
}
|
||||
}
|
||||
|
||||
+ //Slice start
|
||||
+ @Override
|
||||
+ public void teamOptions(net.kyori.adventure.text.Component displayName,
|
||||
+ net.kyori.adventure.text.Component prefix,
|
||||
+ net.kyori.adventure.text.Component suffix,
|
||||
+ net.kyori.adventure.text.format.NamedTextColor color,
|
||||
+ java.util.List<org.apache.commons.lang3.tuple.Pair<Option, OptionStatus>> options) throws IllegalStateException {
|
||||
+ checkState();
|
||||
+ team.setUpdateTeamChangeInstantly(false);
|
||||
+
|
||||
+ if (displayName == null) displayName = net.kyori.adventure.text.Component.empty();
|
||||
+ team.setDisplayName(io.papermc.paper.adventure.PaperAdventure.asVanilla(displayName));
|
||||
+
|
||||
+ if (prefix == null) prefix = net.kyori.adventure.text.Component.empty();
|
||||
+ team.setPlayerPrefix(io.papermc.paper.adventure.PaperAdventure.asVanilla(prefix));
|
||||
+
|
||||
+ if (suffix == null) suffix = net.kyori.adventure.text.Component.empty();
|
||||
+ team.setPlayerSuffix(io.papermc.paper.adventure.PaperAdventure.asVanilla(suffix));
|
||||
+
|
||||
+ if (color == null) color = net.kyori.adventure.text.format.NamedTextColor.WHITE;
|
||||
+ team.setColor(io.papermc.paper.adventure.PaperAdventure.asVanilla(color));
|
||||
+
|
||||
+ for (org.apache.commons.lang3.tuple.Pair<Option, OptionStatus> pair : options) {
|
||||
+ setOption(pair.getLeft(), pair.getRight());
|
||||
+ }
|
||||
+
|
||||
+ team.setUpdateTeamChangeInstantly(true);
|
||||
+ team.getScoreboard().onTeamChanged(team);
|
||||
+ }
|
||||
+ //Slice end
|
||||
+
|
||||
// Paper start
|
||||
@Override
|
||||
public void addEntity(org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException {
|
||||
57
patches/server/0014-Smooth-Teleports.patch
Normal file
57
patches/server/0014-Smooth-Teleports.patch
Normal file
@@ -0,0 +1,57 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 13 Aug 2022 08:58:14 -0500
|
||||
Subject: [PATCH] Smooth Teleports
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 7d6d3c8556033d289fdadc489e73fba478fce41a..fc07b3340c8e90df20ab3989bb07a8c4bfc13579 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -268,6 +268,7 @@ public class ServerPlayer extends Player {
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
|
||||
+ public boolean smoothWorldTeleport; // Slice
|
||||
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 673930ebb5027b71bc4a780ecd354108ed8c7226..b1e0a4f51b58ffdff72127886d5c9014002dd52f 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -899,12 +899,12 @@ public abstract class PlayerList {
|
||||
int i = flag ? 1 : 0;
|
||||
// CraftBukkit start
|
||||
LevelData worlddata = worldserver1.getLevelData();
|
||||
- entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), (byte) i, entityplayer1.getLastDeathLocation()));
|
||||
+ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), (byte) i, entityplayer1.getLastDeathLocation()));
|
||||
entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetSendDistance())); // Spigot // Paper - replace old player chunk management
|
||||
entityplayer1.connection.send(new ClientboundSetSimulationDistancePacket(worldserver1.getChunkSource().chunkMap.playerChunkManager.getTargetTickViewDistance())); // Spigot // Paper - replace old player chunk management
|
||||
entityplayer1.spawnIn(worldserver1);
|
||||
entityplayer1.unsetRemoved();
|
||||
- entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
+ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
entityplayer1.setShiftKeyDown(false);
|
||||
|
||||
// entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 2c3b361d604b30cc114ecaa9874bc1f6cdcae22a..2f614915026dd9d44589cb1c1da28aca9b202d12 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1175,6 +1175,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
// Paper end
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public void teleportWithoutRespawn(Location location) {
|
||||
+ ServerPlayer serverPlayer = getHandle();
|
||||
+ serverPlayer.smoothWorldTeleport = true;
|
||||
+ teleport(location);
|
||||
+ serverPlayer.smoothWorldTeleport = false;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Override
|
||||
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
|
||||
// Paper start - Teleport API
|
||||
@@ -1,36 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 10 Oct 2021 13:36:38 -0500
|
||||
Subject: [PATCH] Smooth World Teleports
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 11f46c1b8f4c8414e0667d1873542c17d6e01f2a..fda2fedb0a24800e2690bba13d44c1cbfc3fb867 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -263,6 +263,7 @@ public class ServerPlayer extends Player {
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
public boolean needsChunkCenterUpdate; // Paper - no-tick view distance // Paper - public
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
|
||||
+ public boolean smoothWorldTeleport; // Slice
|
||||
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index eaa005c1c9b4386bcdbe1d6eb28c3eca7635066c..86d00fdee17bce31a5caf370ede8a2dbc42e440b 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -940,11 +940,11 @@ public abstract class PlayerList {
|
||||
}
|
||||
// CraftBukkit start
|
||||
LevelData worlddata = worldserver1.getLevelData();
|
||||
- entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag));
|
||||
+ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag));
|
||||
entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.getChunkSource().chunkMap.playerChunkManager.getLoadDistance())); // Spigot // Paper - no-tick view distance// Paper - replace old player chunk management
|
||||
entityplayer1.setLevel(worldserver1);
|
||||
entityplayer1.unsetRemoved();
|
||||
- entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
+ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
entityplayer1.setShiftKeyDown(false);
|
||||
|
||||
// entityplayer1.connection.b(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
@@ -1,15 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 5 Oct 2021 09:05:10 -0500
|
||||
Date: Sat, 13 Aug 2022 09:10:38 -0500
|
||||
Subject: [PATCH] Allow access to LightEngine
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index b3c99c1678c3ee159861c8aac38e765d664c4d1d..b6e1459db7f03801073d39ead5cd08fda8c9b4ba 100644
|
||||
index 2212f9f48636357265d8e44aba415ea4f09f1fe7..34d32abbec7bc79751d46f4b15f7b6cbe5a71e11 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -702,7 +702,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return Math.max(Math.abs(k), Math.abs(l));
|
||||
@@ -506,7 +506,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return !ChunkMap.isChunkInRange(x1, z1, x2, z2, distance) ? false : (!ChunkMap.isChunkInRange(x1 + 1, z1, x2, z2, distance) ? true : (!ChunkMap.isChunkInRange(x1, z1 + 1, x2, z2, distance) ? true : (!ChunkMap.isChunkInRange(x1 - 1, z1, x2, z2, distance) ? true : !ChunkMap.isChunkInRange(x1, z1 - 1, x2, z2, distance))));
|
||||
}
|
||||
|
||||
- protected ThreadedLevelLightEngine getLightEngine() {
|
||||
@@ -1,94 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 29 Oct 2021 10:22:23 -0500
|
||||
Subject: [PATCH] Block Mob Spawns globally by EntityType
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 2509a170b8ddd812ad5be49e5345ec5a3c0cf2b8..6a0726ec0882a67d2cc6b652010e2b02a75b3833 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -665,4 +665,16 @@ public class PaperConfig {
|
||||
private static void sendFullPosForHardCollidingEntities() {
|
||||
sendFullPosForHardCollidingEntities = getBoolean("settings.send-full-pos-for-hard-colliding-entities", true);
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ public static java.util.Set<net.minecraft.world.entity.EntityType<?>> globalBlockedMobSpawnTypes = new java.util.HashSet<>();
|
||||
+
|
||||
+ private static void globalBlockedMobSpawnTypes() {
|
||||
+ java.util.List<String> list = getList("settings.global-blocked-mobspawn-types", java.util.Collections.emptyList());
|
||||
+ for (String type : list) {
|
||||
+ java.util.Optional<net.minecraft.world.entity.EntityType<?>> entityType = net.minecraft.world.entity.EntityType.byString(type.toLowerCase());
|
||||
+ entityType.ifPresent(eType -> globalBlockedMobSpawnTypes.add(eType));
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
|
||||
index 86528ff031014e788d72a8bf7c1c9443512096bb..f66e6f750136fc3903acbcb7502e98e21e75fe5a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
|
||||
@@ -41,9 +41,10 @@ public class MobSpawnSettings {
|
||||
}), Codec.BOOL.fieldOf("player_spawn_friendly").orElse(false).forGetter(MobSpawnSettings::playerSpawnFriendly)).apply(instance, MobSpawnSettings::new);
|
||||
});
|
||||
private final float creatureGenerationProbability;
|
||||
- private final Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> spawners;
|
||||
- private final Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> mobSpawnCosts;
|
||||
+ private Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> spawners; // Slice
|
||||
+ private Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> mobSpawnCosts; // Slice
|
||||
private final boolean playerSpawnFriendly;
|
||||
+ private boolean stripped; // Slice
|
||||
|
||||
MobSpawnSettings(float creatureSpawnProbability, Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> spawners, Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> spawnCosts, boolean playerSpawnFriendly) {
|
||||
this.creatureGenerationProbability = creatureSpawnProbability;
|
||||
@@ -52,12 +53,49 @@ public class MobSpawnSettings {
|
||||
this.playerSpawnFriendly = playerSpawnFriendly;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ // This very stupid thing is because Mob Spawning Biome data is statically registered before CraftServer
|
||||
+ // is even created. As a result, we need to lazily rebuild our spawning data here which is very cool and very
|
||||
+ // stupid. But it should only really happen once up front, so isn't the end of the world
|
||||
+ private void stripSpawnData() {
|
||||
+ if (com.destroystokyo.paper.PaperConfig.globalBlockedMobSpawnTypes.isEmpty()) {
|
||||
+ stripped = true;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> finalMobSpawnCosts = new java.util.HashMap<>();
|
||||
+ for (Entry<EntityType<?>, MobSpawnSettings.MobSpawnCost> entry : mobSpawnCosts.entrySet()) {
|
||||
+ if (!com.destroystokyo.paper.PaperConfig.globalBlockedMobSpawnTypes.contains(entry.getKey())) {
|
||||
+ finalMobSpawnCosts.put(entry.getKey(), entry.getValue());
|
||||
+ }
|
||||
+ }
|
||||
+ this.mobSpawnCosts = ImmutableMap.copyOf(finalMobSpawnCosts);
|
||||
+
|
||||
+ Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> finalSpawners = new java.util.HashMap<>();
|
||||
+ for (Entry<MobCategory, WeightedRandomList<SpawnerData>> entry : spawners.entrySet()) {
|
||||
+ List<SpawnerData> finalSpawnerData = new java.util.ArrayList<>();
|
||||
+ for (SpawnerData spawnerData : entry.getValue().unwrap()) {
|
||||
+ if (!com.destroystokyo.paper.PaperConfig.globalBlockedMobSpawnTypes.contains(spawnerData.type)) {
|
||||
+ finalSpawnerData.add(spawnerData);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ finalSpawners.put(entry.getKey(), finalSpawnerData.isEmpty() ? EMPTY_MOB_LIST : WeightedRandomList.create(finalSpawnerData));
|
||||
+ }
|
||||
+
|
||||
+ this.spawners = ImmutableMap.copyOf(finalSpawners);
|
||||
+ stripped = true;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
public WeightedRandomList<MobSpawnSettings.SpawnerData> getMobs(MobCategory spawnGroup) {
|
||||
+ if (!stripped) stripSpawnData(); // Slice
|
||||
return this.spawners.getOrDefault(spawnGroup, EMPTY_MOB_LIST);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MobSpawnSettings.MobSpawnCost getMobSpawnCost(EntityType<?> entityType) {
|
||||
+ if (!stripped) stripSpawnData(); // Slice
|
||||
return this.mobSpawnCosts.get(entityType);
|
||||
}
|
||||
|
||||
19
patches/server/0016-Unfreeze-MappedRegistry.patch
Normal file
19
patches/server/0016-Unfreeze-MappedRegistry.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 16 Aug 2022 08:27:13 -0500
|
||||
Subject: [PATCH] Unfreeze MappedRegistry
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
index 1e33434f9f361542e03da3e4812bc6d76768a202..834a6f2eb2d6c0aa3afd450034f32b4e008b3a3c 100644
|
||||
--- a/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
+++ b/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
@@ -335,7 +335,7 @@ public class MappedRegistry<T> implements WritableRegistry<T> {
|
||||
|
||||
@Override
|
||||
public Registry<T> freeze() {
|
||||
- if (this.frozen) {
|
||||
+ if (this.true) { // Slice (a TODO in Paper, thanks Owen)
|
||||
return this;
|
||||
} else {
|
||||
this.frozen = true;
|
||||
201
patches/server/0017-Equipment-Packet-Caching.patch
Normal file
201
patches/server/0017-Equipment-Packet-Caching.patch
Normal file
@@ -0,0 +1,201 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 18 Nov 2022 08:02:11 -0600
|
||||
Subject: [PATCH] Equipment Packet Caching
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java
|
||||
index 5a8f850b447fc3a4bd0eb0c505bbdfc8be7115e8..997c9656c9cf815ad2769d4dea6f67a2301fca7c 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java
|
||||
@@ -18,6 +18,17 @@ public class ClientboundSetEquipmentPacket implements Packet<ClientGamePacketLis
|
||||
this.slots = equipmentList;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public ClientboundSetEquipmentPacket(int id, List<Pair<EquipmentSlot, ItemStack>> equipmentList, net.minecraft.world.entity.LivingEntity entity, String tag) {
|
||||
+ this.entity = id;
|
||||
+ slots = new java.util.ArrayList<>(equipmentList.size());
|
||||
+ for (Pair<EquipmentSlot, ItemStack> pair : equipmentList) {
|
||||
+ EquipmentSlot slot = pair.getFirst();
|
||||
+ slots.add(Pair.of(slot, entity.getOrCreateCachedEquipmentItem(tag, slot, pair.getSecond())));
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
public ClientboundSetEquipmentPacket(FriendlyByteBuf buf) {
|
||||
this.entity = buf.readVarInt();
|
||||
EquipmentSlot[] equipmentSlots = EquipmentSlot.values();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 6d5a3bf7f93ea96d8615aaab2f88c40f524aa888..47b9b5d165d96fa978aeefb1825a3f94ba732bca 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -304,27 +304,8 @@ public class ServerEntity {
|
||||
consumer.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.ap));
|
||||
}
|
||||
|
||||
- if (this.entity instanceof LivingEntity) {
|
||||
- List<Pair<EquipmentSlot, ItemStack>> list = Lists.newArrayList();
|
||||
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
|
||||
- int i = aenumitemslot.length;
|
||||
-
|
||||
- for (int j = 0; j < i; ++j) {
|
||||
- EquipmentSlot enumitemslot = aenumitemslot[j];
|
||||
- ItemStack itemstack = ((LivingEntity) this.entity).getItemBySlot(enumitemslot);
|
||||
-
|
||||
- if (!itemstack.isEmpty()) {
|
||||
- // Paper start - prevent oversized data
|
||||
- final ItemStack sanitized = LivingEntity.sanitizeItemStack(itemstack.copy(), false);
|
||||
- list.add(Pair.of(enumitemslot, ((LivingEntity) this.entity).stripMeta(sanitized, false))); // Paper - remove unnecessary item meta
|
||||
- // Paper end
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (!list.isEmpty()) {
|
||||
- consumer.accept(new ClientboundSetEquipmentPacket(this.entity.getId(), list));
|
||||
- }
|
||||
- ((LivingEntity) this.entity).detectEquipmentUpdates(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
+ if (this.entity instanceof LivingEntity livingEntity) {
|
||||
+ livingEntity.sendEquipment(entityplayer); // Slice
|
||||
}
|
||||
|
||||
// CraftBukkit start - Fix for nonsensical head yaw
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index b9fbbd5d775af0ce7d9eba97e14046233c64b0fd..5611ddc32992a8d06095fcde814c40f72efc72d5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -266,6 +266,8 @@ public abstract class LivingEntity extends Entity {
|
||||
public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
|
||||
public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
|
||||
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper
|
||||
+ private final com.google.common.collect.Table<String, ItemStack, ItemStack> equipmentPacketCache = com.google.common.collect.HashBasedTable.create(); // Slice
|
||||
+ public java.util.Map<String, net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket> cachedEquipmentMap = new java.util.HashMap<>(); // Slice
|
||||
|
||||
@Override
|
||||
public float getBukkitYaw() {
|
||||
@@ -3074,6 +3076,7 @@ public abstract class LivingEntity extends Entity {
|
||||
if (map != null) {
|
||||
this.handleHandSwap(map);
|
||||
if (!map.isEmpty()) {
|
||||
+ cachedEquipmentMap.clear(); // Slice - Must invalidate cached equipment map if we have changes
|
||||
this.handleEquipmentChanges(map);
|
||||
}
|
||||
}
|
||||
@@ -3166,7 +3169,25 @@ public abstract class LivingEntity extends Entity {
|
||||
}
|
||||
|
||||
});
|
||||
- ((ServerLevel) this.level).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list));
|
||||
+
|
||||
+ // Slice start
|
||||
+ net.minecraft.server.level.ChunkMap.TrackedEntity entityTracker = ((ServerLevel) this.level).getChunkSource().chunkMap.entityMap.get(getId());
|
||||
+ if (entityTracker != null) {
|
||||
+ ClientboundSetEquipmentPacket packet = new ClientboundSetEquipmentPacket(this.getId(), list);
|
||||
+ for (net.minecraft.server.network.ServerPlayerConnection playerConnection : entityTracker.seenBy) {
|
||||
+ ServerPlayer player = playerConnection.getPlayer();
|
||||
+ org.bukkit.event.player.PlayerReceiveEquipmentEvent event = new org.bukkit.event.player.PlayerReceiveEquipmentEvent(player.getBukkitEntity(), getBukkitEntity());
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ String tag = event.getTag();
|
||||
+ if (tag != null) {
|
||||
+ playerConnection.send(new ClientboundSetEquipmentPacket(this.getId(), list, this, tag));
|
||||
+ } else {
|
||||
+ playerConnection.send(packet);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
// Paper start - hide unnecessary item meta
|
||||
@@ -4432,4 +4453,72 @@ public abstract class LivingEntity extends Entity {
|
||||
public static record Fallsounds(SoundEvent small, SoundEvent big) {
|
||||
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ public void sendEquipment(ServerPlayer p) {
|
||||
+ org.bukkit.event.player.PlayerReceiveEquipmentEvent event = new org.bukkit.event.player.PlayerReceiveEquipmentEvent(p.getBukkitEntity(), getBukkitEntity());
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ boolean sendEquipment = !event.isCancelled();
|
||||
+ String tag = event.getTag();
|
||||
+ if (sendEquipment && this instanceof ServerPlayer player && tag != null) {
|
||||
+ ClientboundSetEquipmentPacket equipmentPacket = player.cachedEquipmentMap.get(tag);
|
||||
+ if (equipmentPacket != null) {
|
||||
+ //Event says use a tag, and our tag exists; so we simply used our entire cached packet
|
||||
+ p.connection.send(equipmentPacket);
|
||||
+ sendEquipment = false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (sendEquipment) {
|
||||
+ EquipmentSlot[] equipmentSlots = EquipmentSlot.values();
|
||||
+ List<Pair<EquipmentSlot, ItemStack>> list = new ArrayList<>(equipmentSlots.length);
|
||||
+
|
||||
+ for (EquipmentSlot enumitemslot : equipmentSlots) {
|
||||
+ ItemStack itemstack = getItemBySlot(enumitemslot);
|
||||
+
|
||||
+ if (!itemstack.isEmpty()) {
|
||||
+ // Paper start - prevent oversized data
|
||||
+ final ItemStack sanitized = LivingEntity.sanitizeItemStack(itemstack.copy(), false);
|
||||
+ ItemStack strippedItem = stripMeta(sanitized, false);
|
||||
+
|
||||
+ if (tag != null) {
|
||||
+ strippedItem = getOrCreateCachedEquipmentItem(tag, enumitemslot, strippedItem);
|
||||
+ }
|
||||
+
|
||||
+ list.add(Pair.of(enumitemslot, strippedItem)); // Paper - remove unnecessary item meta
|
||||
+ // Paper end
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!list.isEmpty()) {
|
||||
+ ClientboundSetEquipmentPacket equipmentPacket = new ClientboundSetEquipmentPacket(getId(), list);
|
||||
+ if (tag != null) {
|
||||
+ cachedEquipmentMap.put(tag, equipmentPacket);
|
||||
+ }
|
||||
+ p.connection.send(equipmentPacket);
|
||||
+ }
|
||||
+
|
||||
+ detectEquipmentUpdates(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public ItemStack getOrCreateCachedEquipmentItem(String tag, EquipmentSlot slot, ItemStack itemStack) {
|
||||
+ return equipmentPacketCache.row(tag).computeIfAbsent(itemStack, i -> {
|
||||
+ String name = slot.name();
|
||||
+
|
||||
+ //How neat is this.
|
||||
+ if (name.equals("MAINHAND")) {
|
||||
+ name = "HAND";
|
||||
+ } else if (name.equals("OFFHAND")) {
|
||||
+ name = "OFF_HAND";
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.event.entity.EntityEquipmentItemLookup event = new org.bukkit.event.entity.EntityEquipmentItemLookup(getBukkitEntity(), tag, org.bukkit.inventory.EquipmentSlot.valueOf(name), CraftItemStack.asBukkitCopy(i));
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ org.bukkit.inventory.ItemStack eventItem = event.getItemStack();
|
||||
+ return CraftItemStack.asNMSCopy(eventItem);
|
||||
+ });
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 09da9d3c85e36c2a78663f58a97963dbc795a367..50d4fc1681d035128b4bcf4318312017fd84dc16 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -1054,4 +1054,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
getHandle().knockback(strength, directionX, directionZ);
|
||||
};
|
||||
// Paper end
|
||||
+
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public void sendEquipment(Player p) {
|
||||
+ if (entity instanceof net.minecraft.world.entity.LivingEntity livingEntity) {
|
||||
+ livingEntity.sendEquipment(((CraftPlayer) p).getHandle());
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 29 Oct 2021 17:06:43 -0500
|
||||
Subject: [PATCH] Very far tracking range
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 9f32296ca4afaa7f2c0dd920a4c994af7a815ec3..2b2fb92cbfeed75276f054e6f04e21b37d28b49b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1994,8 +1994,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end
|
||||
if (!(entity instanceof EnderDragonPart)) {
|
||||
EntityType<?> entitytypes = entity.getType();
|
||||
- int i = entitytypes.clientTrackingRange() * 16;
|
||||
- i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, i); // Spigot
|
||||
+ // Slice
|
||||
+ int i;
|
||||
+ if (entity.visibleFromVeryFar) {
|
||||
+ i = 128;
|
||||
+ } else {
|
||||
+ i = entitytypes.clientTrackingRange() * 16;
|
||||
+ i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, i); // Spigot
|
||||
+ }
|
||||
+ // Slice end
|
||||
|
||||
if (i != 0) {
|
||||
int j = entitytypes.updateInterval();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 7c3cd4d613489e5ad68a15f59b076668cbc82c5e..b9f85c52ee8af7349b3600a7a45f37c593ed761d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -339,6 +339,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
public void inactiveTick() { }
|
||||
// Spigot end
|
||||
|
||||
+ public boolean visibleFromVeryFar; // Slice
|
||||
+
|
||||
public float getBukkitYaw() {
|
||||
return this.yRot;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 986f045a2e6a040c6e2aab7420c8cb2d4ac3a726..eb18db47313ebefb4e66a92f072931186245e968 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1067,6 +1067,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
this.getHandle().setSilent(flag);
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public void setVisibleFromVeryFar(boolean flag) {
|
||||
+ this.getHandle().visibleFromVeryFar = flag;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Override
|
||||
public boolean hasGravity() {
|
||||
return !this.getHandle().isNoGravity();
|
||||
48
patches/server/0018-AntiXray-Bypass.patch
Normal file
48
patches/server/0018-AntiXray-Bypass.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 18 Nov 2022 08:03:19 -0600
|
||||
Subject: [PATCH] AntiXray Bypass
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
||||
index 4f3670b2bdb8b1b252e9f074a6af56a018a8c465..31146c7cbaced5658ed43f05239b8165ce7c0a1d 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
||||
@@ -163,6 +163,7 @@ public final class ChunkPacketBlockControllerAntiXray extends ChunkPacketBlockCo
|
||||
|
||||
@Override
|
||||
public boolean shouldModify(ServerPlayer player, LevelChunk chunk) {
|
||||
+ if (player.getBukkitEntity().hasAntiXrayBypass()) return false; // Slice
|
||||
return !usePermission || !player.getBukkitEntity().hasPermission("paper.antixray.bypass");
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 2f614915026dd9d44589cb1c1da28aca9b202d12..abb7cb5cd93b7eb4f2f85cb40045bad35fc10b01 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -178,6 +178,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit
|
||||
private long lastSaveTime;
|
||||
// Paper end
|
||||
+ private boolean antiXrayBypass; // Slice
|
||||
|
||||
public CraftPlayer(CraftServer server, ServerPlayer entity) {
|
||||
super(server, entity);
|
||||
@@ -2568,6 +2569,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Slice start
|
||||
+ public boolean hasAntiXrayBypass() {
|
||||
+ return this.antiXrayBypass;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void toggleAntiXrayBypass(boolean bypass) {
|
||||
+ this.antiXrayBypass = bypass;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Override
|
||||
public void updateCommands() {
|
||||
if (this.getHandle().connection == null) return;
|
||||
@@ -1,18 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 30 Nov 2021 12:04:50 -0600
|
||||
Subject: [PATCH] PlayerTrackEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 6e9c5e210270647205499801b235849d20776156..bae3f9447d9dbb6cc48fe4878ac2d57c4d28b9d7 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -362,6 +362,7 @@ public class ServerEntity {
|
||||
}
|
||||
}
|
||||
|
||||
+ this.entity.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerTrackEntityEvent(entityplayer.getBukkitEntity().getPlayer(), this.entity.getBukkitEntity())); // Slice
|
||||
}
|
||||
|
||||
private void sendDirtyEntityData() {
|
||||
53
patches/server/0019-PlayerPreChunkLoadEvent.patch
Normal file
53
patches/server/0019-PlayerPreChunkLoadEvent.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 18 Nov 2022 08:06:31 -0600
|
||||
Subject: [PATCH] PlayerPreChunkLoadEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
||||
index 0b060183429f4c72ec767075538477b4302bbf0d..e4461c176682644d842b15b833c662039333d24f 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
||||
@@ -787,7 +787,7 @@ public final class PlayerChunkLoader {
|
||||
// warning: modifications of this field must be aware that the loadQueue inside PlayerChunkLoader uses this field
|
||||
// in a comparator!
|
||||
protected final ArrayDeque<ChunkPriorityHolder> loadQueue = new ArrayDeque<>();
|
||||
- protected final LongOpenHashSet sentChunks = new LongOpenHashSet();
|
||||
+ public final LongOpenHashSet sentChunks = new LongOpenHashSet(); // Slice - public
|
||||
protected final LongOpenHashSet chunksToBeSent = new LongOpenHashSet();
|
||||
|
||||
protected final TreeSet<ChunkPriorityHolder> sendQueue = new TreeSet<>((final ChunkPriorityHolder p1, final ChunkPriorityHolder p2) -> {
|
||||
@@ -871,7 +871,14 @@ public final class PlayerChunkLoader {
|
||||
}
|
||||
|
||||
public void sendChunk(final int chunkX, final int chunkZ, final Runnable onChunkSend) {
|
||||
- if (this.sentChunks.add(CoordinateUtils.getChunkKey(chunkX, chunkZ))) {
|
||||
+ // Slice start
|
||||
+ if (!new io.papermc.paper.event.packet.PlayerPreChunkLoadEvent(this.player.getBukkitEntity().getWorld(), chunkX, chunkZ, this.player.getBukkitEntity()).callEvent()) {
|
||||
+ this.player.connection.connection.execute(onChunkSend);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
+ if (this.sentChunks.add(CoordinateUtils.getChunkKey(chunkX, chunkZ))) { // Slice
|
||||
this.player.getLevel().getChunkSource().chunkMap.updateChunkTracking(this.player,
|
||||
new ChunkPos(chunkX, chunkZ), new MutableObject<>(), false, true); // unloaded, loaded
|
||||
this.player.connection.connection.execute(onChunkSend);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0c8ec5c60d123e1fc7984dc45ba2df16612314b3..0295f39efc828cc3fb23df12a959a4e4469e606f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -523,6 +523,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public it.unimi.dsi.fastutil.longs.LongOpenHashSet getSentChunks(Player p) {
|
||||
+ CraftPlayer craftPlayer = (CraftPlayer) p;
|
||||
+ io.papermc.paper.chunk.PlayerChunkLoader.PlayerLoaderData data = this.world.chunkSource.chunkMap.playerChunkManager.getData(craftPlayer.getHandle());
|
||||
+ return data != null ? data.sentChunks : null;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public boolean isChunkInUse(int x, int z) {
|
||||
return this.isChunkLoaded(x, z);
|
||||
112
patches/server/0020-Shared-DataStorage-for-maps.patch
Normal file
112
patches/server/0020-Shared-DataStorage-for-maps.patch
Normal file
@@ -0,0 +1,112 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 18 Nov 2022 08:37:19 -0600
|
||||
Subject: [PATCH] Shared DataStorage for maps
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
index 4532f3a0d74feae0a1249b53e1bfbc18a8808b32..2df8d02d7151d3483587c22f70dea1439d439553 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -364,6 +364,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public class Maps extends ConfigurationPart {
|
||||
public int itemFrameCursorLimit = 128;
|
||||
public int itemFrameCursorUpdateInterval = 10;
|
||||
+ public String sharedDataFolder; // Slice
|
||||
}
|
||||
|
||||
public Fixes fixes;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 274a8deb22d0d6d07d1e6278935000756ae37ac5..79f85a4d93b837e4b7f2e62f599359bf939ddc90 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -229,6 +229,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return thr;
|
||||
}
|
||||
|
||||
+ private @Nullable DimensionDataStorage sharedDataStorage; // Slice
|
||||
+
|
||||
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
||||
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper
|
||||
}
|
||||
@@ -606,6 +608,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
|
||||
this.chunkTaskScheduler = new io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler(this, io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.workerThreads); // Paper - rewrite chunk system
|
||||
this.entityLookup = new io.papermc.paper.chunk.system.entity.EntityLookup(this, new EntityCallbacks()); // Paper - rewrite chunk system
|
||||
+
|
||||
+ // Slice start
|
||||
+ String sharedDataFolder = paperConfig().maps.sharedDataFolder;
|
||||
+ if (sharedDataFolder != null) {
|
||||
+ java.io.File sharedDir = new java.io.File(sharedDataFolder);
|
||||
+ sharedDir.mkdirs();
|
||||
+ this.sharedDataStorage = new DimensionDataStorage(sharedDir, datafixer);
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
public void setWeatherParameters(int clearDuration, int rainDuration, boolean raining, boolean thundering) {
|
||||
@@ -1337,6 +1348,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
}// Paper
|
||||
// Paper - rewrite chunk system - entity saving moved into ChunkHolder
|
||||
|
||||
+ if (sharedDataStorage != null) sharedDataStorage.save();
|
||||
} else if (close) { chunkproviderserver.close(false); } // Paper - rewrite chunk system
|
||||
|
||||
// CraftBukkit start - moved from MinecraftServer.saveChunks
|
||||
@@ -1918,11 +1930,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
return this.getChunkSource().getDataStorage();
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public DimensionDataStorage getMapDataStorage() {
|
||||
+ return sharedDataStorage != null ? sharedDataStorage : this.getChunkSource().getDataStorage();
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Nullable
|
||||
@Override
|
||||
public MapItemSavedData getMapData(String id) {
|
||||
// CraftBukkit start
|
||||
- return (MapItemSavedData) this.getServer().overworld().getDataStorage().get((nbttagcompound) -> {
|
||||
+ return (MapItemSavedData) getMapDataStorage().get((nbttagcompound) -> { // Slice
|
||||
// We only get here when the data file exists, but is not a valid map
|
||||
MapItemSavedData newMap = MapItemSavedData.load(nbttagcompound);
|
||||
newMap.id = id;
|
||||
@@ -1936,12 +1954,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@Override
|
||||
public void setMapData(String id, MapItemSavedData state) {
|
||||
state.id = id; // CraftBukkit
|
||||
- this.getServer().overworld().getDataStorage().set(id, state);
|
||||
+ getMapDataStorage().set(id, state); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFreeMapId() {
|
||||
- return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex::load, MapIndex::new, "idcounts")).getFreeAuxValueForMap();
|
||||
+ // Slice start
|
||||
+ DimensionDataStorage storage = getMapDataStorage();
|
||||
+ MapIndex mapIndex = storage.readSavedData(MapIndex::load, "idcounts");
|
||||
+ if (mapIndex == null) {
|
||||
+ mapIndex = new MapIndex();
|
||||
+ }
|
||||
+ int newId = mapIndex.getFreeAuxValueForMap();
|
||||
+ storage.set("idcounts", mapIndex);
|
||||
+ storage.save();
|
||||
+ return newId;
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
// Paper start - helper function for configurable spawn radius
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
index 2da78bc43af715fe399eac1d83b3bf6e8fb8afac..3a8d2344b8e3485c9d4a7abb1b22e853b710ef4e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
@@ -58,7 +58,7 @@ public class DimensionDataStorage {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- private <T extends SavedData> T readSavedData(Function<CompoundTag, T> readFunction, String id) {
|
||||
+ public <T extends SavedData> T readSavedData(Function<CompoundTag, T> readFunction, String id) { // Slice private -> public
|
||||
try {
|
||||
File file = this.getDataFile(id);
|
||||
if (file.exists()) {
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 3 Dec 2022 06:58:09 -0600
|
||||
Subject: [PATCH] Set COOKED_MUTTON nutrition equal to COOKED_BEEF
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/food/Foods.java b/src/main/java/net/minecraft/world/food/Foods.java
|
||||
index b16d9e2eaa589f19c563ee70b1a56d67dbcdecb0..c6ff08efc7f0c0e782f8e78e01b9d9cea5cdcaed 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/Foods.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/Foods.java
|
||||
@@ -17,7 +17,7 @@ public class Foods {
|
||||
public static final FoodProperties COOKED_BEEF = (new FoodProperties.Builder()).nutrition(8).saturationMod(0.8F).meat().build();
|
||||
public static final FoodProperties COOKED_CHICKEN = (new FoodProperties.Builder()).nutrition(6).saturationMod(0.6F).meat().build();
|
||||
public static final FoodProperties COOKED_COD = (new FoodProperties.Builder()).nutrition(5).saturationMod(0.6F).build();
|
||||
- public static final FoodProperties COOKED_MUTTON = (new FoodProperties.Builder()).nutrition(6).saturationMod(0.8F).meat().build();
|
||||
+ public static final FoodProperties COOKED_MUTTON = (new FoodProperties.Builder()).nutrition(8).saturationMod(0.8F).meat().build();
|
||||
public static final FoodProperties COOKED_PORKCHOP = (new FoodProperties.Builder()).nutrition(8).saturationMod(0.8F).meat().build();
|
||||
public static final FoodProperties COOKED_RABBIT = (new FoodProperties.Builder()).nutrition(5).saturationMod(0.6F).meat().build();
|
||||
public static final FoodProperties COOKED_SALMON = (new FoodProperties.Builder()).nutrition(6).saturationMod(0.8F).build();
|
||||
@@ -0,0 +1,59 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 15 Dec 2022 15:48:34 -0600
|
||||
Subject: [PATCH] Player-specific target chunk send rate
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
||||
index e4461c176682644d842b15b833c662039333d24f..9dabd5bb2d9e6c2f9a6dc7103ca914478b17cd60 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/PlayerChunkLoader.java
|
||||
@@ -386,8 +386,8 @@ public final class PlayerChunkLoader {
|
||||
return (int)Math.ceil(Math.min(config * MinecraftServer.getServer().getPlayerCount(), max <= 1.0 ? Double.MAX_VALUE : max));
|
||||
}
|
||||
|
||||
- protected long getTargetSendPerPlayerAddend() {
|
||||
- return GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate <= 1.0 ? 0L : (long)Math.round(1.0e9 / GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate);
|
||||
+ protected long getTargetSendPerPlayerAddend(ServerPlayer player) { // Slice
|
||||
+ return player.targetChunkSendRate <= 1.0 ? 0L : (long)Math.round(1.0e9 / player.targetChunkSendRate); // Slice
|
||||
}
|
||||
|
||||
protected long getMaxSendAddend() {
|
||||
@@ -541,7 +541,6 @@ public final class PlayerChunkLoader {
|
||||
}
|
||||
|
||||
final int maxSends = this.getMaxConcurrentChunkSends();
|
||||
- final long nextPlayerDeadline = this.getTargetSendPerPlayerAddend() + time;
|
||||
for (;;) {
|
||||
if (this.chunkSendQueue.isEmpty()) {
|
||||
break;
|
||||
@@ -574,7 +573,7 @@ public final class PlayerChunkLoader {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
- data.nextChunkSendTarget = nextPlayerDeadline;
|
||||
+ data.nextChunkSendTarget = this.getTargetSendPerPlayerAddend(data.player) + time; // Slice
|
||||
this.chunkSendWaitQueue.add(data);
|
||||
|
||||
synchronized (this.sendingChunkCounts) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index fc07b3340c8e90df20ab3989bb07a8c4bfc13579..5fc08093a818486642fbff9a3587bc5e7d051ea2 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -14,6 +14,8 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import io.papermc.paper.configuration.GlobalConfiguration;
|
||||
import net.minecraft.BlockUtil;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.CrashReport;
|
||||
@@ -269,6 +271,7 @@ public class ServerPlayer extends Player {
|
||||
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
|
||||
public boolean smoothWorldTeleport; // Slice
|
||||
+ public double targetChunkSendRate = GlobalConfiguration.get().chunkLoading.targetPlayerChunkSendRate; // Slice
|
||||
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||
@@ -1,34 +1,47 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 08:27:21 -0500
|
||||
Subject: [PATCH] Track Player throughout entire block destroy
|
||||
Date: Fri, 30 Dec 2022 10:03:50 -0600
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
index 834a6f2eb2d6c0aa3afd450034f32b4e008b3a3c..3b2090503a4208c416167f5c70d3d8a4121cf916 100644
|
||||
--- a/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
+++ b/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
@@ -335,7 +335,7 @@ public class MappedRegistry<T> implements WritableRegistry<T> {
|
||||
|
||||
@Override
|
||||
public Registry<T> freeze() {
|
||||
- if (this.true) { // Slice (a TODO in Paper, thanks Owen)
|
||||
+ if (true) { // Slice (a TODO in Paper, thanks Owen)
|
||||
return this;
|
||||
} else {
|
||||
this.frozen = true;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index 12998d0e9ae0e148a155faa4468b0f78b8462cc9..b03eacbef3cf15b70ec012af0870975d3e8e8cba 100644
|
||||
index 0989c7deef13ee202560fb2f44cbd273f9817f91..168e68f1a93b2a134952cd88a35501a3290694e9 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -441,6 +441,7 @@ public class ServerPlayerGameMode {
|
||||
@@ -410,6 +410,7 @@ public class ServerPlayerGameMode {
|
||||
org.bukkit.block.BlockState state = bblock.getState();
|
||||
level.captureDrops = new ArrayList<>();
|
||||
// CraftBukkit end
|
||||
+ level.pendingPlayerBlockEvents.put(pos, new Level.PendingBlockEvent(pos, this.player)); // Paper
|
||||
block.playerWillDestroy((Level) this.level, pos, iblockdata, (Player) this.player);
|
||||
block.playerWillDestroy(this.level, pos, iblockdata, this.player);
|
||||
boolean flag = this.level.removeBlock(pos, false);
|
||||
|
||||
@@ -465,6 +466,7 @@ public class ServerPlayerGameMode {
|
||||
@@ -438,6 +439,7 @@ public class ServerPlayerGameMode {
|
||||
// CraftBukkit start
|
||||
java.util.List<ItemEntity> itemsToDrop = level.captureDrops; // Paper - store current list
|
||||
java.util.List<net.minecraft.world.entity.item.ItemEntity> itemsToDrop = level.captureDrops; // Paper - store current list
|
||||
level.captureDrops = null; // Paper - Remove this earlier so that we can actually drop stuff
|
||||
+ level.pendingPlayerBlockEvents.remove(pos); // Paper
|
||||
if (event.isDropItems()) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - use stored ref
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 7695a5ec88023720d873f81fc36f78ad60fb9589..71d02915581326f5546b2f916259a1ec00e85961 100644
|
||||
index 6ed921621f66dc4bfec66a307db24defb3caf380..c5a8e12055c46015b499eadf5614597c77a39e90 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -323,6 +323,7 @@ public final class ItemStack {
|
||||
@@ -353,6 +353,7 @@ public final class ItemStack {
|
||||
}
|
||||
}
|
||||
Item item = this.getItem();
|
||||
@@ -37,10 +50,10 @@ index 7695a5ec88023720d873f81fc36f78ad60fb9589..71d02915581326f5546b2f916259a1ec
|
||||
CompoundTag newData = this.getTagClone();
|
||||
int newCount = this.getCount();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 8420d615867faa717266d1edfa5a469df1b1e43f..71fca6c915f90a771e6139b985ebc51c7923778c 100644
|
||||
index 264a6bc9f174a42dfeed4822dbb1bd3cc608d108..1914c22c9d3cdc338a9c5ddf03ddf00cf7eb457d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -176,6 +176,27 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -181,6 +181,27 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
|
||||
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
|
||||
|
||||
@@ -68,7 +81,7 @@ index 8420d615867faa717266d1edfa5a469df1b1e43f..71fca6c915f90a771e6139b985ebc51c
|
||||
// Paper start - fix and optimise world upgrading
|
||||
// copied from below
|
||||
public static ResourceKey<DimensionType> getDimensionKey(DimensionType manager) {
|
||||
@@ -695,6 +716,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -662,6 +683,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (!this.preventPoiUpdated) {
|
||||
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
@@ -76,56 +89,55 @@ index 8420d615867faa717266d1edfa5a469df1b1e43f..71fca6c915f90a771e6139b985ebc51c
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -800,8 +822,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public void neighborChanged(BlockPos pos, Block sourceBlock, BlockPos neighborPos) {
|
||||
if (!this.isClientSide) {
|
||||
BlockState iblockdata = this.getBlockState(pos);
|
||||
+ org.bukkit.block.Block blockAt = world.getBlockAt(pos.getX(), pos.getY(), pos.getZ()); // Paper
|
||||
|
||||
try {
|
||||
+ // Paper start - If this is a non-air block being set to an air block, get (remove, if exists)
|
||||
+ // our PendingBlockEvent
|
||||
+ if (blockAt.getType() != org.bukkit.Material.AIR && iblockdata.getMaterial() == net.minecraft.world.level.material.Material.AIR) {
|
||||
+ PendingBlockEvent blockEvent = pendingPlayerBlockEvents.remove(pos);
|
||||
+ if (blockEvent != null) {
|
||||
+ //Would fire a future BlockDestroyedByNeighborEvent here, but must have this conditional block
|
||||
+ //because it's important to remove from pendingPlayerBlockEvents
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
@@ -683,6 +705,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (iblockdata.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
+ // Paper start
|
||||
+ PendingBlockEvent blockEvent = pendingPlayerBlockEvents.get(pos);
|
||||
+ if (blockEvent != null && blockEvent.sourceBlock != null) {
|
||||
+ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event =
|
||||
+ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this, pos),
|
||||
+ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(),
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.at(this, blockEvent.sourceBlock));
|
||||
+ event.callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
// CraftBukkit start
|
||||
CraftWorld world = ((ServerLevel) this).getWorld();
|
||||
if (world != null && ((ServerLevel)this).hasPhysicsEvent) { // Paper
|
||||
FluidState fluid = this.getFluidState(pos);
|
||||
// Paper start - while the above setAir method is named same and looks very similar
|
||||
// they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent,
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
index 65a163d93a293e1e0a12a300d6335a700099cac2..b1b6072ffff0e1cc2e9e1a585ad882bc70697d92 100644
|
||||
index e234ae13fe9793db237adb6f6216fa32638cfc4f..c126742149b10cc67caa18c7c4d8e1c7108c6c15 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
@@ -104,6 +104,12 @@ public class DoublePlantBlock extends BushBlock {
|
||||
@@ -105,6 +105,15 @@ public class DoublePlantBlock extends BushBlock {
|
||||
BlockPos blockposition1 = pos.below();
|
||||
BlockState iblockdata1 = world.getBlockState(blockposition1);
|
||||
|
||||
+ Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos);
|
||||
+ if (blockEvent != null) {
|
||||
+ //Would fire a future BlockDestroyedByNeighborEvent here, but must have this conditional block
|
||||
+ //because it's important to remove from pendingPlayerBlockEvents
|
||||
+ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event =
|
||||
+ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition1),
|
||||
+ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(),
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.at(world, pos));
|
||||
+ if (!event.callEvent()) return;
|
||||
+ }
|
||||
+
|
||||
if (iblockdata1.is(state.getBlock()) && iblockdata1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER) {
|
||||
BlockState iblockdata2 = iblockdata1.hasProperty(BlockStateProperties.WATERLOGGED) && (Boolean) iblockdata1.getValue(BlockStateProperties.WATERLOGGED) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState();
|
||||
BlockState iblockdata2 = iblockdata1.getFluidState().is((Fluid) Fluids.WATER) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index 83d813025efca5846538e36508a5d4fe38b02108..e1eed33f75c3118826ccd0c994325b327e20f83f 100644
|
||||
index 25ce337ed266be7bafeacd9eb6f53a9474775fc5..cd4a84f8ab08dbed23a6cd15b90c0d530728b85f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -890,6 +890,18 @@ public abstract class BlockBehaviour {
|
||||
@@ -1016,6 +1016,16 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
Direction enumdirection = aenumdirection[l];
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset((Vec3i) pos, enumdirection);
|
||||
BlockState iblockdata = world.getBlockState(blockposition_mutableblockposition);
|
||||
+
|
||||
blockposition_mutableblockposition.setWithOffset(pos, enumdirection);
|
||||
+ // Paper start - Propagate the PendingBlockEvent from the current blockPos to the next block
|
||||
+ // if it will break (!canSurvive)
|
||||
+ if (this.getMaterial() == Material.AIR && !iblockdata.canSurvive(world, blockposition_mutableblockposition)) {
|
||||
+ if (this.getMaterial() == Material.AIR && !world.getBlockState(blockposition_mutableblockposition).canSurvive(world, blockposition_mutableblockposition)) {
|
||||
+ Level.PendingBlockEvent blockEvent = ((Level) world).pendingPlayerBlockEvents.get(pos);
|
||||
+ if (blockEvent != null) {
|
||||
+ BlockPos blockPosCopy = blockposition_mutableblockposition.immutable();
|
||||
@@ -133,7 +145,6 @@ index 83d813025efca5846538e36508a5d4fe38b02108..e1eed33f75c3118826ccd0c994325b32
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
BlockState iblockdata1 = iblockdata.updateShape(enumdirection.getOpposite(), this.asState(), world, blockposition_mutableblockposition, pos);
|
||||
world.neighborShapeChanged(enumdirection.getOpposite(), this.asState(), blockposition_mutableblockposition, pos, flags, maxUpdateDepth);
|
||||
}
|
||||
|
||||
Block.updateOrDestroy(iblockdata, iblockdata1, world, blockposition_mutableblockposition, flags, maxUpdateDepth);
|
||||
31
patches/server/0024-noEntityCollisions-for-Entity.patch
Normal file
31
patches/server/0024-noEntityCollisions-for-Entity.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 30 Dec 2022 15:00:35 -0600
|
||||
Subject: [PATCH] noEntityCollisions for Entity
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
index a87f6380b2c387fb0cdd40d5087b5c93492e3c88..cd35c2136a638c07fed683a2f92e70aa57bcfa8e 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
@@ -809,7 +809,7 @@ public final class CollisionUtil {
|
||||
|
||||
public static boolean getEntityHardCollisions(final CollisionGetter getter, final Entity entity, AABB aabb,
|
||||
final List<AABB> into, final boolean checkOnly, final Predicate<Entity> predicate) {
|
||||
- if (isEmpty(aabb) || !(getter instanceof EntityGetter entityGetter)) {
|
||||
+ if ((entity != null && entity.noEntityCollisions) || isEmpty(aabb) || !(getter instanceof EntityGetter entityGetter)) { // Slice
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 282cee03458ce6fa16896d988ac4d1dc887e5501..f83e5383e950c9261804991431ff0da89673f277 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -433,6 +433,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
* Overriding this field will cause memory leaks.
|
||||
*/
|
||||
private final boolean hardCollides;
|
||||
+ public boolean noEntityCollisions; // Slice
|
||||
|
||||
private static final java.util.Map<Class<? extends Entity>, Boolean> cachedOverrides = java.util.Collections.synchronizedMap(new java.util.WeakHashMap<>());
|
||||
{
|
||||
@@ -5,6 +5,6 @@ pluginManagement {
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "Slice"
|
||||
rootProject.name = "slice"
|
||||
|
||||
include("Slice-API", "Slice-Server")
|
||||
include("slice-api", "slice-server")
|
||||
|
||||
Reference in New Issue
Block a user