├── .gitignore ├── LICENSE ├── README.md ├── build-data └── dev-imports.txt ├── build.gradle.kts ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── patches ├── api │ ├── 0001-Add-BlockDestroyedByNeighborEvent.patch │ ├── 0002-Add-provided-Material-to-getDrops.patch │ ├── 0003-Add-Player-to-SpongeAbsorbEvent.patch │ ├── 0004-Add-World-Instance-flag.patch │ ├── 0005-Smooth-Teleports.patch │ ├── 0006-Add-Force-Crit-to-PlayerPreAttackEntityEvent.patch │ ├── 0007-Add-reason-to-PlayerConnectionCloseEvent.patch │ ├── 0008-ChunkStatusChangeEvent.patch │ ├── 0009-Equipment-Packet-Caching.patch │ ├── 0010-Add-Vanish.patch │ ├── 0011-Add-ObjectId.patch │ ├── 0012-Add-PlayerLoadStatsEvent-Fix-patch.patch │ ├── 0013-Expose-getBlockPosBelowThatAffectsMyMovement.patch │ ├── 0014-Add-DimensionDataStorageEvents.patch │ ├── 0015-Add-PlayerData-Events.patch │ ├── 0016-Non-saveable-entities.patch │ ├── 0017-Map-Events.patch │ ├── 0018-PlayerInsertBundleItemEvent.patch │ └── 0019-Add-PlayerPreRespawnEvent.patch └── server │ ├── 0001-Build-changes.patch │ ├── 0002-Add-BlockDestroyedByNeighborEvent.patch │ ├── 0003-Add-provided-Material-to-getDrops.patch │ ├── 0004-Add-Player-to-SpongeAbsorbEvent.patch │ ├── 0005-Add-World-Instance-flag.patch │ ├── 0006-Smooth-Teleports.patch │ ├── 0007-Allow-opening-covered-chests.patch │ ├── 0008-Add-Force-Crit-to-PlayerPreAttackEntityEvent.patch │ ├── 0009-Allow-access-to-LightEngine.patch │ ├── 0010-Don-t-send-fire-packets-if-player-has-FR.patch │ ├── 0011-Allow-inventory-clicks-in-Spectator.patch │ ├── 0012-Add-reason-to-PlayerConnectionCloseEvent.patch │ ├── 0013-Change-KeepAlive-interval.patch │ ├── 0014-Equipment-Packet-Caching.patch │ ├── 0015-Add-ChunkStatusChangeEvent.patch │ ├── 0016-Biome-freeze-override.patch │ ├── 0017-Add-Vanish.patch │ ├── 0018-Add-jackson.patch │ ├── 0019-Add-ObjectId.patch │ ├── 0020-Packet-obfuscation-and-reduction.patch │ ├── 0021-Add-PlayerLoadStatsEvent-Fix-patch.patch │ ├── 0022-Expose-getBlockPosBelowThatAffectsMyMovement.patch │ ├── 0023-Add-DimensionDataStorageEvents.patch │ ├── 0024-Add-PlayerData-Events.patch │ ├── 0025-Non-saveable-entities.patch │ ├── 0026-Map-Events.patch │ ├── 0027-PlayerInsertBundleItemEvent.patch │ ├── 0028-Mute-bee-logger-warn.patch │ ├── 0029-Add-PlayerPreRespawnEvent.patch │ ├── 0030-Fix-authorless-book-loading.patch │ └── 0031-noEntityCollisions-for-Entity.patch └── settings.gradle.kts /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /build/ 3 | .idea 4 | run 5 | slice-api 6 | slice-server 7 | paper-api-generator 8 | 9 | # Ignore Gradle GUI config 10 | gradle-app.setting 11 | 12 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 13 | !gradle-wrapper.jar 14 | 15 | # Cache of project 16 | .gradletasknamecache 17 | 18 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 19 | # gradle/wrapper/gradle-wrapper.properties 20 | /commit.sh 21 | /publish.sh 22 | /slice-api/ 23 | /slice-server/ 24 | /generated/ 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Tom Miller 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Slice 2 | Loka Minecraft's Paper Fork 3 | -------------------------------------------------------------------------------- /build-data/dev-imports.txt: -------------------------------------------------------------------------------- 1 | # You can use this file to import files from minecraft libraries into the project 2 | # format: 3 | # 4 | # both fully qualified and a file based syntax are accepted for : 5 | # authlib com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java 6 | # datafixerupper com.mojang.datafixers.DataFixerBuilder 7 | # datafixerupper com/mojang/datafixers/util/Either.java 8 | # To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId: 9 | # minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter 10 | # minecraft net/minecraft/world/level/entity/LevelEntityGetter.java 11 | # To import minecraft data files, like the default chat type, use `mc_data` as the prefix: 12 | # mc_data chat_type/chat.json 13 | # mc_data dimension_type/overworld.json 14 | # -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | import io.papermc.paperweight.util.constants.* 2 | 3 | plugins { 4 | java 5 | `maven-publish` 6 | id("com.github.johnrengelman.shadow") version "8.1.1" apply false 7 | id("io.papermc.paperweight.patcher") version "1.7.4" 8 | } 9 | 10 | val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" 11 | 12 | repositories { 13 | mavenCentral() 14 | maven(paperMavenPublicUrl) { 15 | content { onlyForConfigurations(configurations.paperclip.name) } 16 | } 17 | } 18 | 19 | dependencies { 20 | remapper("net.fabricmc:tiny-remapper:0.10.3:fat") // Must be kept in sync with upstream 21 | decompiler("org.vineflower:vineflower:1.10.1") // Must be kept in sync with upstream 22 | paperclip("io.papermc:paperclip:3.0.3") // You probably want this to be kept in sync with upstream 23 | } 24 | 25 | allprojects { 26 | apply(plugin = "java") 27 | apply(plugin = "maven-publish") 28 | 29 | java { 30 | toolchain { 31 | languageVersion.set(JavaLanguageVersion.of(21)) 32 | } 33 | } 34 | } 35 | 36 | subprojects { 37 | tasks.withType { 38 | options.encoding = Charsets.UTF_8.name() 39 | options.release.set(21) 40 | } 41 | tasks.withType { 42 | options.encoding = Charsets.UTF_8.name() 43 | } 44 | tasks.withType { 45 | filteringCharset = Charsets.UTF_8.name() 46 | } 47 | 48 | repositories { 49 | mavenCentral() 50 | maven(paperMavenPublicUrl) 51 | } 52 | } 53 | 54 | paperweight { 55 | serverProject.set(project(":slice-server")) 56 | 57 | remapRepo.set(paperMavenPublicUrl) 58 | decompileRepo.set(paperMavenPublicUrl) 59 | 60 | usePaperUpstream(providers.gradleProperty("paperRef")) { 61 | withPaperPatcher { 62 | apiPatchDir.set(layout.projectDirectory.dir("patches/api")) 63 | apiOutputDir.set(layout.projectDirectory.dir("slice-api")) 64 | 65 | serverPatchDir.set(layout.projectDirectory.dir("patches/server")) 66 | serverOutputDir.set(layout.projectDirectory.dir("slice-server")) 67 | } 68 | 69 | patchTasks { 70 | register("generatedApi") { 71 | isBareDirectory.set(true) 72 | upstreamDirPath.set("paper-api-generator/generated") 73 | patchDir.set(layout.projectDirectory.dir("patches/generatedApi")) 74 | outputDir.set(layout.projectDirectory.dir("paper-api-generator/generated")) 75 | } 76 | } 77 | } 78 | } 79 | 80 | // 81 | // Everything below here is optional if you don't care about publishing API or dev bundles to your repository 82 | // 83 | 84 | tasks.generateDevelopmentBundle { 85 | apiCoordinates.set("com.lokamc.slice:slice-api") 86 | libraryRepositories.set( 87 | listOf( 88 | "https://repo.maven.apache.org/maven2/", 89 | paperMavenPublicUrl 90 | ) 91 | ) 92 | } 93 | 94 | publishing { 95 | // Publishing dev bundle: 96 | // ./gradlew publishDevBundlePublicationTo(MavenLocal|MyRepoSnapshotsRepository) -PpublishDevBundle 97 | if (project.hasProperty("publishDevBundle")) { 98 | publications.create("devBundle") { 99 | artifact(tasks.generateDevelopmentBundle) { 100 | artifactId = "dev-bundle" 101 | } 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | group=com.lokamc.slice 2 | version=1.21.3-R0.1-SNAPSHOT 3 | mcVersion=1.21.3 4 | paperRef=da7138233f6392e791d790d1c3407414c855f9c2 5 | updatingMinecraft=false 6 | 7 | org.gradle.caching=true 8 | org.gradle.parallel=true 9 | org.gradle.vfs.watch=false 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cryptite/OldSlice/e3c907b800804aa5b2b3bedac9fc18da9e72b9b0/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC2039,SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC2039,SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /patches/api/0001-Add-BlockDestroyedByNeighborEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 9 Nov 2024 09:48:21 -0600 4 | Subject: [PATCH] Add BlockDestroyedByNeighborEvent 5 | 6 | 7 | diff --git a/src/main/java/io/papermc/paper/event/block/BlockDestroyedByNeighborEvent.java b/src/main/java/io/papermc/paper/event/block/BlockDestroyedByNeighborEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..7db2789d54a609b023ea6deff87b45d717aabbf0 10 | --- /dev/null 11 | +++ b/src/main/java/io/papermc/paper/event/block/BlockDestroyedByNeighborEvent.java 12 | @@ -0,0 +1,67 @@ 13 | +package io.papermc.paper.event.block; 14 | + 15 | +import org.bukkit.block.Block; 16 | +import org.bukkit.entity.Player; 17 | +import org.bukkit.event.Cancellable; 18 | +import org.bukkit.event.HandlerList; 19 | +import org.bukkit.event.block.BlockEvent; 20 | +import org.jetbrains.annotations.NotNull; 21 | +import org.jetbrains.annotations.Nullable; 22 | + 23 | +/** 24 | + * Called when a block is broken another block. This is generally the result of BlockPhysicsEvent propagation 25 | + */ 26 | +public class BlockDestroyedByNeighborEvent extends BlockEvent implements Cancellable { 27 | + private static final HandlerList handlers = new HandlerList(); 28 | + private final Player player; 29 | + private final Block sourceBlock; 30 | + private boolean cancel; 31 | + 32 | + public BlockDestroyedByNeighborEvent(@NotNull final Block theBlock, @Nullable Player player, @NotNull final Block sourceBlock) { 33 | + super(theBlock); 34 | + 35 | + this.player = player; 36 | + this.sourceBlock = sourceBlock; 37 | + } 38 | + 39 | + /** 40 | + * Gets the Player that caused this 41 | + * 42 | + * @return The Player that is breaking the block involved in this event 43 | + */ 44 | + @Nullable 45 | + public Player getPlayer() { 46 | + return player; 47 | + } 48 | + 49 | + /** 50 | + * Gets the source block that caused this block break 51 | + * 52 | + * @return The Source Block which block is involved in this event 53 | + */ 54 | + @NotNull 55 | + public final Block getSourceBlock() { 56 | + return sourceBlock; 57 | + } 58 | + 59 | + @Override 60 | + public boolean isCancelled() { 61 | + return cancel; 62 | + } 63 | + 64 | + @Override 65 | + public void setCancelled(boolean cancel) { 66 | + this.cancel = cancel; 67 | + } 68 | + 69 | + @Override 70 | + @NotNull 71 | + public HandlerList getHandlers() { 72 | + return handlers; 73 | + } 74 | + 75 | + @NotNull 76 | + public static HandlerList getHandlerList() { 77 | + return handlers; 78 | + } 79 | +} 80 | -------------------------------------------------------------------------------- /patches/api/0002-Add-provided-Material-to-getDrops.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 9 Nov 2024 09:54:36 -0600 4 | Subject: [PATCH] Add provided Material to getDrops 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java 8 | index 0efd8bb70ebdb86372022c9e12ec89f229ab3b52..be4f8fc7e7d9b6fb3ef0f557c9f591431c902837 100644 9 | --- a/src/main/java/org/bukkit/block/Block.java 10 | +++ b/src/main/java/org/bukkit/block/Block.java 11 | @@ -677,6 +677,20 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr 12 | @NotNull 13 | Collection getDrops(@Nullable ItemStack tool, @Nullable Entity entity); // Paper 14 | 15 | + // Slice start 16 | + /** 17 | + * Returns a list of items which would drop by the entity destroying this 18 | + * block as though it were a given Material with a specific tool 19 | + * 20 | + * @param blockType The block type to use as the source loot 21 | + * @param tool The tool or item in hand used for digging 22 | + * @param entity the entity destroying the block 23 | + * @return a list of dropped items for this type of block 24 | + */ 25 | + @NotNull 26 | + Collection getDrops(@NotNull Material blockType, @NotNull ItemStack tool, @Nullable Entity entity); 27 | + // Slice end 28 | + 29 | /** 30 | * Returns if the given item is a preferred choice to break this Block. 31 | * 32 | -------------------------------------------------------------------------------- /patches/api/0003-Add-Player-to-SpongeAbsorbEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 9 Nov 2024 09:55:18 -0600 4 | Subject: [PATCH] Add Player to SpongeAbsorbEvent 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java b/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java 8 | index 7029cfcd00ed5d9c7f06898ec2b81238ec775a70..0e2f21e0f1983d2e8b67deebf4d12d25107d1582 100644 9 | --- a/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java 10 | +++ b/src/main/java/org/bukkit/event/block/SpongeAbsorbEvent.java 11 | @@ -7,6 +7,7 @@ import org.bukkit.block.BlockState; 12 | import org.bukkit.event.Cancellable; 13 | import org.bukkit.event.HandlerList; 14 | import org.jetbrains.annotations.NotNull; 15 | +import org.jetbrains.annotations.Nullable; // Paper 16 | 17 | /** 18 | * Called when a sponge absorbs water from the world. 19 | @@ -21,11 +22,13 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable { 20 | 21 | private static final HandlerList handlers = new HandlerList(); 22 | private boolean cancelled; 23 | + private final org.bukkit.entity.Player player; // Paper 24 | private final List blocks; 25 | 26 | - public SpongeAbsorbEvent(@NotNull Block block, @NotNull List waterblocks) { 27 | + public SpongeAbsorbEvent(@NotNull Block block, @Nullable org.bukkit.entity.Player player, @NotNull List waterblocks) { // Paper 28 | super(block); 29 | this.blocks = waterblocks; 30 | + this.player = player; // Paper 31 | } 32 | 33 | /** 34 | @@ -41,6 +44,18 @@ public class SpongeAbsorbEvent extends BlockEvent implements Cancellable { 35 | return blocks; 36 | } 37 | 38 | + // Paper start 39 | + /** 40 | + * Gets the Player that placed the Sponge Block 41 | + * 42 | + * @return The Player that placed the sponge block causing the absorb event, or null if no Player was involved 43 | + */ 44 | + @Nullable 45 | + public org.bukkit.entity.Player getPlayer() { 46 | + return player; 47 | + } 48 | + // Paper end 49 | + 50 | @Override 51 | public boolean isCancelled() { 52 | return cancelled; 53 | -------------------------------------------------------------------------------- /patches/api/0004-Add-World-Instance-flag.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 9 Nov 2024 09:56:09 -0600 4 | Subject: [PATCH] Add World Instance flag 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java 8 | index 7a439c99fc4c5ee17d674460c8e58a9fe0c64e02..411e2153538f63f1ce3b3a10bb2829d1737d0597 100644 9 | --- a/src/main/java/org/bukkit/World.java 10 | +++ b/src/main/java/org/bukkit/World.java 11 | @@ -2776,6 +2776,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient 12 | */ 13 | public void setAutoSave(boolean value); 14 | 15 | + // Slice start 16 | + public boolean isInstance(); 17 | + public void setInstance(boolean value); 18 | + // Slice end 19 | + 20 | /** 21 | * Sets the Difficulty of the world. 22 | * 23 | -------------------------------------------------------------------------------- /patches/api/0005-Smooth-Teleports.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sun, 10 Nov 2024 09:34:07 -0600 4 | Subject: [PATCH] Smooth Teleports 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java 8 | index 95f0b3186e313c7fbd5c8531d52b82a69e525f94..f542265036bde4031c834e379a031d2821f32173 100644 9 | --- a/src/main/java/org/bukkit/entity/Player.java 10 | +++ b/src/main/java/org/bukkit/entity/Player.java 11 | @@ -3721,6 +3721,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM 12 | String getClientBrandName(); 13 | // Paper end 14 | 15 | + // Slice start 16 | + /** 17 | + * This abuses some of how Minecraft works and allows teleporting a player to another world without 18 | + * triggering typical respawn packets. All of natural state of chunk resends, entity adds/removes, etc still 19 | + * happen but the visual "refresh" of a world change is hidden. Depending on the destination location/world, 20 | + * this can act as a "smooth teleport" to a world if the new world is very similar looking to the old one. 21 | + * 22 | + * @param location New location to teleport this Player to 23 | + */ 24 | + @org.jetbrains.annotations.ApiStatus.Experimental 25 | + void teleportWithoutRespawn(@NotNull Location location); 26 | + // Slice end 27 | + 28 | // Paper start - Teleport API 29 | /** 30 | * Sets the player's rotation. 31 | -------------------------------------------------------------------------------- /patches/api/0006-Add-Force-Crit-to-PlayerPreAttackEntityEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Wed, 13 Nov 2024 07:49:32 -0600 4 | Subject: [PATCH] Add Force Crit to PlayerPreAttackEntityEvent 5 | 6 | 7 | diff --git a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java 8 | index a6c5818bcdd8de5f2d0e9bf72d1e3816652e0199..196d790d766548a2e4afc31820658ba493a1fe83 100644 9 | --- a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java 10 | +++ b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java 11 | @@ -28,6 +28,7 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab 12 | private final boolean willAttack; 13 | 14 | private boolean cancelled; 15 | + private boolean forceCrit; // Slice 16 | 17 | @ApiStatus.Internal 18 | public PrePlayerAttackEntityEvent(final Player player, final Entity attacked, final boolean willAttack) { 19 | @@ -59,6 +60,16 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab 20 | return this.willAttack; 21 | } 22 | 23 | + // Slice start 24 | + public boolean isForceCrit() { 25 | + return forceCrit; 26 | + } 27 | + 28 | + public void setForceCrit(boolean forceCrit) { 29 | + this.forceCrit = forceCrit; 30 | + } 31 | + // Slice end 32 | + 33 | @Override 34 | public boolean isCancelled() { 35 | return this.cancelled; 36 | -------------------------------------------------------------------------------- /patches/api/0007-Add-reason-to-PlayerConnectionCloseEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Wed, 13 Nov 2024 08:04:09 -0600 4 | Subject: [PATCH] Add reason to PlayerConnectionCloseEvent 5 | 6 | 7 | diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java 8 | index 5f5afcdb3c9e669ed0e730c720ad91d16b95602c..9447c571a514155cebc47a3bd9f6d0d79bdc8c97 100644 9 | --- a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java 10 | +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java 11 | @@ -7,6 +7,7 @@ import org.bukkit.event.HandlerList; 12 | import org.bukkit.event.player.AsyncPlayerPreLoginEvent; 13 | import org.bukkit.event.player.PlayerQuitEvent; 14 | import org.jetbrains.annotations.ApiStatus; 15 | +import org.jetbrains.annotations.NotNull; 16 | import org.jspecify.annotations.NullMarked; 17 | 18 | /** 19 | @@ -42,13 +43,19 @@ public class PlayerConnectionCloseEvent extends Event { 20 | private final UUID playerUniqueId; 21 | private final String playerName; 22 | private final InetAddress ipAddress; 23 | + @NotNull private final ConnectionCloseReason reason; 24 | 25 | @ApiStatus.Internal 26 | public PlayerConnectionCloseEvent(final UUID playerUniqueId, final String playerName, final InetAddress ipAddress, final boolean async) { 27 | + this(playerUniqueId, playerName, ipAddress, ConnectionCloseReason.NORMAL, async); 28 | + } 29 | + 30 | + public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull final InetAddress ipAddress, @NotNull ConnectionCloseReason reason, final boolean async) { 31 | super(async); 32 | this.playerUniqueId = playerUniqueId; 33 | this.playerName = playerName; 34 | this.ipAddress = ipAddress; 35 | + this.reason = reason; 36 | } 37 | 38 | /** 39 | @@ -80,4 +87,27 @@ public class PlayerConnectionCloseEvent extends Event { 40 | public static HandlerList getHandlerList() { 41 | return HANDLER_LIST; 42 | } 43 | + 44 | + 45 | + /** 46 | + * Returns the reason for the closed connection. 47 | + */ 48 | + @NotNull 49 | + public ConnectionCloseReason getReason() { 50 | + return this.reason; 51 | + } 52 | + 53 | + public enum ConnectionCloseReason { 54 | + /** 55 | + * Player disconnected normally 56 | + */ 57 | + NORMAL, 58 | + 59 | + /** 60 | + * Player has invalid data for some reason. 61 | + *

