mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Merge branch 'ver/1.21.11' into feat/quiver-bundle
This commit is contained in:
@@ -1,32 +1,32 @@
|
||||
[*]
|
||||
charset=utf-8
|
||||
end_of_line=lf
|
||||
insert_final_newline=true
|
||||
indent_style=space
|
||||
indent_size=4
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
ij_any_block_comment_add_space = false
|
||||
ij_any_block_comment_at_first_column = false
|
||||
ij_any_line_comment_at_first_column = false
|
||||
ij_any_line_comment_add_space = true
|
||||
|
||||
[*.tiny]
|
||||
indent_style=tab
|
||||
indent_style = tab
|
||||
|
||||
[*.bat]
|
||||
end_of_line=crlf
|
||||
end_of_line = crlf
|
||||
|
||||
[*.yml]
|
||||
indent_size=2
|
||||
indent_size = 2
|
||||
|
||||
[*.patch]
|
||||
trim_trailing_whitespace=false
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.java]
|
||||
ij_continuation_indent_size = 4
|
||||
ij_java_class_count_to_use_import_on_demand = 999999
|
||||
ij_java_insert_inner_class_imports = false
|
||||
ij_java_names_count_to_use_import_on_demand = 999999
|
||||
ij_java_imports_layout = *,|,$*
|
||||
ij_java_imports_layout = *, |, $*
|
||||
ij_java_generate_final_locals = true
|
||||
ij_java_generate_final_parameters = true
|
||||
ij_java_method_parameters_new_line_after_left_paren = true
|
||||
@@ -40,5 +40,5 @@ ij_java_use_fq_class_names = true
|
||||
[purpur-server/src/minecraft/resources/data/**/*.json]
|
||||
indent_size = 2
|
||||
|
||||
[paper-api/src/generated/**/*.java]
|
||||
[paper-api/src/generated/java/**/*.java]
|
||||
ij_java_imports_layout = $*,|,*
|
||||
|
||||
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@@ -21,12 +21,12 @@ jobs:
|
||||
- name: Configure Git
|
||||
run: git config --global user.email "no-reply@github.com" && git config --global user.name "Github Actions"
|
||||
- name: Apply Patches
|
||||
run: ./gradlew applyAllPatches --no-daemon --stacktrace
|
||||
run: ./gradlew applyAllPatches --stacktrace
|
||||
- name: Build
|
||||
run: ./gradlew build --no-daemon --stacktrace
|
||||
run: ./gradlew build --stacktrace
|
||||
- name: Rebuild on Failure
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
./gradlew clean cleanCache --refresh-dependencies
|
||||
./gradlew applyAllPatches --no-daemon --stacktrace
|
||||
./gradlew build --no-daemon --stacktrace
|
||||
./gradlew applyAllPatches --stacktrace
|
||||
./gradlew build --stacktrace
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,6 +5,7 @@ hs_err_pid*
|
||||
# Intellij
|
||||
/.idea/*
|
||||
!/.idea/runConfigurations
|
||||
!/.idea/icon.svg
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
22
.idea/icon.svg
generated
Normal file
22
.idea/icon.svg
generated
Normal file
@@ -0,0 +1,22 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
||||
<defs>
|
||||
<linearGradient id="g" x1="0" y1="0" x2="100" y2="100" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="15%" stop-color="#25b8ff" />
|
||||
<stop offset="85%" stop-color="#fa02ff" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g fill="none" stroke="url(#g)" stroke-linejoin="round" stroke-width="1.8">
|
||||
<path d="M72.09 13.86L53.18 24.8l18.93 10.92 18.91-10.94z"/>
|
||||
<path d="M49.87 1.05L30.95 11.99 49.88 22.9 68.8 11.97z"/>
|
||||
<path d="M27.67 13.89L8.75 24.82l18.93 10.92 18.91-10.93z"/>
|
||||
<path d="M49.89 26.7L30.97 37.64 49.9 48.55l18.92-10.93z"/>
|
||||
<path d="M7.11 27.67l.01 21.86 18.93 10.91-.01-21.85z"/>
|
||||
<path d="M29.33 40.49l.01 21.85 18.93 10.92-.01-21.85z"/>
|
||||
<path d="M7.12 53.32l.01 21.85 18.93 10.91-.01-21.85z"/>
|
||||
<path d="M29.34 66.14l.01 21.85L48.28 98.9l-.01-21.85z"/>
|
||||
<path d="M51.57 98.9l18.92-10.93-.01-21.85-18.92 10.93z"/>
|
||||
<path d="M73.78 86.06L92.7 75.13l-.02-21.85-18.91 10.93z"/>
|
||||
<path d="M73.76 60.41l18.92-10.93-.01-21.85-18.92 10.93z"/>
|
||||
<path d="M51.55 51.4l.01 21.85 18.91-10.93-.01-21.85z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -1,6 +1,6 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run Purpur Paperclip Jar" type="JarApplication">
|
||||
<option name="JAR_PATH" value="$PROJECT_DIR$/purpur-server/build/libs/purpur-paperclip-1.21.4-R0.1-SNAPSHOT-mojmap.jar" />
|
||||
<option name="JAR_PATH" value="$PROJECT_DIR$/purpur-server/build/libs/purpur-paperclip-1.21.10-R0.1-SNAPSHOT-mojmap.jar" />
|
||||
<option name="VM_PARAMETERS" value="-Dcom.mojang.eula.agree" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/run" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
|
||||
@@ -243,7 +243,8 @@ required.
|
||||
with `// Purpur end - <COMMIT DESCRIPTION>`.
|
||||
- One-line changes should have `// Purpur - <COMMIT DESCRIPTION>` at the end of the line.
|
||||
|
||||
> [!NOTE] These comments are incredibly important to be able to keep track of changes
|
||||
> [!NOTE]
|
||||
> These comments are incredibly important to be able to keep track of changes
|
||||
> across files and to remember what they are for, even a decade into the future.
|
||||
|
||||
Here's an example of how to mark changes by Purpur:
|
||||
@@ -298,6 +299,40 @@ are assumed to be non-null by default. For less obvious placing such as on gener
|
||||
**For other classes**: Keep using both `@Nullable` and `@NotNull` from `org.jetbrains.annotations`. These
|
||||
will be replaced later.
|
||||
|
||||
### API checks
|
||||
|
||||
When performing API-related checks where an exception needs to be thrown under specific conditions, you should use the `Preconditions` class.
|
||||
|
||||
#### Checking Method Arguments
|
||||
To validate method arguments, use `Preconditions#checkArgument`. This will throw an `IllegalArgumentException` if the condition is not met.
|
||||
> Don't use Preconditions#checkNotNull, as it throws a NullPointerException, which makes it harder to determine whether the error was caused by an internal issue or invalid arguments.
|
||||
|
||||
ex:
|
||||
```java
|
||||
@Override
|
||||
public void sendMessage(Player player, Component message) {
|
||||
Preconditions.checkArgument(player != null, "player cannot be null");
|
||||
Preconditions.checkArgument(player.isOnline(), "player %s must be online", player.getName());
|
||||
Preconditions.checkArgument(message != null, "message cannot be null");
|
||||
// rest of code
|
||||
}
|
||||
```
|
||||
|
||||
#### Checking Object State
|
||||
To validate the state of an object inside a method, use `Preconditions#checkState`. This will throw an `IllegalStateException` if the condition is not met.
|
||||
ex:
|
||||
```java
|
||||
private Player player;
|
||||
|
||||
@Override
|
||||
public void sendMessage(Component message) {
|
||||
Preconditions.checkArgument(message != null, "message cannot be null");
|
||||
Preconditions.checkState(this.player != null, "player cannot be null");
|
||||
Preconditions.checkState(this.player.isOnline(), "player %s must be online", this.player.getName());
|
||||
// rest of code
|
||||
}
|
||||
```
|
||||
|
||||
## Access Transformers
|
||||
Sometimes, Vanilla code already contains a field, method, or type you want to access
|
||||
but the visibility is too low (e.g. a private field in an entity class). Purpur can use access transformers
|
||||
@@ -459,6 +494,17 @@ If you use Maven to build your plugin:
|
||||
If you use Windows and don't usually build using WSL, you might not need to
|
||||
do this.
|
||||
|
||||
## Tips and Tricks
|
||||
|
||||
### IntelliJ IDEA
|
||||
|
||||
- Under `Settings > Appearance & Behavior > System Settings`, disable
|
||||
`Sync external changes: Periodically when the IDE is inactive (experimental)`.
|
||||
When disabled, the IDE will not attempt to reindex files while patches are applying
|
||||
unless you interact with the IDE during the process. This avoids severe slowdowns and freezes.
|
||||
- Under `Settings > Appearance & Behavior > System Settings`, you may also want to
|
||||
disable `Reopen projects on startup` to avoid freeze loops.
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### My commit doesn't need a build, what do I do?
|
||||
|
||||
21
README.md
21
README.md
@@ -7,7 +7,7 @@
|
||||
## Purpur
|
||||
|
||||
[](LICENSE)
|
||||
[](https://purpurmc.org/downloads/)
|
||||
[](https://purpurmc.org/downloads/)
|
||||
[](https://www.codefactor.io/repository/github/PurpurMC/Purpur)
|
||||
[](https://purpurmc.org/discord)
|
||||
|
||||
@@ -27,7 +27,7 @@ Join us on Discord:
|
||||
## Downloads
|
||||
Downloads can be obtained from the [downloads page](https://purpurmc.org/downloads/) or the [downloads API](https://api.purpurmc.org).
|
||||
|
||||
[](https://purpurmc.org/downloads/)
|
||||
[](https://purpurmc.org/downloads/)
|
||||
|
||||
Downloads API endpoints:
|
||||
* List versions of Minecraft with builds available:
|
||||
@@ -67,7 +67,7 @@ Maven
|
||||
<dependency>
|
||||
<groupId>org.purpurmc.purpur</groupId>
|
||||
<artifactId>purpur-api</artifactId>
|
||||
<version>1.21.4-R0.1-SNAPSHOT</version>
|
||||
<version>1.21.11-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
```
|
||||
@@ -80,7 +80,7 @@ repositories {
|
||||
```
|
||||
```kotlin
|
||||
dependencies {
|
||||
compileOnly("org.purpurmc.purpur:purpur-api:1.21.4-R0.1-SNAPSHOT")
|
||||
compileOnly("org.purpurmc.purpur:purpur-api:1.21.11-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -94,28 +94,23 @@ First, <u>clone</u> this repository. Do not download it.
|
||||
Then run the following command in the root directory:
|
||||
|
||||
```
|
||||
./gradlew applyPatches
|
||||
./gradlew applyAllPatches
|
||||
```
|
||||
|
||||
The project is now ready for use in your IDE.
|
||||
|
||||
#### Creating a patch
|
||||
Patches are effectively just commits in either `Purpur-API` or `Purpur-Server`.
|
||||
To create one, just add a commit to either repo and run `./gradlew rebuildPatches`, and a
|
||||
patch will be placed in the patches folder. Modifying commits will also modify its
|
||||
corresponding patch file.
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md) for more detailed information.
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||
|
||||
#### Compiling
|
||||
|
||||
Use the command `./gradlew build` to build the API and server. Compiled JARs
|
||||
will be placed under `Purpur-API/build/libs` and `Purpur-Server/build/libs`.
|
||||
will be placed under `purpur-api/build/libs` and `purpur-server/build/libs`.
|
||||
**These JARs are not used to start a server.**
|
||||
|
||||
To compile a server-ready purpurclip jar, run `./gradlew createMojmapBundlerJar`.
|
||||
To install the `purpur-api` and `purpur` dependencies to your local Maven repo, run `./gradlew publishToMavenLocal`. The compiled purpurclip jar will be in `build/libs/` not `Purpur-Server/build/libs`.
|
||||
To install the `purpur-api` and `purpur` dependencies to your local Maven repo, run `./gradlew publishToMavenLocal`. The compiled purpurclip jar will be in `purpur-server/build/libs`.
|
||||
|
||||
Special Thanks To:
|
||||
-------------
|
||||
|
||||
@@ -5,10 +5,4 @@
|
||||
# authlib com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
|
||||
# datafixerupper com.mojang.datafixers.DataFixerBuilder
|
||||
# datafixerupper com/mojang/datafixers/util/Either.java
|
||||
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
|
||||
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
|
||||
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
|
||||
# To import minecraft data files, like the default chat type, use `mc_data` as the prefix:
|
||||
# mc_data chat_type/chat.json
|
||||
# mc_data dimension_type/overworld.json
|
||||
#
|
||||
|
||||
@@ -5,6 +5,7 @@ public net.minecraft.world.entity.Entity updateInWaterStateAndDoWaterCurrentPush
|
||||
public net.minecraft.world.entity.LivingEntity canGlide()Z
|
||||
public net.minecraft.world.entity.monster.Shulker MAX_SCALE
|
||||
public net.minecraft.world.entity.player.Player canGlide()Z
|
||||
public net.minecraft.world.level.block.ShulkerBoxBlock canOpen(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/ShulkerBoxBlockEntity;)Z
|
||||
public net.minecraft.world.level.block.entity.FuelValues values
|
||||
public-f net.minecraft.world.entity.EntityType dimensions
|
||||
public-f net.minecraft.world.level.block.state.BlockBehaviour explosionResistance
|
||||
|
||||
@@ -3,7 +3,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||
|
||||
plugins {
|
||||
java // TODO java launcher tasks
|
||||
id("io.papermc.paperweight.patcher") version "2.0.0-beta.14"
|
||||
id("io.papermc.paperweight.patcher") version "2.0.0-beta.19"
|
||||
}
|
||||
|
||||
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||
@@ -45,6 +45,7 @@ subprojects {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
options.release = 21
|
||||
options.isFork = true
|
||||
options.compilerArgs.addAll(listOf("-Xlint:-deprecation", "-Xlint:-removal"))
|
||||
}
|
||||
tasks.withType<Javadoc> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
group = org.purpurmc.purpur
|
||||
version = 1.21.4-R0.1-SNAPSHOT
|
||||
version = 1.21.11-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion = 1.21.4
|
||||
paperCommit = 54b2e9d9738ce32e2f415c321f20e3fc07063c14
|
||||
mcVersion = 1.21.11
|
||||
apiVersion=1.21.11
|
||||
paperCommit = e5e2c50ed3f7a6e4dbe7451c089cb1ad3f77f8f9
|
||||
|
||||
org.gradle.configuration-cache = true
|
||||
org.gradle.caching = true
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
27
gradlew
vendored
27
gradlew
vendored
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -84,7 +86,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -112,7 +114,6 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -145,7 +146,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -153,7 +154,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -170,7 +171,6 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -202,16 +202,15 @@ fi
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
25
gradlew.bat
vendored
25
gradlew.bat
vendored
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,22 +59,21 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
--- a/paper-api/build.gradle.kts
|
||||
+++ b/paper-api/build.gradle.kts
|
||||
@@ -93,7 +_,7 @@
|
||||
@@ -91,7 +_,7 @@
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
-val generatedApiPath: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
|
||||
+val generatedApiPath: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath()
|
||||
-val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
|
||||
+val generatedDir: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath()
|
||||
idea {
|
||||
module {
|
||||
generatedSourceDirs.add(generatedApiPath.toFile())
|
||||
@@ -103,6 +_,18 @@
|
||||
generatedSourceDirs.add(generatedDir.toFile())
|
||||
@@ -101,6 +_,18 @@
|
||||
main {
|
||||
java {
|
||||
srcDir(generatedApiPath)
|
||||
srcDir(generatedDir)
|
||||
+ srcDir(file("../paper-api/src/main/java"))
|
||||
+ }
|
||||
+ resources {
|
||||
@@ -28,11 +28,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,8 +_,10 @@
|
||||
@@ -182,8 +_,9 @@
|
||||
val services = objects.newInstance<Services>()
|
||||
|
||||
tasks.withType<Javadoc> {
|
||||
+ //(options as StandardJavadocDocletOptions).addStringOption("-add-modules", "jdk.incubator.vector") // Purpur - our javadocs need this for pufferfish's SIMD patch
|
||||
tasks.withType<Javadoc>().configureEach {
|
||||
+ (options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet") // Purpur - silence Paper's bajillion javadoc warnings
|
||||
val options = options as StandardJavadocDocletOptions
|
||||
- options.overview = "src/main/javadoc/overview.html"
|
||||
@@ -40,7 +39,7 @@
|
||||
options.use()
|
||||
options.isDocFilesSubDirs = true
|
||||
options.links(
|
||||
@@ -202,11 +_,11 @@
|
||||
@@ -216,11 +_,11 @@
|
||||
}
|
||||
|
||||
// workaround for https://github.com/gradle/gradle/issues/4046
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Purpur config files
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 365368983a25f7ccbd3c8b7b572a5173a4c868a0..594bcedd823acc87ed429ad8ef17b66e9dc15beb 100644
|
||||
index bd8123503132b742d873c18486c3d19024fb9898..a17790d2da3008927b79814629e073b2091ce421 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2330,6 +2330,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2425,6 +2425,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
}
|
||||
// Paper end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/generated/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||
+++ b/src/generated/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||
@@ -441,6 +_,26 @@
|
||||
@@ -450,6 +_,26 @@
|
||||
|
||||
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
|
||||
@@ -28,6 +_,12 @@
|
||||
*/
|
||||
Component getVersionMessage(String serverVersion);
|
||||
@@ -40,6 +_,12 @@
|
||||
return getVersionMessage();
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ default int distance() {
|
||||
@@ -10,6 +10,6 @@
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@ApiStatus.Internal
|
||||
class DummyVersionFetcher implements VersionFetcher {
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2980,4 +_,133 @@
|
||||
public static Server.Spigot spigot() {
|
||||
return server.spigot();
|
||||
@@ -3003,4 +_,147 @@
|
||||
public static void restart() {
|
||||
server.restart();
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Bring back server name
|
||||
@@ -48,14 +48,16 @@
|
||||
+ }
|
||||
+ // Purpur end - Added the ability to add combustible items
|
||||
+
|
||||
+ // Purpur start - Debug Marker API
|
||||
+ // Purpur start - Debug Marker API
|
||||
+ /**
|
||||
+ * Creates debug block highlight on specified block location and show it to all players on the server.
|
||||
+ * <p>
|
||||
+ * Clients may be inconsistent in displaying it.
|
||||
+ * @param location Location to highlight
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void sendBlockHighlight(@NotNull Location location, int duration) {
|
||||
+ server.sendBlockHighlight(location, duration);
|
||||
+ }
|
||||
@@ -67,7 +69,9 @@
|
||||
+ * @param location Location to highlight
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void sendBlockHighlight(@NotNull Location location, int duration, int argb) {
|
||||
+ server.sendBlockHighlight(location, duration, argb);
|
||||
+ }
|
||||
@@ -79,7 +83,9 @@
|
||||
+ * @param location Location to highlight
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @param text Text to show above the highlight
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text) {
|
||||
+ server.sendBlockHighlight(location, duration, text);
|
||||
+ }
|
||||
@@ -92,7 +98,9 @@
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @param text Text to show above the highlight
|
||||
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, int argb) {
|
||||
+ server.sendBlockHighlight(location, duration, text, argb);
|
||||
+ }
|
||||
@@ -106,7 +114,9 @@
|
||||
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
|
||||
+ * @param transparency Transparency of the highlight
|
||||
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void sendBlockHighlight(@NotNull Location location, int duration, @NotNull org.bukkit.Color color, int transparency) {
|
||||
+ server.sendBlockHighlight(location, duration, color, transparency);
|
||||
+ }
|
||||
@@ -121,14 +131,18 @@
|
||||
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
|
||||
+ * @param transparency Transparency of the highlight
|
||||
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, @NotNull org.bukkit.Color color, int transparency) {
|
||||
+ server.sendBlockHighlight(location, duration, text, color, transparency);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Clears all debug block highlights for all players on the server.
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void clearBlockHighlights() {
|
||||
+ server.clearBlockHighlights();
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/Material.java
|
||||
+++ b/src/main/java/org/bukkit/Material.java
|
||||
@@ -5812,4 +_,40 @@
|
||||
@@ -3708,4 +_,40 @@
|
||||
return this.asItemType().getDefaultDataTypes();
|
||||
}
|
||||
// Paper end - data component API
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||
@@ -573,4 +_,106 @@
|
||||
@Override
|
||||
io.papermc.paper.persistence.@NotNull PersistentDataContainerView getPersistentDataContainer();
|
||||
// Paper end - add pdc to offline player
|
||||
@@ -592,4 +_,104 @@
|
||||
default void applySkinToPlayerHeadContents(final PlayerHeadObjectContents.@NonNull Builder builder) {
|
||||
builder.id(this.getUniqueId());
|
||||
}
|
||||
+
|
||||
+ // Purpur start - OfflinePlayer API
|
||||
+ /**
|
||||
@@ -12,7 +12,7 @@
|
||||
+ *
|
||||
+ * @return True if the player is allowed to fly.
|
||||
+ */
|
||||
+ public boolean getAllowFlight();
|
||||
+ boolean getAllowFlight();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets if the OfflinePlayer is allowed to fly via jump key double-tap like in
|
||||
@@ -20,21 +20,21 @@
|
||||
+ *
|
||||
+ * @param flight If flight should be allowed.
|
||||
+ */
|
||||
+ public void setAllowFlight(boolean flight);
|
||||
+ void setAllowFlight(boolean flight);
|
||||
+
|
||||
+ /**
|
||||
+ * Checks to see if this player is currently flying or not.
|
||||
+ *
|
||||
+ * @return True if the player is flying, else false.
|
||||
+ */
|
||||
+ public boolean isFlying();
|
||||
+ boolean isFlying();
|
||||
+
|
||||
+ /**
|
||||
+ * Makes this player start or stop flying.
|
||||
+ *
|
||||
+ * @param value True to fly.
|
||||
+ */
|
||||
+ public void setFlying(boolean value);
|
||||
+ void setFlying(boolean value);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the speed at which a client will fly. Negative values indicate
|
||||
@@ -44,7 +44,7 @@
|
||||
+ * @throws IllegalArgumentException If new speed is less than -1 or
|
||||
+ * greater than 1
|
||||
+ */
|
||||
+ public void setFlySpeed(float value) throws IllegalArgumentException;
|
||||
+ void setFlySpeed(float value) throws IllegalArgumentException;
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the speed at which a client will walk. Negative values indicate
|
||||
@@ -54,21 +54,21 @@
|
||||
+ * @throws IllegalArgumentException If new speed is less than -1 or
|
||||
+ * greater than 1
|
||||
+ */
|
||||
+ public void setWalkSpeed(float value) throws IllegalArgumentException;
|
||||
+ void setWalkSpeed(float value) throws IllegalArgumentException;
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the current allowed speed that a client can fly.
|
||||
+ *
|
||||
+ * @return The current allowed speed, from -1 to 1
|
||||
+ */
|
||||
+ public float getFlySpeed();
|
||||
+ float getFlySpeed();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the current allowed speed that a client can walk.
|
||||
+ *
|
||||
+ * @return The current allowed speed, from -1 to 1
|
||||
+ */
|
||||
+ public float getWalkSpeed();
|
||||
+ float getWalkSpeed();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleport implementation.
|
||||
@@ -76,7 +76,7 @@
|
||||
+ * @param destination
|
||||
+ * @return true if teleportation was successful
|
||||
+ */
|
||||
+ public boolean teleportOffline(@NotNull org.bukkit.Location destination);
|
||||
+ boolean teleportOffline(org.bukkit.Location destination);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleport implementation.
|
||||
@@ -85,7 +85,7 @@
|
||||
+ * @param cause Teleport cause used if player is online
|
||||
+ * @return true if teleportation was successful
|
||||
+ */
|
||||
+ public boolean teleportOffline(@NotNull org.bukkit.Location destination, @NotNull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause);
|
||||
+ boolean teleportOffline(org.bukkit.Location destination, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleportAsync implementation.
|
||||
@@ -93,8 +93,7 @@
|
||||
+ * @param destination
|
||||
+ * @return <code>true</code> if teleportation successful
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(@NotNull Location destination);
|
||||
+ java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(Location destination);
|
||||
+
|
||||
+ /**
|
||||
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleportAsync implementation.
|
||||
@@ -103,7 +102,6 @@
|
||||
+ * @param cause Teleport cause used if player is online
|
||||
+ * @return <code>true</code> if teleportation successful
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(@NotNull Location destination, @NotNull org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause);
|
||||
+ java.util.concurrent.CompletableFuture<Boolean> teleportOfflineAsync(Location destination, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause);
|
||||
+ // Purpur end - OfflinePlayer API
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2654,4 +_,111 @@
|
||||
@@ -2761,4 +_,125 @@
|
||||
*/
|
||||
void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value);
|
||||
// Paper end - API to check if the server is sleeping
|
||||
@@ -47,7 +47,9 @@
|
||||
+ * Clients may be inconsistent in displaying it.
|
||||
+ * @param location Location to highlight
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration);
|
||||
+
|
||||
+ /**
|
||||
@@ -57,7 +59,9 @@
|
||||
+ * @param location Location to highlight
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, int argb);
|
||||
+
|
||||
+ /**
|
||||
@@ -67,7 +71,9 @@
|
||||
+ * @param location Location to highlight
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @param text Text to show above the highlight
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text);
|
||||
+
|
||||
+ /**
|
||||
@@ -78,7 +84,9 @@
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @param text Text to show above the highlight
|
||||
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, int argb);
|
||||
+
|
||||
+ /**
|
||||
@@ -90,7 +98,9 @@
|
||||
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
|
||||
+ * @param transparency Transparency of the highlight
|
||||
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull org.bukkit.Color color, int transparency);
|
||||
+
|
||||
+ /**
|
||||
@@ -103,12 +113,16 @@
|
||||
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
|
||||
+ * @param transparency Transparency of the highlight
|
||||
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, @NotNull org.bukkit.Color color, int transparency);
|
||||
+
|
||||
+ /**
|
||||
+ * Clears all debug block highlights for all players on the server.
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void clearBlockHighlights();
|
||||
+ // Purpur end - Debug Marker API
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -4253,6 +_,86 @@
|
||||
@@ -4497,6 +_,100 @@
|
||||
@Nullable
|
||||
public DragonBattle getEnderDragonBattle();
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
+ * Clients may be inconsistent in displaying it.
|
||||
+ * @param location Location to highlight
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration);
|
||||
+
|
||||
+ /**
|
||||
@@ -29,7 +31,9 @@
|
||||
+ * @param location Location to highlight
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, int argb);
|
||||
+
|
||||
+ /**
|
||||
@@ -39,7 +43,9 @@
|
||||
+ * @param location Location to highlight
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @param text Text to show above the highlight
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text);
|
||||
+
|
||||
+ /**
|
||||
@@ -50,7 +56,9 @@
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @param text Text to show above the highlight
|
||||
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, int argb);
|
||||
+
|
||||
+ /**
|
||||
@@ -62,7 +70,9 @@
|
||||
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
|
||||
+ * @param transparency Transparency of the highlight
|
||||
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull org.bukkit.Color color, int transparency);
|
||||
+
|
||||
+ /**
|
||||
@@ -75,12 +85,16 @@
|
||||
+ * @param color Color of the highlight. Will be ignored on some versions of vanilla client
|
||||
+ * @param transparency Transparency of the highlight
|
||||
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, @NotNull org.bukkit.Color color, int transparency);
|
||||
+
|
||||
+ /**
|
||||
+ * Clears all debug block highlights for all players on this world.
|
||||
+ * @deprecated until further notice. NOOP since 1.21.10
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void clearBlockHighlights();
|
||||
+ // Purpur end
|
||||
+
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -153,6 +_,19 @@
|
||||
@@ -148,6 +_,19 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
// Paper start - Plugins do weird things to workaround normal registration
|
||||
if (target.timings == null) {
|
||||
target.timings = co.aikar.timings.TimingsManager.getCommandTiming(null, target);
|
||||
@@ -160,10 +_,10 @@
|
||||
@@ -155,10 +_,10 @@
|
||||
// Paper end
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
@@ -215,7 +_,7 @@
|
||||
@@ -214,7 +_,7 @@
|
||||
String version = Bukkit.getVersion();
|
||||
// Paper start
|
||||
if (version.startsWith("null")) { // running from ide?
|
||||
@@ -9,7 +9,7 @@
|
||||
return;
|
||||
}
|
||||
setVersionMessage(getVersionFetcher().getVersionMessage(version));
|
||||
@@ -256,9 +_,11 @@
|
||||
@@ -255,9 +_,11 @@
|
||||
// Paper start
|
||||
private void setVersionMessage(final @NotNull Component msg) {
|
||||
lastCheck = System.currentTimeMillis();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
|
||||
+++ b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
|
||||
@@ -227,6 +_,30 @@
|
||||
@@ -169,6 +_,30 @@
|
||||
public boolean includes(@NotNull Material item) {
|
||||
return BREAKABLE.includes(item) || (WEARABLE.includes(item) && !item.equals(Material.ELYTRA)) || item.equals(Material.COMPASS);
|
||||
return Tag.ITEMS_ENCHANTABLE_VANISHING.isTagged(item);
|
||||
}
|
||||
+ // Purpur start - Add enchantment target for bows and crossbows
|
||||
+ },
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
--- a/src/main/java/org/bukkit/entity/CopperGolem.java
|
||||
+++ b/src/main/java/org/bukkit/entity/CopperGolem.java
|
||||
@@ -39,6 +_,22 @@
|
||||
*/
|
||||
void setOxidizing(Oxidizing oxidizing);
|
||||
|
||||
+ // Purpur start
|
||||
+ /**
|
||||
+ * Get the player that summoned this iron golem
|
||||
+ *
|
||||
+ * @return UUID of summoner
|
||||
+ */
|
||||
+ @org.jetbrains.annotations.Nullable java.util.UUID getSummoner();
|
||||
+
|
||||
+ /**
|
||||
+ * Set the player that summoned this iron golem
|
||||
+ *
|
||||
+ * @param summoner UUID of summoner
|
||||
+ */
|
||||
+ void setSummoner(@org.jetbrains.annotations.Nullable java.util.UUID summoner);
|
||||
+ // Purpur end
|
||||
+
|
||||
/**
|
||||
* Represents the oxidizing state of a copper golem.
|
||||
*
|
||||
@@ -13,7 +13,7 @@
|
||||
* @return player spawned status
|
||||
- * @deprecated this functionality no longer exists
|
||||
*/
|
||||
- @Deprecated(since = "1.17")
|
||||
- @Deprecated(since = "1.17", forRemoval = true)
|
||||
boolean isPlayerSpawned();
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@
|
||||
* @param playerSpawned player spawned status
|
||||
- * @deprecated this functionality no longer exists
|
||||
*/
|
||||
- @Deprecated(since = "1.17")
|
||||
- @Deprecated(since = "1.17", forRemoval = true)
|
||||
void setPlayerSpawned(boolean playerSpawned);
|
||||
// Paper start
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -1196,4 +_,59 @@
|
||||
@@ -1322,4 +_,59 @@
|
||||
*/
|
||||
void broadcastHurtAnimation(@NotNull java.util.Collection<Player> players);
|
||||
// Paper end - broadcast hurt animation
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -1468,4 +_,20 @@
|
||||
@@ -1494,4 +_,20 @@
|
||||
*/
|
||||
boolean canUseEquipmentSlot(org.bukkit.inventory.@NotNull EquipmentSlot slot);
|
||||
// Paper end - Expose canUseSlot
|
||||
@ApiStatus.Experimental
|
||||
@NotNull CombatTracker getCombatTracker();
|
||||
+
|
||||
+ // Purpur start - API for any mob to burn daylight
|
||||
+ /**
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -3928,4 +_,123 @@
|
||||
* @return the result of this method, holding leftovers and spawned items.
|
||||
@@ -4004,4 +_,123 @@
|
||||
*/
|
||||
@NotNull PlayerGiveResult give(@NotNull Collection<@NotNull ItemStack> items, boolean dropIfFull);
|
||||
@ApiStatus.Experimental
|
||||
PlayerGameConnection getConnection();
|
||||
+
|
||||
+ // Purpur start
|
||||
+ /**
|
||||
@@ -11,7 +11,7 @@
|
||||
+ *
|
||||
+ * @return true if player uses PurpurClient
|
||||
+ */
|
||||
+ public boolean usesPurpurClient();
|
||||
+ boolean usesPurpurClient();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if player is AFK
|
||||
@@ -40,7 +40,7 @@
|
||||
+ * @param location Location to highlight
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ */
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration);
|
||||
+ void sendBlockHighlight(Location location, int duration);
|
||||
+
|
||||
+ /**
|
||||
+ * Creates debug block highlight on specified block location and show it to this player.
|
||||
@@ -50,7 +50,7 @@
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
|
||||
+ */
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, int argb);
|
||||
+ void sendBlockHighlight(Location location, int duration, int argb);
|
||||
+
|
||||
+ /**
|
||||
+ * Creates debug block highlight on specified block location and show it to this player.
|
||||
@@ -60,7 +60,7 @@
|
||||
+ * @param duration Duration for highlight to show in milliseconds
|
||||
+ * @param text Text to show above the highlight
|
||||
+ */
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text);
|
||||
+ void sendBlockHighlight(Location location, int duration, String text);
|
||||
+
|
||||
+ /**
|
||||
+ * Creates debug block highlight on specified block location and show it to this player.
|
||||
@@ -71,7 +71,7 @@
|
||||
+ * @param text Text to show above the highlight
|
||||
+ * @param argb Color of the highlight. ARGB int. Will be ignored on some versions of vanilla client
|
||||
+ */
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, int argb);
|
||||
+ void sendBlockHighlight(Location location, int duration, String text, int argb);
|
||||
+
|
||||
+ /**
|
||||
+ * Creates debug block highlight on specified block location and show it to this player.
|
||||
@@ -83,7 +83,7 @@
|
||||
+ * @param transparency Transparency of the highlight
|
||||
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
|
||||
+ */
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull org.bukkit.Color color, int transparency);
|
||||
+ void sendBlockHighlight(Location location, int duration, org.bukkit.Color color, int transparency);
|
||||
+
|
||||
+ /**
|
||||
+ * Creates debug block highlight on specified block location and show it to this player.
|
||||
@@ -96,7 +96,7 @@
|
||||
+ * @param transparency Transparency of the highlight
|
||||
+ * @throws IllegalArgumentException If transparency is outside 0-255 range
|
||||
+ */
|
||||
+ void sendBlockHighlight(@NotNull Location location, int duration, @NotNull String text, @NotNull org.bukkit.Color color, int transparency);
|
||||
+ void sendBlockHighlight(Location location, int duration, String text, org.bukkit.Color color, int transparency);
|
||||
+
|
||||
+ /**
|
||||
+ * Clears all debug block highlights
|
||||
@@ -108,7 +108,7 @@
|
||||
+ *
|
||||
+ * @param message The death message to show the player
|
||||
+ */
|
||||
+ void sendDeathScreen(@NotNull net.kyori.adventure.text.Component message);
|
||||
+ void sendDeathScreen(net.kyori.adventure.text.Component message);
|
||||
+
|
||||
+ /**
|
||||
+ * Sends a player the death screen with a specified death message,
|
||||
@@ -119,7 +119,7 @@
|
||||
+ * @deprecated Use {@link #sendDeathScreen(net.kyori.adventure.text.Component)} instead, as 1.20 removed the killer ID from the packet.
|
||||
+ */
|
||||
+ @Deprecated(since = "1.20")
|
||||
+ default void sendDeathScreen(@NotNull net.kyori.adventure.text.Component message, @Nullable Entity killer) {
|
||||
+ default void sendDeathScreen(net.kyori.adventure.text.Component message, @Nullable Entity killer) {
|
||||
+ sendDeathScreen(message);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
--- a/src/main/java/org/bukkit/entity/Villager.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Villager.java
|
||||
@@ -367,4 +_,14 @@
|
||||
@@ -406,4 +_,13 @@
|
||||
* Demand is still updated even if all events are canceled.
|
||||
*/
|
||||
public void clearReputations();
|
||||
// Paper end
|
||||
public void restock();
|
||||
+
|
||||
+ // Purpur start
|
||||
+
|
||||
+ /**
|
||||
+ * Check if villager is currently lobotomized
|
||||
+ *
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/src/main/java/org/bukkit/entity/Wither.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Wither.java
|
||||
@@ -107,4 +_,20 @@
|
||||
@@ -105,4 +_,20 @@
|
||||
* This is called in vanilla directly after spawning the wither.
|
||||
*/
|
||||
void enterInvulnerabilityPhase();
|
||||
// Paper end
|
||||
+
|
||||
+ // Purpur start
|
||||
+ /**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/src/main/java/org/bukkit/entity/Wolf.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Wolf.java
|
||||
@@ -110,4 +_,20 @@
|
||||
return RegistryAccess.registryAccess().getRegistry(RegistryKey.WOLF_VARIANT).getOrThrow(NamespacedKey.minecraft(key));
|
||||
@@ -162,4 +_,20 @@
|
||||
return RegistryAccess.registryAccess().getRegistry(RegistryKey.WOLF_SOUND_VARIANT).getOrThrow(NamespacedKey.minecraft(key));
|
||||
}
|
||||
}
|
||||
+
|
||||
@@ -11,13 +11,13 @@
|
||||
+ *
|
||||
+ * @return whether the wolf is rabid
|
||||
+ */
|
||||
+ public boolean isRabid();
|
||||
+ boolean isRabid();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets this wolf to be rabid or not
|
||||
+ *
|
||||
+ * @param rabid whether the wolf should be rabid
|
||||
+ */
|
||||
+ public void setRabid(boolean rabid);
|
||||
+ void setRabid(boolean rabid);
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||
@@ -308,7 +_,8 @@
|
||||
@@ -310,7 +_,8 @@
|
||||
WORLD_BORDER,
|
||||
/**
|
||||
* Damage caused when an entity contacts a block such as a Cactus,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityPotionEffectEvent.java
|
||||
@@ -216,6 +_,12 @@
|
||||
@@ -218,6 +_,12 @@
|
||||
* When all effects are removed due to a bucket of milk.
|
||||
*/
|
||||
MILK,
|
||||
@@ -11,5 +11,5 @@
|
||||
+ NETHERITE_ARMOR,
|
||||
+ // Purpur end
|
||||
/**
|
||||
* When a player gets bad omen after killing a patrol captain.
|
||||
*
|
||||
* When the entity gets the effect from a nautilus.
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||
@@ -164,7 +_,7 @@
|
||||
@@ -170,7 +_,7 @@
|
||||
SMITHING_NEW(4, "Upgrade Gear", MenuType.SMITHING),
|
||||
;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -21,6 +_,13 @@
|
||||
import org.bukkit.material.MaterialData;
|
||||
@@ -24,6 +_,13 @@
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
+// Purpur start - ItemStack convenience methods
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
/**
|
||||
* Represents a stack of items.
|
||||
@@ -1329,4 +_,482 @@
|
||||
@@ -1373,4 +_,482 @@
|
||||
return this.craftDelegate.matchesWithoutData(item, excludeTypes, ignoreCount);
|
||||
}
|
||||
// Paper end - data component API
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -55,6 +_,7 @@
|
||||
@@ -53,6 +_,7 @@
|
||||
private final Pattern[] fileFilters = new Pattern[]{Pattern.compile("\\.jar$")};
|
||||
private final List<PluginClassLoader> loaders = new CopyOnWriteArrayList<PluginClassLoader>();
|
||||
private final LibraryLoader libraryLoader;
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||
@@ -68,6 +_,7 @@
|
||||
@@ -69,6 +_,7 @@
|
||||
session.setTransferListener(new AbstractTransferListener() {
|
||||
@Override
|
||||
public void transferStarted(@NotNull TransferEvent event) throws TransferCancelledException
|
||||
{
|
||||
public void transferStarted(@NotNull TransferEvent event) {
|
||||
+ if (!JavaPluginLoader.SuppressLibraryLoaderLogger) // Purpur - Add log suppression for LibraryLoader
|
||||
logger.log( Level.INFO, "Downloading {0}", event.getResource().getRepositoryUrl() + event.getResource().getResourceName() );
|
||||
logger.log(Level.INFO, "Downloading {0}", event.getResource().getRepositoryUrl() + event.getResource().getResourceName());
|
||||
}
|
||||
} );
|
||||
});
|
||||
@@ -94,6 +_,7 @@
|
||||
{
|
||||
// Paper end - plugin loader api
|
||||
return null;
|
||||
}
|
||||
+ if (!JavaPluginLoader.SuppressLibraryLoaderLogger) // Purpur - Add log suppression for LibraryLoader
|
||||
logger.log( Level.INFO, "[{0}] Loading {1} libraries... please wait", new Object[]
|
||||
{
|
||||
java.util.Objects.requireNonNullElseGet(desc.getPrefix(), desc::getName), desc.getLibraries().size() // Paper - use configured log prefix
|
||||
@@ -144,6 +_,7 @@
|
||||
logger.log(Level.INFO, "[{0}] Loading {1} libraries... please wait", new Object[]
|
||||
{
|
||||
java.util.Objects.requireNonNullElseGet(desc.getPrefix(), desc::getName), desc.getLibraries().size() // Paper - use configured log prefix
|
||||
@@ -146,6 +_,7 @@
|
||||
}
|
||||
|
||||
jarFiles.add( url );
|
||||
jarFiles.add(url);
|
||||
+ if (!JavaPluginLoader.SuppressLibraryLoaderLogger) // Purpur - Add log suppression for LibraryLoader
|
||||
logger.log( Level.INFO, "[{0}] Loaded library {1}", new Object[]
|
||||
{
|
||||
java.util.Objects.requireNonNullElseGet(desc.getPrefix(), desc::getName), file // Paper - use configured log prefix
|
||||
logger.log(Level.INFO, "[{0}] Loaded library {1}", new Object[]
|
||||
{
|
||||
java.util.Objects.requireNonNullElseGet(desc.getPrefix(), desc::getName), file // Paper - use configured log prefix
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
package org.purpurmc.purpur.event.entity;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Fired when an entity is hindered from teleporting.
|
||||
*/
|
||||
@NullMarked
|
||||
public class EntityTeleportHinderedEvent extends EntityEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private final Reason reason;
|
||||
|
||||
private final @Nullable TeleportCause teleportCause;
|
||||
|
||||
private boolean retry = false;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public EntityTeleportHinderedEvent(Entity what, Reason reason, @Nullable TeleportCause teleportCause) {
|
||||
super(what);
|
||||
this.reason = reason;
|
||||
this.teleportCause = teleportCause;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return why the teleport was hindered.
|
||||
*/
|
||||
public Reason getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return why the teleport occurred if cause was given, otherwise {@code null}.
|
||||
*/
|
||||
@Nullable
|
||||
public TeleportCause getTeleportCause() {
|
||||
return teleportCause;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the teleport should be retried.
|
||||
* <p>
|
||||
* Note that this can put the server in a never-ending loop of trying to teleport someone resulting in a stack
|
||||
* overflow. Do not retry more than necessary.
|
||||
* </p>
|
||||
*
|
||||
* @return whether the teleport should be retried.
|
||||
*/
|
||||
public boolean shouldRetry() {
|
||||
return retry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the teleport should be retried.
|
||||
* <p>
|
||||
* Note that this can put the server in a never-ending loop of trying to teleport someone resulting in a stack
|
||||
* overflow. Do not retry more than necessary.
|
||||
* </p>
|
||||
*
|
||||
* @param retry whether the teleport should be retried.
|
||||
*/
|
||||
public void setShouldRetry(boolean retry) {
|
||||
this.retry = retry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the event and tests if should retry.
|
||||
*
|
||||
* @return whether the teleport should be retried.
|
||||
*/
|
||||
@Override
|
||||
public boolean callEvent() {
|
||||
super.callEvent();
|
||||
return shouldRetry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reason for hindrance in teleports.
|
||||
*/
|
||||
public enum Reason {
|
||||
/**
|
||||
* The teleported entity is a passenger of another entity.
|
||||
*/
|
||||
IS_PASSENGER,
|
||||
|
||||
/**
|
||||
* The teleported entity has passengers.
|
||||
*/
|
||||
IS_VEHICLE,
|
||||
|
||||
/**
|
||||
* The teleport event was cancelled.
|
||||
* <p>
|
||||
* This is only caused by players teleporting.
|
||||
* </p>
|
||||
*/
|
||||
EVENT_CANCELLED,
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,18 @@
|
||||
--- a/paper-server/build.gradle.kts
|
||||
+++ b/paper-server/build.gradle.kts
|
||||
@@ -21,6 +_,16 @@
|
||||
// macheOldPath = file("F:\\Projects\\PaperTooling\\mache\\versions\\1.21.4\\src\\main\\java")
|
||||
// gitFilePatches = true
|
||||
@@ -2,6 +_,7 @@
|
||||
import io.papermc.paperweight.attribute.DevBundleOutput
|
||||
import io.papermc.paperweight.util.*
|
||||
import java.time.Instant
|
||||
+import kotlin.io.path.writeText
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
@@ -22,6 +_,18 @@
|
||||
minecraftVersion = providers.gradleProperty("mcVersion")
|
||||
gitFilePatches = false
|
||||
|
||||
+ // Purpur start - Rebrand
|
||||
+ val purpur = forks.register("purpur") {
|
||||
+ upstream.patchDir("paperServer") {
|
||||
+ upstreamPath = "paper-server"
|
||||
@@ -13,15 +22,17 @@
|
||||
+ }
|
||||
+ }
|
||||
+ activeFork = purpur
|
||||
+ // Purpur end - Rebrand
|
||||
+
|
||||
spigot {
|
||||
buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42"
|
||||
packageVersion = "v1_21_R3" // also needs to be updated in MappingEnvironment
|
||||
@@ -101,7 +_,20 @@
|
||||
enabled = false
|
||||
buildDataRef = "42d18d4c4653ffc549778dbe223f6994a031d69e"
|
||||
@@ -104,7 +_,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
-val log4jPlugins = sourceSets.create("log4jPlugins")
|
||||
+// Purpur start - Rebrand
|
||||
+sourceSets {
|
||||
+ main {
|
||||
+ java { srcDir("../paper-server/src/main/java") }
|
||||
@@ -32,34 +43,34 @@
|
||||
+ resources { srcDir("../paper-server/src/test/resources") }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+val log4jPlugins = sourceSets.create("log4jPlugins") {
|
||||
+ java { srcDir("../paper-server/src/log4jPlugins/java") }
|
||||
+}
|
||||
+// Purpur end - Rebrand
|
||||
configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
extendsFrom(configurations.compileClasspath.get())
|
||||
}
|
||||
@@ -119,7 +_,7 @@
|
||||
@@ -127,7 +_,7 @@
|
||||
}
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":paper-api"))
|
||||
+ implementation(project(":purpur-api"))
|
||||
implementation("ca.spottedleaf:concurrentutil:0.0.3")
|
||||
+ implementation(project(":purpur-api")) // Purpur
|
||||
implementation("ca.spottedleaf:concurrentutil:0.0.7")
|
||||
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
|
||||
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
|
||||
@@ -149,6 +_,10 @@
|
||||
runtimeOnly("com.mysql:mysql-connector-j:9.1.0")
|
||||
runtimeOnly("com.lmax:disruptor:3.4.4")
|
||||
@@ -153,6 +_,10 @@
|
||||
implementation("org.ow2.asm:asm-commons:9.8")
|
||||
implementation("org.spongepowered:configurate-yaml:4.2.0")
|
||||
|
||||
+ implementation("org.mozilla:rhino-runtime:1.7.14") // Purpur
|
||||
+ implementation("org.mozilla:rhino-engine:1.7.14") // Purpur
|
||||
+ implementation("dev.omega24:upnp4j:1.0") // Purpur
|
||||
+
|
||||
runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")
|
||||
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
|
||||
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
|
||||
@@ -188,14 +_,14 @@
|
||||
// Deps that were previously in the API but have now been moved here for backwards compat, eventually to be removed
|
||||
runtimeOnly("commons-lang:commons-lang:2.6")
|
||||
runtimeOnly("org.xerial:sqlite-jdbc:3.49.1.0")
|
||||
@@ -198,14 +_,14 @@
|
||||
val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim()
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
@@ -79,3 +90,67 @@
|
||||
"Build-Number" to (build ?: ""),
|
||||
"Build-Time" to buildTime.toString(),
|
||||
"Git-Branch" to gitBranch,
|
||||
@@ -264,7 +_,7 @@
|
||||
jvmArgumentProviders.add(provider)
|
||||
}
|
||||
|
||||
-val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("src/generated/java").asFile.toPath()
|
||||
+val generatedDir: java.nio.file.Path = layout.projectDirectory.dir("../paper-server/src/generated/java").asFile.toPath() // Purpur
|
||||
idea {
|
||||
module {
|
||||
generatedSourceDirs.add(generatedDir.toFile())
|
||||
@@ -356,7 +_,7 @@
|
||||
mainClass.set(null as String?)
|
||||
}
|
||||
|
||||
-fill {
|
||||
+/* fill { // Purpur - we don't use fill
|
||||
project("paper")
|
||||
versionFamily(paperweight.minecraftVersion.map { it.split(".", "-").takeWhile { part -> part.toIntOrNull() != null }.take(2).joinToString(".") })
|
||||
version(paperweight.minecraftVersion)
|
||||
@@ -371,4 +_,44 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
-}
|
||||
+} */ // Purpur - we don't use fill
|
||||
+
|
||||
+// tasks.register("rebuildMinecraftSourcesWithGit") {
|
||||
+// group = "temp"
|
||||
+//
|
||||
+// val patchDir = project.rootDir.resolve("purpur-server/minecraft-patches/sources").convertToPath().cleanDir()
|
||||
+// val inputDir = this.project.rootDir.resolve("purpur-server/src/minecraft/java").convertToPath()
|
||||
+//
|
||||
+// val git = Git(inputDir)
|
||||
+// git("stash", "push").executeSilently(silenceErr = true)
|
||||
+// git("checkout", "file").executeSilently(silenceErr = true)
|
||||
+//
|
||||
+// rebuildWithGit(git, patchDir)
|
||||
+// }
|
||||
+//
|
||||
+// private fun rebuildWithGit(
|
||||
+// git: Git,
|
||||
+// patchDir: java.nio.file.Path
|
||||
+// ): Int {
|
||||
+// val files = git("diff-tree", "--name-only", "--no-commit-id", "-r", "HEAD").getText().split("\n")
|
||||
+// files.parallelStream().forEach { filename ->
|
||||
+// if (filename.isBlank()) return@forEach
|
||||
+// val patch = git(
|
||||
+// "format-patch",
|
||||
+// "--diff-algorithm=myers",
|
||||
+// "--full-index",
|
||||
+// "--no-signature",
|
||||
+// "--no-stat",
|
||||
+// "--no-numbered",
|
||||
+// "-1",
|
||||
+// "HEAD",
|
||||
+// "--stdout",
|
||||
+// filename
|
||||
+// ).getText()
|
||||
+// val patchFile = patchDir.resolve("$filename.patch")
|
||||
+// patchFile.createParentDirectories()
|
||||
+// patchFile.writeText(patch)
|
||||
+// }
|
||||
+//
|
||||
+// return files.size
|
||||
+// }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -5,10 +5,10 @@ Subject: [PATCH] Barrels and enderchests 6 rows
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
||||
index 2d09f2a2c97f29ac0d941b7a3fb941102a5d545e..94abb9d8f6381aee000dbd0720477db8b7ca279c 100644
|
||||
index 80986de9222010f01982cfdab58649429d457778..22f768d805bfc1c6e6e50449e1d275c3195036ad 100644
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1027,6 +1027,27 @@ public abstract class PlayerList {
|
||||
@@ -887,6 +887,27 @@ public abstract class PlayerList {
|
||||
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
||||
this.server.getCommands().sendCommands(player);
|
||||
} // Paper - Add sendOpLevel API
|
||||
@@ -35,12 +35,12 @@ index 2d09f2a2c97f29ac0d941b7a3fb941102a5d545e..94abb9d8f6381aee000dbd0720477db8
|
||||
+ // Purpur end - Barrels and enderchests 6 rows
|
||||
}
|
||||
|
||||
public boolean isWhiteListed(GameProfile profile) {
|
||||
// Paper start - whitelist verify event / login event
|
||||
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
|
||||
index ca998a8a480af63d4a5f58a1f4490528a7b33c69..43657822f0660613078e9afa512000b5255a1537 100644
|
||||
index 4bf98783e7199bc5c7c05c953729523b0b75b2b5..c4039b1ba46ea72c7cd1cbed9e8edbffc5d5e1cc 100644
|
||||
--- a/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/net/minecraft/world/entity/player/Player.java
|
||||
@@ -202,6 +202,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -181,6 +181,7 @@ public abstract class Player extends Avatar implements ContainerUser {
|
||||
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
|
||||
public int burpDelay = 0; // Purpur - Burp delay
|
||||
public boolean canPortalInstant = false; // Purpur - Add portal permission bypass
|
||||
@@ -49,7 +49,7 @@ index ca998a8a480af63d4a5f58a1f4490528a7b33c69..43657822f0660613078e9afa512000b5
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
diff --git a/net/minecraft/world/inventory/ChestMenu.java b/net/minecraft/world/inventory/ChestMenu.java
|
||||
index 280169afbd637eeb67ddf7eaeb4eecd464a128d5..ba7730a24831efa33de4c5ffce57bfa7177f89d6 100644
|
||||
index 1fb3a34ea872dec73658fac59743e46ef8db5151..4c3b8d7ba777916ffc5ad0feccffbc7634bffe8d 100644
|
||||
--- a/net/minecraft/world/inventory/ChestMenu.java
|
||||
+++ b/net/minecraft/world/inventory/ChestMenu.java
|
||||
@@ -66,10 +66,30 @@ public class ChestMenu extends AbstractContainerMenu {
|
||||
@@ -84,10 +84,10 @@ index 280169afbd637eeb67ddf7eaeb4eecd464a128d5..ba7730a24831efa33de4c5ffce57bfa7
|
||||
return new ChestMenu(MenuType.GENERIC_9x6, containerId, playerInventory, container, 6);
|
||||
}
|
||||
diff --git a/net/minecraft/world/inventory/PlayerEnderChestContainer.java b/net/minecraft/world/inventory/PlayerEnderChestContainer.java
|
||||
index a6a359bab2a727f4631b633a8bb370dd40decc75..d2d75e5c34c97300ce5da8c7ea70958aba31fa4a 100644
|
||||
index 9749909b8253b432bb2f7fba2cd8ff17a8579b30..2c65c6428cb5925f8505cb0836b359f7e18c64eb 100644
|
||||
--- a/net/minecraft/world/inventory/PlayerEnderChestContainer.java
|
||||
+++ b/net/minecraft/world/inventory/PlayerEnderChestContainer.java
|
||||
@@ -25,11 +25,18 @@ public class PlayerEnderChestContainer extends SimpleContainer {
|
||||
@@ -26,11 +26,18 @@ public class PlayerEnderChestContainer extends SimpleContainer {
|
||||
}
|
||||
|
||||
public PlayerEnderChestContainer(Player owner) {
|
||||
@@ -108,7 +108,7 @@ index a6a359bab2a727f4631b633a8bb370dd40decc75..d2d75e5c34c97300ce5da8c7ea70958a
|
||||
this.activeChest = enderChestBlockEntity;
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/block/EnderChestBlock.java b/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
index f5533960708bdbaf2eacefbc7c7c3123b7d26502..17aa27885b4431bf7b98799e02d080b5a0ecbbf1 100644
|
||||
index 383e8285d366c7f594b0b4ff55b367970c9b69e4..077edf449d4faa41abafb94ac41dfe822f449d04 100644
|
||||
--- a/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
+++ b/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
@@ -85,8 +85,8 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
|
||||
@@ -159,13 +159,13 @@ index f5533960708bdbaf2eacefbc7c7c3123b7d26502..17aa27885b4431bf7b98799e02d080b5
|
||||
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
|
||||
return new EnderChestBlockEntity(pos, state);
|
||||
diff --git a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||
index 0f808855f58281578c2758513787f0f7330c9291..9f6063089f0aa3a68d26ae7cfe39379123ab2f47 100644
|
||||
index 75c09a2079c89f9346391abdd01ef8790b9cbb13..04f6b3c328377091734a111f5a219379e32b5640 100644
|
||||
--- a/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||
@@ -55,7 +55,17 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
this.maxStack = i;
|
||||
@@ -59,7 +59,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
}
|
||||
// CraftBukkit end
|
||||
private static final Component DEFAULT_NAME = Component.translatable("container.barrel");
|
||||
- private NonNullList<ItemStack> items = NonNullList.withSize(27, ItemStack.EMPTY);
|
||||
+ // Purpur start - Barrels and enderchests 6 rows
|
||||
+ private NonNullList<ItemStack> items = NonNullList.withSize(switch (org.purpurmc.purpur.PurpurConfig.barrelRows) {
|
||||
@@ -177,11 +177,10 @@ index 0f808855f58281578c2758513787f0f7330c9291..9f6063089f0aa3a68d26ae7cfe393791
|
||||
+ default -> 27;
|
||||
+ }, ItemStack.EMPTY);
|
||||
+ // Purpur end - Barrels and enderchests 6 rows
|
||||
+
|
||||
public final ContainerOpenersCounter openersCounter = new ContainerOpenersCounter() {
|
||||
@Override
|
||||
protected void onOpen(Level level, BlockPos pos, BlockState state) {
|
||||
@@ -107,7 +117,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
@@ -111,7 +120,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
|
||||
@Override
|
||||
public int getContainerSize() {
|
||||
@@ -199,7 +198,7 @@ index 0f808855f58281578c2758513787f0f7330c9291..9f6063089f0aa3a68d26ae7cfe393791
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,7 +146,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
@@ -131,7 +149,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
|
||||
@Override
|
||||
protected AbstractContainerMenu createMenu(int id, Inventory player) {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Giants AI settings
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Giant.java b/net/minecraft/world/entity/monster/Giant.java
|
||||
index 13021800af7cc9263ef4f393f9cfbda5061a32ae..73da18c4b54e250c434fd75971ef0a8f7c8cf6a3 100644
|
||||
index 416bb85fc87b5f9e372f33df8fe27f12e83834b9..40cf8f44a6b01d45306dab4ba4f9a7ea7c6590a9 100644
|
||||
--- a/net/minecraft/world/entity/monster/Giant.java
|
||||
+++ b/net/minecraft/world/entity/monster/Giant.java
|
||||
@@ -30,8 +30,25 @@ public class Giant extends Monster {
|
||||
@@ -25,19 +25,19 @@ index 13021800af7cc9263ef4f393f9cfbda5061a32ae..73da18c4b54e250c434fd75971ef0a8f
|
||||
+ if (level().purpurConfig.giantHaveHostileAI) {
|
||||
+ this.goalSelector.addGoal(2, new net.minecraft.world.entity.ai.goal.MeleeAttackGoal(this, 1.0D, false));
|
||||
+ this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
|
||||
+ this.targetSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal(this).setAlertOthers(ZombifiedPiglin.class));
|
||||
+ this.targetSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal(this).setAlertOthers(net.minecraft.world.entity.monster.zombie.ZombifiedPiglin.class));
|
||||
+ this.targetSelector.addGoal(2, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.player.Player.class, true));
|
||||
+ this.targetSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.npc.Villager.class, false));
|
||||
+ this.targetSelector.addGoal(4, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.animal.IronGolem.class, true));
|
||||
+ this.targetSelector.addGoal(5, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.animal.Turtle.class, true));
|
||||
+ this.targetSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.npc.villager.Villager.class, false));
|
||||
+ this.targetSelector.addGoal(4, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.animal.golem.IronGolem.class, true));
|
||||
+ this.targetSelector.addGoal(5, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.animal.turtle.Turtle.class, true));
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Giants AI settings
|
||||
}
|
||||
// Purpur end - Ridables
|
||||
|
||||
@@ -49,8 +66,36 @@ public class Giant extends Monster {
|
||||
return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 100.0).add(Attributes.MOVEMENT_SPEED, 0.5).add(Attributes.ATTACK_DAMAGE, 50.0);
|
||||
@@ -53,8 +70,36 @@ public class Giant extends Monster {
|
||||
.add(Attributes.CAMERA_DISTANCE, 16.0);
|
||||
}
|
||||
|
||||
+ // Purpur - Giants AI settings
|
||||
|
||||
@@ -4,11 +4,11 @@ Date: Sun, 12 Apr 2020 13:19:34 -0500
|
||||
Subject: [PATCH] Chickens can retaliate
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Chicken.java b/net/minecraft/world/entity/animal/Chicken.java
|
||||
index 509163f409a5b8988a484aedb2f3ddf042d5eb13..d718f0ed362c49803260dceed64bd93e2b6744fc 100644
|
||||
--- a/net/minecraft/world/entity/animal/Chicken.java
|
||||
+++ b/net/minecraft/world/entity/animal/Chicken.java
|
||||
@@ -73,6 +73,11 @@ public class Chicken extends Animal {
|
||||
diff --git a/net/minecraft/world/entity/animal/chicken/Chicken.java b/net/minecraft/world/entity/animal/chicken/Chicken.java
|
||||
index bfc5c6639ef1005d2752d5164f3613ddacc46bf1..52a0bf792337e2f1cf11e215b033caae21ee774b 100644
|
||||
--- a/net/minecraft/world/entity/animal/chicken/Chicken.java
|
||||
+++ b/net/minecraft/world/entity/animal/chicken/Chicken.java
|
||||
@@ -95,6 +95,11 @@ public class Chicken extends Animal {
|
||||
public void initAttributes() {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.chickenMaxHealth);
|
||||
this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.chickenScale);
|
||||
@@ -20,7 +20,7 @@ index 509163f409a5b8988a484aedb2f3ddf042d5eb13..d718f0ed362c49803260dceed64bd93e
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -80,13 +85,21 @@ public class Chicken extends Animal {
|
||||
@@ -102,13 +107,21 @@ public class Chicken extends Animal {
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
|
||||
@@ -43,7 +43,7 @@ index 509163f409a5b8988a484aedb2f3ddf042d5eb13..d718f0ed362c49803260dceed64bd93e
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,7 +108,7 @@ public class Chicken extends Animal {
|
||||
@@ -117,7 +130,7 @@ public class Chicken extends Animal {
|
||||
}
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
|
||||
@@ -5,29 +5,29 @@ Subject: [PATCH] Minecart settings and WASD controls
|
||||
|
||||
|
||||
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||
index d77381237f8a7d1b2f280a5032f5e1c8f0ab8f94..9a88ca440fad04b5941cda125c6a39d24adf6d37 100644
|
||||
index 2eba1b0ac8b4a0bb34d04b81c4c279db6e716b3b..01efe1fbd185ebd3a60c6bbb7aa2d82817506e7d 100644
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1240,6 +1240,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
@@ -1311,6 +1311,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
} else {
|
||||
// Purpur start - Add boat fall damage config
|
||||
if (damageSource.is(net.minecraft.tags.DamageTypeTags.IS_FALL)) {
|
||||
+ // Purpur start - Minecart settings and WASD controls
|
||||
+ if (getRootVehicle() instanceof net.minecraft.world.entity.vehicle.AbstractMinecart && level().purpurConfig.minecartControllable && !level().purpurConfig.minecartControllableFallDamage) {
|
||||
+ if (getRootVehicle() instanceof AbstractMinecart && level().purpurConfig.minecartControllable && !level().purpurConfig.minecartControllableFallDamage) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end - Minecart settings and WASD controls
|
||||
if (getRootVehicle() instanceof net.minecraft.world.entity.vehicle.Boat && !level().purpurConfig.boatsDoFallDamage) {
|
||||
if (getRootVehicle() instanceof net.minecraft.world.entity.vehicle.boat.Boat && !level().purpurConfig.boatsDoFallDamage) {
|
||||
return false;
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
index 9e15e7159cf98b3928110df9eae6de93793bf44e..6df4d736d94b9e49a3eb3d59a329e37127aa64cd 100644
|
||||
--- a/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
||||
@@ -83,6 +83,10 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||
diff --git a/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java b/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java
|
||||
index 1123ec0038552e0b40774f4a433ff325695ea071..48099ae66045b6e78ec52832e3b972ac9c9bc246 100644
|
||||
--- a/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java
|
||||
@@ -105,6 +105,10 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||
private double flyingY = 0.95;
|
||||
private double flyingZ = 0.95;
|
||||
public Double maxSpeed;
|
||||
public @Nullable Double maxSpeed;
|
||||
+ // Purpur start - Minecart settings and WASD controls
|
||||
+ public double storedMaxSpeed;
|
||||
+ public boolean isNewBehavior;
|
||||
@@ -35,7 +35,7 @@ index 9e15e7159cf98b3928110df9eae6de93793bf44e..6df4d736d94b9e49a3eb3d59a329e371
|
||||
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -91,8 +95,13 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||
@@ -113,8 +117,13 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||
this.blocksBuilding = true;
|
||||
if (useExperimentalMovement(level)) {
|
||||
this.behavior = new NewMinecartBehavior(this);
|
||||
@@ -49,7 +49,7 @@ index 9e15e7159cf98b3928110df9eae6de93793bf44e..6df4d736d94b9e49a3eb3d59a329e371
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,6 +267,14 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||
@@ -278,6 +287,14 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -64,7 +64,7 @@ index 9e15e7159cf98b3928110df9eae6de93793bf44e..6df4d736d94b9e49a3eb3d59a329e371
|
||||
// CraftBukkit start
|
||||
double prevX = this.getX();
|
||||
double prevY = this.getY();
|
||||
@@ -394,15 +411,61 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||
@@ -392,15 +409,61 @@ public abstract class AbstractMinecart extends VehicleEntity {
|
||||
this.behavior.moveAlongTrack(level);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ index 9e15e7159cf98b3928110df9eae6de93793bf44e..6df4d736d94b9e49a3eb3d59a329e371
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
if (!this.onGround()) {
|
||||
diff --git a/net/minecraft/world/item/MinecartItem.java b/net/minecraft/world/item/MinecartItem.java
|
||||
index 620069daba04d48b57fc933328eda77f6ca9333e..0403b9b01994269d394820e8c8710ba1b9808bf0 100644
|
||||
index 3b511139985ea1646661ae0a6bcd1f0e386561e7..3a65e1a0b914d113feb727833803ece8f3b2e020 100644
|
||||
--- a/net/minecraft/world/item/MinecartItem.java
|
||||
+++ b/net/minecraft/world/item/MinecartItem.java
|
||||
@@ -30,8 +30,9 @@ public class MinecartItem extends Item {
|
||||
|
||||
@@ -5,49 +5,48 @@ Subject: [PATCH] Villagers follow emerald blocks
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
|
||||
index 61ed4d687120fcbb7b91863e400f3657ebcde687..e773c426567964fc8269237d71c3434a5473985c 100644
|
||||
index 686776bb00560f9da8838bd5f8dd64aaddfa7a2b..ccdd439a89b7e7e10ee960cfe1e5e119d5367799 100644
|
||||
--- a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
|
||||
+++ b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
|
||||
@@ -162,7 +162,7 @@ public class DefaultAttributes {
|
||||
@@ -173,7 +173,7 @@ public class DefaultAttributes {
|
||||
.put(EntityType.VILLAGER, Villager.createAttributes().build())
|
||||
.put(EntityType.VINDICATOR, Vindicator.createAttributes().build())
|
||||
.put(EntityType.WARDEN, Warden.createAttributes().build())
|
||||
- .put(EntityType.WANDERING_TRADER, Mob.createMobAttributes().build())
|
||||
+ .put(EntityType.WANDERING_TRADER, net.minecraft.world.entity.npc.WanderingTrader.createAttributes().build()) // Purpur - Villagers follow emerald blocks
|
||||
+ .put(EntityType.WANDERING_TRADER, net.minecraft.world.entity.npc.wanderingtrader.WanderingTrader.createAttributes().build()) // Purpur - Villagers follow emerald blocks
|
||||
.put(EntityType.WITCH, Witch.createAttributes().build())
|
||||
.put(EntityType.WITHER, WitherBoss.createAttributes().build())
|
||||
.put(EntityType.WITHER_SKELETON, AbstractSkeleton.createAttributes().build())
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/TemptGoal.java b/net/minecraft/world/entity/ai/goal/TemptGoal.java
|
||||
index 438d6347778a94b4fe430320b268a2d67afa209a..f88f618d34fb343b31de3af1a875d6633703df71 100644
|
||||
index 18030dc04eb7d7971e457637b5320b1e41665658..60ebd57de496eba6ad307195ffacd3b7fc4149ff 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/TemptGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/TemptGoal.java
|
||||
@@ -58,7 +58,7 @@ public class TemptGoal extends Goal {
|
||||
@@ -70,7 +70,7 @@ public class TemptGoal extends Goal {
|
||||
}
|
||||
|
||||
private boolean shouldFollow(LivingEntity entity) {
|
||||
- return this.items.test(entity.getMainHandItem()) || this.items.test(entity.getOffhandItem());
|
||||
+ return (this.items.test(entity.getMainHandItem()) || this.items.test(entity.getOffhandItem())) && (!(this.mob instanceof net.minecraft.world.entity.npc.Villager villager) || !villager.isSleeping()); // Purpur - Villagers follow emerald blocks
|
||||
+ return (this.items.test(entity.getMainHandItem()) || this.items.test(entity.getOffhandItem())) && (!(this.mob instanceof net.minecraft.world.entity.npc.villager.Villager villager) || !villager.isSleeping()); // Purpur - Villagers follow emerald blocks
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/world/entity/npc/AbstractVillager.java b/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
index a71d16d968bb90fd7aca6f01a3dd56df4f9a7ce6..b4e79cac5611942240ce85120f7bbee329ae2fb8 100644
|
||||
--- a/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
+++ b/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
@@ -45,6 +45,8 @@ import org.bukkit.event.entity.VillagerAcquireTradeEvent;
|
||||
// CraftBukkit end
|
||||
diff --git a/net/minecraft/world/entity/npc/villager/AbstractVillager.java b/net/minecraft/world/entity/npc/villager/AbstractVillager.java
|
||||
index fa8f1ea38192f9ad0a961a53399f295d83af7721..05d1a859e1aee639ad9572f2369e6db3c3d7a111 100644
|
||||
--- a/net/minecraft/world/entity/npc/villager/AbstractVillager.java
|
||||
+++ b/net/minecraft/world/entity/npc/villager/AbstractVillager.java
|
||||
@@ -38,6 +38,7 @@ import net.minecraft.world.phys.Vec3;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
public abstract class AbstractVillager extends AgeableMob implements InventoryCarrier, Npc, Merchant {
|
||||
+ static final net.minecraft.world.item.crafting.Ingredient TEMPT_ITEMS = net.minecraft.world.item.crafting.Ingredient.of(net.minecraft.world.level.block.Blocks.EMERALD_BLOCK.asItem()); // Purpur - Villagers follow emerald blocks
|
||||
+
|
||||
// CraftBukkit start
|
||||
@Override
|
||||
public CraftMerchant getCraftMerchant() {
|
||||
diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java
|
||||
index c4ce3a2f03bb7665beb131892288d8e4f722a4b5..ff07cfe07200be23f17310522d737fca3251a580 100644
|
||||
--- a/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -265,6 +265,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
+ public static final net.minecraft.world.item.crafting.Ingredient TEMPT_ITEMS = net.minecraft.world.item.crafting.Ingredient.of(net.minecraft.world.level.block.Blocks.EMERALD_BLOCK.asItem()); // Purpur - Villagers follow emerald blocks
|
||||
private static final EntityDataAccessor<Integer> DATA_UNHAPPY_COUNTER = SynchedEntityData.defineId(AbstractVillager.class, EntityDataSerializers.INT);
|
||||
public static final int VILLAGER_SLOT_OFFSET = 300;
|
||||
private static final int VILLAGER_INVENTORY_SIZE = 8;
|
||||
diff --git a/net/minecraft/world/entity/npc/villager/Villager.java b/net/minecraft/world/entity/npc/villager/Villager.java
|
||||
index 6f9658af51f1f30434756f871cf6ab5cd2f3a7ea..02836bd2e8fda563877d3014ab839734aebc7457 100644
|
||||
--- a/net/minecraft/world/entity/npc/villager/Villager.java
|
||||
+++ b/net/minecraft/world/entity/npc/villager/Villager.java
|
||||
@@ -269,6 +269,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
|
||||
@@ -55,7 +54,7 @@ index c4ce3a2f03bb7665beb131892288d8e4f722a4b5..ff07cfe07200be23f17310522d737fca
|
||||
}
|
||||
// Purpur end - Ridables
|
||||
|
||||
@@ -273,6 +274,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -277,6 +278,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
public void initAttributes() {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.villagerMaxHealth);
|
||||
this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.villagerScale);
|
||||
@@ -63,7 +62,7 @@ index c4ce3a2f03bb7665beb131892288d8e4f722a4b5..ff07cfe07200be23f17310522d737fca
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -341,7 +343,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -345,7 +347,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
}
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
@@ -72,11 +71,11 @@ index c4ce3a2f03bb7665beb131892288d8e4f722a4b5..ff07cfe07200be23f17310522d737fca
|
||||
}
|
||||
|
||||
public boolean assignProfessionWhenSpawned() {
|
||||
diff --git a/net/minecraft/world/entity/npc/WanderingTrader.java b/net/minecraft/world/entity/npc/WanderingTrader.java
|
||||
index 5d5fa6b4ad18b4213f5098e4d708f3301a6f59c6..4ba2921dd99f674344fe3371332c9b23365d3aa2 100644
|
||||
--- a/net/minecraft/world/entity/npc/WanderingTrader.java
|
||||
+++ b/net/minecraft/world/entity/npc/WanderingTrader.java
|
||||
@@ -97,9 +97,16 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
|
||||
diff --git a/net/minecraft/world/entity/npc/wanderingtrader/WanderingTrader.java b/net/minecraft/world/entity/npc/wanderingtrader/WanderingTrader.java
|
||||
index 9d5dbaeafd899594425547fc58b87a1d0a52066e..c6c4f4f2a970db7e782181eaca312931b192b0d5 100644
|
||||
--- a/net/minecraft/world/entity/npc/wanderingtrader/WanderingTrader.java
|
||||
+++ b/net/minecraft/world/entity/npc/wanderingtrader/WanderingTrader.java
|
||||
@@ -89,9 +89,16 @@ public class WanderingTrader extends AbstractVillager implements Consumable.Over
|
||||
@Override
|
||||
public void initAttributes() {
|
||||
this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.wanderingTraderMaxHealth);
|
||||
@@ -93,7 +92,7 @@ index 5d5fa6b4ad18b4213f5098e4d708f3301a6f59c6..4ba2921dd99f674344fe3371332c9b23
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
@@ -134,6 +141,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
|
||||
@@ -126,6 +133,7 @@ public class WanderingTrader extends AbstractVillager implements Consumable.Over
|
||||
this.goalSelector.addGoal(1, new PanicGoal(this, 0.5));
|
||||
this.goalSelector.addGoal(1, new LookAtTradingPlayerGoal(this));
|
||||
this.goalSelector.addGoal(2, new WanderingTrader.WanderToPositionGoal(this, 2.0, 0.35));
|
||||
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Implement elytra settings
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index d1f7da0f4adc4609247c349d7ccdb0e6bba9b8f8..6de5f527c018201d874e06a45c9509fa12125766 100644
|
||||
index 983aea0bb8c581f06030adf74f0f7962f99c3c2a..c0a686ba573642f8f666db7c1636e29a770e9c05 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3595,7 +3595,18 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (i1 % 2 == 0) {
|
||||
List<EquipmentSlot> list = EquipmentSlot.VALUES.stream().filter(slot -> canGlideUsing(this.getItemBySlot(slot), slot)).toList();
|
||||
@@ -3883,7 +3883,18 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
.filter(equipmentSlot1 -> canGlideUsing(this.getItemBySlot(equipmentSlot1), equipmentSlot1))
|
||||
.toList();
|
||||
EquipmentSlot equipmentSlot = Util.getRandom(list, this.random);
|
||||
- this.getItemBySlot(equipmentSlot).hurtAndBreak(1, this, equipmentSlot);
|
||||
+
|
||||
@@ -29,18 +29,17 @@ index d1f7da0f4adc4609247c349d7ccdb0e6bba9b8f8..6de5f527c018201d874e06a45c9509fa
|
||||
|
||||
this.gameEvent(GameEvent.ELYTRA_GLIDE);
|
||||
diff --git a/net/minecraft/world/item/FireworkRocketItem.java b/net/minecraft/world/item/FireworkRocketItem.java
|
||||
index 75a9bd205f32b77c5d242cb9fac0f571ce36045a..b03f182c62c699cc222e67c1ae6eadf99c45d48d 100644
|
||||
index 2c597e20c1ff587f2eadef600bedb9e01b999bbf..e548f7161f14d7dc02d6882c3639ff65d59d7b37 100644
|
||||
--- a/net/minecraft/world/item/FireworkRocketItem.java
|
||||
+++ b/net/minecraft/world/item/FireworkRocketItem.java
|
||||
@@ -66,6 +66,19 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
|
||||
com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemInHand), (org.bukkit.entity.Firework) delayed.projectile().getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand));
|
||||
if (event.callEvent() && delayed.attemptSpawn()) {
|
||||
player.awardStat(Stats.ITEM_USED.get(this)); // Moved up from below
|
||||
+
|
||||
@@ -73,6 +73,17 @@ public class FireworkRocketItem extends Item implements ProjectileItem {
|
||||
if (player.dropAllLeashConnections(null)) {
|
||||
level.playSound(null, player, SoundEvents.LEAD_BREAK, SoundSource.NEUTRAL, 1.0F, 1.0F);
|
||||
}
|
||||
+ // Purpur start - Implement elytra settings
|
||||
+ if (level.purpurConfig.elytraDamagePerFireworkBoost > 0) {
|
||||
+ List<net.minecraft.world.entity.EquipmentSlot> list = net.minecraft.world.entity.EquipmentSlot.VALUES.stream().filter((enumitemslot) -> net.minecraft.world.entity.LivingEntity.canGlideUsing(player.getItemBySlot(enumitemslot), enumitemslot)).toList();
|
||||
+ net.minecraft.world.entity.EquipmentSlot enumitemslot = net.minecraft.Util.getRandom(list, player.random);
|
||||
+ java.util.List<net.minecraft.world.entity.EquipmentSlot> list = net.minecraft.world.entity.EquipmentSlot.VALUES.stream().filter((enumitemslot) -> net.minecraft.world.entity.LivingEntity.canGlideUsing(player.getItemBySlot(enumitemslot), enumitemslot)).toList();
|
||||
+ net.minecraft.world.entity.EquipmentSlot enumitemslot = net.minecraft.util.Util.getRandom(list, player.random);
|
||||
+
|
||||
+ ItemStack glideItem = player.getItemBySlot(enumitemslot);
|
||||
+ if (player.canGlide()) {
|
||||
@@ -48,15 +47,14 @@ index 75a9bd205f32b77c5d242cb9fac0f571ce36045a..b03f182c62c699cc222e67c1ae6eadf9
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Implement elytra settings
|
||||
+
|
||||
if (event.shouldConsume() && !player.hasInfiniteMaterials()) {
|
||||
itemInHand.shrink(1); // Moved up from below
|
||||
} else {
|
||||
diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java
|
||||
index c5426585f53a3139dc9d188a73e3a7ff4cb2e492..264b713e8b7c3d5f7d8e1facc90a60349f2cf414 100644
|
||||
index b8e38ce9b5c4b11e5bcbe6cf5603d6d39454759c..fd90ba8eba88c8d4fa372cb1047e0af8528f914d 100644
|
||||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -733,6 +733,14 @@ public final class ItemStack implements DataComponentHolder {
|
||||
@@ -702,6 +702,14 @@ public final class ItemStack implements DataComponentHolder {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(serverPlayer, this); // Paper - Add EntityDamageItemEvent
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -72,18 +70,17 @@ index c5426585f53a3139dc9d188a73e3a7ff4cb2e492..264b713e8b7c3d5f7d8e1facc90a6034
|
||||
onBreak.accept(item);
|
||||
}
|
||||
diff --git a/net/minecraft/world/item/TridentItem.java b/net/minecraft/world/item/TridentItem.java
|
||||
index 07f8c7644a112bb1ba283d1eadd8661010e888a4..7ea7db834e7b627a1d7d37ca87cd43eb61408565 100644
|
||||
index b87861c089f849e855d10c15ede53fd7c9e6a47c..633bb1a6d69b55717a9a07978b92f625ff5d066a 100644
|
||||
--- a/net/minecraft/world/item/TridentItem.java
|
||||
+++ b/net/minecraft/world/item/TridentItem.java
|
||||
@@ -133,6 +133,18 @@ public class TridentItem extends Item implements ProjectileItem {
|
||||
@@ -126,6 +126,17 @@ public class TridentItem extends Item implements ProjectileItem {
|
||||
f1 *= tridentSpinAttackStrength / squareRoot;
|
||||
f2 *= tridentSpinAttackStrength / squareRoot;
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerRiptideEvent(player, stack, f, f1, f2); // CraftBukkit
|
||||
+
|
||||
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerRiptideEvent(player, stack, f, f1, f2)) return false; // Paper - Add player riptide event
|
||||
+ // Purpur start - Implement elytra settings
|
||||
+ List<EquipmentSlot> list = EquipmentSlot.VALUES.stream().filter((enumitemslot) -> LivingEntity.canGlideUsing(entity.getItemBySlot(enumitemslot), enumitemslot)).toList();
|
||||
+ List<net.minecraft.world.entity.EquipmentSlot> list = net.minecraft.world.entity.EquipmentSlot.VALUES.stream().filter((enumitemslot) -> LivingEntity.canGlideUsing(entity.getItemBySlot(enumitemslot), enumitemslot)).toList();
|
||||
+ if (!list.isEmpty()) {
|
||||
+ EquipmentSlot enumitemslot = net.minecraft.Util.getRandom(list, entity.random);
|
||||
+ net.minecraft.world.entity.EquipmentSlot enumitemslot = net.minecraft.util.Util.getRandom(list, entity.random);
|
||||
+ ItemStack glideItem = entity.getItemBySlot(enumitemslot);
|
||||
+ if (glideItem.has(net.minecraft.core.component.DataComponents.GLIDER) && level.purpurConfig.elytraDamagePerTridentBoost > 0) {
|
||||
+ glideItem.hurtAndBreak(level.purpurConfig.elytraDamagePerTridentBoost, entity, enumitemslot);
|
||||
@@ -4,11 +4,11 @@ Date: Thu, 26 Mar 2020 21:39:32 -0500
|
||||
Subject: [PATCH] Configurable jockey options
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java
|
||||
index 9c328f67260606d9252547848d5916cab4290e74..83fc978a94be4655e8c47ee634b8cd280d2a6fde 100644
|
||||
--- a/net/minecraft/world/entity/monster/Drowned.java
|
||||
+++ b/net/minecraft/world/entity/monster/Drowned.java
|
||||
@@ -105,6 +105,23 @@ public class Drowned extends Zombie implements RangedAttackMob {
|
||||
diff --git a/net/minecraft/world/entity/monster/zombie/Drowned.java b/net/minecraft/world/entity/monster/zombie/Drowned.java
|
||||
index 0b6d2bcec8506686eb6e0aaeb14870c14bd84e9d..3b1e3e7c1218cbfdfe48db3fad15280f43fd3311 100644
|
||||
--- a/net/minecraft/world/entity/monster/zombie/Drowned.java
|
||||
+++ b/net/minecraft/world/entity/monster/zombie/Drowned.java
|
||||
@@ -109,6 +109,23 @@ public class Drowned extends Zombie implements RangedAttackMob {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -32,11 +32,11 @@ index 9c328f67260606d9252547848d5916cab4290e74..83fc978a94be4655e8c47ee634b8cd28
|
||||
@Override
|
||||
protected void addBehaviourGoals() {
|
||||
this.goalSelector.addGoal(1, new Drowned.DrownedGoToWaterGoal(this, 1.0));
|
||||
diff --git a/net/minecraft/world/entity/monster/Husk.java b/net/minecraft/world/entity/monster/Husk.java
|
||||
index c2365ae1cf6f98e262f302a117c4647c383dfbb5..7a8951f93e65c6df145e30d44b9d928dd0c39189 100644
|
||||
--- a/net/minecraft/world/entity/monster/Husk.java
|
||||
+++ b/net/minecraft/world/entity/monster/Husk.java
|
||||
@@ -50,6 +50,23 @@ public class Husk extends Zombie {
|
||||
diff --git a/net/minecraft/world/entity/monster/zombie/Husk.java b/net/minecraft/world/entity/monster/zombie/Husk.java
|
||||
index 03270138e6fae7ee28f958cafee5b74b18dce355..d31145fee0f646d734e90199288b29f07854d066 100644
|
||||
--- a/net/minecraft/world/entity/monster/zombie/Husk.java
|
||||
+++ b/net/minecraft/world/entity/monster/zombie/Husk.java
|
||||
@@ -58,6 +58,23 @@ public class Husk extends Zombie {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -57,14 +57,14 @@ index c2365ae1cf6f98e262f302a117c4647c383dfbb5..7a8951f93e65c6df145e30d44b9d928d
|
||||
+ }
|
||||
+ // Purpur end - Configurable jockey options
|
||||
+
|
||||
public static boolean checkHuskSpawnRules(
|
||||
EntityType<Husk> entityType, ServerLevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
|
||||
) {
|
||||
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java
|
||||
index 8886aa0da372223ecd4d1a17c60971e167ced886..63446c874e7153dcfb99133145c8b5311d7d86cd 100644
|
||||
--- a/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -125,6 +125,20 @@ public class Zombie extends Monster {
|
||||
@Override
|
||||
public boolean isSunSensitive() {
|
||||
return false;
|
||||
diff --git a/net/minecraft/world/entity/monster/zombie/Zombie.java b/net/minecraft/world/entity/monster/zombie/Zombie.java
|
||||
index d873ca9873e95f3a5869cb63a93b0643a9c867dc..638642628c3dc9fa25d25c589029219c23d1e602 100644
|
||||
--- a/net/minecraft/world/entity/monster/zombie/Zombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/zombie/Zombie.java
|
||||
@@ -128,6 +128,20 @@ public class Zombie extends Monster {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -85,7 +85,7 @@ index 8886aa0da372223ecd4d1a17c60971e167ced886..63446c874e7153dcfb99133145c8b531
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
|
||||
@@ -556,19 +570,18 @@ public class Zombie extends Monster {
|
||||
@@ -531,19 +545,18 @@ public class Zombie extends Monster {
|
||||
}
|
||||
|
||||
if (spawnGroupData instanceof Zombie.ZombieGroupData zombieGroupData) {
|
||||
@@ -104,26 +104,26 @@ index 8886aa0da372223ecd4d1a17c60971e167ced886..63446c874e7153dcfb99133145c8b531
|
||||
if (!entitiesOfClass.isEmpty()) {
|
||||
Chicken chicken = entitiesOfClass.get(0);
|
||||
chicken.setChickenJockey(true);
|
||||
this.startRiding(chicken);
|
||||
this.startRiding(chicken, false, false);
|
||||
- }
|
||||
- } else if (random.nextFloat() < 0.05) {
|
||||
+ } else { // Purpur - Configurable jockey options
|
||||
Chicken chicken1 = EntityType.CHICKEN.create(this.level(), EntitySpawnReason.JOCKEY);
|
||||
if (chicken1 != null) {
|
||||
chicken1.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
||||
@@ -577,6 +590,7 @@ public class Zombie extends Monster {
|
||||
this.startRiding(chicken1);
|
||||
chicken1.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
||||
@@ -552,6 +565,7 @@ public class Zombie extends Monster {
|
||||
this.startRiding(chicken1, false, false);
|
||||
level.addFreshEntity(chicken1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit
|
||||
}
|
||||
+ } // Purpur - Configurable jockey options
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/monster/ZombieVillager.java b/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
index 578cfc33a493b5ebc2ed42733577129a8953a461..f1e9bf75c50f353bd377051be82a391f97d952fd 100644
|
||||
--- a/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/ZombieVillager.java
|
||||
@@ -107,6 +107,23 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
diff --git a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
|
||||
index 0a02684ec00540b91a2a68e5787e51d15b3743a7..62f55763d95e496da8b8fcf7d95752777e323b48 100644
|
||||
--- a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
|
||||
@@ -114,6 +114,23 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -147,11 +147,11 @@ index 578cfc33a493b5ebc2ed42733577129a8953a461..f1e9bf75c50f353bd377051be82a391f
|
||||
@Override
|
||||
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
||||
super.defineSynchedData(builder);
|
||||
diff --git a/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||
index 1424954f5b4cf0fbe821425cd741b4b5c1bfed50..9603589e0501feee900cd21b04eb84b02bb45de2 100644
|
||||
--- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
|
||||
@@ -88,6 +88,23 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
|
||||
diff --git a/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
|
||||
index 3ff8c95075f9d25c3a2e4160ee6d18057838a7b5..ec39ad6740361774f9ecfda7186cab9d8fac90f2 100644
|
||||
--- a/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
|
||||
@@ -89,6 +89,23 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -173,5 +173,5 @@ index 1424954f5b4cf0fbe821425cd741b4b5c1bfed50..9603589e0501feee900cd21b04eb84b0
|
||||
+ // Purpur end - Configurable jockey options
|
||||
+
|
||||
@Override
|
||||
public void setPersistentAngerTarget(@Nullable UUID target) {
|
||||
this.persistentAngerTarget = target;
|
||||
protected void addBehaviourGoals() {
|
||||
this.goalSelector.addGoal(1, new SpearUseGoal<>(this, 1.0, 1.0, 10.0F, 2.0F));
|
||||
@@ -5,11 +5,11 @@ Subject: [PATCH] Phantoms attracted to crystals and crystals shoot phantoms
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
index 67711964552a8e32d3590a64aff78e1db768b026..d58829c88b86358a0c06a982b302fc9a31c15853 100644
|
||||
index d1c593ccfab7bee4366ee7c56606a230964e3fb7..21d678008fac473dff4c3e10890882ab94d0087c 100644
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
@@ -26,6 +26,12 @@ public class EndCrystal extends Entity {
|
||||
private static final EntityDataAccessor<Boolean> DATA_SHOW_BOTTOM = SynchedEntityData.defineId(EndCrystal.class, EntityDataSerializers.BOOLEAN);
|
||||
@@ -27,6 +27,12 @@ public class EndCrystal extends Entity {
|
||||
private static final boolean DEFAULT_SHOW_BOTTOM = true;
|
||||
public int time;
|
||||
public boolean generatedByDragonFight = false; // Paper - Fix invulnerable end crystals
|
||||
+ // Purpur start - Phantoms attracted to crystals and crystals shoot phantoms
|
||||
@@ -19,9 +19,9 @@ index 67711964552a8e32d3590a64aff78e1db768b026..d58829c88b86358a0c06a982b302fc9a
|
||||
+ private int idleCooldown = 0;
|
||||
+ // Purpur end - Phantoms attracted to crystals and crystals shoot phantoms
|
||||
|
||||
public EndCrystal(EntityType<? extends EndCrystal> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -94,6 +100,49 @@ public class EndCrystal extends Entity {
|
||||
public EndCrystal(EntityType<? extends EndCrystal> type, Level level) {
|
||||
super(type, level);
|
||||
@@ -95,6 +101,49 @@ public class EndCrystal extends Entity {
|
||||
// Paper end - Fix invulnerable end crystals
|
||||
if (this.level().purpurConfig.endCrystalCramming > 0 && this.level().getEntitiesOfClass(EndCrystal.class, getBoundingBox()).size() > this.level().purpurConfig.endCrystalCramming) this.hurt(this.damageSources().cramming(), 6.0F); // Purpur - End Crystal Cramming
|
||||
|
||||
@@ -72,18 +72,18 @@ index 67711964552a8e32d3590a64aff78e1db768b026..d58829c88b86358a0c06a982b302fc9a
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
|
||||
index 08fc2dc0fecfa370c99e877d502149a8ea147e5f..aea7b608d88d243113f67665844841ac879c3f88 100644
|
||||
index 046d6d3b665d0dbb5403ebe91d18503ec7613936..7077beafe2251fcc4e37578091bfaa02714268b9 100644
|
||||
--- a/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -47,6 +47,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
@@ -49,6 +49,7 @@ public class Phantom extends Mob implements Enemy {
|
||||
Vec3 moveTargetPoint = Vec3.ZERO;
|
||||
public BlockPos anchorPoint = BlockPos.ZERO;
|
||||
@Nullable public BlockPos anchorPoint;
|
||||
Phantom.AttackPhase attackPhase = Phantom.AttackPhase.CIRCLE;
|
||||
+ Vec3 crystalPosition; // Purpur - Phantoms attracted to crystals and crystals shoot phantoms
|
||||
// Paper start
|
||||
@Nullable
|
||||
public java.util.UUID spawningEntity;
|
||||
@@ -118,6 +119,25 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
public java.util.@Nullable UUID spawningEntity;
|
||||
public boolean shouldBurnInDay = true;
|
||||
@@ -107,6 +108,25 @@ public class Phantom extends Mob implements Enemy {
|
||||
}
|
||||
// Purpur end - Ridables
|
||||
|
||||
@@ -109,7 +109,7 @@ index 08fc2dc0fecfa370c99e877d502149a8ea147e5f..aea7b608d88d243113f67665844841ac
|
||||
@Override
|
||||
public boolean isFlapping() {
|
||||
return (this.getUniqueFlapTickOffset() + this.tickCount) % TICKS_PER_FLAP == 0;
|
||||
@@ -131,9 +151,15 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
@@ -120,9 +140,15 @@ public class Phantom extends Mob implements Enemy {
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
|
||||
@@ -128,7 +128,7 @@ index 08fc2dc0fecfa370c99e877d502149a8ea147e5f..aea7b608d88d243113f67665844841ac
|
||||
this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
|
||||
this.targetSelector.addGoal(1, new Phantom.PhantomAttackPlayerTargetGoal());
|
||||
}
|
||||
@@ -509,6 +535,124 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
@@ -506,6 +532,124 @@ public class Phantom extends Mob implements Enemy {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,31 +5,31 @@ Subject: [PATCH] Phantoms burn in light
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
|
||||
index aea7b608d88d243113f67665844841ac879c3f88..4cc1c8d8967b1e9ee5b0b1c50d887f3de3e8a882 100644
|
||||
index 7077beafe2251fcc4e37578091bfaa02714268b9..6e8fe1b694ade45ffbf0b9bb39b954deffeb2402 100644
|
||||
--- a/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -53,6 +53,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
public java.util.UUID spawningEntity;
|
||||
@@ -54,6 +54,7 @@ public class Phantom extends Mob implements Enemy {
|
||||
public java.util.@Nullable UUID spawningEntity;
|
||||
public boolean shouldBurnInDay = true;
|
||||
// Paper end
|
||||
+ private static final net.minecraft.world.item.crafting.Ingredient TORCH = net.minecraft.world.item.crafting.Ingredient.of(net.minecraft.world.item.Items.TORCH, net.minecraft.world.item.Items.SOUL_TORCH); // Purpur - Phantoms burn in light
|
||||
|
||||
public Phantom(EntityType<? extends Phantom> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -253,7 +254,11 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
|
||||
public Phantom(EntityType<? extends Phantom> type, Level level) {
|
||||
super(type, level);
|
||||
@@ -238,7 +239,11 @@ public class Phantom extends Mob implements Enemy {
|
||||
// Paper start
|
||||
@Override
|
||||
public void aiStep() {
|
||||
- if (this.isAlive() && this.shouldBurnInDay && this.isSunBurnTick()) { // Paper - shouldBurnInDay API
|
||||
+ // Purpur start - Phantoms burn in light
|
||||
+ boolean burnFromDaylight = this.shouldBurnInDay && this.isSunBurnTick() && this.level().purpurConfig.phantomBurnInDaylight;
|
||||
public boolean isSunBurnTick() {
|
||||
- return this.shouldBurnInDay && super.isSunBurnTick();
|
||||
+ // Purpur start - API for any mob to burn daylight
|
||||
+ boolean burnFromDaylight = this.shouldBurnInDay && super.isSunBurnTick() && this.level().purpurConfig.phantomBurnInDaylight;
|
||||
+ boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight;
|
||||
+ if (this.isAlive() && (burnFromDaylight || burnFromLightSource)) { // Paper - shouldBurnInDay API
|
||||
+ // Purpur end - Phantoms burn in light
|
||||
if (getRider() == null || !this.isControllable()) // Purpur - Ridables
|
||||
this.igniteForSeconds(8.0F);
|
||||
}
|
||||
@@ -374,6 +379,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
+ return burnFromDaylight || burnFromLightSource;
|
||||
+ // Purpur end - API for any mob to burn daylight
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -366,6 +371,7 @@ public class Phantom extends Mob implements Enemy {
|
||||
List<Player> nearbyPlayers = serverLevel.getNearbyPlayers(
|
||||
this.attackTargeting, Phantom.this, Phantom.this.getBoundingBox().inflate(16.0, 64.0, 16.0)
|
||||
);
|
||||
@@ -37,7 +37,7 @@ index aea7b608d88d243113f67665844841ac879c3f88..4cc1c8d8967b1e9ee5b0b1c50d887f3d
|
||||
if (!nearbyPlayers.isEmpty()) {
|
||||
nearbyPlayers.sort(Comparator.<Player, Double>comparing(Entity::getY).reversed());
|
||||
|
||||
@@ -739,6 +745,12 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
@@ -736,6 +742,12 @@ public class Phantom extends Mob implements Enemy {
|
||||
return false;
|
||||
} else if (!target.isAlive()) {
|
||||
return false;
|
||||
@@ -5,13 +5,13 @@ Subject: [PATCH] Make entity breeding times configurable
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/VillagerMakeLove.java b/net/minecraft/world/entity/ai/behavior/VillagerMakeLove.java
|
||||
index 4fb63e58eac5d67fcd31c3233dca1dae72b98bc4..dd8d315eba203db121e24e3402f2117fc0f3043f 100644
|
||||
index 35aec6c3aa2f09f13954fda67902b3c975f566e3..fff139abc9341f3ab2dac568a922235dc5e81b3e 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/VillagerMakeLove.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/VillagerMakeLove.java
|
||||
@@ -118,8 +118,10 @@ public class VillagerMakeLove extends Behavior<Villager> {
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(breedOffspring, parent, partner, null, null, 0).isCancelled()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
// Move age setting down
|
||||
- parent.setAge(6000);
|
||||
- partner.setAge(6000);
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
@@ -19,24 +19,24 @@ index 4fb63e58eac5d67fcd31c3233dca1dae72b98bc4..dd8d315eba203db121e24e3402f2117f
|
||||
+ partner.setAge(level.purpurConfig.villagerBreedingTicks);
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
level.addFreshEntityWithPassengers(breedOffspring, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING);
|
||||
// CraftBukkit end
|
||||
level.broadcastEntityEvent(breedOffspring, (byte)12);
|
||||
// CraftBukkit end - call EntityBreedEvent
|
||||
level.broadcastEntityEvent(breedOffspring, EntityEvent.LOVE_HEARTS);
|
||||
diff --git a/net/minecraft/world/entity/animal/Animal.java b/net/minecraft/world/entity/animal/Animal.java
|
||||
index 33c3752be451508343cad83766da7c3be1822d02..fa34e7f1c20dfd569b52a9c8e0a8d4d5e659ce20 100644
|
||||
index 2e7e7c1913f5cbc20ce116c5ae3e185fc83094c0..53d04c412d36015a30ae2680f61651db6acbf2f2 100644
|
||||
--- a/net/minecraft/world/entity/animal/Animal.java
|
||||
+++ b/net/minecraft/world/entity/animal/Animal.java
|
||||
@@ -40,6 +40,7 @@ public abstract class Animal extends AgeableMob {
|
||||
@Nullable
|
||||
public UUID loveCause;
|
||||
public ItemStack breedItem; // CraftBukkit - Add breedItem variable
|
||||
@@ -46,6 +46,7 @@ public abstract class Animal extends AgeableMob {
|
||||
public int inLove = 0;
|
||||
public @Nullable EntityReference<ServerPlayer> loveCause;
|
||||
public @Nullable ItemStack breedItem; // CraftBukkit - Add breedItem variable
|
||||
+ public abstract int getPurpurBreedTime(); // Purpur - Make entity breeding times configurable
|
||||
|
||||
protected Animal(EntityType<? extends Animal> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -279,8 +280,10 @@ public abstract class Animal extends AgeableMob {
|
||||
protected Animal(EntityType<? extends Animal> type, Level level) {
|
||||
super(type, level);
|
||||
@@ -271,8 +272,10 @@ public abstract class Animal extends AgeableMob {
|
||||
player.awardStat(Stats.ANIMALS_BRED);
|
||||
CriteriaTriggers.BRED_ANIMALS.trigger(player, this, animal, baby);
|
||||
} // Paper
|
||||
} // Paper - Call EntityBreedEvent
|
||||
- this.setAge(6000);
|
||||
- animal.setAge(6000);
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
@@ -45,295 +45,12 @@ index 33c3752be451508343cad83766da7c3be1822d02..fa34e7f1c20dfd569b52a9c8e0a8d4d5
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
this.resetLove();
|
||||
animal.resetLove();
|
||||
level.broadcastEntityEvent(this, (byte)18);
|
||||
diff --git a/net/minecraft/world/entity/animal/Bee.java b/net/minecraft/world/entity/animal/Bee.java
|
||||
index 3cdfded14a2fb74e3f345e893e60364b6b810075..199bd7e9b053a2eac76987ceb5caebc088d1071d 100644
|
||||
--- a/net/minecraft/world/entity/animal/Bee.java
|
||||
+++ b/net/minecraft/world/entity/animal/Bee.java
|
||||
@@ -480,6 +480,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.beeBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
public int getRemainingPersistentAngerTime() {
|
||||
return this.entityData.get(DATA_REMAINING_ANGER_TIME);
|
||||
diff --git a/net/minecraft/world/entity/animal/Cat.java b/net/minecraft/world/entity/animal/Cat.java
|
||||
index 98ce277c5b27591e22daa3c85241be1b8689bfae..584568cef949cee24aa7850d2ff99d47cd089a6e 100644
|
||||
--- a/net/minecraft/world/entity/animal/Cat.java
|
||||
+++ b/net/minecraft/world/entity/animal/Cat.java
|
||||
@@ -126,6 +126,13 @@ public class Cat extends TamableAnimal implements VariantHolder<Holder<CatVarian
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.catBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.temptGoal = new Cat.CatTemptGoal(this, 0.6, itemStack -> itemStack.is(ItemTags.CAT_FOOD), true);
|
||||
diff --git a/net/minecraft/world/entity/animal/Chicken.java b/net/minecraft/world/entity/animal/Chicken.java
|
||||
index d718f0ed362c49803260dceed64bd93e2b6744fc..39ad1729ef03fc35a6365ee215be214eccfd959a 100644
|
||||
--- a/net/minecraft/world/entity/animal/Chicken.java
|
||||
+++ b/net/minecraft/world/entity/animal/Chicken.java
|
||||
@@ -81,6 +81,13 @@ public class Chicken extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.chickenBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
diff --git a/net/minecraft/world/entity/animal/Cow.java b/net/minecraft/world/entity/animal/Cow.java
|
||||
index d2a4bfa5334f7361067e4adac36ba5a4a4fa6ad8..e4965300eb41512d03a0b111422c98627cf29a54 100644
|
||||
--- a/net/minecraft/world/entity/animal/Cow.java
|
||||
+++ b/net/minecraft/world/entity/animal/Cow.java
|
||||
@@ -63,6 +63,13 @@ public class Cow extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.cowBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
diff --git a/net/minecraft/world/entity/animal/Fox.java b/net/minecraft/world/entity/animal/Fox.java
|
||||
index 8bf893837586ae2a9b4ef7564d242e16e4863b5d..1acf9b8c9e6a5915b3f095e83d3f209708947093 100644
|
||||
--- a/net/minecraft/world/entity/animal/Fox.java
|
||||
+++ b/net/minecraft/world/entity/animal/Fox.java
|
||||
@@ -175,6 +175,13 @@ public class Fox extends Animal implements VariantHolder<Fox.Variant> {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.foxBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
||||
super.defineSynchedData(builder);
|
||||
@@ -969,8 +976,10 @@ public class Fox extends Animal implements VariantHolder<Fox.Variant> {
|
||||
CriteriaTriggers.BRED_ANIMALS.trigger(serverPlayer, this.animal, this.partner, fox);
|
||||
}
|
||||
|
||||
- this.animal.setAge(6000);
|
||||
- this.partner.setAge(6000);
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ this.animal.setAge(this.animal.getPurpurBreedTime());
|
||||
+ this.partner.setAge(this.partner.getPurpurBreedTime());
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
this.animal.resetLove();
|
||||
this.partner.resetLove();
|
||||
serverLevel.addFreshEntityWithPassengers(fox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
||||
diff --git a/net/minecraft/world/entity/animal/MushroomCow.java b/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
index 990723c31aa1040a4e45b9857a18d86287ef91b4..a64b609bf5ce38a252bfa1bcff869f88e14389b5 100644
|
||||
--- a/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/MushroomCow.java
|
||||
@@ -79,6 +79,13 @@ public class MushroomCow extends Cow implements Shearable, VariantHolder<Mushroo
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.mooshroomBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
public float getWalkTargetValue(BlockPos pos, LevelReader level) {
|
||||
return level.getBlockState(pos.below()).is(Blocks.MYCELIUM) ? 10.0F : level.getPathfindingCostFromLightLevels(pos);
|
||||
diff --git a/net/minecraft/world/entity/animal/Ocelot.java b/net/minecraft/world/entity/animal/Ocelot.java
|
||||
index 41c42ecbf6aa233bd82000a4bbba3b186cca6a9d..b06697fd64a8962133f0324b2c03b9e9b4f32086 100644
|
||||
--- a/net/minecraft/world/entity/animal/Ocelot.java
|
||||
+++ b/net/minecraft/world/entity/animal/Ocelot.java
|
||||
@@ -87,6 +87,13 @@ public class Ocelot extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.ocelotBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
public boolean isTrusting() {
|
||||
return this.entityData.get(DATA_TRUSTING);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/animal/Panda.java b/net/minecraft/world/entity/animal/Panda.java
|
||||
index 5b07dff937c8873300eabecf1c510cf562fae4f3..450c7be36846bf4e95f84615fca893501415cdbc 100644
|
||||
--- a/net/minecraft/world/entity/animal/Panda.java
|
||||
+++ b/net/minecraft/world/entity/animal/Panda.java
|
||||
@@ -140,6 +140,13 @@ public class Panda extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.pandaBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected boolean canDispenserEquipIntoSlot(EquipmentSlot slot) {
|
||||
return slot == EquipmentSlot.MAINHAND && this.canPickUpLoot();
|
||||
diff --git a/net/minecraft/world/entity/animal/Parrot.java b/net/minecraft/world/entity/animal/Parrot.java
|
||||
index 87de937fd17c2e7e8916f8503b0334e7015bdb8f..9d7e142cc4b9ea32aad7ab17f3fc09a7a3a1d862 100644
|
||||
--- a/net/minecraft/world/entity/animal/Parrot.java
|
||||
+++ b/net/minecraft/world/entity/animal/Parrot.java
|
||||
@@ -194,6 +194,13 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return 6000;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Nullable
|
||||
@Override
|
||||
public SpawnGroupData finalizeSpawn(
|
||||
diff --git a/net/minecraft/world/entity/animal/Pig.java b/net/minecraft/world/entity/animal/Pig.java
|
||||
index 7df848bd9c4cf98fbd431a8cae16a2df86ec5e2b..801365d71b5b733e2dce54211e08d26d7f45f4d9 100644
|
||||
--- a/net/minecraft/world/entity/animal/Pig.java
|
||||
+++ b/net/minecraft/world/entity/animal/Pig.java
|
||||
@@ -81,6 +81,13 @@ public class Pig extends Animal implements ItemSteerable, Saddleable {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.pigBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
diff --git a/net/minecraft/world/entity/animal/PolarBear.java b/net/minecraft/world/entity/animal/PolarBear.java
|
||||
index 913439a769a36521ba59d59cba4d6878d3186254..365ad366bd0077619b0f6b5d26ed41038da0397e 100644
|
||||
--- a/net/minecraft/world/entity/animal/PolarBear.java
|
||||
+++ b/net/minecraft/world/entity/animal/PolarBear.java
|
||||
@@ -124,6 +124,13 @@ public class PolarBear extends Animal implements NeutralMob {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.polarBearBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Nullable
|
||||
@Override
|
||||
public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob otherParent) {
|
||||
diff --git a/net/minecraft/world/entity/animal/Rabbit.java b/net/minecraft/world/entity/animal/Rabbit.java
|
||||
index e71161ecc9d4ee3fe29fa3a27d11d63e1a28d1a0..bbdd06002b07699fffebdf6ed8148abdb69c24cc 100644
|
||||
--- a/net/minecraft/world/entity/animal/Rabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/Rabbit.java
|
||||
@@ -145,6 +145,13 @@ public class Rabbit extends Animal implements VariantHolder<Rabbit.Variant> {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.rabbitBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
public void registerGoals() {
|
||||
this.goalSelector.addGoal(1, new FloatGoal(this));
|
||||
diff --git a/net/minecraft/world/entity/animal/Sheep.java b/net/minecraft/world/entity/animal/Sheep.java
|
||||
index b66440f5cfbd714c6d2f5b7f66b4e755602b4521..882c799cb66a2acada33ff24f3adb7eb611f89c1 100644
|
||||
--- a/net/minecraft/world/entity/animal/Sheep.java
|
||||
+++ b/net/minecraft/world/entity/animal/Sheep.java
|
||||
@@ -106,6 +106,13 @@ public class Sheep extends Animal implements Shearable {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.sheepBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.eatBlockGoal = new EatBlockGoal(this);
|
||||
diff --git a/net/minecraft/world/entity/animal/Turtle.java b/net/minecraft/world/entity/animal/Turtle.java
|
||||
index 4f0fbbb2caeda6d1477d3297fd68f802e4f3a9ca..edbccb7ca27aa8a1917eb8b35b3ba8600c91111a 100644
|
||||
--- a/net/minecraft/world/entity/animal/Turtle.java
|
||||
+++ b/net/minecraft/world/entity/animal/Turtle.java
|
||||
@@ -109,6 +109,13 @@ public class Turtle extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.turtleBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
public void setHomePos(BlockPos homePos) {
|
||||
this.entityData.set(HOME_POS, homePos);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/animal/Wolf.java b/net/minecraft/world/entity/animal/Wolf.java
|
||||
index afc12968313a408e8a71a20c2c0defde52605c4e..9d79946497cfc92ff11160b86d5064d86916af36 100644
|
||||
--- a/net/minecraft/world/entity/animal/Wolf.java
|
||||
+++ b/net/minecraft/world/entity/animal/Wolf.java
|
||||
@@ -210,6 +210,13 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.wolfBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(1, new FloatGoal(this));
|
||||
level.broadcastEntityEvent(this, EntityEvent.IN_LOVE_HEARTS);
|
||||
diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
index c10ebb66dec26b6ccc223e98effa0b9a68363626..90bcd8c79cccbcbe7ff3fd2534e0c3450b970bd4 100644
|
||||
index 1f6b28531127ea2e5b291583f6bb6a236868fbf0..8ae1f8471f35028c1c469dc9cb9eac9b564a5c5e 100644
|
||||
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
@@ -105,6 +105,13 @@ public class Armadillo extends Animal {
|
||||
@@ -107,6 +107,13 @@ public class Armadillo extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -348,10 +65,10 @@ index c10ebb66dec26b6ccc223e98effa0b9a68363626..90bcd8c79cccbcbe7ff3fd2534e0c345
|
||||
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
||||
super.defineSynchedData(builder);
|
||||
diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
index f2f09a529e9db88784ff4299fdf3966046c736ab..07eee1f82331a2172aede02219a7eae8e82c7b59 100644
|
||||
index 3f9e15685ba52a5b9bd4282ba6de6751296975bf..79dfebbd72424d5a3a13d4ba89a555fdf782e703 100644
|
||||
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
@@ -140,6 +140,13 @@ public class Axolotl extends Animal implements VariantHolder<Axolotl.Variant>, B
|
||||
@@ -146,6 +146,13 @@ public class Axolotl extends Animal implements Bucketable {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -365,11 +82,29 @@ index f2f09a529e9db88784ff4299fdf3966046c736ab..07eee1f82331a2172aede02219a7eae8
|
||||
@Override
|
||||
public float getWalkTargetValue(BlockPos pos, LevelReader level) {
|
||||
return 0.0F;
|
||||
diff --git a/net/minecraft/world/entity/animal/bee/Bee.java b/net/minecraft/world/entity/animal/bee/Bee.java
|
||||
index 7d7ab4c5092ac085e8cd6d3a432feb683db5a282..473aa29e3075fcab44a14c2bc14d3f222b55cbad 100644
|
||||
--- a/net/minecraft/world/entity/animal/bee/Bee.java
|
||||
+++ b/net/minecraft/world/entity/animal/bee/Bee.java
|
||||
@@ -485,6 +485,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.beeBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
public long getPersistentAngerEndTime() {
|
||||
return this.entityData.get(DATA_ANGER_END_TIME);
|
||||
diff --git a/net/minecraft/world/entity/animal/camel/Camel.java b/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
index 1d7e2358bac193af48dc4b7f5b0295e3bffa152b..1d7ae2a08968860636918e7c66b60139a9d761b4 100644
|
||||
index 95e86330e1e973c43e50bd4ac310212b8a057430..842b20242c323572d4c04d3a2d5fe21a54d53ed4 100644
|
||||
--- a/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
+++ b/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
@@ -90,6 +90,13 @@ public class Camel extends AbstractHorse {
|
||||
@@ -97,6 +97,13 @@ public class Camel extends AbstractHorse {
|
||||
}
|
||||
// Purpur end - Ridables
|
||||
|
||||
@@ -381,47 +116,66 @@ index 1d7e2358bac193af48dc4b7f5b0295e3bffa152b..1d7ae2a08968860636918e7c66b60139
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag compound) {
|
||||
super.addAdditionalSaveData(compound);
|
||||
diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
index 9a400c8bf2b54aa5fbcbe65b61670cac5fbebf05..c4ea9485294b7dec2582c638802f003ad70659b6 100644
|
||||
--- a/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
+++ b/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
@@ -165,6 +165,12 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
|
||||
protected void addAdditionalSaveData(ValueOutput output) {
|
||||
super.addAdditionalSaveData(output);
|
||||
diff --git a/net/minecraft/world/entity/animal/chicken/Chicken.java b/net/minecraft/world/entity/animal/chicken/Chicken.java
|
||||
index 52a0bf792337e2f1cf11e215b033caae21ee774b..029fe4ac952d9f56824de346d98b341bd0b9b65f 100644
|
||||
--- a/net/minecraft/world/entity/animal/chicken/Chicken.java
|
||||
+++ b/net/minecraft/world/entity/animal/chicken/Chicken.java
|
||||
@@ -103,6 +103,13 @@ public class Chicken extends Animal {
|
||||
}
|
||||
// Purpur end - Ridables
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.frogBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
@Override
|
||||
protected Brain.Provider<Frog> brainProvider() {
|
||||
return Brain.provider(MEMORY_TYPES, SENSOR_TYPES);
|
||||
diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
index 302208b566038a3a352ca867dd70a61887bac104..0a018dbfe3750cf91892d8cfb5c0eac18e83d587 100644
|
||||
--- a/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
@@ -128,6 +128,13 @@ public class Goat extends Animal {
|
||||
}
|
||||
// Purpur end - Ridables
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.goatBreedingTicks;
|
||||
+ return this.level().purpurConfig.chickenBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected Brain.Provider<Goat> brainProvider() {
|
||||
return Brain.provider(MEMORY_TYPES, SENSOR_TYPES);
|
||||
diff --git a/net/minecraft/world/entity/animal/horse/Donkey.java b/net/minecraft/world/entity/animal/horse/Donkey.java
|
||||
index 223f1d109680e3643ab2c8343be22713e89755fd..b977597785df5665176ab2f330633ec61b7c9feb 100644
|
||||
--- a/net/minecraft/world/entity/animal/horse/Donkey.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/Donkey.java
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
diff --git a/net/minecraft/world/entity/animal/cow/Cow.java b/net/minecraft/world/entity/animal/cow/Cow.java
|
||||
index 5e5b239ebc774ae66f8c35a725ea917993239ef2..400b0a0a99590e3590cb66724acdc5ba9170f2c4 100644
|
||||
--- a/net/minecraft/world/entity/animal/cow/Cow.java
|
||||
+++ b/net/minecraft/world/entity/animal/cow/Cow.java
|
||||
@@ -54,6 +54,13 @@ public class Cow extends AbstractCow {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.cowBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
||||
super.defineSynchedData(builder);
|
||||
diff --git a/net/minecraft/world/entity/animal/cow/MushroomCow.java b/net/minecraft/world/entity/animal/cow/MushroomCow.java
|
||||
index 85ad44eb3e64232cf1ea326257078c46288a613a..e2aa027dc7a39fa8a8868a7d153e838113fcf97b 100644
|
||||
--- a/net/minecraft/world/entity/animal/cow/MushroomCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/cow/MushroomCow.java
|
||||
@@ -85,6 +85,13 @@ public class MushroomCow extends AbstractCow implements Shearable {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.mooshroomBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
public float getWalkTargetValue(BlockPos pos, LevelReader level) {
|
||||
return level.getBlockState(pos.below()).is(Blocks.MYCELIUM) ? 10.0F : level.getPathfindingCostFromLightLevels(pos);
|
||||
diff --git a/net/minecraft/world/entity/animal/equine/Donkey.java b/net/minecraft/world/entity/animal/equine/Donkey.java
|
||||
index b85d967c7c809683e4576be30ed855941c6e68cc..d74a5cc2a43ef41fd00676bbd17fe4df9edb67ff 100644
|
||||
--- a/net/minecraft/world/entity/animal/equine/Donkey.java
|
||||
+++ b/net/minecraft/world/entity/animal/equine/Donkey.java
|
||||
@@ -40,6 +40,13 @@ public class Donkey extends AbstractChestedHorse {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
@@ -434,13 +188,13 @@ index 223f1d109680e3643ab2c8343be22713e89755fd..b977597785df5665176ab2f330633ec6
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound() {
|
||||
public SoundEvent getAmbientSound() {
|
||||
return SoundEvents.DONKEY_AMBIENT;
|
||||
diff --git a/net/minecraft/world/entity/animal/horse/Horse.java b/net/minecraft/world/entity/animal/horse/Horse.java
|
||||
index 8bd118e82da9e4d4153de0a3efaf6d69e3c4c540..0339ab08b3029a9ffc102c5b865e411aca2a863c 100644
|
||||
--- a/net/minecraft/world/entity/animal/horse/Horse.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/Horse.java
|
||||
@@ -67,6 +67,13 @@ public class Horse extends AbstractHorse implements VariantHolder<Variant> {
|
||||
diff --git a/net/minecraft/world/entity/animal/equine/Horse.java b/net/minecraft/world/entity/animal/equine/Horse.java
|
||||
index 9a97cd588fb2dc0f393b2c8768f4e45066a34850..ba9df659ed019f9e58991059fe99c1471bfc94d8 100644
|
||||
--- a/net/minecraft/world/entity/animal/equine/Horse.java
|
||||
+++ b/net/minecraft/world/entity/animal/equine/Horse.java
|
||||
@@ -74,6 +74,13 @@ public class Horse extends AbstractHorse {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -454,11 +208,11 @@ index 8bd118e82da9e4d4153de0a3efaf6d69e3c4c540..0339ab08b3029a9ffc102c5b865e411a
|
||||
@Override
|
||||
protected void randomizeAttributes(RandomSource random) {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(generateMaxHealth(random::nextInt));
|
||||
diff --git a/net/minecraft/world/entity/animal/horse/Llama.java b/net/minecraft/world/entity/animal/horse/Llama.java
|
||||
index 58e726dd33f572a31b4910b9ff666c4252fb03a9..6efe52edb6909ed2b38210ce6a0334eddc55f261 100644
|
||||
--- a/net/minecraft/world/entity/animal/horse/Llama.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/Llama.java
|
||||
@@ -141,6 +141,13 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
|
||||
diff --git a/net/minecraft/world/entity/animal/equine/Llama.java b/net/minecraft/world/entity/animal/equine/Llama.java
|
||||
index b54a535add643390a6164ab3f4a2fdd475d60162..960e48f5ae63d8c86758d2573510bf481ca4bca0 100644
|
||||
--- a/net/minecraft/world/entity/animal/equine/Llama.java
|
||||
+++ b/net/minecraft/world/entity/animal/equine/Llama.java
|
||||
@@ -152,6 +152,13 @@ public class Llama extends AbstractChestedHorse implements RangedAttackMob {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -472,10 +226,10 @@ index 58e726dd33f572a31b4910b9ff666c4252fb03a9..6efe52edb6909ed2b38210ce6a0334ed
|
||||
public boolean isTraderLlama() {
|
||||
return false;
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/animal/horse/Mule.java b/net/minecraft/world/entity/animal/horse/Mule.java
|
||||
index d0d6b511dbd4f992d11f06e7539b0c1034250660..20458799fdcfa16bdd1c22df74b414000b110f82 100644
|
||||
--- a/net/minecraft/world/entity/animal/horse/Mule.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/Mule.java
|
||||
diff --git a/net/minecraft/world/entity/animal/equine/Mule.java b/net/minecraft/world/entity/animal/equine/Mule.java
|
||||
index f49c8a61ac3883f7ff8ad8193ae9ea9136f54c45..180a807026437e949e3f7c3d59864ea328f6f03f 100644
|
||||
--- a/net/minecraft/world/entity/animal/equine/Mule.java
|
||||
+++ b/net/minecraft/world/entity/animal/equine/Mule.java
|
||||
@@ -39,6 +39,13 @@ public class Mule extends AbstractChestedHorse {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
@@ -488,13 +242,13 @@ index d0d6b511dbd4f992d11f06e7539b0c1034250660..20458799fdcfa16bdd1c22df74b41400
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound() {
|
||||
public SoundEvent getAmbientSound() {
|
||||
return SoundEvents.MULE_AMBIENT;
|
||||
diff --git a/net/minecraft/world/entity/animal/horse/SkeletonHorse.java b/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
|
||||
index 6cc64c7e2f50a311460cd5d7ffa9545e5d7e0b02..0ce71ab6a28a5fbff9d71793b855c116b31729fc 100644
|
||||
--- a/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
|
||||
@@ -63,6 +63,13 @@ public class SkeletonHorse extends AbstractHorse {
|
||||
diff --git a/net/minecraft/world/entity/animal/equine/SkeletonHorse.java b/net/minecraft/world/entity/animal/equine/SkeletonHorse.java
|
||||
index d8b7b787b98b86d16578abe1cd19321ad2c176c0..af0e326f5ff8fcb82353bac3143103928a6a08e6 100644
|
||||
--- a/net/minecraft/world/entity/animal/equine/SkeletonHorse.java
|
||||
+++ b/net/minecraft/world/entity/animal/equine/SkeletonHorse.java
|
||||
@@ -67,6 +67,13 @@ public class SkeletonHorse extends AbstractHorse {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -508,11 +262,11 @@ index 6cc64c7e2f50a311460cd5d7ffa9545e5d7e0b02..0ce71ab6a28a5fbff9d71793b855c116
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
return createBaseHorseAttributes().add(Attributes.MAX_HEALTH, 15.0).add(Attributes.MOVEMENT_SPEED, 0.2F);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/animal/horse/TraderLlama.java b/net/minecraft/world/entity/animal/horse/TraderLlama.java
|
||||
index 715cb8046e1fb9ac929d81709777bf4ae9323d46..870775ce8a1bd09d35bf85551e1af3a6edfefc0e 100644
|
||||
--- a/net/minecraft/world/entity/animal/horse/TraderLlama.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/TraderLlama.java
|
||||
@@ -68,6 +68,13 @@ public class TraderLlama extends Llama {
|
||||
diff --git a/net/minecraft/world/entity/animal/equine/TraderLlama.java b/net/minecraft/world/entity/animal/equine/TraderLlama.java
|
||||
index deb0a1eb867daec57a644ce698fe50d79fd8960e..65ac46335d642d5dd8c01623721257a4fd53441d 100644
|
||||
--- a/net/minecraft/world/entity/animal/equine/TraderLlama.java
|
||||
+++ b/net/minecraft/world/entity/animal/equine/TraderLlama.java
|
||||
@@ -70,6 +70,13 @@ public class TraderLlama extends Llama {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -526,11 +280,11 @@ index 715cb8046e1fb9ac929d81709777bf4ae9323d46..870775ce8a1bd09d35bf85551e1af3a6
|
||||
@Override
|
||||
public boolean isTraderLlama() {
|
||||
return true;
|
||||
diff --git a/net/minecraft/world/entity/animal/horse/ZombieHorse.java b/net/minecraft/world/entity/animal/horse/ZombieHorse.java
|
||||
index 8da61e14f2470dfb191d9dfaf19c713584b8e9b8..cdff0fab8a256c1e06e280500a31d4a99659d1ee 100644
|
||||
--- a/net/minecraft/world/entity/animal/horse/ZombieHorse.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/ZombieHorse.java
|
||||
@@ -62,6 +62,13 @@ public class ZombieHorse extends AbstractHorse {
|
||||
diff --git a/net/minecraft/world/entity/animal/equine/ZombieHorse.java b/net/minecraft/world/entity/animal/equine/ZombieHorse.java
|
||||
index 8b8580f8c082a40f958ec61adf32dc7d1485ea68..fa2f18470123f98e336ab5c94bc791e9333356cb 100644
|
||||
--- a/net/minecraft/world/entity/animal/equine/ZombieHorse.java
|
||||
+++ b/net/minecraft/world/entity/animal/equine/ZombieHorse.java
|
||||
@@ -81,6 +81,13 @@ public class ZombieHorse extends AbstractHorse {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -542,13 +296,278 @@ index 8da61e14f2470dfb191d9dfaf19c713584b8e9b8..cdff0fab8a256c1e06e280500a31d4a9
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
return createBaseHorseAttributes().add(Attributes.MAX_HEALTH, 15.0).add(Attributes.MOVEMENT_SPEED, 0.2F);
|
||||
return createBaseHorseAttributes().add(Attributes.MAX_HEALTH, 25.0);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/animal/feline/Cat.java b/net/minecraft/world/entity/animal/feline/Cat.java
|
||||
index b7c17aed96dce39cb03780ff251e0e38c3c6adb1..d0aa698ef99cf3b1926018314b4067cc1cd8ac2a 100644
|
||||
--- a/net/minecraft/world/entity/animal/feline/Cat.java
|
||||
+++ b/net/minecraft/world/entity/animal/feline/Cat.java
|
||||
@@ -128,6 +128,13 @@ public class Cat extends TamableAnimal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.catBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.temptGoal = new Cat.CatTemptGoal(this, 0.6, stack -> stack.is(ItemTags.CAT_FOOD), true);
|
||||
diff --git a/net/minecraft/world/entity/animal/feline/Ocelot.java b/net/minecraft/world/entity/animal/feline/Ocelot.java
|
||||
index c9a8dcfd1e46f97dee0393db3205049c0db1cefb..bf281fd4c050b87fd277ab68e812ab2dcd3d06aa 100644
|
||||
--- a/net/minecraft/world/entity/animal/feline/Ocelot.java
|
||||
+++ b/net/minecraft/world/entity/animal/feline/Ocelot.java
|
||||
@@ -91,6 +91,13 @@ public class Ocelot extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.ocelotBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
public boolean isTrusting() {
|
||||
return this.entityData.get(DATA_TRUSTING);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/animal/fox/Fox.java b/net/minecraft/world/entity/animal/fox/Fox.java
|
||||
index 6819bcb15ad6c85f41a098a9fdb73ce5a7987d8f..3c2f5e711c013a6f51093e94bc4b5518263607a2 100644
|
||||
--- a/net/minecraft/world/entity/animal/fox/Fox.java
|
||||
+++ b/net/minecraft/world/entity/animal/fox/Fox.java
|
||||
@@ -197,6 +197,13 @@ public class Fox extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.foxBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
||||
super.defineSynchedData(builder);
|
||||
@@ -997,8 +1004,10 @@ public class Fox extends Animal {
|
||||
CriteriaTriggers.BRED_ANIMALS.trigger(serverPlayer, this.animal, this.partner, fox);
|
||||
}
|
||||
|
||||
- this.animal.setAge(6000);
|
||||
- this.partner.setAge(6000);
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ this.animal.setAge(this.animal.getPurpurBreedTime());
|
||||
+ this.partner.setAge(this.partner.getPurpurBreedTime());
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
this.animal.resetLove();
|
||||
this.partner.resetLove();
|
||||
this.level.addFreshEntityWithPassengers(fox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
||||
diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
index 5b4bb6fd100abc569c5da167735a220014bf5d8c..7d6dbdef68b25e774b5a83bb8aeb2535246459aa 100644
|
||||
--- a/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
+++ b/net/minecraft/world/entity/animal/frog/Frog.java
|
||||
@@ -164,6 +164,13 @@ public class Frog extends Animal {
|
||||
}
|
||||
// Purpur end - Ridables
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.frogBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected Brain.Provider<Frog> brainProvider() {
|
||||
return Brain.provider(MEMORY_TYPES, SENSOR_TYPES);
|
||||
diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
index 6e4d611c959960e8d13f79704c176b41ea5c12c4..07ba57ae845024e0f2fa03a68e126ec79bfc6b15 100644
|
||||
--- a/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
|
||||
@@ -132,6 +132,13 @@ public class Goat extends Animal {
|
||||
}
|
||||
// Purpur end - Ridables
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.goatBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected Brain.Provider<Goat> brainProvider() {
|
||||
return Brain.provider(MEMORY_TYPES, SENSOR_TYPES);
|
||||
diff --git a/net/minecraft/world/entity/animal/happyghast/HappyGhast.java b/net/minecraft/world/entity/animal/happyghast/HappyGhast.java
|
||||
index cd888e070a72ff46d35a4425a0013c617b31e159..30204224ed83f6d3cfd64640b332b23cb74d379f 100644
|
||||
--- a/net/minecraft/world/entity/animal/happyghast/HappyGhast.java
|
||||
+++ b/net/minecraft/world/entity/animal/happyghast/HappyGhast.java
|
||||
@@ -146,6 +146,13 @@ public class HappyGhast extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return 6000;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void ageBoundaryReached() {
|
||||
if (this.isBaby()) {
|
||||
diff --git a/net/minecraft/world/entity/animal/nautilus/Nautilus.java b/net/minecraft/world/entity/animal/nautilus/Nautilus.java
|
||||
index a32ac3907883f65c2a00173128a4a011fd552932..98199869b70c7c0f2b744ac74961c77d473617ca 100644
|
||||
--- a/net/minecraft/world/entity/animal/nautilus/Nautilus.java
|
||||
+++ b/net/minecraft/world/entity/animal/nautilus/Nautilus.java
|
||||
@@ -32,6 +32,13 @@ public class Nautilus extends AbstractNautilus {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.nautilusBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected Brain.Provider<Nautilus> brainProvider() {
|
||||
return NautilusAi.brainProvider();
|
||||
diff --git a/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java b/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java
|
||||
index 7ef4a15ba2b315a41480484572a6c6898340466b..94383c5020b6631203ddc4e0a58a222729ffe9a2 100644
|
||||
--- a/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java
|
||||
+++ b/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java
|
||||
@@ -54,6 +54,13 @@ public class ZombieNautilus extends AbstractNautilus {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return 6000;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
return AbstractNautilus.createAttributes().add(Attributes.MOVEMENT_SPEED, 1.1F);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/animal/panda/Panda.java b/net/minecraft/world/entity/animal/panda/Panda.java
|
||||
index d5060fb8e9a711e6230f2c4950521d8b4f5c01d2..163fe697f57459b36885fa3a18f41370347cab38 100644
|
||||
--- a/net/minecraft/world/entity/animal/panda/Panda.java
|
||||
+++ b/net/minecraft/world/entity/animal/panda/Panda.java
|
||||
@@ -143,6 +143,13 @@ public class Panda extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.pandaBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected boolean canDispenserEquipIntoSlot(EquipmentSlot slot) {
|
||||
return slot == EquipmentSlot.MAINHAND && this.canPickUpLoot();
|
||||
diff --git a/net/minecraft/world/entity/animal/parrot/Parrot.java b/net/minecraft/world/entity/animal/parrot/Parrot.java
|
||||
index 7480a491533a47882eaf4b36c320adf45ebfb190..0d62046cb33ed750ab27229fe4f0b43c3a1dd5f4 100644
|
||||
--- a/net/minecraft/world/entity/animal/parrot/Parrot.java
|
||||
+++ b/net/minecraft/world/entity/animal/parrot/Parrot.java
|
||||
@@ -207,6 +207,13 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return 6000;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
public @Nullable SpawnGroupData finalizeSpawn(
|
||||
ServerLevelAccessor level, DifficultyInstance difficulty, EntitySpawnReason spawnReason, @Nullable SpawnGroupData spawnGroupData
|
||||
diff --git a/net/minecraft/world/entity/animal/pig/Pig.java b/net/minecraft/world/entity/animal/pig/Pig.java
|
||||
index aeb9e57db2233bff20fa5208a679ac9bcb8d5026..0cb09a058c2d21b10677482792b230464ed9f951 100644
|
||||
--- a/net/minecraft/world/entity/animal/pig/Pig.java
|
||||
+++ b/net/minecraft/world/entity/animal/pig/Pig.java
|
||||
@@ -88,6 +88,13 @@ public class Pig extends Animal implements ItemSteerable {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.pigBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
diff --git a/net/minecraft/world/entity/animal/polarbear/PolarBear.java b/net/minecraft/world/entity/animal/polarbear/PolarBear.java
|
||||
index 904e4c641f1892220f263528c65f6f81708399cd..97edd950e2142e73ad947590c99d6d5529cbd44c 100644
|
||||
--- a/net/minecraft/world/entity/animal/polarbear/PolarBear.java
|
||||
+++ b/net/minecraft/world/entity/animal/polarbear/PolarBear.java
|
||||
@@ -126,6 +126,13 @@ public class PolarBear extends Animal implements NeutralMob {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.polarBearBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
public @Nullable AgeableMob getBreedOffspring(ServerLevel level, AgeableMob partner) {
|
||||
return EntityType.POLAR_BEAR.create(level, EntitySpawnReason.BREEDING);
|
||||
diff --git a/net/minecraft/world/entity/animal/rabbit/Rabbit.java b/net/minecraft/world/entity/animal/rabbit/Rabbit.java
|
||||
index cfbab57dd0527c5e2f17718f3974059eb881c2ea..061418a25d359574c4ff44327082b08b4094ee1c 100644
|
||||
--- a/net/minecraft/world/entity/animal/rabbit/Rabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/rabbit/Rabbit.java
|
||||
@@ -156,6 +156,13 @@ public class Rabbit extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.rabbitBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
public void registerGoals() {
|
||||
this.goalSelector.addGoal(1, new FloatGoal(this));
|
||||
diff --git a/net/minecraft/world/entity/animal/sheep/Sheep.java b/net/minecraft/world/entity/animal/sheep/Sheep.java
|
||||
index 1d60d35c1330418009f7d1d0b60d263559b68b7f..0e4505474a50d57338c16648cb6049d35455fdc6 100644
|
||||
--- a/net/minecraft/world/entity/animal/sheep/Sheep.java
|
||||
+++ b/net/minecraft/world/entity/animal/sheep/Sheep.java
|
||||
@@ -88,6 +88,13 @@ public class Sheep extends Animal implements Shearable {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.sheepBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.eatBlockGoal = new EatBlockGoal(this);
|
||||
diff --git a/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
index a5ff61a3697e2299c96288b6f8d7c6f2511d86d5..11a5da22149a61ca48bbb0a8ed10b71e91a5cc98 100644
|
||||
index eb6675394ecc5bba67e0f8bb0220ad92ef2b5e4f..7ef3c94f63c8a25d09e69b818ecdf79795803570 100644
|
||||
--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
+++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
@@ -113,6 +113,13 @@ public class Sniffer extends Animal {
|
||||
@@ -114,6 +114,13 @@ public class Sniffer extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -562,11 +581,60 @@ index a5ff61a3697e2299c96288b6f8d7c6f2511d86d5..11a5da22149a61ca48bbb0a8ed10b71e
|
||||
@Override
|
||||
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
||||
super.defineSynchedData(builder);
|
||||
diff --git a/net/minecraft/world/entity/animal/turtle/Turtle.java b/net/minecraft/world/entity/animal/turtle/Turtle.java
|
||||
index 8d9a1fe887c39588e43e4ccfc46151a033c8ccb7..fce1b1a22e091a1c05650c72e1ceb83e1a1d1ed1 100644
|
||||
--- a/net/minecraft/world/entity/animal/turtle/Turtle.java
|
||||
+++ b/net/minecraft/world/entity/animal/turtle/Turtle.java
|
||||
@@ -112,6 +112,13 @@ public class Turtle extends Animal {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.turtleBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
public void setHomePos(BlockPos homePos) {
|
||||
this.homePos = homePos;
|
||||
}
|
||||
@@ -343,8 +350,10 @@ public class Turtle extends Animal {
|
||||
}
|
||||
|
||||
this.turtle.setHasEgg(true);
|
||||
- this.animal.setAge(6000);
|
||||
- this.partner.setAge(6000);
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ this.animal.setAge(this.animal.getPurpurBreedTime());
|
||||
+ this.partner.setAge(this.partner.getPurpurBreedTime());
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
this.animal.resetLove();
|
||||
this.partner.resetLove();
|
||||
RandomSource random = this.animal.getRandom();
|
||||
diff --git a/net/minecraft/world/entity/animal/wolf/Wolf.java b/net/minecraft/world/entity/animal/wolf/Wolf.java
|
||||
index 7bccee8b5dd689bbff18f34d3afac52bfe34aa42..08a1bafa0e45dbdbf8bdc4d5cb654d080590707d 100644
|
||||
--- a/net/minecraft/world/entity/animal/wolf/Wolf.java
|
||||
+++ b/net/minecraft/world/entity/animal/wolf/Wolf.java
|
||||
@@ -216,6 +216,13 @@ public class Wolf extends TamableAnimal implements NeutralMob {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
+ public int getPurpurBreedTime() {
|
||||
+ return this.level().purpurConfig.wolfBreedingTicks;
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(1, new FloatGoal(this));
|
||||
diff --git a/net/minecraft/world/entity/monster/Strider.java b/net/minecraft/world/entity/monster/Strider.java
|
||||
index be0dc92bf5ae3da1368a649e9c4e7ff5dbb1c67c..f36e94437b4e21961532ac9ab91767617f9c3c32 100644
|
||||
index 3308e954c8f6deff89c6df0af01f7774e36b0385..ad6515c2dcde0079095c6777f56319e9901850f8 100644
|
||||
--- a/net/minecraft/world/entity/monster/Strider.java
|
||||
+++ b/net/minecraft/world/entity/monster/Strider.java
|
||||
@@ -119,6 +119,13 @@ public class Strider extends Animal implements ItemSteerable, Saddleable {
|
||||
@@ -117,6 +117,13 @@ public class Strider extends Animal implements ItemSteerable {
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -581,12 +649,12 @@ index be0dc92bf5ae3da1368a649e9c4e7ff5dbb1c67c..f36e94437b4e21961532ac9ab9176761
|
||||
EntityType<Strider> entityType, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
|
||||
) {
|
||||
diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
||||
index 54924cd7c84cbcd22ffc0bd37fc24f24e73c18bc..266d1838e6602ef6322c15732f2693a865911f2e 100644
|
||||
index baf81e1919e64af9d6da0a49b19e5f34cf962a79..4498fe26dff2cdec8e90d6559a66ebe7859195bb 100644
|
||||
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
||||
@@ -122,6 +122,13 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
|
||||
this.timeInOverworld = timeInOverworld;
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
+ // Purpur start - Make entity breeding times configurable
|
||||
+ @Override
|
||||
@@ -595,6 +663,6 @@ index 54924cd7c84cbcd22ffc0bd37fc24f24e73c18bc..266d1838e6602ef6322c15732f2693a8
|
||||
+ }
|
||||
+ // Purpur end - Make entity breeding times configurable
|
||||
+
|
||||
@Override
|
||||
public boolean canBeLeashed() {
|
||||
return true;
|
||||
@VisibleForTesting
|
||||
public void setTimeInOverworld(int timeInOverworld) {
|
||||
this.timeInOverworld = timeInOverworld;
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Apply display names from item forms of entities to entities
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
index d368b1971b270c44efc849464a100832bc29a679..8c0ab32487c56e2caf42404184f86c9bcf5f8b41 100644
|
||||
index 959037a01841de06767522512b92e96be7c72b56..c7be4713a526171d2c4b9642d28f1a246e294ff7 100644
|
||||
--- a/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
@@ -564,6 +564,7 @@ public class ArmorStand extends LivingEntity {
|
||||
@@ -451,6 +451,7 @@ public class ArmorStand extends LivingEntity {
|
||||
|
||||
private org.bukkit.event.entity.EntityDeathEvent brokenByPlayer(ServerLevel level, DamageSource damageSource) { // Paper
|
||||
ItemStack itemStack = new ItemStack(Items.ARMOR_STAND);
|
||||
@@ -18,10 +18,10 @@ index d368b1971b270c44efc849464a100832bc29a679..8c0ab32487c56e2caf42404184f86c9b
|
||||
this.drops.add(new DefaultDrop(itemStack, stack -> Block.popResource(this.level(), this.blockPosition(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior
|
||||
return this.brokenByAnything(level, damageSource); // Paper
|
||||
diff --git a/net/minecraft/world/entity/decoration/ItemFrame.java b/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
index 65e1d7c5ac94b1cfb921fa009be59d3e5872f0b5..3ee1d8798db666ee8d83556047e40ff217cda732 100644
|
||||
index 5f518a7469953f50135ec53d7c6b77b9acbafed9..d5fec174e6accbf93fd70ed1ba64135fb879d0b2 100644
|
||||
--- a/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
+++ b/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
@@ -223,7 +223,11 @@ public class ItemFrame extends HangingEntity {
|
||||
@@ -246,7 +246,11 @@ public class ItemFrame extends HangingEntity {
|
||||
this.removeFramedMap(item);
|
||||
} else {
|
||||
if (dropItem) {
|
||||
@@ -34,12 +34,12 @@ index 65e1d7c5ac94b1cfb921fa009be59d3e5872f0b5..3ee1d8798db666ee8d83556047e40ff2
|
||||
}
|
||||
|
||||
if (!item.isEmpty()) {
|
||||
diff --git a/net/minecraft/world/entity/decoration/Painting.java b/net/minecraft/world/entity/decoration/Painting.java
|
||||
index 5b905a4d49c44b04d5795c2bf297f3c69d183d7c..b6429a2bbb6fc1e08610ab20e50f8f0414f0ad26 100644
|
||||
--- a/net/minecraft/world/entity/decoration/Painting.java
|
||||
+++ b/net/minecraft/world/entity/decoration/Painting.java
|
||||
@@ -162,7 +162,11 @@ public class Painting extends HangingEntity implements VariantHolder<Holder<Pain
|
||||
if (level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
|
||||
diff --git a/net/minecraft/world/entity/decoration/painting/Painting.java b/net/minecraft/world/entity/decoration/painting/Painting.java
|
||||
index 682d6e8c400e3343815be83d74dafe7f16477ba2..32b7bfec3d169166fb607b68e4abf484756327ee 100644
|
||||
--- a/net/minecraft/world/entity/decoration/painting/Painting.java
|
||||
+++ b/net/minecraft/world/entity/decoration/painting/Painting.java
|
||||
@@ -182,7 +182,11 @@ public class Painting extends HangingEntity {
|
||||
if (level.getGameRules().get(GameRules.ENTITY_DROPS)) {
|
||||
this.playSound(SoundEvents.PAINTING_BREAK, 1.0F, 1.0F);
|
||||
if (!(entity instanceof Player player && player.hasInfiniteMaterials())) {
|
||||
- this.spawnAtLocation(level, Items.PAINTING);
|
||||
@@ -51,11 +51,11 @@ index 5b905a4d49c44b04d5795c2bf297f3c69d183d7c..b6429a2bbb6fc1e08610ab20e50f8f04
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/vehicle/AbstractBoat.java b/net/minecraft/world/entity/vehicle/AbstractBoat.java
|
||||
index 4e724a12f13032075aeff7cf71b9ceabd5a7bd88..b1b312e45ed4514eaa6fb3941af64b641220c5bd 100644
|
||||
--- a/net/minecraft/world/entity/vehicle/AbstractBoat.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/AbstractBoat.java
|
||||
@@ -879,7 +879,13 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable {
|
||||
diff --git a/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java b/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
|
||||
index d17269c9274bd29c761403138bfc56355c800d9c..e5854af03a58dc26a100feac59357862e46bfeed 100644
|
||||
--- a/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java
|
||||
@@ -818,7 +818,13 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable {
|
||||
|
||||
@Override
|
||||
public final ItemStack getPickResult() {
|
||||
@@ -71,7 +71,7 @@ index 4e724a12f13032075aeff7cf71b9ceabd5a7bd88..b1b312e45ed4514eaa6fb3941af64b64
|
||||
|
||||
public static enum Status {
|
||||
diff --git a/net/minecraft/world/item/ArmorStandItem.java b/net/minecraft/world/item/ArmorStandItem.java
|
||||
index d82e6651999a2650ec8884c4c3d8de4133cb42a4..a26b9fe964c79da57aaa0f755a81934f51a79913 100644
|
||||
index 962483d6f7225f13f121141882262d36dacad8cb..89d4bc00898fd8f6d40cda87c04c5983e2ea223c 100644
|
||||
--- a/net/minecraft/world/item/ArmorStandItem.java
|
||||
+++ b/net/minecraft/world/item/ArmorStandItem.java
|
||||
@@ -51,6 +51,10 @@ public class ArmorStandItem extends Item {
|
||||
@@ -86,7 +86,7 @@ index d82e6651999a2650ec8884c4c3d8de4133cb42a4..a26b9fe964c79da57aaa0f755a81934f
|
||||
level.playSound(
|
||||
null, armorStand.getX(), armorStand.getY(), armorStand.getZ(), SoundEvents.ARMOR_STAND_PLACE, SoundSource.BLOCKS, 0.75F, 0.8F
|
||||
diff --git a/net/minecraft/world/item/BoatItem.java b/net/minecraft/world/item/BoatItem.java
|
||||
index 13ce174e4f7e406f57a68ea0d3ef0ee3367f3f3b..ca86122e38688b29340cd8413ccf1746315e292a 100644
|
||||
index a8732056d0086a0932e82f70396a8849bf8d0ee1..2219d5e3e3d1aaa9f729205191a1f549ed662e2e 100644
|
||||
--- a/net/minecraft/world/item/BoatItem.java
|
||||
+++ b/net/minecraft/world/item/BoatItem.java
|
||||
@@ -63,6 +63,7 @@ public class BoatItem extends Item {
|
||||
@@ -98,14 +98,15 @@ index 13ce174e4f7e406f57a68ea0d3ef0ee3367f3f3b..ca86122e38688b29340cd8413ccf1746
|
||||
return InteractionResult.FAIL;
|
||||
} else {
|
||||
diff --git a/net/minecraft/world/item/HangingEntityItem.java b/net/minecraft/world/item/HangingEntityItem.java
|
||||
index 85980c7e5ad63398e0f0948fb0250f580251fe63..cd9e0398876567afc337db8f6ff0ebb0ee162383 100644
|
||||
index e9403c7c857bfaf09d8f8851b468aa4431c5be54..ecc890ae91475420215b61311ff959d9c522202d 100644
|
||||
--- a/net/minecraft/world/item/HangingEntityItem.java
|
||||
+++ b/net/minecraft/world/item/HangingEntityItem.java
|
||||
@@ -62,6 +62,7 @@ public class HangingEntityItem extends Item {
|
||||
CustomData customData = itemInHand.getOrDefault(DataComponents.ENTITY_DATA, CustomData.EMPTY);
|
||||
if (!customData.isEmpty()) {
|
||||
EntityType.updateCustomEntityTag(level, player, hangingEntity, customData);
|
||||
+ if (!level.purpurConfig.persistentDroppableEntityDisplayNames) hangingEntity.setCustomName(null); // Purpur - Apply display names from item forms of entities to entities and vice versa
|
||||
@@ -59,7 +59,7 @@ public class HangingEntityItem extends Item {
|
||||
hangingEntity = new GlowItemFrame(level, blockPos, clickedFace);
|
||||
}
|
||||
|
||||
- EntityType.<HangingEntity>createDefaultStackConfig(level, itemInHand, player).accept(hangingEntity);
|
||||
+ EntityType.<HangingEntity>appendDefaultStackConfig(entity -> {if (!level.purpurConfig.persistentDroppableEntityDisplayNames) entity.setCustomName(null);}, level, itemInHand, player).accept(hangingEntity); // Purpur - Apply display names from item forms of entities to entities and vice versa
|
||||
if (hangingEntity.survives()) {
|
||||
if (!level.isClientSide()) {
|
||||
// CraftBukkit start - fire HangingPlaceEvent
|
||||
@@ -8,10 +8,10 @@ farm Nether Wart. Reimplemented based on a feature of the carpet-extra
|
||||
mod.
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
|
||||
index 4106549bd4dec1cc47d8765be8f5d119fe33bf56..e98fac58b29f78cb63bd868811cca41e1644e9ac 100644
|
||||
index 23c9363f03a74a2ddd15ffa1da4e0910dcfe2eb4..83aac5dcc51fbc2cc9ee45c155fb2b5b67293a96 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
|
||||
@@ -32,6 +32,7 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
@@ -31,6 +31,7 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
private long nextOkStartTime;
|
||||
private int timeWorkedSoFar;
|
||||
private final List<BlockPos> validFarmlandAroundVillager = Lists.newArrayList();
|
||||
@@ -19,27 +19,27 @@ index 4106549bd4dec1cc47d8765be8f5d119fe33bf56..e98fac58b29f78cb63bd868811cca41e
|
||||
|
||||
public HarvestFarmland() {
|
||||
super(
|
||||
@@ -50,9 +51,10 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
@@ -49,9 +50,10 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
protected boolean checkExtraStartConditions(ServerLevel level, Villager owner) {
|
||||
if (!level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
if (!level.getGameRules().get(GameRules.MOB_GRIEFING)) {
|
||||
return false;
|
||||
- } else if (owner.getVillagerData().getProfession() != VillagerProfession.FARMER) {
|
||||
+ } else if (owner.getVillagerData().getProfession() != VillagerProfession.FARMER && !(level.purpurConfig.villagerClericsFarmWarts && owner.getVillagerData().getProfession() == VillagerProfession.CLERIC)) { // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
- } else if (!owner.getVillagerData().profession().is(VillagerProfession.FARMER)) {
|
||||
+ } else if (!owner.getVillagerData().profession().is(VillagerProfession.FARMER) && !(level.purpurConfig.villagerClericsFarmWarts && owner.getVillagerData().profession().is(VillagerProfession.CLERIC))) { // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
return false;
|
||||
} else {
|
||||
+ if (!this.clericWartFarmer && owner.getVillagerData().getProfession() == VillagerProfession.CLERIC) this.clericWartFarmer = true; // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
+ if (!this.clericWartFarmer && owner.getVillagerData().profession().is(VillagerProfession.CLERIC)) this.clericWartFarmer = true; // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
BlockPos.MutableBlockPos mutableBlockPos = owner.blockPosition().mutable();
|
||||
this.validFarmlandAroundVillager.clear();
|
||||
|
||||
@@ -83,6 +85,7 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
BlockState blockState = serverLevel.getBlockState(pos);
|
||||
@@ -81,6 +83,7 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
BlockState blockState = level.getBlockState(pos);
|
||||
Block block = blockState.getBlock();
|
||||
Block block1 = serverLevel.getBlockState(pos.below()).getBlock();
|
||||
Block block1 = level.getBlockState(pos.below()).getBlock();
|
||||
+ if (this.clericWartFarmer) return block == net.minecraft.world.level.block.Blocks.NETHER_WART && blockState.getValue(net.minecraft.world.level.block.NetherWartBlock.AGE) == 3 || blockState.isAir() && block1 == net.minecraft.world.level.block.Blocks.SOUL_SAND; // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
return block instanceof CropBlock && ((CropBlock)block).isMaxAge(blockState) || blockState.isAir() && block1 instanceof FarmBlock;
|
||||
}
|
||||
|
||||
@@ -109,19 +112,19 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
@@ -107,19 +110,19 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
BlockState blockState = level.getBlockState(this.aboveFarmlandPos);
|
||||
Block block = blockState.getBlock();
|
||||
Block block1 = level.getBlockState(this.aboveFarmlandPos.below()).getBlock();
|
||||
@@ -62,7 +62,7 @@ index 4106549bd4dec1cc47d8765be8f5d119fe33bf56..e98fac58b29f78cb63bd868811cca41e
|
||||
BlockState blockState1 = blockItem.getBlock().defaultBlockState();
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(owner, this.aboveFarmlandPos, blockState1)) { // CraftBukkit
|
||||
level.setBlockAndUpdate(this.aboveFarmlandPos, blockState1);
|
||||
@@ -136,7 +139,7 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
@@ -134,7 +137,7 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
this.aboveFarmlandPos.getX(),
|
||||
this.aboveFarmlandPos.getY(),
|
||||
this.aboveFarmlandPos.getZ(),
|
||||
@@ -72,7 +72,7 @@ index 4106549bd4dec1cc47d8765be8f5d119fe33bf56..e98fac58b29f78cb63bd868811cca41e
|
||||
1.0F,
|
||||
1.0F
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java b/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java
|
||||
index 243ac036f95794e7766aefb4630b635681ae5a5f..4d8523a43d60cd6b4fd5546ffb3a61417b2c475b 100644
|
||||
index 256fb863683d66235db4fb2b65fb1495672a67bf..81145178ba1ef75c441a09ab5f376d0528299ad3 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java
|
||||
@@ -59,6 +59,12 @@ public class TradeWithVillager extends Behavior<Villager> {
|
||||
@@ -80,7 +80,7 @@ index 243ac036f95794e7766aefb4630b635681ae5a5f..4d8523a43d60cd6b4fd5546ffb3a6141
|
||||
}
|
||||
|
||||
+ // Purpur start - Option for Villager Clerics to farm Nether Wart
|
||||
+ if (level.purpurConfig.villagerClericsFarmWarts && level.purpurConfig.villagerClericFarmersThrowWarts && owner.getVillagerData().getProfession() == VillagerProfession.CLERIC && owner.getInventory().countItem(Items.NETHER_WART) > Items.NETHER_WART.getDefaultMaxStackSize() / 2) {
|
||||
+ if (level.purpurConfig.villagerClericsFarmWarts && level.purpurConfig.villagerClericFarmersThrowWarts && owner.getVillagerData().profession().is(VillagerProfession.CLERIC) && owner.getInventory().countItem(Items.NETHER_WART) > Items.NETHER_WART.getDefaultMaxStackSize() / 2) {
|
||||
+ throwHalfStack(owner, ImmutableSet.of(Items.NETHER_WART), villager);
|
||||
+ }
|
||||
+ // Purpur end - Option for Villager Clerics to farm Nether Wart
|
||||
@@ -89,26 +89,26 @@ index 243ac036f95794e7766aefb4630b635681ae5a5f..4d8523a43d60cd6b4fd5546ffb3a6141
|
||||
throwHalfStack(owner, this.trades, villager);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java b/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java
|
||||
index 84afd8646b05409c582f29d73f9fea4b09feb603..32779b121322688a4b14e460b1f902ef67770b32 100644
|
||||
index bb3ac5297860c8af6e213d10fdf5144086e9474b..0e72601781235119d62fe74420153b98edb5ce23 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java
|
||||
@@ -74,8 +74,13 @@ public class VillagerGoalPackages {
|
||||
}
|
||||
|
||||
public static ImmutableList<Pair<Integer, ? extends BehaviorControl<? super Villager>>> getWorkPackage(VillagerProfession profession, float speedModifier) {
|
||||
@@ -79,8 +79,13 @@ public class VillagerGoalPackages {
|
||||
public static ImmutableList<Pair<Integer, ? extends BehaviorControl<? super Villager>>> getWorkPackage(
|
||||
Holder<VillagerProfession> profession, float speedModifier
|
||||
) {
|
||||
+ // Purpur start - Option for Villager Clerics to farm Nether Wart
|
||||
+ return getWorkPackage(profession, speedModifier, false);
|
||||
+ }
|
||||
+ public static ImmutableList<Pair<Integer, ? extends BehaviorControl<? super Villager>>> getWorkPackage(VillagerProfession profession, float speedModifier, boolean clericsFarmWarts) {
|
||||
+ public static ImmutableList<Pair<Integer, ? extends BehaviorControl<? super Villager>>> getWorkPackage(Holder<VillagerProfession> profession, float speedModifier, boolean clericsFarmWarts) {
|
||||
+ // Purpur end - Option for Villager Clerics to farm Nether Wart
|
||||
WorkAtPoi workAtPoi;
|
||||
- if (profession == VillagerProfession.FARMER) {
|
||||
+ if (profession == VillagerProfession.FARMER || (clericsFarmWarts && profession == VillagerProfession.CLERIC)) { // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
- if (profession.is(VillagerProfession.FARMER)) {
|
||||
+ if (profession.is(VillagerProfession.FARMER) || (clericsFarmWarts && profession.is(VillagerProfession.CLERIC))) { // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
workAtPoi = new WorkAtComposter();
|
||||
} else {
|
||||
workAtPoi = new WorkAtPoi();
|
||||
diff --git a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
||||
index 6b99afb4f237b5d6def98f3e03492975b795bc95..234e9d4aca14bc2a2e138918be1430516d710060 100644
|
||||
index 39a9e9a6f6dfddbf47a7f96150ef832efe61f89e..c268817b170bd54898bb5f8c2e2e12c0faa7eb1e 100644
|
||||
--- a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
|
||||
@@ -22,6 +22,13 @@ public class SecondaryPoiSensor extends Sensor<Villager> {
|
||||
@@ -117,7 +117,7 @@ index 6b99afb4f237b5d6def98f3e03492975b795bc95..234e9d4aca14bc2a2e138918be143051
|
||||
protected void doTick(ServerLevel level, Villager entity) {
|
||||
+ // Purpur start - Option for Villager Clerics to farm Nether Wart - make sure clerics don't wander to soul sand when the option is off
|
||||
+ Brain<?> brain = entity.getBrain();
|
||||
+ if (!level.purpurConfig.villagerClericsFarmWarts && entity.getVillagerData().getProfession() == net.minecraft.world.entity.npc.VillagerProfession.CLERIC) {
|
||||
+ if (!level.purpurConfig.villagerClericsFarmWarts && entity.getVillagerData().profession().is(net.minecraft.world.entity.npc.villager.VillagerProfession.CLERIC)) {
|
||||
+ brain.eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE);
|
||||
+ return;
|
||||
+ }
|
||||
@@ -134,38 +134,38 @@ index 6b99afb4f237b5d6def98f3e03492975b795bc95..234e9d4aca14bc2a2e138918be143051
|
||||
if (!list.isEmpty()) {
|
||||
brain.setMemory(MemoryModuleType.SECONDARY_JOB_SITE, list);
|
||||
} else {
|
||||
diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java
|
||||
index ff07cfe07200be23f17310522d737fca3251a580..017b54e0b8dec8996c90a3c6651867277dd516df 100644
|
||||
--- a/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -311,7 +311,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
villagerBrain.setSchedule(Schedule.VILLAGER_DEFAULT);
|
||||
diff --git a/net/minecraft/world/entity/npc/villager/Villager.java b/net/minecraft/world/entity/npc/villager/Villager.java
|
||||
index 02836bd2e8fda563877d3014ab839734aebc7457..ed6642023fccbc8f825d7c5c206d73ffd666f0f9 100644
|
||||
--- a/net/minecraft/world/entity/npc/villager/Villager.java
|
||||
+++ b/net/minecraft/world/entity/npc/villager/Villager.java
|
||||
@@ -315,7 +315,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
villagerBrain.setSchedule(EnvironmentAttributes.VILLAGER_ACTIVITY);
|
||||
villagerBrain.addActivityWithConditions(
|
||||
Activity.WORK,
|
||||
- VillagerGoalPackages.getWorkPackage(profession, 0.5F),
|
||||
+ VillagerGoalPackages.getWorkPackage(profession, 0.5F, this.level().purpurConfig.villagerClericsFarmWarts), // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
- VillagerGoalPackages.getWorkPackage(holder, 0.5F),
|
||||
+ VillagerGoalPackages.getWorkPackage(holder, 0.5F, this.level().purpurConfig.villagerClericsFarmWarts), // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
ImmutableSet.of(Pair.of(MemoryModuleType.JOB_SITE, MemoryStatus.VALUE_PRESENT))
|
||||
);
|
||||
}
|
||||
@@ -977,7 +977,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -956,7 +956,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
}
|
||||
|
||||
public boolean hasFarmSeeds() {
|
||||
- return this.getInventory().hasAnyMatching(itemStack -> itemStack.is(ItemTags.VILLAGER_PLANTABLE_SEEDS));
|
||||
+ return this.getInventory().hasAnyMatching(itemStack -> this.level().purpurConfig.villagerClericsFarmWarts && this.getVillagerData().getProfession() == VillagerProfession.CLERIC ? itemStack.is(Items.NETHER_WART) : itemStack.is(ItemTags.VILLAGER_PLANTABLE_SEEDS)); // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
- return this.getInventory().hasAnyMatching(stack -> stack.is(ItemTags.VILLAGER_PLANTABLE_SEEDS));
|
||||
+ return this.getInventory().hasAnyMatching(stack -> this.level().purpurConfig.villagerClericsFarmWarts && this.getVillagerData().profession().is(VillagerProfession.CLERIC) ? stack.is(Items.NETHER_WART) : stack.is(ItemTags.VILLAGER_PLANTABLE_SEEDS)); // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/world/entity/npc/VillagerProfession.java b/net/minecraft/world/entity/npc/VillagerProfession.java
|
||||
index 1ec8ad124c76483d11057eb97fcfb9aebee0c301..f783d058a080408d572938d36ba031f33a08e9af 100644
|
||||
--- a/net/minecraft/world/entity/npc/VillagerProfession.java
|
||||
+++ b/net/minecraft/world/entity/npc/VillagerProfession.java
|
||||
@@ -31,7 +31,7 @@ public record VillagerProfession(
|
||||
public static final VillagerProfession ARMORER = register("armorer", PoiTypes.ARMORER, SoundEvents.VILLAGER_WORK_ARMORER);
|
||||
public static final VillagerProfession BUTCHER = register("butcher", PoiTypes.BUTCHER, SoundEvents.VILLAGER_WORK_BUTCHER);
|
||||
public static final VillagerProfession CARTOGRAPHER = register("cartographer", PoiTypes.CARTOGRAPHER, SoundEvents.VILLAGER_WORK_CARTOGRAPHER);
|
||||
- public static final VillagerProfession CLERIC = register("cleric", PoiTypes.CLERIC, SoundEvents.VILLAGER_WORK_CLERIC);
|
||||
+ public static final VillagerProfession CLERIC = register("cleric", PoiTypes.CLERIC, ImmutableSet.of(Items.NETHER_WART), ImmutableSet.of(Blocks.SOUL_SAND), SoundEvents.VILLAGER_WORK_CLERIC); // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
public static final VillagerProfession FARMER = register(
|
||||
"farmer",
|
||||
PoiTypes.FARMER,
|
||||
diff --git a/net/minecraft/world/entity/npc/villager/VillagerProfession.java b/net/minecraft/world/entity/npc/villager/VillagerProfession.java
|
||||
index 0acfa8f9d2eab00cf0d8b4bc65c3af52046272bd..8f2edbe693a793d31295d035bc01e4c2b7742b4e 100644
|
||||
--- a/net/minecraft/world/entity/npc/villager/VillagerProfession.java
|
||||
+++ b/net/minecraft/world/entity/npc/villager/VillagerProfession.java
|
||||
@@ -103,7 +103,7 @@ public record VillagerProfession(
|
||||
register(registry, ARMORER, PoiTypes.ARMORER, SoundEvents.VILLAGER_WORK_ARMORER);
|
||||
register(registry, BUTCHER, PoiTypes.BUTCHER, SoundEvents.VILLAGER_WORK_BUTCHER);
|
||||
register(registry, CARTOGRAPHER, PoiTypes.CARTOGRAPHER, SoundEvents.VILLAGER_WORK_CARTOGRAPHER);
|
||||
- register(registry, CLERIC, PoiTypes.CLERIC, SoundEvents.VILLAGER_WORK_CLERIC);
|
||||
+ register(registry, CLERIC, PoiTypes.CLERIC, ImmutableSet.of(Items.NETHER_WART), ImmutableSet.of(Blocks.SOUL_SAND), SoundEvents.VILLAGER_WORK_CLERIC); // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
register(
|
||||
registry,
|
||||
FARMER,
|
||||
@@ -0,0 +1,378 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Tue, 5 Jan 2021 22:21:56 -0500
|
||||
Subject: [PATCH] Add mobGriefing override to everything affected
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index e04320155173caa8ce8f998477f36a6b36de935c..34d5283bbc76b4b6c335de354fc2edc1046dcfd1 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1961,7 +1961,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
boolean var6 = false;
|
||||
if (this.dead && entitySource instanceof WitherBoss) { // Paper
|
||||
- if (serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) {
|
||||
+ if (serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.witherMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
|
||||
BlockPos blockPos = this.blockPosition();
|
||||
BlockState blockState = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
if (this.level().getBlockState(blockPos).isAir() && blockState.canSurvive(this.level(), blockPos)) {
|
||||
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
|
||||
index a3569262099dce237c3feb5e29d24bf47f4c1e38..70807b4a6c94b0231eb541c7121d925d88022ac6 100644
|
||||
--- a/net/minecraft/world/entity/Mob.java
|
||||
+++ b/net/minecraft/world/entity/Mob.java
|
||||
@@ -554,7 +554,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
&& this.canPickUpLoot()
|
||||
&& this.isAlive()
|
||||
&& !this.dead
|
||||
- && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) {
|
||||
+ && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.entitiesPickUpLootMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
|
||||
Vec3i pickupReach = this.getPickupReach();
|
||||
|
||||
for (ItemEntity itemEntity : this.level()
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
|
||||
index 83aac5dcc51fbc2cc9ee45c155fb2b5b67293a96..c68399986583a215da156b9057a61f22cbf6143d 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
|
||||
@@ -48,7 +48,7 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
|
||||
@Override
|
||||
protected boolean checkExtraStartConditions(ServerLevel level, Villager owner) {
|
||||
- if (!level.getGameRules().get(GameRules.MOB_GRIEFING)) {
|
||||
+ if (!level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.villagerMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
|
||||
return false;
|
||||
} else if (!owner.getVillagerData().profession().is(VillagerProfession.FARMER) && !(level.purpurConfig.villagerClericsFarmWarts && owner.getVillagerData().profession().is(VillagerProfession.CLERIC))) { // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
return false;
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java b/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
||||
index 3da917a428b9300d839df610e0e9dceb1d0f0668..a43c0d99458e8aff6a0b0a9eee60ed82b75ffdda 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
||||
@@ -31,7 +31,7 @@ public class BreakDoorGoal extends DoorInteractGoal {
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
return super.canUse()
|
||||
- && getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING)
|
||||
+ && getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING, this.mob.level().purpurConfig.zombieMobGriefingOverride) // Purpur - Add mobGriefing override to everything affected
|
||||
&& this.isValidDifficulty(this.mob.level().getDifficulty())
|
||||
&& !this.isOpen();
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/EatBlockGoal.java b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
index 087861886eeb55324ffe54bda78e19f83bf33e72..0f0311eb836b8da39651ece499fe4bda44bce178 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
@@ -64,7 +64,7 @@ public class EatBlockGoal extends Goal {
|
||||
BlockPos blockPos = this.mob.blockPosition();
|
||||
final BlockState blockState = this.level.getBlockState(blockPos); // Paper - fix wrong block state
|
||||
if (IS_EDIBLE.test(blockState)) { // Paper - fix wrong block state
|
||||
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos, blockState.getFluidState().createLegacyBlock(), !getServerLevel(this.level).getGameRules().get(GameRules.MOB_GRIEFING))) { // CraftBukkit // Paper - fix wrong block state
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos, blockState.getFluidState().createLegacyBlock(), !getServerLevel(this.level).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(this.level).purpurConfig.sheepMobGriefingOverride))) { // CraftBukkit // Paper - fix wrong block state // Purpur - Add mobGriefing override to everything affected
|
||||
this.level.destroyBlock(blockPos, false);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class EatBlockGoal extends Goal {
|
||||
} else {
|
||||
BlockPos blockPos1 = blockPos.below();
|
||||
if (this.level.getBlockState(blockPos1).is(Blocks.GRASS_BLOCK)) {
|
||||
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos1, Blocks.DIRT.defaultBlockState(), !getServerLevel(this.level).getGameRules().get(GameRules.MOB_GRIEFING))) { // CraftBukkit // Paper - Fix wrong block state
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos1, Blocks.DIRT.defaultBlockState(), !getServerLevel(this.level).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(this.level).purpurConfig.sheepMobGriefingOverride))) { // CraftBukkit // Paper - Fix wrong block state // Purpur - Add mobGriefing override to everything affected
|
||||
this.level.levelEvent(LevelEvent.PARTICLES_DESTROY_BLOCK, blockPos1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState()));
|
||||
this.level.setBlock(blockPos1, Blocks.DIRT.defaultBlockState(), Block.UPDATE_CLIENTS);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
index 50cc4c462640a9d40abef6245439d71e8c593ae6..83be00350765db043b6bf32e7814d9c7119eacc5 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
@@ -35,7 +35,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
- if (!getServerLevel(this.removerMob).getGameRules().get(GameRules.MOB_GRIEFING)) {
|
||||
+ if (!getServerLevel(this.removerMob).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(this.removerMob).purpurConfig.zombieMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
|
||||
return false;
|
||||
} else if (this.nextStartTick > 0) {
|
||||
this.nextStartTick--;
|
||||
diff --git a/net/minecraft/world/entity/animal/fox/Fox.java b/net/minecraft/world/entity/animal/fox/Fox.java
|
||||
index 3c2f5e711c013a6f51093e94bc4b5518263607a2..a0ed30e8ccd41729de8e0ff977a61fa607386640 100644
|
||||
--- a/net/minecraft/world/entity/animal/fox/Fox.java
|
||||
+++ b/net/minecraft/world/entity/animal/fox/Fox.java
|
||||
@@ -1062,7 +1062,7 @@ public class Fox extends Animal {
|
||||
}
|
||||
|
||||
protected void onReachedTarget() {
|
||||
- if (getServerLevel(Fox.this.level()).getGameRules().get(GameRules.MOB_GRIEFING)) {
|
||||
+ if (getServerLevel(Fox.this.level()).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(Fox.this.level()).purpurConfig.foxMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
|
||||
BlockState blockState = Fox.this.level().getBlockState(this.blockPos);
|
||||
if (blockState.is(Blocks.SWEET_BERRY_BUSH)) {
|
||||
this.pickSweetBerries(blockState);
|
||||
diff --git a/net/minecraft/world/entity/animal/golem/SnowGolem.java b/net/minecraft/world/entity/animal/golem/SnowGolem.java
|
||||
index ab44bc401438d589696d9f25ebaca0fc39648bed..f011369a67809d54230984a22a909bfea44f47f3 100644
|
||||
--- a/net/minecraft/world/entity/animal/golem/SnowGolem.java
|
||||
+++ b/net/minecraft/world/entity/animal/golem/SnowGolem.java
|
||||
@@ -135,7 +135,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
this.hurtServer(serverLevel, this.damageSources().onFire().knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.MELTING), 1.0F); // CraftBukkit
|
||||
}
|
||||
|
||||
- if (!serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) {
|
||||
+ if (!serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.snowGolemMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
|
||||
return;
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/rabbit/Rabbit.java b/net/minecraft/world/entity/animal/rabbit/Rabbit.java
|
||||
index 061418a25d359574c4ff44327082b08b4094ee1c..66fda64006c0a70ab4502f088637bb6871c3bb37 100644
|
||||
--- a/net/minecraft/world/entity/animal/rabbit/Rabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/rabbit/Rabbit.java
|
||||
@@ -648,7 +648,7 @@ public class Rabbit extends Animal {
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
if (this.nextStartTick <= 0) {
|
||||
- if (!getServerLevel(this.rabbit).getGameRules().get(GameRules.MOB_GRIEFING)) {
|
||||
+ if (!getServerLevel(this.rabbit).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(this.rabbit).purpurConfig.rabbitMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
index 844c989fc4e0d131d823bf8a59951f35f30b7641..e14347ccc7b21213801e59fa2e0e47964bc943ad 100644
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
@@ -542,7 +542,7 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
BlockPos blockPos = new BlockPos(i, i1, i2);
|
||||
BlockState blockState = level.getBlockState(blockPos);
|
||||
if (!blockState.isAir() && !blockState.is(BlockTags.DRAGON_TRANSPARENT)) {
|
||||
- if (level.getGameRules().get(GameRules.MOB_GRIEFING) && !blockState.is(BlockTags.DRAGON_IMMUNE)) {
|
||||
+ if (level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.enderDragonMobGriefingOverride) && !blockState.is(BlockTags.DRAGON_IMMUNE)) { // Purpur - Add mobGriefing override to everything affected
|
||||
// CraftBukkit start - Add blocks to list rather than destroying them
|
||||
//flag1 = level.removeBlock(blockPos, false) || flag1;
|
||||
flag1 = true;
|
||||
diff --git a/net/minecraft/world/entity/boss/wither/WitherBoss.java b/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index 612df8799b80f1793ab9781212442098633e9d65..73dbc5ae28c5af00a36528e0397ad1c2eed14f2c 100644
|
||||
--- a/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -495,7 +495,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
|
||||
|
||||
if (this.destroyBlocksTick > 0) {
|
||||
this.destroyBlocksTick--;
|
||||
- if (this.destroyBlocksTick == 0 && level.getGameRules().get(GameRules.MOB_GRIEFING)) {
|
||||
+ if (this.destroyBlocksTick == 0 && level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.witherMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
|
||||
boolean flag = false;
|
||||
int alternativeTarget = Mth.floor(this.getBbWidth() / 2.0F + 1.0F);
|
||||
int floor = Mth.floor(this.getBbHeight());
|
||||
diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java
|
||||
index 29570047bfc78a8993b0bbd7168cb4fe318a6be6..79a1d8f67a22a8fa4a6c3b657e44bb9503687c27 100644
|
||||
--- a/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -509,7 +509,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
public boolean canUse() {
|
||||
if (!enderman.level().purpurConfig.endermanAllowGriefing) return false; // Purpur - Add enderman and creeper griefing controls
|
||||
return this.enderman.getCarriedBlock() != null
|
||||
- && getServerLevel(this.enderman).getGameRules().get(GameRules.MOB_GRIEFING)
|
||||
+ && getServerLevel(this.enderman).getGameRules().get(GameRules.MOB_GRIEFING, this.enderman.level().purpurConfig.endermanMobGriefingOverride) // Purpur - Add mobGriefing override to everything affected
|
||||
&& this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0;
|
||||
}
|
||||
|
||||
@@ -658,7 +658,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
public boolean canUse() {
|
||||
if (!enderman.level().purpurConfig.endermanAllowGriefing) return false; // Purpur - Add enderman and creeper griefing controls
|
||||
return this.enderman.getCarriedBlock() == null
|
||||
- && getServerLevel(this.enderman).getGameRules().get(GameRules.MOB_GRIEFING)
|
||||
+ && getServerLevel(this.enderman).getGameRules().get(GameRules.MOB_GRIEFING, this.enderman.level().purpurConfig.endermanMobGriefingOverride) // Purpur - Add mobGriefing override to everything affected
|
||||
&& this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0;
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Ravager.java b/net/minecraft/world/entity/monster/Ravager.java
|
||||
index c3546b0841aff52ef758b0e8e48c9a70726f412d..c1ae9826d15456762ac0c0ab7380763242fa48de 100644
|
||||
--- a/net/minecraft/world/entity/monster/Ravager.java
|
||||
+++ b/net/minecraft/world/entity/monster/Ravager.java
|
||||
@@ -179,7 +179,7 @@ public class Ravager extends Raider {
|
||||
this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Mth.lerp(0.1, baseValue, d));
|
||||
}
|
||||
|
||||
- if (this.level() instanceof ServerLevel serverLevel && this.horizontalCollision && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) {
|
||||
+ if (this.level() instanceof ServerLevel serverLevel && this.horizontalCollision && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.ravagerMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
|
||||
boolean flag = false;
|
||||
AABB aabb = this.getBoundingBox().inflate(0.2);
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Silverfish.java b/net/minecraft/world/entity/monster/Silverfish.java
|
||||
index 1df006a0a49038f1e737194e7da8e0b27e6eeb95..3e8e3a6018120576b0773769db7b2037148fae96 100644
|
||||
--- a/net/minecraft/world/entity/monster/Silverfish.java
|
||||
+++ b/net/minecraft/world/entity/monster/Silverfish.java
|
||||
@@ -168,7 +168,7 @@ public class Silverfish extends Monster {
|
||||
return false;
|
||||
} else {
|
||||
RandomSource random = this.mob.getRandom();
|
||||
- if (getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING) && random.nextInt(reducedTickDelay(10)) == 0) {
|
||||
+ if (getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(this.mob).purpurConfig.silverfishMobGriefingOverride) && random.nextInt(reducedTickDelay(10)) == 0) { // Purpur - Add mobGriefing override to everything affected
|
||||
this.selectedDirection = Direction.getRandom(random);
|
||||
BlockPos blockPos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5, this.mob.getZ()).relative(this.selectedDirection);
|
||||
BlockState blockState = this.mob.level().getBlockState(blockPos);
|
||||
@@ -245,7 +245,7 @@ public class Silverfish extends Monster {
|
||||
Block block = blockState.getBlock();
|
||||
if (block instanceof InfestedBlock) {
|
||||
// CraftBukkit start
|
||||
- BlockState afterState = getServerLevel(level).getGameRules().get(GameRules.MOB_GRIEFING) ? blockState.getFluidState().createLegacyBlock() : ((InfestedBlock) block).hostStateByInfested(level.getBlockState(blockPos1)); // Paper - fix wrong block state
|
||||
+ BlockState afterState = getServerLevel(level).getGameRules().get(GameRules.MOB_GRIEFING, getServerLevel(level).purpurConfig.silverfishMobGriefingOverride) ? blockState.getFluidState().createLegacyBlock() : ((InfestedBlock) block).hostStateByInfested(level.getBlockState(blockPos1)); // Paper - fix wrong block state // Purpur - Add mobGriefing override to everything affected
|
||||
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockPos1, afterState)) { // Paper - fix wrong block state
|
||||
continue;
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/monster/illager/Evoker.java b/net/minecraft/world/entity/monster/illager/Evoker.java
|
||||
index 46f79ed345ec51125364b49b244d6d005a3e64ae..334786b2c358c41058f2ac4b1fa4b185833cbd84 100644
|
||||
--- a/net/minecraft/world/entity/monster/illager/Evoker.java
|
||||
+++ b/net/minecraft/world/entity/monster/illager/Evoker.java
|
||||
@@ -306,7 +306,7 @@ public class Evoker extends SpellcasterIllager {
|
||||
return false;
|
||||
} else {
|
||||
ServerLevel serverLevel = getServerLevel(Evoker.this.level());
|
||||
- if (!serverLevel.getGameRules().get(GameRules.MOB_GRIEFING)) {
|
||||
+ if (!serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.evokerMobGriefingOverride)) { // Purpur - Add mobGriefing override to everything affected
|
||||
return false;
|
||||
} else {
|
||||
List<Sheep> nearbyEntities = serverLevel.getNearbyEntities(
|
||||
diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||
index 98241af88cc961470e07df47d128d8912338bd44..4fccd122a227e5fe80965c37afaa031c4a673978 100644
|
||||
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||
@@ -448,7 +448,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
|
||||
|
||||
@Override
|
||||
public boolean wantsToPickUp(ServerLevel level, ItemStack stack) {
|
||||
- return level.getGameRules().get(GameRules.MOB_GRIEFING) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, stack);
|
||||
+ return level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.piglinMobGriefingOverride) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, stack); // Purpur - Add mobGriefing override to everything affected
|
||||
}
|
||||
|
||||
protected boolean canReplaceCurrentItem(ItemStack candidate) {
|
||||
diff --git a/net/minecraft/world/entity/projectile/Projectile.java b/net/minecraft/world/entity/projectile/Projectile.java
|
||||
index 6298e6de25f1dd9ff880a9ad2882dc7ccb2f100c..36479ed544ce812113c9a9c982a74a950cb9b26a 100644
|
||||
--- a/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -434,7 +434,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@Override
|
||||
public boolean mayInteract(ServerLevel level, BlockPos pos) {
|
||||
Entity owner = this.getOwner();
|
||||
- return owner instanceof Player ? owner.mayInteract(level, pos) : owner == null || level.getGameRules().get(GameRules.MOB_GRIEFING);
|
||||
+ return owner instanceof Player ? owner.mayInteract(level, pos) : owner == null || level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.projectilesMobGriefingOverride); // Purpur - Add mobGriefing override to everything affected
|
||||
}
|
||||
|
||||
public boolean mayBreak(ServerLevel level) {
|
||||
diff --git a/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java b/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java
|
||||
index de0f086da9fe4afa14d2b77f6b0a2c0910745b94..775aa79a0d503217dbe42268f4feccbc2d3e1edb 100644
|
||||
--- a/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/hurtingprojectile/LargeFireball.java
|
||||
@@ -20,20 +20,20 @@ public class LargeFireball extends Fireball {
|
||||
|
||||
public LargeFireball(EntityType<? extends LargeFireball> type, Level level) {
|
||||
super(type, level);
|
||||
- this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING); // CraftBukkit
|
||||
+ this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.fireballsMobGriefingOverride); // CraftBukkit // Purpur - Add mobGriefing override to everything affected
|
||||
}
|
||||
|
||||
public LargeFireball(Level level, LivingEntity owner, Vec3 movement, int explosionPower) {
|
||||
super(EntityType.FIREBALL, owner, movement, level);
|
||||
this.explosionPower = explosionPower;
|
||||
- this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING); // CraftBukkit
|
||||
+ this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.fireballsMobGriefingOverride); // CraftBukkit // Purpur - Add mobGriefing override to everything affected
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHit(HitResult result) {
|
||||
super.onHit(result);
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
- // boolean flag = serverLevel.getGameRules().get(GameRules.MOB_GRIEFING); // CraftBukkit - baked into fields (see constructor)
|
||||
+ // boolean flag = serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.fireballsMobGriefingOverride); // CraftBukkit - baked into fields (see constructor) // Purpur - Add mobGriefing override to everything affected
|
||||
// CraftBukkit start - fire ExplosionPrimeEvent
|
||||
org.bukkit.event.entity.ExplosionPrimeEvent event = new org.bukkit.event.entity.ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
|
||||
if (event.callEvent()) {
|
||||
diff --git a/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java b/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java
|
||||
index 043ddaa0e8718f50881d16892eab188aed70f67f..a10617c29098f28c5b5586a43071a47ef17e5744 100644
|
||||
--- a/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/hurtingprojectile/SmallFireball.java
|
||||
@@ -25,7 +25,7 @@ public class SmallFireball extends Fireball {
|
||||
super(EntityType.SMALL_FIREBALL, owner, movement, level);
|
||||
// CraftBukkit start
|
||||
if (this.getOwner() != null && this.getOwner() instanceof Mob) {
|
||||
- this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING);
|
||||
+ this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.fireballsMobGriefingOverride); // Purpur - Add mobGriefing override to everything affected
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java
|
||||
index 298d6749bdd5b6f09530096f8f546d9f46910b19..b03faa7600f182a12c3a739deefc38028cf45615 100644
|
||||
--- a/net/minecraft/world/entity/raid/Raider.java
|
||||
+++ b/net/minecraft/world/entity/raid/Raider.java
|
||||
@@ -396,7 +396,7 @@ public abstract class Raider extends PatrollingMonster {
|
||||
}
|
||||
|
||||
private boolean cannotPickUpBanner() {
|
||||
- if (!getServerLevel(this.mob).getGameRules().get(net.minecraft.world.level.gamerules.GameRules.MOB_GRIEFING)) return true; // Paper - respect game and entity rules for picking up items
|
||||
+ if (!getServerLevel(this.mob).getGameRules().get(net.minecraft.world.level.gamerules.GameRules.MOB_GRIEFING, this.mob.level().purpurConfig.pillagerMobGriefingOverride)) return true; // Paper - respect game and entity rules for picking up items // Purpur - Add mobGriefing override to everything affected
|
||||
if (!this.mob.hasActiveRaid()) {
|
||||
return true;
|
||||
} else if (this.mob.getCurrentRaid().isOver()) {
|
||||
diff --git a/net/minecraft/world/level/block/CropBlock.java b/net/minecraft/world/level/block/CropBlock.java
|
||||
index 4ad9b4afeb6958cba98d8413b3371754730741e5..0b748fac353d6a8b5351ad67df7d239d3efa43b0 100644
|
||||
--- a/net/minecraft/world/level/block/CropBlock.java
|
||||
+++ b/net/minecraft/world/level/block/CropBlock.java
|
||||
@@ -169,7 +169,7 @@ public class CropBlock extends VegetationBlock implements BonemealableBlock {
|
||||
@Override
|
||||
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier, boolean pastEdges) {
|
||||
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
|
||||
- if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.purpurConfig.ravagerGriefableBlocks.contains(serverLevel.getBlockState(pos).getBlock()) && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !serverLevel.getGameRules().get(GameRules.MOB_GRIEFING))) { // CraftBukkit // Purpur - Configurable ravager griefable blocks list
|
||||
+ if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.purpurConfig.ravagerGriefableBlocks.contains(serverLevel.getBlockState(pos).getBlock()) && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.ravagerMobGriefingOverride))) { // CraftBukkit // Purpur - Configurable ravager griefable blocks list // Purpur - Add mobGriefing override to everything affected
|
||||
serverLevel.destroyBlock(pos, true, entity);
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/FarmBlock.java b/net/minecraft/world/level/block/FarmBlock.java
|
||||
index cd90b5151cae59a63836e88c6457c2954e24a345..3fd6a259788503f2a6d33d29a9247796f75e719a 100644
|
||||
--- a/net/minecraft/world/level/block/FarmBlock.java
|
||||
+++ b/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -114,7 +114,7 @@ public class FarmBlock extends Block {
|
||||
if (level instanceof ServerLevel serverLevel
|
||||
&& (serverLevel.purpurConfig.farmlandTrampleHeight >= 0D ? fallDistance >= serverLevel.purpurConfig.farmlandTrampleHeight : level.random.nextFloat() < fallDistance - 0.5) // Purpur - Configurable farmland trample height
|
||||
&& entity instanceof LivingEntity
|
||||
- && (entity instanceof Player || serverLevel.getGameRules().get(GameRules.MOB_GRIEFING))
|
||||
+ && (entity instanceof Player || serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.farmlandMobGriefingOverride)) // Purpur - Add mobGriefing override to everything affected
|
||||
&& entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) {
|
||||
// CraftBukkit start - Interact soil
|
||||
org.bukkit.event.Cancellable cancellable;
|
||||
diff --git a/net/minecraft/world/level/block/PowderSnowBlock.java b/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
index f3a9117bd066861a1b447e8a13108ad212cc499f..b0165c839b145e82af38fe8f61bbd0161015d867 100644
|
||||
--- a/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
+++ b/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
@@ -96,7 +96,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
|
||||
// CraftBukkit - move down
|
||||
&& entity1.mayInteract(serverLevel, blockPos)) {
|
||||
// CraftBukkit start
|
||||
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity1, pos, Blocks.AIR.defaultBlockState(), !(serverLevel.getGameRules().get(GameRules.MOB_GRIEFING) || entity1 instanceof Player))) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity1, pos, Blocks.AIR.defaultBlockState(), !(serverLevel.getGameRules().get(GameRules.MOB_GRIEFING, serverLevel.purpurConfig.powderSnowMobGriefingOverride) || entity1 instanceof Player))) { // Purpur - Add mobGriefing override to everything affected
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/net/minecraft/world/level/block/TurtleEggBlock.java b/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
index 77c2fb39c961180cd8280b97205273a5562481f7..f10a56052c51509784fb1f3851e41548c04d6a3c 100644
|
||||
--- a/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
+++ b/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
@@ -214,7 +214,7 @@ public class TurtleEggBlock extends Block {
|
||||
// Purpur end - Option to disable turtle egg trampling with feather falling
|
||||
if (entity instanceof Player) return true;
|
||||
|
||||
- return level.getGameRules().get(GameRules.MOB_GRIEFING);
|
||||
+ return level.getGameRules().get(GameRules.MOB_GRIEFING, level.purpurConfig.turtleEggsMobGriefingOverride); // Purpur - Add mobGriefing override to everything affected
|
||||
// Purpur end - Add turtle egg block options
|
||||
}
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/gamerules/GameRules.java b/net/minecraft/world/level/gamerules/GameRules.java
|
||||
index e71a9ffdb6c081baa79113f34b179671c179152d..746bc21fc09644366caa8bfd309f596c3cac59ec 100644
|
||||
--- a/net/minecraft/world/level/gamerules/GameRules.java
|
||||
+++ b/net/minecraft/world/level/gamerules/GameRules.java
|
||||
@@ -113,6 +113,13 @@ public class GameRules {
|
||||
return this.rules.keySet().stream();
|
||||
}
|
||||
|
||||
+ public <T> boolean get(GameRule<T> rule, Boolean gameRuleOverride) {
|
||||
+ if (gameRuleOverride != null) {
|
||||
+ return gameRuleOverride;
|
||||
+ }
|
||||
+ return (Boolean) this.get(rule);
|
||||
+ }
|
||||
+
|
||||
public <T> T get(GameRule<T> rule) {
|
||||
T object = this.rules.get(rule);
|
||||
if (object == null) {
|
||||
@@ -1,360 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Encode42 <me@encode42.dev>
|
||||
Date: Tue, 5 Jan 2021 22:21:56 -0500
|
||||
Subject: [PATCH] Add mobGriefing bypass to everything affected
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index 6de5f527c018201d874e06a45c9509fa12125766..2dc588e2d503c16ccd2589ce18abd2ecebbc8e74 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1818,7 +1818,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
boolean var6 = false;
|
||||
if (this.dead && entitySource instanceof WitherBoss) { // Paper
|
||||
- if (serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (serverLevel.purpurConfig.witherBypassMobGriefing ^ serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur - Add mobGriefing bypass to everything affected
|
||||
BlockPos blockPos = this.blockPosition();
|
||||
BlockState blockState = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
if (this.level().getBlockState(blockPos).isAir() && blockState.canSurvive(this.level(), blockPos)) {
|
||||
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
|
||||
index c431f28c3f4f6cec946048f5752c364429af5ba1..d93584c6793818463e8883ffe399bf16b03263a9 100644
|
||||
--- a/net/minecraft/world/entity/Mob.java
|
||||
+++ b/net/minecraft/world/entity/Mob.java
|
||||
@@ -648,7 +648,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
&& this.canPickUpLoot()
|
||||
&& this.isAlive()
|
||||
&& !this.dead
|
||||
- && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ && serverLevel.purpurConfig.entitiesPickUpLootBypassMobGriefing ^ serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur - Add mobGriefing bypass to everything affected
|
||||
Vec3i pickupReach = this.getPickupReach();
|
||||
|
||||
for (ItemEntity itemEntity : this.level()
|
||||
diff --git a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
|
||||
index e98fac58b29f78cb63bd868811cca41e1644e9ac..56d49bc71cb0cb0a08ff771991fd77ab774b4b59 100644
|
||||
--- a/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
|
||||
@@ -49,7 +49,7 @@ public class HarvestFarmland extends Behavior<Villager> {
|
||||
|
||||
@Override
|
||||
protected boolean checkExtraStartConditions(ServerLevel level, Villager owner) {
|
||||
- if (!level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (!level.purpurConfig.villagerBypassMobGriefing == !level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur - Add mobGriefing bypass to everything affected
|
||||
return false;
|
||||
} else if (owner.getVillagerData().getProfession() != VillagerProfession.FARMER && !(level.purpurConfig.villagerClericsFarmWarts && owner.getVillagerData().getProfession() == VillagerProfession.CLERIC)) { // Purpur - Option for Villager Clerics to farm Nether Wart
|
||||
return false;
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java b/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
||||
index e026e07ca86700c864a3dceda6817fb7b6cb11e9..f1dfe0bf047e7d331b2379a672ff7b8eae4c9c90 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/BreakDoorGoal.java
|
||||
@@ -30,7 +30,7 @@ public class BreakDoorGoal extends DoorInteractGoal {
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
return super.canUse()
|
||||
- && getServerLevel(this.mob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)
|
||||
+ && this.mob.level().purpurConfig.zombieBypassMobGriefing == !getServerLevel(this.mob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) // Purpur - Add mobGriefing bypass to everything affected
|
||||
&& this.isValidDifficulty(this.mob.level().getDifficulty())
|
||||
&& !this.isOpen();
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/EatBlockGoal.java b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
index e84893780b533b1ecb3675606b5c2daf7339b861..65eb4d8001b07cb3f7cda17565eea10a88a9c47c 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
@@ -67,7 +67,7 @@ public class EatBlockGoal extends Goal {
|
||||
BlockPos blockPos = this.mob.blockPosition();
|
||||
final BlockState blockState = this.level.getBlockState(blockPos); // Paper - fix wrong block state
|
||||
if (IS_TALL_GRASS.test(blockState)) { // Paper - fix wrong block state
|
||||
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos, blockState.getFluidState().createLegacyBlock(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - fix wrong block state
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos, blockState.getFluidState().createLegacyBlock(), !getServerLevel(this.level).purpurConfig.sheepBypassMobGriefing == !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - fix wrong block state // Purpur - Add mobGriefing bypass to everything affected
|
||||
this.level.destroyBlock(blockPos, false);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class EatBlockGoal extends Goal {
|
||||
} else {
|
||||
BlockPos blockPos1 = blockPos.below();
|
||||
if (this.level.getBlockState(blockPos1).is(Blocks.GRASS_BLOCK)) {
|
||||
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos1, Blocks.DIRT.defaultBlockState(), !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - Fix wrong block state
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos1, Blocks.DIRT.defaultBlockState(), !getServerLevel(this.level).purpurConfig.sheepBypassMobGriefing == !getServerLevel(this.level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Paper - Fix wrong block state // Purpur - Add mobGriefing bypass to everything affected
|
||||
this.level.levelEvent(2001, blockPos1, Block.getId(Blocks.GRASS_BLOCK.defaultBlockState()));
|
||||
this.level.setBlock(blockPos1, Blocks.DIRT.defaultBlockState(), 2);
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
index 579ca031d461ed4327fe4fb45c5289565322e64e..95fa516910a3834bbd4db6d11279e13a1f0dac41 100644
|
||||
--- a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java
|
||||
@@ -35,7 +35,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal {
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
- if (!getServerLevel(this.removerMob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (!getServerLevel(this.removerMob).purpurConfig.zombieBypassMobGriefing == !getServerLevel(this.removerMob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur - Add mobGriefing bypass to everything affected
|
||||
return false;
|
||||
} else if (this.nextStartTick > 0) {
|
||||
this.nextStartTick--;
|
||||
diff --git a/net/minecraft/world/entity/animal/Fox.java b/net/minecraft/world/entity/animal/Fox.java
|
||||
index 1acf9b8c9e6a5915b3f095e83d3f209708947093..3d94d5c9ecab0fe7332daf4cdac879385159eaa1 100644
|
||||
--- a/net/minecraft/world/entity/animal/Fox.java
|
||||
+++ b/net/minecraft/world/entity/animal/Fox.java
|
||||
@@ -1038,7 +1038,7 @@ public class Fox extends Animal implements VariantHolder<Fox.Variant> {
|
||||
}
|
||||
|
||||
protected void onReachedTarget() {
|
||||
- if (getServerLevel(Fox.this.level()).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (getServerLevel(Fox.this.level()).purpurConfig.foxBypassMobGriefing ^ getServerLevel(Fox.this.level()).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur - Add mobGriefing bypass to everything affected
|
||||
BlockState blockState = Fox.this.level().getBlockState(this.blockPos);
|
||||
if (blockState.is(Blocks.SWEET_BERRY_BUSH)) {
|
||||
this.pickSweetBerries(blockState);
|
||||
diff --git a/net/minecraft/world/entity/animal/Rabbit.java b/net/minecraft/world/entity/animal/Rabbit.java
|
||||
index bbdd06002b07699fffebdf6ed8148abdb69c24cc..7379def14f3f700fb8a746dc89d89e249e93b7b9 100644
|
||||
--- a/net/minecraft/world/entity/animal/Rabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/Rabbit.java
|
||||
@@ -620,7 +620,7 @@ public class Rabbit extends Animal implements VariantHolder<Rabbit.Variant> {
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
if (this.nextStartTick <= 0) {
|
||||
- if (!getServerLevel(this.rabbit).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (!getServerLevel(this.rabbit).purpurConfig.rabbitBypassMobGriefing == !getServerLevel(this.rabbit).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur - Add mobGriefing bypass to everything affected
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/SnowGolem.java b/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
index d97a297db3bec0c86c6a82ef1c353015df2115f7..6ee73b798ab306f7c828c9f06ca5b1a96bd96139 100644
|
||||
--- a/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
+++ b/net/minecraft/world/entity/animal/SnowGolem.java
|
||||
@@ -136,7 +136,7 @@ public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackM
|
||||
this.hurtServer(serverLevel, this.damageSources().melting(), 1.0F); // CraftBukkit - DamageSources.ON_FIRE -> CraftEventFactory.MELTING
|
||||
}
|
||||
|
||||
- if (!serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (!serverLevel.purpurConfig.snowGolemBypassMobGriefing == !serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur - Add mobGriefing bypass to everything affected
|
||||
return;
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
index ca900bb646e16c7b4342f23c3ffae786eab28145..724d259d4b793f2043e63dda9022bdfddc4dca38 100644
|
||||
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
||||
@@ -547,7 +547,7 @@ public class EnderDragon extends Mob implements Enemy {
|
||||
BlockPos blockPos = new BlockPos(i, i1, i2);
|
||||
BlockState blockState = level.getBlockState(blockPos);
|
||||
if (!blockState.isAir() && !blockState.is(BlockTags.DRAGON_TRANSPARENT)) {
|
||||
- if (level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !blockState.is(BlockTags.DRAGON_IMMUNE)) {
|
||||
+ if (level.purpurConfig.enderDragonBypassMobGriefing ^ level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !blockState.is(BlockTags.DRAGON_IMMUNE)) { // Purpur - Add mobGriefing bypass to everything affected
|
||||
// CraftBukkit start - Add blocks to list rather than destroying them
|
||||
//flag1 = level.removeBlock(blockPos, false) || flag1;
|
||||
flag1 = true;
|
||||
diff --git a/net/minecraft/world/entity/boss/wither/WitherBoss.java b/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index 60e666aa8afe14b519010b6d137a89e3d22f6c81..a325fa87e149e7f354ed4cf3dbb30a002c4ce32a 100644
|
||||
--- a/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -493,7 +493,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
|
||||
|
||||
if (this.destroyBlocksTick > 0) {
|
||||
this.destroyBlocksTick--;
|
||||
- if (this.destroyBlocksTick == 0 && level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (this.destroyBlocksTick == 0 && level.purpurConfig.witherBypassMobGriefing ^ level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur - Add mobGriefing bypass to everything affected
|
||||
boolean flag = false;
|
||||
int alternativeTarget = Mth.floor(this.getBbWidth() / 2.0F + 1.0F);
|
||||
int floor = Mth.floor(this.getBbHeight());
|
||||
diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java
|
||||
index f8d6935439b4e672ed655b2a458451d4b1fa8ffd..7b74322aef3d7d45a322abccc71d9168b3c0911b 100644
|
||||
--- a/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -516,7 +516,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
public boolean canUse() {
|
||||
if (!enderman.level().purpurConfig.endermanAllowGriefing) return false; // Purpur - Add enderman and creeper griefing controls
|
||||
return this.enderman.getCarriedBlock() != null
|
||||
- && getServerLevel(this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)
|
||||
+ && getServerLevel(this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) == !this.enderman.level().purpurConfig.endermanBypassMobGriefing // Purpur - Add mobGriefing bypass to everything affected
|
||||
&& this.enderman.getRandom().nextInt(reducedTickDelay(2000)) == 0;
|
||||
}
|
||||
|
||||
@@ -666,7 +666,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
public boolean canUse() {
|
||||
if (!enderman.level().purpurConfig.endermanAllowGriefing) return false; // Purpur - Add enderman and creeper griefing controls
|
||||
return this.enderman.getCarriedBlock() == null
|
||||
- && getServerLevel(this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)
|
||||
+ && getServerLevel(this.enderman).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) == !this.enderman.level().purpurConfig.endermanBypassMobGriefing // Purpur - Add mobGriefing bypass to everything affected
|
||||
&& this.enderman.getRandom().nextInt(reducedTickDelay(20)) == 0;
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Evoker.java b/net/minecraft/world/entity/monster/Evoker.java
|
||||
index d3d7e11a12af404d83e81888a9a633dfb93412ec..91574baf7ca095eae909e8e7225ad500bde15af2 100644
|
||||
--- a/net/minecraft/world/entity/monster/Evoker.java
|
||||
+++ b/net/minecraft/world/entity/monster/Evoker.java
|
||||
@@ -323,7 +323,7 @@ public class Evoker extends SpellcasterIllager {
|
||||
return false;
|
||||
} else {
|
||||
ServerLevel serverLevel = getServerLevel(Evoker.this.level());
|
||||
- if (!serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (!serverLevel.purpurConfig.evokerBypassMobGriefing == !serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur - Add mobGriefing bypass to everything affected
|
||||
return false;
|
||||
} else {
|
||||
List<Sheep> nearbyEntities = serverLevel.getNearbyEntities(
|
||||
diff --git a/net/minecraft/world/entity/monster/Ravager.java b/net/minecraft/world/entity/monster/Ravager.java
|
||||
index 36ebfc1102a18e4050eb9a2441d75bafcf3784b8..3449628fb87fd760abd730d84699c3a09c6ec761 100644
|
||||
--- a/net/minecraft/world/entity/monster/Ravager.java
|
||||
+++ b/net/minecraft/world/entity/monster/Ravager.java
|
||||
@@ -175,7 +175,7 @@ public class Ravager extends Raider {
|
||||
|
||||
if (this.level() instanceof ServerLevel serverLevel
|
||||
&& this.horizontalCollision
|
||||
- && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ && serverLevel.purpurConfig.ravagerBypassMobGriefing ^ serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { // Purpur - Add mobGriefing bypass to everything affected
|
||||
boolean flag = false;
|
||||
AABB aabb = this.getBoundingBox().inflate(0.2);
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Silverfish.java b/net/minecraft/world/entity/monster/Silverfish.java
|
||||
index d3befe91bc65bbc2bc0d8651b78e8c9576cd0f75..0d3b8b64a23a19d67a1a4a01faaf6649a59f54ad 100644
|
||||
--- a/net/minecraft/world/entity/monster/Silverfish.java
|
||||
+++ b/net/minecraft/world/entity/monster/Silverfish.java
|
||||
@@ -170,7 +170,7 @@ public class Silverfish extends Monster {
|
||||
return false;
|
||||
} else {
|
||||
RandomSource random = this.mob.getRandom();
|
||||
- if (getServerLevel(this.mob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && random.nextInt(reducedTickDelay(10)) == 0) {
|
||||
+ if (getServerLevel(this.mob).purpurConfig.silverfishBypassMobGriefing ^ getServerLevel(this.mob).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && random.nextInt(reducedTickDelay(10)) == 0) { // Purpur - Add mobGriefing bypass to everything affected
|
||||
this.selectedDirection = Direction.getRandom(random);
|
||||
BlockPos blockPos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5, this.mob.getZ()).relative(this.selectedDirection);
|
||||
BlockState blockState = this.mob.level().getBlockState(blockPos);
|
||||
@@ -247,7 +247,7 @@ public class Silverfish extends Monster {
|
||||
Block block = blockState.getBlock();
|
||||
if (block instanceof InfestedBlock) {
|
||||
// CraftBukkit start
|
||||
- BlockState afterState = getServerLevel(level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? blockState.getFluidState().createLegacyBlock() : ((InfestedBlock) block).hostStateByInfested(level.getBlockState(blockPos1)); // Paper - fix wrong block state
|
||||
+ BlockState afterState = getServerLevel(level).purpurConfig.silverfishBypassMobGriefing ^ getServerLevel(level).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? blockState.getFluidState().createLegacyBlock() : ((InfestedBlock) block).hostStateByInfested(level.getBlockState(blockPos1)); // Paper - fix wrong block state // Purpur - Add mobGriefing bypass to everything affected
|
||||
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockPos1, afterState)) { // Paper - fix wrong block state
|
||||
continue;
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||
index 897c57263ab7347987b289016a71d11f693bc8b2..d923a424e2b33b7d4e9e4ecdce8e0a8c825038de 100644
|
||||
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||
@@ -473,7 +473,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
|
||||
|
||||
@Override
|
||||
public boolean wantsToPickUp(ServerLevel level, ItemStack stack) {
|
||||
- return level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, stack);
|
||||
+ return level.purpurConfig.piglinBypassMobGriefing ^ level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && this.canPickUpLoot() && PiglinAi.wantsToPickup(this, stack); // Purpur - Add mobGriefing bypass to everything affected
|
||||
}
|
||||
|
||||
protected boolean canReplaceCurrentItem(ItemStack candidate) {
|
||||
diff --git a/net/minecraft/world/entity/projectile/LargeFireball.java b/net/minecraft/world/entity/projectile/LargeFireball.java
|
||||
index 4a752ace041228f095af7b1b4878a03c5ed2381f..3e8b5d042eddb817dee2504ff9aa263f6195b1c7 100644
|
||||
--- a/net/minecraft/world/entity/projectile/LargeFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/LargeFireball.java
|
||||
@@ -18,20 +18,20 @@ public class LargeFireball extends Fireball {
|
||||
|
||||
public LargeFireball(EntityType<? extends LargeFireball> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
- this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit
|
||||
+ this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.purpurConfig.fireballsBypassMobGriefing ^ serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit // Purpur - Add mobGriefing bypass to everything affected
|
||||
}
|
||||
|
||||
public LargeFireball(Level level, LivingEntity owner, Vec3 movement, int explosionPower) {
|
||||
super(EntityType.FIREBALL, owner, movement, level);
|
||||
this.explosionPower = explosionPower;
|
||||
- this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit
|
||||
+ this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.purpurConfig.fireballsBypassMobGriefing ^ serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // CraftBukkit // Purpur - Add mobGriefing bypass to everything affected
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onHit(HitResult result) {
|
||||
super.onHit(result);
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
- boolean _boolean = serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ boolean _boolean = serverLevel.purpurConfig.fireballsBypassMobGriefing ^ serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // Purpur - Add mobGriefing bypass to everything affected
|
||||
// CraftBukkit start - fire ExplosionPrimeEvent
|
||||
org.bukkit.event.entity.ExplosionPrimeEvent event = new org.bukkit.event.entity.ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
|
||||
this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
diff --git a/net/minecraft/world/entity/projectile/Projectile.java b/net/minecraft/world/entity/projectile/Projectile.java
|
||||
index ad0bb896d6ea669ce88bfe6490319e8ba7a29001..843f1396a6567672e5e8002d7e48fb18cf39d5de 100644
|
||||
--- a/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -454,7 +454,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@Override
|
||||
public boolean mayInteract(ServerLevel level, BlockPos pos) {
|
||||
Entity owner = this.getOwner();
|
||||
- return owner instanceof Player ? owner.mayInteract(level, pos) : owner == null || level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ return owner instanceof Player ? owner.mayInteract(level, pos) : owner == null || level.purpurConfig.projectilesBypassMobGriefing ^ level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // Purpur - Add mobGriefing bypass to everything affected
|
||||
}
|
||||
|
||||
public boolean mayBreak(ServerLevel level) {
|
||||
diff --git a/net/minecraft/world/entity/projectile/SmallFireball.java b/net/minecraft/world/entity/projectile/SmallFireball.java
|
||||
index 8c84cea43fc0e42a576004663670977eac99f1a6..808aa5dcb27c87b6ba5c1eee639486067447e370 100644
|
||||
--- a/net/minecraft/world/entity/projectile/SmallFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/SmallFireball.java
|
||||
@@ -25,7 +25,7 @@ public class SmallFireball extends Fireball {
|
||||
super(EntityType.SMALL_FIREBALL, owner, movement, level);
|
||||
// CraftBukkit start
|
||||
if (this.getOwner() != null && this.getOwner() instanceof Mob) {
|
||||
- this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ this.isIncendiary = (level instanceof ServerLevel serverLevel) && serverLevel.purpurConfig.fireballsBypassMobGriefing ^ serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // Purpur - Add mobGriefing bypass to everything affected
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java
|
||||
index 8270d76a753bfd26a4c8ef6610bee5c24ee59cfe..c06b589e669b055a26f662df60070d5908256220 100644
|
||||
--- a/net/minecraft/world/entity/raid/Raider.java
|
||||
+++ b/net/minecraft/world/entity/raid/Raider.java
|
||||
@@ -399,7 +399,7 @@ public abstract class Raider extends PatrollingMonster {
|
||||
}
|
||||
|
||||
private boolean cannotPickUpBanner() {
|
||||
- if (!getServerLevel(this.mob).getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
|
||||
+ if (!this.mob.level().purpurConfig.pillagerBypassMobGriefing == !getServerLevel(this.mob).getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items // Purpur - Add mobGriefing bypass to everything affected
|
||||
if (!this.mob.hasActiveRaid()) {
|
||||
return true;
|
||||
} else if (this.mob.getCurrentRaid().isOver()) {
|
||||
diff --git a/net/minecraft/world/level/block/CropBlock.java b/net/minecraft/world/level/block/CropBlock.java
|
||||
index b43f16297ac4441d78d0dc1fadb555698b0c3f6d..27f0c5c886a3f8b14ef9a00e2aaaabf4bf09c7db 100644
|
||||
--- a/net/minecraft/world/level/block/CropBlock.java
|
||||
+++ b/net/minecraft/world/level/block/CropBlock.java
|
||||
@@ -182,7 +182,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
||||
@Override
|
||||
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
|
||||
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
|
||||
- if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.purpurConfig.ravagerGriefableBlocks.contains(serverLevel.getBlockState(pos).getBlock()) && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Purpur - Configurable ravager griefable blocks list
|
||||
+ if (level instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.purpurConfig.ravagerGriefableBlocks.contains(serverLevel.getBlockState(pos).getBlock()) && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !serverLevel.purpurConfig.ravagerBypassMobGriefing == !serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit // Purpur - Configurable ravager griefable blocks list // Purpur - Add mobGriefing bypass to everything affected
|
||||
serverLevel.destroyBlock(pos, true, entity);
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/FarmBlock.java b/net/minecraft/world/level/block/FarmBlock.java
|
||||
index 6ab9a1188ce60e114ef35e393d9f2f46d490af83..9a7ca836e54cc3f58001c85f0079747f4d4941ad 100644
|
||||
--- a/net/minecraft/world/level/block/FarmBlock.java
|
||||
+++ b/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -114,7 +114,7 @@ public class FarmBlock extends Block {
|
||||
if (level instanceof ServerLevel serverLevel
|
||||
&& (serverLevel.purpurConfig.farmlandTrampleHeight >= 0D ? fallDistance >= serverLevel.purpurConfig.farmlandTrampleHeight : level.random.nextFloat() < fallDistance - 0.5F) // // Purpur - Configurable farmland trample height
|
||||
&& entity instanceof LivingEntity
|
||||
- && (entity instanceof Player || serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))
|
||||
+ && (entity instanceof Player || serverLevel.purpurConfig.farmlandBypassMobGriefing ^ serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))
|
||||
&& entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) {
|
||||
// CraftBukkit start - Interact soil
|
||||
org.bukkit.event.Cancellable cancellable;
|
||||
diff --git a/net/minecraft/world/level/block/PowderSnowBlock.java b/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
index 9c0ded7ae7e3a520704033a866f80743ae85d772..4f3646961beb877520e257e11224c3045467d351 100644
|
||||
--- a/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
+++ b/net/minecraft/world/level/block/PowderSnowBlock.java
|
||||
@@ -84,7 +84,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
|
||||
// CraftBukkit - move down
|
||||
&& entity.mayInteract(serverLevel, pos)) {
|
||||
// CraftBukkit start
|
||||
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !(serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof Player))) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !(serverLevel.purpurConfig.powderSnowBypassMobGriefing ^ serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof Player))) {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/net/minecraft/world/level/block/TurtleEggBlock.java b/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
index c97d5bd7b4c1b6f8eccbe2d123292e913a285ef2..a3a093d95306baac22e5cf720f5b14f733b548d4 100644
|
||||
--- a/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
+++ b/net/minecraft/world/level/block/TurtleEggBlock.java
|
||||
@@ -216,7 +216,7 @@ public class TurtleEggBlock extends Block {
|
||||
// Purpur end - Option to disable turtle egg trampling with feather falling
|
||||
if (entity instanceof Player) return true;
|
||||
|
||||
- return level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
+ return level.purpurConfig.turtleEggsBypassMobGriefing ^ level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); // Purpur - Add mobGriefing bypass to everything affected
|
||||
// Purpur end - Add turtle egg block options
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,279 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <ben@omega24.dev>
|
||||
Date: Tue, 25 May 2021 16:31:09 -0400
|
||||
Subject: [PATCH] API for any mob to burn daylight
|
||||
|
||||
Co-authored by: Encode42 <me@encode42.dev>
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 468df93a0302f200c2bd5e9bc65feccdd8649bf3..663cd67250c516fa8e16fa55dd91c02131507fd0 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -544,6 +544,24 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
|
||||
}
|
||||
// Purpur end - Add canSaveToDisk to Entity
|
||||
|
||||
+ // Purpur start - copied from Mob - API for any mob to burn daylight
|
||||
+ public boolean isSunBurnTick() {
|
||||
+ if (!this.level().isClientSide() && this.level().environmentAttributes().getValue(EnvironmentAttributes.MONSTERS_BURN, this.position())) {
|
||||
+ float lightLevelDependentMagicValue = this.getLightLevelDependentMagicValue();
|
||||
+ BlockPos blockPos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ());
|
||||
+ boolean flag = this.isInWater() || this.isInPowderSnow || this.wasInPowderSnow;
|
||||
+ if (lightLevelDependentMagicValue > 0.5F
|
||||
+ && this.random.nextFloat() * 30.0F < (lightLevelDependentMagicValue - 0.4F) * 2.0F
|
||||
+ && !flag
|
||||
+ && this.level().canSeeSky(blockPos)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end - copied from Mob - API for any mob to burn daylight
|
||||
+
|
||||
public Entity(EntityType<?> type, Level level) {
|
||||
this.type = type;
|
||||
this.level = level;
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index f991e7a6988e98ec64b6af3c6c56522b19d929d2..78e68335805270ff1f942fe28e0e833adb41fd85 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -290,6 +290,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
|
||||
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||
public int invulnerableDuration = LivingEntity.INVULNERABLE_DURATION; // Paper - configurable invulnerable duration
|
||||
+ protected boolean shouldBurnInDay = false; public boolean shouldBurnInDay() { return this.shouldBurnInDay; } public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } // Purpur - API for any mob to burn daylight
|
||||
// CraftBukkit end
|
||||
|
||||
protected LivingEntity(EntityType<? extends LivingEntity> type, Level level) {
|
||||
@@ -793,6 +794,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
this.getSleepingPos().ifPresent(blockPos -> output.store("sleeping_pos", BlockPos.CODEC, blockPos));
|
||||
DataResult<Dynamic<?>> dataResult = this.brain.serializeStart(NbtOps.INSTANCE).map(tag -> new Dynamic<>(NbtOps.INSTANCE, tag));
|
||||
dataResult.resultOrPartial(LOGGER::error).ifPresent(dynamic -> output.store("Brain", Codec.PASSTHROUGH, (Dynamic<?>)dynamic));
|
||||
+ output.putBoolean("Purpur.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - API for any mob to burn daylight
|
||||
if (this.lastHurtByPlayer != null) {
|
||||
this.lastHurtByPlayer.store(output, "last_hurt_by_player");
|
||||
output.putInt("last_hurt_by_player_memory_time", this.lastHurtByPlayerMemoryTime);
|
||||
@@ -917,6 +919,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
} // Paper - The sleeping pos will always also set the actual pos, so a desync suggests something is wrong
|
||||
}, this::clearSleepingPos);
|
||||
input.read("Brain", Codec.PASSTHROUGH).ifPresent(dynamic -> this.brain = this.makeBrain((Dynamic<?>)dynamic));
|
||||
+ this.shouldBurnInDay = input.getBooleanOr("Purpur.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - API for any mob to burn daylight
|
||||
this.lastHurtByPlayer = EntityReference.read(input, "last_hurt_by_player");
|
||||
this.lastHurtByPlayerMemoryTime = input.getIntOr("last_hurt_by_player_memory_time", 0);
|
||||
this.lastHurtByMob = EntityReference.read(input, "last_hurt_by_mob");
|
||||
@@ -3850,6 +3853,37 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterOrRain()) {
|
||||
this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F);
|
||||
}
|
||||
+
|
||||
+ // Purpur start - copied from Mob - API for any mob to burn daylight
|
||||
+ if (this.getType().is(EntityTypeTags.BURN_IN_DAYLIGHT) && this.isAlive()) {
|
||||
+ boolean flag = this.shouldBurnInDay() && this.isSunBurnTick(); // Paper - shouldBurnInDay API // Purpur - use shouldBurnInDay() method to handle Phantoms properly - API for any mob to burn daylight
|
||||
+ if (flag) {
|
||||
+ EquipmentSlot equipmentSlot = this.sunProtectionSlot();
|
||||
+ ItemStack itemBySlot = this.getItemBySlot(equipmentSlot);
|
||||
+ if (!itemBySlot.isEmpty()) {
|
||||
+ if (itemBySlot.isDamageableItem()) {
|
||||
+ Item item = itemBySlot.getItem();
|
||||
+ itemBySlot.setDamageValue(itemBySlot.getDamageValue() + this.random.nextInt(2));
|
||||
+ if (itemBySlot.getDamageValue() >= itemBySlot.getMaxDamage()) {
|
||||
+ this.onEquippedItemBroken(item, equipmentSlot);
|
||||
+ this.setItemSlot(equipmentSlot, ItemStack.EMPTY);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ flag = false;
|
||||
+ }
|
||||
+
|
||||
+ if (flag) {
|
||||
+ if (getRider() == null || !this.isControllable()) // Purpur - ignore mobs which are uncontrollable or without rider - API for any mob to burn daylight
|
||||
+ this.igniteForSeconds(8.0F);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected EquipmentSlot sunProtectionSlot() {
|
||||
+ return net.minecraft.world.entity.EquipmentSlot.HEAD;
|
||||
+ // Purpur end - copied from Mob - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
protected void applyInput() {
|
||||
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
|
||||
index c94a1bd594bcd3b2f7525f1541d2e55897954623..327982be3748e82a36c7a24ede989dacebfb04db 100644
|
||||
--- a/net/minecraft/world/entity/Mob.java
|
||||
+++ b/net/minecraft/world/entity/Mob.java
|
||||
@@ -544,9 +544,9 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@Override
|
||||
public void aiStep() {
|
||||
super.aiStep();
|
||||
- if (this.getType().is(EntityTypeTags.BURN_IN_DAYLIGHT)) {
|
||||
+ /*if (this.getType().is(EntityTypeTags.BURN_IN_DAYLIGHT)) { // Purpur start - implemented in LivingEntity - API for any mob to burn daylight
|
||||
this.burnUndead();
|
||||
- }
|
||||
+ }*/ // Purpur end - implemented in LivingEntity - API for any mob to burn daylight
|
||||
|
||||
ProfilerFiller profilerFiller = Profiler.get();
|
||||
profilerFiller.push("looting");
|
||||
@@ -601,19 +601,8 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
}
|
||||
|
||||
public boolean isSunBurnTick() {
|
||||
- if (!this.level().isClientSide() && this.level().environmentAttributes().getValue(EnvironmentAttributes.MONSTERS_BURN, this.position())) {
|
||||
- float lightLevelDependentMagicValue = this.getLightLevelDependentMagicValue();
|
||||
- BlockPos blockPos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ());
|
||||
- boolean flag = this.isInWaterOrRain() || this.isInPowderSnow || this.wasInPowderSnow;
|
||||
- if (lightLevelDependentMagicValue > 0.5F
|
||||
- && this.random.nextFloat() * 30.0F < (lightLevelDependentMagicValue - 0.4F) * 2.0F
|
||||
- && !flag
|
||||
- && this.level().canSeeSky(blockPos)) {
|
||||
- return true;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return false;
|
||||
+ // Purpur - implemented in Entity - API for any mob to burn daylight
|
||||
+ return super.isSunBurnTick();
|
||||
}
|
||||
|
||||
protected Vec3i getPickupReach() {
|
||||
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
|
||||
index 2fa22088ac507eceb36f3c77f24a733076641d8f..ff944ad57d4e9e4a910cd63282e5e7594626365e 100644
|
||||
--- a/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -52,7 +52,7 @@ public class Phantom extends Mob implements Enemy {
|
||||
Vec3 crystalPosition; // Purpur - Phantoms attracted to crystals and crystals shoot phantoms
|
||||
// Paper start
|
||||
public java.util.@Nullable UUID spawningEntity;
|
||||
- public boolean shouldBurnInDay = true;
|
||||
+ //public boolean shouldBurnInDay = true; // Purpur - API for any mob to burn daylight
|
||||
// Paper end
|
||||
private static final net.minecraft.world.item.crafting.Ingredient TORCH = net.minecraft.world.item.crafting.Ingredient.of(net.minecraft.world.item.Items.TORCH, net.minecraft.world.item.Items.SOUL_TORCH); // Purpur - Phantoms burn in light
|
||||
|
||||
@@ -61,6 +61,7 @@ public class Phantom extends Mob implements Enemy {
|
||||
this.xpReward = 5;
|
||||
this.moveControl = new Phantom.PhantomMoveControl(this);
|
||||
this.lookControl = new Phantom.PhantomLookControl(this);
|
||||
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
// Purpur start - Ridables
|
||||
@@ -297,7 +298,7 @@ public class Phantom extends Mob implements Enemy {
|
||||
this.setPhantomSize(input.getIntOr("size", 0));
|
||||
// Paper start
|
||||
this.spawningEntity = input.read("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC).orElse(null);
|
||||
- this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true);
|
||||
+ //this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
// Paper end
|
||||
}
|
||||
|
||||
@@ -308,7 +309,7 @@ public class Phantom extends Mob implements Enemy {
|
||||
output.putInt("size", this.getPhantomSize());
|
||||
// Paper start
|
||||
output.storeNullable("Paper.SpawningEntity", net.minecraft.core.UUIDUtil.CODEC, this.spawningEntity);
|
||||
- output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
|
||||
+ //output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
// Paper end
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java b/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java
|
||||
index 1ab860be69bcc1ab5cc07418c2d7e733afdc482b..60afd81d3bf671889fbff5d4a3fabb38a8e2d461 100644
|
||||
--- a/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java
|
||||
+++ b/net/minecraft/world/entity/monster/skeleton/AbstractSkeleton.java
|
||||
@@ -66,11 +66,12 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
AbstractSkeleton.this.setAggressive(true);
|
||||
}
|
||||
};
|
||||
- private boolean shouldBurnInDay = true; // Paper - shouldBurnInDay API
|
||||
+ //private boolean shouldBurnInDay = true; // Paper - shouldBurnInDay API // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
|
||||
|
||||
protected AbstractSkeleton(EntityType<? extends AbstractSkeleton> type, Level level) {
|
||||
super(type, level);
|
||||
this.reassessWeaponGoal();
|
||||
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -223,14 +224,14 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
protected void readAdditionalSaveData(ValueInput input) {
|
||||
super.readAdditionalSaveData(input);
|
||||
this.reassessWeaponGoal();
|
||||
- this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - shouldBurnInDay API
|
||||
+ //this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - shouldBurnInDay API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
// Paper start - shouldBurnInDay API
|
||||
@Override
|
||||
protected void addAdditionalSaveData(final net.minecraft.world.level.storage.ValueOutput output) {
|
||||
super.addAdditionalSaveData(output);
|
||||
- output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
|
||||
+ //output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
}
|
||||
// Paper end - shouldBurnInDay API
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/zombie/Husk.java b/net/minecraft/world/entity/monster/zombie/Husk.java
|
||||
index 928e2c95146bc3fc9b8c41c5b6c3970fc919bb15..31b91dbc3f3e1875fbe6750bb815514686d14f7f 100644
|
||||
--- a/net/minecraft/world/entity/monster/zombie/Husk.java
|
||||
+++ b/net/minecraft/world/entity/monster/zombie/Husk.java
|
||||
@@ -27,6 +27,7 @@ import org.jspecify.annotations.Nullable;
|
||||
public class Husk extends Zombie {
|
||||
public Husk(EntityType<? extends Husk> type, Level level) {
|
||||
super(type, level);
|
||||
+ this.setShouldBurnInDay(false); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
// Purpur start - Ridables
|
||||
@@ -84,7 +85,7 @@ public class Husk extends Zombie {
|
||||
|
||||
@Override
|
||||
public boolean isSunSensitive() {
|
||||
- return false;
|
||||
+ return this.shouldBurnInDay; // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/world/entity/monster/zombie/Zombie.java b/net/minecraft/world/entity/monster/zombie/Zombie.java
|
||||
index dfdf9ee98a25ec1f7a1f41326c98155131494d93..d32a831ba76f65c4719c2672ffaec81a861cc7e6 100644
|
||||
--- a/net/minecraft/world/entity/monster/zombie/Zombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/zombie/Zombie.java
|
||||
@@ -92,11 +92,12 @@ public class Zombie extends Monster {
|
||||
private boolean canBreakDoors = false;
|
||||
private int inWaterTime = 0;
|
||||
public int conversionTime;
|
||||
- private boolean shouldBurnInDay = true; // Paper - Add more Zombie API
|
||||
+ //private boolean shouldBurnInDay = true; // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
|
||||
public Zombie(EntityType<? extends Zombie> type, Level level) {
|
||||
super(type, level);
|
||||
this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(level.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(type, level.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper - Configurable door breaking difficulty
|
||||
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
public Zombie(Level level) {
|
||||
@@ -347,6 +348,7 @@ public class Zombie extends Monster {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
+ public boolean shouldBurnInDay() { return this.isSunSensitive(); } // Purpur - for ABI compatibility - API for any mob to burn daylight
|
||||
public boolean isSunSensitive() {
|
||||
return this.shouldBurnInDay; // Paper - Add more Zombie API
|
||||
}
|
||||
@@ -486,7 +488,7 @@ public class Zombie extends Monster {
|
||||
output.putBoolean("CanBreakDoors", this.canBreakDoors());
|
||||
output.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
|
||||
output.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
|
||||
- output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API
|
||||
+ //output.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -501,7 +503,7 @@ public class Zombie extends Monster {
|
||||
} else {
|
||||
this.getEntityData().set(DATA_DROWNED_CONVERSION_ID, false);
|
||||
}
|
||||
- this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - Add more Zombie API
|
||||
+ //this.shouldBurnInDay = input.getBooleanOr("Paper.ShouldBurnInDay", true); // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,72 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Sat, 9 Jan 2021 15:26:04 +0100
|
||||
Subject: [PATCH] Add EntityTeleportHinderedEvent
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/net/minecraft/world/level/block/EndGatewayBlock.java b/net/minecraft/world/level/block/EndGatewayBlock.java
|
||||
index 84a1bd5e40e635962d795506861447851e443eee..54abeb142e119edd1c1d1c263821b95b1f05c388 100644
|
||||
--- a/net/minecraft/world/level/block/EndGatewayBlock.java
|
||||
+++ b/net/minecraft/world/level/block/EndGatewayBlock.java
|
||||
@@ -98,6 +98,13 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal {
|
||||
org.bukkit.event.entity.EntityPortalEnterEvent event = new org.bukkit.event.entity.EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(level.getWorld(), pos.getX(), pos.getY(), pos.getZ()), org.bukkit.PortalType.END_GATEWAY); // Paper - add portal type
|
||||
if (!event.callEvent()) return;
|
||||
// Paper end - call EntityPortalEnterEvent
|
||||
+ // Purpur start - Add EntityTeleportHinderedEvent
|
||||
+ if (level.purpurConfig.imposeTeleportRestrictionsOnGateways && (entity.isVehicle() || entity.isPassenger())) {
|
||||
+ if (!new org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent(entity.getBukkitEntity(), entity.isPassenger() ? org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_PASSENGER : org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_VEHICLE, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_GATEWAY).callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Add EntityTeleportHinderedEvent
|
||||
entity.setAsInsidePortal(this, pos);
|
||||
TheEndGatewayBlockEntity.triggerCooldown(level, pos, state, theEndGatewayBlockEntity);
|
||||
}
|
||||
diff --git a/net/minecraft/world/level/block/EndPortalBlock.java b/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
index 01cddd7001b4a7f99c1b1d147fac904d3064d733..7e60bcadd2d343e00fc554dba0b85c9191f7efb6 100644
|
||||
--- a/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
+++ b/net/minecraft/world/level/block/EndPortalBlock.java
|
||||
@@ -58,6 +58,13 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal {
|
||||
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
|
||||
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
|
||||
if (entity.canUsePortal(false)) {
|
||||
+ // Purpur start - Add EntityTeleportHinderedEvent
|
||||
+ if (level.purpurConfig.imposeTeleportRestrictionsOnEndPortals && (entity.isVehicle() || entity.isPassenger())) {
|
||||
+ if (!new org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent(entity.getBukkitEntity(), entity.isPassenger() ? org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_PASSENGER : org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_VEHICLE, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL).callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Add EntityTeleportHinderedEvent
|
||||
// CraftBukkit start - Entity in portal
|
||||
org.bukkit.event.entity.EntityPortalEnterEvent event = new org.bukkit.event.entity.EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(level.getWorld(), pos.getX(), pos.getY(), pos.getZ()), org.bukkit.PortalType.ENDER); // Paper - add portal type
|
||||
level.getCraftServer().getPluginManager().callEvent(event);
|
||||
diff --git a/net/minecraft/world/level/block/NetherPortalBlock.java b/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
index 006444811c00a8820bddaf75950e794271efdd82..eb659209008209c0930770e5f9671a3d7a4abae6 100644
|
||||
--- a/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
+++ b/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
@@ -117,6 +117,13 @@ public class NetherPortalBlock extends Block implements Portal {
|
||||
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
|
||||
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
|
||||
if (entity.canUsePortal(false)) {
|
||||
+ // Purpur start - Add EntityTeleportHinderedEvent
|
||||
+ if (level.purpurConfig.imposeTeleportRestrictionsOnNetherPortals && (entity.isVehicle() || entity.isPassenger())) {
|
||||
+ if (!new org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent(entity.getBukkitEntity(), entity.isPassenger() ? org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_PASSENGER : org.purpurmc.purpur.event.entity.EntityTeleportHinderedEvent.Reason.IS_VEHICLE, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.NETHER_PORTAL).callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Add EntityTeleportHinderedEvent
|
||||
// CraftBukkit start - Entity in portal
|
||||
org.bukkit.event.entity.EntityPortalEnterEvent event = new org.bukkit.event.entity.EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(level.getWorld(), pos.getX(), pos.getY(), pos.getZ()), org.bukkit.PortalType.NETHER); // Paper - add portal type
|
||||
level.getCraftServer().getPluginManager().callEvent(event);
|
||||
@@ -0,0 +1,79 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 30 Aug 2021 22:49:53 -0500
|
||||
Subject: [PATCH] Cows naturally aggressive to players chance
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
|
||||
index ccdd439a89b7e7e10ee960cfe1e5e119d5367799..49292ae53f2b4554064daa4953a8cec00aa1fa98 100644
|
||||
--- a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
|
||||
+++ b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
|
||||
@@ -135,7 +135,7 @@ public class DefaultAttributes {
|
||||
.put(EntityType.LLAMA, Llama.createAttributes().build())
|
||||
.put(EntityType.MAGMA_CUBE, MagmaCube.createAttributes().build())
|
||||
.put(EntityType.MANNEQUIN, LivingEntity.createLivingAttributes().build())
|
||||
- .put(EntityType.MOOSHROOM, Cow.createAttributes().build())
|
||||
+ .put(EntityType.MOOSHROOM, net.minecraft.world.entity.animal.cow.AbstractCow.createAttributes().build()) // Purpur - Cows naturally aggressive to players chance
|
||||
.put(EntityType.MULE, AbstractChestedHorse.createBaseChestedHorseAttributes().build())
|
||||
.put(EntityType.NAUTILUS, Nautilus.createAttributes().build())
|
||||
.put(EntityType.OCELOT, Ocelot.createAttributes().build())
|
||||
diff --git a/net/minecraft/world/entity/animal/cow/Cow.java b/net/minecraft/world/entity/animal/cow/Cow.java
|
||||
index bb8c75d20e6a1300d68ae75233962bdc26736c77..9fa18b190091bbfcb9a65d8d35f68fc7375f504f 100644
|
||||
--- a/net/minecraft/world/entity/animal/cow/Cow.java
|
||||
+++ b/net/minecraft/world/entity/animal/cow/Cow.java
|
||||
@@ -23,6 +23,8 @@ import net.minecraft.world.level.storage.ValueOutput;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
public class Cow extends AbstractCow {
|
||||
+ private boolean isNaturallyAggressiveToPlayers; // Purpur - Cows naturally aggressive to players chance
|
||||
+
|
||||
private static final EntityDataAccessor<Holder<CowVariant>> DATA_VARIANT_ID = SynchedEntityData.defineId(Cow.class, EntityDataSerializers.COW_VARIANT);
|
||||
|
||||
public Cow(EntityType<? extends Cow> type, Level level) {
|
||||
@@ -49,8 +51,9 @@ public class Cow extends AbstractCow {
|
||||
// Purpur start - Configurable entity base attributes
|
||||
@Override
|
||||
public void initAttributes() {
|
||||
- this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.cowMaxHealth);
|
||||
- this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.cowScale);
|
||||
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.cowMaxHealth);
|
||||
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.SCALE).setBaseValue(this.level().purpurConfig.cowScale);
|
||||
+ this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.ATTACK_DAMAGE).setBaseValue(this.level().purpurConfig.cowNaturallyAggressiveToPlayersDamage); // Purpur - Cows naturally aggressive to players chance
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -68,6 +71,13 @@ public class Cow extends AbstractCow {
|
||||
}
|
||||
// Purpur end - Toggle for water sensitive mob damage
|
||||
|
||||
+ @Override
|
||||
+ protected void registerGoals() {
|
||||
+ super.registerGoals();
|
||||
+ this.goalSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.MeleeAttackGoal(this, 1.2000000476837158D, true)); // Purpur - Cows naturally aggressive to players chance
|
||||
+ this.targetSelector.addGoal(0, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, net.minecraft.world.entity.player.Player.class, 10, true, false, (ignored, ignored2) -> isNaturallyAggressiveToPlayers)); // Purpur - Cows naturally aggressive to players chance
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
||||
super.defineSynchedData(builder);
|
||||
@@ -80,6 +90,12 @@ public class Cow extends AbstractCow {
|
||||
VariantUtils.writeVariant(output, this.getVariant());
|
||||
}
|
||||
|
||||
+ // Purpur start - Cows naturally aggressive to players chance
|
||||
+ public static net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder createAttributes() {
|
||||
+ return AbstractCow.createAttributes().add(net.minecraft.world.entity.ai.attributes.Attributes.ATTACK_DAMAGE, 0.0D);
|
||||
+ }
|
||||
+ // Purpur end - Cows naturally aggressive to players chance
|
||||
+
|
||||
@Override
|
||||
protected void readAdditionalSaveData(ValueInput input) {
|
||||
super.readAdditionalSaveData(input);
|
||||
@@ -100,6 +116,7 @@ public class Cow extends AbstractCow {
|
||||
public SpawnGroupData finalizeSpawn(
|
||||
ServerLevelAccessor level, DifficultyInstance difficulty, EntitySpawnReason spawnReason, @Nullable SpawnGroupData spawnGroupData
|
||||
) {
|
||||
+ this.isNaturallyAggressiveToPlayers = level.getLevel().purpurConfig.cowNaturallyAggressiveToPlayersChance > 0.0D && random.nextDouble() <= level.getLevel().purpurConfig.cowNaturallyAggressiveToPlayersChance; // Purpur - Cows naturally aggressive to players chance
|
||||
VariantUtils.selectVariantToSpawn(SpawnContext.create(level, this.blockPosition()), Registries.COW_VARIANT).ifPresent(this::setVariant);
|
||||
return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData);
|
||||
}
|
||||
@@ -1,344 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <ben@omega24.dev>
|
||||
Date: Tue, 25 May 2021 16:31:09 -0400
|
||||
Subject: [PATCH] API for any mob to burn daylight
|
||||
|
||||
Co-authored by: Encode42 <me@encode42.dev>
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 62a38ecedbd579b32a8fd9cff5a433bfe635fc62..8473a7d9af9d83e97387ddf4cc50f6ad22730def 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -530,6 +530,24 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
// Purpur end - Add canSaveToDisk to Entity
|
||||
|
||||
+ // Purpur start - copied from Mob - API for any mob to burn daylight
|
||||
+ public boolean isSunBurnTick() {
|
||||
+ if (this.level().isDay() && !this.level().isClientSide) {
|
||||
+ float lightLevelDependentMagicValue = this.getLightLevelDependentMagicValue();
|
||||
+ BlockPos blockPos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ());
|
||||
+ boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow;
|
||||
+ if (lightLevelDependentMagicValue > 0.5F
|
||||
+ && this.random.nextFloat() * 30.0F < (lightLevelDependentMagicValue - 0.4F) * 2.0F
|
||||
+ && !flag
|
||||
+ && this.level().canSeeSky(blockPos)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Purpur end - copied from Mob - API for any mob to burn daylight
|
||||
+
|
||||
public Entity(EntityType<?> entityType, Level level) {
|
||||
this.type = entityType;
|
||||
this.level = level;
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index 2dc588e2d503c16ccd2589ce18abd2ecebbc8e74..db5a2227009bc4d655fc781d5850221f36f2d112 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -301,6 +301,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
|
||||
public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
|
||||
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||
+ protected boolean shouldBurnInDay = false; public boolean shouldBurnInDay() { return this.shouldBurnInDay; } public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } // Purpur - API for any mob to burn daylight
|
||||
|
||||
@Override
|
||||
public float getBukkitYaw() {
|
||||
@@ -809,6 +810,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
});
|
||||
DataResult<Tag> dataResult = this.brain.serializeStart(NbtOps.INSTANCE);
|
||||
dataResult.resultOrPartial(LOGGER::error).ifPresent(brain -> compound.put("Brain", brain));
|
||||
+ compound.putBoolean("Purpur.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -892,6 +894,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (compound.contains("Brain", 10)) {
|
||||
this.brain = this.makeBrain(new Dynamic<>(NbtOps.INSTANCE, compound.get("Brain")));
|
||||
}
|
||||
+
|
||||
+ // Purpur start - API for any mob to burn daylight
|
||||
+ if (compound.contains("Purpur.ShouldBurnInDay")) {
|
||||
+ this.shouldBurnInDay = compound.getBoolean("Purpur.ShouldBurnInDay");
|
||||
+ }
|
||||
+ // Purpur end - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -3574,6 +3582,32 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (this.level() instanceof ServerLevel serverLevel && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
|
||||
this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F);
|
||||
}
|
||||
+
|
||||
+ // Purpur start - copied from Zombie - API for any mob to burn daylight
|
||||
+ if (this.isAlive()) {
|
||||
+ boolean flag = this.shouldBurnInDay() && this.isSunBurnTick(); // Paper - shouldBurnInDay API // Purpur - use shouldBurnInDay() method to handle Phantoms properly - API for any mob to burn daylight
|
||||
+ if (flag) {
|
||||
+ ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
|
||||
+ if (!itemBySlot.isEmpty()) {
|
||||
+ if (itemBySlot.isDamageableItem()) {
|
||||
+ Item item = itemBySlot.getItem();
|
||||
+ itemBySlot.setDamageValue(itemBySlot.getDamageValue() + this.random.nextInt(2));
|
||||
+ if (itemBySlot.getDamageValue() >= itemBySlot.getMaxDamage()) {
|
||||
+ this.onEquippedItemBroken(item, EquipmentSlot.HEAD);
|
||||
+ this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ flag = false;
|
||||
+ }
|
||||
+
|
||||
+ if (flag) {
|
||||
+ if (getRider() == null || !this.isControllable()) // Purpur - ignore mobs which are uncontrollable or without rider - API for any mob to burn daylight
|
||||
+ this.igniteForSeconds(8.0F);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - copied from Zombie - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
public boolean isSensitiveToWater() {
|
||||
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
|
||||
index d93584c6793818463e8883ffe399bf16b03263a9..70ee86993d381445855ac7e7290da384d6675987 100644
|
||||
--- a/net/minecraft/world/entity/Mob.java
|
||||
+++ b/net/minecraft/world/entity/Mob.java
|
||||
@@ -1655,19 +1655,8 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
}
|
||||
|
||||
public boolean isSunBurnTick() {
|
||||
- if (this.level().isDay() && !this.level().isClientSide) {
|
||||
- float lightLevelDependentMagicValue = this.getLightLevelDependentMagicValue();
|
||||
- BlockPos blockPos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ());
|
||||
- boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow;
|
||||
- if (lightLevelDependentMagicValue > 0.5F
|
||||
- && this.random.nextFloat() * 30.0F < (lightLevelDependentMagicValue - 0.4F) * 2.0F
|
||||
- && !flag
|
||||
- && this.level().canSeeSky(blockPos)) {
|
||||
- return true;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return false;
|
||||
+ // Purpur - implemented in Entity - API for any mob to burn daylight
|
||||
+ return super.isSunBurnTick();
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/world/entity/monster/AbstractSkeleton.java b/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
index e186aee80b052b7fc4bfe02763010bfb2d55ea35..223739818e9ac6c9fe396b82bce53a3ab029610a 100644
|
||||
--- a/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -64,11 +64,12 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
AbstractSkeleton.this.setAggressive(true);
|
||||
}
|
||||
};
|
||||
- private boolean shouldBurnInDay = true; // Paper - shouldBurnInDay API
|
||||
+ //private boolean shouldBurnInDay = true; // Paper - shouldBurnInDay API // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
|
||||
|
||||
protected AbstractSkeleton(EntityType<? extends AbstractSkeleton> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
this.reassessWeaponGoal();
|
||||
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -110,27 +111,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
|
||||
@Override
|
||||
public void aiStep() {
|
||||
- boolean isSunBurnTick = this.shouldBurnInDay && this.isSunBurnTick(); // Paper - shouldBurnInDay API
|
||||
- if (isSunBurnTick) {
|
||||
- ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
|
||||
- if (!itemBySlot.isEmpty()) {
|
||||
- if (itemBySlot.isDamageableItem()) {
|
||||
- Item item = itemBySlot.getItem();
|
||||
- itemBySlot.setDamageValue(itemBySlot.getDamageValue() + this.random.nextInt(2));
|
||||
- if (itemBySlot.getDamageValue() >= itemBySlot.getMaxDamage()) {
|
||||
- this.onEquippedItemBroken(item, EquipmentSlot.HEAD);
|
||||
- this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- isSunBurnTick = false;
|
||||
- }
|
||||
-
|
||||
- if (isSunBurnTick) {
|
||||
- this.igniteForSeconds(8.0F);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
+ // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
super.aiStep();
|
||||
}
|
||||
|
||||
@@ -243,7 +224,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
super.readAdditionalSaveData(compound);
|
||||
this.reassessWeaponGoal();
|
||||
// Paper start - shouldBurnInDay API
|
||||
- if (compound.contains("Paper.ShouldBurnInDay")) {
|
||||
+ if (false && compound.contains("Paper.ShouldBurnInDay")) { // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
this.shouldBurnInDay = compound.getBoolean("Paper.ShouldBurnInDay");
|
||||
}
|
||||
// Paper end - shouldBurnInDay API
|
||||
@@ -252,7 +233,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
@Override
|
||||
public void addAdditionalSaveData(final net.minecraft.nbt.CompoundTag nbt) {
|
||||
super.addAdditionalSaveData(nbt);
|
||||
- nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
|
||||
+ //nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
}
|
||||
// Paper end - shouldBurnInDay API
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Husk.java b/net/minecraft/world/entity/monster/Husk.java
|
||||
index 31eef2869945d9de565d627cac3fc1a5db380a2a..e618e716cb5ff3a3c5d284e985455694cc0edde0 100644
|
||||
--- a/net/minecraft/world/entity/monster/Husk.java
|
||||
+++ b/net/minecraft/world/entity/monster/Husk.java
|
||||
@@ -19,6 +19,7 @@ import net.minecraft.world.level.ServerLevelAccessor;
|
||||
public class Husk extends Zombie {
|
||||
public Husk(EntityType<? extends Husk> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
+ this.setShouldBurnInDay(false); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
// Purpur start - Ridables
|
||||
@@ -82,7 +83,7 @@ public class Husk extends Zombie {
|
||||
|
||||
@Override
|
||||
public boolean isSunSensitive() {
|
||||
- return false;
|
||||
+ return this.shouldBurnInDay; // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/net/minecraft/world/entity/monster/Phantom.java b/net/minecraft/world/entity/monster/Phantom.java
|
||||
index 32b7c34d3c68dcfa936b628b2d038524204129a3..0ee817699fffbb929011465029182cc56befc30c 100644
|
||||
--- a/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -60,6 +60,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
this.xpReward = 5;
|
||||
this.moveControl = new Phantom.PhantomMoveControl(this);
|
||||
this.lookControl = new Phantom.PhantomLookControl(this);
|
||||
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
// Purpur start - Ridables
|
||||
@@ -146,6 +147,16 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
}
|
||||
// Purpur end - Toggle for water sensitive mob damage
|
||||
|
||||
+ //private boolean shouldBurnInDay = true; // Purpur - moved to LivingEntity; keep methods for ABI compatibility - API for any mob to burn daylight
|
||||
+ // Purpur start - API for any mob to burn daylight
|
||||
+ public boolean shouldBurnInDay() {
|
||||
+ boolean burnFromDaylight = this.shouldBurnInDay && this.level().purpurConfig.phantomBurnInDaylight;
|
||||
+ boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight;
|
||||
+ return burnFromDaylight || burnFromLightSource;
|
||||
+ }
|
||||
+ public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; }
|
||||
+ // Purpur end - API for any mob to burn daylight
|
||||
+
|
||||
@Override
|
||||
public boolean isFlapping() {
|
||||
return (this.getUniqueFlapTickOffset() + this.tickCount) % TICKS_PER_FLAP == 0;
|
||||
@@ -261,6 +272,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
|
||||
@Override
|
||||
public void aiStep() {
|
||||
+ // Purpur - implemented in LivingEntity; moved down to shouldBurnInDay() - API for any mob to burn daylight
|
||||
// Purpur start - Phantoms burn in light
|
||||
boolean burnFromDaylight = this.shouldBurnInDay && this.isSunBurnTick() && this.level().purpurConfig.phantomBurnInDaylight;
|
||||
boolean burnFromLightSource = this.level().purpurConfig.phantomBurnInLight > 0 && this.level().getMaxLocalRawBrightness(blockPosition()) >= this.level().purpurConfig.phantomBurnInLight;
|
||||
@@ -299,7 +311,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
if (compound.hasUUID("Paper.SpawningEntity")) {
|
||||
this.spawningEntity = compound.getUUID("Paper.SpawningEntity");
|
||||
}
|
||||
- if (compound.contains("Paper.ShouldBurnInDay")) {
|
||||
+ if (false && compound.contains("Paper.ShouldBurnInDay")) { // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
this.shouldBurnInDay = compound.getBoolean("Paper.ShouldBurnInDay");
|
||||
}
|
||||
// Paper end
|
||||
@@ -316,7 +328,7 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
if (this.spawningEntity != null) {
|
||||
compound.putUUID("Paper.SpawningEntity", this.spawningEntity);
|
||||
}
|
||||
- compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay);
|
||||
+ //compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
// Paper end
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java
|
||||
index bb8c37c8348172947efe14d48ed9ae203409affa..b1da45df27f02395d793e7eafe576f5f92aa3a7b 100644
|
||||
--- a/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -89,11 +89,12 @@ public class Zombie extends Monster {
|
||||
private boolean canBreakDoors;
|
||||
private int inWaterTime;
|
||||
public int conversionTime;
|
||||
- private boolean shouldBurnInDay = true; // Paper - Add more Zombie API
|
||||
+ //private boolean shouldBurnInDay = true; // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
|
||||
public Zombie(EntityType<? extends Zombie> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(level.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(entityType, level.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper - Configurable door breaking difficulty
|
||||
+ this.setShouldBurnInDay(true); // Purpur - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
public Zombie(Level level) {
|
||||
@@ -290,29 +291,7 @@ public class Zombie extends Monster {
|
||||
|
||||
@Override
|
||||
public void aiStep() {
|
||||
- if (this.isAlive()) {
|
||||
- boolean flag = this.isSunSensitive() && this.isSunBurnTick();
|
||||
- if (flag) {
|
||||
- ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD);
|
||||
- if (!itemBySlot.isEmpty()) {
|
||||
- if (itemBySlot.isDamageableItem()) {
|
||||
- Item item = itemBySlot.getItem();
|
||||
- itemBySlot.setDamageValue(itemBySlot.getDamageValue() + this.random.nextInt(2));
|
||||
- if (itemBySlot.getDamageValue() >= itemBySlot.getMaxDamage()) {
|
||||
- this.onEquippedItemBroken(item, EquipmentSlot.HEAD);
|
||||
- this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- flag = false;
|
||||
- }
|
||||
-
|
||||
- if (flag) {
|
||||
- this.igniteForSeconds(8.0F);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
+ // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
super.aiStep();
|
||||
}
|
||||
|
||||
@@ -371,6 +350,7 @@ public class Zombie extends Monster {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
+ public boolean shouldBurnInDay() { return this.isSunSensitive(); } // Purpur - for ABI compatibility - API for any mob to burn daylight
|
||||
public boolean isSunSensitive() {
|
||||
return this.shouldBurnInDay; // Paper - Add more Zombie API
|
||||
}
|
||||
@@ -509,7 +489,7 @@ public class Zombie extends Monster {
|
||||
compound.putBoolean("CanBreakDoors", this.canBreakDoors());
|
||||
compound.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
|
||||
compound.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
|
||||
- compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API
|
||||
+ //compound.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -522,7 +502,7 @@ public class Zombie extends Monster {
|
||||
this.startUnderWaterConversion(compound.getInt("DrownedConversionTime"));
|
||||
}
|
||||
// Paper start - Add more Zombie API
|
||||
- if (compound.contains("Paper.ShouldBurnInDay")) {
|
||||
+ if (false && compound.contains("Paper.ShouldBurnInDay")) { // Purpur - implemented in LivingEntity - API for any mob to burn daylight
|
||||
this.shouldBurnInDay = compound.getBoolean("Paper.ShouldBurnInDay");
|
||||
}
|
||||
// Paper end - Add more Zombie API
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,64 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Mon, 30 Aug 2021 22:49:53 -0500
|
||||
Subject: [PATCH] Cows naturally aggressive to players chance
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/animal/Cow.java b/net/minecraft/world/entity/animal/Cow.java
|
||||
index a8c76fcbbaa4afd2d0bd568874995b91d8d67c03..b62c4449047da36d8b4d4b87d03c77906d12dc31 100644
|
||||
--- a/net/minecraft/world/entity/animal/Cow.java
|
||||
+++ b/net/minecraft/world/entity/animal/Cow.java
|
||||
@@ -32,6 +32,8 @@ import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class Cow extends Animal {
|
||||
+ private boolean isNaturallyAggressiveToPlayers; // Purpur - Cows naturally aggressive to players chance
|
||||
+
|
||||
private static final EntityDimensions BABY_DIMENSIONS = EntityType.COW.getDimensions().scale(0.5F).withEyeHeight(0.665F);
|
||||
|
||||
public Cow(EntityType<? extends Cow> entityType, Level level) {
|
||||
@@ -60,6 +62,7 @@ public class Cow extends Animal {
|
||||
public void initAttributes() {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.cowMaxHealth);
|
||||
this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.cowScale);
|
||||
+ this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(this.level().purpurConfig.cowNaturallyAggressiveToPlayersDamage); // Purpur - Cows naturally aggressive to players chance
|
||||
}
|
||||
// Purpur end - Configurable entity base attributes
|
||||
|
||||
@@ -77,17 +80,27 @@ public class Cow extends Animal {
|
||||
}
|
||||
// Purpur end - Toggle for water sensitive mob damage
|
||||
|
||||
+ // Purpur start - Cows naturally aggressive to players chance
|
||||
+ @Override
|
||||
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnReason, net.minecraft.world.entity.SpawnGroupData entityData) {
|
||||
+ this.isNaturallyAggressiveToPlayers = world.getLevel().purpurConfig.cowNaturallyAggressiveToPlayersChance > 0.0D && random.nextDouble() <= world.getLevel().purpurConfig.cowNaturallyAggressiveToPlayersChance;
|
||||
+ return super.finalizeSpawn(world, difficulty, spawnReason, entityData);
|
||||
+ }
|
||||
+ // Purpur end - Cows naturally aggressive to players chance
|
||||
+
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
|
||||
this.goalSelector.addGoal(1, new PanicGoal(this, 2.0));
|
||||
+ this.goalSelector.addGoal(1, new net.minecraft.world.entity.ai.goal.MeleeAttackGoal(this, 1.2000000476837158D, true)); // Purpur - Cows naturally aggressive to players chance
|
||||
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0));
|
||||
this.goalSelector.addGoal(3, new TemptGoal(this, 1.25, itemStack -> level().purpurConfig.cowFeedMushrooms > 0 && (itemStack.is(net.minecraft.world.level.block.Blocks.RED_MUSHROOM.asItem()) || itemStack.is(net.minecraft.world.level.block.Blocks.BROWN_MUSHROOM.asItem())) || itemStack.is(ItemTags.COW_FOOD), false)); // Purpur - Cows eat mushrooms
|
||||
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25));
|
||||
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0));
|
||||
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
||||
this.goalSelector.addGoal(7, new RandomLookAroundGoal(this));
|
||||
+ this.targetSelector.addGoal(0, new net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, (ignored, ignored2) -> isNaturallyAggressiveToPlayers)); // Purpur - Cows naturally aggressive to players chance
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,7 +109,7 @@ public class Cow extends Animal {
|
||||
}
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
- return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.MOVEMENT_SPEED, 0.2F);
|
||||
+ return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 10.0).add(Attributes.MOVEMENT_SPEED, 0.2F).add(Attributes.ATTACK_DAMAGE, 0.0D); // Purpur - Cows naturally aggressive to players chance
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,41 +1,38 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Thu, 27 Feb 2020 21:42:19 -0600
|
||||
Subject: [PATCH] Configurable void damage height and damage
|
||||
From: granny <contact@granny.dev>
|
||||
Date: Mon, 8 Dec 2025 17:02:40 -0800
|
||||
Subject: [PATCH] Setting to reintroduce end void rings
|
||||
|
||||
temporarily migrate to paper's config
|
||||
drop patch on the next minecraft release
|
||||
|
||||
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
||||
index 9afbfe9bf493e09ca1963e8956ab7573964479b4..d04c06fafd133f773f311e7c2708fa8b049da67c 100644
|
||||
index cfd9596246713030f7c0f28a65abeed6dcc8d81b..952444a26fd13ae0b385b2b7f717d965b4c76d19 100644
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1222,6 +1222,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1315,6 +1315,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
// Purpur end - config for startup commands
|
||||
|
||||
+ // Purpur start - Configurable void damage height and damage
|
||||
+ if (org.purpurmc.purpur.configuration.transformation.VoidDamageHeightMigration.HAS_BEEN_REGISTERED) {
|
||||
+ // Purpur start - Migrate Setting to reintroduce end void rings
|
||||
+ if (org.purpurmc.purpur.configuration.transformation.FarEndTerrainGenerationMigration.HAS_BEEN_REGISTERED) {
|
||||
+ try {
|
||||
+ org.purpurmc.purpur.PurpurConfig.config.save((java.io.File) this.options.valueOf("purpur-settings"));
|
||||
+ } catch (IOException ex) {
|
||||
+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "Could not save " + this.options.valueOf("purpur-settings"), ex);
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Configurable void damage height and damage
|
||||
+
|
||||
+ // Purpur end - Migrate Setting to reintroduce end void rings
|
||||
|
||||
while (this.running) {
|
||||
long l;
|
||||
if (!this.isPaused() && this.tickRateManager.isSprinting() && this.tickRateManager.checkShouldSprintThisTick()) {
|
||||
final long tickStart = System.nanoTime(); // Paper - improve tick loop
|
||||
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 315b5be292b5cd81c526e9190ea43cd25afb89d4..4f90ebcd86fba38dec313143e36614e992c7dbc7 100644
|
||||
index 6a0ccd6eb3e355348c68db3de980f4eddea1aaea..829ea2888927a3bd8b1b1e1961cdcff55c1cf3ce 100644
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -209,6 +209,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -258,6 +258,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
org.spigotmc.SpigotConfig.registerCommands();
|
||||
// Spigot end
|
||||
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc.
|
||||
+ // Purpur start - Configurable void damage height and damage
|
||||
+ // Purpur start - Migrate Setting to reintroduce end void rings
|
||||
+ try {
|
||||
+ org.purpurmc.purpur.PurpurConfig.init((java.io.File) options.valueOf("purpur-settings"));
|
||||
+ } catch (Exception e) {
|
||||
@@ -43,7 +40,7 @@ index 315b5be292b5cd81c526e9190ea43cd25afb89d4..4f90ebcd86fba38dec313143e36614e9
|
||||
+ return false;
|
||||
+ }
|
||||
+ org.purpurmc.purpur.PurpurConfig.registerCommands();
|
||||
+ // Purpur end - Configurable void damage height and damage
|
||||
+ // Purpur end - Migrate Setting to reintroduce end void rings
|
||||
// Paper start - initialize global and world-defaults configuration
|
||||
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
|
||||
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] config for turning bundles into functional quivers
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
||||
index db5a2227009bc4d655fc781d5850221f36f2d112..c26846d3b92be4ed8ec40ce21128dfe912f19298 100644
|
||||
index 78e68335805270ff1f942fe28e0e833adb41fd85..bbc1a45b80d0ffc3d7567466716e8c8f86bdfac8 100644
|
||||
--- a/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -4456,6 +4456,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -4753,6 +4753,11 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
||||
}
|
||||
|
||||
public ItemStack getProjectile(ItemStack weaponStack) {
|
||||
@@ -21,10 +21,10 @@ index db5a2227009bc4d655fc781d5850221f36f2d112..c26846d3b92be4ed8ec40ce21128dfe9
|
||||
}
|
||||
|
||||
diff --git a/net/minecraft/world/entity/monster/Monster.java b/net/minecraft/world/entity/monster/Monster.java
|
||||
index c1ebb74b0d4a8e2eb8880ccaf20f0f9bc1940094..4d0916c0ec6c199f9ef359a17cda0891448d07f6 100644
|
||||
index 54033572e325f8486a438e31dde34f8407f9180a..0b947c3f9f45d5ff590e496bec4d43bd8b0c5c20 100644
|
||||
--- a/net/minecraft/world/entity/monster/Monster.java
|
||||
+++ b/net/minecraft/world/entity/monster/Monster.java
|
||||
@@ -144,6 +144,12 @@ public abstract class Monster extends PathfinderMob implements Enemy {
|
||||
@@ -148,6 +148,12 @@ public abstract class Monster extends PathfinderMob implements Enemy {
|
||||
|
||||
@Override
|
||||
public ItemStack getProjectile(ItemStack shootable) {
|
||||
@@ -38,10 +38,10 @@ index c1ebb74b0d4a8e2eb8880ccaf20f0f9bc1940094..4d0916c0ec6c199f9ef359a17cda0891
|
||||
Predicate<ItemStack> supportedHeldProjectiles = ((ProjectileWeaponItem)shootable.getItem()).getSupportedHeldProjectiles();
|
||||
ItemStack heldProjectile = ProjectileWeaponItem.getHeldProjectile(this, supportedHeldProjectiles);
|
||||
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
|
||||
index 43657822f0660613078e9afa512000b5255a1537..a5284118fa4c3c2fff52c8220615c9ca848d9af0 100644
|
||||
index 053d51070df51e901bdf8f0f33316e4f25ea9a2f..214b915712538f98811b4efde8bf360202a2ef49 100644
|
||||
--- a/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/net/minecraft/world/entity/player/Player.java
|
||||
@@ -2294,6 +2294,12 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -2089,6 +2089,12 @@ public abstract class Player extends Avatar implements ContainerUser {
|
||||
|
||||
@Override
|
||||
public ItemStack getProjectile(ItemStack shootable) {
|
||||
@@ -54,11 +54,10 @@ index 43657822f0660613078e9afa512000b5255a1537..a5284118fa4c3c2fff52c8220615c9ca
|
||||
if (!(shootable.getItem() instanceof ProjectileWeaponItem)) {
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
@@ -2306,6 +2312,39 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -2102,6 +2108,37 @@ public abstract class Player extends Avatar implements ContainerUser {
|
||||
|
||||
for (int i = 0; i < this.inventory.getContainerSize(); i++) {
|
||||
ItemStack item = this.inventory.getItem(i);
|
||||
+
|
||||
+ // Purpur start - config for turning bundles into functional quivers
|
||||
+ if ((this.level().purpurConfig.bowUseBundleAsQuiver || this.level().purpurConfig.crossbowUseBundleAsQuiver) && !this.abilities.instabuild && item.getItem() instanceof net.minecraft.world.item.BundleItem) {
|
||||
+ net.minecraft.world.item.component.BundleContents bundleContents = item.get(net.minecraft.core.component.DataComponents.BUNDLE_CONTENTS);
|
||||
@@ -90,12 +89,11 @@ index 43657822f0660613078e9afa512000b5255a1537..a5284118fa4c3c2fff52c8220615c9ca
|
||||
+ return itemStack;
|
||||
+ }
|
||||
+ // Purpur end - config for turning bundles into functional quivers
|
||||
+
|
||||
if (supportedHeldProjectiles.test(item)) {
|
||||
return item;
|
||||
}
|
||||
diff --git a/net/minecraft/world/item/BowItem.java b/net/minecraft/world/item/BowItem.java
|
||||
index b3e003694ce0da357e91ab3ce2b1380f9ab0a32a..186bd391ed3738734ca2d8e82339af0158ae4875 100644
|
||||
index 0a14a098f3aa40c8195c3a3bdf61ad6ae0fcc9d2..06cd5f1664d2f02fe36a16e675dfbb7ebf66751c 100644
|
||||
--- a/net/minecraft/world/item/BowItem.java
|
||||
+++ b/net/minecraft/world/item/BowItem.java
|
||||
@@ -27,7 +27,7 @@ public class BowItem extends ProjectileWeaponItem {
|
||||
@@ -108,10 +106,10 @@ index b3e003694ce0da357e91ab3ce2b1380f9ab0a32a..186bd391ed3738734ca2d8e82339af01
|
||||
if (level.purpurConfig.infinityWorksWithoutArrows && projectile.isEmpty() && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY, stack) > 0) {
|
||||
projectile = new ItemStack(Items.ARROW);
|
||||
diff --git a/net/minecraft/world/item/BundleItem.java b/net/minecraft/world/item/BundleItem.java
|
||||
index 966029b761bcb31113b167831fe7f4f2dea4b17d..eda25cc71b4804d805b1a7f875f823b20efc754b 100644
|
||||
index 79f3955cbf3a19b013d86180d8dda576ab4c25cd..8eae89acdfdc15a3a2ebfa72ea5a2c4282fdf770 100644
|
||||
--- a/net/minecraft/world/item/BundleItem.java
|
||||
+++ b/net/minecraft/world/item/BundleItem.java
|
||||
@@ -131,7 +131,7 @@ public class BundleItem extends Item {
|
||||
@@ -132,7 +132,7 @@ public class BundleItem extends Item {
|
||||
}
|
||||
|
||||
private void dropContent(Level level, Player player, ItemStack stack) {
|
||||
@@ -121,10 +119,10 @@ index 966029b761bcb31113b167831fe7f4f2dea4b17d..eda25cc71b4804d805b1a7f875f823b2
|
||||
player.awardStat(Stats.ITEM_USED.get(this));
|
||||
}
|
||||
diff --git a/net/minecraft/world/item/CrossbowItem.java b/net/minecraft/world/item/CrossbowItem.java
|
||||
index 1131e984fd30e40c1b99054b5db9462ffe55b5f1..c9dbe63316cad0437f50fa3f7ffe345ec1906752 100644
|
||||
index a29ff7584371d35d9b0fff71681f672b76dea07c..d1d450fa22f5deb766b39f2c34d4cf7cda944644 100644
|
||||
--- a/net/minecraft/world/item/CrossbowItem.java
|
||||
+++ b/net/minecraft/world/item/CrossbowItem.java
|
||||
@@ -72,7 +72,7 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
||||
@@ -68,7 +68,7 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
||||
if (chargedProjectiles != null && !chargedProjectiles.isEmpty()) {
|
||||
this.performShooting(level, player, hand, itemInHand, getShootingPower(chargedProjectiles), (float) level.purpurConfig.crossbowProjectileOffset, null); // Purpur - Projectile offset config
|
||||
return InteractionResult.CONSUME;
|
||||
@@ -133,9 +131,9 @@ index 1131e984fd30e40c1b99054b5db9462ffe55b5f1..c9dbe63316cad0437f50fa3f7ffe345e
|
||||
this.startSoundPlayed = false;
|
||||
this.midLoadSoundPlayed = false;
|
||||
player.startUsingItem(hand);
|
||||
@@ -124,7 +124,7 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
||||
return CrossbowItem.tryLoadProjectiles(shooter, crossbowStack, true);
|
||||
@@ -95,7 +95,7 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
||||
}
|
||||
|
||||
private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbowStack, boolean consume) {
|
||||
- List<ItemStack> list = draw(crossbowStack, shooter.getProjectile(crossbowStack), shooter, consume);
|
||||
+ List<ItemStack> list = draw(crossbowStack, shooter.getProjectile(crossbowStack, true), shooter, consume); // Purpur - config for turning bundles into functional quivers
|
||||
@@ -143,10 +141,10 @@ index 1131e984fd30e40c1b99054b5db9462ffe55b5f1..c9dbe63316cad0437f50fa3f7ffe345e
|
||||
if (!list.isEmpty()) {
|
||||
crossbowStack.set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.of(list));
|
||||
diff --git a/net/minecraft/world/item/component/BundleContents.java b/net/minecraft/world/item/component/BundleContents.java
|
||||
index fca2dd0fb9ff4ff795a01de722fbb31dc02682fa..6fb9becef49bd4161c7829d240dd9e786f2226b5 100644
|
||||
index e513f95105b0663bd6155e69ac814bc8dbba5b76..2bf687e86ae6d0117f7c72e535f6841eaeefd2ea 100644
|
||||
--- a/net/minecraft/world/item/component/BundleContents.java
|
||||
+++ b/net/minecraft/world/item/component/BundleContents.java
|
||||
@@ -163,7 +163,12 @@ public final class BundleContents implements TooltipComponent {
|
||||
@@ -164,7 +164,12 @@ public final class BundleContents implements TooltipComponent {
|
||||
}
|
||||
|
||||
private int findStackIndex(ItemStack stack) {
|
||||
@@ -160,20 +158,19 @@ index fca2dd0fb9ff4ff795a01de722fbb31dc02682fa..6fb9becef49bd4161c7829d240dd9e78
|
||||
return -1;
|
||||
} else {
|
||||
for (int i = 0; i < this.items.size(); i++) {
|
||||
@@ -223,11 +228,20 @@ public final class BundleContents implements TooltipComponent {
|
||||
@@ -227,11 +232,19 @@ public final class BundleContents implements TooltipComponent {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack removeOne() {
|
||||
+ // Purpur start - config for turning bundles into functional quivers
|
||||
public @Nullable ItemStack removeOne() {
|
||||
+ // Purpur start - config for turning bundles into functional quivers
|
||||
+ return this.removeOne(null);
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ public ItemStack removeOne(ItemStack itemStack2) {
|
||||
+ // Purpur end - config for turning bundles into functional quivers
|
||||
+ public @Nullable ItemStack removeOne(ItemStack itemStack2) {
|
||||
+ // Purpur end - config for turning bundles into functional quivers
|
||||
if (this.items.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
int i = this.selectedItem != -1 && this.selectedItem < this.items.size() ? this.selectedItem : 0;
|
||||
int i = this.indexIsOutsideAllowedBounds(this.selectedItem) ? 0 : this.selectedItem;
|
||||
- ItemStack itemStack = this.items.remove(i).copy();
|
||||
+ // Purpur start - config for turning bundles into functional quivers
|
||||
+ int stackIndex = itemStack2 != null ? this.findStackIndex(itemStack2, true) : -1;
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/io/papermc/paper/entity/activation/ActivationRange.java
|
||||
+++ b/io/papermc/paper/entity/activation/ActivationRange.java
|
||||
@@ -141,6 +_,8 @@
|
||||
@@ -147,6 +_,8 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
final int worldHeight = world.getHeight();
|
||||
ActivationRange.maxBB = player.getBoundingBox().inflate(maxRange, worldHeight, maxRange);
|
||||
ActivationType.MISC.boundingBox = player.getBoundingBox().inflate(miscActivationRange, worldHeight, miscActivationRange);
|
||||
@@ -282,6 +_,7 @@
|
||||
@@ -288,6 +_,7 @@
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkIfActive(final Entity entity) {
|
||||
+ if (entity.level().purpurConfig.squidImmuneToEAR && entity instanceof net.minecraft.world.entity.animal.Squid) return true; // Purpur - Squid EAR immunity
|
||||
+ if (entity.level().purpurConfig.squidImmuneToEAR && entity instanceof net.minecraft.world.entity.animal.squid.Squid) return true; // Purpur - Squid EAR immunity
|
||||
// Never safe to skip fireworks or item gravity
|
||||
if (entity instanceof FireworkRocketEntity || (entity instanceof ItemEntity && (entity.tickCount + entity.getId()) % 4 == 0)) { // Needed for item gravity, see ItemEntity tick
|
||||
return true;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
+ return this.getFriendlyReport(type, extraInfo); // Purpur - Rebrand
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -161,7 +_,7 @@
|
||||
public @Nullable Path getSaveFile() {
|
||||
@@ -160,7 +_,7 @@
|
||||
}
|
||||
|
||||
public boolean saveToFile(Path path, ReportType type) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--- a/net/minecraft/commands/CommandSourceStack.java
|
||||
+++ b/net/minecraft/commands/CommandSourceStack.java
|
||||
@@ -455,6 +_,19 @@
|
||||
@@ -430,6 +_,19 @@
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Purpur start - Gamemode extra permissions
|
||||
+ public boolean testPermission(int i, String bukkitPermission) {
|
||||
+ if (hasPermission(i, bukkitPermission)) {
|
||||
+ public boolean testPermission(net.minecraft.server.permissions.Permission permission, String bukkitPermission) {
|
||||
+ if (hasPermission(permission, bukkitPermission)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ net.kyori.adventure.text.Component permissionMessage = getLevel().getServer().server.permissionMessage();
|
||||
@@ -20,7 +20,7 @@
|
||||
public Vec3 getPosition() {
|
||||
return this.worldPosition;
|
||||
}
|
||||
@@ -540,6 +_,30 @@
|
||||
@@ -512,6 +_,30 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,11 +37,11 @@
|
||||
+ sendSuccess(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(message), broadcastToOps);
|
||||
+ }
|
||||
+
|
||||
+ public void sendSuccess(@Nullable net.kyori.adventure.text.Component message) {
|
||||
+ public void sendSuccess(net.kyori.adventure.text.@Nullable Component message) {
|
||||
+ sendSuccess(message, false);
|
||||
+ }
|
||||
+
|
||||
+ public void sendSuccess(@Nullable net.kyori.adventure.text.Component message, boolean broadcastToOps) {
|
||||
+ public void sendSuccess(net.kyori.adventure.text.@Nullable Component message, boolean broadcastToOps) {
|
||||
+ if (message == null) {
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
--- a/net/minecraft/commands/Commands.java
|
||||
+++ b/net/minecraft/commands/Commands.java
|
||||
@@ -216,8 +_,8 @@
|
||||
@@ -265,11 +_,11 @@
|
||||
JfrCommand.register(this.dispatcher);
|
||||
}
|
||||
|
||||
- if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
- TestCommand.register(this.dispatcher);
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands || SharedConstants.IS_RUNNING_IN_IDE) { // Purpur - register minecraft debug commands
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands) TestCommand.register(this.dispatcher); // Purpur - register minecraft debug commands
|
||||
- if (SharedConstants.DEBUG_CHASE_COMMAND) {
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.registerMinecraftDisabledCommands || SharedConstants.DEBUG_CHASE_COMMAND) { // Purpur - register disabled minecraft commands
|
||||
ChaseCommand.register(this.dispatcher);
|
||||
}
|
||||
|
||||
- if (SharedConstants.DEBUG_DEV_COMMANDS || SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands || SharedConstants.DEBUG_DEV_COMMANDS || SharedConstants.IS_RUNNING_IN_IDE) { // Purpur - register minecraft debug commands
|
||||
RaidCommand.register(this.dispatcher, context);
|
||||
DebugPathCommand.register(this.dispatcher);
|
||||
DebugMobSpawningCommand.register(this.dispatcher);
|
||||
@@ -245,6 +_,14 @@
|
||||
@@ -297,6 +_,14 @@
|
||||
StopCommand.register(this.dispatcher);
|
||||
TransferCommand.register(this.dispatcher);
|
||||
WhitelistCommand.register(this.dispatcher);
|
||||
@@ -26,19 +29,20 @@
|
||||
}
|
||||
|
||||
if (selection.includeIntegrated) {
|
||||
@@ -488,6 +_,7 @@
|
||||
private void runSync(ServerPlayer player, java.util.Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootCommandNode) {
|
||||
@@ -522,6 +_,7 @@
|
||||
private void runSync(ServerPlayer player, java.util.Collection<String> bukkit, RootCommandNode<CommandSourceStack> rootCommandNode) {
|
||||
// Paper end - Perf: Async command map building
|
||||
new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootCommandNode, true).callEvent(); // Paper - Brigadier API
|
||||
+ if (org.bukkit.event.player.PlayerCommandSendEvent.getHandlerList().getRegisteredListeners().length > 0) { // Purpur - Skip events if there's no listeners
|
||||
org.bukkit.event.player.PlayerCommandSendEvent event = new org.bukkit.event.player.PlayerCommandSendEvent(player.getBukkitEntity(), new java.util.LinkedHashSet<>(bukkit));
|
||||
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@@ -498,6 +_,7 @@
|
||||
@@ -532,6 +_,8 @@
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ } // Purpur - Skip events if there's no listeners
|
||||
|
||||
player.connection.send(new ClientboundCommandsPacket(rootCommandNode));
|
||||
+
|
||||
player.connection.send(new ClientboundCommandsPacket(rootCommandNode, COMMAND_NODE_INSPECTOR));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
@@ -192,26 +_,27 @@
|
||||
@@ -190,26 +_,27 @@
|
||||
this.checkPermissions(source);
|
||||
if (this.playerName != null) {
|
||||
ServerPlayer playerByName = source.getServer().getPlayerList().getPlayerByName(this.playerName);
|
||||
@@ -32,7 +32,7 @@
|
||||
players.add(serverPlayer1);
|
||||
if (players.size() >= resultLimit) {
|
||||
return players;
|
||||
@@ -270,4 +_,10 @@
|
||||
@@ -267,4 +_,10 @@
|
||||
public static Component joinNames(List<? extends Entity> names) {
|
||||
return ComponentUtils.formatList(names, Entity::getDisplayName);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/core/BlockPos.java
|
||||
+++ b/net/minecraft/core/BlockPos.java
|
||||
@@ -63,6 +_,12 @@
|
||||
@@ -61,6 +_,12 @@
|
||||
public static final int MAX_HORIZONTAL_COORDINATE = 33554431;
|
||||
// Paper end - Optimize Bit Operations by inlining
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -892,5 +_,22 @@
|
||||
@@ -750,5 +_,22 @@
|
||||
DispenserBlock.registerBehavior(Items.TNT_MINECART, new MinecartDispenseItemBehavior(EntityType.TNT_MINECART));
|
||||
DispenserBlock.registerBehavior(Items.HOPPER_MINECART, new MinecartDispenseItemBehavior(EntityType.HOPPER_MINECART));
|
||||
DispenserBlock.registerBehavior(Items.COMMAND_BLOCK_MINECART, new MinecartDispenseItemBehavior(EntityType.COMMAND_BLOCK_MINECART));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java
|
||||
@@ -31,7 +_,7 @@
|
||||
@@ -32,7 +_,7 @@
|
||||
return false;
|
||||
} else {
|
||||
LivingEntity livingEntity = entitiesOfClass.getFirst();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/gametest/framework/GameTestHelper.java
|
||||
+++ b/net/minecraft/gametest/framework/GameTestHelper.java
|
||||
@@ -279,6 +_,8 @@
|
||||
return gameType.isCreative();
|
||||
@@ -322,6 +_,8 @@
|
||||
return gameType;
|
||||
}
|
||||
|
||||
+ public void setAfk(final boolean afk) {} // Purpur - AFK API
|
||||
+
|
||||
@Override
|
||||
public boolean isLocalPlayer() {
|
||||
return true;
|
||||
public boolean isClientAuthoritative() {
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/gametest/framework/TestCommand.java
|
||||
+++ b/net/minecraft/gametest/framework/TestCommand.java
|
||||
@@ -443,7 +_,7 @@
|
||||
)
|
||||
)
|
||||
);
|
||||
- if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands || SharedConstants.IS_RUNNING_IN_IDE) { // Purpur - register minecraft debug commands
|
||||
literalArgumentBuilder = literalArgumentBuilder.then(
|
||||
Commands.literal("export")
|
||||
.then(
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/network/Connection.java
|
||||
+++ b/net/minecraft/network/Connection.java
|
||||
@@ -588,11 +_,20 @@
|
||||
@@ -554,11 +_,20 @@
|
||||
private static final int MAX_PER_TICK = io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick; // Paper - Buffer joins to world
|
||||
private static int joinAttemptsThisTick; // Paper - Buffer joins to world
|
||||
private static int currTick; // Paper - Buffer joins to world
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/network/chat/SignedMessageChain.java
|
||||
+++ b/net/minecraft/network/chat/SignedMessageChain.java
|
||||
@@ -45,7 +_,7 @@
|
||||
@@ -44,7 +_,7 @@
|
||||
SignedMessageLink signedMessageLink = SignedMessageChain.this.nextLink;
|
||||
if (signedMessageLink == null) {
|
||||
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.CHAIN_BROKEN);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -108,6 +_,12 @@
|
||||
@@ -105,6 +_,13 @@
|
||||
JvmProfiler.INSTANCE.start(Environment.SERVER);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
+ org.bukkit.configuration.file.YamlConfiguration purpurConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionSet.valueOf("purpur-settings"));
|
||||
+ org.purpurmc.purpur.PurpurConfig.clampEnchantLevels = purpurConfiguration.getBoolean("settings.enchantment.clamp-levels", true);
|
||||
+ org.purpurmc.purpur.PurpurConfig.registerMinecraftDebugCommands = purpurConfiguration.getBoolean("settings.register-minecraft-debug-commands"); // Purpur - register minecraft debug commands
|
||||
+ org.purpurmc.purpur.PurpurConfig.registerMinecraftDisabledCommands = purpurConfiguration.getBoolean("settings.register-minecraft-disabled-commands"); // Purpur - register disabled minecraft commands
|
||||
+ // Purpur end - Add toggle for enchant level clamping - load config files early
|
||||
+
|
||||
io.papermc.paper.plugin.PluginInitializerManager.load(optionSet); // Paper
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -284,6 +_,7 @@
|
||||
@@ -290,6 +_,7 @@
|
||||
public joptsimple.OptionSet options;
|
||||
public org.bukkit.command.ConsoleCommandSender console;
|
||||
public static int currentTick; // Paper - improve tick loop
|
||||
@@ -8,26 +8,24 @@
|
||||
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
|
||||
public int autosavePeriod;
|
||||
// Paper - don't store the vanilla dispatcher
|
||||
@@ -294,7 +_,7 @@
|
||||
public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS;
|
||||
private static final int SAMPLE_INTERVAL = 20; // Paper - improve server tick loop
|
||||
@Deprecated(forRemoval = true) // Paper
|
||||
- public final double[] recentTps = new double[3];
|
||||
+ public final double[] recentTps = new double[4]; // Purpur - Add 5 second tps average in /tps
|
||||
// Spigot end
|
||||
public volatile boolean hasFullyShutdown; // Paper - Improved watchdog support
|
||||
public volatile boolean abnormalExit; // Paper - Improved watchdog support
|
||||
@@ -302,7 +_,9 @@
|
||||
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
|
||||
@@ -306,6 +_,8 @@
|
||||
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
|
||||
+ public boolean lagging = false; // Purpur - Lagging threshold
|
||||
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
|
||||
+ public boolean lagging = false; // Purpur - Lagging threshold
|
||||
+ protected boolean upnp = false; // Purpur - UPnP Port Forwarding
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> threadFunction) {
|
||||
ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system
|
||||
@@ -1001,6 +_,15 @@
|
||||
// Paper start - improve tick loop
|
||||
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes1s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(1L));
|
||||
public final ca.spottedleaf.moonrise.common.time.TickData tickTimes5s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(5L));
|
||||
@@ -375,6 +_,7 @@
|
||||
public double[] computeTPS() {
|
||||
final long interval = this.tickRateManager().nanosecondsPerTick();
|
||||
return new double[] {
|
||||
+ getTPS(this.tickTimes5s, interval), // Purpur - Add 5 second tps average in /tps
|
||||
getTPS(this.tickTimes1m, interval),
|
||||
getTPS(this.tickTimes5m, interval),
|
||||
getTPS(this.tickTimes15m, interval)
|
||||
@@ -1016,6 +_,15 @@
|
||||
|
||||
LOGGER.info("Stopping server");
|
||||
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
||||
@@ -43,24 +41,16 @@
|
||||
// CraftBukkit start
|
||||
if (this.server != null) {
|
||||
this.server.spark.disable(); // Paper - spark
|
||||
@@ -1093,6 +_,8 @@
|
||||
this.safeShutdown(waitForServer, false);
|
||||
@@ -1114,6 +_,8 @@
|
||||
this.safeShutdown(waitForShutdown, false);
|
||||
}
|
||||
public void safeShutdown(boolean waitForServer, boolean isRestarting) {
|
||||
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
|
||||
+ org.purpurmc.purpur.task.BossBarTask.stopAll(); // Purpur - Implement TPSBar
|
||||
+ org.purpurmc.purpur.task.BeehiveTask.instance().unregister(); // Purpur - Give bee counts in beehives to Purpur clients
|
||||
this.isRestarting = isRestarting;
|
||||
this.hasLoggedStop = true; // Paper - Debugging
|
||||
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
|
||||
@@ -1112,6 +_,7 @@
|
||||
private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L;
|
||||
private long lastTick = 0;
|
||||
private long catchupTime = 0;
|
||||
+ public final RollingAverage tps5s = new RollingAverage(5); // Purpur - Add 5 second tps average in /tps
|
||||
public final RollingAverage tps1 = new RollingAverage(60);
|
||||
public final RollingAverage tps5 = new RollingAverage(60 * 5);
|
||||
public final RollingAverage tps15 = new RollingAverage(60 * 15);
|
||||
@@ -1197,6 +_,16 @@
|
||||
@@ -1291,6 +_,16 @@
|
||||
}
|
||||
// Paper end - Add onboarding message for initial server start
|
||||
|
||||
@@ -75,45 +65,21 @@
|
||||
+ // Purpur end - config for startup commands
|
||||
+
|
||||
while (this.running) {
|
||||
long l;
|
||||
if (!this.isPaused() && this.tickRateManager.isSprinting() && this.tickRateManager.checkShouldSprintThisTick()) {
|
||||
@@ -1221,14 +_,19 @@
|
||||
if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) {
|
||||
final long diff = currentTime - tickSection;
|
||||
final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
|
||||
+ tps5s.add(currentTps, diff); // Purpur - Add 5 second tps average in /tps
|
||||
tps1.add(currentTps, diff);
|
||||
tps5.add(currentTps, diff);
|
||||
tps15.add(currentTps, diff);
|
||||
final long tickStart = System.nanoTime(); // Paper - improve tick loop
|
||||
long l; // Paper - improve tick loop - diff on change, expect this to be tick interval
|
||||
@@ -1304,8 +_,10 @@
|
||||
final long ticksBehind = Math.max(1L, this.tickSchedule.getPeriodsAhead(l, tickStart));
|
||||
final long catchup = (long)Math.max(
|
||||
1,
|
||||
- 5 //ConfigHolder.getConfig().tickLoop.catchupTicks.getOrDefault(MoonriseConfig.TickLoop.DEFAULT_CATCHUP_TICKS).intValue()
|
||||
+ org.purpurmc.purpur.PurpurConfig.tpsCatchup ? 5 : 1 //ConfigHolder.getConfig().tickLoop.catchupTicks.getOrDefault(MoonriseConfig.TickLoop.DEFAULT_CATCHUP_TICKS).intValue() // Purpur - Configurable TPS Catchup
|
||||
);
|
||||
+
|
||||
+ lagging = getTPS()[0] < org.purpurmc.purpur.PurpurConfig.laggingThreshold; // Purpur - Lagging threshold
|
||||
|
||||
// Backwards compat with bad plugins
|
||||
- this.recentTps[0] = tps1.getAverage();
|
||||
- this.recentTps[1] = tps5.getAverage();
|
||||
- this.recentTps[2] = tps15.getAverage();
|
||||
+ // Purpur start - Add 5 second tps average in /tps
|
||||
+ this.recentTps[0] = tps5s.getAverage();
|
||||
+ this.recentTps[1] = tps1.getAverage();
|
||||
+ this.recentTps[2] = tps5.getAverage();
|
||||
+ this.recentTps[3] = tps15.getAverage();
|
||||
+ // Purpur end - Add 5 second tps average in /tps
|
||||
+ lagging = recentTps[0] < org.purpurmc.purpur.PurpurConfig.laggingThreshold; // Purpur - Lagging threshold
|
||||
tickSection = currentTime;
|
||||
}
|
||||
// Paper end - further improve server tick loop
|
||||
@@ -1260,6 +_,12 @@
|
||||
profilerFiller.popPush("nextTickWait");
|
||||
this.mayHaveDelayedTasks = true;
|
||||
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
|
||||
+ // Purpur start - Configurable TPS Catchup
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.tpsCatchup /*|| !gg.pufferfish.pufferfish.PufferfishConfig.tpsCatchup*/) { // Purpur - Configurable TPS Catchup
|
||||
+ this.nextTickTimeNanos = currentTime + l;
|
||||
+ this.delayedTasksMaxNextTickTimeNanos = nextTickTimeNanos;
|
||||
+ }
|
||||
+ // Purpur end - Configurable TPS Catchup
|
||||
this.startMeasuringTaskExecutionTime();
|
||||
this.waitUntilNextTick();
|
||||
this.finishMeasuringTaskExecutionTime();
|
||||
@@ -1690,7 +_,7 @@
|
||||
// adjust ticksBehind so that it is not greater-than catchup
|
||||
if (ticksBehind > catchup) {
|
||||
@@ -1787,7 +_,7 @@
|
||||
long worldTime = level.getGameTime();
|
||||
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
|
||||
for (Player entityhuman : level.players()) {
|
||||
@@ -122,7 +88,7 @@
|
||||
continue;
|
||||
}
|
||||
ServerPlayer entityplayer = (ServerPlayer) entityhuman;
|
||||
@@ -1855,7 +_,7 @@
|
||||
@@ -1954,7 +_,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
--- a/net/minecraft/server/PlayerAdvancements.java
|
||||
+++ b/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -148,6 +_,7 @@
|
||||
@@ -146,6 +_,7 @@
|
||||
AdvancementHolder advancementHolder = advancementManager.get(path);
|
||||
if (advancementHolder == null) {
|
||||
if (!path.getNamespace().equals(ResourceLocation.DEFAULT_NAMESPACE)) return; // CraftBukkit
|
||||
if (!path.getNamespace().equals(Identifier.DEFAULT_NAMESPACE)) return; // CraftBukkit
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.loggerSuppressIgnoredAdvancementWarnings) // Purpur - Logger settings (suppressing pointless logs)
|
||||
LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", path, this.playerSavePath);
|
||||
} else {
|
||||
this.startProgress(advancementHolder, progress);
|
||||
@@ -195,6 +_,7 @@
|
||||
@@ -193,6 +_,7 @@
|
||||
advancement.value().display().ifPresent(displayInfo -> {
|
||||
// Paper start - Add Adventure message to PlayerAdvancementDoneEvent
|
||||
if (event.message() != null && this.player.serverLevel().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
|
||||
if (event.message() != null && this.player.level().getGameRules().get(GameRules.SHOW_ADVANCEMENT_MESSAGES)) {
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.advancementOnlyBroadcastToAffectedPlayer) this.player.sendMessage(message); else // Purpur - Configurable broadcast settings
|
||||
this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false);
|
||||
// Paper end
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
throw ERROR_LEVEL_TOO_HIGH.create(level, enchantment1.getMaxLevel());
|
||||
} else {
|
||||
int i = 0;
|
||||
@@ -81,7 +_,7 @@
|
||||
@@ -80,7 +_,7 @@
|
||||
ItemStack mainHandItem = livingEntity.getMainHandItem();
|
||||
if (!mainHandItem.isEmpty()) {
|
||||
if (enchantment1.canEnchant(mainHandItem)
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
--- a/net/minecraft/server/commands/GameModeCommand.java
|
||||
+++ b/net/minecraft/server/commands/GameModeCommand.java
|
||||
@@ -51,6 +_,18 @@
|
||||
@@ -53,6 +_,18 @@
|
||||
}
|
||||
|
||||
private static int setMode(CommandContext<CommandSourceStack> source, Collection<ServerPlayer> players, GameType gameType) {
|
||||
private static int setMode(CommandContext<CommandSourceStack> context, Collection<ServerPlayer> players, GameType gameType) {
|
||||
+ // Purpur start - Gamemode extra permissions
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.commandGamemodeRequiresPermission) {
|
||||
+ String gamemode = gameType.getName();
|
||||
+ CommandSourceStack sender = source.getSource();
|
||||
+ if (!sender.testPermission(2, "minecraft.command.gamemode." + gamemode)) {
|
||||
+ CommandSourceStack sender = context.getSource();
|
||||
+ if (!sender.testPermission(Permissions.COMMANDS_GAMEMASTER, "minecraft.command.gamemode." + gamemode)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (sender.getEntity() instanceof ServerPlayer player && (players.size() > 1 || !players.contains(player)) && !sender.testPermission(2, "minecraft.command.gamemode." + gamemode + ".other")) {
|
||||
+ if (sender.getEntity() instanceof ServerPlayer player && (players.size() > 1 || !players.contains(player)) && !sender.testPermission(Permissions.COMMANDS_GAMEMASTER, "minecraft.command.gamemode." + gamemode + ".other")) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/server/commands/GiveCommand.java
|
||||
+++ b/net/minecraft/server/commands/GiveCommand.java
|
||||
@@ -66,6 +_,7 @@
|
||||
@@ -68,6 +_,7 @@
|
||||
i1 -= min;
|
||||
ItemStack itemStack1 = item.createItemStack(min, false);
|
||||
boolean flag = serverPlayer.getInventory().add(itemStack1);
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.disableGiveCommandDrops) continue; // Purpur - add config option for toggling give command dropping
|
||||
if (flag && itemStack1.isEmpty()) {
|
||||
ItemEntity itemEntity = serverPlayer.drop(itemStack, false, false, false); // CraftBukkit - SPIGOT-2942: Add boolean to call event
|
||||
ItemEntity itemEntity = serverPlayer.drop(itemStack, false, false, false, null); // Paper - do not fire PlayerDropItemEvent for /give command
|
||||
if (itemEntity != null) {
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -106,6 +_,7 @@
|
||||
// CraftBukkit start
|
||||
if (!org.bukkit.craftbukkit.Main.useConsole) return;
|
||||
@@ -195,6 +_,7 @@
|
||||
public void run() {
|
||||
if (!org.bukkit.craftbukkit.Main.useConsole) return; // CraftBukkit
|
||||
// Paper start - Use TerminalConsoleAppender
|
||||
+ if (DedicatedServer.this.gui == null || System.console() != null) // Purpur - GUI Improvements - has no GUI or has console (did not double-click)
|
||||
new com.destroystokyo.paper.console.PaperConsole(DedicatedServer.this).start();
|
||||
/*
|
||||
jline.console.ConsoleReader bufferedreader = DedicatedServer.this.reader;
|
||||
@@ -224,6 +_,15 @@
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
|
||||
@@ -273,6 +_,15 @@
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
|
||||
this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
|
||||
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
|
||||
+ /*// Purpur start - Purpur config files // Purpur - Configurable void damage height and damage
|
||||
+ // Purpur start - Purpur config files
|
||||
+ try {
|
||||
+ org.purpurmc.purpur.PurpurConfig.init((java.io.File) options.valueOf("purpur-settings"));
|
||||
+ } catch (Exception e) {
|
||||
@@ -20,12 +20,12 @@
|
||||
+ return false;
|
||||
+ }
|
||||
+ org.purpurmc.purpur.PurpurConfig.registerCommands();
|
||||
+ */// Purpur end - Purpur config files // Purpur - Configurable void damage height and damage
|
||||
+ // Purpur end - Purpur config files
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
||||
|
||||
this.setPvpAllowed(properties.pvp);
|
||||
@@ -271,6 +_,30 @@
|
||||
if (true) throw new IllegalStateException("Failed to bind to port", var10); // Paper - Propagate failed to bind to port error
|
||||
// this.worldData.setGameType(properties.gameMode.get()); // CraftBukkit - moved to world loading
|
||||
@@ -315,6 +_,30 @@
|
||||
if (true) throw new IllegalStateException("Failed to bind to port", var11); // Paper - Propagate failed to bind to port error
|
||||
return false;
|
||||
}
|
||||
+ // Purpur start - UPnP Port Forwarding
|
||||
@@ -54,13 +54,14 @@
|
||||
+ // Purpur end - UPnP Port Forwarding
|
||||
|
||||
// CraftBukkit start
|
||||
// this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage)); // Spigot - moved up
|
||||
@@ -350,6 +_,8 @@
|
||||
this.server.loadPlugins();
|
||||
@@ -389,6 +_,9 @@
|
||||
MinecraftServerStatistics.registerJmxMonitoring(this);
|
||||
LOGGER.info("JMX monitoring enabled");
|
||||
}
|
||||
|
||||
+
|
||||
+ org.purpurmc.purpur.task.BossBarTask.startAll(); // Purpur - Implement TPSBar
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.beeCountPayload) org.purpurmc.purpur.task.BeehiveTask.instance().register(); // Purpur - Give bee counts in beehives to Purpur clients
|
||||
|
||||
this.notificationManager().serverStarted();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -49,6 +_,7 @@
|
||||
@@ -57,6 +_,7 @@
|
||||
public final boolean onlineMode = this.get("online-mode", true);
|
||||
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
|
||||
public final String serverIp = this.get("server-ip", "");
|
||||
+ public final String serverName = this.get("server-name", "Unknown Server"); // Purpur - Bring back server name
|
||||
public final boolean pvp = this.get("pvp", true);
|
||||
public final boolean allowFlight = this.get("allow-flight", false);
|
||||
public final String motd = this.get("motd", "A Minecraft Server");
|
||||
public final Settings<DedicatedServerProperties>.MutableValue<Boolean> allowFlight = this.getMutable("allow-flight", false);
|
||||
public final Settings<DedicatedServerProperties>.MutableValue<String> motd = this.getMutable("motd", "A Minecraft Server");
|
||||
public final boolean codeOfConduct = this.get("enable-code-of-conduct", false);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/gui/StatsComponent.java
|
||||
+++ b/net/minecraft/server/gui/StatsComponent.java
|
||||
@@ -43,7 +_,7 @@
|
||||
@@ -41,7 +_,7 @@
|
||||
}
|
||||
this.msgs[0] = "Memory use: " + l / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
|
||||
this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms";
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -207,6 +_,8 @@
|
||||
@@ -218,6 +_,8 @@
|
||||
private final StructureManager structureManager;
|
||||
private final StructureCheck structureCheck;
|
||||
private final boolean tickTime;
|
||||
+ private double preciseTime; // Purpur - Configurable daylight cycle
|
||||
+ private boolean forceTime; // Purpur - Configurable daylight cycle
|
||||
private final RandomSequences randomSequences;
|
||||
final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this);
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -595,7 +_,24 @@
|
||||
@@ -622,8 +_,25 @@
|
||||
// CraftBukkit end
|
||||
this.tickTime = tickTime;
|
||||
this.server = server;
|
||||
- this.customSpawners = customSpawners;
|
||||
+ this.customSpawners = new ArrayList<>(); // Purpur - Allow toggling special MobSpawners per world
|
||||
this.serverLevelData = serverLevelData;
|
||||
+ // Purpur start - Allow toggling special MobSpawners per world
|
||||
+ this.customSpawners = new ArrayList<>();
|
||||
+ if (purpurConfig.phantomSpawning) {
|
||||
+ this.customSpawners.add(new net.minecraft.world.level.levelgen.PhantomSpawner());
|
||||
+ }
|
||||
@@ -29,13 +30,13 @@
|
||||
+ this.customSpawners.add(new net.minecraft.world.entity.ai.village.VillageSiege());
|
||||
+ }
|
||||
+ if (purpurConfig.villagerTraderSpawning) {
|
||||
+ this.customSpawners.add(new net.minecraft.world.entity.npc.WanderingTraderSpawner(serverLevelData));
|
||||
+ this.customSpawners.add(new net.minecraft.world.entity.npc.wanderingtrader.WanderingTraderSpawner(serverLevelData));
|
||||
+ }
|
||||
+ // Purpur end - Allow toggling special MobSpawners per world
|
||||
this.serverLevelData = serverLevelData;
|
||||
ChunkGenerator chunkGenerator = levelStem.generator();
|
||||
// CraftBukkit start
|
||||
@@ -681,6 +_,7 @@
|
||||
this.serverLevelData.setWorld(this);
|
||||
@@ -709,6 +_,7 @@
|
||||
this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler);
|
||||
// Paper end - rewrite chunk system
|
||||
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
|
||||
@@ -43,21 +44,21 @@
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -727,7 +_,7 @@
|
||||
@@ -760,7 +_,7 @@
|
||||
}
|
||||
|
||||
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
|
||||
- if (this.sleepStatus.areEnoughSleeping(_int) && this.sleepStatus.areEnoughDeepSleeping(_int, this.players)) {
|
||||
+ if (this.purpurConfig.playersSkipNight && this.sleepStatus.areEnoughSleeping(_int) && this.sleepStatus.areEnoughDeepSleeping(_int, this.players)) { // Purpur - Config for skipping night
|
||||
int i = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE);
|
||||
- if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
|
||||
+ if (this.purpurConfig.playersSkipNight && this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) { // Purpur - Config for skipping night
|
||||
// Paper start - create time skip event - move up calculations
|
||||
final long newDayTime = this.levelData.getDayTime() + 24000L;
|
||||
org.bukkit.event.world.TimeSkipEvent event = new org.bukkit.event.world.TimeSkipEvent(
|
||||
@@ -846,6 +_,13 @@
|
||||
@@ -895,6 +_,13 @@
|
||||
this.serverLevelData.getScheduledEvents().tick(this.server, l);
|
||||
Profiler.get().pop();
|
||||
if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
|
||||
if (this.getGameRules().get(GameRules.ADVANCE_TIME)) {
|
||||
+ // Purpur start - Configurable daylight cycle
|
||||
+ int incrementTicks = isDay() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks;
|
||||
+ int incrementTicks = isBrightOutside() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks;
|
||||
+ if (incrementTicks != 12000) {
|
||||
+ this.preciseTime += 12000 / (double) incrementTicks;
|
||||
+ this.setDayTime(this.preciseTime);
|
||||
@@ -66,11 +67,10 @@
|
||||
this.setDayTime(this.levelData.getDayTime() + 1L);
|
||||
}
|
||||
}
|
||||
@@ -853,7 +_,21 @@
|
||||
@@ -902,6 +_,20 @@
|
||||
|
||||
public void setDayTime(long time) {
|
||||
this.serverLevelData.setDayTime(time);
|
||||
- }
|
||||
+ // Purpur start - Configurable daylight cycle
|
||||
+ this.preciseTime = time;
|
||||
+ this.forceTime = false;
|
||||
@@ -84,33 +84,68 @@
|
||||
+ // Purpur start - Configurable daylight cycle
|
||||
+ public boolean isForceTime() {
|
||||
+ return this.forceTime;
|
||||
+ }
|
||||
+ // Purpur end - Configurable daylight cycle
|
||||
}
|
||||
|
||||
public void tickCustomSpawners(boolean spawnEnemies, boolean spawnFriendlies) {
|
||||
for (CustomSpawner customSpawner : this.customSpawners) {
|
||||
@@ -934,9 +_,18 @@
|
||||
public long getDayCount() {
|
||||
@@ -1010,9 +_,17 @@
|
||||
&& this.random.nextDouble() < currentDifficultyAt.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01) // Paper - Configurable spawn chances for skeleton horses
|
||||
&& !this.getBlockState(blockPos.below()).is(Blocks.LIGHTNING_ROD);
|
||||
&& !this.getBlockState(blockPos.below()).is(BlockTags.LIGHTNING_RODS);
|
||||
if (flag) {
|
||||
- SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT);
|
||||
+ // Purpur start - Special mobs naturally spawn
|
||||
+ net.minecraft.world.entity.animal.horse.AbstractHorse entityhorseskeleton;
|
||||
+ net.minecraft.world.entity.animal.equine.AbstractHorse skeletonHorse;
|
||||
+ if (purpurConfig.zombieHorseSpawnChance > 0D && random.nextDouble() <= purpurConfig.zombieHorseSpawnChance) {
|
||||
+ entityhorseskeleton = EntityType.ZOMBIE_HORSE.create(this, EntitySpawnReason.EVENT);
|
||||
+ skeletonHorse = EntityType.ZOMBIE_HORSE.create(this, EntitySpawnReason.EVENT);
|
||||
+ } else {
|
||||
+ entityhorseskeleton = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT);
|
||||
+ if (entityhorseskeleton != null) ((SkeletonHorse) entityhorseskeleton).setTrap(true);
|
||||
+ skeletonHorse = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT);
|
||||
+ if (skeletonHorse != null) ((SkeletonHorse) skeletonHorse).setTrap(true);
|
||||
+ }
|
||||
+ // Purpur end - Special mobs naturally spawn
|
||||
SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT);
|
||||
if (skeletonHorse != null) {
|
||||
- skeletonHorse.setTrap(true);
|
||||
+ //skeletonHorse.setTrap(true); // Purpur - Special mobs naturally spawn - moved up
|
||||
skeletonHorse.setAge(0);
|
||||
skeletonHorse.setPos(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
this.addFreshEntity(skeletonHorse, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
|
||||
@@ -1009,7 +_,7 @@
|
||||
pointOfInterestType -> pointOfInterestType.is(PoiTypes.LIGHTNING_ROD),
|
||||
@@ -1047,9 +_,35 @@
|
||||
if (blockState.is(Blocks.SNOW)) {
|
||||
int layersValue = blockState.getValue(SnowLayerBlock.LAYERS);
|
||||
if (layersValue < Math.min(i, 8)) {
|
||||
+ // Purpur start - Smooth snow accumulation
|
||||
+ boolean canSnow = true;
|
||||
+ // Ensure snow doesn't get more than N layers taller than its neighbors
|
||||
+ // We only need to check blocks that are taller than the minimum step height
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.smoothSnowAccumulationStep > 0 && layersValue >= org.purpurmc.purpur.PurpurConfig.smoothSnowAccumulationStep) {
|
||||
+ int layersValueMin = layersValue - org.purpurmc.purpur.PurpurConfig.smoothSnowAccumulationStep;
|
||||
+ for (Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
+ BlockPos blockPosNeighbor = heightmapPos.relative(direction);
|
||||
+ BlockState blockStateNeighbor = this.getBlockState(blockPosNeighbor);
|
||||
+ if (blockStateNeighbor.is(Blocks.SNOW)) {
|
||||
+ // Special check for snow layers, if neighbors are too short, don't accumulate
|
||||
+ int layersValueNeighbor = blockStateNeighbor.getValue(SnowLayerBlock.LAYERS);
|
||||
+ if (layersValueNeighbor <= layersValueMin) {
|
||||
+ canSnow = false;
|
||||
+ break;
|
||||
+ }
|
||||
+ } else if (!Block.isFaceFull(blockStateNeighbor.getCollisionShape(this, blockPosNeighbor), direction.getOpposite())) {
|
||||
+ // Since our layer is tall enough already, if we have a non-full neighbor block, don't accumulate
|
||||
+ canSnow = false;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (canSnow) {
|
||||
+ // Purpur end - Smooth snow accumulation
|
||||
BlockState blockState1 = blockState.setValue(SnowLayerBlock.LAYERS, layersValue + 1);
|
||||
Block.pushEntitiesUp(blockState, blockState1, this, heightmapPos);
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, heightmapPos, blockState1, 3, null); // CraftBukkit
|
||||
+ } // Purpur - Smooth snow accumulation
|
||||
}
|
||||
} else {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, heightmapPos, Blocks.SNOW.defaultBlockState(), 3, null); // CraftBukkit
|
||||
@@ -1070,7 +_,7 @@
|
||||
poiType -> poiType.is(PoiTypes.LIGHTNING_ROD),
|
||||
blockPos -> blockPos.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, blockPos.getX(), blockPos.getZ()) - 1,
|
||||
pos,
|
||||
- 128,
|
||||
@@ -118,10 +153,10 @@
|
||||
PoiManager.Occupancy.ANY
|
||||
);
|
||||
return optional.map(blockPos -> blockPos.above(1));
|
||||
@@ -1057,8 +_,26 @@
|
||||
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
|
||||
@@ -1119,8 +_,26 @@
|
||||
int i = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE);
|
||||
Component component;
|
||||
if (this.sleepStatus.areEnoughSleeping(_int)) {
|
||||
if (this.sleepStatus.areEnoughSleeping(i)) {
|
||||
+ // Purpur start - Customizable sleeping actionbar messages
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.isBlank()) {
|
||||
+ return;
|
||||
@@ -139,13 +174,13 @@
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) {
|
||||
+ component = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent,
|
||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("count", Integer.toString(this.sleepStatus.amountSleeping())),
|
||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("total", Integer.toString(this.sleepStatus.sleepersNeeded(_int)))));
|
||||
+ net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("total", Integer.toString(this.sleepStatus.sleepersNeeded(i)))));
|
||||
+ } else
|
||||
+ // Purpur end - Customizable sleeping actionbar messages
|
||||
component = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(_int));
|
||||
component = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i));
|
||||
}
|
||||
|
||||
@@ -1191,6 +_,7 @@
|
||||
@@ -1275,6 +_,7 @@
|
||||
@VisibleForTesting
|
||||
public void resetWeatherCycle() {
|
||||
// CraftBukkit start
|
||||
@@ -153,7 +188,7 @@
|
||||
this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
|
||||
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
|
||||
// Not that everyone ever manages to get the whole server to sleep at the same time....
|
||||
@@ -1198,6 +_,7 @@
|
||||
@@ -1282,6 +_,7 @@
|
||||
this.serverLevelData.setRainTime(0);
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -161,7 +196,16 @@
|
||||
this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
|
||||
// CraftBukkit start
|
||||
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
|
||||
@@ -2676,7 +_,7 @@
|
||||
@@ -1954,7 +_,7 @@
|
||||
Explosion.BlockInteraction blockInteraction = switch (explosionInteraction) {
|
||||
case NONE -> Explosion.BlockInteraction.KEEP;
|
||||
case BLOCK -> this.getDestroyType(GameRules.BLOCK_EXPLOSION_DROP_DECAY);
|
||||
- case MOB -> this.getGameRules().get(GameRules.MOB_GRIEFING)
|
||||
+ case MOB -> ((source instanceof net.minecraft.world.entity.projectile.hurtingprojectile.LargeFireball) ? this.getGameRules().get(GameRules.MOB_GRIEFING, this.purpurConfig.fireballsMobGriefingOverride) : this.getGameRules().get(GameRules.MOB_GRIEFING)) // Purpur - Add mobGriefing override to everything affected
|
||||
? this.getDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY)
|
||||
: Explosion.BlockInteraction.KEEP;
|
||||
case TNT -> this.getDestroyType(GameRules.TNT_EXPLOSION_DROP_DECAY);
|
||||
@@ -2846,7 +_,7 @@
|
||||
// Spigot start
|
||||
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
|
||||
// Paper start - Fix merchant inventory not closing on entity removal
|
||||
|
||||
@@ -1,52 +1,50 @@
|
||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -393,6 +_,10 @@
|
||||
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
||||
public @Nullable String clientBrandName = null; // Paper - Brand support
|
||||
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
|
||||
+ public boolean purpurClient = false; // Purpur - Purpur client support
|
||||
@@ -433,6 +_,9 @@
|
||||
public boolean isRealPlayer; // Paper
|
||||
public com.destroystokyo.paper.event.entity.@Nullable PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
||||
public org.bukkit.event.player.PlayerQuitEvent.@Nullable 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
|
||||
+ private boolean tpsBar = false; // Purpur - Implement TPSBar
|
||||
+ private boolean compassBar = false; // Purpur - Add compass command
|
||||
+ private boolean ramBar = false; // Purpur - Implement rambar commands
|
||||
|
||||
// Paper start - rewrite chunk system
|
||||
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
@@ -561,6 +_,10 @@
|
||||
if (tag != null) {
|
||||
BlockPos.CODEC.parse(NbtOps.INSTANCE, tag).resultOrPartial(LOGGER::error).ifPresent(pos -> this.raidOmenPosition = pos);
|
||||
@@ -506,6 +_,9 @@
|
||||
this.respawnConfig = input.read("respawn", ServerPlayer.RespawnConfig.CODEC).orElse(null);
|
||||
this.spawnExtraParticlesOnFall = input.getBooleanOr("spawn_extra_particles_on_fall", false);
|
||||
this.raidOmenPosition = input.read("raid_omen_position", BlockPos.CODEC).orElse(null);
|
||||
+ this.tpsBar = input.getBooleanOr("Purpur.TPSBar", false); // Purpur - Implement TPSBar
|
||||
+ this.compassBar = input.getBooleanOr("Purpur.CompassBar", false); // Purpur - Add compass command
|
||||
+ this.ramBar = input.getBooleanOr("Purpur.RamBar", false); // Purpur - Implement rambar command
|
||||
// Paper start - Expand PlayerGameModeChangeEvent
|
||||
this.loadGameTypes(input);
|
||||
}
|
||||
@@ -547,6 +_,9 @@
|
||||
output.store("ShoulderEntityRight", CompoundTag.CODEC, this.getShoulderEntityRight());
|
||||
}
|
||||
+
|
||||
+ if (compound.contains("Purpur.TPSBar")) { this.tpsBar = compound.getBoolean("Purpur.TPSBar"); } // Purpur - Implement TPSBar
|
||||
+ if (compound.contains("Purpur.CompassBar")) { this.compassBar = compound.getBoolean("Purpur.CompassBar"); } // Purpur - Add compass command
|
||||
+ if (compound.contains("Purpur.RamBar")) { this.ramBar = compound.getBoolean("Purpur.RamBar"); } // Purpur - Implement rambar command
|
||||
this.getBukkitEntity().setExtraData(output); // CraftBukkit
|
||||
+ output.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur - Implement TPSBar
|
||||
+ output.putBoolean("Purpur.CompassBar", this.compassBar); // Purpur - Add compass command
|
||||
+ output.putBoolean("Purpur.RamBar", this.ramBar); // Purpur - Add rambar command
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -605,6 +_,9 @@
|
||||
}
|
||||
|
||||
this.saveEnderPearls(compound);
|
||||
+ compound.putBoolean("Purpur.TPSBar", this.tpsBar); // Purpur - Implement TPSBar
|
||||
+ compound.putBoolean("Purpur.CompassBar", this.compassBar); // Purpur - Add compass command
|
||||
+ compound.putBoolean("Purpur.RamBar", this.ramBar); // Purpur - Add rambar command
|
||||
}
|
||||
|
||||
private void saveParentVehicle(CompoundTag tag) {
|
||||
@@ -1124,6 +_,7 @@
|
||||
)
|
||||
);
|
||||
private void saveParentVehicle(ValueOutput output) {
|
||||
@@ -1183,6 +_,7 @@
|
||||
// Paper - moved up to sendClientboundPlayerCombatKillPacket()
|
||||
sendClientboundPlayerCombatKillPacket(event.getShowDeathMessages(), deathScreenMessage); // Paper - Expand PlayerDeathEvent
|
||||
Team team = this.getTeam();
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.deathMessageOnlyBroadcastToAffectedPlayer) this.sendSystemMessage(deathMessage); else // Purpur - Configurable broadcast settings
|
||||
if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) {
|
||||
this.server.getPlayerList().broadcastSystemMessage(deathMessage, false);
|
||||
} else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
|
||||
@@ -1217,6 +_,13 @@
|
||||
@@ -1290,6 +_,13 @@
|
||||
if (this.isInvulnerableTo(level, damageSource)) {
|
||||
return false;
|
||||
} else {
|
||||
+ // Purpur start - Add boat fall damage config
|
||||
+ if (damageSource.is(net.minecraft.tags.DamageTypeTags.IS_FALL)) {
|
||||
+ if (getRootVehicle() instanceof net.minecraft.world.entity.vehicle.Boat && !level().purpurConfig.boatsDoFallDamage) {
|
||||
+ if (getRootVehicle() instanceof net.minecraft.world.entity.vehicle.boat.Boat && !level().purpurConfig.boatsDoFallDamage) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
@@ -54,29 +52,29 @@
|
||||
Entity entity = damageSource.getEntity();
|
||||
if (!( // Paper - split the if statement. If below statement is false, hurtServer would not have been evaluated. Return false.
|
||||
!(entity instanceof Player player && !this.canHarmPlayer(player))
|
||||
@@ -1446,6 +_,7 @@
|
||||
serverLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
// CraftBukkit end
|
||||
+ this.portalPos = io.papermc.paper.util.MCUtil.toBlockPosition(exit); // Purpur - Fix stuck in portals
|
||||
@@ -1544,6 +_,7 @@
|
||||
|
||||
profilerFiller.pop();
|
||||
profilerFiller.push("placing");
|
||||
+ this.portalPos = org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(exit); // Purpur - Fix stuck in portals
|
||||
this.setServerLevel(level);
|
||||
this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event
|
||||
this.connection.resetPosition();
|
||||
@@ -1564,7 +_,7 @@
|
||||
new AABB(vec3.x() - 8.0, vec3.y() - 5.0, vec3.z() - 8.0, vec3.x() + 8.0, vec3.y() + 5.0, vec3.z() + 8.0),
|
||||
monster -> monster.isPreventingPlayerRest(this.serverLevel(), this)
|
||||
);
|
||||
- if (!entitiesOfClass.isEmpty()) {
|
||||
+ if (!this.level().purpurConfig.playerSleepNearMonsters && !entitiesOfClass.isEmpty()) { // Purpur - Config to ignore nearby mobs when sleeping
|
||||
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
|
||||
@@ -1652,7 +_,7 @@
|
||||
new AABB(vec3.x() - 8.0, vec3.y() - 5.0, vec3.z() - 8.0, vec3.x() + 8.0, vec3.y() + 5.0, vec3.z() + 8.0),
|
||||
monster -> monster.isPreventingPlayerRest(this.level(), this)
|
||||
);
|
||||
- if (!entitiesOfClass.isEmpty()) {
|
||||
+ if (!this.level().purpurConfig.playerSleepNearMonsters && !entitiesOfClass.isEmpty()) { // Purpur - Config to ignore nearby mobs when sleeping
|
||||
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1601,7 +_,19 @@
|
||||
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
if (!this.serverLevel().canSleepThroughNights()) {
|
||||
- this.displayClientMessage(Component.translatable("sleep.not_possible"), true);
|
||||
+ // Purpur start - Customizable sleeping actionbar messages
|
||||
@@ -1692,8 +_,19 @@
|
||||
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
if (!this.level().canSleepThroughNights()) {
|
||||
- this.displayClientMessage(Component.translatable("sleep.not_possible"), true);
|
||||
+ // Purpur start - Customizable sleeping actionbar messages
|
||||
+ Component clientMessage;
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.sleepNotPossible.isBlank()) {
|
||||
+ clientMessage = null;
|
||||
@@ -84,15 +82,15 @@
|
||||
+ clientMessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepNotPossible));
|
||||
+ } else {
|
||||
+ clientMessage = Component.translatable("sleep.not_possible");
|
||||
+ }
|
||||
}
|
||||
+ if (clientMessage != null) {
|
||||
+ this.displayClientMessage(clientMessage, true);
|
||||
+ }
|
||||
+ // Purpur end - Customizable sleeping actionbar messages
|
||||
}
|
||||
+ }// Purpur end - Customizable sleeping actionbar messages
|
||||
+ }
|
||||
|
||||
((ServerLevel)this.level()).updateSleepingPlayerList();
|
||||
@@ -1709,6 +_,7 @@
|
||||
this.level().updateSleepingPlayerList();
|
||||
return either;
|
||||
@@ -1784,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void openTextEdit(SignBlockEntity signEntity, boolean isFrontText) {
|
||||
@@ -100,7 +98,7 @@
|
||||
this.connection.send(new ClientboundBlockUpdatePacket(this.level(), signEntity.getBlockPos()));
|
||||
this.connection.send(new ClientboundOpenSignEditorPacket(signEntity.getBlockPos(), isFrontText));
|
||||
}
|
||||
@@ -2014,6 +_,26 @@
|
||||
@@ -2121,6 +_,26 @@
|
||||
this.lastSentExp = -1; // CraftBukkit - Added to reset
|
||||
}
|
||||
|
||||
@@ -111,7 +109,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void sendActionBarMessage(@Nullable net.kyori.adventure.text.Component message) {
|
||||
+ public void sendActionBarMessage(net.kyori.adventure.text.@Nullable Component message) {
|
||||
+ if (message != null) {
|
||||
+ sendActionBarMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message));
|
||||
+ }
|
||||
@@ -125,9 +123,9 @@
|
||||
+ // Purpur end - Component related conveniences
|
||||
+
|
||||
@Override
|
||||
public void displayClientMessage(Component chatComponent, boolean actionBar) {
|
||||
this.sendSystemMessage(chatComponent, actionBar);
|
||||
@@ -2235,6 +_,20 @@
|
||||
public void displayClientMessage(Component message, boolean overlay) {
|
||||
this.sendSystemMessage(message, overlay);
|
||||
@@ -2355,6 +_,20 @@
|
||||
);
|
||||
}
|
||||
|
||||
@@ -138,17 +136,17 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void sendMessage(@Nullable net.kyori.adventure.text.Component message) {
|
||||
+ public void sendMessage(net.kyori.adventure.text.@Nullable Component message) {
|
||||
+ if (message != null) {
|
||||
+ this.sendSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message));
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Component related conveniences
|
||||
+
|
||||
public void sendSystemMessage(Component mesage) {
|
||||
this.sendSystemMessage(mesage, false);
|
||||
public void sendSystemMessage(Component message) {
|
||||
this.sendSystemMessage(message, false);
|
||||
}
|
||||
@@ -2373,7 +_,67 @@
|
||||
@@ -2492,7 +_,67 @@
|
||||
|
||||
public void resetLastActionTime() {
|
||||
this.lastActionTime = Util.getMillis();
|
||||
@@ -180,7 +178,7 @@
|
||||
+
|
||||
+ msg = event.getBroadcastMsg();
|
||||
+ if (msg != null && !msg.isEmpty()) {
|
||||
+ String playerName = this.getGameProfile().getName();
|
||||
+ String playerName = this.getGameProfile().name();
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.afkBroadcastUseDisplayName) {
|
||||
+ net.kyori.adventure.text.Component playerDisplayNameComponent = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(this.getBukkitEntity().getDisplayName());
|
||||
+ playerName = net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer.plainText().serialize(playerDisplayNameComponent);
|
||||
@@ -210,14 +208,14 @@
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canBeCollidedWith() {
|
||||
+ return !this.isAfk() && super.canBeCollidedWith();
|
||||
+ public boolean canBeCollidedWith(Entity entity) {
|
||||
+ return !this.isAfk() && super.canBeCollidedWith(entity);
|
||||
+ }
|
||||
+ // Purpur end - AFK API
|
||||
|
||||
public ServerStatsCounter getStats() {
|
||||
return this.stats;
|
||||
@@ -3078,4 +_,56 @@
|
||||
@@ -3128,4 +_,65 @@
|
||||
return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity();
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -237,9 +235,18 @@
|
||||
+
|
||||
+ ServerLevel toLevel = ((org.bukkit.craftbukkit.CraftWorld) to.getWorld()).getHandle();
|
||||
+ if (this.level() == toLevel) {
|
||||
+ this.connection.teleport(to);
|
||||
+ this.connection.internalTeleport(to);
|
||||
+ } else {
|
||||
+ this.server.getPlayerList().respawn(this, true, RemovalReason.KILLED, org.bukkit.event.player.PlayerRespawnEvent.RespawnReason.DEATH, to);
|
||||
+ this.teleport(new TeleportTransition(
|
||||
+ toLevel,
|
||||
+ org.bukkit.craftbukkit.util.CraftLocation.toVec3(to),
|
||||
+ Vec3.ZERO,
|
||||
+ to.getYaw(),
|
||||
+ to.getPitch(),
|
||||
+ net.minecraft.world.entity.Relative.ALL,
|
||||
+ TeleportTransition.DO_NOTHING,
|
||||
+ org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.UNKNOWN
|
||||
+ ));
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Add option to teleport to spawn if outside world border
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -351,6 +_,7 @@
|
||||
@@ -365,6 +_,7 @@
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -464,6 +_,7 @@
|
||||
@@ -482,6 +_,7 @@
|
||||
public InteractionHand interactHand;
|
||||
public ItemStack interactItemStack;
|
||||
public InteractionResult useItemOn(ServerPlayer player, Level level, ItemStack stack, InteractionHand hand, BlockHitResult hitResult) {
|
||||
@@ -16,7 +16,7 @@
|
||||
BlockPos blockPos = hitResult.getBlockPos();
|
||||
BlockState blockState = level.getBlockState(blockPos);
|
||||
boolean cancelledBlock = false;
|
||||
@@ -506,7 +_,7 @@
|
||||
@@ -524,7 +_,7 @@
|
||||
boolean flag = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty();
|
||||
boolean flag1 = player.isSecondaryUseActive() && flag;
|
||||
ItemStack itemStack = stack.copy();
|
||||
@@ -25,9 +25,9 @@
|
||||
InteractionResult interactionResult = blockState.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult);
|
||||
if (interactionResult.consumesAction()) {
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, blockPos, itemStack);
|
||||
@@ -552,4 +_,18 @@
|
||||
public void setLevel(ServerLevel serverLevel) {
|
||||
this.level = serverLevel;
|
||||
@@ -570,4 +_,18 @@
|
||||
public void setLevel(ServerLevel level) {
|
||||
this.level = level;
|
||||
}
|
||||
+
|
||||
+ // Purpur start - Shift right click to use exp for mending
|
||||
@@ -35,8 +35,8 @@
|
||||
+ if (this.player.level().purpurConfig.shiftRightClickRepairsMendingPoints > 0 && this.player.isShiftKeyDown() && this.player.getBukkitEntity().hasPermission("purpur.mending_shift_click")) {
|
||||
+ int points = Math.min(this.player.totalExperience, this.player.level().purpurConfig.shiftRightClickRepairsMendingPoints);
|
||||
+ if (points > 0 && itemstack.isDamaged() && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.MENDING, itemstack) > 0) {
|
||||
+ this.player.giveExperiencePoints(-points);
|
||||
+ this.player.level().addFreshEntity(new net.minecraft.world.entity.ExperienceOrb(this.player.level(), this.player.getX(), this.player.getY(), this.player.getZ(), points, org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN, this.player, this.player));
|
||||
+ this.player.giveExperiencePoints(itemstack.getDamageValue() == 1 ? -2 : -points);
|
||||
+ this.player.level().addFreshEntity(new net.minecraft.world.entity.ExperienceOrb(this.player.level(), this.player.getX(), this.player.getY(), this.player.getZ(), itemstack.getDamageValue() == 1 ? 1 : points, org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN, this.player, this.player));
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -312,6 +_,7 @@
|
||||
@@ -311,6 +_,7 @@
|
||||
return true;
|
||||
} else {
|
||||
// Paper start - Buffer OOB setBlock calls
|
||||
|
||||
@@ -1,72 +1,82 @@
|
||||
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -41,6 +_,7 @@
|
||||
private long keepAliveChallenge;
|
||||
@@ -40,10 +_,11 @@
|
||||
public final Connection connection; // Paper
|
||||
private final boolean transferred;
|
||||
//private long keepAliveTime; // Paper - improve keepalives
|
||||
- //private boolean keepAlivePending; // Paper - improve keepalives
|
||||
+ private boolean keepAlivePending; // Paper - improve keepalives // Purpur - Alternative Keepalive Handling
|
||||
//private long keepAliveChallenge; // Paper - improve keepalives
|
||||
private long closedListenerTime;
|
||||
private boolean closed = false;
|
||||
+ private it.unimi.dsi.fastutil.longs.LongList keepAlives = new it.unimi.dsi.fastutil.longs.LongArrayList(); // Purpur - Alternative Keepalive Handling
|
||||
private int latency;
|
||||
private volatile int latency; // Paper - improve keepalives - make volatile
|
||||
private final io.papermc.paper.util.KeepAlive keepAlive; // Paper - improve keepalives
|
||||
private volatile boolean suspendFlushingOnServerThread = false;
|
||||
// CraftBukkit start
|
||||
@@ -51,6 +_,7 @@
|
||||
@@ -54,6 +_,10 @@
|
||||
public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
|
||||
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
|
||||
protected static final net.minecraft.resources.ResourceLocation MINECRAFT_BRAND = net.minecraft.resources.ResourceLocation.withDefaultNamespace("brand"); // Paper - Brand support
|
||||
+ protected static final net.minecraft.resources.ResourceLocation PURPUR_CLIENT = net.minecraft.resources.ResourceLocation.fromNamespaceAndPath("purpur", "client"); // Purpur - Purpur client support
|
||||
|
||||
public ServerCommonPacketListenerImpl(MinecraftServer server, Connection connection, CommonListenerCookie cookie, net.minecraft.server.level.ServerPlayer player) { // CraftBukkit
|
||||
this.server = server;
|
||||
@@ -118,6 +_,16 @@
|
||||
|
||||
@Override
|
||||
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
|
||||
protected static final net.minecraft.resources.Identifier MINECRAFT_BRAND = net.minecraft.resources.Identifier.withDefaultNamespace("brand"); // Paper - Brand support
|
||||
+ // Purpur start - Purpur client support
|
||||
+ protected static final net.minecraft.resources.Identifier PURPUR_CLIENT = net.minecraft.resources.Identifier.fromNamespaceAndPath("purpur", "client");
|
||||
+ public boolean purpurClient;
|
||||
+ // Purpur end - Purpur client support
|
||||
// Paper start - retain certain values
|
||||
public @Nullable String playerBrand;
|
||||
public final java.util.Set<String> pluginMessagerChannels;
|
||||
@@ -105,6 +_,18 @@
|
||||
// Paper start - improve keepalives
|
||||
long now = System.nanoTime();
|
||||
io.papermc.paper.util.KeepAlive.PendingKeepAlive pending = this.keepAlive.pendingKeepAlives.peek();
|
||||
+ // Purpur start - Alternative Keepalive Handling
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.useAlternateKeepAlive) {
|
||||
+ if (this.keepAlivePending && !keepAlives.isEmpty() && keepAlives.contains(packet.getId())) {
|
||||
+ int ping = (int) (Util.getMillis() - packet.getId());
|
||||
+ this.latency = (this.latency * 3 + ping) / 4;
|
||||
+ int updatedLatency = (this.latency * 3 + ping) / 4;
|
||||
+ this.latency = updatedLatency;
|
||||
+ this.keepAlivePending = false;
|
||||
+ keepAlives.clear(); // we got a valid response, lets roll with it and forget the rest
|
||||
+ }
|
||||
+ return;
|
||||
+ } else
|
||||
+ // Purpur end - Alternative Keepalive Handling
|
||||
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
|
||||
int i = (int)(Util.getMillis() - this.keepAliveTime);
|
||||
this.latency = (this.latency * 3 + i) / 4;
|
||||
@@ -159,6 +_,13 @@
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn't register custom payload", ex);
|
||||
this.disconnect(Component.literal("Invalid payload REGISTER!"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
|
||||
if (pending != null && pending.challengeId() == packet.getId()) {
|
||||
this.keepAlive.pendingKeepAlives.remove(pending);
|
||||
|
||||
@@ -179,6 +_,12 @@
|
||||
return;
|
||||
}
|
||||
+ // Purpur start - Purpur client support
|
||||
+ } else if (identifier.equals(PURPUR_CLIENT)) {
|
||||
+ try {
|
||||
+ player.purpurClient = true;
|
||||
+ } catch (Exception ignore) {
|
||||
|
||||
+ // Purpur start - Purpur client support
|
||||
+ if (identifier.equals(PURPUR_CLIENT)) {
|
||||
+ this.purpurClient = true;
|
||||
+ }
|
||||
+ // Purpur end - Purpur client support
|
||||
} else if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER)) {
|
||||
try {
|
||||
String channels = payload.toString(com.google.common.base.Charsets.UTF_8);
|
||||
@@ -238,6 +_,22 @@
|
||||
// Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings
|
||||
// This should effectively place the keepalive handling back to "as it was" before 1.12.2
|
||||
final long elapsedTime = millis - this.keepAliveTime;
|
||||
+ // Purpur end - Purpur client support
|
||||
+
|
||||
if (identifier.equals(MINECRAFT_BRAND)) {
|
||||
this.playerBrand = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.wrappedBuffer(data)).readUtf(256);
|
||||
}
|
||||
@@ -264,6 +_,23 @@
|
||||
Profiler.get().push("keepAlive");
|
||||
long millis = Util.getMillis();
|
||||
// Paper start - improve keepalives
|
||||
+ // Purpur start - Alternative Keepalive Handling
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.useAlternateKeepAlive) {
|
||||
+ if (elapsedTime >= 1000L) { // 1 second
|
||||
+ if (this.keepAlivePending && !this.processedDisconnect && keepAlives.size() * 1000L >= KEEPALIVE_LIMIT) {
|
||||
+ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT);
|
||||
+ } else if (this.checkIfClosed(millis)) {
|
||||
+ this.keepAlivePending = true;
|
||||
+ this.keepAliveTime = millis; // hijack this field for 1 second intervals
|
||||
+ this.keepAlives.add(millis); // currentTime is ID
|
||||
+ this.send(new ClientboundKeepAlivePacket(millis));
|
||||
+ if (this.checkIfClosed(millis) && !this.processedDisconnect) {
|
||||
+ long currTime = System.nanoTime();
|
||||
+ if ((currTime - this.keepAlive.lastKeepAliveTx) >= java.util.concurrent.TimeUnit.SECONDS.toNanos(1L)) { // 1 second
|
||||
+ this.keepAlive.lastKeepAliveTx = currTime;
|
||||
+ if (this.keepAlivePending && !this.processedDisconnect && keepAlives.size() * 1000L >= KEEPALIVE_LIMIT) {
|
||||
+ this.disconnect(TIMEOUT_DISCONNECTION_MESSAGE, io.papermc.paper.connection.DisconnectionReason.TIMEOUT);
|
||||
+ } else if (this.checkIfClosed(millis)) {
|
||||
+ this.keepAlivePending = true;
|
||||
+ this.keepAlives.add(millis); // currentTime is ID
|
||||
+ this.send(new ClientboundKeepAlivePacket(millis));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ } else
|
||||
+ // Purpur end - Alternative Keepalive Handling
|
||||
+
|
||||
if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // use vanilla's 15000L between keep alive packets
|
||||
if (this.keepAlivePending) {
|
||||
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
|
||||
if (this.checkIfClosed(millis) && !this.processedDisconnect) {
|
||||
long currTime = System.nanoTime();
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -326,6 +_,20 @@
|
||||
this.chatMessageChain = new FutureChain(server.chatExecutor); // CraftBukkit - async chat
|
||||
@@ -346,6 +_,20 @@
|
||||
}
|
||||
// Paper end - configuration phase API
|
||||
|
||||
+ // Purpur start - AFK API
|
||||
+ private final com.google.common.cache.LoadingCache<org.bukkit.craftbukkit.entity.CraftPlayer, Boolean> kickPermissionCache = com.google.common.cache.CacheBuilder.newBuilder()
|
||||
@@ -21,20 +21,20 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.ackBlockChangesUpTo > -1) {
|
||||
@@ -384,6 +_,12 @@
|
||||
if (this.player.getLastActionTime() > 0L
|
||||
&& this.server.getPlayerIdleTimeout() > 0
|
||||
&& Util.getMillis() - this.player.getLastActionTime() > this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits
|
||||
+ // Purpur start - AFK API
|
||||
+ this.player.setAfk(true);
|
||||
+ if (!this.player.level().purpurConfig.idleTimeoutKick || (!Boolean.parseBoolean(System.getenv("PURPUR_FORCE_IDLE_KICK")) && kickPermissionCache.getUnchecked(this.player.getBukkitEntity()))) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Purpur end - AFK API
|
||||
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
|
||||
this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
|
||||
@@ -363,6 +_,12 @@
|
||||
&& this.server.playerIdleTimeout() > 0
|
||||
&& Util.getMillis() - this.player.getLastActionTime() > TimeUnit.MINUTES.toMillis(this.server.playerIdleTimeout())
|
||||
&& !this.player.wonGame) {
|
||||
+ // Purpur start - AFK API
|
||||
+ this.player.setAfk(true);
|
||||
+ if (!this.player.level().purpurConfig.idleTimeoutKick || (!Boolean.parseBoolean(System.getenv("PURPUR_FORCE_IDLE_KICK")) && kickPermissionCache.getUnchecked(this.player.getBukkitEntity()))) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Purpur end - AFK API
|
||||
this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
|
||||
}
|
||||
}
|
||||
@@ -629,6 +_,8 @@
|
||||
@@ -682,6 +_,8 @@
|
||||
this.lastYaw = to.getYaw();
|
||||
this.lastPitch = to.getPitch();
|
||||
|
||||
@@ -43,15 +43,15 @@
|
||||
Location oldTo = to.clone();
|
||||
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
@@ -709,6 +_,7 @@
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
@@ -761,6 +_,7 @@
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
|
||||
if (packet.getId() == this.awaitingTeleport) {
|
||||
if (this.awaitingPositionFromClient == null) {
|
||||
+ ServerGamePacketListenerImpl.LOGGER.warn("Disconnected on accept teleport packet. Was not expecting position data from client at this time"); // Purpur - Add more logger output for invalid movement kicks
|
||||
this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
|
||||
return;
|
||||
}
|
||||
@@ -1176,6 +_,10 @@
|
||||
@@ -1301,6 +_,10 @@
|
||||
final int maxBookPageSize = pageMax.intValue();
|
||||
final double multiplier = Math.clamp(io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier, 0.3D, 1D);
|
||||
long byteAllowed = maxBookPageSize;
|
||||
@@ -62,7 +62,7 @@
|
||||
for (final String page : pageList) {
|
||||
final int byteLength = page.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
|
||||
byteTotal += byteLength;
|
||||
@@ -1200,7 +_,8 @@
|
||||
@@ -1325,7 +_,8 @@
|
||||
}
|
||||
|
||||
if (byteTotal > byteAllowed) {
|
||||
@@ -72,7 +72,7 @@
|
||||
this.disconnectAsync(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause // Paper - add proper async disconnect
|
||||
return;
|
||||
}
|
||||
@@ -1219,31 +_,45 @@
|
||||
@@ -1344,31 +_,45 @@
|
||||
Optional<String> optional = packet.title();
|
||||
optional.ifPresent(list::add);
|
||||
list.addAll(packet.pages());
|
||||
@@ -82,9 +82,9 @@
|
||||
+ // Purpur end - Allow color codes in books
|
||||
Consumer<List<FilteredText>> consumer = optional.isPresent()
|
||||
- ? texts -> this.signBook(texts.get(0), texts.subList(1, texts.size()), slot)
|
||||
- : texts -> this.updateBookContents(texts, slot);
|
||||
- : list1 -> this.updateBookContents(list1, slot);
|
||||
+ ? texts -> this.signBook(texts.get(0), texts.subList(1, texts.size()), slot, hasSignPerm) // Purpur - Allow color codes in books
|
||||
+ : texts -> this.updateBookContents(texts, slot, hasEditPerm); // Purpur - Allow color codes in books
|
||||
+ : list1 -> this.updateBookContents(list1, slot, hasEditPerm); // Purpur - Allow color codes in books
|
||||
this.filterTextPacket(list).thenAcceptAsync(consumer, this.server);
|
||||
}
|
||||
}
|
||||
@@ -120,9 +120,9 @@
|
||||
- List<Filterable<Component>> list = pages.stream().map(filteredText -> this.filterableFromOutgoing(filteredText).<Component>map(Component::literal)).toList();
|
||||
+ List<Filterable<Component>> list = pages.stream().map((filteredText) -> this.filterableFromOutgoing(filteredText).map(s -> hexColor(s, hasPerm))).toList(); // Purpur - Allow color codes in books
|
||||
itemStack.set(
|
||||
DataComponents.WRITTEN_BOOK_CONTENT,
|
||||
new WrittenBookContent(this.filterableFromOutgoing(title), this.player.getName().getString(), 0, list, true)
|
||||
@@ -1257,6 +_,16 @@
|
||||
DataComponents.WRITTEN_BOOK_CONTENT, new WrittenBookContent(this.filterableFromOutgoing(title), this.player.getPlainTextName(), 0, list, true)
|
||||
);
|
||||
@@ -1381,6 +_,16 @@
|
||||
return this.player.isTextFilteringEnabled() ? Filterable.passThrough(filteredText.filteredOrEmpty()) : Filterable.from(filteredText);
|
||||
}
|
||||
|
||||
@@ -138,11 +138,11 @@
|
||||
+
|
||||
@Override
|
||||
public void handleEntityTagQuery(ServerboundEntityTagQueryPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
@@ -1292,7 +_,15 @@
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
|
||||
@@ -1420,7 +_,15 @@
|
||||
@Override
|
||||
public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
|
||||
- if (containsInvalidValues(packet.getX(0.0), packet.getY(0.0), packet.getZ(0.0), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
|
||||
+ // Purpur start - Add more logger output for invalid movement kicks
|
||||
+ boolean invalidX = Double.isNaN(packet.getX(0.0));
|
||||
@@ -155,40 +155,40 @@
|
||||
+ // Purpur end - Add more logger output for invalid movement kicks
|
||||
this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
|
||||
} else {
|
||||
ServerLevel serverLevel = this.player.serverLevel();
|
||||
@@ -1467,7 +_,7 @@
|
||||
movedWrongly = true;
|
||||
if (event.getLogWarning())
|
||||
// Paper end
|
||||
- LOGGER.warn("{} moved wrongly!", this.player.getName().getString());
|
||||
+ LOGGER.warn("{} moved wrongly!, ({})", this.player.getName().getString(), verticalDelta); // Purpur - AFK API
|
||||
} // Paper
|
||||
}
|
||||
|
||||
@@ -1533,6 +_,8 @@
|
||||
this.lastYaw = to.getYaw();
|
||||
this.lastPitch = to.getPitch();
|
||||
|
||||
+ if (!to.getWorld().getUID().equals(from.getWorld().getUID()) || to.getBlockX() != from.getBlockX() || to.getBlockY() != from.getBlockY() || to.getBlockZ() != from.getBlockZ() || to.getYaw() != from.getYaw() || to.getPitch() != from.getPitch()) this.player.resetLastActionTime(); // Purpur - AFK API
|
||||
+
|
||||
Location oldTo = to.clone();
|
||||
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
@@ -1589,6 +_,13 @@
|
||||
this.player.tryResetCurrentImpulseContext();
|
||||
ServerLevel serverLevel = this.player.level();
|
||||
@@ -1603,7 +_,7 @@
|
||||
movedWrongly = true;
|
||||
if (event.getLogWarning())
|
||||
// Paper end
|
||||
- LOGGER.warn("{} moved wrongly!", this.player.getPlainTextName());
|
||||
+ LOGGER.warn("{} moved wrongly!, ({})", this.player.getPlainTextName(), verticalDelta); // Purpur - AFK API
|
||||
} // Paper
|
||||
}
|
||||
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ if (this.player.serverLevel().purpurConfig.dontRunWithScissors && this.player.isSprinting() && !(this.player.serverLevel().purpurConfig.ignoreScissorsInWater && this.player.isInWater()) && !(this.player.serverLevel().purpurConfig.ignoreScissorsInLava && this.player.isInLava()) && (isScissors(this.player.getItemInHand(InteractionHand.MAIN_HAND)) || isScissors(this.player.getItemInHand(InteractionHand.OFF_HAND))) && (int) (Math.random() * 10) == 0) {
|
||||
+ this.player.hurtServer(this.player.serverLevel(), this.player.damageSources().scissors(), (float) this.player.serverLevel().purpurConfig.scissorsRunningDamage);
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.dontRunWithScissors.isBlank()) this.player.sendActionBarMessage(org.purpurmc.purpur.PurpurConfig.dontRunWithScissors);
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
@@ -1668,6 +_,8 @@
|
||||
this.lastYaw = to.getYaw();
|
||||
this.lastPitch = to.getPitch();
|
||||
|
||||
+ if (!to.getWorld().getUID().equals(from.getWorld().getUID()) || to.getBlockX() != from.getBlockX() || to.getBlockY() != from.getBlockY() || to.getBlockZ() != from.getBlockZ() || to.getYaw() != from.getYaw() || to.getPitch() != from.getPitch()) this.player.resetLastActionTime(); // Purpur - AFK API
|
||||
+
|
||||
this.player.checkMovementStatistics(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z);
|
||||
this.lastGoodX = this.player.getX();
|
||||
this.lastGoodY = this.player.getY();
|
||||
@@ -1637,6 +_,17 @@
|
||||
Location oldTo = to.clone();
|
||||
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
|
||||
this.cserver.getPluginManager().callEvent(event);
|
||||
@@ -1723,6 +_,13 @@
|
||||
this.player.tryResetCurrentImpulseContext();
|
||||
}
|
||||
|
||||
+ // Purpur start - Dont run with scissors!
|
||||
+ if (this.player.level().purpurConfig.dontRunWithScissors && this.player.isSprinting() && !(this.player.level().purpurConfig.ignoreScissorsInWater && this.player.isInWater()) && !(this.player.level().purpurConfig.ignoreScissorsInLava && this.player.isInLava()) && (isScissors(this.player.getItemInHand(InteractionHand.MAIN_HAND)) || isScissors(this.player.getItemInHand(InteractionHand.OFF_HAND))) && (int) (Math.random() * 10) == 0) {
|
||||
+ this.player.hurtServer(this.player.level(), this.player.damageSources().scissors(), (float) this.player.level().purpurConfig.scissorsRunningDamage);
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.dontRunWithScissors.isBlank()) this.player.sendActionBarMessage(org.purpurmc.purpur.PurpurConfig.dontRunWithScissors);
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
+
|
||||
this.player.checkMovementStatistics(this.player.getX() - x, this.player.getY() - y, this.player.getZ() - z);
|
||||
this.lastGoodX = this.player.getX();
|
||||
this.lastGoodY = this.player.getY();
|
||||
@@ -1740,6 +_,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,29 +196,38 @@
|
||||
+ public boolean isScissors(ItemStack stack) {
|
||||
+ if (!stack.is(Items.SHEARS)) return false;
|
||||
+
|
||||
+ ResourceLocation itemModelReference = stack.get(net.minecraft.core.component.DataComponents.ITEM_MODEL);
|
||||
+ if (itemModelReference != null && itemModelReference.equals(this.player.serverLevel().purpurConfig.dontRunWithScissorsItemModelReference)) return true;
|
||||
+ Identifier itemModelReference = stack.get(net.minecraft.core.component.DataComponents.ITEM_MODEL);
|
||||
+ if (itemModelReference != null && itemModelReference.equals(this.player.level().purpurConfig.dontRunWithScissorsItemModelReference)) return true;
|
||||
+
|
||||
+ return stack.getOrDefault(DataComponents.CUSTOM_MODEL_DATA, net.minecraft.world.item.component.CustomModelData.EMPTY).equals(net.minecraft.world.item.component.CustomModelData.EMPTY);
|
||||
+ }
|
||||
+ // Purpur end - Dont run with scissors!
|
||||
+
|
||||
// Paper start - optimise out extra getCubes
|
||||
private boolean hasNewCollision(final ServerLevel level, final Entity entity, final AABB oldBox, final AABB newBox) {
|
||||
final List<AABB> collisionsBB = new java.util.ArrayList<>();
|
||||
@@ -2001,6 +_,7 @@
|
||||
private boolean shouldCheckPlayerMovement(boolean isElytraMovement) {
|
||||
if (this.isSingleplayerOwner()) {
|
||||
return false;
|
||||
@@ -2154,6 +_,7 @@
|
||||
|
||||
boolean cancelled;
|
||||
if (hitResult == null || hitResult.getType() != HitResult.Type.BLOCK) {
|
||||
+ if (this.player.gameMode.shiftClickMended(itemInHand)) return; // Purpur - Shift right click to use exp for mending
|
||||
+ if (this.player.gameMode.shiftClickMended(itemInHand)) return; // Purpur - Shift right click to use exp for mending
|
||||
org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemInHand, hand);
|
||||
cancelled = event.useItemInHand() == Event.Result.DENY;
|
||||
} else {
|
||||
@@ -2741,6 +_,7 @@
|
||||
@@ -2800,6 +_,7 @@
|
||||
|
||||
AABB boundingBox = target.getBoundingBox();
|
||||
if (this.player.canInteractWithEntity(boundingBox, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0))) { // Paper - configurable lenience value for interact range
|
||||
if (packet.isWithinRange(this.player, boundingBox, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0))) { // Paper - configurable lenience value for interact range
|
||||
+ if (target instanceof net.minecraft.world.entity.Mob mob) mob.ticksSinceLastInteraction = 0; // Purpur - Entity lifespan
|
||||
packet.dispatch(
|
||||
new ServerboundInteractPacket.Handler() {
|
||||
private void performInteraction(InteractionHand hand, ServerGamePacketListenerImpl.EntityInteraction entityInteraction, PlayerInteractEntityEvent event) { // CraftBukkit
|
||||
@@ -3545,7 +_,7 @@
|
||||
@Override
|
||||
public void handleChangeGameMode(ServerboundChangeGameModePacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
|
||||
- if (!GameModeCommand.PERMISSION_CHECK.check(this.player.permissions())) {
|
||||
+ if (!GameModeCommand.PERMISSION_CHECK.check(this.player.permissions()) && !player.getBukkitEntity().hasPermission("purpur.debug.f3n")) { // Purpur - Add permission for F3+N debug
|
||||
LOGGER.warn(
|
||||
"Player {} tried to change game mode to {} without required permissions",
|
||||
this.player.getGameProfile().name(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -307,7 +_,7 @@
|
||||
@@ -278,7 +_,7 @@
|
||||
ServerLoginPacketListenerImpl.LOGGER.warn("Failed to verify username but will let them in anyway!");
|
||||
ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(string1)); // Spigot
|
||||
} else {
|
||||
|
||||
@@ -1,31 +1,22 @@
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -396,6 +_,7 @@
|
||||
@@ -311,6 +_,7 @@
|
||||
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
|
||||
}
|
||||
// Paper end - Configurable player collision
|
||||
+ org.purpurmc.purpur.task.BossBarTask.addToAll(player); // Purpur - Implement TPSBar
|
||||
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), loggableAddress, player.getId(), serverLevel.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
|
||||
// Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead
|
||||
if (player.isDeadOrDying()) {
|
||||
@@ -501,6 +_,7 @@
|
||||
// CraftBukkit start - moved down
|
||||
LOGGER.info(
|
||||
"{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", // CraftBukkit - add world name
|
||||
@@ -431,6 +_,7 @@
|
||||
}
|
||||
public net.kyori.adventure.text.Component remove(ServerPlayer player, net.kyori.adventure.text.Component leaveMessage) {
|
||||
public net.kyori.adventure.text.@Nullable Component remove(ServerPlayer player, net.kyori.adventure.text.Component leaveMessage) {
|
||||
// Paper end - Fix kick event leave message not being sent
|
||||
+ org.purpurmc.purpur.task.BossBarTask.removeFromAll(player.getBukkitEntity()); // Purpur - Implement TPSBar
|
||||
ServerLevel serverLevel = player.serverLevel();
|
||||
ServerLevel serverLevel = player.level();
|
||||
player.awardStat(Stats.LEAVE_GAME);
|
||||
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
|
||||
@@ -665,7 +_,7 @@
|
||||
// return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)
|
||||
// ? Component.translatable("multiplayer.disconnect.server_full")
|
||||
// : null;
|
||||
- if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameProfile)) {
|
||||
+ if (this.players.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameProfile))) { // Purpur - Allow player join full server by permission
|
||||
event.disallow(org.bukkit.event.player.PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure
|
||||
}
|
||||
}
|
||||
@@ -919,6 +_,20 @@
|
||||
@@ -770,6 +_,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +27,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void broadcastMessage(@Nullable net.kyori.adventure.text.Component message, boolean overlay) {
|
||||
+ public void broadcastMessage(net.kyori.adventure.text.@Nullable Component message, boolean overlay) {
|
||||
+ if (message != null) {
|
||||
+ this.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), overlay);
|
||||
+ }
|
||||
@@ -46,11 +37,20 @@
|
||||
public void broadcastAll(Packet<?> packet, ResourceKey<Level> dimension) {
|
||||
for (ServerPlayer serverPlayer : this.players) {
|
||||
if (serverPlayer.level().dimension() == dimension) {
|
||||
@@ -1002,6 +_,7 @@
|
||||
} else {
|
||||
b = (byte)(24 + permLevel);
|
||||
}
|
||||
+ if (b < 28 && player.getBukkitEntity().hasPermission("purpur.debug.f3n")) b = 28; // Purpur - Add permission for F3+N debug
|
||||
|
||||
@@ -863,6 +_,7 @@
|
||||
case ADMINS -> EntityEvent.PERMISSION_LEVEL_ADMINS;
|
||||
case OWNERS -> EntityEvent.PERMISSION_LEVEL_OWNERS;
|
||||
};
|
||||
+ if (b < EntityEvent.PERMISSION_LEVEL_OWNERS && player.getBukkitEntity().hasPermission("purpur.debug.f3n")) b = EntityEvent.PERMISSION_LEVEL_OWNERS; // Purpur - Add permission for F3+N debug
|
||||
player.connection.send(new ClientboundEntityEventPacket(player, b));
|
||||
}
|
||||
|
||||
@@ -874,7 +_,7 @@
|
||||
|
||||
// Paper start - whitelist verify event / login event
|
||||
public LoginResult canBypassFullServerLogin(final NameAndId nameAndId, final LoginResult currentResult) {
|
||||
- final boolean shouldKick = this.players.size() >= this.getMaxPlayers() && !this.canBypassPlayerLimit(nameAndId);
|
||||
+ final boolean shouldKick = this.players.size() >= this.getMaxPlayers() && !(/*player.hasPermission("purpur.joinfullserver") || */this.canBypassPlayerLimit(nameAndId)); // Purpur - Allow player join full server by permission TODO: this hasn't worked for a while, so comment it out until we can reliably check perms of the player joining
|
||||
final io.papermc.paper.event.player.PlayerServerFullCheckEvent fullCheckEvent = new io.papermc.paper.event.player.PlayerServerFullCheckEvent(
|
||||
new com.destroystokyo.paper.profile.CraftPlayerProfile(nameAndId),
|
||||
io.papermc.paper.adventure.PaperAdventure.asAdventure(currentResult.message),
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/stats/ServerRecipeBook.java
|
||||
+++ b/net/minecraft/stats/ServerRecipeBook.java
|
||||
@@ -138,6 +_,7 @@
|
||||
try {
|
||||
ResourceKey<Recipe<?>> resourceKey = ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(string));
|
||||
if (!isRecognized.test(resourceKey)) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.loggerSuppressUnrecognizedRecipeErrors) // Purpur - Logger settings (suppressing pointless logs)
|
||||
LOGGER.error("Tried to load unrecognized recipe: {} removed now.", resourceKey);
|
||||
} else {
|
||||
output.accept(resourceKey);
|
||||
@@ -106,6 +_,7 @@
|
||||
private void loadRecipes(List<ResourceKey<Recipe<?>>> recipes, Consumer<ResourceKey<Recipe<?>>> output, Predicate<ResourceKey<Recipe<?>>> isRecognized) {
|
||||
for (ResourceKey<Recipe<?>> resourceKey : recipes) {
|
||||
if (!isRecognized.test(resourceKey)) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.loggerSuppressUnrecognizedRecipeErrors) // Purpur - Logger settings (suppressing pointless logs)
|
||||
LOGGER.error("Tried to load unrecognized recipe: {} removed now.", resourceKey);
|
||||
} else {
|
||||
output.accept(resourceKey);
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
+++ b/net/minecraft/world/damagesource/CombatRules.java
|
||||
@@ -15,7 +_,7 @@
|
||||
|
||||
public static float getDamageAfterAbsorb(LivingEntity entity, float damage, DamageSource damageSource, float armorValue, float armorToughness) {
|
||||
public static float getDamageAfterAbsorb(LivingEntity entity, float damageAmount, DamageSource damageSource, float armorValue, float armorToughness) {
|
||||
float f = 2.0F + armorToughness / 4.0F;
|
||||
- float f1 = Mth.clamp(armorValue - damage / f, armorValue * 0.2F, 20.0F);
|
||||
+ float f1 = Mth.clamp(armorValue - damage / f, armorValue * 0.2F, org.purpurmc.purpur.PurpurConfig.limitArmor ? 20F : Float.MAX_VALUE); // Purpur - Add attribute clamping and armor limit config
|
||||
- float f1 = Mth.clamp(armorValue - damageAmount / f, armorValue * 0.2F, 20.0F);
|
||||
+ float f1 = Mth.clamp(armorValue - damageAmount / f, armorValue * 0.2F, org.purpurmc.purpur.PurpurConfig.limitArmor ? 20F : Float.MAX_VALUE); // Purpur - Add attribute clamping and armor limit config
|
||||
float f2 = f1 / 25.0F;
|
||||
ItemStack weaponItem = damageSource.getWeaponItem();
|
||||
float f3;
|
||||
@@ -30,7 +_,7 @@
|
||||
}
|
||||
|
||||
public static float getDamageAfterMagicAbsorb(float damage, float enchantModifiers) {
|
||||
public static float getDamageAfterMagicAbsorb(float damageAmount, float enchantModifiers) {
|
||||
- float f = Mth.clamp(enchantModifiers, 0.0F, 20.0F);
|
||||
+ float f = Mth.clamp(enchantModifiers, 0.0F, org.purpurmc.purpur.PurpurConfig.limitArmor ? 20F : Float.MAX_VALUE); // Purpur - Add attribute clamping and armor limit config
|
||||
return damage * (1.0F - f / 25.0F);
|
||||
return damageAmount * (1.0F - f / 25.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/damagesource/CombatTracker.java
|
||||
+++ b/net/minecraft/world/damagesource/CombatTracker.java
|
||||
@@ -54,7 +_,7 @@
|
||||
@@ -64,7 +_,7 @@
|
||||
|
||||
private Component getMessageForAssistedFall(Entity entity, Component entityDisplayName, String hasWeaponTranslationKey, String noWeaponTranslationKey) {
|
||||
ItemStack itemStack = entity instanceof LivingEntity livingEntity ? livingEntity.getMainHandItem() : ItemStack.EMPTY;
|
||||
@@ -9,7 +9,7 @@
|
||||
? Component.translatable(hasWeaponTranslationKey, this.mob.getDisplayName(), entityDisplayName, itemStack.getDisplayName())
|
||||
: Component.translatable(noWeaponTranslationKey, this.mob.getDisplayName(), entityDisplayName);
|
||||
}
|
||||
@@ -98,6 +_,15 @@
|
||||
@@ -107,6 +_,15 @@
|
||||
Component component = ComponentUtils.wrapInSquareBrackets(Component.translatable(string + ".link")).withStyle(INTENTIONAL_GAME_DESIGN_STYLE);
|
||||
return Component.translatable(string + ".message", this.mob.getDisplayName(), component);
|
||||
} else {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user