Compare commits
167 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b327b6652 | ||
|
|
74c285c9b8 | ||
|
|
53a33bce30 | ||
|
|
f153251858 | ||
|
|
52f1f9d217 | ||
|
|
bd8656028e | ||
|
|
ddce0cde62 | ||
|
|
bc3711ebf3 | ||
|
|
f3b7b86532 | ||
|
|
47aeaffbdb | ||
|
|
d9b3b3a062 | ||
|
|
400162acc9 | ||
|
|
3ef1929507 | ||
|
|
357471c126 | ||
|
|
d23067e50d | ||
|
|
05dd78f0b8 | ||
|
|
1a2c9e0c5d | ||
|
|
423038f3dc | ||
|
|
7091e85fb9 | ||
|
|
6b0f7bcb46 | ||
|
|
490feb33c1 | ||
|
|
49f6ea378b | ||
|
|
fca8e2489e | ||
|
|
11e11dcbb2 | ||
|
|
aa5645b695 | ||
|
|
bf2e1a599f | ||
|
|
07104c8191 | ||
|
|
6fa36fbf36 | ||
|
|
383096325e | ||
|
|
22172ae225 | ||
|
|
bcadea3a13 | ||
|
|
e4b194d2d1 | ||
|
|
fdadeb897f | ||
|
|
37de50054d | ||
|
|
bcea4943f7 | ||
|
|
8080aa21e3 | ||
|
|
700708fcda | ||
|
|
e42a638149 | ||
|
|
182af09174 | ||
|
|
5920aced80 | ||
|
|
1734aa29a7 | ||
|
|
5dc2168275 | ||
|
|
4ddd0748f3 | ||
|
|
6e2bb01d85 | ||
|
|
8183b8084f | ||
|
|
c3b16a9220 | ||
|
|
dae8cb806d | ||
|
|
c46ddfb6f9 | ||
|
|
6c2091b610 | ||
|
|
550c12f16a | ||
|
|
5329f509c9 | ||
|
|
e4f61bf6ed | ||
|
|
2cac3f6a43 | ||
|
|
3544d87a45 | ||
|
|
caa9c93355 | ||
|
|
cb84a72508 | ||
|
|
87ec6b249e | ||
|
|
3241691aea | ||
|
|
42eb17973b | ||
|
|
003871482b | ||
|
|
0f11149b2d | ||
|
|
4b70830774 | ||
|
|
6cb20103b6 | ||
|
|
36ebcb0220 | ||
|
|
ee68309ac0 | ||
|
|
5c2253f82e | ||
|
|
00bd3e0d3c | ||
|
|
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
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,5 +1,9 @@
|
||||
.gradle
|
||||
/build/
|
||||
.idea
|
||||
run
|
||||
slice-api
|
||||
slice-server
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
@@ -12,3 +16,5 @@ gradle-app.setting
|
||||
|
||||
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
|
||||
# gradle/wrapper/gradle-wrapper.properties
|
||||
/commit.sh
|
||||
/publish.sh
|
||||
|
||||
@@ -7,4 +7,4 @@
|
||||
# datafixerupper com/mojang/datafixers/util/Either.java
|
||||
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
|
||||
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
|
||||
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
|
||||
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
|
||||
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 "8.1.1" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.5.8"
|
||||
}
|
||||
|
||||
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.6:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
|
||||
paperclip("io.papermc:paperclip:3.0.3")
|
||||
}
|
||||
|
||||
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,33 +77,12 @@ 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/",
|
||||
paperMavenPublicUrl
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
allprojects {
|
||||
// Publishing API:
|
||||
// ./gradlew :Slice-API:publish[ToMavenLocal]
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "Ysera"
|
||||
url = uri("https://ysera.dyndns.org: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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
// Publishing dev bundle:
|
||||
// ./gradlew publishDevBundlePublicationTo(MavenLocal|MyRepoSnapshotsRepository) -PpublishDevBundle
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
group=com.lokamc.slice
|
||||
version=1.17.1-R0.1-SNAPSHOT
|
||||
version=1.20.1-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion=1.17.1
|
||||
paperRef=bf23668bc56a31ccf9ff7c7b290bb0442afebff6
|
||||
mcVersion=1.20.1
|
||||
paperRef=29d1c7b60244bb002d29a5dcfc9c995019f550ab
|
||||
|
||||
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-8.0.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
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:29:11 -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 390a2a2611df35a9ea6f1eb996b47e2aa4597ff0..384e5700b6899850d91a34e1d13d1ca0678cfaaa 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
|
||||
@@ -298,6 +298,28 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
||||
*/
|
||||
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: Mon, 10 Apr 2023 07:30:30 -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: Mon, 10 Apr 2023 07:31:55 -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 384e5700b6899850d91a34e1d13d1ca0678cfaaa..9c1aef68b1b6f4fddfa171f7189dda5619e758d6 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
|
||||
@@ -666,6 +666,20 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
||||
@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: Mon, 10 Apr 2023 07:36:22 -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: Mon, 10 Apr 2023 07:37:06 -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 6917931966377c51db88a3364997a110dd987970..792b1b4ea3330b282961844d48b2dc56e0201c7e 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
|
||||
@@ -2573,6 +2573,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
*/
|
||||
public void setAutoSave(boolean value);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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 player data saving events
|
||||
Date: Mon, 10 Apr 2023 07:38:40 -0500
|
||||
Subject: [PATCH] Add PlayerData Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java
|
||||
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: Mon, 10 Apr 2023 07:46:19 -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: Mon, 10 Apr 2023 07:52:54 -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 8424fdac153f6dea76acce89f4726408d9726c41..6effaeaf885d70f8aeb11b5c44e7f3ab42cf2a90 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
@@ -514,6 +514,24 @@ public interface Team {
|
||||
boolean hasEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException;
|
||||
// Paper end - improve scoreboard entries
|
||||
|
||||
+ //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: Mon, 10 Apr 2023 07:55:36 -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 f9dd00210c1762a40259f823aeb8d8a5ddc78e3e..bb0c49ed971d71904b9172cac2e724133754f32c 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -3153,6 +3153,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.
|
||||
21
patches/api/0011-AntiXray-Bypass.patch
Normal file
21
patches/api/0011-AntiXray-Bypass.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 08:46:54 -0500
|
||||
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 bb0c49ed971d71904b9172cac2e724133754f32c..8fc53e32d09f1678d59da0d01f28b6ef96527011 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2950,6 +2950,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/0012-Add-PlayerPreChunkLoadEvent.patch
Normal file
95
patches/api/0012-Add-PlayerPreChunkLoadEvent.patch
Normal file
@@ -0,0 +1,95 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 08:47:44 -0500
|
||||
Subject: [PATCH] Add 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 792b1b4ea3330b282961844d48b2dc56e0201c7e..a2b42e723fd7989b410e8c90f235ce38bd1bae45 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -500,6 +500,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.
|
||||
149
patches/api/0013-Equipment-Packet-Caching.patch
Normal file
149
patches/api/0013-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: Tue, 25 Apr 2023 07:36:40 -0500
|
||||
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 19e58e62ae442ef9be02ca7fa2f55e370a54afa4..94aafbc3a08dec7c66cef89de7a5283049a4bf05 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -1192,4 +1192,11 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
void setBodyYaw(float bodyYaw);
|
||||
// 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;
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:16:51 -0500
|
||||
Subject: [PATCH] Add Force Crit to PlayerPreAttackEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
index d49999ea597ef247bbf2298e6bf5600bfe003c3e..4ed53b14f94154043e3043f4fef540b45b2b272d 100644
|
||||
--- a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
@@ -26,6 +26,7 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
private final Entity attacked;
|
||||
private boolean cancelled;
|
||||
private final boolean willAttack;
|
||||
+ private boolean forceCrit; // Slice
|
||||
|
||||
public PrePlayerAttackEntityEvent(@NotNull Player who, @NotNull Entity attacked, boolean willAttack) {
|
||||
super(who);
|
||||
@@ -55,6 +56,16 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
return this.willAttack;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public boolean isForceCrit() {
|
||||
+ return forceCrit;
|
||||
+ }
|
||||
+
|
||||
+ public void setForceCrit(boolean forceCrit) {
|
||||
+ this.forceCrit = forceCrit;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:17:39 -0500
|
||||
Subject: [PATCH] Add Preventing KB Bonus to PlayerPreAttackEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
index 4ed53b14f94154043e3043f4fef540b45b2b272d..608df52360df66390fce3070e52e4ecd4cd5fb64 100644
|
||||
--- a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
@@ -27,6 +27,7 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
private boolean cancelled;
|
||||
private final boolean willAttack;
|
||||
private boolean forceCrit; // Slice
|
||||
+ private boolean preventKnockbackBonus; // Slice
|
||||
|
||||
public PrePlayerAttackEntityEvent(@NotNull Player who, @NotNull Entity attacked, boolean willAttack) {
|
||||
super(who);
|
||||
@@ -64,6 +65,15 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
public void setForceCrit(boolean forceCrit) {
|
||||
this.forceCrit = forceCrit;
|
||||
}
|
||||
+
|
||||
+ public boolean isPreventKnockbackBonus() {
|
||||
+ return preventKnockbackBonus;
|
||||
+ }
|
||||
+
|
||||
+ public void setPreventKnockbackBonus(boolean preventKnockbackBonus) {
|
||||
+ this.preventKnockbackBonus = preventKnockbackBonus;
|
||||
+ }
|
||||
+
|
||||
// Slice end
|
||||
|
||||
@NotNull
|
||||
66
patches/api/0016-PlayerLoadStatsEvent.patch
Normal file
66
patches/api/0016-PlayerLoadStatsEvent.patch
Normal file
@@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:25:26 -0500
|
||||
Subject: [PATCH] PlayerLoadStatsEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadStatsEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadStatsEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..80b67d390152b114ad385f7eb6af5ef975b7ca20
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadStatsEvent.java
|
||||
@@ -0,0 +1,54 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import com.google.gson.JsonObject;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+/**
|
||||
+ * Calls an event in which player stats can be provided. If null, will load from disk, otherwise will use provided data
|
||||
+ */
|
||||
+public class PlayerLoadStatsEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final UUID playerId;
|
||||
+ private JsonObject statistics;
|
||||
+
|
||||
+ public PlayerLoadStatsEvent(@NotNull UUID playerId) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.playerId = playerId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player's unique ID.
|
||||
+ *
|
||||
+ * @return The unique ID
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public UUID getUniqueId() {
|
||||
+ return playerId;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public JsonObject getStatistics() {
|
||||
+ return statistics;
|
||||
+ }
|
||||
+
|
||||
+ public void setStatistics(@NotNull JsonObject statistics) {
|
||||
+ this.statistics = statistics;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
19
patches/api/0017-Warden-setCanDespawn-API.patch
Normal file
19
patches/api/0017-Warden-setCanDespawn-API.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 23 Jun 2023 11:21:27 -0500
|
||||
Subject: [PATCH] Warden setCanDespawn API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Warden.java b/src/main/java/org/bukkit/entity/Warden.java
|
||||
index efaa45f41bc1dc8df6665c55b4e5ade343d60d4c..36ea5429b9a18a857fd1fea30b52f69a182c7ede 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Warden.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Warden.java
|
||||
@@ -111,4 +111,6 @@ public interface Warden extends Monster {
|
||||
*/
|
||||
ANGRY;
|
||||
}
|
||||
-}
|
||||
+
|
||||
+ void setCanDespawn(boolean canDespawn); // Slice
|
||||
+}
|
||||
\ No newline at end of file
|
||||
@@ -0,0 +1,56 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 22 Aug 2023 06:22:17 -0500
|
||||
Subject: [PATCH] Add reason to PlayerConnectionCloseEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
|
||||
index 12c1c6fe9dc8dc5f5faf6dcf99f6857219ef22b8..42954466c13a926e735754949cc9d78fa1ad7b10 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
|
||||
@@ -50,12 +50,18 @@ public class PlayerConnectionCloseEvent extends Event {
|
||||
@NotNull private final UUID playerUniqueId;
|
||||
@NotNull private final String playerName;
|
||||
@NotNull private final InetAddress ipAddress;
|
||||
+ @NotNull private final ConnectionCloseReason reason;
|
||||
|
||||
public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull final InetAddress ipAddress, final boolean async) {
|
||||
+ this(playerUniqueId, playerName, ipAddress, ConnectionCloseReason.NORMAL, async);
|
||||
+ }
|
||||
+
|
||||
+ public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull final InetAddress ipAddress, @NotNull ConnectionCloseReason reason, final boolean async) {
|
||||
super(async);
|
||||
this.playerUniqueId = playerUniqueId;
|
||||
this.playerName = playerName;
|
||||
this.ipAddress = ipAddress;
|
||||
+ this.reason = reason;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,4 +98,26 @@ public class PlayerConnectionCloseEvent extends Event {
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLERS;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the reason for the closed connection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ConnectionCloseReason getReason() {
|
||||
+ return this.reason;
|
||||
+ }
|
||||
+
|
||||
+ public enum ConnectionCloseReason {
|
||||
+ /**
|
||||
+ * Player disconnected normally
|
||||
+ */
|
||||
+ NORMAL,
|
||||
+
|
||||
+ /**
|
||||
+ * Player has invalid data for some reason.
|
||||
+ * <p>
|
||||
+ * One example of this is a player logging into an unloaded world.
|
||||
+ */
|
||||
+ INVALID_PLAYER_DATA,
|
||||
+ }
|
||||
}
|
||||
41
patches/api/0019-Add-timeDamaged-to-EntityDamageEvent.patch
Normal file
41
patches/api/0019-Add-timeDamaged-to-EntityDamageEvent.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 10 Sep 2023 07:41:26 -0500
|
||||
Subject: [PATCH] Add timeDamaged to EntityDamageEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||
index 4773f537dec20d6ebd82e4b145a1cdea0077fe90..f7a6346bc7eecc57fa7d69c801afa15230496f3c 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||
@@ -27,6 +27,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
private final Map<DamageModifier, Double> originals;
|
||||
private boolean cancelled;
|
||||
private final DamageCause cause;
|
||||
+ private long timeDamaged = System.currentTimeMillis(); // Slice
|
||||
|
||||
public EntityDamageEvent(@NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
|
||||
this(damagee, cause, new EnumMap<DamageModifier, Double>(ImmutableMap.of(DamageModifier.BASE, damage)), new EnumMap<DamageModifier, Function<? super Double, Double>>(ImmutableMap.of(DamageModifier.BASE, ZERO)));
|
||||
@@ -193,6 +194,22 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
return cause;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ /**
|
||||
+ * @return Get the time the damage event happened.
|
||||
+ */
|
||||
+ public long getTimeDamaged() {
|
||||
+ return timeDamaged;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @param timeDamaged Set the time the damage event happened, if you so choose.
|
||||
+ */
|
||||
+ public void setTimeDamaged(long timeDamaged) {
|
||||
+ this.timeDamaged = timeDamaged;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
30
patches/api/0020-Non-saveable-entities.patch
Normal file
30
patches/api/0020-Non-saveable-entities.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 21 Oct 2023 11:27:53 -0500
|
||||
Subject: [PATCH] Non-saveable entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 762cb07861ca8ff058ce8d57ea6c15df1e588bf3..234ad94cf73caaac64d0917cf0d761c1d4c5d6b5 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -1049,4 +1049,19 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
*/
|
||||
@NotNull String getScoreboardEntryName();
|
||||
// Paper end - entity scoreboard name
|
||||
+
|
||||
+ // Slice start
|
||||
+ /**
|
||||
+ * Returns true if the entity can be saved. If false, the entity will never be serialized or saved.
|
||||
+ */
|
||||
+ boolean isSaveable();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the entity can be serialized and saved to disk.
|
||||
+ *
|
||||
+ * @param saveable the saveable status
|
||||
+ * @see #isSaveable()
|
||||
+ */
|
||||
+ void setSaveable(boolean saveable);
|
||||
+ // Slice end
|
||||
}
|
||||
70
patches/api/0021-ChunkStatusChangeEvent.patch
Normal file
70
patches/api/0021-ChunkStatusChangeEvent.patch
Normal file
@@ -0,0 +1,70 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 22 Oct 2023 08:41:09 -0500
|
||||
Subject: [PATCH] ChunkStatusChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..512664d4a7a6821b8d79d0aabf5c31a61fcae6b9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java
|
||||
@@ -0,0 +1,58 @@
|
||||
+package com.destroystokyo.paper.event.chunk;
|
||||
+
|
||||
+import org.bukkit.Chunk;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the Full Status of a Chunk changes
|
||||
+ */
|
||||
+public class ChunkStatusChangeEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Chunk chunk;
|
||||
+ private final ChunkStatus currentState;
|
||||
+ private final ChunkStatus newState;
|
||||
+
|
||||
+ public ChunkStatusChangeEvent(Chunk chunk, ChunkStatus currentState, ChunkStatus newState) {
|
||||
+ super();
|
||||
+ this.chunk = chunk;
|
||||
+ this.currentState = currentState;
|
||||
+ this.newState = newState;
|
||||
+ }
|
||||
+
|
||||
+ public Chunk getChunk() {
|
||||
+ return chunk;
|
||||
+ }
|
||||
+
|
||||
+ public ChunkStatus getCurrentState() {
|
||||
+ return currentState;
|
||||
+ }
|
||||
+
|
||||
+ public ChunkStatus getNewState() {
|
||||
+ return newState;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isUpgrade() {
|
||||
+ return newState.ordinal() > currentState.ordinal();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public enum ChunkStatus {
|
||||
+ INACCESSIBLE,
|
||||
+ FULL,
|
||||
+ BLOCK_TICKING,
|
||||
+ ENTITY_TICKING;
|
||||
+ }
|
||||
+}
|
||||
@@ -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 fb98936bb8a5488db75d676c5bcb4060597fbbf8..2e1cea360bb6ff85eb8da54237bc407653eb91f6 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -22,8 +22,8 @@ repositories {
|
||||
}
|
||||
@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
val alsoShade: Configuration by configurations.creating
|
||||
|
||||
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 {
|
||||
@@ -72,7 +76,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
|
||||
@@ -149,7 +153,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 67ee3a4ca8a6cdeb275653d492a1fea8037c51fb..915340fedc6c0b3d70ee065482dbe621b7c0b0a8 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
|
||||
@@ -1692,7 +1692,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 ec4b73321205b472f19fa5bd4ad95893020d1340..2fdc3bcea74b82d7155617d77100b100d8e56047 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
|
||||
@@ -265,7 +265,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 08:33:45 -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
|
||||
--- 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 {
|
||||
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);
|
||||
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
|
||||
--- 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 {
|
||||
protected void blockUsingShield(LivingEntity attacker) {
|
||||
super.blockUsingShield(attacker);
|
||||
if (attacker.getMainHandItem().getItem() instanceof AxeItem) {
|
||||
- this.disableShield(true);
|
||||
+ this.disableShield(true, attacker); // Slice
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1403,6 +1403,12 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
public void disableShield(boolean sprinting) {
|
||||
+ // Slice start
|
||||
+ disableShield(sprinting, null);
|
||||
+ }
|
||||
+
|
||||
+ public void disableShield(boolean sprinting, @Nullable LivingEntity attacker) {
|
||||
+ // Slice end
|
||||
float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F;
|
||||
|
||||
if (sprinting) {
|
||||
@@ -1410,6 +1416,8 @@ 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.stopUsingItem();
|
||||
this.level.broadcastEntityEvent(this, (byte) 30);
|
||||
@@ -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
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:29:11 -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 773bfdd3ed457a352b5329f280c0d10297d579ba..c7ee934d4f890bc86596d36079ffed5050133b47 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 {
|
||||
@@ -598,12 +598,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,16 +46,7 @@ index 9cafd000b3533ed9fd35df2ec880f55e262084fb..8420d615867faa717266d1edfa5a469d
|
||||
// CraftBukkit start - tree generation
|
||||
if (this.captureTreeGeneration) {
|
||||
// Paper start
|
||||
@@ -593,7 +593,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())) {
|
||||
this.getProfiler().push("queueCheckLight");
|
||||
this.getChunkSource().getLightEngine().checkBlock(pos);
|
||||
this.getProfiler().pop();
|
||||
@@ -740,7 +740,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -794,7 +794,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
Block.dropResources(iblockdata, this, pos, tileentity, breakingEntity, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@@ -63,9 +54,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 +77,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 fdd9c61b7248e92dbcbec91cd6fe4c6310bba237..2f2197236d9ba64b62510df923378b0256629d02 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 {
|
||||
@@ -194,7 +194,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 bf2cd1eb04c10b8422ddca8efd397290bf58ea4d..30dcafc3ebcb5ab230a5622a0108aa3d7e3c4ead 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
@@ -286,7 +286,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 f3ac362b7b65a5273ff5fdad1d8065c5f654a53a..2c60ae8b5adb60c49712327bda3c2666778fd729 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 {
|
||||
@@ -187,15 +187,20 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public void setBlockData(BlockData data, boolean applyPhysics) {
|
||||
@@ -116,28 +120,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
|
||||
@@ -209,7 +214,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 b1abb332eca597b23888bca42d21d5b587f61b13..7286394d1de13247870aac7c3110964bf01a7078 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
@@ -208,7 +208,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 0b7d882551bcb8be149754209aad5fe4142f0fac..db3a7b550b1fa0654ba76f522a8163135f222281 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 {
|
||||
@@ -245,7 +245,7 @@ public class DummyGeneratorAccess implements WorldGenLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,46 +1,46 @@
|
||||
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: Mon, 10 Apr 2023 07:30:29 -0500
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
|
||||
|
||||
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 618ab9a2903f6d4139acd4aaa2e6db0a26e88ba9..ec94d787f227c373637e6bb5f38260d978fe14df 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 {
|
||||
@@ -419,6 +419,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 {
|
||||
@@ -447,6 +448,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 879cc823d56625867eb73bb621db6a13f40ad81c..2b3b1c5ccdf58ee9b46d404cfa3790d0fdc2df3d 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 {
|
||||
}
|
||||
}
|
||||
Item item = this.getItem();
|
||||
@@ -352,6 +352,7 @@ public final class ItemStack {
|
||||
CompoundTag oldData = this.getTagClone();
|
||||
int oldCount = this.getCount();
|
||||
ServerLevel world = (ServerLevel) context.getLevel();
|
||||
+ if (entityhuman != null) world.pendingPlayerBlockEvents.put(blockposition, new Level.PendingBlockEvent(blockposition, entityhuman)); // Paper
|
||||
InteractionResult enuminteractionresult = item.useOn(itemactioncontext);
|
||||
CompoundTag newData = this.getTagClone();
|
||||
int newCount = this.getCount();
|
||||
|
||||
if (!(item instanceof BucketItem/* || item instanceof SolidBucketItem*/)) { // if not bucket // Paper - capture block states for snow buckets
|
||||
world.captureBlockStates = true;
|
||||
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 c7ee934d4f890bc86596d36079ffed5050133b47..1d17c6471449fe4f4fd2bae6bc8a9c500fb0c96f 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 {
|
||||
@@ -184,6 +184,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 +68,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 {
|
||||
@@ -748,6 +769,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (!this.preventPoiUpdated) {
|
||||
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
@@ -76,56 +76,61 @@ 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
|
||||
@@ -769,6 +791,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 030b38d5d5d2578d6ef482a239ef58787efa3b08..329053cf5c342747985f9079e87edc6f883bfa1e 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 de4c1e4701236e7d5ec77339c51ad6a9d8288bb6..4beb56de55d5584ce7f6e04ae30f7c3cffc1440e 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 {
|
||||
@@ -1127,11 +1127,22 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||
Direction[] aenumdirection = BlockBehaviour.UPDATE_SHAPE_ORDER;
|
||||
int k = aenumdirection.length;
|
||||
+ BlockState blockState = world.getBlockState(pos); // Slice
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset((Vec3i) pos, enumdirection);
|
||||
BlockState iblockdata = world.getBlockState(blockposition_mutableblockposition);
|
||||
+
|
||||
for (int l = 0; l < k; ++l) {
|
||||
Direction enumdirection = aenumdirection[l];
|
||||
|
||||
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 (blockState.getBukkitMaterial() == org.bukkit.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 +138,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);
|
||||
@@ -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,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: Mon, 10 Apr 2023 07:31:54 -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 243b5823ea99eefd812134b5c80d4d3c9f008499..ee97b4352fcdb3fd55eeb5a4a57981b2f0aed28b 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: Mon, 10 Apr 2023 07:36:21 -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 4bce895268542531598a01a1bccd8ac1ed703b7d..8b552fc58a2909bced07eb743dd5d76c0357f9ab 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 {
|
||||
@@ -104,7 +104,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,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,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: Mon, 10 Apr 2023 07:37:05 -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 18aac3da3c88f33b1a71a5920a8daa27e9723913..af0720fb8bd334aac5493121c6373d87421204b4 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 {
|
||||
@@ -222,6 +222,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 1a481fb4f4228f0fea8a7dc6132248c98b727c90..836bdbf4a4742f0cce0f9612d694db03305c7a00 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 {
|
||||
@@ -1268,6 +1268,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,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
|
||||
Date: Mon, 10 Apr 2023 07:38:40 -0500
|
||||
Subject: [PATCH] Add PlayerData 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 df2a4449bdc00eb936bf219807d401fc99663926..939d29db3c535c45866fe67cabbe9304601230b0 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);
|
||||
@@ -602,6 +602,8 @@ public class ServerPlayerGameMode {
|
||||
enuminteractionresult1 = stack.useOn(itemactioncontext);
|
||||
}
|
||||
|
||||
+ 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 9501e5f25f5c4d3069e554d4dc82b0e094156682..8afd9b785fb8734255e3ea926b8375bb9cae60be 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 {
|
||||
@@ -198,7 +198,12 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@@ -35,17 +35,17 @@ index 9f3355dbbbab1ab88cf2b7034130c2888e38d7a7..ec43aa3661bc891a17670aec54d3f009
|
||||
Map<StatType<?>, JsonObject> map = Maps.newHashMap();
|
||||
ObjectIterator objectiterator = this.stats.object2IntEntrySet().iterator();
|
||||
|
||||
@@ -227,7 +232,7 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
@@ -224,7 +229,7 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
|
||||
jsonobject1.add("stats", jsonobject);
|
||||
jsonobject1.addProperty("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
|
||||
jsonobject1.addProperty("DataVersion", SharedConstants.getCurrentVersion().getDataVersion().getVersion());
|
||||
- return jsonobject1.toString();
|
||||
+ return jsonobject1; // Slice
|
||||
}
|
||||
|
||||
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 36af81f0957d17e170d229059c66f4eb4539dfeb..e8d324a32838b69255ce48b1c03e47cd9e201da6 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/0008-Add-PlayerGetRespawnLocationEvent.patch
Normal file
102
patches/server/0008-Add-PlayerGetRespawnLocationEvent.patch
Normal file
@@ -0,0 +1,102 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:46:18 -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 f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..20a0b9835c47ca153a6f77dacf4b775de32e4ef2 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -853,49 +853,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); // CraftBukkit - not required, just copies old location into reused entity
|
||||
- flag2 = !flag && flag3;
|
||||
- isBedSpawn = true;
|
||||
- location = CraftLocation.toBukkit(vec3d, worldserver1.getWorld(), 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); // CraftBukkit - not required, just copies old location into reused entity
|
||||
+ flag2 = !flag && flag3;
|
||||
+ isBedSpawn = true;
|
||||
+ location = CraftLocation.toBukkit(vec3d, worldserver1.getWorld(), 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
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
|
||||
- if (location == null) {
|
||||
- worldserver1 = this.server.getLevel(Level.OVERWORLD);
|
||||
- blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
- location = CraftLocation.toBukkit(blockposition, worldserver1.getWorld(), worldserver1.levelData.getSpawnAngle(), 0.0F).add(0.5F, 0.1F, 0.5F); // Paper - use world spawn angle
|
||||
+ if (location == null) {
|
||||
+ worldserver1 = this.server.getLevel(Level.OVERWORLD);
|
||||
+ blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
+ location = CraftLocation.toBukkit(blockposition, worldserver1.getWorld(), worldserver1.levelData.getSpawnAngle(), 0.0F).add(0.5F, 0.1F, 0.5F); // Paper - use world spawn angle
|
||||
+ }
|
||||
}
|
||||
|
||||
- Player respawnPlayer = entityplayer1.getBukkitEntity();
|
||||
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, reason, 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
|
||||
@@ -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) {
|
||||
149
patches/server/0009-Set-multiple-team-settings-at-once.patch
Normal file
149
patches/server/0009-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: Mon, 10 Apr 2023 07:52:53 -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 9c3520524cfb903da6a5401760394ec1b49a1825..a6809c3104d4a8fce89eb5056b445ae0517bf9a0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
@@ -341,6 +341,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/0010-Smooth-Teleports.patch
Normal file
57
patches/server/0010-Smooth-Teleports.patch
Normal file
@@ -0,0 +1,57 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:55:35 -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 161c40692e8d469fad4169908b9353be0f85d0d8..2b93a37ee1f711c14140eb96f29dfdd3290641ad 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -278,6 +278,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
|
||||
|
||||
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
|
||||
public io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 20a0b9835c47ca153a6f77dacf4b775de32e4ef2..97c6f1c622af02b3761b23a4d3a67b385e45ea84 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -935,12 +935,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(), entityplayer1.getPortalCooldown()));
|
||||
+ 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.getPortalCooldown()));
|
||||
entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.getWorld().getSendViewDistance())); // Spigot // Paper - replace old player chunk management
|
||||
entityplayer1.connection.send(new ClientboundSetSimulationDistancePacket(worldserver1.getWorld().getSimulationDistance())); // Spigot // Paper - replace old player chunk management
|
||||
entityplayer1.spawnIn(worldserver1);
|
||||
entityplayer1.unsetRemoved();
|
||||
- entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver1.getWorld(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
+ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver1.getWorld(), 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 4e6fea7cf11b1e29ae7c7098a6f5d06bb5f93cc2..767a33cdce4b438164bf4101ff39cd7b1e8f929e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1254,6 +1254,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
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 08:40:20 -0500
|
||||
Subject: [PATCH] Ignore durability changes for 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 e11d7283662834047b2ff81a2fd25a4263792deb..d0e49ae973a91344f3973dc6e00e7e6c649e87cb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3127,7 +3127,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
public boolean equipmentHasChanged(ItemStack stack, ItemStack stack2) {
|
||||
- return !ItemStack.matches(stack2, stack);
|
||||
+ return !ItemStack.isSame(stack2, stack);
|
||||
}
|
||||
|
||||
private void handleHandSwap(Map<EquipmentSlot, ItemStack> equipmentChanges) {
|
||||
32
patches/server/0012-Disable-Azalea-generation.patch
Normal file
32
patches/server/0012-Disable-Azalea-generation.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 08:45:12 -0500
|
||||
Subject: [PATCH] Disable Azalea generation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java b/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java
|
||||
index 8f5178e934b5f9bc48beacd082e479fd9fb80fa6..d580238d733ba2dbbbbaa2659d1a7834c8cf7dac 100644
|
||||
--- a/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java
|
||||
+++ b/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java
|
||||
@@ -161,7 +161,7 @@ public class BiomeDefaultFeatures {
|
||||
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.CAVE_VINES);
|
||||
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.LUSH_CAVES_CLAY);
|
||||
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.LUSH_CAVES_VEGETATION);
|
||||
- builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.ROOTED_AZALEA_TREE);
|
||||
+// builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.ROOTED_AZALEA_TREE); // Slice
|
||||
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.SPORE_BLOSSOM);
|
||||
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.CLASSIC_VINES);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/data/worldgen/features/CaveFeatures.java b/src/main/java/net/minecraft/data/worldgen/features/CaveFeatures.java
|
||||
index 3d899e4dbb96f64279485bbd5b708df88ddbfe8f..89f33b92dc8cfa22d1e1edbda1a31179743979e8 100644
|
||||
--- a/src/main/java/net/minecraft/data/worldgen/features/CaveFeatures.java
|
||||
+++ b/src/main/java/net/minecraft/data/worldgen/features/CaveFeatures.java
|
||||
@@ -110,7 +110,7 @@ public class CaveFeatures {
|
||||
RandomizedIntStateProvider randomizedIntStateProvider = new RandomizedIntStateProvider(new WeightedStateProvider(SimpleWeightedRandomList.<BlockState>builder().add(Blocks.CAVE_VINES.defaultBlockState(), 4).add(Blocks.CAVE_VINES.defaultBlockState().setValue(CaveVines.BERRIES, Boolean.valueOf(true)), 1)), CaveVinesBlock.AGE, UniformInt.of(23, 25));
|
||||
FeatureUtils.register(featureRegisterable, CAVE_VINE, Feature.BLOCK_COLUMN, new BlockColumnConfiguration(List.of(BlockColumnConfiguration.layer(new WeightedListInt(SimpleWeightedRandomList.<IntProvider>builder().add(UniformInt.of(0, 19), 2).add(UniformInt.of(0, 2), 3).add(UniformInt.of(0, 6), 10).build()), weightedStateProvider), BlockColumnConfiguration.layer(ConstantInt.of(1), randomizedIntStateProvider)), Direction.DOWN, BlockPredicate.ONLY_IN_AIR_PREDICATE, true));
|
||||
FeatureUtils.register(featureRegisterable, CAVE_VINE_IN_MOSS, Feature.BLOCK_COLUMN, new BlockColumnConfiguration(List.of(BlockColumnConfiguration.layer(new WeightedListInt(SimpleWeightedRandomList.<IntProvider>builder().add(UniformInt.of(0, 3), 5).add(UniformInt.of(1, 7), 1).build()), weightedStateProvider), BlockColumnConfiguration.layer(ConstantInt.of(1), randomizedIntStateProvider)), Direction.DOWN, BlockPredicate.ONLY_IN_AIR_PREDICATE, true));
|
||||
- FeatureUtils.register(featureRegisterable, MOSS_VEGETATION, Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(new WeightedStateProvider(SimpleWeightedRandomList.<BlockState>builder().add(Blocks.FLOWERING_AZALEA.defaultBlockState(), 4).add(Blocks.AZALEA.defaultBlockState(), 7).add(Blocks.MOSS_CARPET.defaultBlockState(), 25).add(Blocks.GRASS.defaultBlockState(), 50).add(Blocks.TALL_GRASS.defaultBlockState(), 10))));
|
||||
+ FeatureUtils.register(featureRegisterable, MOSS_VEGETATION, Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(new WeightedStateProvider(SimpleWeightedRandomList.<BlockState>builder().add(Blocks.MOSS_CARPET.defaultBlockState(), 25).add(Blocks.GRASS.defaultBlockState(), 50).add(Blocks.TALL_GRASS.defaultBlockState(), 10))));
|
||||
FeatureUtils.register(featureRegisterable, MOSS_PATCH, Feature.VEGETATION_PATCH, new VegetationPatchConfiguration(BlockTags.MOSS_REPLACEABLE, BlockStateProvider.simple(Blocks.MOSS_BLOCK), PlacementUtils.inlinePlaced(holderGetter.getOrThrow(MOSS_VEGETATION)), CaveSurface.FLOOR, ConstantInt.of(1), 0.0F, 5, 0.8F, UniformInt.of(4, 7), 0.3F));
|
||||
FeatureUtils.register(featureRegisterable, MOSS_PATCH_BONEMEAL, Feature.VEGETATION_PATCH, new VegetationPatchConfiguration(BlockTags.MOSS_REPLACEABLE, BlockStateProvider.simple(Blocks.MOSS_BLOCK), PlacementUtils.inlinePlaced(holderGetter.getOrThrow(MOSS_VEGETATION)), CaveSurface.FLOOR, ConstantInt.of(1), 0.0F, 5, 0.6F, UniformInt.of(1, 2), 0.75F));
|
||||
FeatureUtils.register(featureRegisterable, DRIPLEAF, Feature.SIMPLE_RANDOM_SELECTOR, new SimpleRandomFeatureConfiguration(HolderSet.direct(makeSmallDripleaf(), makeDripleaf(Direction.EAST), makeDripleaf(Direction.WEST), makeDripleaf(Direction.SOUTH), makeDripleaf(Direction.NORTH))));
|
||||
48
patches/server/0013-AntiXray-Bypass.patch
Normal file
48
patches/server/0013-AntiXray-Bypass.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 08:46:54 -0500
|
||||
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 42fdce97d99618a53f2e9c51804ff2205b574f69..7e8d58e3481be2d7ebbe5fe388d61932479e7721 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
||||
@@ -165,6 +165,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 767a33cdce4b438164bf4101ff39cd7b1e8f929e..0af1801085701437f06c9ecaf8864fe875e90509 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -196,6 +196,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);
|
||||
@@ -2827,6 +2828,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,213 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 6 Oct 2021 11:03:01 -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
|
||||
--- 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 {
|
||||
}
|
||||
|
||||
public <T> void set(EntityDataAccessor<T> key, T value) {
|
||||
+ //Slice start
|
||||
+ set(key, value, null);
|
||||
+ }
|
||||
+
|
||||
+ public <T> void set(EntityDataAccessor<T> key, T value, @Nullable T foreignValue) { // Slice end
|
||||
SynchedEntityData.DataItem<T> datawatcher_item = this.getItem(key);
|
||||
|
||||
if (ObjectUtils.notEqual(value, datawatcher_item.getValue())) {
|
||||
@@ -145,6 +150,11 @@ public class SynchedEntityData {
|
||||
this.isDirty = true;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ if (foreignValue != null && ObjectUtils.notEqual(foreignValue, datawatcher_item.getForeignValue())) {
|
||||
+ datawatcher_item.setForeignValue(foreignValue);
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
// CraftBukkit start - add method from above
|
||||
@@ -200,6 +210,28 @@ 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);
|
||||
+
|
||||
+ if (list == null) {
|
||||
+ list = Lists.newArrayList();
|
||||
+ }
|
||||
+
|
||||
+ list.add(item.copy(true));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return list;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Nullable
|
||||
public List<SynchedEntityData.DataItem<?>> getAll() {
|
||||
List<SynchedEntityData.DataItem<?>> list = null;
|
||||
@@ -313,11 +345,14 @@ public class SynchedEntityData {
|
||||
final EntityDataAccessor<T> accessor;
|
||||
T value;
|
||||
private boolean dirty;
|
||||
+ @Nullable T foreignValue = null; // Slice
|
||||
+ private boolean foreignDirty; // Slice
|
||||
|
||||
public DataItem(EntityDataAccessor<T> data, T value) {
|
||||
this.accessor = data;
|
||||
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));
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ public void setForeignValue(T foreignValue) {
|
||||
+ this.foreignValue = foreignValue;
|
||||
+ this.foreignDirty = true;
|
||||
+ }
|
||||
+
|
||||
+ public @Nullable T getForeignValue() {
|
||||
+ return foreignValue;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isDirty(boolean foreign) {
|
||||
+ if (foreign) {
|
||||
+ //There must be a foreign value in order for this to be dirty, otherwise we consider this a normal
|
||||
+ //value and check the normal dirty flag.
|
||||
+ return foreignValue == null || this.foreignDirty;
|
||||
+ }
|
||||
+
|
||||
+ return this.dirty;
|
||||
+ }
|
||||
+
|
||||
+ public void setForeignDirty(boolean dirty) {
|
||||
+ this.foreignDirty = dirty;
|
||||
+ }
|
||||
+
|
||||
+ public SynchedEntityData.DataItem<T> copy(boolean foreign) {
|
||||
+ return new SynchedEntityData.DataItem<>(this.accessor, this.accessor.getSerializer().copy((foreign && this.foreignValue != null ? this.foreignValue : this.value)));
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
}
|
||||
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
|
||||
--- 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();
|
||||
|
||||
if (datawatcher.isDirty()) {
|
||||
- this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false));
|
||||
+ // Slice start
|
||||
+ ClientboundSetEntityDataPacket dataPacket = new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false);
|
||||
+ 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());
|
||||
+ if (dirtyItems != null) {
|
||||
+ this.broadcast(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
|
||||
--- 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()) {
|
||||
return;
|
||||
}
|
||||
- this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount());
|
||||
+ this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount(), getMaxAirSupply()); // Slice
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
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
|
||||
--- 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 {
|
||||
public void increaseScore(int score) {
|
||||
int j = this.getScore();
|
||||
|
||||
- this.entityData.set(Player.DATA_SCORE_ID, j + score);
|
||||
+ this.entityData.set(Player.DATA_SCORE_ID, j + score, 0); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
--- 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 {
|
||||
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().maxHealthCache = getMaxHealth();
|
||||
}
|
||||
36
patches/server/0014-Add-PlayerPreChunkLoadEvent.patch
Normal file
36
patches/server/0014-Add-PlayerPreChunkLoadEvent.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 08:47:43 -0500
|
||||
Subject: [PATCH] Add PlayerPreChunkLoadEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
index 924539d4ac50c70178ba220424ffacd6ff277c8b..f9b30f2904d06f2a7de6fa03287bc2e40e879e2d 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
@@ -411,7 +411,7 @@ public class RegionizedPlayerChunkLoader {
|
||||
private boolean canGenerateChunks = true;
|
||||
|
||||
private final ArrayDeque<ChunkHolderManager.TicketOperation<?, ?>> delayedTicketOps = new ArrayDeque<>();
|
||||
- private final LongOpenHashSet sentChunks = new LongOpenHashSet();
|
||||
+ public final LongOpenHashSet sentChunks = new LongOpenHashSet(); // Slice -> public
|
||||
|
||||
private static final byte CHUNK_TICKET_STAGE_NONE = 0;
|
||||
private static final byte CHUNK_TICKET_STAGE_LOADING = 1;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 836bdbf4a4742f0cce0f9612d694db03305c7a00..fb79e3ee663709538d6e322fd8401564dcbbe5a7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -530,6 +530,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public it.unimi.dsi.fastutil.longs.LongOpenHashSet getSentChunks(Player p) {
|
||||
+ ServerPlayer craftPlayer = ((CraftPlayer) p).getHandle();
|
||||
+ return craftPlayer.chunkLoader.sentChunks;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public boolean isChunkInUse(int x, int z) {
|
||||
return this.isChunkLoaded(x, z);
|
||||
@@ -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,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
|
||||
Date: Tue, 18 Apr 2023 07:49:59 -0500
|
||||
Subject: [PATCH] Allow 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 5e22d175b1048a58802cdf64ac70a8b56329e915..0f15e574b5c0cc8648bc1c0a12f1c72aa8653724 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,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);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
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: Tue, 18 Apr 2023 07:50:34 -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 e8485fb900b25e911a858678a833852731cb2ace..a0f8740c93fe86d4c49b9e43f1044ef03d8e3de7 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
|
||||
@@ -868,7 +868,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
this.checkOutOfWorld();
|
||||
if (!this.level.isClientSide) {
|
||||
this.checkBelowWorld();
|
||||
if (!this.level().isClientSide) {
|
||||
- this.setSharedFlagOnFire(this.remainingFireTicks > 0);
|
||||
+ if (this instanceof net.minecraft.world.entity.LivingEntity livingEntity) {
|
||||
+ this.setSharedFlagOnFire(this.remainingFireTicks > 0 && !livingEntity.hasEffect(net.minecraft.world.effect.MobEffects.FIRE_RESISTANCE));
|
||||
@@ -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: Tue, 18 Apr 2023 07:52:19 -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 65d947df910d60f478e7a449eb161e5105e2c0c9..e08b72010f22ce680e88f443782bdfe6a46285f9 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));
|
||||
@@ -524,7 +524,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return !ChunkMap.isChunkInRange(x1, z1, x2, z2, distance) ? false : !ChunkMap.isChunkInRange(x1 + 1, z1 + 1, x2, z2, distance) || !ChunkMap.isChunkInRange(x1 - 1, z1 + 1, x2, z2, distance) || !ChunkMap.isChunkInRange(x1 + 1, z1 - 1, x2, z2, distance) || !ChunkMap.isChunkInRange(x1 - 1, z1 - 1, x2, z2, distance);
|
||||
}
|
||||
|
||||
- protected ThreadedLevelLightEngine getLightEngine() {
|
||||
@@ -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();
|
||||
@@ -0,0 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 18 Apr 2023 07:56:32 -0500
|
||||
Subject: [PATCH] Disable geode and monsterspawners generation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/data/worldgen/biome/OverworldBiomes.java b/src/main/java/net/minecraft/data/worldgen/biome/OverworldBiomes.java
|
||||
index 84aa56cbcaa5539b556f42eb284d3dd2e200e358..a6d2ead225841192c2eb80b3b2e54ceeaa76546b 100644
|
||||
--- a/src/main/java/net/minecraft/data/worldgen/biome/OverworldBiomes.java
|
||||
+++ b/src/main/java/net/minecraft/data/worldgen/biome/OverworldBiomes.java
|
||||
@@ -54,8 +54,8 @@ public class OverworldBiomes {
|
||||
|
||||
private static void globalOverworldGeneration(BiomeGenerationSettings.Builder generationSettings) {
|
||||
BiomeDefaultFeatures.addDefaultCarversAndLakes(generationSettings);
|
||||
- BiomeDefaultFeatures.addDefaultCrystalFormations(generationSettings);
|
||||
- BiomeDefaultFeatures.addDefaultMonsterRoom(generationSettings);
|
||||
+// BiomeDefaultFeatures.addDefaultCrystalFormations(generationSettings); // Slice - Don't generate Geodes in our chunk generation
|
||||
+// BiomeDefaultFeatures.addDefaultMonsterRoom(generationSettings);
|
||||
BiomeDefaultFeatures.addDefaultUndergroundVariety(generationSettings);
|
||||
BiomeDefaultFeatures.addDefaultSprings(generationSettings);
|
||||
BiomeDefaultFeatures.addSurfaceFreezing(generationSettings);
|
||||
@@ -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() {
|
||||
19
patches/server/0019-Set-Mutton-nutrition-equal-to-beef.patch
Normal file
19
patches/server/0019-Set-Mutton-nutrition-equal-to-beef.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 18 Apr 2023 07:58:01 -0500
|
||||
Subject: [PATCH] Set Mutton nutrition equal to 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();
|
||||
145
patches/server/0020-PlayerLoadStatsEvent.patch
Normal file
145
patches/server/0020-PlayerLoadStatsEvent.patch
Normal file
@@ -0,0 +1,145 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:15:23 -0500
|
||||
Subject: [PATCH] PlayerLoadStatsEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 97c6f1c622af02b3761b23a4d3a67b385e45ea84..7f059a71d25170e8e3215c7d91ab7927394cfeb5 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1474,7 +1474,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
}
|
||||
|
||||
- serverstatisticmanager = new ServerStatsCounter(this.server, file1);
|
||||
+ serverstatisticmanager = new ServerStatsCounter(this.server, file1, uuid); // Slice
|
||||
// this.stats.put(uuid, serverstatisticmanager); // CraftBukkit
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
index 8afd9b785fb8734255e3ea926b8375bb9cae60be..9bd42eac43f068df8f7f49249bb47840d87d799a 100644
|
||||
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
@@ -45,7 +45,7 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
private final File file;
|
||||
private final Set<Stat<?>> dirty = Sets.newHashSet();
|
||||
|
||||
- public ServerStatsCounter(MinecraftServer server, File file) {
|
||||
+ public ServerStatsCounter(MinecraftServer server, File file, java.util.UUID uuid) { // Slice
|
||||
this.server = server;
|
||||
this.file = file;
|
||||
// Spigot start
|
||||
@@ -55,7 +55,13 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
this.stats.put( wrapper, entry.getValue().intValue() );
|
||||
}
|
||||
// Spigot end
|
||||
- if (file.isFile()) {
|
||||
+ // Slice start - If event supplies stats, use it. Otherwise just load from disk as usual
|
||||
+ com.destroystokyo.paper.event.player.PlayerLoadStatsEvent event = new com.destroystokyo.paper.event.player.PlayerLoadStatsEvent(uuid);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ JsonObject providedStats = event.getStatistics();
|
||||
+ if (providedStats != null) {
|
||||
+ readStats(server.getFixerUpper(), fromJson(providedStats));
|
||||
+ } else if (file.isFile()) { // Slice end
|
||||
try {
|
||||
this.parseLocal(server.getFixerUpper(), FileUtils.readFileToString(file));
|
||||
} catch (IOException ioexception) {
|
||||
@@ -103,46 +109,8 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
|
||||
if (!jsonelement.isJsonNull()) {
|
||||
CompoundTag nbttagcompound = ServerStatsCounter.fromJson(jsonelement.getAsJsonObject());
|
||||
-
|
||||
- nbttagcompound = DataFixTypes.STATS.updateToCurrentVersion(dataFixer, nbttagcompound, NbtUtils.getDataVersion(nbttagcompound, 1343));
|
||||
- if (!nbttagcompound.contains("stats", 10)) {
|
||||
- break label48;
|
||||
- }
|
||||
-
|
||||
- CompoundTag nbttagcompound1 = nbttagcompound.getCompound("stats");
|
||||
- Iterator iterator = nbttagcompound1.getAllKeys().iterator();
|
||||
-
|
||||
- while (true) {
|
||||
- if (!iterator.hasNext()) {
|
||||
- break label48;
|
||||
- }
|
||||
-
|
||||
- String s1 = (String) iterator.next();
|
||||
-
|
||||
- if (nbttagcompound1.contains(s1, 10)) {
|
||||
- Util.ifElse(BuiltInRegistries.STAT_TYPE.getOptional(new ResourceLocation(s1)), (statisticwrapper) -> {
|
||||
- CompoundTag nbttagcompound2 = nbttagcompound1.getCompound(s1);
|
||||
- Iterator iterator1 = nbttagcompound2.getAllKeys().iterator();
|
||||
-
|
||||
- while (iterator1.hasNext()) {
|
||||
- String s2 = (String) iterator1.next();
|
||||
-
|
||||
- if (nbttagcompound2.contains(s2, 99)) {
|
||||
- Util.ifElse(this.getStat(statisticwrapper, s2), (statistic) -> {
|
||||
- this.stats.put(statistic, nbttagcompound2.getInt(s2));
|
||||
- }, () -> {
|
||||
- ServerStatsCounter.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.file, s2);
|
||||
- });
|
||||
- } else {
|
||||
- ServerStatsCounter.LOGGER.warn("Invalid statistic value in {}: Don't know what {} is for key {}", new Object[]{this.file, nbttagcompound2.get(s2), s2});
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- }, () -> {
|
||||
- ServerStatsCounter.LOGGER.warn("Invalid statistic type in {}: Don't know what {} is", this.file, s1);
|
||||
- });
|
||||
- }
|
||||
- }
|
||||
+ readStats(dataFixer, nbttagcompound);
|
||||
+ break label48;
|
||||
}
|
||||
|
||||
ServerStatsCounter.LOGGER.error("Unable to parse Stat data from {}", this.file);
|
||||
@@ -167,6 +135,48 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
|
||||
}
|
||||
|
||||
+ private void readStats(DataFixer dataFixer, CompoundTag nbttagcompound) {
|
||||
+ nbttagcompound = DataFixTypes.STATS.updateToCurrentVersion(dataFixer, nbttagcompound, NbtUtils.getDataVersion(nbttagcompound, 1343));
|
||||
+ if (!nbttagcompound.contains("stats", 10)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ CompoundTag nbttagcompound1 = nbttagcompound.getCompound("stats");
|
||||
+ Iterator iterator = nbttagcompound1.getAllKeys().iterator();
|
||||
+
|
||||
+ while (true) {
|
||||
+ if (!iterator.hasNext()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ String s1 = (String) iterator.next();
|
||||
+
|
||||
+ if (nbttagcompound1.contains(s1, 10)) {
|
||||
+ Util.ifElse(BuiltInRegistries.STAT_TYPE.getOptional(new ResourceLocation(s1)), (statisticwrapper) -> {
|
||||
+ CompoundTag nbttagcompound2 = nbttagcompound1.getCompound(s1);
|
||||
+ Iterator iterator1 = nbttagcompound2.getAllKeys().iterator();
|
||||
+
|
||||
+ while (iterator1.hasNext()) {
|
||||
+ String s2 = (String) iterator1.next();
|
||||
+
|
||||
+ if (nbttagcompound2.contains(s2, 99)) {
|
||||
+ Util.ifElse(this.getStat(statisticwrapper, s2), (statistic) -> {
|
||||
+ this.stats.put(statistic, nbttagcompound2.getInt(s2));
|
||||
+ }, () -> {
|
||||
+ ServerStatsCounter.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.file, s2);
|
||||
+ });
|
||||
+ } else {
|
||||
+ ServerStatsCounter.LOGGER.warn("Invalid statistic value in {}: Don't know what {} is for key {}", new Object[]{this.file, nbttagcompound2.get(s2), s2});
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ }, () -> {
|
||||
+ ServerStatsCounter.LOGGER.warn("Invalid statistic type in {}: Don't know what {} is", this.file, s1);
|
||||
+ });
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
private <T> Optional<Stat<T>> getStat(StatType<T> type, String id) {
|
||||
// CraftBukkit - decompile error start
|
||||
Optional<ResourceLocation> optional = Optional.ofNullable(ResourceLocation.tryParse(id));
|
||||
@@ -0,0 +1,53 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:16:50 -0500
|
||||
Subject: [PATCH] Add Force Crit to PlayerPreAttackEntityEvent
|
||||
|
||||
|
||||
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 58152160d609d0e9d105153aeb166a56a7955603..5d52d8821edc8dd2cac3391081a223811297faf8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1277,10 +1277,11 @@ public abstract class Player extends LivingEntity {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
- boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; // Paper - Add critical damage API - conflict on change
|
||||
+ boolean forceCrit = playerAttackEntityEvent.isForceCrit();
|
||||
+ boolean flag2 = forceCrit || (flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity); // Paper - Add critical damage API - conflict on change // Slice
|
||||
|
||||
- flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper
|
||||
- flag2 = flag2 && !this.isSprinting();
|
||||
+ flag2 = flag2 && !level().paperConfig().entities.behavior.disablePlayerCrits; // Paper
|
||||
+ flag2 = forceCrit || (flag2 && !this.isSprinting()); // Slice
|
||||
if (flag2) {
|
||||
f *= 1.5F;
|
||||
}
|
||||
@@ -2411,27 +2412,6 @@ public abstract class Player extends LivingEntity {
|
||||
this.lastDeathLocation = lastDeathPos;
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public float getHurtDir() {
|
||||
- return this.hurtDir;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void animateHurt(float yaw) {
|
||||
- super.animateHurt(yaw);
|
||||
- this.hurtDir = yaw;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public boolean canSprint() {
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- protected float getFlyingSpeed() {
|
||||
- return this.abilities.flying && !this.isPassenger() ? (this.isSprinting() ? this.abilities.getFlyingSpeed() * 2.0F : this.abilities.getFlyingSpeed()) : (this.isSprinting() ? 0.025999999F : 0.02F);
|
||||
- }
|
||||
-
|
||||
public static enum BedSleepingProblem {
|
||||
|
||||
NOT_POSSIBLE_HERE, NOT_POSSIBLE_NOW(Component.translatable("block.minecraft.bed.no_sleep")), TOO_FAR_AWAY(Component.translatable("block.minecraft.bed.too_far_away")), OBSTRUCTED(Component.translatable("block.minecraft.bed.obstructed")), OTHER_PROBLEM, NOT_SAFE(Component.translatable("block.minecraft.bed.not_safe"));
|
||||
@@ -0,0 +1,23 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:17:39 -0500
|
||||
Subject: [PATCH] Add Preventing KB Bonus to PlayerPreAttackEntityEvent
|
||||
|
||||
|
||||
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 5d52d8821edc8dd2cac3391081a223811297faf8..38e110a226aac27d86dfe89bc0e9ecaada6ff268 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1269,7 +1269,11 @@ public abstract class Player extends LivingEntity {
|
||||
boolean flag = f2 > 0.9F;
|
||||
boolean flag1 = false;
|
||||
byte b0 = 0;
|
||||
- int i = b0 + EnchantmentHelper.getKnockbackBonus(this);
|
||||
+ int i = b0; // Slice start
|
||||
+ if (!playerAttackEntityEvent.isPreventKnockbackBonus()) {
|
||||
+ i += EnchantmentHelper.getKnockbackBonus(this);
|
||||
+ }
|
||||
+ // Slice end
|
||||
|
||||
if (this.isSprinting() && flag) {
|
||||
sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
|
||||
31
patches/server/0023-noEntityCollisions-for-Entity.patch
Normal file
31
patches/server/0023-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: Tue, 25 Apr 2023 08:21:03 -0500
|
||||
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 a0f8740c93fe86d4c49b9e43f1044ef03d8e3de7..6d6baa82bb7a67c3f6de4bdb0987e4d1f68b6ec8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -453,6 +453,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<>());
|
||||
{
|
||||
42
patches/server/0024-Do-not-freeze-MappedRegistry.patch
Normal file
42
patches/server/0024-Do-not-freeze-MappedRegistry.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 09:05:16 -0500
|
||||
Subject: [PATCH] Do not freeze MappedRegistry
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
index 1e33434f9f361542e03da3e4812bc6d76768a202..828d9472bf90fe098825c15bc55949497a40ae39 100644
|
||||
--- a/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
+++ b/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
@@ -338,7 +338,7 @@ public class MappedRegistry<T> implements WritableRegistry<T> {
|
||||
if (this.frozen) {
|
||||
return this;
|
||||
} else {
|
||||
- this.frozen = true;
|
||||
+// this.frozen = true; // Slice
|
||||
this.byValue.forEach((value, entry) -> {
|
||||
entry.bindValue(value);
|
||||
});
|
||||
@@ -365,14 +365,16 @@ public class MappedRegistry<T> implements WritableRegistry<T> {
|
||||
|
||||
@Override
|
||||
public Holder.Reference<T> createIntrusiveHolder(T value) {
|
||||
+ // Slice start
|
||||
if (this.unregisteredIntrusiveHolders == null) {
|
||||
- throw new IllegalStateException("This registry can't create intrusive holders");
|
||||
- } else {
|
||||
- this.validateWrite();
|
||||
- return this.unregisteredIntrusiveHolders.computeIfAbsent(value, (valuex) -> {
|
||||
- return Holder.Reference.createIntrusive(this.asLookup(), valuex);
|
||||
- });
|
||||
+ this.unregisteredIntrusiveHolders = new HashMap<>();
|
||||
}
|
||||
+ // Slice end
|
||||
+
|
||||
+ this.validateWrite();
|
||||
+ return this.unregisteredIntrusiveHolders.computeIfAbsent(value, (valuex) -> {
|
||||
+ return Holder.Reference.createIntrusive(this.asLookup(), valuex);
|
||||
+ });
|
||||
}
|
||||
|
||||
@Override
|
||||
24
patches/server/0025-Add-jackson.patch
Normal file
24
patches/server/0025-Add-jackson.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 2 May 2023 07:54:02 -0500
|
||||
Subject: [PATCH] Add jackson
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 2e1cea360bb6ff85eb8da54237bc407653eb91f6..475cbb6120655419fc7dc51292e6beedfe778656 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -19,6 +19,13 @@ dependencies {
|
||||
exclude("io.papermc.paper", "paper-api")
|
||||
}
|
||||
// Slice end
|
||||
+
|
||||
+ // Slice start - JSON logging for DataDog ingestion
|
||||
+ implementation("com.fasterxml.jackson.core:jackson-core:2.13.0")
|
||||
+ implementation("com.fasterxml.jackson.core:jackson-databind:2.13.0")
|
||||
+ implementation("com.fasterxml.jackson.core:jackson-annotations:2.13.0")
|
||||
+ // Slice end
|
||||
+
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
37
patches/server/0026-Maybe-can-t-tostring.patch
Normal file
37
patches/server/0026-Maybe-can-t-tostring.patch
Normal file
@@ -0,0 +1,37 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 6 May 2023 18:14:26 -0500
|
||||
Subject: [PATCH] Maybe can't tostring?
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
|
||||
index 7e94ebe06fc62293e665d6db19e42d947e7eb30f..158c012b8a6808ca0f820c2997af282529148c7c 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
|
||||
@@ -466,6 +466,9 @@ public class CompoundTag implements Tag {
|
||||
@Override
|
||||
public CompoundTag copy() {
|
||||
// Paper start - reduce memory footprint of NBTTagCompound
|
||||
+ if (this.tags.size() < 0) {
|
||||
+ net.minecraft.server.MinecraftServer.LOGGER.debug("Tried to copy an invalid item with negative tags: {}, {}, {}, {}", this.tags, this.tags.getClass().getName());
|
||||
+ }
|
||||
it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<String, Tag> ret = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(this.tags.size(), 0.8f);
|
||||
java.util.Iterator<java.util.Map.Entry<String, Tag>> iterator = (this.tags instanceof it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap) ? ((it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap)this.tags).object2ObjectEntrySet().fastIterator() : this.tags.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 2b3b1c5ccdf58ee9b46d404cfa3790d0fdc2df3d..b31f21e2d9faa00174bbcbbd1e0cf1b22c8b69d4 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -736,7 +736,11 @@ public final class ItemStack {
|
||||
|
||||
itemstack.setPopTime(this.getPopTime());
|
||||
if (this.tag != null) {
|
||||
- itemstack.tag = this.tag.copy();
|
||||
+ if (this.tag.tags.size() < 0) {
|
||||
+ ItemStack.LOGGER.debug("Tried to copy an invalid item with negative tags: {}, {}, {}, {}", this.tag, this.tag.tags, this.tag.tags.getClass().getName());
|
||||
+ } else {
|
||||
+ itemstack.tag = this.tag.copy();
|
||||
+ }
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 22 May 2023 08:21:18 -0500
|
||||
Subject: [PATCH] Allow inventory clicks in Spectator
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 3c0651fa5a5db880202c9a3805a6455269c5f16d..42e61e55ef45935e1f690eefa56bc36842cdd974 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3030,7 +3030,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
if (this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu.stillValid(this.player)) { // CraftBukkit
|
||||
- boolean cancelled = this.player.isSpectator(); // CraftBukkit - see below if
|
||||
+ boolean cancelled = false; //Slice - allow spectator inv management this.player.isSpectator(); // CraftBukkit - see below if
|
||||
if (false/*this.player.isSpectator()*/) { // CraftBukkit
|
||||
this.player.containerMenu.sendAllDataToRemote();
|
||||
} else if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
197
patches/server/0028-Packet-obfuscation-and-reduction.patch
Normal file
197
patches/server/0028-Packet-obfuscation-and-reduction.patch
Normal file
@@ -0,0 +1,197 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 6 Jun 2023 07:51:32 -0500
|
||||
Subject: [PATCH] Packet obfuscation and reduction
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
index 5dfb35117c285e0b202dc9c088ad5848beb8d054..b3d2cbf9f60c4a4b34df20bfe45a80ac23f4570f 100644
|
||||
--- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
@@ -165,15 +165,29 @@ public class SynchedEntityData {
|
||||
}
|
||||
|
||||
public <T> void set(EntityDataAccessor<T> key, T value, boolean force) {
|
||||
+ // Slice start
|
||||
+ this.set(key, value, force, null);
|
||||
+ }
|
||||
+
|
||||
+ public <T> void set(EntityDataAccessor<T> key, T value, @Nullable T foreignValue) {
|
||||
+ this.set(key, value, false, foreignValue);
|
||||
+ }
|
||||
+
|
||||
+ public <T> void set(EntityDataAccessor<T> key, T value, boolean force, @Nullable T foreignValue) { // Slice end
|
||||
SynchedEntityData.DataItem<T> datawatcher_item = this.getItem(key);
|
||||
|
||||
+ // Slice start
|
||||
+ if (foreignValue != null && ObjectUtils.notEqual(foreignValue, datawatcher_item.getForeignValue())) {
|
||||
+ datawatcher_item.setForeignValue(foreignValue);
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
if (force || ObjectUtils.notEqual(value, datawatcher_item.getValue())) {
|
||||
datawatcher_item.setValue(value);
|
||||
this.entity.onSyncedDataUpdated(key);
|
||||
datawatcher_item.setDirty(true);
|
||||
this.isDirty = true;
|
||||
}
|
||||
-
|
||||
}
|
||||
|
||||
// CraftBukkit start - add method from above
|
||||
@@ -215,6 +229,26 @@ public class SynchedEntityData {
|
||||
return list;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ @Nullable
|
||||
+ 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 = new ArrayList();
|
||||
+ }
|
||||
+
|
||||
+ list.add(dataItem.foreignValue != null ? dataItem.foreignValue() : dataItem.value());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return list;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Nullable
|
||||
public List<SynchedEntityData.DataValue<?>> getNonDefaultValues() {
|
||||
List<SynchedEntityData.DataValue<?>> list = null;
|
||||
@@ -336,11 +370,14 @@ public class SynchedEntityData {
|
||||
T value;
|
||||
private final T initialValue;
|
||||
private boolean dirty;
|
||||
+ private @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.foreignDirty = true; //Slice
|
||||
}
|
||||
|
||||
public EntityDataAccessor<T> getAccessor() {
|
||||
@@ -370,6 +407,35 @@ public class SynchedEntityData {
|
||||
public SynchedEntityData.DataValue<T> value() {
|
||||
return SynchedEntityData.DataValue.create(this.accessor, this.value);
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ public SynchedEntityData.DataValue<T> foreignValue() {
|
||||
+ return SynchedEntityData.DataValue.create(this.accessor, this.foreignValue);
|
||||
+ }
|
||||
+
|
||||
+ public void setForeignValue(T foreignValue) {
|
||||
+ this.foreignValue = foreignValue;
|
||||
+ this.foreignDirty = true;
|
||||
+ }
|
||||
+
|
||||
+ public @Nullable T getForeignValue() {
|
||||
+ return foreignValue;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isDirty(boolean foreign) {
|
||||
+ if (foreign) {
|
||||
+ //There must be a foreign value in order for this to be dirty, otherwise we consider this a normal
|
||||
+ //value and check the normal dirty flag.
|
||||
+ return foreignValue == null || this.foreignDirty;
|
||||
+ }
|
||||
+
|
||||
+ return this.dirty;
|
||||
+ }
|
||||
+
|
||||
+ public void setForeignDirty(boolean dirty) {
|
||||
+ this.foreignDirty = dirty;
|
||||
+ }
|
||||
+ // 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 196280f54e397c69d32bd4d1f6ae666efdd93773..a514a1f26e439b5959093488ec9905fec327a404 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -381,7 +381,20 @@ public class ServerEntity {
|
||||
|
||||
if (list != null) {
|
||||
this.trackedDataValues = datawatcher.getNonDefaultValues();
|
||||
- this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), list));
|
||||
+// this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), list));
|
||||
+ // Slice start
|
||||
+ 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.DataValue<?>> dirtyItems = datawatcher.packForeignDirty();
|
||||
+ if (dirtyItems != null) {
|
||||
+ this.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 6d6baa82bb7a67c3f6de4bdb0987e4d1f68b6ec8..b23b6be85496d031b81b2d3abb9690322c340a80 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3272,7 +3272,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());
|
||||
+ this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount(), getMaxAirSupply()); // Slice
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index d0e49ae973a91344f3973dc6e00e7e6c649e87cb..b7c9876eaff4365d136a9af20c1a5845b3094336 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3127,7 +3127,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
public boolean equipmentHasChanged(ItemStack stack, ItemStack stack2) {
|
||||
- return !ItemStack.isSame(stack2, stack);
|
||||
+ return !ItemStack.isSameItem(stack2, stack);
|
||||
}
|
||||
|
||||
private void handleHandSwap(Map<EquipmentSlot, ItemStack> equipmentChanges) {
|
||||
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 38e110a226aac27d86dfe89bc0e9ecaada6ff268..15515e871c89498ec936ab24871741f883f18a3b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -643,7 +643,7 @@ public abstract class Player extends LivingEntity {
|
||||
public void increaseScore(int score) {
|
||||
int j = this.getScore();
|
||||
|
||||
- this.entityData.set(Player.DATA_SCORE_ID, j + score);
|
||||
+ this.entityData.set(Player.DATA_SCORE_ID, j + score, 0); // Slice
|
||||
}
|
||||
|
||||
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 0af1801085701437f06c9ecaf8864fe875e90509..48402f6be39ca1fe65453ca3ab3b995ad33051b0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2593,7 +2593,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
this.sendHealthUpdate();
|
||||
}
|
||||
}
|
||||
- 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();
|
||||
}
|
||||
85
patches/server/0029-Long-distance-tracking.patch
Normal file
85
patches/server/0029-Long-distance-tracking.patch
Normal file
@@ -0,0 +1,85 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 6 Jun 2023 08:14:08 -0500
|
||||
Subject: [PATCH] Long distance tracking
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index e08b72010f22ce680e88f443782bdfe6a46285f9..3809b2125254424d4939794961a9f08254af54c8 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1551,6 +1551,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end - remove allocation of Vec3D here
|
||||
Vec3 vec3d = player.position().subtract(this.entity.position());
|
||||
double d0 = (double) Math.min(this.getEffectiveRange(), io.papermc.paper.chunk.system.ChunkSystem.getSendViewDistance(player) * 16); // Paper - per player view distance
|
||||
+ if (this.entity instanceof ServerPlayer serverPlayer && player.canSeeFromLongDistance(serverPlayer)) d0 = Math.min(level.spigotConfig.flyingPlayerTrackingRange, d0); // Slice
|
||||
double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper
|
||||
double d2 = d0 * d0;
|
||||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index c610111cde3d1cecac661549511742231e1e47c3..069665c210f2c3f8aec8c13c1c0c2ab5c50d3e24 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -279,6 +279,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 boolean hasLongDistanceTracking; // Slice
|
||||
|
||||
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
|
||||
public io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
@@ -2656,4 +2657,18 @@ public class ServerPlayer extends Player {
|
||||
return (CraftPlayer) super.getBukkitEntity();
|
||||
}
|
||||
// CraftBukkit end
|
||||
+
|
||||
+ // Slice start
|
||||
+ public boolean canSeeFromLongDistance(ServerPlayer other) {
|
||||
+ if (hasLongDistanceTracking) return true;
|
||||
+
|
||||
+ CraftPlayer bukkitEntity = other.getBukkitEntity();
|
||||
+ return bukkitEntity.isGliding() || bukkitEntity.isFlying();
|
||||
+ }
|
||||
+
|
||||
+ public boolean canBeSeenLongDistance() {
|
||||
+ CraftPlayer bukkitEntity = getBukkitEntity();
|
||||
+ return bukkitEntity.isGliding() || bukkitEntity.isFlying();
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 5b5109e942b18418b3a3a0e2109fe4ef15045fe5..507519c75fabe8991cddbc1aa7813cec25dee01b 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -271,6 +271,7 @@ public class SpigotWorldConfig
|
||||
}
|
||||
|
||||
public int playerTrackingRange = 48;
|
||||
+ public int flyingPlayerTrackingRange = 64; // Slice
|
||||
public int animalTrackingRange = 48;
|
||||
public int monsterTrackingRange = 48;
|
||||
public int miscTrackingRange = 32;
|
||||
@@ -279,6 +280,7 @@ public class SpigotWorldConfig
|
||||
private void trackingRange()
|
||||
{
|
||||
this.playerTrackingRange = this.getInt( "entity-tracking-range.players", this.playerTrackingRange );
|
||||
+ this.flyingPlayerTrackingRange = this.getInt( "entity-tracking-range.flying-players", this.flyingPlayerTrackingRange ); // Slice
|
||||
this.animalTrackingRange = this.getInt( "entity-tracking-range.animals", this.animalTrackingRange );
|
||||
this.monsterTrackingRange = this.getInt( "entity-tracking-range.monsters", this.monsterTrackingRange );
|
||||
this.miscTrackingRange = this.getInt( "entity-tracking-range.misc", this.miscTrackingRange );
|
||||
diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java
|
||||
index 8fca15099952626ee537f5ce3eefdfaa6518dc1b..1ddf149ce3d962905bec8c4562e4d86fbbe6e570 100644
|
||||
--- a/src/main/java/org/spigotmc/TrackingRange.java
|
||||
+++ b/src/main/java/org/spigotmc/TrackingRange.java
|
||||
@@ -26,9 +26,9 @@ public class TrackingRange
|
||||
return defaultRange;
|
||||
}
|
||||
SpigotWorldConfig config = entity.level().spigotConfig;
|
||||
- if ( entity instanceof ServerPlayer )
|
||||
+ if ( entity instanceof ServerPlayer serverPlayer)
|
||||
{
|
||||
- return config.playerTrackingRange;
|
||||
+ return serverPlayer.canBeSeenLongDistance() ? config.flyingPlayerTrackingRange : config.playerTrackingRange;
|
||||
// Paper start - Simplify and set water mobs to animal tracking range
|
||||
}
|
||||
switch (entity.activationType) {
|
||||
134
patches/server/0030-Shared-Data-Storage.patch
Normal file
134
patches/server/0030-Shared-Data-Storage.patch
Normal file
@@ -0,0 +1,134 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 12 Jun 2023 14:09:36 -0500
|
||||
Subject: [PATCH] Shared Data Storage
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 3bc7230ca62ebe3426da293e436a962bb0134f85..a812bd61e0352023cfd44e62a9cf722616ba4358 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -318,6 +318,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public boolean useDimensionTypeForCustomSpawners = false;
|
||||
public boolean strictAdvancementDimensionCheck = false;
|
||||
public IntOr.Default compressionLevel = IntOr.Default.USE_DEFAULT;
|
||||
+ public String sharedDataFolder = ""; // Slice
|
||||
}
|
||||
|
||||
public BlockUpdates blockUpdates;
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 915340fedc6c0b3d70ee065482dbe621b7c0b0a8..fc6fa65dae66d695b5fd732cc495d3649a28862c 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Splitter;
|
||||
+import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import co.aikar.timings.Timings;
|
||||
import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
|
||||
@@ -310,6 +311,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public volatile Thread shutdownThread; // Paper
|
||||
public volatile boolean abnormalExit = false; // Paper
|
||||
public boolean isIteratingOverLevels = false; // Paper
|
||||
+ public @Nullable DimensionDataStorage sharedDataStorage; // Slice
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
@@ -410,6 +412,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Slice start
|
||||
+ public DimensionDataStorage getMapDataStorage() {
|
||||
+ return sharedDataStorage != null ? sharedDataStorage : overworld().getDataStorage();
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
private void readScoreboard(DimensionDataStorage persistentStateManager) {
|
||||
ServerScoreboard scoreboardserver = this.getScoreboard();
|
||||
|
||||
@@ -885,6 +893,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.isSaving = true;
|
||||
this.getPlayerList().saveAll(); // Diff on change
|
||||
flag3 = this.saveAllChunks(suppressLogs, flush, force);
|
||||
+ if (sharedDataStorage != null) sharedDataStorage.save(); // Slice
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
}
|
||||
@@ -1101,6 +1110,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
throw new IllegalStateException("Failed to initialize server");
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ String sharedDataFolder = io.papermc.paper.configuration.GlobalConfiguration.get().misc.sharedDataFolder;
|
||||
+ if (!Strings.isNullOrEmpty(sharedDataFolder)) {
|
||||
+ File sharedDir = new File(sharedDataFolder);
|
||||
+ sharedDir.mkdirs();
|
||||
+ this.sharedDataStorage = new DimensionDataStorage(sharedDir, fixerUpper);
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
this.nextTickTime = Util.getMillis();
|
||||
this.statusIcon = (ServerStatus.Favicon) this.loadStatusIcon().orElse(null); // CraftBukkit - decompile error
|
||||
this.status = this.buildServerStatus();
|
||||
@@ -1413,6 +1431,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
level.saveIncrementally(fullSave);
|
||||
}
|
||||
}
|
||||
+ if (sharedDataStorage != null) sharedDataStorage.save(); // Slice
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index af0720fb8bd334aac5493121c6373d87421204b4..564591e9f18dd6bb0f76ae4f153adcc0a228d4fa 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2068,7 +2068,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@Override
|
||||
public MapItemSavedData getMapData(String id) {
|
||||
// CraftBukkit start
|
||||
- return (MapItemSavedData) this.getServer().overworld().getDataStorage().get((nbttagcompound) -> {
|
||||
+ return (MapItemSavedData) this.getServer().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;
|
||||
@@ -2082,12 +2082,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);
|
||||
+ this.getServer().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 = this.getServer().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 defe31a5d3aa89a3d18b94f2ff005594e38754b3..637a86e74d633901fdd2f2f1ba6aa4ed49780ead 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()) {
|
||||
202
patches/server/0031-Equipment-Packet-Caching.patch
Normal file
202
patches/server/0031-Equipment-Packet-Caching.patch
Normal file
@@ -0,0 +1,202 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 12 Jun 2023 14:14:48 -0500
|
||||
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..34d74735b7a7d258c6bd14bb7e5406934a208a31 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,15 @@ public class ClientboundSetEquipmentPacket implements Packet<ClientGamePacketLis
|
||||
this.slots = equipmentList;
|
||||
}
|
||||
|
||||
+ 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())));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
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 a514a1f26e439b5959093488ec9905fec327a404..0ac580f3cf8f95025992420702d67ad56db2ba05 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -328,27 +328,8 @@ public class ServerEntity {
|
||||
sender.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()) {
|
||||
- sender.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(sender, player); // Slice
|
||||
}
|
||||
|
||||
// CraftBukkit start - MC-109346: 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 836c007db96b115a0f7a869649e9ed4738920093..b6c320554693d1b55a385c45784feb45d7cac757 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -263,6 +263,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
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() {
|
||||
@@ -3071,6 +3073,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (map != null) {
|
||||
this.handleHandSwap(map);
|
||||
if (!map.isEmpty()) {
|
||||
+ cachedEquipmentMap.clear(); // Slice - Must invalidate cached equipment map if we have changes
|
||||
this.handleEquipmentChanges(map);
|
||||
}
|
||||
}
|
||||
@@ -3163,7 +3166,25 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
});
|
||||
- ((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
|
||||
@@ -4450,4 +4471,74 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
public static record Fallsounds(SoundEvent small, SoundEvent big) {
|
||||
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ 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
|
||||
+
|
||||
+ // Slice start
|
||||
+ public void sendEquipment(java.util.function.Consumer<net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener>> consumer, 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
|
||||
+ consumer.accept(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);
|
||||
+ }
|
||||
+ consumer.accept(equipmentPacket);
|
||||
+ }
|
||||
+
|
||||
+ detectEquipmentUpdates(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
+ }
|
||||
+ }
|
||||
+ // 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 b25f5931f836fd4d8695120f0bcb7c52deff8583..68507518df679a354534a82f32a011727ae7cea0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -1099,4 +1099,14 @@ 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) {
|
||||
+ net.minecraft.server.level.ServerPlayer serverPlayer = ((CraftPlayer) p).getHandle();
|
||||
+ livingEntity.sendEquipment(packet -> serverPlayer.connection.send(packet), serverPlayer);
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
66
patches/server/0032-Add-canDespawn-to-Warden.patch
Normal file
66
patches/server/0032-Add-canDespawn-to-Warden.patch
Normal file
@@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 23 Jun 2023 08:22:19 -0500
|
||||
Subject: [PATCH] Add canDespawn to Warden
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
index 9afc81ccb237c3655d64cdbe8a0db9a4d7791043..286e2ad0887379b5b16ca3ca89a8f0d62be258e7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -588,7 +588,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
}), (entity) -> {
|
||||
entity.load(nbt);
|
||||
}, () -> {
|
||||
- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
||||
+ //EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.toString());
|
||||
});
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
index 97b763431bc5015448ee7a26a340635a932c950b..e8b748eb16d7409a69dbd364a59dcf217ce701ec 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
@@ -110,6 +110,7 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
private final VibrationSystem.User vibrationUser = new Warden.VibrationUser();
|
||||
private VibrationSystem.Data vibrationData = new VibrationSystem.Data();
|
||||
AngerManagement angerManagement = new AngerManagement(this::canTargetEntity, Collections.emptyList());
|
||||
+ public boolean canDespawn; // Slice
|
||||
|
||||
public Warden(EntityType<? extends Monster> type, Level world) {
|
||||
super(type, world);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/WardenAi.java b/src/main/java/net/minecraft/world/entity/monster/warden/WardenAi.java
|
||||
index 03f16a5541de6bc95407aaa24741570c1993dc9e..07600fdd32a058d0e3f9828efdc18f5e76448663 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/warden/WardenAi.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/WardenAi.java
|
||||
@@ -139,7 +139,13 @@ public class WardenAi {
|
||||
|
||||
public static void setDigCooldown(LivingEntity warden) {
|
||||
if (warden.getBrain().hasMemoryValue(MemoryModuleType.DIG_COOLDOWN)) {
|
||||
- warden.getBrain().setMemoryWithExpiry(MemoryModuleType.DIG_COOLDOWN, Unit.INSTANCE, 1200L);
|
||||
+ // Slice start
|
||||
+ if (warden instanceof Warden nmsWarden && !nmsWarden.canDespawn) {
|
||||
+ warden.getBrain().setMemory(MemoryModuleType.DIG_COOLDOWN, Unit.INSTANCE);
|
||||
+ } else {
|
||||
+ warden.getBrain().setMemoryWithExpiry(MemoryModuleType.DIG_COOLDOWN, Unit.INSTANCE, 1200L);
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
|
||||
index 46e3cc146a4b109c4baaf94f42d825646abade68..b248150c047890f45fae75716e40e495752f3732 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
|
||||
@@ -86,4 +86,11 @@ public class CraftWarden extends CraftMonster implements org.bukkit.entity.Warde
|
||||
case ANGRY -> AngerLevel.ANGRY;
|
||||
};
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public void setCanDespawn(boolean canDespawn) {
|
||||
+ this.getHandle().canDespawn = canDespawn;
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
58
patches/server/0033-Save-DimensionDataStorage-async.patch
Normal file
58
patches/server/0033-Save-DimensionDataStorage-async.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 26 Jun 2023 16:45:00 -0500
|
||||
Subject: [PATCH] Save DimensionDataStorage async
|
||||
|
||||
|
||||
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 637a86e74d633901fdd2f2f1ba6aa4ed49780ead..8cf3880d9168b5ba6b383ec921bfb490ea51ac38 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
@@ -9,6 +9,8 @@ import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PushbackInputStream;
|
||||
import java.util.Map;
|
||||
+import java.util.concurrent.CompletableFuture;
|
||||
+import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -18,11 +20,12 @@ import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.util.datafix.DataFixTypes;
|
||||
import net.minecraft.world.level.saveddata.SavedData;
|
||||
+import org.bukkit.Bukkit;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class DimensionDataStorage {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
- public final Map<String, SavedData> cache = Maps.newHashMap();
|
||||
+ public final Map<String, SavedData> cache = new ConcurrentHashMap<>();
|
||||
private final DataFixer fixerUpper;
|
||||
private final File dataFolder;
|
||||
|
||||
@@ -51,7 +54,7 @@ public class DimensionDataStorage {
|
||||
SavedData savedData = this.cache.get(id);
|
||||
if (savedData == null && !this.cache.containsKey(id)) {
|
||||
savedData = this.readSavedData(readFunction, id);
|
||||
- this.cache.put(id, savedData);
|
||||
+ if (savedData != null) this.cache.put(id, savedData);
|
||||
}
|
||||
|
||||
return (T)savedData;
|
||||
@@ -119,11 +122,12 @@ public class DimensionDataStorage {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
- this.cache.forEach((id, state) -> {
|
||||
+ // Slice start - run async
|
||||
+ CompletableFuture.runAsync(() -> this.cache.forEach((id, state) -> {
|
||||
if (state != null) {
|
||||
state.save(this.getDataFile(id));
|
||||
}
|
||||
-
|
||||
- });
|
||||
+ }));
|
||||
+ // Slice end
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 22 Aug 2023 06:22:16 -0500
|
||||
Subject: [PATCH] Add reason to PlayerConnectionCloseEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 2ff578e4a953ffcf5176815ba8e3f06f73499989..f9a1b0e3be862cc00370c130621a07be5deebf0c 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -193,6 +193,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
|
||||
this.connection.send(new ClientboundDisconnectPacket(ichatmutablecomponent));
|
||||
this.connection.disconnect(ichatmutablecomponent);
|
||||
+ new com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent(this.gameProfile.getId(), this.gameProfile.getName(), ((java.net.InetSocketAddress)this.connection.address).getAddress(), com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent.ConnectionCloseReason.INVALID_PLAYER_DATA, false).callEvent(); // Slice
|
||||
}
|
||||
}
|
||||
|
||||
314
patches/server/0035-Disable-feature-generation.patch
Normal file
314
patches/server/0035-Disable-feature-generation.patch
Normal file
@@ -0,0 +1,314 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 26 Aug 2023 07:39:46 -0500
|
||||
Subject: [PATCH] Disable feature generation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java
|
||||
index f945fae50983424091b58f83ed14f2e8f2621619..b4c16e355ebadf06b9405c06e2b598e7a478f6ab 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java
|
||||
@@ -33,139 +33,5 @@ public class GeodeFeature extends Feature<GeodeConfiguration> {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean place(FeaturePlaceContext<GeodeConfiguration> context) {
|
||||
- GeodeConfiguration geodeConfiguration = context.config();
|
||||
- RandomSource randomSource = context.random();
|
||||
- BlockPos blockPos = context.origin();
|
||||
- WorldGenLevel worldGenLevel = context.level();
|
||||
- int i = geodeConfiguration.minGenOffset;
|
||||
- int j = geodeConfiguration.maxGenOffset;
|
||||
- List<Pair<BlockPos, Integer>> list = Lists.newLinkedList();
|
||||
- int k = geodeConfiguration.distributionPoints.sample(randomSource);
|
||||
- WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(worldGenLevel.getSeed()));
|
||||
- NormalNoise normalNoise = NormalNoise.create(worldgenRandom, -4, 1.0D);
|
||||
- List<BlockPos> list2 = Lists.newLinkedList();
|
||||
- double d = (double)k / (double)geodeConfiguration.outerWallDistance.getMaxValue();
|
||||
- GeodeLayerSettings geodeLayerSettings = geodeConfiguration.geodeLayerSettings;
|
||||
- GeodeBlockSettings geodeBlockSettings = geodeConfiguration.geodeBlockSettings;
|
||||
- GeodeCrackSettings geodeCrackSettings = geodeConfiguration.geodeCrackSettings;
|
||||
- double e = 1.0D / Math.sqrt(geodeLayerSettings.filling);
|
||||
- double f = 1.0D / Math.sqrt(geodeLayerSettings.innerLayer + d);
|
||||
- double g = 1.0D / Math.sqrt(geodeLayerSettings.middleLayer + d);
|
||||
- double h = 1.0D / Math.sqrt(geodeLayerSettings.outerLayer + d);
|
||||
- double l = 1.0D / Math.sqrt(geodeCrackSettings.baseCrackSize + randomSource.nextDouble() / 2.0D + (k > 3 ? d : 0.0D));
|
||||
- boolean bl = (double)randomSource.nextFloat() < geodeCrackSettings.generateCrackChance;
|
||||
- int m = 0;
|
||||
-
|
||||
- for(int n = 0; n < k; ++n) {
|
||||
- int o = geodeConfiguration.outerWallDistance.sample(randomSource);
|
||||
- int p = geodeConfiguration.outerWallDistance.sample(randomSource);
|
||||
- int q = geodeConfiguration.outerWallDistance.sample(randomSource);
|
||||
- BlockPos blockPos2 = blockPos.offset(o, p, q);
|
||||
- BlockState blockState = worldGenLevel.getBlockState(blockPos2);
|
||||
- if (blockState.isAir() || blockState.is(BlockTags.GEODE_INVALID_BLOCKS)) {
|
||||
- ++m;
|
||||
- if (m > geodeConfiguration.invalidBlocksThreshold) {
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- list.add(Pair.of(blockPos2, geodeConfiguration.pointOffset.sample(randomSource)));
|
||||
- }
|
||||
-
|
||||
- if (bl) {
|
||||
- int r = randomSource.nextInt(4);
|
||||
- int s = k * 2 + 1;
|
||||
- if (r == 0) {
|
||||
- list2.add(blockPos.offset(s, 7, 0));
|
||||
- list2.add(blockPos.offset(s, 5, 0));
|
||||
- list2.add(blockPos.offset(s, 1, 0));
|
||||
- } else if (r == 1) {
|
||||
- list2.add(blockPos.offset(0, 7, s));
|
||||
- list2.add(blockPos.offset(0, 5, s));
|
||||
- list2.add(blockPos.offset(0, 1, s));
|
||||
- } else if (r == 2) {
|
||||
- list2.add(blockPos.offset(s, 7, s));
|
||||
- list2.add(blockPos.offset(s, 5, s));
|
||||
- list2.add(blockPos.offset(s, 1, s));
|
||||
- } else {
|
||||
- list2.add(blockPos.offset(0, 7, 0));
|
||||
- list2.add(blockPos.offset(0, 5, 0));
|
||||
- list2.add(blockPos.offset(0, 1, 0));
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- List<BlockPos> list3 = Lists.newArrayList();
|
||||
- Predicate<BlockState> predicate = isReplaceable(geodeConfiguration.geodeBlockSettings.cannotReplace);
|
||||
-
|
||||
- for(BlockPos blockPos3 : BlockPos.betweenClosed(blockPos.offset(i, i, i), blockPos.offset(j, j, j))) {
|
||||
- double t = normalNoise.getValue((double)blockPos3.getX(), (double)blockPos3.getY(), (double)blockPos3.getZ()) * geodeConfiguration.noiseMultiplier;
|
||||
- double u = 0.0D;
|
||||
- double v = 0.0D;
|
||||
-
|
||||
- for(Pair<BlockPos, Integer> pair : list) {
|
||||
- u += Mth.invSqrt(blockPos3.distSqr(pair.getFirst()) + (double)pair.getSecond().intValue()) + t;
|
||||
- }
|
||||
-
|
||||
- for(BlockPos blockPos4 : list2) {
|
||||
- v += Mth.invSqrt(blockPos3.distSqr(blockPos4) + (double)geodeCrackSettings.crackPointOffset) + t;
|
||||
- }
|
||||
-
|
||||
- if (!(u < h)) {
|
||||
- if (bl && v >= l && u < e) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, Blocks.AIR.defaultBlockState(), predicate);
|
||||
-
|
||||
- for(Direction direction : DIRECTIONS) {
|
||||
- BlockPos blockPos5 = blockPos3.relative(direction);
|
||||
- FluidState fluidState = worldGenLevel.getFluidState(blockPos5);
|
||||
- if (!fluidState.isEmpty()) {
|
||||
- worldGenLevel.scheduleTick(blockPos5, fluidState.getType(), 0);
|
||||
- }
|
||||
- }
|
||||
- } else if (u >= e) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, geodeBlockSettings.fillingProvider.getState(randomSource, blockPos3), predicate);
|
||||
- } else if (u >= f) {
|
||||
- boolean bl2 = (double)randomSource.nextFloat() < geodeConfiguration.useAlternateLayer0Chance;
|
||||
- if (bl2) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, geodeBlockSettings.alternateInnerLayerProvider.getState(randomSource, blockPos3), predicate);
|
||||
- } else {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, geodeBlockSettings.innerLayerProvider.getState(randomSource, blockPos3), predicate);
|
||||
- }
|
||||
-
|
||||
- if ((!geodeConfiguration.placementsRequireLayer0Alternate || bl2) && (double)randomSource.nextFloat() < geodeConfiguration.usePotentialPlacementsChance) {
|
||||
- list3.add(blockPos3.immutable());
|
||||
- }
|
||||
- } else if (u >= g) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, geodeBlockSettings.middleLayerProvider.getState(randomSource, blockPos3), predicate);
|
||||
- } else if (u >= h) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, geodeBlockSettings.outerLayerProvider.getState(randomSource, blockPos3), predicate);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- List<BlockState> list4 = geodeBlockSettings.innerPlacements;
|
||||
-
|
||||
- for(BlockPos blockPos6 : list3) {
|
||||
- BlockState blockState2 = Util.getRandom(list4, randomSource);
|
||||
-
|
||||
- for(Direction direction2 : DIRECTIONS) {
|
||||
- if (blockState2.hasProperty(BlockStateProperties.FACING)) {
|
||||
- blockState2 = blockState2.setValue(BlockStateProperties.FACING, direction2);
|
||||
- }
|
||||
-
|
||||
- BlockPos blockPos7 = blockPos6.relative(direction2);
|
||||
- BlockState blockState3 = worldGenLevel.getBlockState(blockPos7);
|
||||
- if (blockState2.hasProperty(BlockStateProperties.WATERLOGGED)) {
|
||||
- blockState2 = blockState2.setValue(BlockStateProperties.WATERLOGGED, Boolean.valueOf(blockState3.getFluidState().isSource()));
|
||||
- }
|
||||
-
|
||||
- if (BuddingAmethystBlock.canClusterGrowAtState(blockState3)) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos7, blockState2, predicate);
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return true;
|
||||
- }
|
||||
+ public boolean place(FeaturePlaceContext<GeodeConfiguration> context) {return false;}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java
|
||||
index 3c474c8fc937df5aebfb063be8109053a91e8bb4..2a36bba04d584fdccbb06dc4991064a245082991 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java
|
||||
@@ -30,103 +30,7 @@ public class MonsterRoomFeature extends Feature<NoneFeatureConfiguration> {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> context) {
|
||||
- Predicate<BlockState> predicate = Feature.isReplaceable(BlockTags.FEATURES_CANNOT_REPLACE);
|
||||
- BlockPos blockPos = context.origin();
|
||||
- RandomSource randomSource = context.random();
|
||||
- WorldGenLevel worldGenLevel = context.level();
|
||||
- int i = 3;
|
||||
- int j = randomSource.nextInt(2) + 2;
|
||||
- int k = -j - 1;
|
||||
- int l = j + 1;
|
||||
- int m = -1;
|
||||
- int n = 4;
|
||||
- int o = randomSource.nextInt(2) + 2;
|
||||
- int p = -o - 1;
|
||||
- int q = o + 1;
|
||||
- int r = 0;
|
||||
-
|
||||
- for(int s = k; s <= l; ++s) {
|
||||
- for(int t = -1; t <= 4; ++t) {
|
||||
- for(int u = p; u <= q; ++u) {
|
||||
- BlockPos blockPos2 = blockPos.offset(s, t, u);
|
||||
- boolean bl = worldGenLevel.getBlockState(blockPos2).isSolid();
|
||||
- if (t == -1 && !bl) {
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- if (t == 4 && !bl) {
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- if ((s == k || s == l || u == p || u == q) && t == 0 && worldGenLevel.isEmptyBlock(blockPos2) && worldGenLevel.isEmptyBlock(blockPos2.above())) {
|
||||
- ++r;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (r >= 1 && r <= 5) {
|
||||
- for(int v = k; v <= l; ++v) {
|
||||
- for(int w = 3; w >= -1; --w) {
|
||||
- for(int x = p; x <= q; ++x) {
|
||||
- BlockPos blockPos3 = blockPos.offset(v, w, x);
|
||||
- BlockState blockState = worldGenLevel.getBlockState(blockPos3);
|
||||
- if (v != k && w != -1 && x != p && v != l && w != 4 && x != q) {
|
||||
- if (!blockState.is(Blocks.CHEST) && !blockState.is(Blocks.SPAWNER)) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, AIR, predicate);
|
||||
- }
|
||||
- } else if (blockPos3.getY() >= worldGenLevel.getMinBuildHeight() && !worldGenLevel.getBlockState(blockPos3.below()).isSolid()) {
|
||||
- worldGenLevel.setBlock(blockPos3, AIR, 2);
|
||||
- } else if (blockState.isSolid() && !blockState.is(Blocks.CHEST)) {
|
||||
- if (w == -1 && randomSource.nextInt(4) != 0) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, Blocks.MOSSY_COBBLESTONE.defaultBlockState(), predicate);
|
||||
- } else {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, Blocks.COBBLESTONE.defaultBlockState(), predicate);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- for(int y = 0; y < 2; ++y) {
|
||||
- for(int z = 0; z < 3; ++z) {
|
||||
- int aa = blockPos.getX() + randomSource.nextInt(j * 2 + 1) - j;
|
||||
- int ab = blockPos.getY();
|
||||
- int ac = blockPos.getZ() + randomSource.nextInt(o * 2 + 1) - o;
|
||||
- BlockPos blockPos4 = new BlockPos(aa, ab, ac);
|
||||
- if (worldGenLevel.isEmptyBlock(blockPos4)) {
|
||||
- int ad = 0;
|
||||
-
|
||||
- for(Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
- if (worldGenLevel.getBlockState(blockPos4.relative(direction)).isSolid()) {
|
||||
- ++ad;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (ad == 1) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos4, StructurePiece.reorient(worldGenLevel, blockPos4, Blocks.CHEST.defaultBlockState()), predicate);
|
||||
- RandomizableContainerBlockEntity.setLootTable(worldGenLevel, randomSource, blockPos4, BuiltInLootTables.SIMPLE_DUNGEON);
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- this.safeSetBlock(worldGenLevel, blockPos, Blocks.SPAWNER.defaultBlockState(), predicate);
|
||||
- BlockEntity blockEntity = worldGenLevel.getBlockEntity(blockPos);
|
||||
- if (blockEntity instanceof SpawnerBlockEntity) {
|
||||
- SpawnerBlockEntity spawnerBlockEntity = (SpawnerBlockEntity)blockEntity;
|
||||
- spawnerBlockEntity.setEntityId(this.randomEntityId(randomSource), randomSource);
|
||||
- } else {
|
||||
- LOGGER.error("Failed to fetch mob spawner entity at ({}, {}, {})", blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
- }
|
||||
-
|
||||
- return true;
|
||||
- } else {
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
+ public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> context) {return false;}
|
||||
|
||||
private EntityType<?> randomEntityId(RandomSource random) {
|
||||
return Util.getRandom(MOBS, random);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/SculkPatchFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/SculkPatchFeature.java
|
||||
index f5aea54f81dcd3072e36ddf3c4c6ded848c2c540..1539a644d89b2fee67a5534870ca177b4992409d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/SculkPatchFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SculkPatchFeature.java
|
||||
@@ -19,48 +19,7 @@ public class SculkPatchFeature extends Feature<SculkPatchConfiguration> {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean place(FeaturePlaceContext<SculkPatchConfiguration> context) {
|
||||
- WorldGenLevel worldGenLevel = context.level();
|
||||
- BlockPos blockPos = context.origin();
|
||||
- if (!this.canSpreadFrom(worldGenLevel, blockPos)) {
|
||||
- return false;
|
||||
- } else {
|
||||
- SculkPatchConfiguration sculkPatchConfiguration = context.config();
|
||||
- RandomSource randomSource = context.random();
|
||||
- SculkSpreader sculkSpreader = SculkSpreader.createWorldGenSpreader();
|
||||
- int i = sculkPatchConfiguration.spreadRounds() + sculkPatchConfiguration.growthRounds();
|
||||
-
|
||||
- for(int j = 0; j < i; ++j) {
|
||||
- for(int k = 0; k < sculkPatchConfiguration.chargeCount(); ++k) {
|
||||
- sculkSpreader.addCursors(blockPos, sculkPatchConfiguration.amountPerCharge());
|
||||
- }
|
||||
-
|
||||
- boolean bl = j < sculkPatchConfiguration.spreadRounds();
|
||||
-
|
||||
- for(int l = 0; l < sculkPatchConfiguration.spreadAttempts(); ++l) {
|
||||
- sculkSpreader.updateCursors(worldGenLevel, blockPos, randomSource, bl);
|
||||
- }
|
||||
-
|
||||
- sculkSpreader.clear();
|
||||
- }
|
||||
-
|
||||
- BlockPos blockPos2 = blockPos.below();
|
||||
- if (randomSource.nextFloat() <= sculkPatchConfiguration.catalystChance() && worldGenLevel.getBlockState(blockPos2).isCollisionShapeFullBlock(worldGenLevel, blockPos2)) {
|
||||
- worldGenLevel.setBlock(blockPos, Blocks.SCULK_CATALYST.defaultBlockState(), 3);
|
||||
- }
|
||||
-
|
||||
- int m = sculkPatchConfiguration.extraRareGrowths().sample(randomSource);
|
||||
-
|
||||
- for(int n = 0; n < m; ++n) {
|
||||
- BlockPos blockPos3 = blockPos.offset(randomSource.nextInt(5) - 2, 0, randomSource.nextInt(5) - 2);
|
||||
- if (worldGenLevel.getBlockState(blockPos3).isAir() && worldGenLevel.getBlockState(blockPos3.below()).isFaceSturdy(worldGenLevel, blockPos3.below(), Direction.UP)) {
|
||||
- worldGenLevel.setBlock(blockPos3, Blocks.SCULK_SHRIEKER.defaultBlockState().setValue(SculkShriekerBlock.CAN_SUMMON, Boolean.valueOf(true)), 3);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return true;
|
||||
- }
|
||||
- }
|
||||
+ public boolean place(FeaturePlaceContext<SculkPatchConfiguration> context) { return false; }
|
||||
|
||||
private boolean canSpreadFrom(LevelAccessor world, BlockPos pos) {
|
||||
BlockState blockState = world.getBlockState(pos);
|
||||
27
patches/server/0036-Biome-freeze-override.patch
Normal file
27
patches/server/0036-Biome-freeze-override.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 29 Aug 2023 09:23:11 -0500
|
||||
Subject: [PATCH] Biome freeze override
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
|
||||
index 65012a12e1430956ef55ced56773e6354ac26444..0178017cb2d871dd344e3da910ee724cac05d7e5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
|
||||
@@ -76,6 +76,7 @@ public final class Biome {
|
||||
return long2FloatLinkedOpenHashMap;
|
||||
});
|
||||
});
|
||||
+ public Boolean canFreeze = null; // Slice
|
||||
|
||||
Biome(Biome.ClimateSettings weather, BiomeSpecialEffects effects, BiomeGenerationSettings generationSettings, MobSpawnSettings spawnSettings) {
|
||||
this.climateSettings = weather;
|
||||
@@ -138,6 +139,8 @@ public final class Biome {
|
||||
}
|
||||
|
||||
public boolean shouldFreeze(LevelReader world, BlockPos pos, boolean doWaterCheck) {
|
||||
+ if (canFreeze != null) return canFreeze; // Slice
|
||||
+
|
||||
if (this.warmEnoughToRain(pos)) {
|
||||
return false;
|
||||
} else {
|
||||
19
patches/server/0037-Change-KeepAlive-interval.patch
Normal file
19
patches/server/0037-Change-KeepAlive-interval.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 3 Oct 2023 09:18:59 -0500
|
||||
Subject: [PATCH] Change KeepAlive interval
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 42e61e55ef45935e1f690eefa56bc36842cdd974..049c1417968d89ba7b6208339e4a812bc72e007b 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -409,7 +409,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
this.disconnect(Component.translatable("disconnect.timeout", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
|
||||
}
|
||||
} else {
|
||||
- if (elapsedTime >= 15000L) { // 15 seconds
|
||||
+ if (elapsedTime >= 5000L) { // 15 seconds // Slice -> 5s
|
||||
this.keepAlivePending = true;
|
||||
this.keepAliveTime = currentTime;
|
||||
this.keepAliveChallenge = currentTime;
|
||||
61
patches/server/0038-Non-saveable-entities.patch
Normal file
61
patches/server/0038-Non-saveable-entities.patch
Normal file
@@ -0,0 +1,61 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 21 Oct 2023 11:27:52 -0500
|
||||
Subject: [PATCH] Non-saveable entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
index 7e8dc9e8f381abfdcce2746edc93122d623622d1..303e5ed4d5cf2a64b998656bfd189f19f8c8fcde 100644
|
||||
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
@@ -118,7 +118,7 @@ public final class ChunkEntitySlices {
|
||||
// removed by us below
|
||||
continue;
|
||||
}
|
||||
- if (entity.shouldBeSaved()) {
|
||||
+ if (entity.shouldBeSaved() || !entity.saveable) { // Slice
|
||||
entity.setRemoved(Entity.RemovalReason.UNLOADED_TO_CHUNK);
|
||||
if (entity.isVehicle()) {
|
||||
// we cannot assume that these entities are contained within this chunk, because entities can
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index b23b6be85496d031b81b2d3abb9690322c340a80..eb2ef004860c89fba346c8025ae3c645106a21e6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -418,6 +418,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
|
||||
public boolean collidingWithWorldBorder; // Paper
|
||||
public boolean fixedPose = false; // Paper
|
||||
+ public boolean saveable = true; // Slice
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
this.origin = location.toVector();
|
||||
@@ -4703,7 +4704,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
@Override
|
||||
public boolean shouldBeSaved() {
|
||||
- return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.isPassenger() ? false : !this.isVehicle() || !this.hasAnyPlayerPassengers()); // Paper - rewrite chunk system - it should check if the entity has ANY player passengers
|
||||
+ return this.saveable && this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.isPassenger() ? false : !this.isVehicle() || !this.hasAnyPlayerPassengers()); // Paper - rewrite chunk system - it should check if the entity has ANY player passengers // Slice - add saveable check
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 2dbe8b870fd39b4d22e9725912f443757ae70761..0cc2d78c68c87c7dce3fbd40f5ba946d7776daa0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1507,4 +1507,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return this.getHandle().getScoreboardName();
|
||||
}
|
||||
// Paper end - entity scoreboard name
|
||||
+
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public boolean isSaveable() {
|
||||
+ return this.entity.saveable;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSaveable(boolean saveable) {
|
||||
+ this.entity.saveable = saveable;
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
24
patches/server/0039-ChunkStatusChangeEvent.patch
Normal file
24
patches/server/0039-ChunkStatusChangeEvent.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 22 Oct 2023 08:41:08 -0500
|
||||
Subject: [PATCH] ChunkStatusChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
||||
index 51304c5cf4b0ac7646693ef97ef4a3847d3342b5..21976eeda150d3d7e396ebabdf6416dd65560dbd 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
||||
@@ -1324,6 +1324,13 @@ public final class NewChunkHolder {
|
||||
// chunks cannot downgrade state while status is pending a change
|
||||
final LevelChunk chunk = (LevelChunk)this.currentChunk;
|
||||
|
||||
+ // Slice start
|
||||
+ new com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent(new org.bukkit.craftbukkit.CraftChunk(chunk),
|
||||
+ com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(currState.name()),
|
||||
+ com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(nextState.name()))
|
||||
+ .callEvent();
|
||||
+ // Slice end
|
||||
+
|
||||
// Note: we assume that only load/unload contain plugin logic
|
||||
// plugin logic is anything stupid enough to possibly change the chunk status while it is already
|
||||
// being changed (i.e during load it is possible it will try to set to full ticking)
|
||||
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 25 Oct 2023 17:05:29 -0500
|
||||
Subject: [PATCH] Disable sending Entity Movement Packets
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 0ac580f3cf8f95025992420702d67ad56db2ba05..676427c69ab445cef3a81628ed34cb6d4f018e8e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -148,7 +148,7 @@ public class ServerEntity {
|
||||
boolean flag = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1;
|
||||
|
||||
if (flag) {
|
||||
- this.broadcast.accept(new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte) i, (byte) j, this.entity.onGround()));
|
||||
+ if (entity.sendMovementPackets) this.broadcast.accept(new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte) i, (byte) j, this.entity.onGround())); // Slice
|
||||
this.yRotp = i;
|
||||
this.xRotp = j;
|
||||
}
|
||||
@@ -183,14 +183,14 @@ public class ServerEntity {
|
||||
if (!flag6 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.onGround()&& !(io.papermc.paper.configuration.GlobalConfiguration.get().collisions.sendFullPosForHardCollidingEntities && this.entity.hardCollides())) { // Paper - send full pos for hard colliding entities to prevent collision problems due to desync
|
||||
if ((!flag2 || !flag3) && !(this.entity instanceof AbstractArrow)) {
|
||||
if (flag2) {
|
||||
- packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.onGround());
|
||||
+ if (entity.sendMovementPackets) packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.onGround()); // Slice
|
||||
flag4 = true;
|
||||
} else if (flag3) {
|
||||
- packet1 = new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte) i, (byte) j, this.entity.onGround());
|
||||
+ if (entity.sendMovementPackets) packet1 = new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte) i, (byte) j, this.entity.onGround()); // Slice
|
||||
flag5 = true;
|
||||
}
|
||||
} else {
|
||||
- packet1 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), (byte) i, (byte) j, this.entity.onGround());
|
||||
+ if (entity.sendMovementPackets) packet1 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), (byte) i, (byte) j, this.entity.onGround()); // Slice
|
||||
flag4 = true;
|
||||
flag5 = true;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index eb2ef004860c89fba346c8025ae3c645106a21e6..c955bbc0348dad7ffd4bcc3a5fa17f0de6f1aed6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -419,6 +419,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public boolean collidingWithWorldBorder; // Paper
|
||||
public boolean fixedPose = false; // Paper
|
||||
public boolean saveable = true; // Slice
|
||||
+ public boolean sendMovementPackets = true; // Slice
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
this.origin = location.toVector();
|
||||
45
patches/server/0041-Player-spawnsOwnMobs.patch
Normal file
45
patches/server/0041-Player-spawnsOwnMobs.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 7 Dec 2023 08:48:41 -0600
|
||||
Subject: [PATCH] Player spawnsOwnMobs
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index acbcdc8cb1523044b1657e03a141fae6389a3686..000a2c8d30d7d72a460e2fc6205088b81a8bfe3a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -521,7 +521,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
// Paper start - optimize isOutisdeRange
|
||||
ChunkMap playerChunkMap = this.chunkMap;
|
||||
for (ServerPlayer player : this.level.players) {
|
||||
- if (!player.affectsSpawning || player.isSpectator()) {
|
||||
+ if (!player.affectsSpawning || player.isSpectator() || player.spawnsOwnMobs) { // Slice
|
||||
playerChunkMap.playerMobSpawnMap.remove(player);
|
||||
continue;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 564591e9f18dd6bb0f76ae4f153adcc0a228d4fa..578535732d442b524536bdd76d6a4badeed84fbd 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -770,7 +770,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// Paper start - optimise checkDespawn
|
||||
this.playersAffectingSpawning.clear();
|
||||
for (ServerPlayer player : this.players) {
|
||||
- if (net.minecraft.world.entity.EntitySelector.PLAYER_AFFECTS_SPAWNING.test(player)) {
|
||||
+ if (!player.spawnsOwnMobs && net.minecraft.world.entity.EntitySelector.PLAYER_AFFECTS_SPAWNING.test(player)) { // Slice
|
||||
this.playersAffectingSpawning.add(player);
|
||||
}
|
||||
}
|
||||
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 15515e871c89498ec936ab24871741f883f18a3b..16fbdbe12d54fbc8d54403979ee2a89322a14dd2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -188,6 +188,8 @@ public abstract class Player extends LivingEntity {
|
||||
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET;
|
||||
// Paper end
|
||||
|
||||
+ public boolean spawnsOwnMobs = false; // Slice
|
||||
+
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
public int oldLevel = -1;
|
||||
42
patches/server/0042-Set-location-on-a-Custom-Inventory.patch
Normal file
42
patches/server/0042-Set-location-on-a-Custom-Inventory.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 8 Dec 2023 08:02:07 -0600
|
||||
Subject: [PATCH] Set location on a Custom Inventory
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||
index da1c1fe0faf6819b15a81d6ad53370948e5f984f..84eff85e98484c9701e203bb1fa61435ee88bab4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||
@@ -69,6 +69,14 @@ public class CraftInventoryCustom extends CraftInventory {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Slice start
|
||||
+ public void setLocation(Location location) {
|
||||
+ if (this.inventory instanceof MinecraftInventory minecraftInventory) {
|
||||
+ minecraftInventory.location = location;
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
static class MinecraftInventory implements Container {
|
||||
private final NonNullList<ItemStack> items;
|
||||
private int maxStack = MAX_STACK;
|
||||
@@ -77,6 +85,7 @@ public class CraftInventoryCustom extends CraftInventory {
|
||||
private final net.kyori.adventure.text.Component adventure$title; // Paper
|
||||
private InventoryType type;
|
||||
private final InventoryHolder owner;
|
||||
+ private Location location; // Slice
|
||||
|
||||
// Paper start
|
||||
public MinecraftInventory(InventoryHolder owner, InventoryType type, net.kyori.adventure.text.Component title) {
|
||||
@@ -239,7 +248,7 @@ public class CraftInventoryCustom extends CraftInventory {
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
- return null;
|
||||
+ return location;
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -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