62 | + * One example of this is a player logging into an unloaded world. 63 | + */ 64 | + INVALID_PLAYER_DATA, 65 | + } 66 | } 67 | -------------------------------------------------------------------------------- /patches/api/0008-ChunkStatusChangeEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Wed, 13 Nov 2024 08:07:59 -0600 4 | Subject: [PATCH] ChunkStatusChangeEvent 5 | 6 | 7 | diff --git a/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..9154bc8a072d8e5f3fd9790606508af048a612eb 10 | --- /dev/null 11 | +++ b/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java 12 | @@ -0,0 +1,61 @@ 13 | +package com.destroystokyo.paper.event.chunk; 14 | + 15 | +import org.bukkit.Chunk; 16 | +import org.bukkit.event.Event; 17 | +import org.bukkit.event.HandlerList; 18 | +import org.jetbrains.annotations.NotNull; 19 | + 20 | +/** 21 | + * Called when the Full Status of a Chunk changes 22 | + */ 23 | +public class ChunkStatusChangeEvent extends Event { 24 | + 25 | + private static final HandlerList handlers = new HandlerList(); 26 | + private final Chunk chunk; 27 | + private final ChunkStatus currentState; 28 | + private final ChunkStatus newState; 29 | + 30 | + public ChunkStatusChangeEvent(@NotNull Chunk chunk, @NotNull ChunkStatus currentState, @NotNull ChunkStatus newState) { 31 | + super(); 32 | + this.chunk = chunk; 33 | + this.currentState = currentState; 34 | + this.newState = newState; 35 | + } 36 | + 37 | + @NotNull 38 | + public Chunk getChunk() { 39 | + return chunk; 40 | + } 41 | + 42 | + @NotNull 43 | + public ChunkStatus getCurrentState() { 44 | + return currentState; 45 | + } 46 | + 47 | + @NotNull 48 | + public ChunkStatus getNewState() { 49 | + return newState; 50 | + } 51 | + 52 | + public boolean isUpgrade() { 53 | + return newState.ordinal() > currentState.ordinal(); 54 | + } 55 | + 56 | + @Override 57 | + @NotNull 58 | + public HandlerList getHandlers() { 59 | + return handlers; 60 | + } 61 | + 62 | + @NotNull 63 | + public static HandlerList getHandlerList() { 64 | + return handlers; 65 | + } 66 | + 67 | + public enum ChunkStatus { 68 | + INACCESSIBLE, 69 | + FULL, 70 | + BLOCK_TICKING, 71 | + ENTITY_TICKING; 72 | + } 73 | +} 74 | -------------------------------------------------------------------------------- /patches/api/0009-Equipment-Packet-Caching.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Wed, 13 Nov 2024 08:29:41 -0600 4 | Subject: [PATCH] Equipment Packet Caching 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java 8 | index 68c08e7a212bc3e3885f9b5a4d9aef85fcb3b029..5395ec5d6ec33495516e792bdbbc97a7cef3038d 100644 9 | --- a/src/main/java/org/bukkit/entity/LivingEntity.java 10 | +++ b/src/main/java/org/bukkit/entity/LivingEntity.java 11 | @@ -1458,6 +1458,14 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource 12 | void setBodyYaw(float bodyYaw); 13 | // Paper end - body yaw API 14 | 15 | + 16 | + // Slice start 17 | + /** 18 | + * @param p The player to send this entity's equipment packet to 19 | + */ 20 | + void sendEquipment(@NotNull Player p); 21 | + // Slice end 22 | + 23 | // Paper start - Expose canUseSlot 24 | /** 25 | * Checks whether this entity can use the equipment slot. 26 | diff --git a/src/main/java/org/bukkit/event/entity/EntityEquipmentItemLookup.java b/src/main/java/org/bukkit/event/entity/EntityEquipmentItemLookup.java 27 | new file mode 100644 28 | index 0000000000000000000000000000000000000000..48d2eb3bbb8dbcb6714ee47c4159c0604657a78c 29 | --- /dev/null 30 | +++ b/src/main/java/org/bukkit/event/entity/EntityEquipmentItemLookup.java 31 | @@ -0,0 +1,54 @@ 32 | +package org.bukkit.event.entity; 33 | + 34 | +import org.bukkit.entity.Entity; 35 | +import org.bukkit.event.HandlerList; 36 | +import org.bukkit.inventory.EquipmentSlot; 37 | +import org.bukkit.inventory.ItemStack; 38 | +import org.jetbrains.annotations.NotNull; 39 | + 40 | +/** 41 | + * Called when requesting a cached equipment item lookup 42 | + */ 43 | +public class EntityEquipmentItemLookup extends EntityEvent { 44 | + private static final HandlerList handlers = new HandlerList(); 45 | + private final String tag; 46 | + private final EquipmentSlot equipmentSlot; 47 | + private ItemStack itemStack; 48 | + 49 | + public EntityEquipmentItemLookup(@NotNull final Entity entity, @NotNull String tag, @NotNull EquipmentSlot slot, @NotNull final ItemStack itemStack) { 50 | + super(entity); 51 | + this.tag = tag; 52 | + this.equipmentSlot = slot; 53 | + this.itemStack = itemStack; 54 | + } 55 | + 56 | + @NotNull 57 | + public ItemStack getItemStack() { 58 | + return itemStack; 59 | + } 60 | + 61 | + public void setItemStack(@NotNull ItemStack itemStack) { 62 | + this.itemStack = itemStack; 63 | + } 64 | + 65 | + @NotNull 66 | + public EquipmentSlot getEquipmentSlot() { 67 | + return equipmentSlot; 68 | + } 69 | + 70 | + @NotNull 71 | + public String getTag() { 72 | + return tag; 73 | + } 74 | + 75 | + @NotNull 76 | + @Override 77 | + public HandlerList getHandlers() { 78 | + return handlers; 79 | + } 80 | + 81 | + @NotNull 82 | + public static HandlerList getHandlerList() { 83 | + return handlers; 84 | + } 85 | +} 86 | diff --git a/src/main/java/org/bukkit/event/player/PlayerReceiveEquipmentEvent.java b/src/main/java/org/bukkit/event/player/PlayerReceiveEquipmentEvent.java 87 | new file mode 100644 88 | index 0000000000000000000000000000000000000000..a8f83d19341c2f3024ba8113478ed482657b8589 89 | --- /dev/null 90 | +++ b/src/main/java/org/bukkit/event/player/PlayerReceiveEquipmentEvent.java 91 | @@ -0,0 +1,63 @@ 92 | +package org.bukkit.event.player; 93 | + 94 | +import org.bukkit.entity.Entity; 95 | +import org.bukkit.entity.Player; 96 | +import org.bukkit.event.Cancellable; 97 | +import org.bukkit.event.HandlerList; 98 | +import org.jetbrains.annotations.NotNull; 99 | +import org.jetbrains.annotations.Nullable; 100 | + 101 | +/** 102 | + * Called when a player is about to receive an equipment packet about another player 103 | + */ 104 | +public class PlayerReceiveEquipmentEvent extends PlayerEvent implements Cancellable { 105 | + private static final HandlerList handlers = new HandlerList(); 106 | + private final Entity tracked; 107 | + private boolean cancel; 108 | + private String tag; 109 | + 110 | + public PlayerReceiveEquipmentEvent(@NotNull final Player player, @NotNull final Entity tracked) { 111 | + super(player); 112 | + this.tracked = tracked; 113 | + } 114 | + 115 | + /** 116 | + * Gets the tracked entity 117 | + * 118 | + * @return Entity the player is now tracking 119 | + */ 120 | + @NotNull 121 | + public Entity getTracked() { 122 | + return tracked; 123 | + } 124 | + 125 | + @Nullable 126 | + public String getTag() { 127 | + return tag; 128 | + } 129 | + 130 | + public void setTag(@Nullable String tag) { 131 | + this.tag = tag; 132 | + } 133 | + 134 | + @Override 135 | + public boolean isCancelled() { 136 | + return cancel; 137 | + } 138 | + 139 | + @Override 140 | + public void setCancelled(boolean cancel) { 141 | + this.cancel = cancel; 142 | + } 143 | + 144 | + @NotNull 145 | + @Override 146 | + public HandlerList getHandlers() { 147 | + return handlers; 148 | + } 149 | + 150 | + @NotNull 151 | + public static HandlerList getHandlerList() { 152 | + return handlers; 153 | + } 154 | +} 155 | -------------------------------------------------------------------------------- /patches/api/0010-Add-Vanish.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 16 Nov 2024 09:10:35 -0600 4 | Subject: [PATCH] Add Vanish 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java 8 | index d0ae8a94db20281d3664d74718c65234eb2e5f83..6324e8f11a382288fc0a6c30f47760ea50e231d5 100644 9 | --- a/src/main/java/org/bukkit/entity/Entity.java 10 | +++ b/src/main/java/org/bukkit/entity/Entity.java 11 | @@ -1172,4 +1172,19 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent 12 | */ 13 | void broadcastHurtAnimation(@NotNull java.util.Collection players); 14 | // Paper end - broadcast hurt animation 15 | + 16 | + // Slice start 17 | + /** 18 | + * Returns true if the entity is vanished and cannot emit sounds, effects, etc. 19 | + */ 20 | + boolean isVanished(); 21 | + 22 | + /** 23 | + * Sets whether the entity is vanished and cannot emit sounds, effects, etc. 24 | + * 25 | + * @param vanished the saveable status 26 | + * @see #isVanished() 27 | + */ 28 | + void setVanished(boolean vanished); 29 | + // Slice end 30 | } 31 | -------------------------------------------------------------------------------- /patches/api/0011-Add-ObjectId.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 16 Nov 2024 09:22:24 -0600 4 | Subject: [PATCH] Add ObjectId 5 | 6 | 7 | diff --git a/build.gradle.kts b/build.gradle.kts 8 | index e29e5024fa693baae469d47fe77b57118f14627c..5770f7c756d033076e0fb629d6aa11fb97ccb0f2 100644 9 | --- a/build.gradle.kts 10 | +++ b/build.gradle.kts 11 | @@ -69,6 +69,8 @@ dependencies { 12 | implementation("org.ow2.asm:asm-commons:9.7.1") 13 | // Paper end 14 | 15 | + implementation("org.mongodb:bson:4.11.1") // Slice - MongoDB Bson Library for ObjectIds 16 | + 17 | api("org.apache.maven:maven-resolver-provider:3.9.6") // Paper - make API dependency for Paper Plugins 18 | compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") 19 | compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") 20 | diff --git a/src/main/java/io/papermc/paper/event/player/PlayerResolveObjectIdEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerResolveObjectIdEvent.java 21 | new file mode 100644 22 | index 0000000000000000000000000000000000000000..4c28994757812f9c7f59d9eb827908bb64e63118 23 | --- /dev/null 24 | +++ b/src/main/java/io/papermc/paper/event/player/PlayerResolveObjectIdEvent.java 25 | @@ -0,0 +1,44 @@ 26 | +package io.papermc.paper.event.player; 27 | + 28 | +import org.bson.types.ObjectId; 29 | +import org.bukkit.Bukkit; 30 | +import org.bukkit.entity.Player; 31 | +import org.bukkit.event.HandlerList; 32 | +import org.bukkit.event.player.PlayerEvent; 33 | +import org.jetbrains.annotations.NotNull; 34 | +import org.jetbrains.annotations.Nullable; 35 | + 36 | +import java.util.Objects; 37 | + 38 | +/** 39 | + * Called when a player trades with a standalone merchant GUI. 40 | + */ 41 | +public class PlayerResolveObjectIdEvent extends PlayerEvent { 42 | + private static final HandlerList handlers = new HandlerList(); 43 | + private ObjectId objectId; 44 | + 45 | + public PlayerResolveObjectIdEvent(@NotNull Player player) { 46 | + super(player, !Bukkit.isPrimaryThread()); 47 | + } 48 | + 49 | + @Nullable 50 | + public ObjectId getObjectId() { 51 | + return this.objectId; 52 | + } 53 | + 54 | + public void setObjectId(@NotNull ObjectId objectId) { 55 | + this.objectId = Objects.requireNonNull(objectId, "ObjectId cannot be null!"); 56 | + } 57 | + 58 | + @NotNull 59 | + @Override 60 | + public HandlerList getHandlers() { 61 | + return handlers; 62 | + } 63 | + 64 | + @NotNull 65 | + public static HandlerList getHandlerList() { 66 | + return handlers; 67 | + } 68 | + 69 | +} 70 | diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java 71 | index 488604ba1a516b477693877c74712e4a45624a8b..2a3e40b0b7f058713634d99f61755b368e05fa74 100644 72 | --- a/src/main/java/org/bukkit/entity/HumanEntity.java 73 | +++ b/src/main/java/org/bukkit/entity/HumanEntity.java 74 | @@ -22,6 +22,11 @@ import org.jetbrains.annotations.Nullable; 75 | */ 76 | public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder { 77 | 78 | + // Slice start 79 | + org.bson.types.@Nullable ObjectId getObjectId(); 80 | + void setObjectId(@Nullable org.bson.types.ObjectId objectId); 81 | + // Slice end 82 | + 83 | // Paper start 84 | @Override 85 | org.bukkit.inventory.@NotNull EntityEquipment getEquipment(); 86 | -------------------------------------------------------------------------------- /patches/api/0012-Add-PlayerLoadStatsEvent-Fix-patch.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 16 Nov 2024 09:34:15 -0600 4 | Subject: [PATCH] Add PlayerLoadStatsEvent Fix patch 5 | 6 | 7 | diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadStatsEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadStatsEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..13c627b73520d862f864834732f0cad35532298b 10 | --- /dev/null 11 | +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadStatsEvent.java 12 | @@ -0,0 +1,54 @@ 13 | +package com.destroystokyo.paper.event.player; 14 | + 15 | +import com.google.gson.JsonObject; 16 | +import org.bukkit.Bukkit; 17 | +import org.bukkit.event.Event; 18 | +import org.bukkit.event.HandlerList; 19 | +import org.jetbrains.annotations.NotNull; 20 | +import org.jetbrains.annotations.Nullable; 21 | + 22 | +import java.util.UUID; 23 | + 24 | +/** 25 | + * Calls an event in which player stats can be provided. If null, will load from disk, otherwise will use provided data 26 | + */ 27 | +public class PlayerLoadStatsEvent extends Event { 28 | + private static final HandlerList handlers = new HandlerList(); 29 | + private final UUID playerId; 30 | + private JsonObject json; 31 | + 32 | + public PlayerLoadStatsEvent(@NotNull UUID playerId) { 33 | + super(!Bukkit.isPrimaryThread()); 34 | + this.playerId = playerId; 35 | + } 36 | + 37 | + /** 38 | + * Gets the player's unique ID. 39 | + * 40 | + * @return The unique ID 41 | + */ 42 | + @NotNull 43 | + public UUID getUniqueId() { 44 | + return playerId; 45 | + } 46 | + 47 | + @Nullable 48 | + public JsonObject getStatistics() { 49 | + return json; 50 | + } 51 | + 52 | + public void setStatistics(@NotNull JsonObject json) { 53 | + this.json = json; 54 | + } 55 | + 56 | + @NotNull 57 | + @Override 58 | + public HandlerList getHandlers() { 59 | + return handlers; 60 | + } 61 | + 62 | + @NotNull 63 | + public static HandlerList getHandlerList() { 64 | + return handlers; 65 | + } 66 | +} 67 | -------------------------------------------------------------------------------- /patches/api/0013-Expose-getBlockPosBelowThatAffectsMyMovement.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sun, 17 Nov 2024 08:24:22 -0600 4 | Subject: [PATCH] Expose getBlockPosBelowThatAffectsMyMovement 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java 8 | index 6324e8f11a382288fc0a6c30f47760ea50e231d5..8188b3a27fddac18cf49db5a8049149e784f4cbc 100644 9 | --- a/src/main/java/org/bukkit/entity/Entity.java 10 | +++ b/src/main/java/org/bukkit/entity/Entity.java 11 | @@ -1187,4 +1187,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent 12 | */ 13 | void setVanished(boolean vanished); 14 | // Slice end 15 | + 16 | + // Slice start 17 | + /** 18 | + * Returns the Block that is currently supporting the player, particularly in the case of 19 | + * crouching over the edge of a block. 20 | + */ 21 | + org.bukkit.block.Block getBlockStandingOn(); 22 | + // Slice end 23 | } 24 | -------------------------------------------------------------------------------- /patches/api/0014-Add-DimensionDataStorageEvents.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sun, 17 Nov 2024 09:19:41 -0600 4 | Subject: [PATCH] Add DimensionDataStorageEvents 5 | 6 | 7 | diff --git a/src/main/java/io/papermc/paper/event/server/DimensionDataStorageLoadEvent.java b/src/main/java/io/papermc/paper/event/server/DimensionDataStorageLoadEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..f85074ae3bb7eb558fc07a4e1877f130aec33d39 10 | --- /dev/null 11 | +++ b/src/main/java/io/papermc/paper/event/server/DimensionDataStorageLoadEvent.java 12 | @@ -0,0 +1,61 @@ 13 | +package io.papermc.paper.event.server; 14 | + 15 | +import com.google.gson.JsonElement; 16 | +import org.bukkit.event.Cancellable; 17 | +import org.bukkit.event.HandlerList; 18 | +import org.bukkit.event.server.ServerEvent; 19 | +import org.jetbrains.annotations.ApiStatus; 20 | +import org.jspecify.annotations.NullMarked; 21 | + 22 | +import java.nio.file.Path; 23 | + 24 | +/** 25 | + * Called when resources such as datapacks are reloaded (e.g. /minecraft:reload) 26 | + *

27 | + * Intended for use to re-register custom recipes, advancements that may be lost during a reload like this. 28 | + */ 29 | +@NullMarked 30 | +public class DimensionDataStorageLoadEvent extends ServerEvent implements Cancellable { 31 | + public static final HandlerList HANDLER_LIST = new HandlerList(); 32 | + 33 | + private final Path path; 34 | + private final JsonElement json; 35 | + private boolean cancelled; 36 | + @ApiStatus.Internal 37 | + public DimensionDataStorageLoadEvent(final Path path, final JsonElement json) { 38 | + this.path = path; 39 | + this.json = json; 40 | + } 41 | + 42 | + public Path getPath() { 43 | + return path; 44 | + } 45 | + 46 | + public JsonElement getJson() { 47 | + return json; 48 | + } 49 | + 50 | + @Override 51 | + public boolean isCancelled() { 52 | + return this.cancelled; 53 | + } 54 | + 55 | + @Override 56 | + public void setCancelled(final boolean cancel) { 57 | + this.cancelled = cancel; 58 | + } 59 | + 60 | + public static HandlerList getHandlerList() { 61 | + return HANDLER_LIST; 62 | + } 63 | + 64 | + @Override 65 | + public HandlerList getHandlers() { 66 | + return HANDLER_LIST; 67 | + } 68 | + 69 | + public enum Cause { 70 | + COMMAND, 71 | + PLUGIN, 72 | + } 73 | +} 74 | diff --git a/src/main/java/io/papermc/paper/event/server/DimensionDataStorageSaveEvent.java b/src/main/java/io/papermc/paper/event/server/DimensionDataStorageSaveEvent.java 75 | new file mode 100644 76 | index 0000000000000000000000000000000000000000..2b29981621c959dd6027a072dab06339ebf315bf 77 | --- /dev/null 78 | +++ b/src/main/java/io/papermc/paper/event/server/DimensionDataStorageSaveEvent.java 79 | @@ -0,0 +1,61 @@ 80 | +package io.papermc.paper.event.server; 81 | + 82 | +import org.bukkit.event.Cancellable; 83 | +import org.bukkit.event.HandlerList; 84 | +import org.bukkit.event.server.ServerEvent; 85 | +import org.jetbrains.annotations.ApiStatus; 86 | +import org.jspecify.annotations.NullMarked; 87 | + 88 | +import java.io.ByteArrayOutputStream; 89 | +import java.nio.file.Path; 90 | + 91 | +/** 92 | + * Called when resources such as datapacks are reloaded (e.g. /minecraft:reload) 93 | + *

94 | + * Intended for use to re-register custom recipes, advancements that may be lost during a reload like this. 95 | + */ 96 | +@NullMarked 97 | +public class DimensionDataStorageSaveEvent extends ServerEvent implements Cancellable { 98 | + public static final HandlerList HANDLER_LIST = new HandlerList(); 99 | + 100 | + private final String id; 101 | + private final ByteArrayOutputStream output; 102 | + private boolean cancelled; 103 | + @ApiStatus.Internal 104 | + public DimensionDataStorageSaveEvent(final String id, final ByteArrayOutputStream output) { 105 | + this.id = id; 106 | + this.output = output; 107 | + } 108 | + 109 | + public String getId() { 110 | + return id; 111 | + } 112 | + 113 | + public ByteArrayOutputStream getOutput() { 114 | + return output; 115 | + } 116 | + 117 | + @Override 118 | + public boolean isCancelled() { 119 | + return this.cancelled; 120 | + } 121 | + 122 | + @Override 123 | + public void setCancelled(final boolean cancel) { 124 | + this.cancelled = cancel; 125 | + } 126 | + 127 | + public static HandlerList getHandlerList() { 128 | + return HANDLER_LIST; 129 | + } 130 | + 131 | + @Override 132 | + public HandlerList getHandlers() { 133 | + return HANDLER_LIST; 134 | + } 135 | + 136 | + public enum Cause { 137 | + COMMAND, 138 | + PLUGIN, 139 | + } 140 | +} 141 | -------------------------------------------------------------------------------- /patches/api/0015-Add-PlayerData-Events.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Tom 3 | Date: Mon, 18 Nov 2024 08:34:27 -0600 4 | Subject: [PATCH] Add PlayerData Events 5 | 6 | 7 | diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..2501922ea0fe84ed07e33503d84dd74a423e39e3 10 | --- /dev/null 11 | +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java 12 | @@ -0,0 +1,64 @@ 13 | +package com.destroystokyo.paper.event.player; 14 | + 15 | +import com.google.gson.JsonObject; 16 | +import org.bukkit.Bukkit; 17 | +import org.bukkit.event.Event; 18 | +import org.bukkit.event.HandlerList; 19 | +import org.jetbrains.annotations.NotNull; 20 | +import org.jetbrains.annotations.Nullable; 21 | + 22 | +import java.util.UUID; 23 | + 24 | +/** 25 | + * Calls an event in which playerdata can be provided. If null, will load from disk, otherwise will use provided data 26 | + */ 27 | +public class PlayerLoadDataEvent extends Event { 28 | + private static final HandlerList handlers = new HandlerList(); 29 | + private final UUID playerId; 30 | + private Object playerData; 31 | + private JsonObject statistics; 32 | + 33 | + public PlayerLoadDataEvent(@NotNull UUID playerId) { 34 | + super(!Bukkit.isPrimaryThread()); 35 | + this.playerId = playerId; 36 | + } 37 | + 38 | + /** 39 | + * Gets the player's unique ID. 40 | + * 41 | + * @return The unique ID 42 | + */ 43 | + @NotNull 44 | + public UUID getUniqueId() { 45 | + return playerId; 46 | + } 47 | + 48 | + @Nullable 49 | + public Object getPlayerData() { 50 | + return playerData; 51 | + } 52 | + 53 | + public void setPlayerData(@NotNull Object playerData) { 54 | + this.playerData = playerData; 55 | + } 56 | + 57 | + @Nullable 58 | + public JsonObject getStatistics() { 59 | + return statistics; 60 | + } 61 | + 62 | + public void setStatistics(@NotNull JsonObject statistics) { 63 | + this.statistics = statistics; 64 | + } 65 | + 66 | + @NotNull 67 | + @Override 68 | + public HandlerList getHandlers() { 69 | + return handlers; 70 | + } 71 | + 72 | + @NotNull 73 | + public static HandlerList getHandlerList() { 74 | + return handlers; 75 | + } 76 | +} 77 | diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerSaveDataEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerSaveDataEvent.java 78 | new file mode 100644 79 | index 0000000000000000000000000000000000000000..c706201394d89f4a6f795ebbbac3d1041f395104 80 | --- /dev/null 81 | +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerSaveDataEvent.java 82 | @@ -0,0 +1,52 @@ 83 | +package com.destroystokyo.paper.event.player; 84 | + 85 | +import org.bukkit.entity.Player; 86 | +import org.bukkit.event.Cancellable; 87 | +import org.bukkit.event.Event; 88 | +import org.bukkit.event.HandlerList; 89 | +import org.jetbrains.annotations.NotNull; 90 | + 91 | +/** 92 | + * Calls whenever playerdata is attempted to be saved. This is fired even if SpigotConfig.disablePlayerDataSaving is true 93 | + */ 94 | +public class PlayerSaveDataEvent extends Event implements Cancellable { 95 | + private static final HandlerList handlers = new HandlerList(); 96 | + private final Player player; 97 | + private boolean cancel; 98 | + 99 | + public PlayerSaveDataEvent(@NotNull Player player) { 100 | + super(); 101 | + this.player = player; 102 | + } 103 | + 104 | + /** 105 | + * Gets the player 106 | + * 107 | + * @return The player 108 | + */ 109 | + @NotNull 110 | + public Player getPlayer() { 111 | + return player; 112 | + } 113 | + 114 | + @NotNull 115 | + @Override 116 | + public HandlerList getHandlers() { 117 | + return handlers; 118 | + } 119 | + 120 | + @NotNull 121 | + public static HandlerList getHandlerList() { 122 | + return handlers; 123 | + } 124 | + 125 | + @Override 126 | + public boolean isCancelled() { 127 | + return cancel; 128 | + } 129 | + 130 | + @Override 131 | + public void setCancelled(boolean cancel) { 132 | + this.cancel = cancel; 133 | + } 134 | +} 135 | -------------------------------------------------------------------------------- /patches/api/0016-Non-saveable-entities.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Mon, 18 Nov 2024 11:20:07 -0600 4 | Subject: [PATCH] Non-saveable-entities 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java 8 | index 8188b3a27fddac18cf49db5a8049149e784f4cbc..a189034515b4361c39b60915e38f35d808a503d0 100644 9 | --- a/src/main/java/org/bukkit/entity/Entity.java 10 | +++ b/src/main/java/org/bukkit/entity/Entity.java 11 | @@ -1195,4 +1195,20 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent 12 | */ 13 | org.bukkit.block.Block getBlockStandingOn(); 14 | // Slice end 15 | + 16 | + 17 | + // Slice start 18 | + /** 19 | + * Returns true if the entity can be saved. If false, the entity will never be serialized or saved. 20 | + */ 21 | + boolean isSaveable(); 22 | + 23 | + /** 24 | + * Sets whether the entity can be serialized and saved to disk. 25 | + * 26 | + * @param saveable the saveable status 27 | + * @see #isSaveable() 28 | + */ 29 | + void setSaveable(boolean saveable); 30 | + // Slice end 31 | } 32 | -------------------------------------------------------------------------------- /patches/api/0017-Map-Events.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Mon, 2 Dec 2024 11:52:34 -0600 4 | Subject: [PATCH] Map Events 5 | 6 | 7 | diff --git a/src/main/java/io/papermc/paper/event/server/MapGetFreeIndexEvent.java b/src/main/java/io/papermc/paper/event/server/MapGetFreeIndexEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..25999adb10ed0f3514332d64f27ea118bfccbfb4 10 | --- /dev/null 11 | +++ b/src/main/java/io/papermc/paper/event/server/MapGetFreeIndexEvent.java 12 | @@ -0,0 +1,41 @@ 13 | +package io.papermc.paper.event.server; 14 | + 15 | +import org.bukkit.event.HandlerList; 16 | +import org.bukkit.event.server.ServerEvent; 17 | +import org.jetbrains.annotations.ApiStatus; 18 | +import org.jspecify.annotations.NullMarked; 19 | + 20 | +/** 21 | + * Called when we try to fetch a new index for a newly-created map. 22 | + */ 23 | +@NullMarked 24 | +public class MapGetFreeIndexEvent extends ServerEvent { 25 | + public static final HandlerList HANDLER_LIST = new HandlerList(); 26 | + 27 | + private int index = -1; 28 | + @ApiStatus.Internal 29 | + public MapGetFreeIndexEvent() { 30 | + } 31 | + 32 | + public int getIndex() { 33 | + return index; 34 | + } 35 | + 36 | + public void setIndex(int index) { 37 | + this.index = index; 38 | + } 39 | + 40 | + public static HandlerList getHandlerList() { 41 | + return HANDLER_LIST; 42 | + } 43 | + 44 | + @Override 45 | + public HandlerList getHandlers() { 46 | + return HANDLER_LIST; 47 | + } 48 | + 49 | + public enum Cause { 50 | + COMMAND, 51 | + PLUGIN, 52 | + } 53 | +} 54 | diff --git a/src/main/java/io/papermc/paper/event/server/MapLoadEvent.java b/src/main/java/io/papermc/paper/event/server/MapLoadEvent.java 55 | new file mode 100644 56 | index 0000000000000000000000000000000000000000..0dfab37f18b797003b932a8a8b16943c1dd7677c 57 | --- /dev/null 58 | +++ b/src/main/java/io/papermc/paper/event/server/MapLoadEvent.java 59 | @@ -0,0 +1,55 @@ 60 | +package io.papermc.paper.event.server; 61 | + 62 | +import org.bukkit.event.HandlerList; 63 | +import org.bukkit.event.server.ServerEvent; 64 | +import org.jetbrains.annotations.ApiStatus; 65 | +import org.jspecify.annotations.NullMarked; 66 | +import org.jspecify.annotations.Nullable; 67 | + 68 | +import java.io.ByteArrayInputStream; 69 | +import java.io.ByteArrayOutputStream; 70 | + 71 | +/** 72 | + * Called when we want to load a Map from disk 73 | + */ 74 | +@NullMarked 75 | +public class MapLoadEvent extends ServerEvent { 76 | + public static final HandlerList HANDLER_LIST = new HandlerList(); 77 | + 78 | + private int id; 79 | + private ByteArrayInputStream buf; 80 | + @ApiStatus.Internal 81 | + public MapLoadEvent(int id) { 82 | + this.id = id; 83 | + } 84 | + 85 | + public int getIndex() { 86 | + return id; 87 | + } 88 | + 89 | + public void setIndex(int index) { 90 | + this.id = index; 91 | + } 92 | + 93 | + public @Nullable ByteArrayInputStream getBuf() { 94 | + return buf; 95 | + } 96 | + 97 | + public void setBuf(ByteArrayInputStream buf) { 98 | + this.buf = buf; 99 | + } 100 | + 101 | + public static HandlerList getHandlerList() { 102 | + return HANDLER_LIST; 103 | + } 104 | + 105 | + @Override 106 | + public HandlerList getHandlers() { 107 | + return HANDLER_LIST; 108 | + } 109 | + 110 | + public enum Cause { 111 | + COMMAND, 112 | + PLUGIN, 113 | + } 114 | +} 115 | -------------------------------------------------------------------------------- /patches/api/0018-PlayerInsertBundleItemEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sun, 15 Dec 2024 17:55:31 -0600 4 | Subject: [PATCH] PlayerInsertBundleItemEvent 5 | 6 | 7 | diff --git a/src/main/java/io/papermc/paper/event/player/PlayerInsertBundleItemEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerInsertBundleItemEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..f715b36826591c5b19408c96119892a935eca27f 10 | --- /dev/null 11 | +++ b/src/main/java/io/papermc/paper/event/player/PlayerInsertBundleItemEvent.java 12 | @@ -0,0 +1,54 @@ 13 | +package io.papermc.paper.event.player; 14 | + 15 | +import org.bukkit.entity.Player; 16 | +import org.bukkit.event.Cancellable; 17 | +import org.bukkit.event.HandlerList; 18 | +import org.bukkit.event.player.PlayerEvent; 19 | +import org.bukkit.inventory.ItemStack; 20 | +import org.jetbrains.annotations.ApiStatus; 21 | +import org.jspecify.annotations.NullMarked; 22 | + 23 | +@NullMarked 24 | +public class PlayerInsertBundleItemEvent extends PlayerEvent implements Cancellable { 25 | + 26 | + private static final HandlerList HANDLER_LIST = new HandlerList(); 27 | + 28 | + private ItemStack bundle; 29 | + private ItemStack itemStack; 30 | + 31 | + private boolean cancelled; 32 | + 33 | + @ApiStatus.Internal 34 | + public PlayerInsertBundleItemEvent(final Player player, final ItemStack bundle, final ItemStack itemStack) { 35 | + super(player); 36 | + this.bundle = bundle; 37 | + this.itemStack = itemStack; 38 | + } 39 | + 40 | + public ItemStack getItemStack() { 41 | + return itemStack; 42 | + } 43 | + 44 | + public ItemStack getBundle() { 45 | + return bundle; 46 | + } 47 | + 48 | + @Override 49 | + public boolean isCancelled() { 50 | + return this.cancelled; 51 | + } 52 | + 53 | + @Override 54 | + public void setCancelled(final boolean cancel) { 55 | + this.cancelled = cancel; 56 | + } 57 | + 58 | + @Override 59 | + public HandlerList getHandlers() { 60 | + return HANDLER_LIST; 61 | + } 62 | + 63 | + public static HandlerList getHandlerList() { 64 | + return HANDLER_LIST; 65 | + } 66 | +} 67 | -------------------------------------------------------------------------------- /patches/api/0019-Add-PlayerPreRespawnEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 28 Dec 2024 07:59:54 -0600 4 | Subject: [PATCH] Add PlayerPreRespawnEvent 5 | 6 | 7 | diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnEvent.java 8 | new file mode 100644 9 | index 0000000000000000000000000000000000000000..53b830c7a349d58b1bb8b242b3edd144c6dcbdb0 10 | --- /dev/null 11 | +++ b/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnEvent.java 12 | @@ -0,0 +1,76 @@ 13 | +package io.papermc.paper.event.player; 14 | + 15 | +import org.apache.commons.lang3.Validate; 16 | +import org.bukkit.Location; 17 | +import org.bukkit.entity.Player; 18 | +import org.bukkit.event.Cancellable; 19 | +import org.bukkit.event.HandlerList; 20 | +import org.bukkit.event.player.PlayerEvent; 21 | +import org.bukkit.event.player.PlayerRespawnEvent; 22 | +import org.jetbrains.annotations.NotNull; 23 | +import org.jetbrains.annotations.Nullable; 24 | + 25 | +/** 26 | + * Called before a player's respawn location is determined. 27 | + */ 28 | +public class PlayerPreRespawnEvent extends PlayerEvent implements Cancellable { 29 | + private static final HandlerList handlers = new HandlerList(); 30 | + private final PlayerRespawnEvent.RespawnReason respawnReason; 31 | + private Location respawnLocation; 32 | + private boolean cancelled; 33 | + 34 | + public PlayerPreRespawnEvent(@NotNull final Player respawnPlayer, PlayerRespawnEvent.RespawnReason respawnReason) { 35 | + super(respawnPlayer); 36 | + this.respawnReason = respawnReason; 37 | + } 38 | + 39 | + /** 40 | + * Gets the current respawn location 41 | + * 42 | + * @return Location current respawn location 43 | + */ 44 | + @Nullable 45 | + public Location getRespawnLocation() { 46 | + return this.respawnLocation; 47 | + } 48 | + 49 | + /** 50 | + * Sets the new respawn location 51 | + * 52 | + * @param respawnLocation new location for the respawn 53 | + */ 54 | + public void setRespawnLocation(@NotNull Location respawnLocation) { 55 | + Validate.notNull(respawnLocation, "Respawn location can not be null"); 56 | + Validate.notNull(respawnLocation.getWorld(), "Respawn world can not be null"); 57 | + 58 | + this.respawnLocation = respawnLocation; 59 | + } 60 | + 61 | + /** 62 | + * @return Returns the reason the player was respawned. 63 | + */ 64 | + public PlayerRespawnEvent.RespawnReason getRespawnReason() { 65 | + return respawnReason; 66 | + } 67 | + 68 | + @NotNull 69 | + @Override 70 | + public HandlerList getHandlers() { 71 | + return handlers; 72 | + } 73 | + 74 | + @NotNull 75 | + public static HandlerList getHandlerList() { 76 | + return handlers; 77 | + } 78 | + 79 | + @Override 80 | + public boolean isCancelled() { 81 | + return cancelled; 82 | + } 83 | + 84 | + @Override 85 | + public void setCancelled(boolean cancel) { 86 | + this.cancelled = cancel; 87 | + } 88 | +} 89 | -------------------------------------------------------------------------------- /patches/server/0001-Build-changes.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 9 Nov 2024 09:30:20 -0600 4 | Subject: [PATCH] Build changes 5 | 6 | 7 | diff --git a/build.gradle.kts b/build.gradle.kts 8 | index faf3e3fd72e8c915e7a4803dacbe1bb576c6663e..63aa7a91dad0903383405c2cccf894d23a2ede54 100644 9 | --- a/build.gradle.kts 10 | +++ b/build.gradle.kts 11 | @@ -25,7 +25,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { 12 | // Paper end - configure mockito agent that is needed in newer java versions 13 | 14 | dependencies { 15 | - implementation(project(":paper-api")) 16 | + implementation(project(":slice-api")) 17 | // Paper start 18 | implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ 19 | implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 20 | @@ -99,14 +99,14 @@ tasks.jar { 21 | val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper 22 | attributes( 23 | "Main-Class" to "org.bukkit.craftbukkit.Main", 24 | - "Implementation-Title" to "Paper", 25 | + "Implementation-Title" to "Slice", 26 | "Implementation-Version" to implementationVersion, 27 | "Implementation-Vendor" to date, // Paper 28 | - "Specification-Title" to "Paper", 29 | + "Specification-Title" to "Slice", 30 | "Specification-Version" to project.version, 31 | - "Specification-Vendor" to "Paper Team", 32 | + "Specification-Vendor" to "Loka", 33 | "Brand-Id" to "papermc:paper", 34 | - "Brand-Name" to "Paper", 35 | + "Brand-Name" to "Slice", 36 | "Build-Number" to (build ?: ""), 37 | "Build-Time" to Instant.now().toString(), 38 | "Git-Branch" to gitBranch, // Paper 39 | @@ -172,7 +172,7 @@ fun TaskContainer.registerRunTask( 40 | name: String, 41 | block: JavaExec.() -> Unit 42 | ): TaskProvider = register(name) { 43 | - group = "paper" 44 | + group = "slice" 45 | mainClass.set("org.bukkit.craftbukkit.Main") 46 | standardInput = System.`in` 47 | workingDir = rootProject.layout.projectDirectory 48 | diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java 49 | index 790bad0494454ca12ee152e3de6da3da634d9b20..f4099ed9f6076d4fc216730878134c5e194fc017 100644 50 | --- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java 51 | +++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java 52 | @@ -30,7 +30,7 @@ public record ServerBuildInfoImpl( 53 | private static final String ATTRIBUTE_GIT_BRANCH = "Git-Branch"; 54 | private static final String ATTRIBUTE_GIT_COMMIT = "Git-Commit"; 55 | 56 | - private static final String BRAND_PAPER_NAME = "Paper"; 57 | + private static final String BRAND_SLICE_NAME = "Slice"; 58 | 59 | private static final String BUILD_DEV = "DEV"; 60 | 61 | @@ -44,7 +44,7 @@ public record ServerBuildInfoImpl( 62 | .map(Key::key) 63 | .orElse(BRAND_PAPER_ID), 64 | getManifestAttribute(manifest, ATTRIBUTE_BRAND_NAME) 65 | - .orElse(BRAND_PAPER_NAME), 66 | + .orElse(BRAND_SLICE_NAME), 67 | SharedConstants.getCurrentVersion().getId(), 68 | SharedConstants.getCurrentVersion().getName(), 69 | getManifestAttribute(manifest, ATTRIBUTE_BUILD_NUMBER) 70 | @@ -61,7 +61,7 @@ public record ServerBuildInfoImpl( 71 | 72 | @Override 73 | public boolean isBrandCompatible(final @NotNull Key brandId) { 74 | - return brandId.equals(this.brandId); 75 | + return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID); 76 | } 77 | 78 | @Override 79 | diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java 80 | index 774556a62eb240da42e84db4502e2ed43495be17..7cf4712a774ff73818991c5fd7fe067ff2b83d35 100644 81 | --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java 82 | +++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java 83 | @@ -11,7 +11,7 @@ public final class Versioning { 84 | public static String getBukkitVersion() { 85 | String result = "Unknown-Version"; 86 | 87 | - InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties"); 88 | + InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.lokamc.slice/slice-api/pom.properties"); 89 | Properties properties = new Properties(); 90 | 91 | if (stream != null) { 92 | -------------------------------------------------------------------------------- /patches/server/0002-Add-BlockDestroyedByNeighborEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 9 Nov 2024 09:48:21 -0600 4 | Subject: [PATCH] Add BlockDestroyedByNeighborEvent 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java 8 | index a96f859a5d0c6ec692d4627a69f3c9ee49199dbc..7fe358dac8740ac6338a942f4189bca300d1f1be 100644 9 | --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java 10 | +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java 11 | @@ -425,6 +425,7 @@ public class ServerPlayerGameMode { 12 | this.level.captureDrops = new ArrayList<>(); 13 | // CraftBukkit end 14 | BlockState iblockdata1 = block.playerWillDestroy(this.level, pos, iblockdata, this.player); 15 | + level.pendingPlayerBlockEvents.put(pos, new Level.PendingBlockEvent(pos, this.player)); // Paper 16 | boolean flag = this.level.removeBlock(pos, false); 17 | 18 | if (flag) { 19 | @@ -452,6 +453,7 @@ public class ServerPlayerGameMode { 20 | // CraftBukkit start 21 | java.util.List itemsToDrop = this.level.captureDrops; // Paper - capture all item additions to the world 22 | this.level.captureDrops = null; // Paper - capture all item additions to the world; Remove this earlier so that we can actually drop stuff 23 | + level.pendingPlayerBlockEvents.remove(pos); // Paper 24 | if (event.isDropItems()) { 25 | org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - capture all item additions to the world 26 | } 27 | diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java 28 | index 33e7d2884195677c4d6340d8b84c1dd85c636ec1..04f8269abe339610795237652edcd54ba31bc5fc 100644 29 | --- a/src/main/java/net/minecraft/world/item/ItemStack.java 30 | +++ b/src/main/java/net/minecraft/world/item/ItemStack.java 31 | @@ -424,6 +424,7 @@ public final class ItemStack implements DataComponentHolder { 32 | DataComponentPatch oldData = this.components.asPatch(); 33 | int oldCount = this.getCount(); 34 | ServerLevel world = (ServerLevel) context.getLevel(); 35 | + if (entityhuman != null) world.pendingPlayerBlockEvents.put(blockposition, new Level.PendingBlockEvent(blockposition, entityhuman)); // Paper 36 | 37 | if (!(item instanceof BucketItem/* || item instanceof SolidBucketItem*/)) { // if not bucket // Paper - Fix cancelled powdered snow bucket placement 38 | world.captureBlockStates = true; 39 | diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java 40 | index 022de445bbbb869c38be4972c98dcf1c665539ec..abdbfb6bc3989bdc9332712be3c71b2afbf43c48 100644 41 | --- a/src/main/java/net/minecraft/world/level/Level.java 42 | +++ b/src/main/java/net/minecraft/world/level/Level.java 43 | @@ -181,6 +181,28 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl 44 | public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions 45 | public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here 46 | 47 | + // Paper start - Holder class used to track what Player is responsible the last block event 48 | + public static class PendingBlockEvent { 49 | + 50 | + public final BlockPos block; 51 | + public final Player player; 52 | + public @Nullable BlockPos sourceBlock; 53 | + 54 | + public PendingBlockEvent(BlockPos block, Player player) { 55 | + this(block, player, null); 56 | + } 57 | + 58 | + public PendingBlockEvent(BlockPos block, Player player, @Nullable BlockPos sourceBlock) { 59 | + this.block = block; 60 | + this.player = player; 61 | + this.sourceBlock = sourceBlock; 62 | + } 63 | + 64 | + } 65 | + public final Map pendingPlayerBlockEvents = new HashMap<>(); 66 | + // Paper end 67 | + 68 | + 69 | public CraftWorld getWorld() { 70 | return this.world; 71 | } 72 | @@ -1225,6 +1247,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl 73 | if (!this.preventPoiUpdated) { 74 | this.onBlockStateChange(blockposition, iblockdata1, iblockdata2); 75 | } 76 | + pendingPlayerBlockEvents.remove(blockposition); // Paper 77 | // CraftBukkit end 78 | } 79 | } 80 | @@ -1246,6 +1269,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl 81 | if (iblockdata.isAir()) { 82 | return false; 83 | } else { 84 | + // Paper start 85 | + PendingBlockEvent blockEvent = pendingPlayerBlockEvents.get(pos); 86 | + if (blockEvent != null && blockEvent.sourceBlock != null) { 87 | + io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event = 88 | + new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this, pos), 89 | + (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(), 90 | + org.bukkit.craftbukkit.block.CraftBlock.at(this, blockEvent.sourceBlock)); 91 | + event.callEvent(); 92 | + } 93 | + // Paper end 94 | + 95 | FluidState fluid = this.getFluidState(pos); 96 | // Paper start - BlockDestroyEvent; while the above setAir method is named same and looks very similar 97 | // they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent, 98 | diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java 99 | index 4fe83bd0f355549847b66afb7e61f6f2a6d97016..be6e6247d1a94271926544b128a52f501bc2cad5 100644 100 | --- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java 101 | +++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java 102 | @@ -114,6 +114,15 @@ public class DoublePlantBlock extends BushBlock { 103 | BlockPos blockposition1 = pos.below(); 104 | BlockState iblockdata1 = world.getBlockState(blockposition1); 105 | 106 | + Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos); 107 | + if (blockEvent != null) { 108 | + io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event = 109 | + new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition1), 110 | + (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(), 111 | + org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)); 112 | + if (!event.callEvent()) return; 113 | + } 114 | + 115 | if (iblockdata1.is(state.getBlock()) && iblockdata1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER) { 116 | BlockState iblockdata2 = iblockdata1.getFluidState().is((Fluid) Fluids.WATER) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState(); 117 | 118 | 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 119 | index 99fd67a78539133adf78d65e2c520ff3dd260301..12d9c6769c8cb705d232bc01b50b04df503e4c3a 100644 120 | --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java 121 | +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java 122 | @@ -1237,11 +1237,22 @@ public abstract class BlockBehaviour implements FeatureElement { 123 | BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(); 124 | Direction[] aenumdirection = BlockBehaviour.UPDATE_SHAPE_ORDER; 125 | int k = aenumdirection.length; 126 | + BlockState blockState = world.getBlockState(pos); // Slice 127 | 128 | for (int l = 0; l < k; ++l) { 129 | Direction enumdirection = aenumdirection[l]; 130 | 131 | blockposition_mutableblockposition.setWithOffset(pos, enumdirection); 132 | + // Paper start - Propagate the PendingBlockEvent from the current blockPos to the next block 133 | + // if it will break (!canSurvive) 134 | + if (blockState.getBukkitMaterial() == org.bukkit.Material.AIR && !world.getBlockState(blockposition_mutableblockposition).canSurvive(world, blockposition_mutableblockposition)) { 135 | + Level.PendingBlockEvent blockEvent = ((Level) world).pendingPlayerBlockEvents.get(pos); 136 | + if (blockEvent != null) { 137 | + BlockPos blockPosCopy = blockposition_mutableblockposition.immutable(); 138 | + ((Level) world).pendingPlayerBlockEvents.put(blockPosCopy, new Level.PendingBlockEvent(blockPosCopy, blockEvent.player, pos)); 139 | + } 140 | + } 141 | + // Paper end 142 | world.neighborShapeChanged(enumdirection.getOpposite(), blockposition_mutableblockposition, pos, this.asState(), flags, maxUpdateDepth); 143 | } 144 | 145 | -------------------------------------------------------------------------------- /patches/server/0003-Add-provided-Material-to-getDrops.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 9 Nov 2024 09:54:36 -0600 4 | Subject: [PATCH] Add provided Material to getDrops 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java 8 | index 5cb69d0b822e11a99a96aef4f59986d083b079f4..632f9d98eb0a7a641ce879afcf838b6a96077ef6 100644 9 | --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java 10 | +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java 11 | @@ -592,7 +592,18 @@ public class CraftBlock implements Block { 12 | 13 | @Override 14 | public Collection getDrops(ItemStack item, Entity entity) { 15 | - net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS(); 16 | + return getDrops(null, item, entity); // Slice start 17 | + } 18 | + 19 | + @Override 20 | + public Collection getDrops(Material blockType, ItemStack item, Entity entity) { 21 | + net.minecraft.world.level.block.state.BlockState iblockdata; 22 | + if (blockType == null) { 23 | + iblockdata = this.getNMS(); 24 | + } else { 25 | + iblockdata = ((CraftBlockData) blockType.createBlockData()).getState(); 26 | + } 27 | + 28 | net.minecraft.world.item.ItemStack nms = CraftItemStack.asNMSCopy(item); 29 | 30 | // Modelled off EntityHuman#hasBlock 31 | @@ -603,6 +614,7 @@ public class CraftBlock implements Block { 32 | return Collections.emptyList(); 33 | } 34 | } 35 | + // Slice end 36 | 37 | @Override 38 | public boolean isPreferredTool(ItemStack item) { 39 | -------------------------------------------------------------------------------- /patches/server/0004-Add-Player-to-SpongeAbsorbEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 9 Nov 2024 09:55:18 -0600 4 | Subject: [PATCH] Add Player to SpongeAbsorbEvent 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java 8 | index 59cf905b1b5686f6f4f2bad94730ffa69d3a2834..7a8c80fe0df7a758751e2109e69934d5abfa0060 100644 9 | --- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java 10 | +++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java 11 | @@ -117,7 +117,8 @@ public class SpongeBlock extends Block { 12 | if (!blocks.isEmpty()) { 13 | final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); 14 | 15 | - SpongeAbsorbEvent event = new SpongeAbsorbEvent(bblock, (List) (List) blocks); 16 | + Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos); // Paper 17 | + SpongeAbsorbEvent event = new SpongeAbsorbEvent(bblock, blockEvent != null ? (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity() : null, (List) (List) blocks); // Paper 18 | world.getCraftServer().getPluginManager().callEvent(event); 19 | 20 | if (event.isCancelled()) { 21 | -------------------------------------------------------------------------------- /patches/server/0005-Add-World-Instance-flag.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 9 Nov 2024 09:56:09 -0600 4 | Subject: [PATCH] Add World Instance flag 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java 8 | index 585e2b43a0326f0b81597fa1234d3c67c76af550..e256e5ff5c167c6cff5b9e985cdc80d5c9203708 100644 9 | --- a/src/main/java/net/minecraft/server/level/ServerLevel.java 10 | +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java 11 | @@ -231,6 +231,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe 12 | public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent 13 | public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent 14 | private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current) 15 | + public boolean instance; // Slice 16 | 17 | public LevelChunk getChunkIfLoaded(int x, int z) { 18 | return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately 19 | diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java 20 | index 57da11c0da7322e74810e7108e9c8000b0c36520..68e3dee346fe013f8e69900a0911583f851d2782 100644 21 | --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java 22 | +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java 23 | @@ -1330,6 +1330,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { 24 | this.world.noSave = !value; 25 | } 26 | 27 | + // Slice start 28 | + @Override 29 | + public boolean isInstance() { 30 | + return world.instance; 31 | + } 32 | + 33 | + @Override 34 | + public void setInstance(boolean value) { 35 | + world.instance = value; 36 | + } 37 | + // Slice end 38 | + 39 | @Override 40 | public void setDifficulty(Difficulty difficulty) { 41 | this.getHandle().getServer().setDifficulty(this.getHandle(), net.minecraft.world.Difficulty.byId(difficulty.getValue()), true); // Paper - per level difficulty; don't skip other difficulty-changing logic 42 | -------------------------------------------------------------------------------- /patches/server/0006-Smooth-Teleports.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sun, 10 Nov 2024 09:34:07 -0600 4 | Subject: [PATCH] Smooth Teleports 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java 8 | index 5a8f396d47577f087abb415c972fd4f51e50faba..69c9cec8b397832340d683fc38d04c7ecd469a05 100644 9 | --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java 10 | +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java 11 | @@ -329,6 +329,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple 12 | public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent 13 | public @Nullable String clientBrandName = null; // Paper - Brand support 14 | public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event 15 | + public boolean smoothWorldTeleport = false; // Slice 16 | 17 | // Paper start - rewrite chunk system 18 | private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader; 19 | diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java 20 | index 30de3d1a7792c38ae946f19cb0e14637919b5001..b775de1732238954e9bbbd072277254d2dc91b18 100644 21 | --- a/src/main/java/net/minecraft/server/players/PlayerList.java 22 | +++ b/src/main/java/net/minecraft/server/players/PlayerList.java 23 | @@ -844,8 +844,7 @@ public abstract class PlayerList { 24 | ServerLevel worldserver1 = entityplayer1.serverLevel(); 25 | LevelData worlddata = worldserver1.getLevelData(); 26 | 27 | - entityplayer1.connection.send(new ClientboundRespawnPacket(entityplayer1.createCommonSpawnInfo(worldserver1), (byte) i)); 28 | - entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.spigotConfig.viewDistance)); // Spigot 29 | + if (!entityplayer1.smoothWorldTeleport) entityplayer1.connection.send(new ClientboundRespawnPacket(entityplayer1.createCommonSpawnInfo(worldserver1), (byte) i)); // Slice 30 | entityplayer1.connection.send(new ClientboundSetSimulationDistancePacket(worldserver1.spigotConfig.simulationDistance)); // Spigot 31 | entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver1.getWorld(), entityplayer1.getYRot(), entityplayer1.getXRot())); // CraftBukkit 32 | entityplayer1.connection.send(new ClientboundSetDefaultSpawnPositionPacket(worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle())); 33 | @@ -1213,7 +1212,7 @@ public abstract class PlayerList { 34 | // CraftBukkit end 35 | } 36 | 37 | - player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F)); 38 | + if (!player.smoothWorldTeleport) player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F)); // Slice 39 | this.server.tickRateManager().updateJoiningPlayer(player); 40 | } 41 | 42 | diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 43 | index 554714e449d1d2439b05d7e15f72afccd17d4df5..adf8f0ddde16f08b10cd733eeabf9d40db77001b 100644 44 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 45 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 46 | @@ -1361,6 +1361,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { 47 | // Paper end - Teleportation API 48 | } 49 | 50 | + // Slice start 51 | + public void teleportWithoutRespawn(Location location) { 52 | + ServerPlayer serverPlayer = getHandle(); 53 | + serverPlayer.smoothWorldTeleport = true; 54 | + teleport(location); 55 | + serverPlayer.smoothWorldTeleport = false; 56 | + } 57 | + // Slice end 58 | + 59 | @Override 60 | public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) { 61 | // Paper start - Teleport API 62 | -------------------------------------------------------------------------------- /patches/server/0007-Allow-opening-covered-chests.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Wed, 13 Nov 2024 07:44:28 -0600 4 | Subject: [PATCH] Allow opening covered chests 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java 8 | index edef8fc62f8dba1b57214d8d7d805ff0d83f4114..c948eb36db7f902ce65523e19651057e39a1a8ad 100644 9 | --- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java 10 | +++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java 11 | @@ -341,9 +341,7 @@ public class ChestBlock extends AbstractChestBlock implements 12 | } 13 | 14 | public static boolean isBlockedChestByBlock(BlockGetter world, BlockPos pos) { 15 | - BlockPos blockposition1 = pos.above(); 16 | - 17 | - return world.getBlockState(blockposition1).isRedstoneConductor(world, blockposition1); 18 | + return false; // Slice 19 | } 20 | 21 | private static boolean isCatSittingOnChest(LevelAccessor world, BlockPos pos) { 22 | diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java 23 | index 2a207fb2e1c26b562de42240e11c856bd2a23458..601746d00c1afd85ca8a0c5578ef587e6a231bcf 100644 24 | --- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java 25 | +++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java 26 | @@ -83,7 +83,7 @@ public class EnderChestBlock extends AbstractChestBlock i 27 | PlayerEnderChestContainer playerEnderChestContainer = player.getEnderChestInventory(); 28 | if (playerEnderChestContainer != null && world.getBlockEntity(pos) instanceof EnderChestBlockEntity enderChestBlockEntity) { 29 | BlockPos blockPos = pos.above(); 30 | - if (world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) { // Paper - diff on change; make sure that EnderChest#isBlocked uses the same logic 31 | + if (false) { // Slice - allow block on top to not block opening // world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) { // Paper - diff on change; make sure that EnderChest#isBlocked uses the same logic 32 | return InteractionResult.SUCCESS; 33 | } else { 34 | // Paper start - Fix InventoryOpenEvent cancellation - moved up; 35 | diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java 36 | index f45ee675a10729845bf376fa95e648b23b9aac12..bb59827851262051bc832f32bf54877b6a896990 100644 37 | --- a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java 38 | +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java 39 | @@ -62,9 +62,7 @@ public class CraftEnderChest extends CraftBlockEntityState 3 | Date: Wed, 13 Nov 2024 07:49:32 -0600 4 | Subject: [PATCH] Add Force Crit to PlayerPreAttackEntityEvent 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java 8 | index 61d412c4f1ebd55661cc3f0260468e3ac0efe0bb..551da84c834132d106457c123e1b195e4be904b8 100644 9 | --- a/src/main/java/net/minecraft/world/entity/player/Player.java 10 | +++ b/src/main/java/net/minecraft/world/entity/player/Player.java 11 | @@ -1269,7 +1269,7 @@ public abstract class Player extends LivingEntity { 12 | } 13 | 14 | f += itemstack.getItem().getAttackDamageBonus(target, f, damagesource); 15 | - boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting(); 16 | + boolean flag2 = playerAttackEntityEvent.isForceCrit() || (flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting()); // Slice 17 | 18 | flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits 19 | if (flag2) { 20 | -------------------------------------------------------------------------------- /patches/server/0009-Allow-access-to-LightEngine.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Wed, 13 Nov 2024 07:54:14 -0600 4 | Subject: [PATCH] Allow access to LightEngine 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java 8 | index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..50a5514c9109f71926594d3f4786bd0995fc2d84 100644 9 | --- a/src/main/java/net/minecraft/server/level/ChunkMap.java 10 | +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java 11 | @@ -298,7 +298,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider 12 | return ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getPlayerChunkLoader().isChunkSent(player, chunkX, chunkZ, true); // Paper - rewrite chunk system 13 | } 14 | 15 | - protected ThreadedLevelLightEngine getLightEngine() { 16 | + public ThreadedLevelLightEngine getLightEngine() { // Slice (public) 17 | return this.lightEngine; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /patches/server/0010-Don-t-send-fire-packets-if-player-has-FR.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Wed, 13 Nov 2024 07:55:27 -0600 4 | Subject: [PATCH] Don't send fire packets if player has FR 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java 8 | index a15546e433ebba6c0de01bdaaef201a3d99a87b5..55b9b33ce85cdff75de8753e6294c99bb1b1f7ee 100644 9 | --- a/src/main/java/net/minecraft/world/entity/Entity.java 10 | +++ b/src/main/java/net/minecraft/world/entity/Entity.java 11 | @@ -949,7 +949,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess 12 | 13 | this.checkBelowWorld(); 14 | if (!this.level().isClientSide) { 15 | - this.setSharedFlagOnFire(this.remainingFireTicks > 0); 16 | + if (this instanceof net.minecraft.world.entity.LivingEntity livingEntity) { 17 | + this.setSharedFlagOnFire(this.remainingFireTicks > 0 && !livingEntity.hasEffect(net.minecraft.world.effect.MobEffects.FIRE_RESISTANCE)); 18 | + } else { 19 | + this.setSharedFlagOnFire(this.remainingFireTicks > 0); 20 | + } 21 | } 22 | 23 | this.firstTick = false; 24 | -------------------------------------------------------------------------------- /patches/server/0011-Allow-inventory-clicks-in-Spectator.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Wed, 13 Nov 2024 07:58:14 -0600 4 | Subject: [PATCH] Allow inventory clicks in Spectator 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java 8 | index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..7644dfe30a51295ac3fa59384153c839fa781c01 100644 9 | --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java 10 | +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java 11 | @@ -2991,7 +2991,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl 12 | if (this.player.isImmobile()) return; // CraftBukkit 13 | this.player.resetLastActionTime(); 14 | if (this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu.stillValid(this.player)) { // CraftBukkit 15 | - boolean cancelled = this.player.isSpectator(); // CraftBukkit - see below if 16 | + boolean cancelled = false; //Slice - allow spectator inv management this.player.isSpectator(); // CraftBukkit - see below if 17 | if (false/*this.player.isSpectator()*/) { // CraftBukkit 18 | this.player.containerMenu.sendAllDataToRemote(); 19 | } else if (!this.player.containerMenu.stillValid(this.player)) { 20 | -------------------------------------------------------------------------------- /patches/server/0012-Add-reason-to-PlayerConnectionCloseEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Wed, 13 Nov 2024 08:04:09 -0600 4 | Subject: [PATCH] Add reason to PlayerConnectionCloseEvent 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java 8 | index 880e5c52746e9e3a9a1f42ec6461be54e3ee136c..e8eeb1aaeec6d87af949e249d0ffd0856bfd71b1 100644 9 | --- a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java 10 | +++ b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java 11 | @@ -180,6 +180,7 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis 12 | // Paper end - Debugging 13 | this.connection.send(new ClientboundDisconnectPacket(ServerConfigurationPacketListenerImpl.DISCONNECT_REASON_INVALID_DATA)); 14 | this.connection.disconnect(ServerConfigurationPacketListenerImpl.DISCONNECT_REASON_INVALID_DATA); 15 | + 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 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /patches/server/0013-Change-KeepAlive-interval.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Wed, 13 Nov 2024 08:04:58 -0600 4 | Subject: [PATCH] Change KeepAlive interval 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java 8 | index b0bc66dc7248aae691dcab68b925b52a1695e63f..7096cbc201cd18e71b5da6b825fca83201ada1a3 100644 9 | --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java 10 | +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java 11 | @@ -261,7 +261,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack 12 | long currentTime = Util.getMillis(); 13 | long elapsedTime = currentTime - this.keepAliveTime; 14 | 15 | - if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets 16 | + if (!this.isSingleplayerOwner() && elapsedTime >= 5000L) { // Paper - use vanilla's 15000L between keep alive packets // Slice -> 5s 17 | if (this.keepAlivePending && !this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected 18 | this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause 19 | } else if (this.checkIfClosed(currentTime)) { // Paper 20 | -------------------------------------------------------------------------------- /patches/server/0014-Equipment-Packet-Caching.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Wed, 13 Nov 2024 08:07:59 -0600 4 | Subject: [PATCH] Equipment Packet Caching 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java 8 | index 830bd76916e26a3a54954d3cf7b7520af52a2258..dc9c7a844c2aee1dae80006eafe085c6fa126ae1 100644 9 | --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java 10 | +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java 11 | @@ -30,6 +30,16 @@ public class ClientboundSetEquipmentPacket implements Packet> equipmentList, net.minecraft.world.entity.LivingEntity entity, boolean sanitize, String tag) { 16 | + this.entity = id; 17 | + this.sanitize = sanitize; 18 | + slots = new java.util.ArrayList<>(equipmentList.size()); 19 | + for (Pair pair : equipmentList) { 20 | + EquipmentSlot slot = pair.getFirst(); 21 | + slots.add(Pair.of(slot, entity.getOrCreateCachedEquipmentItem(tag, slot, pair.getSecond()))); 22 | + } 23 | + } 24 | + 25 | private ClientboundSetEquipmentPacket(RegistryFriendlyByteBuf buf) { 26 | this.entity = buf.readVarInt(); 27 | this.slots = Lists.newArrayList(); 28 | diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java 29 | index 90eb4927fa51ce3df86aa7b6c71f49150a03e337..a6c3beb9d5ab87fca882e1761983ebe385011296 100644 30 | --- a/src/main/java/net/minecraft/server/level/ServerEntity.java 31 | +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java 32 | @@ -388,22 +388,7 @@ public class ServerEntity { 33 | Entity entity = this.entity; 34 | 35 | if (entity instanceof LivingEntity entityliving) { 36 | - List> list = Lists.newArrayList(); 37 | - Iterator iterator = EquipmentSlot.VALUES.iterator(); 38 | - 39 | - while (iterator.hasNext()) { 40 | - EquipmentSlot enumitemslot = (EquipmentSlot) iterator.next(); 41 | - ItemStack itemstack = entityliving.getItemBySlot(enumitemslot); 42 | - 43 | - if (!itemstack.isEmpty()) { 44 | - list.add(Pair.of(enumitemslot, itemstack.copy())); 45 | - } 46 | - } 47 | - 48 | - if (!list.isEmpty()) { 49 | - sender.accept(new ClientboundSetEquipmentPacket(this.entity.getId(), list, true)); // Paper - data sanitization 50 | - } 51 | - ((LivingEntity) this.entity).detectEquipmentUpdatesPublic(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending 52 | + entityliving.sendEquipment(sender, player); 53 | } 54 | 55 | if (!this.entity.getPassengers().isEmpty()) { 56 | diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java 57 | index f36a075dbee2b96d01899e02460b1d8443e91749..0634626d4a0bda9ac58f1fd16265ca866ee9f5c3 100644 58 | --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java 59 | +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java 60 | @@ -298,6 +298,11 @@ public abstract class LivingEntity extends Entity implements Attackable { 61 | public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event 62 | public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API 63 | 64 | + // Slice start 65 | + private static final java.util.Map> equipmentPacketCache = new java.util.HashMap<>(); 66 | + protected final java.util.Map cachedEquipmentPacket = new java.util.HashMap<>(); 67 | + // Slice end 68 | + 69 | @Override 70 | public float getBukkitYaw() { 71 | return this.getYHeadRot(); 72 | @@ -3383,6 +3388,7 @@ public abstract class LivingEntity extends Entity implements Attackable { 73 | if (map != null) { 74 | this.handleHandSwap(map); 75 | if (!map.isEmpty()) { 76 | + cachedEquipmentPacket.clear(); // Slice - Must invalidate cached equipment map if we have changes 77 | this.handleEquipmentChanges(map); 78 | } 79 | } 80 | @@ -3507,7 +3513,25 @@ public abstract class LivingEntity extends Entity implements Attackable { 81 | } 82 | 83 | }); 84 | - ((ServerLevel) this.level()).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list, true)); // Paper - data sanitization 85 | + 86 | + // Slice start 87 | + net.minecraft.server.level.ChunkMap.TrackedEntity entityTracker = ((ServerLevel) this.level()).getChunkSource().chunkMap.entityMap.get(getId()); 88 | + if (entityTracker != null) { 89 | + ClientboundSetEquipmentPacket packet = new ClientboundSetEquipmentPacket(this.getId(), list); 90 | + for (net.minecraft.server.network.ServerPlayerConnection playerConnection : entityTracker.seenBy) { 91 | + ServerPlayer player = playerConnection.getPlayer(); 92 | + org.bukkit.event.player.PlayerReceiveEquipmentEvent event = new org.bukkit.event.player.PlayerReceiveEquipmentEvent(player.getBukkitEntity(), getBukkitEntity()); 93 | + level().getCraftServer().getPluginManager().callEvent(event); 94 | + 95 | + String tag = event.getTag(); 96 | + if (tag != null) { 97 | + playerConnection.send(new ClientboundSetEquipmentPacket(this.getId(), list, this, false, tag)); 98 | + } else { 99 | + playerConnection.send(packet); 100 | + } 101 | + } 102 | + } 103 | + // Slice end 104 | } 105 | 106 | private ItemStack getLastArmorItem(EquipmentSlot slot) { 107 | @@ -4803,4 +4827,84 @@ public abstract class LivingEntity extends Entity implements Attackable { 108 | public static record Fallsounds(SoundEvent small, SoundEvent big) { 109 | 110 | } 111 | + 112 | + // Slice start 113 | + public static void invalidateCachedEquipment(String tag) { 114 | + com.google.common.cache.Cache removedCache = equipmentPacketCache.remove(tag); 115 | + if (removedCache != null) { 116 | + removedCache.asMap().clear(); 117 | + } 118 | + } 119 | + 120 | + public ItemStack getOrCreateCachedEquipmentItem(String tag, EquipmentSlot slot, ItemStack itemStack) { 121 | + return equipmentPacketCache.computeIfAbsent(tag, s -> com.google.common.cache.CacheBuilder.newBuilder() 122 | + .expireAfterAccess(10, java.util.concurrent.TimeUnit.MINUTES) 123 | + .build()) 124 | + .asMap() 125 | + .computeIfAbsent(itemStack.hashCode(), i -> { 126 | + String name = slot.name(); 127 | + 128 | + //How neat is this. 129 | + if (name.equals("MAINHAND")) { 130 | + name = "HAND"; 131 | + } else if (name.equals("OFFHAND")) { 132 | + name = "OFF_HAND"; 133 | + } 134 | + 135 | + org.bukkit.event.entity.EntityEquipmentItemLookup event = new org.bukkit.event.entity.EntityEquipmentItemLookup(getBukkitEntity(), tag, org.bukkit.inventory.EquipmentSlot.valueOf(name), CraftItemStack.asBukkitCopy(itemStack)); 136 | + this.level().getCraftServer().getPluginManager().callEvent(event); 137 | + org.bukkit.inventory.ItemStack eventItem = event.getItemStack(); 138 | + return CraftItemStack.asNMSCopy(eventItem); 139 | + }); 140 | + } 141 | + // Slice end 142 | + 143 | + // Slice start 144 | + public void sendEquipment(java.util.function.Consumer> consumer, ServerPlayer p) { 145 | + org.bukkit.event.player.PlayerReceiveEquipmentEvent event = new org.bukkit.event.player.PlayerReceiveEquipmentEvent(p.getBukkitEntity(), getBukkitEntity()); 146 | + level().getCraftServer().getPluginManager().callEvent(event); 147 | + 148 | + boolean sendEquipment = !event.isCancelled(); 149 | + String tag = event.getTag(); 150 | + if (sendEquipment && this instanceof ServerPlayer player && tag != null) { 151 | + ClientboundSetEquipmentPacket equipmentPacket = player.cachedEquipmentPacket.get(tag); 152 | + if (equipmentPacket != null) { 153 | + //Event says use a tag, and our tag exists; so we simply used our entire cached packet 154 | + consumer.accept(equipmentPacket); 155 | + return; 156 | + } 157 | + } 158 | + 159 | + if (sendEquipment) { 160 | + List> list = Lists.newArrayList(); 161 | + Iterator iterator = EquipmentSlot.VALUES.iterator(); 162 | + 163 | + while (iterator.hasNext()) { 164 | + EquipmentSlot enumitemslot = (EquipmentSlot) iterator.next(); 165 | + ItemStack itemstack = getItemBySlot(enumitemslot); 166 | + 167 | + if (!itemstack.isEmpty()) { 168 | + ItemStack finalItemStack; 169 | + if (tag != null) { 170 | + finalItemStack = getOrCreateCachedEquipmentItem(tag, enumitemslot, itemstack); 171 | + } else { 172 | + finalItemStack = itemstack.copy(); 173 | + } 174 | + 175 | + list.add(Pair.of(enumitemslot, finalItemStack)); 176 | + } 177 | + } 178 | + 179 | + if (!list.isEmpty()) { 180 | + ClientboundSetEquipmentPacket equipmentPacket = new ClientboundSetEquipmentPacket(getId(), list, true); 181 | + if (tag != null) { 182 | + cachedEquipmentPacket.put(tag, equipmentPacket); 183 | + } 184 | + consumer.accept(equipmentPacket); 185 | + } 186 | + 187 | + detectEquipmentUpdatesPublic(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending 188 | + } 189 | + } 190 | + // Slice end 191 | } 192 | diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java 193 | index d0c409f4efad289e3e325f44b500fc72589d89d4..baecf1c7bb459786bdbe6f7381ef148e0dad0ef5 100644 194 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java 195 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java 196 | @@ -1205,6 +1205,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { 197 | } 198 | // Paper end - body yaw API 199 | 200 | + // Slice start 201 | + @Override 202 | + public void sendEquipment(Player p) { 203 | + if (entity instanceof net.minecraft.world.entity.LivingEntity livingEntity) { 204 | + net.minecraft.server.level.ServerPlayer serverPlayer = ((CraftPlayer) p).getHandle(); 205 | + livingEntity.sendEquipment(packet -> serverPlayer.connection.send(packet), serverPlayer); 206 | + } 207 | + } 208 | + // Slice end 209 | + 210 | // Paper start - Expose canUseSlot 211 | @Override 212 | public boolean canUseEquipmentSlot(org.bukkit.inventory.EquipmentSlot slot) { 213 | -------------------------------------------------------------------------------- /patches/server/0015-Add-ChunkStatusChangeEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 16 Nov 2024 08:48:20 -0600 4 | Subject: [PATCH] Add ChunkStatusChangeEvent 5 | 6 | 7 | diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java 8 | index eafa4e6d55cd0f9314ac0f2b96a7f48fbb5e1a4c..ee5f51bc5f31f269bdac239cb48265ae355db1ff 100644 9 | --- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java 10 | +++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java 11 | @@ -1261,6 +1261,13 @@ public final class NewChunkHolder { 12 | // note: currentChunk must be LevelChunk, as current != pending which means that at least one is not ACCESSIBLE 13 | final LevelChunk chunk = (LevelChunk)this.currentChunk; 14 | 15 | + // Slice start 16 | + new com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent(new org.bukkit.craftbukkit.CraftChunk(chunk), 17 | + com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(current.name()), 18 | + com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(current.name())) 19 | + .callEvent(); 20 | + // Slice end 21 | + 22 | // Note: we assume that only load/unload contain plugin logic 23 | // plugin logic is anything stupid enough to possibly change the chunk status while it is already 24 | // being changed (i.e during load it is possible it will try to set to full ticking) 25 | -------------------------------------------------------------------------------- /patches/server/0016-Biome-freeze-override.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 16 Nov 2024 08:58:56 -0600 4 | Subject: [PATCH] Biome freeze override 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java 8 | index b725eea9d3ca81d2ef7802f5d0346d924aa1f808..1d903fa83432ed971f784b8cb244b0c5b163830e 100644 9 | --- a/src/main/java/net/minecraft/world/level/biome/Biome.java 10 | +++ b/src/main/java/net/minecraft/world/level/biome/Biome.java 11 | @@ -71,6 +71,7 @@ public final class Biome { 12 | long2FloatLinkedOpenHashMap.defaultReturnValue(Float.NaN); 13 | return long2FloatLinkedOpenHashMap; 14 | })); 15 | + public Boolean canFreeze = null; // Slice 16 | 17 | Biome(Biome.ClimateSettings weather, BiomeSpecialEffects effects, BiomeGenerationSettings generationSettings, MobSpawnSettings spawnSettings) { 18 | this.climateSettings = weather; 19 | @@ -120,6 +121,8 @@ public final class Biome { 20 | } 21 | 22 | public boolean shouldFreeze(LevelReader world, BlockPos pos, boolean doWaterCheck) { 23 | + if (canFreeze != null) return canFreeze; // Slice 24 | + 25 | if (this.warmEnoughToRain(pos, world.getSeaLevel())) { 26 | return false; 27 | } else { 28 | -------------------------------------------------------------------------------- /patches/server/0017-Add-Vanish.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 16 Nov 2024 09:10:35 -0600 4 | Subject: [PATCH] Add Vanish 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java 8 | index 55b9b33ce85cdff75de8753e6294c99bb1b1f7ee..9bb19124498370c5b5ecaff10f523ee6e391b767 100644 9 | --- a/src/main/java/net/minecraft/world/entity/Entity.java 10 | +++ b/src/main/java/net/minecraft/world/entity/Entity.java 11 | @@ -389,6 +389,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess 12 | public boolean freezeLocked = false; // Paper - Freeze Tick Lock API 13 | public boolean fixedPose = false; // Paper - Expand Pose API 14 | private final int despawnTime; // Paper - entity despawn time limit 15 | + public boolean vanished; // Slice 16 | 17 | public void setOrigin(@javax.annotation.Nonnull Location location) { 18 | this.origin = location.toVector(); 19 | @@ -1389,7 +1390,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess 20 | } 21 | 22 | private boolean vibrationAndSoundEffectsFromBlock(BlockPos pos, BlockState state, boolean playSound, boolean emitEvent, Vec3 movement) { 23 | - if (state.isAir()) { 24 | + if (vanished || state.isAir()) { // Slice 25 | return false; 26 | } else { 27 | boolean flag2 = this.isStateClimbable(state); 28 | diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 29 | index ddabaed899c755925ad8618b78c33dacaf2126ac..aefa94ffd630e2dd6aefd547664ae25d2a81420c 100644 30 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 31 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 32 | @@ -1306,4 +1306,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { 33 | } 34 | } 35 | // Paper end - broadcast hurt animation 36 | + 37 | + // Slice start 38 | + @Override 39 | + public boolean isVanished() { 40 | + return this.entity.vanished; 41 | + } 42 | + 43 | + @Override 44 | + public void setVanished(boolean vanished) { 45 | + this.entity.vanished = vanished; 46 | + } 47 | + // Slice end 48 | } 49 | diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java 50 | index da1c1fe0faf6819b15a81d6ad53370948e5f984f..84eff85e98484c9701e203bb1fa61435ee88bab4 100644 51 | --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java 52 | +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java 53 | @@ -69,6 +69,14 @@ public class CraftInventoryCustom extends CraftInventory { 54 | } 55 | // Paper end 56 | 57 | + // Slice start 58 | + public void setLocation(Location location) { 59 | + if (this.inventory instanceof MinecraftInventory minecraftInventory) { 60 | + minecraftInventory.location = location; 61 | + } 62 | + } 63 | + // Slice end 64 | + 65 | static class MinecraftInventory implements Container { 66 | private final NonNullList items; 67 | private int maxStack = MAX_STACK; 68 | @@ -77,6 +85,7 @@ public class CraftInventoryCustom extends CraftInventory { 69 | private final net.kyori.adventure.text.Component adventure$title; // Paper 70 | private InventoryType type; 71 | private final InventoryHolder owner; 72 | + private Location location; // Slice 73 | 74 | // Paper start 75 | public MinecraftInventory(InventoryHolder owner, InventoryType type, net.kyori.adventure.text.Component title) { 76 | @@ -239,7 +248,7 @@ public class CraftInventoryCustom extends CraftInventory { 77 | 78 | @Override 79 | public Location getLocation() { 80 | - return null; 81 | + return location; 82 | } 83 | 84 | // Paper start 85 | -------------------------------------------------------------------------------- /patches/server/0018-Add-jackson.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 16 Nov 2024 09:14:26 -0600 4 | Subject: [PATCH] Add jackson 5 | 6 | 7 | diff --git a/build.gradle.kts b/build.gradle.kts 8 | index 63aa7a91dad0903383405c2cccf894d23a2ede54..fcc93b891c04d8b340b29a8b96e939df9b58839a 100644 9 | --- a/build.gradle.kts 10 | +++ b/build.gradle.kts 11 | @@ -26,6 +26,13 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider { 12 | 13 | dependencies { 14 | implementation(project(":slice-api")) 15 | + 16 | + // Slice start - JSON logging for DataDog ingestion 17 | + implementation("com.fasterxml.jackson.core:jackson-core:2.13.0") 18 | + implementation("com.fasterxml.jackson.core:jackson-databind:2.13.0") 19 | + implementation("com.fasterxml.jackson.core:jackson-annotations:2.13.0") 20 | + // Slice end 21 | + 22 | // Paper start 23 | implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ 24 | implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 25 | -------------------------------------------------------------------------------- /patches/server/0019-Add-ObjectId.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 16 Nov 2024 09:22:24 -0600 4 | Subject: [PATCH] Add ObjectId 5 | 6 | 7 | diff --git a/build.gradle.kts b/build.gradle.kts 8 | index fcc93b891c04d8b340b29a8b96e939df9b58839a..4893e10810583c12f6b34ec63d96bc8477264415 100644 9 | --- a/build.gradle.kts 10 | +++ b/build.gradle.kts 11 | @@ -33,6 +33,8 @@ dependencies { 12 | implementation("com.fasterxml.jackson.core:jackson-annotations:2.13.0") 13 | // Slice end 14 | 15 | + implementation("org.mongodb:bson:4.11.1") // Slice - MongoDB Bson Library for ObjectIds 16 | + 17 | // Paper start 18 | implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ 19 | implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 20 | diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java 21 | index 9bb19124498370c5b5ecaff10f523ee6e391b767..77cc9ae3f5d71454c3b75c44cf53bcfbc5f3eb84 100644 22 | --- a/src/main/java/net/minecraft/world/entity/Entity.java 23 | +++ b/src/main/java/net/minecraft/world/entity/Entity.java 24 | @@ -223,7 +223,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess 25 | // Paper start - Folia schedulers 26 | synchronized (this) { 27 | if (this.bukkitEntity == null) { 28 | - return this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this); 29 | + this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this); 30 | + 31 | + // Slice start - resolve ObjectId 32 | + if (this.bukkitEntity instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity craftHumanEntity) { 33 | + io.papermc.paper.event.player.PlayerResolveObjectIdEvent event = new io.papermc.paper.event.player.PlayerResolveObjectIdEvent((org.bukkit.entity.Player) bukkitEntity); 34 | + event.callEvent(); 35 | + craftHumanEntity.setObjectId(event.getObjectId()); 36 | + } 37 | + // Slice end 38 | + 39 | + return this.bukkitEntity; 40 | } 41 | } 42 | // Paper end - Folia schedulers 43 | diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java 44 | index e345cdbfab44a0f5da80d738798dbb4424b7ab5c..ba1280382f2b95ea2cb412d3a15789affc65bb12 100644 45 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java 46 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java 47 | @@ -73,6 +73,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { 48 | protected final PermissibleBase perm = new PermissibleBase(this); 49 | private boolean op; 50 | private GameMode mode; 51 | + private org.bson.types.ObjectId objectId; 52 | 53 | public CraftHumanEntity(final CraftServer server, final Player entity) { 54 | super(server, entity); 55 | @@ -81,6 +82,18 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { 56 | this.enderChest = new CraftInventory(entity.getEnderChestInventory()); 57 | } 58 | 59 | + // Slice start 60 | + @Override 61 | + public org.bson.types.ObjectId getObjectId() { 62 | + return objectId; 63 | + } 64 | + 65 | + @Override 66 | + public void setObjectId(org.bson.types.ObjectId objectId) { 67 | + this.objectId = objectId; 68 | + } 69 | + // Slice end 70 | + 71 | @Override 72 | public PlayerInventory getInventory() { 73 | return this.inventory; 74 | -------------------------------------------------------------------------------- /patches/server/0020-Packet-obfuscation-and-reduction.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 16 Nov 2024 09:26:55 -0600 4 | Subject: [PATCH] Packet obfuscation and reduction 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java 8 | index 0f99733660f91280e4c6262cf75b3c9cae86f65a..8845497071ca3be0e439b454f1f2d14f0f74e842 100644 9 | --- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java 10 | +++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java 11 | @@ -63,15 +63,29 @@ public class SynchedEntityData { 12 | } 13 | 14 | public void set(EntityDataAccessor key, T value, boolean force) { 15 | + // Slice start 16 | + this.set(key, value, force, null); 17 | + } 18 | + 19 | + public void set(EntityDataAccessor key, T value, @Nullable T foreignValue) { 20 | + this.set(key, value, false, foreignValue); 21 | + } 22 | + 23 | + public void set(EntityDataAccessor key, T value, boolean force, @Nullable T foreignValue) { // Slice end 24 | SynchedEntityData.DataItem datawatcher_item = this.getItem(key); 25 | 26 | + // Slice start 27 | + if (foreignValue != null && ObjectUtils.notEqual(foreignValue, datawatcher_item.getForeignValue())) { 28 | + datawatcher_item.setForeignValue(foreignValue); 29 | + } 30 | + // Slice end 31 | + 32 | if (force || ObjectUtils.notEqual(value, datawatcher_item.getValue())) { 33 | datawatcher_item.setValue(value); 34 | this.entity.onSyncedDataUpdated(key); 35 | datawatcher_item.setDirty(true); 36 | this.isDirty = true; 37 | } 38 | - 39 | } 40 | 41 | // CraftBukkit start - add method from above 42 | @@ -108,6 +122,26 @@ public class SynchedEntityData { 43 | } 44 | } 45 | 46 | + // Slice start 47 | + @Nullable 48 | + public List> packForeignDirty() { 49 | + List> list = null; 50 | + 51 | + for (DataItem dataItem : this.itemsById) { 52 | + if (dataItem.isDirty(true)) { 53 | + dataItem.setForeignDirty(false); 54 | + if (list == null) { 55 | + list = new ArrayList(); 56 | + } 57 | + 58 | + list.add(dataItem.foreignValue != null ? dataItem.foreignValue() : dataItem.value()); 59 | + } 60 | + } 61 | + 62 | + return list; 63 | + } 64 | + // Slice end 65 | + 66 | @Nullable 67 | public List> getNonDefaultValues() { 68 | List> list = null; 69 | @@ -171,11 +205,14 @@ public class SynchedEntityData { 70 | T value; 71 | private final T initialValue; 72 | private boolean dirty; 73 | + private @Nullable T foreignValue = null; // Slice 74 | + private boolean foreignDirty; // Slice 75 | 76 | public DataItem(EntityDataAccessor data, T value) { 77 | this.accessor = data; 78 | this.initialValue = value; 79 | this.value = value; 80 | + this.foreignDirty = true; //Slice 81 | } 82 | 83 | public EntityDataAccessor getAccessor() { 84 | @@ -205,6 +242,36 @@ public class SynchedEntityData { 85 | public SynchedEntityData.DataValue value() { 86 | return SynchedEntityData.DataValue.create(this.accessor, this.value); 87 | } 88 | + 89 | + 90 | + // Slice start 91 | + public SynchedEntityData.DataValue foreignValue() { 92 | + return SynchedEntityData.DataValue.create(this.accessor, this.foreignValue); 93 | + } 94 | + 95 | + public void setForeignValue(T foreignValue) { 96 | + this.foreignValue = foreignValue; 97 | + this.foreignDirty = true; 98 | + } 99 | + 100 | + public @Nullable T getForeignValue() { 101 | + return foreignValue; 102 | + } 103 | + 104 | + public boolean isDirty(boolean foreign) { 105 | + if (foreign) { 106 | + //There must be a foreign value in order for this to be dirty, otherwise we consider this a normal 107 | + //value and check the normal dirty flag. 108 | + return foreignValue == null || this.foreignDirty; 109 | + } 110 | + 111 | + return this.dirty; 112 | + } 113 | + 114 | + public void setForeignDirty(boolean dirty) { 115 | + this.foreignDirty = dirty; 116 | + } 117 | + // Slice end 118 | } 119 | 120 | public static record DataValue(int id, EntityDataSerializer serializer, T value) { 121 | diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java 122 | index a6c3beb9d5ab87fca882e1761983ebe385011296..112a8c0840ded4156782a6bab7550d4696b02c6f 100644 123 | --- a/src/main/java/net/minecraft/server/level/ServerEntity.java 124 | +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java 125 | @@ -434,7 +434,20 @@ public class ServerEntity { 126 | 127 | if (list != null) { 128 | this.trackedDataValues = datawatcher.getNonDefaultValues(); 129 | - this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), list)); 130 | +// this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), list)); 131 | + // Slice start 132 | + ClientboundSetEntityDataPacket dataPacket = new ClientboundSetEntityDataPacket(this.entity.getId(), list); 133 | + if (this.entity instanceof ServerPlayer serverPlayer) { 134 | + serverPlayer.connection.send(dataPacket); 135 | + } 136 | + 137 | + //Get the packedData that the original packet has, and then determine if any of those are changed in 138 | + //the foreign version. If null, nothing to notify foreign trackers about. 139 | + List> dirtyItems = datawatcher.packForeignDirty(); 140 | + if (dirtyItems != null) { 141 | + this.broadcast.accept(new ClientboundSetEntityDataPacket(this.entity.getId(), dirtyItems)); 142 | + } 143 | + // Slice end 144 | } 145 | 146 | if (this.entity instanceof LivingEntity) { 147 | diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java 148 | index 77cc9ae3f5d71454c3b75c44cf53bcfbc5f3eb84..a46df2ccbae85cdbdb7a19825a89c1797337d270 100644 149 | --- a/src/main/java/net/minecraft/world/entity/Entity.java 150 | +++ b/src/main/java/net/minecraft/world/entity/Entity.java 151 | @@ -3670,7 +3670,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess 152 | this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID); 153 | return; 154 | } 155 | - this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount()); 156 | + this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount(), getMaxAirSupply()); // Slice 157 | // CraftBukkit end 158 | } 159 | 160 | diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java 161 | index 551da84c834132d106457c123e1b195e4be904b8..e4041c58a23d3eaefd01402635f714404f3c82cf 100644 162 | --- a/src/main/java/net/minecraft/world/entity/player/Player.java 163 | +++ b/src/main/java/net/minecraft/world/entity/player/Player.java 164 | @@ -676,7 +676,7 @@ public abstract class Player extends LivingEntity { 165 | public void increaseScore(int score) { 166 | int j = this.getScore(); 167 | 168 | - this.entityData.set(Player.DATA_SCORE_ID, j + score); 169 | + this.entityData.set(Player.DATA_SCORE_ID, j + score, 0); // Slice 170 | } 171 | 172 | public void startAutoSpinAttack(int riptideTicks, float riptideAttackDamage, ItemStack stack) { 173 | diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 174 | index 973726a3429498b19bf36915b2e84ff29a203704..b4d72cbcbb9caa10e07fc07278d85fdc87f40102 100644 175 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 176 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 177 | @@ -2864,7 +2864,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { 178 | this.sendHealthUpdate(); 179 | } 180 | } 181 | - this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth()); 182 | + this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth(), isDead() ? 0f : 20f); // Slice 183 | 184 | this.getHandle().maxHealthCache = this.getMaxHealth(); 185 | } 186 | -------------------------------------------------------------------------------- /patches/server/0021-Add-PlayerLoadStatsEvent-Fix-patch.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 16 Nov 2024 09:34:15 -0600 4 | Subject: [PATCH] Add PlayerLoadStatsEvent Fix patch 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java 8 | index 2c1781a45828ef8018e976a445984197f0df1445..46f060f33fcbc6a4568a7fcfba29e83a4d192578 100644 9 | --- a/src/main/java/net/minecraft/server/players/PlayerList.java 10 | +++ b/src/main/java/net/minecraft/server/players/PlayerList.java 11 | @@ -1414,7 +1414,7 @@ public abstract class PlayerList { 12 | } 13 | } 14 | 15 | - serverstatisticmanager = new ServerStatsCounter(this.server, file1); 16 | + serverstatisticmanager = new ServerStatsCounter(this.server, file1, uuid); // Slice 17 | // this.stats.put(uuid, serverstatisticmanager); // CraftBukkit 18 | } 19 | 20 | diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java 21 | index da7e1a69ecb4e6b3be2d8544ac406aa519bd196e..6947650f299f99402a4a8d9c8384eb9f71a8e3a6 100644 22 | --- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java 23 | +++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java 24 | @@ -45,10 +45,16 @@ public class ServerStatsCounter extends StatsCounter { 25 | private final File file; 26 | private final Set> dirty = Sets.newHashSet(); 27 | 28 | - public ServerStatsCounter(MinecraftServer server, File file) { 29 | + public ServerStatsCounter(MinecraftServer server, File file, java.util.UUID uuid) { // Slice 30 | this.server = server; 31 | this.file = file; 32 | - if (file.isFile()) { 33 | + // Slice start - If event supplies stats, use it. Otherwise just load from disk as usual 34 | + com.destroystokyo.paper.event.player.PlayerLoadStatsEvent event = new com.destroystokyo.paper.event.player.PlayerLoadStatsEvent(uuid); 35 | + org.bukkit.Bukkit.getPluginManager().callEvent(event); 36 | + JsonObject providedJson = event.getStatistics(); 37 | + if (providedJson != null) { 38 | + parseLocal(server.getFixerUpper(), providedJson); 39 | + } else if (file.isFile()) { // Slice end 40 | try { 41 | this.parseLocal(server.getFixerUpper(), FileUtils.readFileToString(file)); 42 | } catch (IOException ioexception) { 43 | @@ -101,77 +107,59 @@ public class ServerStatsCounter extends StatsCounter { 44 | try { 45 | JsonReader jsonreader = new JsonReader(new StringReader(json)); 46 | 47 | - label48: 48 | - { 49 | - try { 50 | - jsonreader.setLenient(false); 51 | - JsonElement jsonelement = Streams.parse(jsonreader); 52 | - 53 | - if (!jsonelement.isJsonNull()) { 54 | - CompoundTag nbttagcompound = ServerStatsCounter.fromJson(jsonelement.getAsJsonObject()); 55 | - 56 | - nbttagcompound = DataFixTypes.STATS.updateToCurrentVersion(dataFixer, nbttagcompound, NbtUtils.getDataVersion(nbttagcompound, 1343)); 57 | - if (!nbttagcompound.contains("stats", 10)) { 58 | - break label48; 59 | - } 60 | - 61 | - CompoundTag nbttagcompound1 = nbttagcompound.getCompound("stats"); 62 | - Iterator iterator = nbttagcompound1.getAllKeys().iterator(); 63 | - 64 | - while (true) { 65 | - if (!iterator.hasNext()) { 66 | - break label48; 67 | - } 68 | - 69 | - String s1 = (String) iterator.next(); 70 | - 71 | - if (nbttagcompound1.contains(s1, 10)) { 72 | - Util.ifElse(BuiltInRegistries.STAT_TYPE.getOptional(ResourceLocation.parse(s1)), (statisticwrapper) -> { 73 | - CompoundTag nbttagcompound2 = nbttagcompound1.getCompound(s1); 74 | - Iterator iterator1 = nbttagcompound2.getAllKeys().iterator(); 75 | - 76 | - while (iterator1.hasNext()) { 77 | - String s2 = (String) iterator1.next(); 78 | - 79 | - if (nbttagcompound2.contains(s2, 99)) { 80 | - Util.ifElse(this.getStat(statisticwrapper, s2), (statistic) -> { 81 | - this.stats.put(statistic, nbttagcompound2.getInt(s2)); 82 | - }, () -> { 83 | - ServerStatsCounter.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.file, s2); 84 | - }); 85 | - } else { 86 | - ServerStatsCounter.LOGGER.warn("Invalid statistic value in {}: Don't know what {} is for key {}", new Object[]{this.file, nbttagcompound2.get(s2), s2}); 87 | - } 88 | - } 89 | - 90 | - }, () -> { 91 | - ServerStatsCounter.LOGGER.warn("Invalid statistic type in {}: Don't know what {} is", this.file, s1); 92 | - }); 93 | - } 94 | - } 95 | - } 96 | - 97 | - ServerStatsCounter.LOGGER.error("Unable to parse Stat data from {}", this.file); 98 | - } catch (Throwable throwable) { 99 | - try { 100 | - jsonreader.close(); 101 | - } catch (Throwable throwable1) { 102 | - throwable.addSuppressed(throwable1); 103 | - } 104 | + // Slice start 105 | + try { 106 | + jsonreader.setLenient(false); 107 | + JsonElement jsonelement = Streams.parse(jsonreader); 108 | 109 | - throw throwable; 110 | + if (!jsonelement.isJsonNull()) { 111 | + parseLocal(dataFixer, jsonelement.getAsJsonObject()); // Slice 112 | + } 113 | + } catch (Throwable throwable) { 114 | + try { 115 | + jsonreader.close(); 116 | + } catch (Throwable throwable1) { 117 | + throwable.addSuppressed(throwable1); 118 | } 119 | 120 | - jsonreader.close(); 121 | - return; 122 | + throw throwable; 123 | } 124 | 125 | jsonreader.close(); 126 | } catch (IOException | JsonParseException jsonparseexception) { 127 | ServerStatsCounter.LOGGER.error("Unable to parse Stat data from {}", this.file, jsonparseexception); 128 | } 129 | + } 130 | + 131 | + public void parseLocal(DataFixer dataFixer, JsonObject jsonObject) { 132 | + CompoundTag nbttagcompound = ServerStatsCounter.fromJson(jsonObject); 133 | + nbttagcompound = DataFixTypes.STATS.updateToCurrentVersion(dataFixer, nbttagcompound, NbtUtils.getDataVersion(nbttagcompound, 1343)); 134 | + if (!nbttagcompound.contains("stats", 10)) { 135 | + ServerStatsCounter.LOGGER.error("Unable to parse Stat data from {}", jsonObject); 136 | + return; 137 | + } 138 | 139 | + CompoundTag nbttagcompound1 = nbttagcompound.getCompound("stats"); 140 | + 141 | + for (String s1 : nbttagcompound1.getAllKeys()) { 142 | + if (nbttagcompound1.contains(s1, 10)) { 143 | + Util.ifElse(BuiltInRegistries.STAT_TYPE.getOptional(ResourceLocation.parse(s1)), (statisticwrapper) -> { 144 | + CompoundTag nbttagcompound2 = nbttagcompound1.getCompound(s1); 145 | + for (String s2 : nbttagcompound2.getAllKeys()) { 146 | + if (nbttagcompound2.contains(s2, 99)) { 147 | + Util.ifElse(this.getStat(statisticwrapper, s2), 148 | + (statistic) -> this.stats.put(statistic, nbttagcompound2.getInt(s2)), 149 | + () -> ServerStatsCounter.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.file, s2)); 150 | + } else { 151 | + ServerStatsCounter.LOGGER.warn("Invalid statistic value in {}: Don't know what {} is for key {}", new Object[]{this.file, nbttagcompound2.get(s2), s2}); 152 | + } 153 | + } 154 | + 155 | + }, () -> ServerStatsCounter.LOGGER.warn("Invalid statistic type in {}: Don't know what {} is", this.file, s1)); 156 | + } 157 | + } 158 | } 159 | + // Slice end 160 | 161 | private Optional> getStat(StatType type, String id) { 162 | // CraftBukkit - decompile error start 163 | -------------------------------------------------------------------------------- /patches/server/0022-Expose-getBlockPosBelowThatAffectsMyMovement.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sun, 17 Nov 2024 08:24:22 -0600 4 | Subject: [PATCH] Expose getBlockPosBelowThatAffectsMyMovement 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 8 | index aefa94ffd630e2dd6aefd547664ae25d2a81420c..0a34c8fb259ac9d3bfba518521d9137495509b96 100644 9 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 10 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 11 | @@ -28,6 +28,7 @@ import org.bukkit.Location; 12 | import org.bukkit.Server; 13 | import org.bukkit.Sound; 14 | import org.bukkit.World; 15 | +import org.bukkit.block.Block; 16 | import org.bukkit.block.BlockFace; 17 | import org.bukkit.block.PistonMoveReaction; 18 | import org.bukkit.craftbukkit.CraftServer; 19 | @@ -1318,4 +1319,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { 20 | this.entity.vanished = vanished; 21 | } 22 | // Slice end 23 | + 24 | + // Slice start 25 | + @Override 26 | + public Block getBlockStandingOn() { 27 | + net.minecraft.core.BlockPos pos = this.entity.getBlockPosBelowThatAffectsMyMovement(); 28 | + return this.entity.level().getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); 29 | + } 30 | + // Slice end 31 | } 32 | -------------------------------------------------------------------------------- /patches/server/0023-Add-DimensionDataStorageEvents.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sun, 17 Nov 2024 09:19:41 -0600 4 | Subject: [PATCH] Add DimensionDataStorageEvents 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java 8 | index d16f124e0371ce943298c8d7d9bfac21e98cf885..74de7e040ebccb000aa258238ed0bc41dec3754f 100644 9 | --- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java 10 | +++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java 11 | @@ -1,12 +1,12 @@ 12 | package net.minecraft.world.level.storage; 13 | 14 | +import ca.spottedleaf.dataconverter.minecraft.converters.custom.V3818_Commands; 15 | import com.mojang.datafixers.DataFixer; 16 | import com.mojang.logging.LogUtils; 17 | +import io.papermc.paper.event.server.DimensionDataStorageSaveEvent; 18 | import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; 19 | -import java.io.DataInputStream; 20 | -import java.io.IOException; 21 | -import java.io.InputStream; 22 | -import java.io.PushbackInputStream; 23 | + 24 | +import java.io.*; 25 | import java.nio.file.Files; 26 | import java.nio.file.Path; 27 | import java.util.HashMap; 28 | @@ -128,29 +128,34 @@ public class DimensionDataStorage implements AutoCloseable { 29 | } 30 | 31 | public CompletableFuture scheduleSave() { 32 | - Map map = this.collectDirtyTagsToSave(); 33 | + Map map = this.collectDirtyTagsToSave(); 34 | if (map.isEmpty()) { 35 | return CompletableFuture.completedFuture(null); 36 | } else { 37 | this.pendingWriteFuture = this.pendingWriteFuture 38 | .thenCompose( 39 | v -> CompletableFuture.allOf( 40 | - map.entrySet().stream().map(entry -> tryWriteAsync(entry.getKey(), entry.getValue())).toArray(CompletableFuture[]::new) 41 | + map.entrySet().stream().map(entry -> tryWriteAsync(entry.getKey(), this.getDataFile(entry.getKey()), entry.getValue())).toArray(CompletableFuture[]::new) 42 | ) 43 | ); 44 | return this.pendingWriteFuture; 45 | } 46 | } 47 | 48 | - private Map collectDirtyTagsToSave() { 49 | - Map map = new Object2ObjectArrayMap<>(); 50 | - this.cache.forEach((id, state) -> state.filter(SavedData::isDirty).ifPresent(state2 -> map.put(this.getDataFile(id), state2.save(this.registries)))); 51 | + private Map collectDirtyTagsToSave() { 52 | + Map map = new Object2ObjectArrayMap<>(); 53 | + this.cache.forEach((id, state) -> state.filter(SavedData::isDirty).ifPresent(state2 -> map.put(id, state2.save(this.registries)))); 54 | return map; 55 | } 56 | 57 | - private static CompletableFuture tryWriteAsync(Path path, CompoundTag nbt) { 58 | + private static CompletableFuture tryWriteAsync(String id, Path path, CompoundTag nbt) { 59 | return CompletableFuture.runAsync(() -> { 60 | try { 61 | + ByteArrayOutputStream buf = new ByteArrayOutputStream(); 62 | + NbtIo.writeCompressed(nbt, buf); 63 | + DimensionDataStorageSaveEvent event = new DimensionDataStorageSaveEvent(id, buf); 64 | + if (!event.callEvent()) return; 65 | + 66 | NbtIo.writeCompressed(nbt, path); 67 | } catch (IOException var3) { 68 | LOGGER.error("Could not save data to {}", path.getFileName(), var3); 69 | -------------------------------------------------------------------------------- /patches/server/0024-Add-PlayerData-Events.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Tom 3 | Date: Mon, 18 Nov 2024 08:34:27 -0600 4 | Subject: [PATCH] Add PlayerData Events 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java 8 | index 6947650f299f99402a4a8d9c8384eb9f71a8e3a6..299fcc2ecb17f8d42ff3480ec9868127faa9b0fc 100644 9 | --- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java 10 | +++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java 11 | @@ -192,7 +192,12 @@ public class ServerStatsCounter extends StatsCounter { 12 | return nbttagcompound; 13 | } 14 | 15 | - protected String toJson() { 16 | + // Slice start - OBFHELPER 17 | + public String toJson() { 18 | + return serialize().toString(); 19 | + } 20 | + 21 | + public JsonObject serialize() { // Slice end 22 | Map, JsonObject> map = Maps.newHashMap(); 23 | ObjectIterator objectiterator = this.stats.object2IntEntrySet().iterator(); 24 | 25 | @@ -218,7 +223,7 @@ public class ServerStatsCounter extends StatsCounter { 26 | 27 | jsonobject1.add("stats", jsonobject); 28 | jsonobject1.addProperty("DataVersion", SharedConstants.getCurrentVersion().getDataVersion().getVersion()); 29 | - return jsonobject1.toString(); 30 | + return jsonobject1; // Slice 31 | } 32 | 33 | private static ResourceLocation getKey(Stat stat) { 34 | diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java 35 | index b148cf247acdd36f856d0495cde4cc5ad32b5a2f..f9403d73ae2400e148a76bf79661e2e96fe7a6cc 100644 36 | --- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java 37 | +++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java 38 | @@ -36,6 +36,7 @@ public class PlayerDataStorage { 39 | 40 | public void save(Player player) { 41 | if (org.spigotmc.SpigotConfig.disablePlayerDataSaving) return; // Spigot 42 | + if (!new com.destroystokyo.paper.event.player.PlayerSaveDataEvent((org.bukkit.entity.Player) player.getBukkitEntity()).callEvent()) return; // Slice 43 | try { 44 | CompoundTag nbttagcompound = player.saveWithoutId(new CompoundTag()); 45 | Path path = this.playerDir.toPath(); 46 | @@ -108,6 +109,21 @@ public class PlayerDataStorage { 47 | } 48 | 49 | public Optional load(Player player) { 50 | + // Slice start - If event supplies playerdata, use it. Otherwise just load from disk as usual 51 | + com.destroystokyo.paper.event.player.PlayerLoadDataEvent event = new com.destroystokyo.paper.event.player.PlayerLoadDataEvent(player.getUUID()); 52 | + org.bukkit.Bukkit.getPluginManager().callEvent(event); 53 | + 54 | + Object playerData = event.getPlayerData(); 55 | + if (playerData instanceof CompoundTag data) { 56 | + data = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.PLAYER, 57 | + data, 58 | + NbtUtils.getDataVersion(data, -1), 59 | + net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion()); // Paper - rewrite data conversion system 60 | + player.load(data); 61 | + return Optional.of(data); 62 | + } 63 | + // Slice end 64 | + 65 | // CraftBukkit start 66 | return this.load(player.getName().getString(), player.getStringUUID()).map((nbttagcompound) -> { 67 | if (player instanceof ServerPlayer) { 68 | -------------------------------------------------------------------------------- /patches/server/0025-Non-saveable-entities.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Mon, 18 Nov 2024 11:20:07 -0600 4 | Subject: [PATCH] Non-saveable-entities 5 | 6 | 7 | diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java 8 | index b3c993a790fc3fab6a408c731deb297f74c959ce..7c1d4b08cbd41b70e712a636321ff9d73541ed8c 100644 9 | --- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java 10 | +++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java 11 | @@ -161,7 +161,7 @@ public final class ChunkEntitySlices { 12 | // removed by us below 13 | continue; 14 | } 15 | - if (entity.shouldBeSaved()) { 16 | + if (entity.shouldBeSaved() || !entity.saveable) { // Slice 17 | PlatformHooks.get().unloadEntity(entity); 18 | if (entity.isVehicle()) { 19 | // we cannot assume that these entities are contained within this chunk, because entities can 20 | diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java 21 | index a46df2ccbae85cdbdb7a19825a89c1797337d270..b878b2559d3957055702d8281846196732909ebd 100644 22 | --- a/src/main/java/net/minecraft/world/entity/Entity.java 23 | +++ b/src/main/java/net/minecraft/world/entity/Entity.java 24 | @@ -400,6 +400,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess 25 | public boolean fixedPose = false; // Paper - Expand Pose API 26 | private final int despawnTime; // Paper - entity despawn time limit 27 | public boolean vanished; // Slice 28 | + public boolean saveable = true; // Slice 29 | 30 | public void setOrigin(@javax.annotation.Nonnull Location location) { 31 | this.origin = location.toVector(); 32 | @@ -5210,6 +5211,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess 33 | 34 | @Override 35 | public boolean shouldBeSaved() { 36 | + if (!this.saveable) return false; // Slice 37 | return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.isPassenger() ? false : !this.isVehicle() || !((ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity)this).moonrise$hasAnyPlayerPassengers()); // Paper - rewrite chunk system 38 | } 39 | 40 | diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 41 | index 0a34c8fb259ac9d3bfba518521d9137495509b96..1f0a4a89815bf8110e7c02d2d3325e47fc9c2abe 100644 42 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 43 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 44 | @@ -1327,4 +1327,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { 45 | return this.entity.level().getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); 46 | } 47 | // Slice end 48 | + 49 | + 50 | + // Slice start 51 | + @Override 52 | + public boolean isSaveable() { 53 | + return this.entity.saveable; 54 | + } 55 | + 56 | + @Override 57 | + public void setSaveable(boolean saveable) { 58 | + this.entity.saveable = saveable; 59 | + } 60 | + // Slice end 61 | } 62 | -------------------------------------------------------------------------------- /patches/server/0026-Map-Events.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Mon, 2 Dec 2024 11:52:34 -0600 4 | Subject: [PATCH] Map Events 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java 8 | index e256e5ff5c167c6cff5b9e985cdc80d5c9203708..5f0439860468283dcdcce17fefc22c5e088b8dc4 100644 9 | --- a/src/main/java/net/minecraft/server/level/ServerLevel.java 10 | +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java 11 | @@ -2119,6 +2119,14 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe 12 | 13 | @Override 14 | public MapId getFreeMapId() { 15 | + // Slice start 16 | + io.papermc.paper.event.server.MapGetFreeIndexEvent event = new io.papermc.paper.event.server.MapGetFreeIndexEvent(); 17 | + event.callEvent(); 18 | + int newIndex = event.getIndex(); 19 | + if (newIndex != -1) { 20 | + return new MapId(newIndex); 21 | + } 22 | + // Slice end 23 | return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex.factory(), "idcounts")).getFreeAuxValueForMap(); 24 | } 25 | 26 | diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java 27 | index 4f256e61f858020f32e7a66664375ba05a57826b..f1eefed0282c2f5af125c6579fd5311d6e7f78b9 100644 28 | --- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java 29 | +++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java 30 | @@ -70,6 +70,23 @@ public class DimensionDataStorage implements AutoCloseable { 31 | @Nullable 32 | private T readSavedData(BiFunction readFunction, DataFixTypes dataFixTypes, String id) { 33 | try { 34 | + // Slice start 35 | + if (id.startsWith("map_")) { 36 | + int mapId = Integer.parseInt(id.split("map_")[1]); 37 | + io.papermc.paper.event.server.MapLoadEvent event = new io.papermc.paper.event.server.MapLoadEvent(mapId); 38 | + event.callEvent(); 39 | + ByteArrayInputStream buf = event.getBuf(); 40 | + if (buf != null) { 41 | + try { 42 | + CompoundTag tag = NbtIo.readCompressed(buf, NbtAccounter.unlimitedHeap()); 43 | + return readFunction.apply(tag.getCompound("data"), this.registries); 44 | + } catch (IOException e) { 45 | + LOGGER.error("Error loading saved data: {}", id, e); 46 | + } 47 | + } 48 | + } 49 | + // Slice end 50 | + 51 | Path path = this.getDataFile(id); 52 | if (Files.exists(path)) { 53 | CompoundTag compoundTag = this.readTagFromDisk(id, dataFixTypes, SharedConstants.getCurrentVersion().getDataVersion().getVersion()); 54 | -------------------------------------------------------------------------------- /patches/server/0027-PlayerInsertBundleItemEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Thu, 12 Dec 2024 15:20:17 -0600 4 | Subject: [PATCH] PlayerInsertBundleItemEvent 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java 8 | index d021cd5b6136f0125076513977f430c6d4dd4f9f..e134cdebde3e3afa6ddce177c949b4fb7a3ed277 100644 9 | --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java 10 | +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java 11 | @@ -582,6 +582,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon 12 | if (flag && (this.spawnEnemies || this.spawnFriendlies)) { 13 | // Paper start - PlayerNaturallySpawnCreaturesEvent 14 | for (ServerPlayer entityPlayer : this.level.players()) { 15 | + if (entityPlayer.spawnsOwnMobs) continue; // Slice 16 | int chunkRange = Math.min(level.spigotConfig.mobSpawnRange, entityPlayer.getBukkitEntity().getViewDistance()); 17 | chunkRange = Math.min(chunkRange, 8); 18 | entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange); 19 | diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java 20 | index e4041c58a23d3eaefd01402635f714404f3c82cf..6eb9155c3227ae2a69bb7a379af94d6a73cdc6c7 100644 21 | --- a/src/main/java/net/minecraft/world/entity/player/Player.java 22 | +++ b/src/main/java/net/minecraft/world/entity/player/Player.java 23 | @@ -198,6 +198,8 @@ public abstract class Player extends LivingEntity { 24 | public boolean affectsSpawning = true; // Paper - Affects Spawning API 25 | public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage 26 | 27 | + public boolean spawnsOwnMobs = false; // Slice 28 | + 29 | // CraftBukkit start 30 | public boolean fauxSleeping; 31 | public int oldLevel = -1; 32 | diff --git a/src/main/java/net/minecraft/world/item/BundleItem.java b/src/main/java/net/minecraft/world/item/BundleItem.java 33 | index f1999d904ac66f5349346ad8157f5401fb395e11..56159a23d231028ba671f441fed0f601eedec7be 100644 34 | --- a/src/main/java/net/minecraft/world/item/BundleItem.java 35 | +++ b/src/main/java/net/minecraft/world/item/BundleItem.java 36 | @@ -67,6 +67,7 @@ public class BundleItem extends Item { 37 | ItemStack itemStack = slot.getItem(); 38 | BundleContents.Mutable mutable = new BundleContents.Mutable(bundleContents); 39 | if (clickType == ClickAction.PRIMARY && !itemStack.isEmpty()) { 40 | + if (!new io.papermc.paper.event.player.PlayerInsertBundleItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), stack.getBukkitStack(), itemStack.getBukkitStack()).callEvent()) return false; // Slice 41 | if (mutable.tryTransfer(slot, player) > 0) { 42 | playInsertSound(player); 43 | } else { 44 | @@ -110,6 +111,7 @@ public class BundleItem extends Item { 45 | } else { 46 | BundleContents.Mutable mutable = new BundleContents.Mutable(bundleContents); 47 | if (clickType == ClickAction.PRIMARY && !otherStack.isEmpty()) { 48 | + if (!new io.papermc.paper.event.player.PlayerInsertBundleItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), stack.getBukkitStack(), otherStack.getBukkitStack()).callEvent()) return false; // Slice 49 | if (slot.allowModification(player) && mutable.tryInsert(otherStack) > 0) { 50 | playInsertSound(player); 51 | } else { 52 | -------------------------------------------------------------------------------- /patches/server/0028-Mute-bee-logger-warn.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Fri, 20 Dec 2024 07:17:20 -0600 4 | Subject: [PATCH] Mute bee logger warn 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java 8 | index c8c2394558952d7ca57d29874485251b8f2b3400..4317275aeb5b3519b6b9a7195e3d997f386349ce 100644 9 | --- a/src/main/java/net/minecraft/world/entity/EntityType.java 10 | +++ b/src/main/java/net/minecraft/world/entity/EntityType.java 11 | @@ -660,7 +660,7 @@ public class EntityType implements FeatureElement, EntityTypeT 12 | if (generation) entity.generation = true; // Paper - Don't fire sync event during generation 13 | entity.load(nbt); 14 | }, () -> { 15 | - EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); 16 | +// EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); // Slice - something about bees 17 | }); 18 | } 19 | 20 | -------------------------------------------------------------------------------- /patches/server/0029-Add-PlayerPreRespawnEvent.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sat, 28 Dec 2024 07:59:54 -0600 4 | Subject: [PATCH] Add PlayerPreRespawnEvent 5 | 6 | 7 | diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java 8 | index 46f060f33fcbc6a4568a7fcfba29e83a4d192578..28b1ec198970b88515b37ef651c90916f3aef347 100644 9 | --- a/src/main/java/net/minecraft/server/players/PlayerList.java 10 | +++ b/src/main/java/net/minecraft/server/players/PlayerList.java 11 | @@ -808,19 +808,31 @@ public abstract class PlayerList { 12 | // Paper end - Add PlayerPostRespawnEvent 13 | 14 | // CraftBukkit start - fire PlayerRespawnEvent 15 | - TeleportTransition teleporttransition; 16 | + TeleportTransition teleporttransition = null; 17 | if (location == null) { 18 | - teleporttransition = entityplayer.findRespawnPositionAndUseSpawnBlock(!flag, TeleportTransition.DO_NOTHING, reason); 19 | + // Slice start 20 | + io.papermc.paper.event.player.PlayerPreRespawnEvent preRespawnEvent = new io.papermc.paper.event.player.PlayerPreRespawnEvent(entityplayer.getBukkitEntity(), reason); 21 | + if (!preRespawnEvent.callEvent()) return entityplayer; 22 | + 23 | + Location respawnLocation = preRespawnEvent.getRespawnLocation(); 24 | + if (respawnLocation != null) { 25 | + location = respawnLocation; 26 | + teleporttransition = new TeleportTransition(((CraftWorld) respawnLocation.getWorld()).getHandle(), CraftLocation.toVec3D(respawnLocation), Vec3.ZERO, respawnLocation.getYaw(), respawnLocation.getPitch(), TeleportTransition.DO_NOTHING); 27 | + } else { 28 | + teleporttransition = entityplayer.findRespawnPositionAndUseSpawnBlock(!flag, TeleportTransition.DO_NOTHING, reason); 29 | + } 30 | + // Slice end 31 | 32 | if (!flag) entityplayer.reset(); // SPIGOT-4785 33 | - // Paper start - Add PlayerPostRespawnEvent 34 | - if (teleporttransition == null) return entityplayer; // Early exit, mirrors belows early return for disconnected players in respawn event 35 | - isRespawn = true; 36 | - location = CraftLocation.toBukkit(teleporttransition.position(), teleporttransition.newLevel().getWorld(), teleporttransition.yRot(), teleporttransition.xRot()); 37 | - // Paper end - Add PlayerPostRespawnEvent 38 | + // Paper start - Add PlayerPostRespawnEvent 39 | + if (teleporttransition == null || entityplayer.connection.isDisconnected()) return entityplayer; // Early exit, mirrors belows early return for disconnected players in respawn event 40 | + isRespawn = true; 41 | + location = CraftLocation.toBukkit(teleporttransition.position(), teleporttransition.newLevel().getWorld(), teleporttransition.yRot(), teleporttransition.xRot()); 42 | + // Paper end - Add PlayerPostRespawnEvent 43 | } else { 44 | teleporttransition = new TeleportTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), Vec3.ZERO, location.getYaw(), location.getPitch(), TeleportTransition.DO_NOTHING); 45 | } 46 | + 47 | // Spigot Start 48 | if (teleporttransition == null) { // Paper - Add PlayerPostRespawnEvent - diff on change - spigot early returns if respawn pos is null, that is how they handle disconnected player in respawn event 49 | return entityplayer; 50 | -------------------------------------------------------------------------------- /patches/server/0030-Fix-authorless-book-loading.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Sun, 29 Dec 2024 09:09:41 -0600 4 | Subject: [PATCH] Fix authorless book loading 5 | 6 | 7 | diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 8 | index 507f908916cbeb592496f963b46e4c2121a7b5e3..429eea868c749c5aece3e1afb96da760c154cfe1 100644 9 | --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 10 | +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 11 | @@ -24,6 +24,7 @@ import net.minecraft.commands.Commands; 12 | import net.minecraft.commands.arguments.item.ItemParser; 13 | import net.minecraft.core.registries.BuiltInRegistries; 14 | import net.minecraft.core.registries.Registries; 15 | +import net.minecraft.nbt.CompoundTag; 16 | import net.minecraft.nbt.NbtOps; 17 | import net.minecraft.nbt.StringTag; 18 | import net.minecraft.nbt.Tag; 19 | @@ -524,6 +525,15 @@ public final class CraftMagicNumbers implements UnsafeValues { 20 | net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); 21 | final int dataVersion = compound.getInt("DataVersion"); 22 | compound = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ITEM_STACK, compound, dataVersion, this.getDataVersion()); // Paper - replace data conversion system 23 | + 24 | + CompoundTag components = compound.getCompound("components"); 25 | + if (!components.isEmpty()) { 26 | + CompoundTag bookContent = components.getCompound("minecraft:written_book_content"); 27 | + if (!bookContent.isEmpty() && !bookContent.getAllKeys().contains("author")) { 28 | + bookContent.putString("author", ""); 29 | + } 30 | + } 31 | + 32 | return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow()); 33 | } 34 | 35 | -------------------------------------------------------------------------------- /patches/server/0031-noEntityCollisions-for-Entity.patch: -------------------------------------------------------------------------------- 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 2 | From: Cryptite 3 | Date: Tue, 31 Dec 2024 15:21:45 -0600 4 | Subject: [PATCH] noEntityCollisions for Entity 5 | 6 | 7 | diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java 8 | index fb251665cdbafab90c6ff5e1bcb34fc17124d4d9..0fa6c37eae00d8921d885eae2b777e21bdb4cad2 100644 9 | --- a/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java 10 | +++ b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java 11 | @@ -2099,6 +2099,7 @@ public final class CollisionUtil { 12 | 13 | public static boolean getEntityHardCollisions(final Level world, final Entity entity, AABB aabb, 14 | final List into, final int collisionFlags, final Predicate predicate) { 15 | + if (entity != null && entity.noEntityCollisions) return false; // Slice 16 | final boolean checkOnly = (collisionFlags & COLLISION_FLAG_CHECK_ONLY) != 0; 17 | 18 | boolean ret = false; 19 | diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java 20 | index b878b2559d3957055702d8281846196732909ebd..5497e03bf49d87ce1d3418c4815f107c3d194800 100644 21 | --- a/src/main/java/net/minecraft/world/entity/Entity.java 22 | +++ b/src/main/java/net/minecraft/world/entity/Entity.java 23 | @@ -438,6 +438,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess 24 | private int sectionY = Integer.MIN_VALUE; 25 | private int sectionZ = Integer.MIN_VALUE; 26 | private boolean updatingSectionStatus; 27 | + public boolean noEntityCollisions; // Slice 28 | 29 | @Override 30 | public final boolean moonrise$isHardColliding() { 31 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | import java.util.Locale 2 | 3 | pluginManagement { 4 | repositories { 5 | gradlePluginPortal() 6 | maven("https://repo.papermc.io/repository/maven-public/") 7 | } 8 | } 9 | 10 | plugins { 11 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" 12 | } 13 | 14 | if (!file(".git").exists()) { 15 | val errorText = """ 16 | 17 | =====================[ ERROR ]===================== 18 | The Paper project directory is not a properly cloned Git repository. 19 | 20 | In order to build Paper from source you must clone 21 | the Paper repository using Git, not download a code 22 | zip from GitHub. 23 | 24 | Built Paper jars are available for download at 25 | https://papermc.io/downloads/paper 26 | 27 | See https://github.com/PaperMC/Paper/blob/master/CONTRIBUTING.md 28 | for further information on building and modifying Paper. 29 | =================================================== 30 | """.trimIndent() 31 | error(errorText) 32 | } 33 | 34 | rootProject.name = "slice" 35 | 36 | for (name in listOf("slice-api", "slice-server")) { 37 | val projName = name.lowercase(Locale.ENGLISH) 38 | include(projName) 39 | findProject(":$projName")!!.projectDir = file(name) 40 | } 41 | 42 | optionalInclude("test-plugin") 43 | optionalInclude("paper-api-generator") 44 | 45 | fun optionalInclude(name: String, op: (ProjectDescriptor.() -> Unit)? = null) { 46 | val settingsFile = file("$name.settings.gradle.kts") 47 | if (settingsFile.exists()) { 48 | apply(from = settingsFile) 49 | findProject(":$name")?.let { op?.invoke(it) } 50 | } else { 51 | settingsFile.writeText( 52 | """ 53 | // Uncomment to enable the '$name' project 54 | // include(":$name") 55 | 56 | """.trimIndent() 57 | ) 58 | } 59 | } --------------------------------------------------------------------------------