Merge branch 'ver/1.20.6' into feat/quiver-bundle

This commit is contained in:
granny
2024-05-07 20:44:02 -07:00
403 changed files with 7980 additions and 7969 deletions

View File

@@ -11,13 +11,14 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.commits[0].message, '[ci-skip]')"
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3.6.0
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
java-version: 21
cache: 'gradle'
- uses: gradle/wrapper-validation-action@v2
- uses: gradle/actions/setup-gradle@v3
- name: Configure Git
run: git config --global user.email "no-reply@github.com" && git config --global user.name "Github Actions"
- name: Apply Patches

2
.gitignore vendored
View File

@@ -56,4 +56,6 @@ build-data/
Purpur-API
Purpur-MojangAPI
Purpur-Server
paper-api-generator
*.jar
test-plugin.settings.gradle.kts

View File

@@ -1,11 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Purpur Paperclip Jar" type="JarApplication">
<option name="JAR_PATH" value="$PROJECT_DIR$/build/libs/purpur-paperclip-1.20.2-R0.1-SNAPSHOT-reobf.jar" />
<option name="JAR_PATH" value="$PROJECT_DIR$/build/libs/purpur-paperclip-1.20.6-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" />
<method v="2">
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Upstream Paper [createReobfPaperclipJar]" run_configuration_type="GradleRunConfiguration" />
<option name="RunConfigurationTask" enabled="false" run_configuration_name="Upstream Paper [createMojmapPaperclipJar]" run_configuration_type="GradleRunConfiguration" />
</method>
</configuration>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Upstream Paper [createReobfPaperclipJar]" type="GradleRunConfiguration" factoryName="Gradle">
<configuration default="false" name="Upstream Paper [createMojmapPaperclipJar]" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -10,7 +10,7 @@
</option>
<option name="taskNames">
<list>
<option value="createReobfPaperclipJar" />
<option value="createMojmapPaperclipJar" />
</list>
</option>
<option name="vmOptions" />
@@ -23,4 +23,4 @@
<option name="RunConfigurationTask" enabled="true" run_configuration_name="Upstream Paper [build]" run_configuration_type="GradleRunConfiguration" />
</method>
</configuration>
</component>
</component>

View File

@@ -4,11 +4,11 @@ Purpur is happy you're willing to contribute to our projects. We are usually
very lenient with all submitted PRs, but there are still some guidelines you
can follow to make the approval process go more smoothly.
## Use a Personal Fork and not Organization
## Use a Personal Fork and not an Organization
Purpur will routinely modify your PR, whether it's a quick rebase or to take care
of any minor nitpicks we might have. Often, it's better for us to solve these
problems for you than make you go back and forth trying to fix it yourself.
problems for you than make you go back and forth trying to fix them yourself.
Unfortunately, if you use an organization for your PR, it prevents Purpur from
modifying it. This requires us to manually merge your PR, resulting in us
@@ -27,12 +27,12 @@ which can be obtained in (most) package managers such as `apt` (Debian / Ubuntu;
you will most likely use this for WSL), `homebrew` (macOS / Linux), and more:
- `git` (package `git` everywhere);
- A Java 16 or later JDK (packages vary, use Google/DuckDuckGo/etc.).
- A Java 21 or later JDK (packages vary, use Google/DuckDuckGo/etc.).
- [Adoptium](https://adoptium.net/) has builds for most operating systems.
- Purpur requires JDK 16 to build, however makes use of Gradle's
- Purpur requires JDK 21 to build, however, makes use of Gradle's
[Toolchains](https://docs.gradle.org/current/userguide/toolchains.html)
feature to allow building with only JRE 8 or later installed. (Gradle will
automatically provision JDK 16 for compilation if it cannot find an existing
feature to allow building with only JRE 11 or later installed. (Gradle will
automatically provision JDK 21 for compilation if it cannot find an existing
install).
If you're on Windows, check
@@ -42,16 +42,16 @@ If you're compiling with Docker, you can use Adoptium's
[`eclipse-temurin`](https://hub.docker.com/_/eclipse-temurin/) images like so:
```console
# docker run -it -v "$(pwd)":/data --rm eclipse-temurin:16.0.2_7-jdk bash
# docker run -it -v "$(pwd)":/data --rm eclipse-temurin:21.0.3_9-jdk bash
Pulling image...
root@abcdefg1234:/# javac -version
javac 16.0.2
javac 21.0.3
```
## Understanding Patches
Purpur is mostly patches and extensions to Paper/Spigot. These patches/extensions are
Paper is mostly patches and extensions to Spigot. These patches/extensions are
split into different directories which target certain parts of the code. These
directories are:
@@ -66,7 +66,7 @@ Assuming you have already forked the repository:
1. Clone your fork to your local machine;
2. Type `./gradlew applyPatches` in a terminal to apply the changes from upstream.
On Windows, leave out the `./` at the beginning for all `gradlew` commands;
On Windows, replace the `./` with `.\` at the beginning for all `gradlew` commands;
3. cd into `Purpur-Server` for server changes, and `Purpur-API` for API changes.
<!--You can also run `./paper server` or `./paper api` for these same directories
respectively.
@@ -167,7 +167,7 @@ messing with your HEADs.
assist you too.
- Alternatively, if you only know the name of the patch, you can do
`git commit -a --fixup "Subject of Patch name"`.
1. Rebase with autosquash: `git rebase --autosquash -i base`.
1. Rebase with autosquash: `git rebase -i --autosquash base`.
This will automatically move your fixup commit to the right place, and you just
need to "save" the changes.
1. Type `./gradlew rebuildPatches` in the root directory;
@@ -183,7 +183,7 @@ These steps assume the `origin` remote is your fork of this repository and `upst
1. Checkout feature/fix branch and rebase on master: `git checkout patch-branch && git rebase master`.
1. Apply updated patches: `./gradlew applyPatches`.
1. If there are conflicts, fix them.
1. If your PR creates new patches instead of modifying exist ones, in both the `Purpur-Server` and `Purpur-API` directories, ensure your newly-created patch is the last commit by either:
1. If your PR creates new patches instead of modifying existing ones, in both the `Purpur-Server` and `Purpur-API` directories, ensure your newly-created patch is the last commit by either:
* Renaming the patch file with a large 4-digit number in front (e.g. 9999-Patch-to-add-some-new-stuff.patch), and re-applying patches.
* Running `git rebase --interactive base` and moving the commits to the end.
1. Rebuild patches: `./gradlew rebuildPatches`.
@@ -203,37 +203,58 @@ when making and submitting changes.
## Formatting
All modifications to non-Purpur files should be marked.
All modifications to non-Purpur files should be marked. The one exception to this is
when modifying javadoc comments, which should not have these markers.
- Multi-line changes start with `// Purpur start` and end with `// Purpur end`;
- You can put a comment with an explanation if it isn't obvious, like this:
`// Purpur start - reason`.
- You need to add a comment with a short and identifiable description of the patch:
`// Purpur start - <COMMIT DESCRIPTION>`
- The comments should generally be about the reason the change was made, what
it was before, or what the change is.
- Multi-line messages should start with `// Purpur start` and use `/* Multi
line message here */` for the message itself.
- One-line changes should have `// Purpur` or `// Purpur - reason`.
- After the general commit description, you can add additional information either
after a `;` or in the next line.
- Multi-line changes start with `// Purpur start - <COMMIT DESCRIPTION>` and end
with `// Purpur end - <COMMIT DESCRIPTION>`.
- One-line changes should have `// Purpur - <COMMIT DESCRIPTION>` at the end of the line.
Here's an example of how to mark changes by Purpur:
```java
entity.getWorld().dontbeStupid(); // Purpur - was beStupid() which is bad
entity.getWorld().dontBeStupid(); // Purpur - Was beStupid(), which is bad
entity.getFriends().forEach(Entity::explode);
entity.a();
entity.b();
// Purpur start - use plugin-set spawn
entity.updateFriends();
// Purpur start - Use plugin-set spawn
// entity.getWorld().explode(entity.getWorld().getSpawn());
Location spawnLocation = ((CraftWorld)entity.getWorld()).getSpawnLocation();
entity.getWorld().explode(new BlockPosition(spawnLocation.getX(), spawnLocation.getY(), spawnLocation.getZ()));
// Purpur end
// Purpur end - Use plugin-set spawn
```
We generally follow usual Java style (aka. Oracle style), or what is programmed
We generally follow the usual Java style (aka. Oracle style), or what is programmed
into most IDEs and formatters by default. There are a few notes, however:
- It is fine to go over 80 lines as long as it doesn't hurt readability.
There are exceptions, especially in Spigot-related files
- When in doubt or the code around your change is in a clearly different style,
use the same style as the surrounding code.
- `var` usage is heavily discouraged, as it makes reading patch files a lot harder
and can lead to confusion during updates due to changed return types. The only
exception to this is if a line would otherwise be way too long/filled with hard
to parse generics in a case where the base type itself is already obvious
### Imports
When adding new imports to a class in a file not created by the current patch, use the fully qualified class name
instead of adding a new import to the top of the file. If you are using a type a significant number of times, you
can add an import with a comment. However, if its only used a couple of times, the FQN is preferred to prevent future
patch conflicts in the import section of the file.
```java
import org.bukkit.event.Event;
// don't add import here, use FQN like below
public class SomeEvent extends Event {
public final org.bukkit.Location newLocation; // Purpur - add location
}
```
## Patch Notes
@@ -269,7 +290,7 @@ Subject: [PATCH] revert serverside behavior of keepalives
This patch intends to bump up the time that a client has to reply to the
server back to 30 seconds as per pre 1.12.2, which allowed clients
more than enough time to reply, potentially allowing them to be less
more than enough time to reply potentially allowing them to be less
temperamental due to lag spikes on the network thread, e.g. that caused
by plugins that are interacting with netty.
@@ -359,6 +380,12 @@ object:
return this.level.purpurConfig.useInhabitedTime ? this.inhabitedTime : 0;
```
#### Committing changes
All changes to the `PurpurConfig` and `PurpurWorldConfig` files
should be done in the commit that created them. So do an interactive rebase
or fixup to apply just those changes to that commit, then add a new commit
that includes the logic that uses that option in the server somewhere.
## Testing API changes
### Using the Purpur Test Plugin
@@ -401,7 +428,7 @@ patching process.
1. Identify the name(s) of the file(s) you want to import.
- A complete list of all possible file names can be found at
`./Purpur-Server/.gradle/caches/paperweight/mc-dev-sources/net/minecraft/`. You might find
[MiniMappingViewer] useful if you need to translate between Mojang and Spigot mapped names.
[MappingViewer] useful if you need to translate between Mojang and Spigot mapped names.
1. Open the file at `./build-data/dev-imports.txt` and add the name of your file to
the script. Follow the instructions there;
1. Re-patch the server `./gradlew applyPatches`;
@@ -426,16 +453,16 @@ file (`CONTRIBUTING.md`), the `LICENSE.md` file, and so forth.
### Patching and building is *really* slow, what can I do?
This only applies if you're running Windows. If you're running a prior Windows
release, either update to Windows 10 or move to macOS/Linux/BSD.
release, either update to Windows 10/11 or move to macOS/Linux/BSD.
In order to speed up patching process on Windows, it's recommended you get WSL.
In order to speed up patching process on Windows, it's recommended you get WSL
2. This is available in Windows 10 v2004, build 19041 or higher. (You can check
your version by running `winver` in the run window (Windows key + R)). If you're
out of date, update your system with the
[Windows Update Assistant](https://www.microsoft.com/en-us/software-download/windows10).
using an out of date version of Windows 10, update your system with the
[Windows 10 Update Assistant](https://www.microsoft.com/en-us/software-download/windows10) or [Windows 11 Update Assistant](https://www.microsoft.com/en-us/software-download/windows11).
To set up WSL 2, follow the information here:
<https://docs.microsoft.com/en-us/windows/wsl/install-win10>
<https://docs.microsoft.com/en-us/windows/wsl/install>
You will most likely want to use the Ubuntu apps. Once it's set up, install the
required tools with `sudo apt-get update && sudo apt-get install $TOOL_NAMES
@@ -445,6 +472,6 @@ everything like usual.
> ❗ Do not use the `/mnt/` directory in WSL! Instead, mount the WSL directories
> in Windows like described here:
> <https://www.howtogeek.com/426749/how-to-access-your-linux-wsl-files-in-windows-10/>
> <https://docs.microsoft.com/en-us/windows/wsl/filesystems#view-your-current-directory-in-windows-file-explorer>
[MiniMappingViewer]: https://minidigger.github.io/MiniMappingViewer/
[MappingViewer]: https://mappings.cephx.dev/

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2019-2022 PurpurMC
Copyright (c) 2019-2024 PurpurMC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -7,7 +7,7 @@
## Purpur
[![MIT License](https://img.shields.io/github/license/PurpurMC/Purpur?&logo=github)](LICENSE)
[![Build Status](https://img.shields.io/github/actions/workflow/status/PurpurMC/Purpur/build.yml?branch=ver%2F1.20.2&event=push&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9bxSIVh1YQcYhQnSyIiuimVShChVArtOpgcukXNGlIUlwcBdeCgx+LVQcXZ10dXAVB8APE0clJ0UVK/F9SaBHjwXE/3t173L0D/PUyU82OMUDVLCOViAuZ7KrQ9YogwujDEGYkZupzopiE5/i6h4+vdzGe5X3uz9Gj5EwG+ATiWaYbFvEG8dSmpXPeJ46woqQQnxOPGnRB4keuyy6/cS447OeZESOdmieOEAuFNpbbmBUNlXiSOKqoGuX7My4rnLc4q+Uqa96TvzCU01aWuU5zEAksYgkiBMioooQyLMRo1UgxkaL9uId/wPGL5JLJVQIjxwIqUCE5fvA/+N2tmZ8Yd5NCcaDzxbY/hoGuXaBRs+3vY9tunACBZ+BKa/krdWD6k/RaS4seAb3bwMV1S5P3gMsdoP9JlwzJkQI0/fk88H5G35QFwrdA95rbW3Mfpw9AmrpK3gAHh8BIgbLXPd4dbO/t3zPN/n4Ax9dyyerighsAAAAGYktHRAAAAAAAAPlDu38AAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfmCBMWBjFhOpnxAAACyklEQVQ4y32TXWgdZRCGn8k5Z3e/bzcJRFuoDRqIIPGniaSl1qgXKYhiLUgleFESW1qQ4g94oVKQJmga0ILRBuvfheJFIbY3SmzRFsWgQrTQFlRoKSVXgcMxJiS7++1ukvHiNKGU6FzNDO8MMw8zwn9Yz5c6anKeChxiMk599aq8sZ5Obk3sGNd7G5aZCHJ+Oj8gAwD9I3rSJmyvzLHz+HG5frO+vOaNa3NXiUkKQj9hQ1jQgWrlyCCV6gIdtmBjoJwbPqgL+R08PDQkCUADwD0TerqzxFTJY++vz0l7c0q/F7P5+aNUqyvM2CU2RAV7hsek3XPs3/QHF7/YrSfrDVQrxrErdESNNTYByAp3NmWUTYaGGSuho+QltAGYRdqilChMeKbO4Ijang5+CVJmbcr20PG3n9NiY6ZOvCW9ACMHdDLIeDDIqTWmtAQJV6OMyhOTsqWBQQo/hvP7pFcWeDxwtAQxGqbEq3isI7EOjRy3NyuPPHtOur0UXWMQZXgAX78uP3sJpTBmyHfsGDmotdF+rQWObq/gnSCm9PQ3chnA3qgRgL5jmjXlTM/n7Ny8yJXRY2IA3tur0yaHF8blLoAzj2kaNNBpZvk2iGntuiZBHWLOtXJC3hbzV5SxtDq6yZmzCXOrsRezHNa4YBzlKGN6bQXryD96W+4PU14zGbw/oLMf79EPbAI2g7M9+smP3fqPKVAT81LnFWnzM1y9gYC9gWtwTD6MEsq+Y8Lm7DMZ7cZxt5/T5xd8Fy5SfuC6fA4QZjdd8eEX9eLwAZ1StHKiT1MARStnHtWZH7bpjKIVgKutmipq50O94Mr6+9oKR8ekyy7x5qd9/NmYslynK4WfUjWOqiAFgElZmY+41BTzcrAkW9d9ptO9etgU7I8S3vVyDtkY/JzPwoxXzCJjt6Uy+r/fuGq/3affezkPRSniJ0y2zsqT6+n+BfRHKWgwbKNIAAAAAElFTkSuQmCC)](https://purpurmc.org/downloads/)
[![Build Status](https://img.shields.io/github/actions/workflow/status/PurpurMC/Purpur/build.yml?branch=ver%2F1.20.6&event=push&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9bxSIVh1YQcYhQnSyIiuimVShChVArtOpgcukXNGlIUlwcBdeCgx+LVQcXZ10dXAVB8APE0clJ0UVK/F9SaBHjwXE/3t173L0D/PUyU82OMUDVLCOViAuZ7KrQ9YogwujDEGYkZupzopiE5/i6h4+vdzGe5X3uz9Gj5EwG+ATiWaYbFvEG8dSmpXPeJ46woqQQnxOPGnRB4keuyy6/cS447OeZESOdmieOEAuFNpbbmBUNlXiSOKqoGuX7My4rnLc4q+Uqa96TvzCU01aWuU5zEAksYgkiBMioooQyLMRo1UgxkaL9uId/wPGL5JLJVQIjxwIqUCE5fvA/+N2tmZ8Yd5NCcaDzxbY/hoGuXaBRs+3vY9tunACBZ+BKa/krdWD6k/RaS4seAb3bwMV1S5P3gMsdoP9JlwzJkQI0/fk88H5G35QFwrdA95rbW3Mfpw9AmrpK3gAHh8BIgbLXPd4dbO/t3zPN/n4Ax9dyyerighsAAAAGYktHRAAAAAAAAPlDu38AAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfmCBMWBjFhOpnxAAACyklEQVQ4y32TXWgdZRCGn8k5Z3e/bzcJRFuoDRqIIPGniaSl1qgXKYhiLUgleFESW1qQ4g94oVKQJmga0ILRBuvfheJFIbY3SmzRFsWgQrTQFlRoKSVXgcMxJiS7++1ukvHiNKGU6FzNDO8MMw8zwn9Yz5c6anKeChxiMk599aq8sZ5Obk3sGNd7G5aZCHJ+Oj8gAwD9I3rSJmyvzLHz+HG5frO+vOaNa3NXiUkKQj9hQ1jQgWrlyCCV6gIdtmBjoJwbPqgL+R08PDQkCUADwD0TerqzxFTJY++vz0l7c0q/F7P5+aNUqyvM2CU2RAV7hsek3XPs3/QHF7/YrSfrDVQrxrErdESNNTYByAp3NmWUTYaGGSuho+QltAGYRdqilChMeKbO4Ijang5+CVJmbcr20PG3n9NiY6ZOvCW9ACMHdDLIeDDIqTWmtAQJV6OMyhOTsqWBQQo/hvP7pFcWeDxwtAQxGqbEq3isI7EOjRy3NyuPPHtOur0UXWMQZXgAX78uP3sJpTBmyHfsGDmotdF+rQWObq/gnSCm9PQ3chnA3qgRgL5jmjXlTM/n7Ny8yJXRY2IA3tur0yaHF8blLoAzj2kaNNBpZvk2iGntuiZBHWLOtXJC3hbzV5SxtDq6yZmzCXOrsRezHNa4YBzlKGN6bQXryD96W+4PU14zGbw/oLMf79EPbAI2g7M9+smP3fqPKVAT81LnFWnzM1y9gYC9gWtwTD6MEsq+Y8Lm7DMZ7cZxt5/T5xd8Fy5SfuC6fA4QZjdd8eEX9eLwAZ1StHKiT1MARStnHtWZH7bpjKIVgKutmipq50O94Mr6+9oKR8ekyy7x5qd9/NmYslynK4WfUjWOqiAFgElZmY+41BTzcrAkW9d9ptO9etgU7I8S3vVyDtkY/JzPwoxXzCJjt6Uy+r/fuGq/3affezkPRSniJ0y2zsqT6+n+BfRHKWgwbKNIAAAAAElFTkSuQmCC)](https://purpurmc.org/downloads/)
[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/PurpurMC/Purpur?logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9bxSIVh1YQcYhQnSyIiuimVShChVArtOpgcukXNGlIUlwcBdeCgx%2BLVQcXZ10dXAVB8APE0clJ0UVK%2FF9SaBHjwXE%2F3t173L0D%2FPUyU82OMUDVLCOViAuZ7KrQ9YogwujDEGYkZupzopiE5%2Fi6h4%2BvdzGe5X3uz9Gj5EwG%2BATiWaYbFvEG8dSmpXPeJ46woqQQnxOPGnRB4keuyy6%2FcS447OeZESOdmieOEAuFNpbbmBUNlXiSOKqoGuX7My4rnLc4q%2BUqa96TvzCU01aWuU5zEAksYgkiBMioooQyLMRo1UgxkaL9uId%2FwPGL5JLJVQIjxwIqUCE5fvA%2F%2BN2tmZ8Yd5NCcaDzxbY%2FhoGuXaBRs%2B3vY9tunACBZ%2BBKa%2FkrdWD6k%2FRaS4seAb3bwMV1S5P3gMsdoP9JlwzJkQI0%2Ffk88H5G35QFwrdA95rbW3Mfpw9AmrpK3gAHh8BIgbLXPd4dbO%2Ft3zPN%2Fn4Ax9dyyerighsAAAAGYktHRAAAAAAAAPlDu38AAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfmCBMVKAA5pS6%2BAAABlElEQVQ4y82PP2gVQRDGf7N3t%2Bvdixpi0N5OELFKJ1iohBciKlgYJLX6YkBbC0sVooVFBAvBPw%2BFZzrJs7DR2iYHRhBsxNI8VLwUx92MRXJGxKCp9AfL7DfDfPutFO3z5wy5DuRlWU2OvLj7hduLYXh0ZSEkOh4SjUKiBK%2BEZP34Gu%2FtbebLE86Qa8BO4FDwyWmAbPjzMWACiNgEMdun6macwfJ6z2qxZYBI6ndAxR%2BRN%2FL1ZGeXlDqFkm%2Fv33nZjHZ0u2OZrw%2F7pBYf16Re8UEJ8VpNE33fP3BxgX%2BOFOOdtjmuGpoPtT51pNcrMZORx4%2FmslQnslAlWahItymZrz%2Bmqc4%2B2z%2B71BjE5uwesEeQsaLY%2FQp42LrfPUqwy2DNO03ZK9hN4Ehj4IDBjzjKCoC5aMDG9q%2BhBz%2BrWCN3KqptBtG89Xx%2BEWB1%2Bszr8OTBFMgkSLKWQAA%2BVCU3%2BK%2BQb%2B0LB4FLGHmrP39LNv3773Ei9IBphLnVduf4VhM4M9JGqGzc%2F5bYnDsrqlcQloaK0adbNfgOUn6NRlZZ46YAAAAASUVORK5CYII%3D)](https://www.codefactor.io/repository/github/PurpurMC/Purpur)
[![Join us on Discord](https://discord.com/api/guilds/685683385313919172/widget.png?style=shield)](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).
[![Build Status](https://img.shields.io/github/actions/workflow/status/PurpurMC/Purpur/build.yml?branch=ver%2F1.20.2&event=push&label=Downloads&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9bxSIVh1YQcYhQnSyIiuimVShChVArtOpgcukXNGlIUlwcBdeCgx+LVQcXZ10dXAVB8APE0clJ0UVK/F9SaBHjwXE/3t173L0D/PUyU82OMUDVLCOViAuZ7KrQ9YogwujDEGYkZupzopiE5/i6h4+vdzGe5X3uz9Gj5EwG+ATiWaYbFvEG8dSmpXPeJ46woqQQnxOPGnRB4keuyy6/cS447OeZESOdmieOEAuFNpbbmBUNlXiSOKqoGuX7My4rnLc4q+Uqa96TvzCU01aWuU5zEAksYgkiBMioooQyLMRo1UgxkaL9uId/wPGL5JLJVQIjxwIqUCE5fvA/+N2tmZ8Yd5NCcaDzxbY/hoGuXaBRs+3vY9tunACBZ+BKa/krdWD6k/RaS4seAb3bwMV1S5P3gMsdoP9JlwzJkQI0/fk88H5G35QFwrdA95rbW3Mfpw9AmrpK3gAHh8BIgbLXPd4dbO/t3zPN/n4Ax9dyyerighsAAAAGYktHRAAAAAAAAPlDu38AAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfmCBMWBjFhOpnxAAACyklEQVQ4y32TXWgdZRCGn8k5Z3e/bzcJRFuoDRqIIPGniaSl1qgXKYhiLUgleFESW1qQ4g94oVKQJmga0ILRBuvfheJFIbY3SmzRFsWgQrTQFlRoKSVXgcMxJiS7++1ukvHiNKGU6FzNDO8MMw8zwn9Yz5c6anKeChxiMk599aq8sZ5Obk3sGNd7G5aZCHJ+Oj8gAwD9I3rSJmyvzLHz+HG5frO+vOaNa3NXiUkKQj9hQ1jQgWrlyCCV6gIdtmBjoJwbPqgL+R08PDQkCUADwD0TerqzxFTJY++vz0l7c0q/F7P5+aNUqyvM2CU2RAV7hsek3XPs3/QHF7/YrSfrDVQrxrErdESNNTYByAp3NmWUTYaGGSuho+QltAGYRdqilChMeKbO4Ijang5+CVJmbcr20PG3n9NiY6ZOvCW9ACMHdDLIeDDIqTWmtAQJV6OMyhOTsqWBQQo/hvP7pFcWeDxwtAQxGqbEq3isI7EOjRy3NyuPPHtOur0UXWMQZXgAX78uP3sJpTBmyHfsGDmotdF+rQWObq/gnSCm9PQ3chnA3qgRgL5jmjXlTM/n7Ny8yJXRY2IA3tur0yaHF8blLoAzj2kaNNBpZvk2iGntuiZBHWLOtXJC3hbzV5SxtDq6yZmzCXOrsRezHNa4YBzlKGN6bQXryD96W+4PU14zGbw/oLMf79EPbAI2g7M9+smP3fqPKVAT81LnFWnzM1y9gYC9gWtwTD6MEsq+Y8Lm7DMZ7cZxt5/T5xd8Fy5SfuC6fA4QZjdd8eEX9eLwAZ1StHKiT1MARStnHtWZH7bpjKIVgKutmipq50O94Mr6+9oKR8ekyy7x5qd9/NmYslynK4WfUjWOqiAFgElZmY+41BTzcrAkW9d9ptO9etgU7I8S3vVyDtkY/JzPwoxXzCJjt6Uy+r/fuGq/3affezkPRSniJ0y2zsqT6+n+BfRHKWgwbKNIAAAAAElFTkSuQmCC)](https://purpurmc.org/downloads/)
[![Build Status](https://img.shields.io/github/actions/workflow/status/PurpurMC/Purpur/build.yml?branch=ver%2F1.20.6&event=push&label=Downloads&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9bxSIVh1YQcYhQnSyIiuimVShChVArtOpgcukXNGlIUlwcBdeCgx+LVQcXZ10dXAVB8APE0clJ0UVK/F9SaBHjwXE/3t173L0D/PUyU82OMUDVLCOViAuZ7KrQ9YogwujDEGYkZupzopiE5/i6h4+vdzGe5X3uz9Gj5EwG+ATiWaYbFvEG8dSmpXPeJ46woqQQnxOPGnRB4keuyy6/cS447OeZESOdmieOEAuFNpbbmBUNlXiSOKqoGuX7My4rnLc4q+Uqa96TvzCU01aWuU5zEAksYgkiBMioooQyLMRo1UgxkaL9uId/wPGL5JLJVQIjxwIqUCE5fvA/+N2tmZ8Yd5NCcaDzxbY/hoGuXaBRs+3vY9tunACBZ+BKa/krdWD6k/RaS4seAb3bwMV1S5P3gMsdoP9JlwzJkQI0/fk88H5G35QFwrdA95rbW3Mfpw9AmrpK3gAHh8BIgbLXPd4dbO/t3zPN/n4Ax9dyyerighsAAAAGYktHRAAAAAAAAPlDu38AAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfmCBMWBjFhOpnxAAACyklEQVQ4y32TXWgdZRCGn8k5Z3e/bzcJRFuoDRqIIPGniaSl1qgXKYhiLUgleFESW1qQ4g94oVKQJmga0ILRBuvfheJFIbY3SmzRFsWgQrTQFlRoKSVXgcMxJiS7++1ukvHiNKGU6FzNDO8MMw8zwn9Yz5c6anKeChxiMk599aq8sZ5Obk3sGNd7G5aZCHJ+Oj8gAwD9I3rSJmyvzLHz+HG5frO+vOaNa3NXiUkKQj9hQ1jQgWrlyCCV6gIdtmBjoJwbPqgL+R08PDQkCUADwD0TerqzxFTJY++vz0l7c0q/F7P5+aNUqyvM2CU2RAV7hsek3XPs3/QHF7/YrSfrDVQrxrErdESNNTYByAp3NmWUTYaGGSuho+QltAGYRdqilChMeKbO4Ijang5+CVJmbcr20PG3n9NiY6ZOvCW9ACMHdDLIeDDIqTWmtAQJV6OMyhOTsqWBQQo/hvP7pFcWeDxwtAQxGqbEq3isI7EOjRy3NyuPPHtOur0UXWMQZXgAX78uP3sJpTBmyHfsGDmotdF+rQWObq/gnSCm9PQ3chnA3qgRgL5jmjXlTM/n7Ny8yJXRY2IA3tur0yaHF8blLoAzj2kaNNBpZvk2iGntuiZBHWLOtXJC3hbzV5SxtDq6yZmzCXOrsRezHNa4YBzlKGN6bQXryD96W+4PU14zGbw/oLMf79EPbAI2g7M9+smP3fqPKVAT81LnFWnzM1y9gYC9gWtwTD6MEsq+Y8Lm7DMZ7cZxt5/T5xd8Fy5SfuC6fA4QZjdd8eEX9eLwAZ1StHKiT1MARStnHtWZH7bpjKIVgKutmipq50O94Mr6+9oKR8ekyy7x5qd9/NmYslynK4WfUjWOqiAFgElZmY+41BTzcrAkW9d9ptO9etgU7I8S3vVyDtkY/JzPwoxXzCJjt6Uy+r/fuGq/3affezkPRSniJ0y2zsqT6+n+BfRHKWgwbKNIAAAAAElFTkSuQmCC)](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.20.2-R0.1-SNAPSHOT</version>
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
```
@@ -80,7 +80,7 @@ repositories {
```
```kotlin
dependencies {
compileOnly("org.purpurmc.purpur:purpur-api:1.20.2-R0.1-SNAPSHOT")
compileOnly("org.purpurmc.purpur:purpur-api:1.20.5-R0.1-SNAPSHOT")
}
```
@@ -114,7 +114,7 @@ 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`.
**These JARs are not used to start a server.**
To compile a server-ready purpurclip jar, run `./gradlew createReobfPaperclipJar`.
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`.
Special Thanks To:

View File

@@ -4,8 +4,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.5.8"
id("io.papermc.paperweight.patcher") version "1.6.3"
}
allprojects {
@@ -14,7 +13,7 @@ allprojects {
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
languageVersion = JavaLanguageVersion.of(21)
}
}
}
@@ -24,7 +23,7 @@ val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
subprojects {
tasks.withType<JavaCompile>().configureEach {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
options.release = 21
}
tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name()
@@ -43,6 +42,7 @@ subprojects {
repositories {
mavenCentral()
maven(paperMavenPublicUrl)
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") // TODO - Adventure snapshot
maven("https://jitpack.io")
}
}
@@ -57,37 +57,43 @@ repositories {
}
dependencies {
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
remapper("net.fabricmc:tiny-remapper:0.10.1:fat")
decompiler("org.vineflower:vineflower:1.10.1")
paperclip("io.papermc:paperclip:3.0.3")
}
paperweight {
serverProject.set(project(":purpur-server"))
serverProject = project(":purpur-server")
remapRepo.set(paperMavenPublicUrl)
decompileRepo.set(paperMavenPublicUrl)
remapRepo = paperMavenPublicUrl
decompileRepo = paperMavenPublicUrl
usePaperUpstream(providers.gradleProperty("paperCommit")) {
withPaperPatcher {
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("Purpur-API"))
apiPatchDir = layout.projectDirectory.dir("patches/api")
apiOutputDir = layout.projectDirectory.dir("Purpur-API")
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("Purpur-Server"))
serverPatchDir = layout.projectDirectory.dir("patches/server")
serverOutputDir = layout.projectDirectory.dir("Purpur-Server")
}
patchTasks.register("generatedApi") {
isBareDirectory = true
upstreamDirPath = "paper-api-generator/generated"
patchDir = layout.projectDirectory.dir("patches/generated-api")
outputDir = layout.projectDirectory.dir("paper-api-generator/generated")
}
}
}
tasks.generateDevelopmentBundle {
apiCoordinates.set("org.purpurmc.purpur:purpur-api")
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
libraryRepositories.set(
listOf(
"https://repo.maven.apache.org/maven2/",
paperMavenPublicUrl,
"https://repo.purpurmc.org/snapshots",
)
apiCoordinates = "org.purpurmc.purpur:purpur-api"
mojangApiCoordinates = "io.papermc.paper:paper-mojangapi"
libraryRepositories = listOf(
"https://repo.maven.apache.org/maven2/",
paperMavenPublicUrl,
"https://repo.purpurmc.org/snapshots",
"https://s01.oss.sonatype.org/content/repositories/snapshots/", // TODO - Adventure snapshot
)
}

View File

@@ -1,8 +1,8 @@
group = org.purpurmc.purpur
version = 1.20.2-R0.1-SNAPSHOT
version = 1.20.6-R0.1-SNAPSHOT
mcVersion = 1.20.2
paperCommit = 4b0bc74c90582f2d52d720c795228130545cd103
mcVersion = 1.20.6
paperCommit = eee55d019fe80372c2e08ccd1d0a94c066cda926
org.gradle.caching = true
org.gradle.parallel = true

Binary file not shown.

View File

@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

29
gradlew vendored
View File

@@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# 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"'
# 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
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -133,10 +131,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@@ -144,7 +145,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
@@ -152,7 +153,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
@@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# 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, 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" \

20
gradlew.bat vendored
View File

@@ -43,11 +43,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,11 +57,11 @@ 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

View File

@@ -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 8d8fe04e6b09d2a5b1cc05002073df5c58cdcb96..c71576fea7e0e7c3ad54912ed61d1ff20aaea4c2 100644
index 30cbe3bdc7142769019765b03cc4fe1f9ba1ddb4..f5c3c1a0c11dd3518981ce3b86dba8ced8578d9c 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2121,6 +2121,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2257,6 +2257,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
}
// Paper end

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Build System Changes
diff --git a/build.gradle.kts b/build.gradle.kts
index 0330a20576c372c29ca4d98a2bc5b01e28303ac3..67f31886a0e5025c1a66b6fb04b44430a9a103fc 100644
index 65e67b8726f1e19a6bcb1fe2f448e4ab68df11d1..892e78b1d2d29dc54def03fcb6d85a93ad56d84c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -109,6 +109,8 @@ tasks.jar {
@@ -121,6 +121,8 @@ tasks.jar {
}
tasks.withType<Javadoc> {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Purpur client support
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 5c7a73ea74efe256c695080ba92b8cf698e4cd86..776c271631a2cb519d411892715c1dfa57e2489e 100644
index 6c327a07bf8a6aa11a2d7dad12b2830acc539484..d972cb242102a3ee7c017299aed64340628c79d8 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3278,4 +3278,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -3806,4 +3806,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Override
Spigot spigot();
// Spigot end

View File

@@ -4,28 +4,11 @@ Date: Sat, 4 May 2019 00:57:16 -0500
Subject: [PATCH] Ridables
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 0c4dbb9ef63fa8575b5546239443cb2bd91ba847..4160e968e7d7e8e2a953534a981a7330916ece2e 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -198,6 +198,12 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Mob> CLIMB_ON_TOP_OF_POWDER_SNOW = GoalKey.of(Mob.class, NamespacedKey.minecraft("climb_on_top_of_powder_snow"));
GoalKey<Wolf> WOLF_PANIC = GoalKey.of(Wolf.class, NamespacedKey.minecraft("wolf_panic"));
+ // Purpur start
+ GoalKey<Mob> MOB_HAS_RIDER = GoalKey.of(Mob.class, NamespacedKey.minecraft("has_rider"));
+ GoalKey<AbstractHorse> HORSE_HAS_RIDER = GoalKey.of(AbstractHorse.class, NamespacedKey.minecraft("horse_has_rider"));
+ GoalKey<Llama> LLAMA_HAS_RIDER = GoalKey.of(Llama.class, NamespacedKey.minecraft("llama_has_rider"));
+ // Purpur end
+
/**
* @deprecated removed in 1.20.2
*/
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index d340ddcf6924cc834455de3acbbac91ab9c66e39..656ea43ec614e5bf4d3474b9f02dafb970f33656 100644
index 62e3793903905b94eb1a120345015149abb33713..50344412a04f3008439e337ecf9dd09c7f853bc9 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -1065,4 +1065,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@@ -1155,4 +1155,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
@NotNull String getScoreboardEntryName();
// Paper end - entity scoreboard name

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Allow inventory resizing
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java
index cbce826add9dc2b3187c7bea00c27b785d7517df..3a98de6407d9a6307f89c207be1f09e639385ebe 100644
index 59b375569a75cb1e1f7c610f96078e102ec0d3ed..a3f74891abbdc51dbbddaeb511f2754e0603c904 100644
--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java
+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java
@@ -151,7 +151,7 @@ public enum InventoryType {
@@ -166,7 +166,7 @@ public enum InventoryType {
SMITHING_NEW(4, "Upgrade Gear"),
;

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] AFK API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 776c271631a2cb519d411892715c1dfa57e2489e..53f509afb6bd7e8afe2d25ec6de23ece8d1c2c18 100644
index d972cb242102a3ee7c017299aed64340628c79d8..972cca3e02296f94099f965a4f7662ec63a067ea 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3286,5 +3286,24 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -3814,5 +3814,25 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @return True if Player uses Purpur Client
*/
public boolean usesPurpurClient();
@@ -29,6 +29,7 @@ index 776c271631a2cb519d411892715c1dfa57e2489e..53f509afb6bd7e8afe2d25ec6de23ece
+
+ /**
+ * Reset the idle timer back to 0
+ * @deprecated Use {@link #resetIdleDuration()} instead
+ */
+ void resetIdleTimer();
// Purpur end

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Bring back server name
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index f78b5fd3c3347d28da58777bff88903d2eb140f6..7338dad470cd75814cce5be40f82058554484607 100644
index 5d1b55fdbcbe63f6b42b694d05211a3cc691a09d..54f11593f4acfb89623cf1fad58819e001505fd1 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2756,4 +2756,15 @@ public final class Bukkit {
@@ -2910,4 +2910,15 @@ public final class Bukkit {
public static Server.Spigot spigot() {
return server.spigot();
}
@@ -25,10 +25,10 @@ index f78b5fd3c3347d28da58777bff88903d2eb140f6..7338dad470cd75814cce5be40f820585
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index c71576fea7e0e7c3ad54912ed61d1ff20aaea4c2..fc2ff6fce4d7b4466cb7936b530c1c0d17f9f24f 100644
index f5c3c1a0c11dd3518981ce3b86dba8ced8578d9c..1299cab5a4a0a017e0a1b792539d9b6fb8ef6c54 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2416,4 +2416,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2552,4 +2552,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
boolean isOwnedByCurrentRegion(@NotNull Entity entity);
// Paper end - Folia region threading API

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Lagging threshold
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 7338dad470cd75814cce5be40f82058554484607..a32155e0cc63d4e4714a953edbae0b19544ff3ef 100644
index 54f11593f4acfb89623cf1fad58819e001505fd1..215647d7f5cc8487d6a173bc0160fec6db1971eb 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2766,5 +2766,14 @@ public final class Bukkit {
@@ -2920,5 +2920,14 @@ public final class Bukkit {
public static String getServerName() {
return server.getServerName();
}
@@ -24,10 +24,10 @@ index 7338dad470cd75814cce5be40f82058554484607..a32155e0cc63d4e4714a953edbae0b19
// Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index fc2ff6fce4d7b4466cb7936b530c1c0d17f9f24f..5b8ce8a5658021c6fdfeabca6c7bb31ebc58e71d 100644
index 1299cab5a4a0a017e0a1b792539d9b6fb8ef6c54..7f9dc209c88a66bd2ee82cc62b948e827c6b1060 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2424,5 +2424,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2560,5 +2560,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
String getServerName();

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack convenience methods
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 8a948a61d0bdb06b0b9a6eac8a27baeb35a7d36c..f6e0b39ba9ea34613ecb22c55d5c38d5dcad9a82 100644
index 7a337fe908915f8ea487a0b9236c511cb07d5e66..1dd02e2782364bf25521088cf8858d3443643447 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -11050,4 +11050,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@@ -11657,4 +11657,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
public boolean isEnabledByFeature(@NotNull World world) {
return Bukkit.getDataPackManager().isEnabledByFeature(this, world);
}
@@ -50,10 +50,10 @@ index 8a948a61d0bdb06b0b9a6eac8a27baeb35a7d36c..f6e0b39ba9ea34613ecb22c55d5c38d5
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 0af73cc04edb93b9772136d4d808f657ea40e733..c733206b769d7a55076d863757fcac1a129033b7 100644
index 84a7bf0936d35bf42b5ed038d295d5c31740f472..6e9b4cbc81878616b1c48add5db534286d267b05 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -17,6 +17,18 @@ import org.bukkit.inventory.meta.ItemMeta;
@@ -17,6 +17,17 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.material.MaterialData;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -67,15 +67,14 @@ index 0af73cc04edb93b9772136d4d808f657ea40e733..c733206b769d7a55076d863757fcac1a
+import org.bukkit.inventory.meta.Repairable;
+import org.bukkit.persistence.PersistentDataContainer;
+import org.bukkit.persistence.PersistentDataHolder;
+import com.destroystokyo.paper.Namespaced;
+// Purpur end
/**
* Represents a stack of items.
@@ -1005,4 +1017,626 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
return type.isAir() || amount <= 0;
@@ -1073,4 +1084,565 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
return Bukkit.getUnsafe().computeTooltipLines(this, tooltipContext, player);
}
// Paper end
// Paper end - expose itemstack tooltip lines
+
+ // Purpur start
+ /**
@@ -557,67 +556,6 @@ index 0af73cc04edb93b9772136d4d808f657ea40e733..c733206b769d7a55076d863757fcac1a
+ }
+
+ /**
+ * Gets the collection of namespaced keys that the item can destroy in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @return Set of {@link com.destroystokyo.paper.Namespaced}
+ */
+ @NotNull
+ public java.util.Set<Namespaced> getDestroyableKeys() {
+ return getItemMeta().getDestroyableKeys();
+ }
+
+ /**
+ * Sets the collection of namespaced keys that the item can destroy in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @param canDestroy Collection of {@link com.destroystokyo.paper.Namespaced}
+ */
+ public void setDestroyableKeys(@NotNull Collection<Namespaced> canDestroy) {
+ ItemMeta itemMeta = getItemMeta();
+ itemMeta.setDestroyableKeys(canDestroy);
+ setItemMeta(itemMeta);
+ }
+
+ /**
+ * Gets the collection of namespaced keys that the item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @return Set of {@link com.destroystokyo.paper.Namespaced}
+ */
+ @NotNull
+ public java.util.Set<Namespaced> getPlaceableKeys() {
+ return getItemMeta().getPlaceableKeys();
+ }
+
+ /**
+ * Sets the set of namespaced keys that the item can be placed on in {@link org.bukkit.GameMode#ADVENTURE}
+ *
+ * @param canPlaceOn Collection of {@link com.destroystokyo.paper.Namespaced}
+ */
+ @NotNull
+ public void setPlaceableKeys(@NotNull Collection<Namespaced> canPlaceOn) {
+ ItemMeta itemMeta = getItemMeta();
+ itemMeta.setPlaceableKeys(canPlaceOn);
+ setItemMeta(itemMeta);
+ }
+
+ /**
+ * Checks for the existence of any keys that the item can be placed on
+ *
+ * @return true if this item has placeable keys
+ */
+ public boolean hasPlaceableKeys() {
+ return hasItemMeta() && getItemMeta().hasPlaceableKeys();
+ }
+
+ /**
+ * Checks for the existence of any keys that the item can destroy
+ *
+ * @return true if this item has destroyable keys
+ */
+ public boolean hasDestroyableKeys() {
+ return hasItemMeta() && getItemMeta().hasDestroyableKeys();
+ }
+
+ /**
+ * Repairs this item by 1 durability
+ */
+ public void repair() {
@@ -662,7 +600,7 @@ index 0af73cc04edb93b9772136d4d808f657ea40e733..c733206b769d7a55076d863757fcac1a
+ public boolean damage(int amount, boolean ignoreUnbreaking) {
+ Damageable damageable = (Damageable) getItemMeta();
+ if (amount > 0) {
+ int unbreaking = getEnchantLevel(Enchantment.DURABILITY);
+ int unbreaking = getEnchantLevel(Enchantment.UNBREAKING);
+ int reduce = 0;
+ for (int i = 0; unbreaking > 0 && i < amount; ++i) {
+ if (reduceDamage(java.util.concurrent.ThreadLocalRandom.current(), unbreaking)) {

View File

@@ -5,19 +5,20 @@ Subject: [PATCH] LivingEntity#broadcastItemBreak
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index c5dcfd380206603c2979aa02e7094fef27348eab..accefccca9993edd00f72b4e5779fce0b3ee628f 100644
index b777e530122549455dcce6fac8d4a151c1c0af42..aba9952b2256b058eb413ce93f3305c861a200db 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -1207,5 +1207,12 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
* @param safeFallDistance Safe fall distance
@@ -1447,4 +1447,13 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
*/
void setSafeFallDistance(float safeFallDistance);
void setBodyYaw(float bodyYaw);
// Paper end - body yaw API
+
+ // Purpur start
+ /**
+ * Play item break animation for the item in specified equipment slot
+ *
+ * @param slot Equipment slot to play break animation for
+ */
+ void broadcastItemBreak(@NotNull org.bukkit.inventory.EquipmentSlot slot);
// Purpur end
+ // Purpur end
}

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Item entity immunities
diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java
index 58017fce436cdbda255f7172fbdadb726d4b113c..05600fc8bf2a61aca8094029bc4c208a710da952 100644
index bcc6ba95bd21c7972865838c636a03f50b6c1f1a..c3fcd8dd7dbb1e1a18e17c014c1e641149ea5960 100644
--- a/src/main/java/org/bukkit/entity/Item.java
+++ b/src/main/java/org/bukkit/entity/Item.java
@@ -153,4 +153,62 @@ public interface Item extends Entity, io.papermc.paper.entity.Frictional { // Pa

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Add predicate to recipe's ExactChoice ingredient
diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java
index 523818cbb0d6c90481ec97123e7fe0e2ff4eea14..bfeb8171a723d84b94bfaacd8aaf7d4d48ecd051 100644
index db8bcc66bdc4bedfffb4705db6338eda4c0ad29a..feda3ddfaaf37b6ee218a0e0b1fbc199899bd364 100644
--- a/src/main/java/org/bukkit/inventory/RecipeChoice.java
+++ b/src/main/java/org/bukkit/inventory/RecipeChoice.java
@@ -10,6 +10,7 @@ import java.util.function.Predicate;

View File

@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Tue, 8 Dec 2020 17:15:15 -0500
Subject: [PATCH] Rabid Wolf API
diff --git a/src/main/java/org/bukkit/entity/Wolf.java b/src/main/java/org/bukkit/entity/Wolf.java
index 4b84c04675775e2a606630b00de8afe51665cebc..ccbaf40a3131f477b4be2264401ad893725c1162 100644
--- a/src/main/java/org/bukkit/entity/Wolf.java
+++ b/src/main/java/org/bukkit/entity/Wolf.java
@@ -112,4 +112,20 @@ public interface Wolf extends Tameable, Sittable, io.papermc.paper.entity.Collar
return variant;
}
}
+
+ // Purpur start
+ /**
+ * Checks if this wolf is rabid
+ *
+ * @return whether the wolf is rabid
+ */
+ public boolean isRabid();
+
+ /**
+ * Sets this wolf to be rabid or not
+ *
+ * @param rabid whether the wolf should be rabid
+ */
+ public void setRabid(boolean rabid);
+ // Purpur end
}

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] API for any mob to burn daylight
Co-authored by: Encode42 <me@encode42.dev>
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 656ea43ec614e5bf4d3474b9f02dafb970f33656..ee3ca27a5406024ed71cce14b0891266b64e6fdf 100644
index 50344412a04f3008439e337ecf9dd09c7f853bc9..f482467ae784b134da97eb38afb7f12585520297 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -1095,5 +1095,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@@ -1185,5 +1185,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
* @return True if ridable in water
*/
boolean isRidableInWater();
@@ -23,10 +23,10 @@ index 656ea43ec614e5bf4d3474b9f02dafb970f33656..ee3ca27a5406024ed71cce14b0891266
// Purpur end
}
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index accefccca9993edd00f72b4e5779fce0b3ee628f..994e026d68fcda9a4c34a8b161a06623f4437dff 100644
index aba9952b2256b058eb413ce93f3305c861a200db..61a046584acf48693489ff551a0dd4c4b16af9ff 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -1214,5 +1214,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
@@ -1455,5 +1455,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
* @param slot Equipment slot to play break animation for
*/
void broadcastItemBreak(@NotNull org.bukkit.inventory.EquipmentSlot slot);

View File

@@ -1,43 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Tue, 8 Dec 2020 17:15:15 -0500
Subject: [PATCH] Rabid Wolf API
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index ce2eb58b86cd638d91f2bf9a8da60db499685fc9..8671b9042df2e219921615144a6ca868fa346d77 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -206,6 +206,7 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Phantom> ORBIT_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("orbit_crystal"));
GoalKey<Drowned> DROWNED_ATTACK_VILLAGER = GoalKey.of(Drowned.class, NamespacedKey.minecraft("drowned_attack_villager"));
GoalKey<Zombie> ZOMBIE_ATTACK_VILLAGER = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack_villager"));
+ GoalKey<Wolf> AVOID_RABID_WOLF = GoalKey.of(Wolf.class, NamespacedKey.minecraft("avoid_rabid_wolf"));
// Purpur end
/**
diff --git a/src/main/java/org/bukkit/entity/Wolf.java b/src/main/java/org/bukkit/entity/Wolf.java
index 84db38388bf7a58e66d6cd29620b4fe64b0a897e..82ebd99549ce9f9e6427a50cef424e9007735708 100644
--- a/src/main/java/org/bukkit/entity/Wolf.java
+++ b/src/main/java/org/bukkit/entity/Wolf.java
@@ -69,4 +69,20 @@ public interface Wolf extends Tameable, Sittable, io.papermc.paper.entity.Collar
* @param interested Whether the wolf is interested
*/
public void setInterested(boolean interested);
+
+ // Purpur start
+ /**
+ * Checks if this wolf is rabid
+ *
+ * @return whether the wolf is rabid
+ */
+ public boolean isRabid();
+
+ /**
+ * Sets this wolf to be rabid or not
+ *
+ * @param rabid whether the wolf should be rabid
+ */
+ public void setRabid(boolean rabid);
+ // Purpur end
}

View File

@@ -5,13 +5,13 @@ Subject: [PATCH] Extended OfflinePlayer API
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
index bce07d84cafca677bb6fad78c21b82097f06430c..4ef0fa4f1ef72bb784674671473c6a322acadecc 100644
index 30298a629b39bd43ce14b414fc697b2dfcbea89c..ce00af9121de7a910aaea4e0685a06d4cf31b4e3 100644
--- a/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
@@ -522,4 +522,114 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
@@ -557,4 +557,106 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
*/
@Nullable
public Location getLastDeathLocation();
public Location getLocation();
+
+ // Purpur start - OfflinePlayer API
+ /**
@@ -79,14 +79,6 @@ index bce07d84cafca677bb6fad78c21b82097f06430c..4ef0fa4f1ef72bb784674671473c6a32
+ public float getWalkSpeed();
+
+ /**
+ * Gets the entity's current position
+ *
+ * @return a new copy of Location containing the position of this offline player
+ */
+ @Nullable
+ public Location getLocation();
+
+ /**
+ * Sets OfflinePlayer's location. If player is online, it falls back to the Player#teleport implementation.
+ *
+ * @param destination

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Added the ability to add combustible items
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index a32155e0cc63d4e4714a953edbae0b19544ff3ef..222dcb75a850d224ac22b2e06895233527cffc76 100644
index 215647d7f5cc8487d6a173bc0160fec6db1971eb..7bc4e5e9947ab646707a5c0b39c70c0cc6606bd8 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2775,5 +2775,24 @@ public final class Bukkit {
@@ -2929,5 +2929,24 @@ public final class Bukkit {
public static boolean isLagging() {
return server.isLagging();
}
@@ -34,10 +34,10 @@ index a32155e0cc63d4e4714a953edbae0b19544ff3ef..222dcb75a850d224ac22b2e068952335
// Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 5b8ce8a5658021c6fdfeabca6c7bb31ebc58e71d..3bc9fa8b68b284516ddbf0ace0c1dc52768307cb 100644
index 7f9dc209c88a66bd2ee82cc62b948e827c6b1060..fa926319ff033768d78508491e072efec1dcbc9f 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2431,5 +2431,20 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2567,5 +2567,20 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return True if lagging
*/
boolean isLagging();

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add local difficulty api
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 8d861f5522a33669f67b3e41dfbc5234637114b4..d12443e6e1f71354dcfab9cf2f166a1097b589b5 100644
index 97f97ea5c6aa513c439f86a9c82821e0f7d9cd1e..099516b90c504205b894b387542221e8c0c98b40 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -4010,6 +4010,16 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -4249,6 +4249,16 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@Nullable
public DragonBattle getEnderDragonBattle();

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Debug Marker API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 222dcb75a850d224ac22b2e06895233527cffc76..584e3b08935f43beb27f478cc72229b6a5f40689 100644
index 7bc4e5e9947ab646707a5c0b39c70c0cc6606bd8..70ef8f63ab79e102cb4326c21cc344488f4fbdd3 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2794,5 +2794,89 @@ public final class Bukkit {
@@ -2948,5 +2948,89 @@ public final class Bukkit {
public static void removeFuel(@NotNull Material material) {
server.removeFuel(material);
}
@@ -99,10 +99,10 @@ index 222dcb75a850d224ac22b2e06895233527cffc76..584e3b08935f43beb27f478cc72229b6
// Purpur end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 3bc9fa8b68b284516ddbf0ace0c1dc52768307cb..aaef58468a3c31f35e5067ed4263e9dd3fbddddd 100644
index fa926319ff033768d78508491e072efec1dcbc9f..320422ff95773efa01e8205edcc5c6c9a84d5ecd 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2446,5 +2446,75 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2582,5 +2582,75 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param material The material that will no longer be a fuel
*/
public void removeFuel(@NotNull Material material);
@@ -179,10 +179,10 @@ index 3bc9fa8b68b284516ddbf0ace0c1dc52768307cb..aaef58468a3c31f35e5067ed4263e9dd
// Purpur end
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index d12443e6e1f71354dcfab9cf2f166a1097b589b5..9a1526d3da2052815404328c2022119b98db7aa4 100644
index 099516b90c504205b894b387542221e8c0c98b40..83a5b68c785a88594e6e3824ed282844086f7f1a 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -4018,6 +4018,76 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -4257,6 +4257,76 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @return The local difficulty
*/
public float getLocalDifficultyAt(@NotNull Location location);
@@ -260,11 +260,11 @@ index d12443e6e1f71354dcfab9cf2f166a1097b589b5..9a1526d3da2052815404328c2022119b
/**
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index c2ab25febe558b9653cd740c477dfd7ffd9b0318..b72415a388862736af005bb2bf8d283bacfb90d9 100644
index 972cca3e02296f94099f965a4f7662ec63a067ea..ec49be86fa9b2612ae2853f06f503bffa3a1271d 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3305,5 +3305,75 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* Reset the idle timer back to 0
@@ -3834,5 +3834,75 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @deprecated Use {@link #resetIdleDuration()} instead
*/
void resetIdleTimer();
+

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add death screen API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 460b8d831049e1bff94b87eaeeabb38e2cc3462e..b9a2001eaf83ab3445f3e44631c60705ac858b98 100644
index ec49be86fa9b2612ae2853f06f503bffa3a1271d..d057743b8f6a463434c1f76398c7a98614b19d47 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3375,5 +3375,25 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -3904,5 +3904,25 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* Clears all debug block highlights
*/
void clearBlockHighlights();

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Add log suppression for LibraryLoader
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index 301e82369603f3dd6e6c1bd380da4bacacd7ef6c..0c6ca7588fb3d6b6497ddf032fe75e5c6c9719e5 100644
index eaefbb00e9993d54906cc8cf35cf753c0d6c7707..f1e58639213be0c43cd2ff090b625e7d0a67e8be 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -55,6 +55,7 @@ public final class JavaPluginLoader implements PluginLoader {
@@ -17,10 +17,10 @@ index 301e82369603f3dd6e6c1bd380da4bacacd7ef6c..0c6ca7588fb3d6b6497ddf032fe75e5c
/**
* This class was not meant to be constructed explicitly
diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
index e4b6f278a811acbb0070e311c5c3bdaff7b00474..ee83ecb054099cb85168a9499dfe967a0a9ec796 100644
index 8e1b6be2462aaa692efa1f72986921a6dc357196..b6e18b12fd4d61ce92203582906d24b4d14e6cc5 100644
--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
@@ -65,6 +65,7 @@ public class LibraryLoader
@@ -68,6 +68,7 @@ public class LibraryLoader
@Override
public void transferStarted(@NotNull TransferEvent event) throws TransferCancelledException
{
@@ -28,7 +28,7 @@ index e4b6f278a811acbb0070e311c5c3bdaff7b00474..ee83ecb054099cb85168a9499dfe967a
logger.log( Level.INFO, "Downloading {0}", event.getResource().getRepositoryUrl() + event.getResource().getResourceName() );
}
} );
@@ -80,6 +81,7 @@ public class LibraryLoader
@@ -88,6 +89,7 @@ public class LibraryLoader
{
return null;
}
@@ -36,7 +36,7 @@ index e4b6f278a811acbb0070e311c5c3bdaff7b00474..ee83ecb054099cb85168a9499dfe967a
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
@@ -118,6 +120,7 @@ public class LibraryLoader
@@ -135,6 +137,7 @@ public class LibraryLoader
}
jarFiles.add( url );

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Fire Immunity API
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index ee3ca27a5406024ed71cce14b0891266b64e6fdf..f21a0fa8420b3fd0a3655a0af998da8f8a66c4b1 100644
index f482467ae784b134da97eb38afb7f12585520297..07b8c0dd049ff783fd2e408be634642479bf8b1e 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -1102,5 +1102,18 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@@ -1192,5 +1192,18 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
* @return True if in daylight
*/
boolean isInDaylight();

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] Add PreExplodeEvents
diff --git a/src/main/java/org/purpurmc/purpur/event/PreBlockExplodeEvent.java b/src/main/java/org/purpurmc/purpur/event/PreBlockExplodeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..32602b398ede24a35ed8a996faa2b23455615a7b
index 0000000000000000000000000000000000000000..8ea97ddceedb7c719e8a50a0dd8f3f0919ca1647
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/event/PreBlockExplodeEvent.java
@@ -0,0 +1,54 @@
@@ -0,0 +1,53 @@
+package org.purpurmc.purpur.event;
+
+import org.bukkit.block.Block;
@@ -18,7 +18,6 @@ index 0000000000000000000000000000000000000000..32602b398ede24a35ed8a996faa2b234
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockExplodeEvent;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import java.util.Collections;
+
+/**
@@ -29,8 +28,8 @@ index 0000000000000000000000000000000000000000..32602b398ede24a35ed8a996faa2b234
+ private boolean cancelled;
+ private final float yield;
+
+ public PreBlockExplodeEvent(@NotNull final Block what, final float yield, @Nullable BlockState explodedBlockState) {
+ super(what, Collections.emptyList(), yield, explodedBlockState);
+ public PreBlockExplodeEvent(@NotNull final Block what, final float yield, @NotNull BlockState explodedBlockState) {
+ super(what, explodedBlockState, Collections.emptyList(), yield);
+ this.yield = yield;
+ this.cancelled = false;
+ }

View File

@@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: granny <contact@granny.dev>
Date: Sun, 11 Feb 2024 23:07:47 -0800
Subject: [PATCH] Stonecutter damage
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
index 446b3ffd5caca5344be1c250475679834cd0d4a2..3da8d3d8925cd7a111c0c357bceecfd3a801c8eb 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
@@ -303,7 +303,8 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
WORLD_BORDER,
/**
* Damage caused when an entity contacts a block such as a Cactus,
- * Dripstone (Stalagmite) or Berry Bush.
+ * Dripstone (Stalagmite) or Berry Bush. (Stonecutters too if you
+ * have the Stonecutter damage Purpur feature enabled)
* <p>
* Damage: variable
*/

View File

@@ -5,27 +5,31 @@ Subject: [PATCH] LivingEntity safeFallDistance
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 19e58e62ae442ef9be02ca7fa2f55e370a54afa4..c5dcfd380206603c2979aa02e7094fef27348eab 100644
index b777e530122549455dcce6fac8d4a151c1c0af42..57a3e330043077f042a284c99e2631e1582cb32c 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -1192,4 +1192,20 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
@@ -1447,4 +1447,24 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
*/
void setBodyYaw(float bodyYaw);
// Paper end
// Paper end - body yaw API
+
+ // Purpur start
+ /**
+ * Gets the distance (in blocks) this entity can safely fall without taking damage
+ *
+ * @return Safe fall distance
+ * @deprecated use {@link org.bukkit.attribute.Attribute#GENERIC_SAFE_FALL_DISTANCE} instead
+ */
+ @Deprecated
+ float getSafeFallDistance();
+
+ /**
+ * Set the distance (in blocks) this entity can safely fall without taking damage
+ *
+ * @param safeFallDistance Safe fall distance
+ * @deprecated use {@link org.bukkit.attribute.Attribute#GENERIC_SAFE_FALL_DISTANCE} instead
+ */
+ @Deprecated
+ void setSafeFallDistance(float safeFallDistance);
+ // Purpur end
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Potion NamespacedKey
diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java
index 037af5fd6d71a526c0e6620f2db0cd6df9625261..939ed1931492854c5854cab06730cf235eba7e89 100644
index c8ab330ef171795d08fa201cf8320703c7f1c66b..93e2ea220dc03c122f82af65d5e9fda5b582290c 100644
--- a/src/main/java/org/bukkit/potion/PotionEffect.java
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java
@@ -32,12 +32,14 @@ public class PotionEffect implements ConfigurationSerializable {
@@ -33,6 +33,7 @@ public class PotionEffect implements ConfigurationSerializable {
private static final String AMBIENT = "ambient";
private static final String PARTICLES = "has-particles";
private static final String ICON = "has-icon";
@@ -16,34 +16,46 @@ index 037af5fd6d71a526c0e6620f2db0cd6df9625261..939ed1931492854c5854cab06730cf23
private final int amplifier;
private final int duration;
private final PotionEffectType type;
private final boolean ambient;
@@ -40,6 +41,7 @@ public class PotionEffect implements ConfigurationSerializable {
private final boolean particles;
private final boolean icon;
private final PotionEffect hiddenEffect; // Paper
+ @Nullable private final NamespacedKey key; // Purpur
/**
* Creates a potion effect.
@@ -50,6 +52,36 @@ public class PotionEffect implements ConfigurationSerializable {
@@ -50,11 +52,12 @@ public class PotionEffect implements ConfigurationSerializable {
* @param ambient the ambient status, see {@link PotionEffect#isAmbient()}
* @param particles the particle status, see {@link PotionEffect#hasParticles()}
* @param icon the icon status, see {@link PotionEffect#hasIcon()}
+ * @param key the namespacedKey, see {@link PotionEffect#getKey()}
* @param hiddenEffect the hidden PotionEffect
* @hidden Internal-- hidden effects are only shown internally
*/
@org.jetbrains.annotations.ApiStatus.Internal // Paper
- public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon, @Nullable PotionEffect hiddenEffect) { // Paper
+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon, @Nullable PotionEffect hiddenEffect, @Nullable NamespacedKey key) { // Paper // Purpur
Preconditions.checkArgument(type != null, "effect type cannot be null");
this.type = type;
this.duration = duration;
@@ -62,6 +65,7 @@ public class PotionEffect implements ConfigurationSerializable {
this.ambient = ambient;
this.particles = particles;
this.icon = icon;
+ this.key = key; // Purpur
// Paper start
this.hiddenEffect = hiddenEffect;
}
@@ -77,10 +81,27 @@ public class PotionEffect implements ConfigurationSerializable {
* @param icon the icon status, see {@link PotionEffect#hasIcon()}
*/
public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) {
+ // Purpur start
+ this(type, duration, amplifier, ambient, particles, icon, null);
+ }
+
+ /**
+ * Create a potion effect.
+ * @param duration measured in ticks, see {@link
+ * PotionEffect#getDuration()}
+ * @param amplifier the amplifier, see {@link PotionEffect#getAmplifier()}
+ * @param ambient the ambient status, see {@link PotionEffect#isAmbient()}
+ * @param particles the particle status, see {@link PotionEffect#hasParticles()}
+ * @param key the namespacedKey, see {@link PotionEffect#getKey()}
+ */
+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, @Nullable NamespacedKey key) {
+ this(type, duration, amplifier, ambient, particles, particles, key);
+ }
+
- this(type, duration, amplifier, ambient, particles, icon, null);
+ this(type, duration, amplifier, ambient, particles, icon, null, null); // Purpur
// Paper end
}
+ // Purpur start
+ /**
+ * Creates a potion effect.
+ * @param type effect type
@@ -56,24 +68,19 @@ index 037af5fd6d71a526c0e6620f2db0cd6df9625261..939ed1931492854c5854cab06730cf23
+ * @param key the namespacedKey, see {@link PotionEffect#getKey()}
+ */
+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon, @Nullable NamespacedKey key) {
+ // Purpur end
Preconditions.checkArgument(type != null, "effect type cannot be null");
this.type = type;
this.duration = duration;
@@ -57,6 +89,7 @@ public class PotionEffect implements ConfigurationSerializable {
this.ambient = ambient;
this.particles = particles;
this.icon = icon;
+ this.key = key; // Purpur - add key
}
+ this(type, duration, amplifier, ambient, particles, icon, null, key);
+ }
+ // Purpur end
+
/**
@@ -104,36 +137,43 @@ public class PotionEffect implements ConfigurationSerializable {
* Creates a potion effect with no defined color.
*
@@ -126,33 +147,33 @@ public class PotionEffect implements ConfigurationSerializable {
* @param map the map to deserialize from
*/
public PotionEffect(@NotNull Map<String, Object> map) {
- this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)));
+ this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)), getKey(map)); // Purpur - getKey
- this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)), (PotionEffect) map.get(HIDDEN_EFFECT)); // Paper
+ this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)), (PotionEffect) map.get(HIDDEN_EFFECT), getKey(map)); // Paper // Purpur - getKey
}
// Paper start
@@ -107,6 +114,10 @@ index 037af5fd6d71a526c0e6620f2db0cd6df9625261..939ed1931492854c5854cab06730cf23
- return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon, key); // Purpur - add key
}
/**
@@ -169,6 +190,13 @@ public class PotionEffect implements ConfigurationSerializable {
}
// Paper end
+ // Purpur start
@@ -119,7 +130,7 @@ index 037af5fd6d71a526c0e6620f2db0cd6df9625261..939ed1931492854c5854cab06730cf23
@NotNull
private static PotionEffectType getEffectType(@NotNull Map<?, ?> map) {
PotionEffectType effect;
@@ -166,17 +206,33 @@ public class PotionEffect implements ConfigurationSerializable {
@@ -201,6 +229,17 @@ public class PotionEffect implements ConfigurationSerializable {
return def;
}
@@ -137,35 +148,28 @@ index 037af5fd6d71a526c0e6620f2db0cd6df9625261..939ed1931492854c5854cab06730cf23
@Override
@NotNull
public Map<String, Object> serialize() {
- return ImmutableMap.<String, Object>builder()
+ // Purpur start - add key, don't serialize if null.
+ ImmutableMap.Builder<String, Object> builder = ImmutableMap.<String, Object>builder()
.put(TYPE, type.getKey().toString())
.put(DURATION, duration)
.put(AMPLIFIER, amplifier)
.put(AMBIENT, ambient)
.put(PARTICLES, particles)
- .put(ICON, icon)
- .build();
+ .put(ICON, icon);
+ if(key != null) {
@@ -215,6 +254,11 @@ public class PotionEffect implements ConfigurationSerializable {
if (this.hiddenEffect != null) {
builder.put(HIDDEN_EFFECT, this.hiddenEffect);
}
+ // Purpur start
+ if (key != null) {
+ builder.put(KEY, key.toString());
+ }
+ return builder.build();
+ // Purpur end
return builder.build();
// Paper end
}
/**
@@ -200,7 +256,7 @@ public class PotionEffect implements ConfigurationSerializable {
@@ -243,7 +287,7 @@ public class PotionEffect implements ConfigurationSerializable {
return false;
}
PotionEffect that = (PotionEffect) obj;
- return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon;
+ return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon && this.key == that.key; // Purpur - add key
- return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon && java.util.Objects.equals(this.hiddenEffect, that.hiddenEffect); // Paper
+ return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon && java.util.Objects.equals(this.hiddenEffect, that.hiddenEffect) && this.key == that.key; // Paper // Purpur - add key
}
/**
@@ -296,6 +352,24 @@ public class PotionEffect implements ConfigurationSerializable {
@@ -339,6 +383,24 @@ public class PotionEffect implements ConfigurationSerializable {
return icon;
}
@@ -190,11 +194,11 @@ index 037af5fd6d71a526c0e6620f2db0cd6df9625261..939ed1931492854c5854cab06730cf23
@Override
public int hashCode() {
int hash = 1;
@@ -310,6 +384,6 @@ public class PotionEffect implements ConfigurationSerializable {
@@ -354,6 +416,6 @@ public class PotionEffect implements ConfigurationSerializable {
@Override
public String toString() {
- return type.getName() + (ambient ? ":(" : ":") + duration + "t-x" + amplifier + (ambient ? ")" : "");
+ return type.getName() + (ambient ? ":(" : ":") + duration + "t-x" + amplifier + (ambient ? ")" : "") + (hasKey() ? "(" + key + ")" : ""); // Purpur - add key if not null
- return "PotionEffect{" + "amplifier=" + amplifier + ", duration=" + duration + ", type=" + type + ", ambient=" + ambient + ", particles=" + particles + ", icon=" + icon + ", hiddenEffect=" + hiddenEffect + '}'; // Paper
+ return "PotionEffect{" + "amplifier=" + amplifier + ", duration=" + duration + ", type=" + type + ", ambient=" + ambient + ", particles=" + particles + ", icon=" + icon + ", hiddenEffect=" + hiddenEffect + ", key=" + key + '}'; // Paper // Purpur - add key
}
}

View File

@@ -5,13 +5,13 @@ Subject: [PATCH] Add hover lines API
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
index ab73893656932f54009340df59293df2a732be51..9448709716e0b91dd9e2c7ff4060ec0d33d77d24 100644
index 98a970a6582dca22e719a31559c7becea4725cb2..1cd2962ceb4fa0a0a3e28a09fa4ccef5802cd5c4 100644
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
@@ -298,4 +298,14 @@ public interface ItemFactory {
@Deprecated
net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @NotNull net.md_5.bungee.api.chat.BaseComponent[] customName);
// Paper end - bungee hover events
@@ -353,4 +353,14 @@ public interface ItemFactory {
*/
@NotNull ItemStack enchantWithLevels(@NotNull ItemStack itemStack, @org.jetbrains.annotations.Range(from = 1, to = 30) int levels, boolean allowTreasure, @NotNull java.util.Random random);
// Paper end - enchantWithLevels API
+
+ // Purpur start
+ /**
@@ -24,10 +24,10 @@ index ab73893656932f54009340df59293df2a732be51..9448709716e0b91dd9e2c7ff4060ec0d
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index c733206b769d7a55076d863757fcac1a129033b7..ed168cba3692f55ac976c6ef31525e83ae36f5f9 100644
index 6e9b4cbc81878616b1c48add5db534286d267b05..e497575b2f44bb8b3bb6fdda3ae2f5247cbb4679 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -1638,5 +1638,14 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
@@ -1644,5 +1644,14 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
}
return random.nextInt(unbreaking + 1) > 0;
}

View File

@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 5 May 2019 12:58:45 -0500
Subject: [PATCH] LivingEntity safeFallDistance
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index aa351df679f300018367244c7ccb3e5a59e9276f..39c2a9f732b8e2452fd2dca07193a173d0c2ba1c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1173,4 +1173,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().setYBodyRot(bodyYaw);
}
// Paper end - body yaw API
+
+ // Purpur start
+ @Override
+ public float getSafeFallDistance() {
+ return (float) getHandle().getAttributeValue(Attributes.SAFE_FALL_DISTANCE);
+ }
+
+ @Override
+ public void setSafeFallDistance(float safeFallDistance) {
+ getHandle().getAttribute(Attributes.SAFE_FALL_DISTANCE).setBaseValue(safeFallDistance);
+ }
+ // Purpur end
}

View File

@@ -0,0 +1,223 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Racci <tangentmoons@gmail.com>
Date: Sat, 4 Dec 2021 00:07:05 +1100
Subject: [PATCH] Potion NamespacedKey
diff --git a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
index 32cf6ea96aaa2e6bd0cc28fa88492ceea3d34052..9787dd4fc6ca2ed8aba3db7674ad2dc26a529a7a 100644
--- a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
+++ b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
@@ -53,6 +53,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
private boolean showIcon;
@Nullable
public MobEffectInstance hiddenEffect;
+ private org.bukkit.NamespacedKey key; // Purpur - add key
private final MobEffectInstance.BlendState blendState = new MobEffectInstance.BlendState();
public MobEffectInstance(Holder<MobEffect> effect) {
@@ -71,8 +72,14 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
this(effect, duration, amplifier, ambient, visible, visible);
}
+ // Purpur start
+ public MobEffectInstance(Holder<MobEffect> effect, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable org.bukkit.NamespacedKey key) {
+ this(effect, duration, amplifier, ambient, showParticles, showIcon, null, key);
+ // Purpur end
+ }
+
public MobEffectInstance(Holder<MobEffect> effect, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon) {
- this(effect, duration, amplifier, ambient, showParticles, showIcon, null);
+ this(effect, duration, amplifier, ambient, showParticles, showIcon, null, null); // Purpur
}
public MobEffectInstance(
@@ -82,7 +89,8 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
boolean ambient,
boolean showParticles,
boolean showIcon,
- @Nullable MobEffectInstance hiddenEffect
+ @Nullable MobEffectInstance hiddenEffect,
+ @Nullable org.bukkit.NamespacedKey key // Purpur
) {
this.effect = effect;
this.duration = duration;
@@ -90,6 +98,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
this.ambient = ambient;
this.visible = showParticles;
this.showIcon = showIcon;
+ this.key = key; // Purpur - add key
this.hiddenEffect = hiddenEffect;
}
@@ -135,6 +144,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
this.ambient = that.ambient;
this.visible = that.visible;
this.showIcon = that.showIcon;
+ this.key = that.key; // Purpur - add key
}
public boolean update(MobEffectInstance that) {
@@ -179,6 +189,13 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
bl = true;
}
+ // Purpur start
+ if (that.key != this.key) {
+ this.key = that.key;
+ bl = true;
+ }
+ // Purpur end
+
return bl;
}
@@ -222,6 +239,17 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
return this.showIcon;
}
+ // Purpur start
+ public boolean hasKey() {
+ return this.key != null;
+ }
+
+ @Nullable
+ public org.bukkit.NamespacedKey getKey() {
+ return this.key;
+ }
+ // Purpur end
+
public boolean tick(LivingEntity entity, Runnable overwriteCallback) {
if (this.hasRemainingDuration()) {
int i = this.isInfiniteDuration() ? entity.tickCount : this.duration;
@@ -286,6 +314,12 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
string = string + ", Show Icon: false";
}
+ // Purpur start
+ if (this.hasKey()) {
+ string = string + ", Key: " + this.key;
+ }
+ // Purpur end
+
return string;
}
@@ -300,6 +334,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
&& this.duration == mobEffectInstance.duration
&& this.amplifier == mobEffectInstance.amplifier
&& this.ambient == mobEffectInstance.ambient
+ && this.key == mobEffectInstance.key // Purpur - add key
&& this.effect.equals(mobEffectInstance.effect);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
index 4a9e6a679530025caa710a152c5249299ceffdf9..ea4f3f606aad69965384c73eb1273ed0644297b8 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
@@ -42,6 +42,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
static final ItemMetaKey POTION_EFFECTS = new ItemMetaKey("custom-effects");
static final ItemMetaKey POTION_COLOR = new ItemMetaKey("custom-color");
static final ItemMetaKey DEFAULT_POTION = new ItemMetaKey("potion-type");
+ static final ItemMetaKey KEY = new ItemMetaKey("key", "namespacedkey"); // Purpur - add key
private PotionType type;
private List<PotionEffect> customEffects;
@@ -91,7 +92,13 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
boolean ambient = effect.isAmbient();
boolean particles = effect.isVisible();
boolean icon = effect.showIcon();
- this.customEffects.add(new PotionEffect(type, duration, amp, ambient, particles, icon));
+ // Purpur start
+ NamespacedKey key = null;
+ if (tag.contains(CraftMetaPotion.KEY.NBT)) {
+ key = NamespacedKey.fromString(effect.getString(CraftMetaPotion.KEY.NBT));
+ }
+ this.customEffects.add(new PotionEffect(type, duration, amp, ambient, particles, icon, key));
+ // Purpur end
}
});
}
@@ -130,6 +137,11 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
if (this.customEffects != null) {
for (PotionEffect effect : this.customEffects) {
effectList.add(new MobEffectInstance(CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()));
+ // Purpur start
+ if (effect.hasKey()) {
+ effectData.putString(CraftMetaPotion.KEY.NBT, effect.getKey().toString());
+ }
+ // Purpur end
}
}
@@ -196,7 +208,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
if (index != -1) {
if (overwrite) {
PotionEffect old = this.customEffects.get(index);
- if (old.getAmplifier() == effect.getAmplifier() && old.getDuration() == effect.getDuration() && old.isAmbient() == effect.isAmbient()) {
+ if (old.getAmplifier() == effect.getAmplifier() && old.getDuration() == effect.getDuration() && old.isAmbient() == effect.isAmbient() && old.getKey() == effect.getKey()) { // Purpur - add key
return false;
}
this.customEffects.set(index, effect);
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
index 14c58cf8d255c51473fd3d0092faeaf5a3c1ae0c..3ee9c14440046872b83de628b7f460d0782e9315 100644
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
@@ -11,7 +11,7 @@ public class CraftPotionUtil {
public static MobEffectInstance fromBukkit(PotionEffect effect) {
Holder<MobEffect> type = CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType());
// Paper - Note: do not copy over the hidden effect, as this method is only used for applying to entities which we do not want to convert over.
- return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()); // Paper
+ return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon(), effect.getKey()); // Paper // Purpur - add key
}
public static PotionEffect toBukkit(MobEffectInstance effect) {
@@ -20,7 +20,7 @@ public class CraftPotionUtil {
int duration = effect.getDuration();
boolean ambient = effect.isAmbient();
boolean particles = effect.isVisible();
- return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon(), effect.hiddenEffect == null ? null : toBukkit(effect.hiddenEffect)); // Paper
+ return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon(), effect.hiddenEffect == null ? null : toBukkit(effect.hiddenEffect), effect.getKey()); // Paper // Purpur - add key
}
public static boolean equals(Holder<MobEffect> mobEffect, PotionEffectType type) {
diff --git a/src/test/java/org/bukkit/potion/PotionTest.java b/src/test/java/org/bukkit/potion/PotionTest.java
index cbcd1c21646308b2a9706095e2e12177ca06734d..b3ccaea713e858e334cc91d1ae498e589e3daafa 100644
--- a/src/test/java/org/bukkit/potion/PotionTest.java
+++ b/src/test/java/org/bukkit/potion/PotionTest.java
@@ -10,6 +10,7 @@ import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.item.alchemy.Potion;
import org.bukkit.craftbukkit.legacy.FieldRename;
+import org.bukkit.NamespacedKey; // Purpur
import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
import org.bukkit.support.AbstractTestingBase;
import org.junit.jupiter.api.Test;
@@ -47,4 +48,27 @@ public class PotionTest extends AbstractTestingBase {
assertEquals(bukkit, byName, "Same type not returned by name " + key);
}
}
+
+ // Purpur start
+ @Test
+ public void testNamespacedKey() {
+ NamespacedKey key = new NamespacedKey("testnamespace", "testkey");
+ PotionEffect namedSpacedEffect = new PotionEffect(PotionEffectType.DOLPHINS_GRACE, 20, 0, true, true, true, key);
+ assertNotNull(namedSpacedEffect.getKey());
+ assertTrue(namedSpacedEffect.hasKey());
+ assertFalse(namedSpacedEffect.withKey(null).hasKey());
+
+ PotionEffect effect = new PotionEffect(PotionEffectType.DOLPHINS_GRACE, 20, 0, true, true, true);
+ assertNull(effect.getKey());
+ assertFalse(effect.hasKey());
+ assertTrue(namedSpacedEffect.withKey(key).hasKey());
+
+ Map<String, Object> s1 = namedSpacedEffect.serialize();
+ Map<String, Object> s2 = effect.serialize();
+ assertTrue(s1.containsKey("namespacedKey"));
+ assertFalse(s2.containsKey("namespacedKey"));
+ assertNotNull(new PotionEffect(s1).getKey());
+ assertNull(new PotionEffect(s2).getKey());
+ }
+ // Purpur end
}

View File

@@ -37,24 +37,23 @@ index 9967ba762567631f2bdb1e4f8fe16a13ea927b46..6c945ae8fe8b1517e312c688f829fab4
FoodProperties(int hunger, float saturationModifier, boolean meat, boolean alwaysEdible, boolean snack, List<Pair<MobEffectInstance, Float>> statusEffects) {
diff --git a/src/main/java/net/minecraft/world/food/Foods.java b/src/main/java/net/minecraft/world/food/Foods.java
index b16d9e2eaa589f19c563ee70b1a56d67dbcdecb0..71beab673f04cd051c46ea37f8c847316885d38d 100644
index 4569cf30b33167a415256a8542820557ad38f89e..9c65eefa855f3622b6c9ae2a698cf332ba225c7f 100644
--- a/src/main/java/net/minecraft/world/food/Foods.java
+++ b/src/main/java/net/minecraft/world/food/Foods.java
@@ -4,6 +4,9 @@ import net.minecraft.world.effect.MobEffectInstance;
@@ -4,6 +4,8 @@ import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
public class Foods {
+ public static final java.util.Map<String, FoodProperties> ALL_PROPERTIES = new java.util.HashMap<>(); // Purpur
+ public static final java.util.Map<String, FoodProperties> DEFAULT_PROPERTIES = new java.util.HashMap<>(); // Purpur
+
public static final FoodProperties APPLE = (new FoodProperties.Builder()).nutrition(4).saturationMod(0.3F).build();
public static final FoodProperties BAKED_POTATO = (new FoodProperties.Builder()).nutrition(5).saturationMod(0.6F).build();
public static final FoodProperties BEEF = (new FoodProperties.Builder()).nutrition(3).saturationMod(0.3F).meat().build();
public static final FoodProperties APPLE = new FoodProperties.Builder().nutrition(4).saturationMod(0.3F).build();
public static final FoodProperties BAKED_POTATO = new FoodProperties.Builder().nutrition(5).saturationMod(0.6F).build();
public static final FoodProperties BEEF = new FoodProperties.Builder().nutrition(3).saturationMod(0.3F).meat().build();
diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java
index 31f5ed9dd1727eee24804a384817d2b76a45676b..5fbb13ebef0ca66419f3e5006d19e4a5918a038a 100644
index bb2103a488964f25335393fa91e8ae5749eca333..249c887af68f56739c3609bad2405ba2cbe11762 100644
--- a/src/main/java/net/minecraft/world/item/Items.java
+++ b/src/main/java/net/minecraft/world/item/Items.java
@@ -1309,6 +1309,13 @@ public class Items {
@@ -1715,6 +1715,13 @@ public class Items {
((BlockItem)item).registerBlocks(Item.BY_BLOCK, item);
}
@@ -69,10 +68,10 @@ index 31f5ed9dd1727eee24804a384817d2b76a45676b..5fbb13ebef0ca66419f3e5006d19e4a5
}
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 730a4a2e46aeb233d8036e8d7e1749dcb397e6c0..fa81039056af14c37426a508b7b2da77e8b50737 100644
index 0e28cf20a870f3f3662bd1d8f7a4f2cbf13c48bf..ce3ab604e6ed6669f38abf83d40b500148277b9d 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -461,4 +461,75 @@ public class PurpurConfig {
@@ -466,4 +466,75 @@ public class PurpurConfig {
String setPattern = getString("settings.username-valid-characters", defaultPattern);
usernameValidCharactersPattern = java.util.regex.Pattern.compile(setPattern == null || setPattern.isBlank() ? defaultPattern : setPattern);
}

View File

@@ -3,12 +3,13 @@ From: Ben Kerllenevich <ben@omega24.dev>
Date: Wed, 13 Jul 2022 16:27:43 -0400
Subject: [PATCH] Send client custom name of BE
https://modrinth.com/mod/know-my-name
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index 2f19f6ac5de454845f5d13a3ebb93af625b2afc8..3431f1a00ae2918b91a6b7a449e613e6e12ff6d4 100644
index 4ea15e17a1393864422edb6d5c57962651abf69a..a78ed43288cfefaeb2592ed0a33fd11565dea2b2 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -205,10 +205,24 @@ public abstract class BlockEntity {
@@ -256,10 +256,24 @@ public abstract class BlockEntity {
@Nullable
public Packet<ClientGamePacketListener> getUpdatePacket() {
@@ -22,7 +23,7 @@ index 2f19f6ac5de454845f5d13a3ebb93af625b2afc8..3431f1a00ae2918b91a6b7a449e613e6
return null;
}
public CompoundTag getUpdateTag() {
public CompoundTag getUpdateTag(HolderLookup.Provider registryLookup) {
+ // Purpur start
+ if (this instanceof net.minecraft.world.Nameable nameable && nameable.hasCustomName()) {
+ CompoundTag nbt = this.saveWithoutMetadata();

View File

@@ -3,12 +3,13 @@ From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Tue, 20 Sep 2022 17:56:21 -0500
Subject: [PATCH] Allay respect item NBT
https://github.com/PurpurMC/Purpur/discussions/1127
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
index 9bf06cf7b3706f8883e1a0ceac8b1aebb52ba475..c783ce59ea766e6c46a3313628b961f27e01ee8b 100644
index bca7b7192debb3a34a08047010a2438e7b7e2a78..53765198483e137d411e227119e4f912964aefe3 100644
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
@@ -406,9 +406,31 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@@ -399,9 +399,31 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
@Override
public boolean wantsToPickUp(ItemStack stack) {
@@ -44,10 +45,10 @@ index 9bf06cf7b3706f8883e1a0ceac8b1aebb52ba475..c783ce59ea766e6c46a3313628b961f2
private boolean allayConsidersItemEqual(ItemStack stack, ItemStack stack2) {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 86340e782bbc125ec672eea855de29f90ac127de..1a8a1a9bca5c2f92b87fb1a21bdff194718caa8e 100644
index 5b12c08a1d8e6f62c5653c95071a1d36d735d039..94e29919ddc7f507d54e14c3360f7a3e8bb831a7 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1083,10 +1083,13 @@ public class PurpurWorldConfig {
@@ -1138,10 +1138,13 @@ public class PurpurWorldConfig {
public boolean allayRidable = false;
public boolean allayRidableInWater = true;
public boolean allayControllable = true;

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add item packet serialize event
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index 2e395962b555bef0ce1a98e1d768e7738f011535..40f51062624161892c780ddae05e22859e2cd021 100644
index b863249ff7e13cf4939c8961601f0564c62fd661..bdcfd80f937c34956911373905d66424bbff8e1d 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -94,6 +94,8 @@ public class FriendlyByteBuf extends ByteBuf {
@@ -95,6 +95,8 @@ public class FriendlyByteBuf extends ByteBuf {
private static final int MAX_PUBLIC_KEY_LENGTH = 512;
private static final Gson GSON = new Gson();
@@ -17,7 +17,7 @@ index 2e395962b555bef0ce1a98e1d768e7738f011535..40f51062624161892c780ddae05e2285
public FriendlyByteBuf(ByteBuf parent) {
this.source = parent;
}
@@ -632,6 +634,17 @@ public class FriendlyByteBuf extends ByteBuf {
@@ -640,6 +642,17 @@ public class FriendlyByteBuf extends ByteBuf {
this.writeBoolean(false);
} else {
this.writeBoolean(true);
@@ -36,22 +36,22 @@ index 2e395962b555bef0ce1a98e1d768e7738f011535..40f51062624161892c780ddae05e2285
this.writeId(BuiltInRegistries.ITEM, item);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 306195a8a57dc62379ffd856b214a651fd60e483..bc0dfdad161936d1881066f61de02e6c9a7ed8a7 100644
index 4611116f3328c0f8d5b37c8765feca36b2448ffe..60b5e0643d933393b5473681ac9261db29fe2416 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1549,6 +1549,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1731,6 +1731,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
//MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper // Purpur
this.isIteratingOverLevels = true; // Paper
this.isIteratingOverLevels = true; // Paper - Throw exception on world create while being ticked
+ net.minecraft.network.FriendlyByteBuf.hasItemSerializeEvent = org.purpurmc.purpur.event.packet.NetworkItemSerializeEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur
Iterator iterator = this.getAllLevels().iterator(); // Paper - move down
Iterator iterator = this.getAllLevels().iterator(); // Paper - Throw exception on world create while being ticked; move down
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 165623f5abc237e63b236489af6375bb43daeaca..6638d769a34287d54b22e4416003556915e153f1 100644
index 872be72e24017fdcb3060f6e4e9a92c342d59fc1..f7ac60e1aa188ec25a4c5d326cdd4a109a54101c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3362,6 +3362,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3382,6 +3382,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
}
}
@@ -65,10 +65,10 @@ index 165623f5abc237e63b236489af6375bb43daeaca..6638d769a34287d54b22e44160035569
boolean flag1 = packet.getSlotNum() >= 1 && packet.getSlotNum() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 568bb53e91dda4804cd328a81ba12ce735c52603..62aabfc021fa3349b0ab46744a9ec78d57f058b0 100644
index 5313ba91ffc625b27d5bb99395f0e719829f6bda..5329ad6493950a561bd46045e35a9bd70ac4405f 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -563,4 +563,9 @@ public class PurpurConfig {
@@ -568,4 +568,9 @@ public class PurpurConfig {
}
});
}

View File

@@ -5,13 +5,13 @@ Subject: [PATCH] Add hover lines API
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index 57f4cf40359fe9bb427eb0134660d00839a63c86..ab510e5917081bd8750a2cd7465e7823687e94bf 100644
index 6e2a6ce5cf456bd9f6c8c18a58f08e2285dc77ed..b27d16e74c3f99aa693b38590c1fb62db8204509 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -559,4 +559,17 @@ public final class CraftItemFactory implements ItemFactory {
return eggItem == null ? null : new net.minecraft.world.item.ItemStack(eggItem).asBukkitMirror();
@@ -619,4 +619,17 @@ public final class CraftItemFactory implements ItemFactory {
return CraftItemStack.asCraftMirror(enchanted);
}
// Paper end
// Paper end - enchantWithLevels API
+
+ // Purpur start
+ @Override

View File

@@ -0,0 +1,23 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 4 May 2019 00:57:16 -0500
Subject: [PATCH] Ridables
diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 069f2668f5229b0368b796e65eef1648fba0a097..50dc058cd8ecade74be30c75907d07f349c4df87 100644
--- a/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -442,6 +442,12 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
+ // Purpur start
+ GoalKey<Mob> MOB_HAS_RIDER = GoalKey.of(Mob.class, NamespacedKey.minecraft("has_rider"));
+ GoalKey<AbstractHorse> HORSE_HAS_RIDER = GoalKey.of(AbstractHorse.class, NamespacedKey.minecraft("horse_has_rider"));
+ GoalKey<Llama> LLAMA_HAS_RIDER = GoalKey.of(Llama.class, NamespacedKey.minecraft("llama_has_rider"));
+ // Purpur end
+
/**
* Removed in 1.20.2
*/

View File

@@ -4,11 +4,11 @@ Date: Sun, 28 Jun 2020 21:50:55 -0500
Subject: [PATCH] Phantoms attracted to crystals and crystals shoot phantoms
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 4160e968e7d7e8e2a953534a981a7330916ece2e..68326105d2e11bd2d94315c0da35a32d1510de08 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -202,6 +202,8 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 50dc058cd8ecade74be30c75907d07f349c4df87..b3a1325786fffb1a585b3911c75c03d184e8a848 100644
--- a/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -446,6 +446,8 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Mob> MOB_HAS_RIDER = GoalKey.of(Mob.class, NamespacedKey.minecraft("has_rider"));
GoalKey<AbstractHorse> HORSE_HAS_RIDER = GoalKey.of(AbstractHorse.class, NamespacedKey.minecraft("horse_has_rider"));
GoalKey<Llama> LLAMA_HAS_RIDER = GoalKey.of(Llama.class, NamespacedKey.minecraft("llama_has_rider"));

View File

@@ -5,11 +5,11 @@ Subject: [PATCH] Add option to disable zombie aggressiveness towards villagers
when lagging
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 68326105d2e11bd2d94315c0da35a32d1510de08..ce2eb58b86cd638d91f2bf9a8da60db499685fc9 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -204,6 +204,8 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index b3a1325786fffb1a585b3911c75c03d184e8a848..31c4d5da936f88e68c67c6e464b94563a47a0f34 100644
--- a/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -448,6 +448,8 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Llama> LLAMA_HAS_RIDER = GoalKey.of(Llama.class, NamespacedKey.minecraft("llama_has_rider"));
GoalKey<Phantom> FIND_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("find_crystal"));
GoalKey<Phantom> ORBIT_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("orbit_crystal"));

View File

@@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Tue, 8 Dec 2020 17:15:15 -0500
Subject: [PATCH] Rabid Wolf API
diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 31c4d5da936f88e68c67c6e464b94563a47a0f34..a41aa6c187d60373630eb803cb69d58b85eacc98 100644
--- a/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -450,6 +450,7 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Phantom> ORBIT_CRYSTAL = GoalKey.of(Phantom.class, NamespacedKey.minecraft("orbit_crystal"));
GoalKey<Drowned> DROWNED_ATTACK_VILLAGER = GoalKey.of(Drowned.class, NamespacedKey.minecraft("drowned_attack_villager"));
GoalKey<Zombie> ZOMBIE_ATTACK_VILLAGER = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack_villager"));
+ GoalKey<Wolf> AVOID_RABID_WOLF = GoalKey.of(Wolf.class, NamespacedKey.minecraft("avoid_rabid_wolf"));
// Purpur end
/**

View File

@@ -4,11 +4,11 @@ Date: Thu, 13 May 2021 21:38:01 -0500
Subject: [PATCH] Iron golem poppy calms anger
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 8671b9042df2e219921615144a6ca868fa346d77..b347224c223569297ee67ac630a710fdf28748ea 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -207,6 +207,7 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index a41aa6c187d60373630eb803cb69d58b85eacc98..9b991201a2f6cc9feccccf7f4e7bcded64117764 100644
--- a/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -451,6 +451,7 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Drowned> DROWNED_ATTACK_VILLAGER = GoalKey.of(Drowned.class, NamespacedKey.minecraft("drowned_attack_villager"));
GoalKey<Zombie> ZOMBIE_ATTACK_VILLAGER = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack_villager"));
GoalKey<Wolf> AVOID_RABID_WOLF = GoalKey.of(Wolf.class, NamespacedKey.minecraft("avoid_rabid_wolf"));

View File

@@ -5,47 +5,45 @@ Subject: [PATCH] Rebrand
diff --git a/build.gradle.kts b/build.gradle.kts
index f8b27b3992f1d59bf0e95bba0961540e88345754..e372110a189857056e4fae3cd1d996ce8cb69493 100644
index 5d448d8a7cf6626a11791f30ad52baf41a099272..81996f00384674b29368e8bea944bdd14d631da3 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -13,12 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
@@ -12,8 +12,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
val alsoShade: Configuration by configurations.creating
dependencies {
- implementation(project(":pufferfish-api")) // Pufferfish // Paper
- // Pufferfish start
- implementation("io.papermc.paper:paper-mojangapi:1.19.2-R0.1-SNAPSHOT") {
- implementation(project(":paper-api"))
- implementation(project(":paper-mojangapi"))
+ // Purpur start
+ implementation(project(":purpur-api"))
+ implementation("io.papermc.paper:paper-mojangapi:${project.version}") {
exclude("io.papermc.paper", "paper-api")
}
- // Pufferfish end
+ exclude("io.papermc.paper", "paper-api")
+ }
+ // Purpur end
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -63,6 +63,10 @@ dependencies {
}
// Pufferfish end
@@ -47,6 +51,10 @@ dependencies {
runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
+ 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
+
testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.hamcrest:hamcrest:2.2")
@@ -89,7 +93,7 @@ tasks.jar {
@@ -79,7 +87,7 @@ tasks.jar {
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
- "Implementation-Version" to "git-Pufferfish-$implementationVersion", // Pufferfish
- "Implementation-Version" to "git-Paper-$implementationVersion",
+ "Implementation-Version" to "git-Purpur-$implementationVersion", // Pufferfish // Purpur
"Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit",
"Specification-Version" to project.version,
@@ -173,7 +177,7 @@ fun TaskContainer.registerRunTask(
@@ -138,7 +146,7 @@ fun TaskContainer.registerRunTask(
name: String,
block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) {
@@ -162,10 +160,10 @@ index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..3cb56595822799926a8141e60a42f5d1
.completer(new ConsoleCommandCompleter(this.server))
.option(LineReader.Option.COMPLETE_IN_WORD, true);
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
index 1d714d3eff11ed14f218656008190017494d4830..ed3527612315e6e0649182ce4e1ae2834b0918a9 100644
index 4f3cc14d48690bb183d09bb7a5ba1e23e8a0c08a..c366d84518979e842a6f10f969a5951539ecac93 100644
--- a/src/main/java/net/minecraft/CrashReport.java
+++ b/src/main/java/net/minecraft/CrashReport.java
@@ -123,6 +123,10 @@ public class CrashReport {
@@ -125,6 +125,10 @@ public class CrashReport {
StringBuilder stringbuilder = new StringBuilder();
stringbuilder.append("---- Minecraft Crash Report ----\n");
@@ -177,10 +175,10 @@ index 1d714d3eff11ed14f218656008190017494d4830..ed3527612315e6e0649182ce4e1ae283
stringbuilder.append(CrashReport.getErrorComment());
stringbuilder.append("\n\n");
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 371049c1236c6443384c0ce184e99d5b9f8e57c2..ebcd6c821379f4feb3b2c094266645ae552972db 100644
index 8dc2f9df367c849ca333bf1a1fd92ff91617b548..57e6aaa63c1308baa5e2863b82b7521d5f4a4f31 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -910,7 +910,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -960,7 +960,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper
if (!isSameThread()) {
@@ -189,24 +187,24 @@ index 371049c1236c6443384c0ce184e99d5b9f8e57c2..ebcd6c821379f4feb3b2c094266645ae
while (this.getRunningThread().isAlive()) {
this.getRunningThread().stop();
try {
@@ -1699,7 +1699,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1924,7 +1924,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
- return "Pufferfish"; // Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return "Purpur"; // Purpur - Purpur > Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
- return "Paper"; // Paper
+ return "Purpur"; // Purpur - Purpur > // Pufferfish > // Paper
}
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5a95dcc02241d6036ee520a6a7a05e8713c6081f..ff9a2122fa26a1238660dcb1bc64e3fc778ddd8d 100644
index 05e304f9fc8d0291fa779da589bd060ef4165b49..62c18b61ee58e76a90938976e9ec96ef28a7106c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -267,7 +267,7 @@ import javax.annotation.Nullable; // Paper
@@ -268,7 +268,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
- private final String serverName = "Pufferfish"; // Paper // Pufferfish
- private final String serverName = "Paper"; // Paper
+ private final String serverName = "Purpur"; // Paper // Pufferfish // Purpur
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
@@ -237,25 +235,12 @@ index 4e56018b64d11f76c8da43fd8f85c6de72204e36..9607675e6c5bff2183c4420d11fc63ee
+ this.sendMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(message)); // Purpur
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index daadfec2d86f7957072a639e1e36d4082448f35f..3579715faa33a722cccb13d8d7c86a3de740d6fc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -912,7 +912,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return EntityCategory.WATER;
}
- throw new UnsupportedOperationException("Unsupported monster type: " + type + ". This is a bug, report this to Spigot.");
+ throw new UnsupportedOperationException("Unsupported monster type: " + type + ". This is a bug, report this to Purpur."); // Purpur
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index d7ce4971d9271dbeff4adb9d852e4e7bdf60bf03..5a47a8785bc2e251d041f80a79295c43459de3bc 100644
index e85b9bb3f9c225d289a4959921970b9963881199..c1e2d3a75b9d4710ab6d8b5c62af4bc136a2b668 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -501,7 +501,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -503,7 +503,7 @@ public class CraftScheduler implements BukkitScheduler {
this.parsePending();
} else {
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
@@ -265,33 +250,33 @@ index d7ce4971d9271dbeff4adb9d852e4e7bdf60bf03..5a47a8785bc2e251d041f80a79295c43
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 3298aac109e08da4801a6f08aa6f7acfc5e6bf16..33ea5172bb7fe1018bc39acc16963f4998ac52b2 100644
index a1c9989df460d7ae3666fffe7968750832a30b85..ad7f21566271260270db452e2f15c32f8a829d28 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -462,7 +462,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -507,7 +507,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
- return new gg.pufferfish.pufferfish.PufferfishVersionFetcher(); // Pufferfish
+ return new com.destroystokyo.paper.PaperVersionFetcher(); // Pufferfish // Purpur
- return new com.destroystokyo.paper.PaperVersionFetcher();
+ return new com.destroystokyo.paper.PaperVersionFetcher(); // Purpur - TODO: Pufferfish
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 80553face9c70c2a3d897681e7761df85b22d464..99597258e8e88cd9e2c901c4ac3ff7faeeabee2b 100644
index 774556a62eb240da42e84db4502e2ed43495be17..99597258e8e88cd9e2c901c4ac3ff7faeeabee2b 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +11,7 @@ public final class Versioning {
public static String getBukkitVersion() {
String result = "Unknown-Version";
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/gg.pufferfish.pufferfish/pufferfish-api/pom.properties"); // Pufferfish
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.purpurmc.purpur/purpur-api/pom.properties"); // Pufferfish // Purpur
Properties properties = new Properties();
if (stream != null) {
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index 50c72e5db369a180f425eaaa0411cb8871bc3463..dbd502761ff6e6efb252bb41376a7ff028c73895 100644
index 6db566e3111ec08a99aa429624979cb83a85e272..a353eb9f45af7b7f9bfd92a4a89403335b841840 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -96,7 +96,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -321,7 +306,7 @@ index 50c72e5db369a180f425eaaa0411cb8871bc3463..dbd502761ff6e6efb252bb41376a7ff0
//
if ( net.minecraft.world.level.Level.lastPhysicsProblem != null )
{
@@ -185,12 +185,12 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -184,12 +184,12 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
// Paper end
} else
{
@@ -333,10 +318,10 @@ index 50c72e5db369a180f425eaaa0411cb8871bc3463..dbd502761ff6e6efb252bb41376a7ff0
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Purpur!):" ); // Paper // Purpur
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper // Paper - rewrite chunk system
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper - rewrite chunk system
this.dumpTickingInfo(); // Paper - log detailed tick information
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
@@ -206,7 +206,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -205,7 +205,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
WatchdogThread.dumpThread( thread, log );
}
} else {

View File

@@ -5,14 +5,14 @@ Subject: [PATCH] Purpur config files
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index 692c962193cf9fcc6801fc93f3220bdc673d527b..8cde30544e14f8fc2dac32966ae3c21f8cf3a551 100644
index 4b002e8b75d117b726b0de274a76d3596fce015b..8cde30544e14f8fc2dac32966ae3c21f8cf3a551 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -593,7 +593,7 @@ public class Metrics {
boolean logFailedRequests = config.getBoolean("logFailedRequests", false);
// Only start Metrics, if it's enabled in the config
if (config.getBoolean("enabled", true)) {
- Metrics metrics = new Metrics("Pufferfish", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish
- Metrics metrics = new Metrics("Paper", serverUUID, logFailedRequests, Bukkit.getLogger());
+ Metrics metrics = new Metrics("Purpur", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
@@ -26,21 +26,21 @@ index 692c962193cf9fcc6801fc93f3220bdc673d527b..8cde30544e14f8fc2dac32966ae3c21f
- final String implVersion = org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion();
- if (implVersion != null) {
- final String buildOrHash = implVersion.substring(implVersion.lastIndexOf('-') + 1);
- paperVersion = "git-Pufferfish-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); // Pufferfish
- paperVersion = "git-Paper-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash);
- } else {
- paperVersion = "unknown";
- }
- metrics.addCustomChart(new Metrics.SimplePie("pufferfish_version", () -> paperVersion)); // Pufferfish
- metrics.addCustomChart(new Metrics.SimplePie("paper_version", () -> paperVersion));
+ metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() ? "bungee" : "offline"))); // Purpur
+ metrics.addCustomChart(new Metrics.SimplePie("purpur_version", () -> (org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() != null) ? org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() : "unknown")); // Purpur
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index 56ae02aab93b9a698e9d2f07a0448aa4767169d9..756651db912068c837197a972e95bc66ab9d4a70 100644
index e6c7f62ed379a78645933670299e4fcda8540ed1..edb94e5601acc38994dac20a167b145de778d426 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -332,6 +332,30 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
@@ -331,6 +331,30 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
}
}
@@ -72,13 +72,13 @@ index 56ae02aab93b9a698e9d2f07a0448aa4767169d9..756651db912068c837197a972e95bc66
boolean flag1 = this.source.acceptsSuccess() && !this.silent;
boolean flag2 = broadcastToOps && this.source.shouldInformAdmins() && !this.silent;
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 66aeb0ea388a8c8a08cf33728921061a0c74552f..6908e2165c4e4b43408a93963b4585d7cabf41dd 100644
index eb4fc900164d1fb3a78653ae8bc42ea30323f5b7..6d47aa73788eef78aa6714384db879b4e907de9b 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -218,6 +218,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
thread.start(); // Paper - start console thread after MinecraftServer.console & PaperConfig are initialized
io.papermc.paper.command.PaperCommands.registerCommands(this);
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics();
@@ -232,6 +232,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
+ // Purpur start
+ try {
+ org.purpurmc.purpur.PurpurConfig.init((java.io.File) options.valueOf("purpur-settings"));
@@ -88,42 +88,42 @@ index 66aeb0ea388a8c8a08cf33728921061a0c74552f..6908e2165c4e4b43408a93963b4585d7
+ }
+ org.purpurmc.purpur.PurpurConfig.registerCommands();
+ // Purpur end
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
// Paper end
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // Paper - init PaperBrigadierProvider
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 6c0e33323922de72dcb941a10883a07c72808b5f..eccc55372a7a52a92dd9418a47ece0fd2adcd6ed 100644
index b4ef3ad2c17168085372f1fe46809f02d9dfe74a..04f7f6743aabdca54892b2b155386f86032cf807 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -176,6 +176,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end
@@ -170,6 +170,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper end - add paper world config
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
+ public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPos lastPhysicsProblem; // Spigot
private org.spigotmc.TickLimiter entityLimiter;
@@ -215,6 +216,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - Async-Anti-Xray - Pass executor
@@ -216,6 +217,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
+ this.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), env); // Purpur
this.generator = gen;
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index ff9a2122fa26a1238660dcb1bc64e3fc778ddd8d..2674aede815f8c6d0fbaf22895ccb7ed05f9a714 100644
index 467ef4ffd6ee13b247ac9e453b006ec3d89362c9..d97f33d654086c892f01e47a59be7e37f6e03ae7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1039,6 +1039,7 @@ public final class CraftServer implements Server {
@@ -1054,6 +1054,7 @@ public final class CraftServer implements Server {
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
this.console.paperConfigurations.reloadConfigs(this.console);
+ org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
for (ServerLevel world : this.console.getAllLevels()) {
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
@@ -1054,6 +1055,7 @@ public final class CraftServer implements Server {
@@ -1069,6 +1070,7 @@ public final class CraftServer implements Server {
}
}
world.spigotConfig.init(); // Spigot
@@ -131,7 +131,7 @@ index ff9a2122fa26a1238660dcb1bc64e3fc778ddd8d..2674aede815f8c6d0fbaf22895ccb7ed
}
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
@@ -1069,6 +1071,7 @@ public final class CraftServer implements Server {
@@ -1084,6 +1086,7 @@ public final class CraftServer implements Server {
this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
@@ -139,7 +139,7 @@ index ff9a2122fa26a1238660dcb1bc64e3fc778ddd8d..2674aede815f8c6d0fbaf22895ccb7ed
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@@ -2919,6 +2922,18 @@ public final class CraftServer implements Server {
@@ -3048,6 +3051,18 @@ public final class CraftServer implements Server {
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
}
@@ -159,10 +159,10 @@ index ff9a2122fa26a1238660dcb1bc64e3fc778ddd8d..2674aede815f8c6d0fbaf22895ccb7ed
public void restart() {
org.spigotmc.RestartCommand.restart();
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index e4cacb17f56c618bef19e1165c07aac86af61150..a6b1c83e289bd0a9ad59288ed2da88ac3e607c0f 100644
index c988afa496d25314451435eedd64079a0d87cef0..45a33086e1bb8a70e0fa01090731d27a0474da41 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -173,6 +173,14 @@ public class Main {
@@ -175,6 +175,14 @@ public class Main {
.describedAs("Jar file");
// Paper end
@@ -179,7 +179,7 @@ index e4cacb17f56c618bef19e1165c07aac86af61150..a6b1c83e289bd0a9ad59288ed2da88ac
.withRequiredArg()
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..61d193d8ddd87817bf2c560037d42366cff1eca9
index 0000000000000000000000000000000000000000..4f015144be0a7a448c6c2b0765232c02ad405d09
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -0,0 +1,175 @@
@@ -260,8 +260,8 @@ index 0000000000000000000000000000000000000000..61d193d8ddd87817bf2c560037d42366
+ commands = new HashMap<>();
+ commands.put("purpur", new PurpurCommand("purpur"));
+
+ version = getInt("config-version", 33);
+ set("config-version", 33);
+ version = getInt("config-version", 35);
+ set("config-version", 35);
+
+ readConfig(PurpurConfig.class, null);
+
@@ -332,7 +332,7 @@ index 0000000000000000000000000000000000000000..61d193d8ddd87817bf2c560037d42366
+ return config.getInt(path, config.getInt(path));
+ }
+
+ private static <T> List getList(String path, T def) {
+ private static <T> List<?> getList(String path, T def) {
+ config.addDefault(path, def);
+ return config.getList(path, config.getList(path));
+ }

View File

@@ -5,30 +5,30 @@ Subject: [PATCH] Purpur client support
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ba972d1661426d7e30f6f61bad3b9608e66ea721..5fe10d6d8590ef5997a4f8f6af01ec16bf20e00a 100644
index 8437316888c6056060a2780652147590b6fe7443..8b07eb1c428bc70b8ee07ea2209f1898d6034809 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -274,6 +274,7 @@ public class ServerPlayer extends Player {
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
public @Nullable String clientBrandName = null; // Paper - Brand name
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
@@ -298,6 +298,7 @@ public class ServerPlayer extends Player {
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
// Paper start - replace player chunk loader
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 20122bf191ebc74c223310aea1f004fdbb163e57..9226fadcf53da5f7d55f4434a660d3e091c0775f 100644
index 8ac5d8ccf731100a1be690cb2ed1be82cadba8ed..4228fd441f8350d43bd545e31c920304f07968bc 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -55,6 +55,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private volatile boolean suspendFlushingOnServerThread = false;
@@ -78,6 +78,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
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 ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support
+ protected static final ResourceLocation PURPUR_CLIENT = new ResourceLocation("purpur", "client"); // Purpur
public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit
this.server = minecraftserver;
@@ -137,6 +138,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -170,6 +171,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
this.disconnect("Invalid payload REGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
}
@@ -39,17 +39,17 @@ index 20122bf191ebc74c223310aea1f004fdbb163e57..9226fadcf53da5f7d55f4434a660d3e0
+ } catch (Exception ignore) {
+ }
+ // Purpur end
} else if (identifier.equals(CUSTOM_UNREGISTER)) {
} else if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER)) {
try {
String channels = payload.toString(com.google.common.base.Charsets.UTF_8);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 604ed1f6742a6b028b9db2809f7bd4b9a3b38f4d..16c05edcd94d8a7ea166a4ab8c72cdeb09f26a73 100644
index 5f896948d158651cd9837364759dbfbcce6b7d21..7f78db4e0331d0f4801807ed1242642ee940d0f8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3283,4 +3283,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.spigot;
@@ -3522,4 +3522,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setSendViewDistance(final int viewDistance) {
this.getHandle().setSendViewDistance(viewDistance);
}
// Spigot end
+
+ // Purpur start
+ @Override

View File

@@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Sun, 12 Jun 2022 06:20:21 -0500
Subject: [PATCH] Fix decompile errors
diff --git a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java
index b0d26b0eadb2a43924629424a6c13198aace8f69..9f5c3ec2eae9b30bdb8dbcb328d7f701cb7aeb9d 100644
--- a/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java
+++ b/src/main/java/net/minecraft/commands/execution/tasks/BuildContexts.java
@@ -52,7 +52,7 @@ public class BuildContexts<T extends ExecutionCommandSource<T>> {
}
RedirectModifier<T> redirectModifier = commandContext.getRedirectModifier();
- if (redirectModifier instanceof CustomModifierExecutor<T> customModifierExecutor) {
+ if (redirectModifier instanceof CustomModifierExecutor customModifierExecutor) { // Purpur - decompile error
customModifierExecutor.apply(baseSource, list, contextChain, chainModifiers, ExecutionControl.create(context, frame));
return;
}
@@ -92,11 +92,11 @@ public class BuildContexts<T extends ExecutionCommandSource<T>> {
if (list.isEmpty()) {
if (chainModifiers.isReturn()) {
- context.queueNext(new CommandQueueEntry<>(frame, FallthroughTask.instance()));
+ context.queueNext(new CommandQueueEntry<>(frame, (EntryAction<T>) FallthroughTask.instance())); // Purpur - decompile error
}
} else {
CommandContext<T> commandContext2 = contextChain.getTopContext();
- if (commandContext2.getCommand() instanceof CustomCommandExecutor<T> customCommandExecutor) {
+ if (commandContext2.getCommand() instanceof CustomCommandExecutor customCommandExecutor) { // Purpur - decompile error
ExecutionControl<T> executionControl = ExecutionControl.create(context, frame);
for (T executionCommandSource2 : list) {
diff --git a/src/main/java/net/minecraft/commands/synchronization/ArgumentTypeInfos.java b/src/main/java/net/minecraft/commands/synchronization/ArgumentTypeInfos.java
index 7b118a92a6eb779f800ae8f5d8f6e3c861fc4f6a..057a038e8dcacd7496a0b2373de2c20255a5c297 100644
--- a/src/main/java/net/minecraft/commands/synchronization/ArgumentTypeInfos.java
+++ b/src/main/java/net/minecraft/commands/synchronization/ArgumentTypeInfos.java
@@ -119,10 +119,10 @@ public class ArgumentTypeInfos {
register(registry, "dimension", DimensionArgument.class, SingletonArgumentInfo.contextFree(DimensionArgument::dimension));
register(registry, "gamemode", GameModeArgument.class, SingletonArgumentInfo.contextFree(GameModeArgument::gameMode));
register(registry, "time", TimeArgument.class, new TimeArgument.Info());
- register(registry, "resource_or_tag", fixClassType(ResourceOrTagArgument.class), new ResourceOrTagArgument.Info());
- register(registry, "resource_or_tag_key", fixClassType(ResourceOrTagKeyArgument.class), new ResourceOrTagKeyArgument.Info());
- register(registry, "resource", fixClassType(ResourceArgument.class), new ResourceArgument.Info());
- register(registry, "resource_key", fixClassType(ResourceKeyArgument.class), new ResourceKeyArgument.Info());
+ register(registry, "resource_or_tag", fixClassType(ResourceOrTagArgument.class), new ResourceOrTagArgument.Info<>()); // Purpur - decompile error
+ register(registry, "resource_or_tag_key", fixClassType(ResourceOrTagKeyArgument.class), new ResourceOrTagKeyArgument.Info<>()); // Purpur - decompile error
+ register(registry, "resource", fixClassType(ResourceArgument.class), new ResourceArgument.Info<>()); // Purpur - decompile error
+ register(registry, "resource_key", fixClassType(ResourceKeyArgument.class), new ResourceKeyArgument.Info<>()); // Purpur - decompile error
register(registry, "template_mirror", TemplateMirrorArgument.class, SingletonArgumentInfo.contextFree(TemplateMirrorArgument::templateMirror));
register(registry, "template_rotation", TemplateRotationArgument.class, SingletonArgumentInfo.contextFree(TemplateRotationArgument::templateRotation));
register(registry, "heightmap", HeightmapTypeArgument.class, SingletonArgumentInfo.contextFree(HeightmapTypeArgument::heightmap));

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Component related conveniences
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 5fe10d6d8590ef5997a4f8f6af01ec16bf20e00a..75faac7c8009672c733033c5aabb4e1974ce5790 100644
index 8b07eb1c428bc70b8ee07ea2209f1898d6034809..0b9c85adaf5c7b5dcb23ab74a4fd02e6c0798851 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1784,6 +1784,26 @@ public class ServerPlayer extends Player {
@@ -1978,6 +1978,26 @@ public class ServerPlayer extends Player {
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
@@ -36,10 +36,10 @@ index 5fe10d6d8590ef5997a4f8f6af01ec16bf20e00a..75faac7c8009672c733033c5aabb4e19
public void displayClientMessage(Component message, boolean overlay) {
this.sendSystemMessage(message, overlay);
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 48d1444fbad1c57738807d0128b94160a5a17a4d..09b111dd0189b8764569e24fb6de862b1bb3bc89 100644
index a2142930b4d4b05987c90496fb9d733d99040aa0..2d6b6795703431939005aa09d1ed590c3f755163 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1039,6 +1039,20 @@ public abstract class PlayerList {
@@ -1063,6 +1063,20 @@ public abstract class PlayerList {
}
// CraftBukkit end
@@ -61,10 +61,10 @@ index 48d1444fbad1c57738807d0128b94160a5a17a4d..09b111dd0189b8764569e24fb6de862b
Iterator iterator = this.players.iterator();
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
index 25a5a3b949a0eb632611355e74ccd4865be108ca..14fcfd7c1d3a62833978e163f4e0d6f9b2203042 100644
index 160dc3216e8f5db5f9b3cce5e2d655f2b35b208a..43b9a7e8ed9043c4d3f8295258a27209ddb4474b 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
@@ -126,6 +126,15 @@ public class DamageSource {
@@ -177,6 +177,15 @@ public class DamageSource {
}
}
@@ -81,10 +81,10 @@ index 25a5a3b949a0eb632611355e74ccd4865be108ca..14fcfd7c1d3a62833978e163f4e0d6f9
return this.type().msgId();
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 505ed0f8f933428192f5fc806ff52d84acea7f99..8bc26cc6af27ba4c13940d61154786d47cb5aaf3 100644
index 2bc85351e6e52f90da5fdb29d8d042a06132d742..6c7f80723d67baf0ca036e0a12c3007144352edf 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4066,6 +4066,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4190,6 +4190,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return SlotAccess.NULL;
}

View File

@@ -1,58 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Sun, 12 Jun 2022 06:20:21 -0500
Subject: [PATCH] Fix decompile errors
diff --git a/src/main/java/net/minecraft/world/entity/decoration/Painting.java b/src/main/java/net/minecraft/world/entity/decoration/Painting.java
index d9016807bc21c38a5c38170e1335c79b39355bcb..03c065d0ad97d29f3586ba2bf3cd207b867ed634 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/Painting.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/Painting.java
@@ -121,7 +121,7 @@ public class Painting extends HangingEntity implements VariantHolder<Holder<Pain
@Override
public void readAdditionalSaveData(CompoundTag nbt) {
- Holder<PaintingVariant> holder = loadVariant(nbt).orElseGet(Painting::getDefaultVariant);
+ Holder<PaintingVariant> holder = loadVariant(nbt).orElseGet(() -> (Holder.Reference<PaintingVariant>) getDefaultVariant()); // Purpur - decompile error TODO: still needed?
this.setVariant(holder);
this.direction = Direction.from2DDataValue(nbt.getByte("facing"));
super.readAdditionalSaveData(nbt);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
index b79c86272f12c4b1173ea494cbe09e1ecdc23533..11275a9ec6faa69c9f054683cb47312e443ba883 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java
@@ -184,7 +184,7 @@ public class Zoglin extends Monster implements Enemy, HoglinBase {
@Override
public Brain<Zoglin> getBrain() {
- return super.getBrain();
+ return (Brain<Zoglin>) super.getBrain(); // Purpur - decompile error
}
protected void updateActivity() {
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
index d02ee11066fc4f07ccb110b09b86d895ff90d4f2..e1be4a77fae0b9120781f460079269b85c993930 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinBrute.java
@@ -70,7 +70,7 @@ public class PiglinBrute extends AbstractPiglin {
@Override
public Brain<PiglinBrute> getBrain() {
- return super.getBrain();
+ return (Brain<PiglinBrute>) super.getBrain(); // Purpur - decompile error
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java
index d5654cfe37bd82f1290b280990a8502432491ae1..b49e02ac7b3db9a5b79ce3f106ead19af4e7cfa6 100644
--- a/src/main/java/net/minecraft/world/level/block/Blocks.java
+++ b/src/main/java/net/minecraft/world/level/block/Blocks.java
@@ -1160,7 +1160,7 @@ public class Blocks {
}
private static Boolean ocelotOrParrot(BlockState state, BlockGetter world, BlockPos pos, EntityType<?> type) {
- return (boolean)type == EntityType.OCELOT || type == EntityType.PARROT;
+ return type == EntityType.OCELOT || type == EntityType.PARROT; // Purpur - decompile error
}
private static BedBlock bed(DyeColor color) {

File diff suppressed because one or more lines are too long

View File

@@ -5,13 +5,13 @@ Subject: [PATCH] Barrels and enderchests 6 rows
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 09b111dd0189b8764569e24fb6de862b1bb3bc89..cf03faf3207f886b03b0e90ad6f4ce5310db428c 100644
index 2d6b6795703431939005aa09d1ed590c3f755163..f10dcc0debcdd2077ee53cb1aefca8abd12f3ecd 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1164,6 +1164,27 @@ public abstract class PlayerList {
@@ -1188,6 +1188,27 @@ public abstract class PlayerList {
player.getBukkitEntity().recalculatePermissions(); // CraftBukkit
this.server.getCommands().sendCommands(player);
} // Paper
} // Paper - Add sendOpLevel API
+
+ // Purpur start
+ if (org.purpurmc.purpur.PurpurConfig.enderChestSixRows && org.purpurmc.purpur.PurpurConfig.enderChestPermissionRows) {
@@ -37,13 +37,13 @@ index 09b111dd0189b8764569e24fb6de862b1bb3bc89..cf03faf3207f886b03b0e90ad6f4ce53
public boolean isWhiteListed(GameProfile profile) {
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 90d437ef429fa6eef620eb54fcb9512e46b19b15..ea475f6fff35e346ca153a385d6b20f90b5f4283 100644
index 90e44c7281935bc7ceb3b220bbcd73187fed44fb..0641e448e0e98694976b820c2e9c4868f2b76909 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -188,6 +188,7 @@ public abstract class Player extends LivingEntity {
public boolean affectsSpawning = true;
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET;
// Paper end
@@ -195,6 +195,7 @@ public abstract class Player extends LivingEntity {
public boolean ignoreFallDamageFromCurrentImpulse;
public boolean affectsSpawning = true; // Paper - Affects Spawning API
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
+ public int sixRowEnderchestSlotCount = -1; // Purpur
// CraftBukkit start
@@ -84,10 +84,10 @@ index 0dbfd23bbfc6ad203f048142f8c90ef741849fe1..9a80427d2bb470b6b1638e59aba57216
return new ChestMenu(MenuType.GENERIC_9x6, syncId, playerInventory, inventory, 6);
}
diff --git a/src/main/java/net/minecraft/world/inventory/PlayerEnderChestContainer.java b/src/main/java/net/minecraft/world/inventory/PlayerEnderChestContainer.java
index 4703f23316f82a1a942907b46d2d6dcb7d70ec37..162798f57a05b78121fa6c4fadf5adee80fbe221 100644
index a15d5ff872dbd77f3c3145e0328f3d02e431ff8c..1dcf36d502990d32fc4cd3ea69c3ea334baed69a 100644
--- a/src/main/java/net/minecraft/world/inventory/PlayerEnderChestContainer.java
+++ b/src/main/java/net/minecraft/world/inventory/PlayerEnderChestContainer.java
@@ -30,11 +30,18 @@ public class PlayerEnderChestContainer extends SimpleContainer {
@@ -31,11 +31,18 @@ public class PlayerEnderChestContainer extends SimpleContainer {
}
public PlayerEnderChestContainer(Player owner) {
@@ -108,49 +108,59 @@ index 4703f23316f82a1a942907b46d2d6dcb7d70ec37..162798f57a05b78121fa6c4fadf5adee
this.activeChest = blockEntity;
}
diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
index 7385e91f32f070e86a4e0fd3d214f55d832c7979..7b73de87236a60ce7343c29ec147e1866b448ba3 100644
index 5f9858ef8d0ec1a74d469ab4426eb1db068873fd..d7ef772444b301d0a3f167679027195e4150b064 100644
--- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
@@ -85,6 +85,34 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
@@ -91,7 +91,7 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
EnderChestBlockEntity enderChestBlockEntity = (EnderChestBlockEntity)blockEntity;
playerEnderChestContainer.setActiveChest(enderChestBlockEntity);
player.openMenu(new SimpleMenuProvider((syncId, inventory, playerx) -> {
+ // Purpur start
+ if (org.purpurmc.purpur.PurpurConfig.enderChestSixRows) {
+ if (org.purpurmc.purpur.PurpurConfig.enderChestPermissionRows) {
+ org.bukkit.craftbukkit.entity.CraftHumanEntity bukkitPlayer = player.getBukkitEntity();
+ if (bukkitPlayer.hasPermission("purpur.enderchest.rows.six")) {
+ player.sixRowEnderchestSlotCount = 54;
+ return ChestMenu.sixRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.five")) {
+ player.sixRowEnderchestSlotCount = 45;
+ return ChestMenu.fiveRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.four")) {
+ player.sixRowEnderchestSlotCount = 36;
+ return ChestMenu.fourRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.three")) {
+ player.sixRowEnderchestSlotCount = 27;
+ return ChestMenu.threeRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.two")) {
+ player.sixRowEnderchestSlotCount = 18;
+ return ChestMenu.twoRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.one")) {
+ player.sixRowEnderchestSlotCount = 9;
+ return ChestMenu.oneRow(syncId, inventory, playerEnderChestContainer);
+ }
+ }
+ player.sixRowEnderchestSlotCount = -1;
+ return ChestMenu.sixRows(syncId, inventory, playerEnderChestContainer);
+ }
+ // Purpur end
return ChestMenu.threeRows(syncId, inventory, playerEnderChestContainer);
}, CONTAINER_TITLE));
player.openMenu(
- new SimpleMenuProvider((i, inventory, playerx) -> ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE)
+ new SimpleMenuProvider((i, inventory, playerx) -> org.purpurmc.purpur.PurpurConfig.enderChestSixRows ? getEnderChestSixRows(i, inventory, player, playerEnderChestContainer) : ChestMenu.threeRows(i, inventory, playerEnderChestContainer), CONTAINER_TITLE) // Purpur
);
player.awardStat(Stats.OPEN_ENDERCHEST);
PiglinAi.angerNearbyPiglins(player, true);
@@ -102,6 +102,35 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
}
}
+ // Purpur start
+ private ChestMenu getEnderChestSixRows(int syncId, net.minecraft.world.entity.player.Inventory inventory, Player player, PlayerEnderChestContainer playerEnderChestContainer) {
+ if (org.purpurmc.purpur.PurpurConfig.enderChestPermissionRows) {
+ org.bukkit.craftbukkit.entity.CraftHumanEntity bukkitPlayer = player.getBukkitEntity();
+ if (bukkitPlayer.hasPermission("purpur.enderchest.rows.six")) {
+ player.sixRowEnderchestSlotCount = 54;
+ return ChestMenu.sixRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.five")) {
+ player.sixRowEnderchestSlotCount = 45;
+ return ChestMenu.fiveRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.four")) {
+ player.sixRowEnderchestSlotCount = 36;
+ return ChestMenu.fourRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.three")) {
+ player.sixRowEnderchestSlotCount = 27;
+ return ChestMenu.threeRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.two")) {
+ player.sixRowEnderchestSlotCount = 18;
+ return ChestMenu.twoRows(syncId, inventory, playerEnderChestContainer);
+ } else if (bukkitPlayer.hasPermission("purpur.enderchest.rows.one")) {
+ player.sixRowEnderchestSlotCount = 9;
+ return ChestMenu.oneRow(syncId, inventory, playerEnderChestContainer);
+ }
+ }
+ player.sixRowEnderchestSlotCount = -1;
+ return ChestMenu.sixRows(syncId, inventory, playerEnderChestContainer);
+ }
+ // Purpur end
+
@Override
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return new EnderChestBlockEntity(pos, state);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
index 416aa989ebb18a8741cc9d605a1180ab830f6643..e38a0adf5463c48311ad08b8d2e5b5c2d989a3b5 100644
index 6186e55014bbb9d5bedaa0e9d196879c55339d42..f4f11292d6d00f4a7c65e3e2a157bba595f70889 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
@@ -67,7 +67,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
@@ -68,7 +68,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
public BarrelBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityType.BARREL, pos, state);
@@ -168,7 +178,7 @@ index 416aa989ebb18a8741cc9d605a1180ab830f6643..e38a0adf5463c48311ad08b8d2e5b5c2
this.openersCounter = new ContainerOpenersCounter() {
@Override
protected void onOpen(Level world, BlockPos pos, BlockState state) {
@@ -118,7 +127,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
@@ -119,7 +128,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
@Override
public int getContainerSize() {
@@ -186,7 +196,7 @@ index 416aa989ebb18a8741cc9d605a1180ab830f6643..e38a0adf5463c48311ad08b8d2e5b5c2
}
@Override
@@ -138,7 +156,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
@@ -139,7 +157,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
@Override
protected AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) {
@@ -205,10 +215,10 @@ index 416aa989ebb18a8741cc9d605a1180ab830f6643..e38a0adf5463c48311ad08b8d2e5b5c2
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
index 633e6f4922ccaf59979a22885162f42c65bf628a..15001e7c8eae3a89f9d8669be532d56b70d538ef 100644
index 977b77547f7ba62cef3640cf8d4f1c8e7cded53a..beae43e9b6fe447e7515d878ac175f461968768a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
@@ -181,8 +181,19 @@ public class CraftContainer extends AbstractContainerMenu {
@@ -184,8 +184,19 @@ public class CraftContainer extends AbstractContainerMenu {
case PLAYER:
case CHEST:
case ENDER_CHEST:
@@ -230,10 +240,10 @@ index 633e6f4922ccaf59979a22885162f42c65bf628a..15001e7c8eae3a89f9d8669be532d56b
case DISPENSER:
case DROPPER:
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index 471ae4458e7ea7c29d7551b32cec98180fbccd4e..23db63c78e9fcf86cd498b3ed36ca50253c2fe97 100644
index af1ae3dacb628da23f7d2988c6e76d3fb2d64103..4ee2d501f882279b48edb4b8bf0824587c276bf6 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -83,7 +83,7 @@ public class CraftInventory implements Inventory {
@@ -84,7 +84,7 @@ public class CraftInventory implements Inventory {
@Override
public void setContents(ItemStack[] items) {
@@ -243,7 +253,7 @@ index 471ae4458e7ea7c29d7551b32cec98180fbccd4e..23db63c78e9fcf86cd498b3ed36ca502
for (int i = 0; i < this.getSize(); i++) {
if (i >= items.length) {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 8ad548fc059568d37675e017548b171d4dd1d555..7937023274acf3a1efdd21bbdd2f933f4399baeb 100644
index 463af65182c0894a75a138df8100f3f616143f4c..a0eb18409f72afe393581e6dc8e2260b3a25197f 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -177,4 +177,39 @@ public class PurpurConfig {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Llama API
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java
index 21725aee29e9120d1c7e1e19f91c21a73a28844f..849f0c7c6d13df00d90211a48d8b56ab156812b8 100644
index df695b444fa2a993d381e2f197182c3e91a68502..eb0faf58fa1a408f294fc62120b140def97f998d 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/LlamaFollowCaravanGoal.java
@@ -22,6 +22,7 @@ public class LlamaFollowCaravanGoal extends Goal {
@@ -14,7 +14,7 @@ index 21725aee29e9120d1c7e1e19f91c21a73a28844f..849f0c7c6d13df00d90211a48d8b56ab
public boolean canUse() {
+ if (!this.llama.shouldJoinCaravan) return false; // Purpur
if (!this.llama.isLeashed() && !this.llama.inCaravan()) {
List<Entity> list = this.llama.level().getEntities(this.llama, this.llama.getBoundingBox().inflate(9.0D, 4.0D, 9.0D), (entity) -> {
List<Entity> list = this.llama.level().getEntities(this.llama, this.llama.getBoundingBox().inflate(9.0, 4.0, 9.0), entity -> {
EntityType<?> entityType = entity.getType();
@@ -71,6 +72,7 @@ public class LlamaFollowCaravanGoal extends Goal {
@@ -23,9 +23,9 @@ index 21725aee29e9120d1c7e1e19f91c21a73a28844f..849f0c7c6d13df00d90211a48d8b56ab
+ if (!this.llama.shouldJoinCaravan) return false; // Purpur
if (this.llama.inCaravan() && this.llama.getCaravanHead().isAlive() && this.firstIsLeashed(this.llama, 0)) {
double d = this.llama.distanceToSqr(this.llama.getCaravanHead());
if (d > 676.0D) {
if (d > 676.0) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
index 278c33b7de4472a746cdbc1faaa68e05592777bc..15a08abe94cb97de1450ff42cfb924a537b9eb5c 100644
index 697895661826e4a1ecbdfd2c3a195b9d0ee7e00a..05614fb50a5509331ac15bb819e827365a4cefcf 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
@@ -75,6 +75,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
@@ -36,25 +36,23 @@ index 278c33b7de4472a746cdbc1faaa68e05592777bc..15a08abe94cb97de1450ff42cfb924a5
public Llama(EntityType<? extends Llama> type, Level world) {
super(type, world);
@@ -170,7 +171,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
if (!this.inventory.getItem(1).isEmpty()) {
nbt.put("DecorItem", this.inventory.getItem(1).save(new CompoundTag()));
}
-
@@ -167,6 +168,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
super.addAdditionalSaveData(nbt);
nbt.putInt("Variant", this.getVariant().id);
nbt.putInt("Strength", this.getStrength());
+ nbt.putBoolean("Purpur.ShouldJoinCaravan", shouldJoinCaravan); // Purpur
}
@Override
@@ -181,7 +182,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
if (nbt.contains("DecorItem", 10)) {
this.inventory.setItem(1, ItemStack.of(nbt.getCompound("DecorItem")));
}
-
@@ -174,6 +176,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
this.setStrength(nbt.getInt("Strength"));
super.readAdditionalSaveData(nbt);
this.setVariant(Llama.Variant.byId(nbt.getInt("Variant")));
+ if (nbt.contains("Purpur.ShouldJoinCaravan")) this.shouldJoinCaravan = nbt.getBoolean("Purpur.ShouldJoinCaravan"); // Purpur
this.updateContainerEquipment();
}
@@ -500,6 +501,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
@Override
@@ -460,6 +463,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
public void leaveCaravan() {
if (this.caravanHead != null) {
@@ -62,7 +60,7 @@ index 278c33b7de4472a746cdbc1faaa68e05592777bc..15a08abe94cb97de1450ff42cfb924a5
this.caravanHead.caravanTail = null;
}
@@ -507,6 +509,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
@@ -467,6 +471,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
}
public void joinCaravan(Llama llama) {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] AFK API
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 3f5d87ccdee1309ae8240a3d181e268d8c022f56..9918f6ac1066ccadd3eb2635450faaf5a4350523 100644
index 2820333cbcd2cb972c4408cb0d9cc1be37a844cf..bc6a5de72d52627b3ceca4b52b95e12ceddf1247 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2134,8 +2134,68 @@ public class ServerPlayer extends Player {
@@ -2326,8 +2326,68 @@ public class ServerPlayer extends Player {
public void resetLastActionTime() {
this.lastActionTime = Util.getMillis();
@@ -78,11 +78,11 @@ index 3f5d87ccdee1309ae8240a3d181e268d8c022f56..9918f6ac1066ccadd3eb2635450faaf5
return this.stats;
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 675e6e7246d84195dc027c0209744896bd2b7224..3d4908a8686804a43e114d4720d7295107659e47 100644
index 1377d7abfe024b8ac977aa1a071b401836c3c048..510a4391463026dd0c896027a579a94174c24299 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -323,6 +323,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private boolean hasMoved; // Spigot
@@ -332,6 +332,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private boolean justTeleported = false;
// CraftBukkit end
+ // Purpur start
@@ -102,10 +102,10 @@ index 675e6e7246d84195dc027c0209744896bd2b7224..3d4908a8686804a43e114d4720d72951
@Override
public void tick() {
if (this.ackBlockChangesUpTo > -1) {
@@ -390,6 +404,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -399,6 +413,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits.
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits
+ // Purpur start
+ this.player.setAfk(true);
+ if (!this.player.level().purpurConfig.idleTimeoutKick || (!Boolean.parseBoolean(System.getenv("PURPUR_FORCE_IDLE_KICK")) && kickPermissionCache.getUnchecked(this.player.getBukkitEntity()))) {
@@ -115,33 +115,33 @@ index 675e6e7246d84195dc027c0209744896bd2b7224..3d4908a8686804a43e114d4720d72951
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
}
@@ -638,6 +658,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -658,6 +678,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
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
+
// Skip the first time we do this
if (true) { // Spigot - don't skip any move events
Location oldTo = to.clone();
@@ -1467,7 +1489,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!event.isAllowed()) {
flag2 = true; // Paper - diff on change, this should be moved wrongly
Location oldTo = to.clone();
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.cserver.getPluginManager().callEvent(event);
@@ -1494,7 +1516,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
movedWrongly = true;
if (event.getLogWarning())
- ServerGamePacketListenerImpl.LOGGER.warn("{} moved wrongly!", this.player.getName().getString());
+ ServerGamePacketListenerImpl.LOGGER.warn("{} moved wrongly!, ({})", this.player.getName().getString(), d11); // Purpur
}
// Paper end
- ServerGamePacketListenerImpl.LOGGER.warn("{} moved wrongly!", this.player.getName().getString());
+ ServerGamePacketListenerImpl.LOGGER.warn("{} moved wrongly!, ({})", this.player.getName().getString(), d11); // Purpur
} // Paper
}
@@ -1529,6 +1551,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1562,6 +1584,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
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
+
// Skip the first time we do this
if (from.getX() != Double.MAX_VALUE) {
Location oldTo = to.clone();
Location oldTo = to.clone();
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.cserver.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/players/SleepStatus.java b/src/main/java/net/minecraft/server/players/SleepStatus.java
index 823efad652d8ff9e96b99375b102fef6f017716e..caa8a69bde0c212c36dd990a67836ac2f95548c0 100644
--- a/src/main/java/net/minecraft/server/players/SleepStatus.java
@@ -165,19 +165,19 @@ index 823efad652d8ff9e96b99375b102fef6f017716e..caa8a69bde0c212c36dd990a67836ac2
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
index 3ff999734d14e2b6e7828e117f5ee32a60c26bc1..cfa9607241c3e69777ffc317206996c2f783437a 100644
index d8cc5614502db7025349e085381b6b32ad32296a..f1b9e83206cc67e6ef29ebe088351b0aaa5eb349 100644
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
@@ -39,6 +39,7 @@ public final class EntitySelector {
@@ -40,6 +40,7 @@ public final class EntitySelector {
return net.minecraft.util.Mth.clamp(serverPlayer.getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= playerInsomniaTicks;
};
// Paper end
// Paper end - Ability to control player's insomnia and phantoms
+ public static Predicate<Player> notAfk = (player) -> !player.isAfk(); // Purpur
private EntitySelector() {}
// Paper start
// Paper start - Affects Spawning API
diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
index ac5e5676b194a2a99e5cf53eb89c1152cac963b8..872454743f6dedc27519a13566559195c47cc9f8 100644
index d2f0c3b26d4beedb49d86e0242d843590d469d02..7463eefb7d09ea55fe8780210e7e967c2fe7896d 100644
--- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
+++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
@@ -64,6 +64,10 @@ public class TargetingConditions {
@@ -192,10 +192,10 @@ index ac5e5676b194a2a99e5cf53eb89c1152cac963b8..872454743f6dedc27519a13566559195
if (baseEntity == null) {
if (this.isCombat && (!targetEntity.canBeSeenAsEnemy() || targetEntity.level().getDifficulty() == Difficulty.PEACEFUL)) {
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index ea475f6fff35e346ca153a385d6b20f90b5f4283..535fe476ebe5b791cae7a4013c4a498b89d047e3 100644
index 054c905085b70ba72a3b76649bf5a20106f239d1..cd0992ec6b70f88c17cf7492847ae7f35e9c1e0d 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -194,6 +194,13 @@ public abstract class Player extends LivingEntity {
@@ -201,6 +201,13 @@ public abstract class Player extends LivingEntity {
public boolean fauxSleeping;
public int oldLevel = -1;
@@ -210,23 +210,23 @@ index ea475f6fff35e346ca153a385d6b20f90b5f4283..535fe476ebe5b791cae7a4013c4a498b
public CraftHumanEntity getBukkitEntity() {
return (CraftHumanEntity) super.getBukkitEntity();
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
index aaa07fcd4b32fe0de88142ab30378327a01f1729..bc8555d21d418f9da37cc089904f7cb038b1cdbe 100644
index ea0aee88c7d901034427db201c1b2430f8a1d522..1f28bfb435c1e4d97da713f96c452abab3fda91a 100644
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
@@ -191,7 +191,7 @@ public interface EntityGetter {
@@ -192,7 +192,7 @@ public interface EntityGetter {
default boolean hasNearbyAlivePlayer(double x, double y, double z, double range) {
for(Player player : this.players()) {
for (Player player : this.players()) {
- if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) {
+ if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player) && EntitySelector.notAfk.test(player)) {
+ if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player) && EntitySelector.notAfk.test(player)) { // Purpur
double d = player.distanceToSqr(x, y, z);
if (range < 0.0D || d < range * range) {
if (range < 0.0 || d < range * range) {
return true;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 16c05edcd94d8a7ea166a4ab8c72cdeb09f26a73..12012dd42a9c1faffcad55c9786a9f99e426600a 100644
index 7f78db4e0331d0f4801807ed1242642ee940d0f8..a4e4babedbf5bbf09bfbabd4f55ecd6301dae302 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -519,10 +519,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -574,10 +574,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void setPlayerListName(String name) {
@@ -236,14 +236,14 @@ index 16c05edcd94d8a7ea166a4ab8c72cdeb09f26a73..12012dd42a9c1faffcad55c9786a9f99
+ public void setPlayerListName(String name, boolean useMM) {
+ // Purpur end
if (name == null) {
name = getName();
name = this.getName();
}
- this.getHandle().listName = name.equals(getName()) ? null : CraftChatMessage.fromStringOrNull(name);
+ this.getHandle().listName = name.equals(getName()) ? null : useMM ? io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(name)) : CraftChatMessage.fromStringOrNull(name); // Purpur
for (ServerPlayer player : (List<ServerPlayer>) server.getHandle().players) {
- this.getHandle().listName = name.equals(this.getName()) ? null : CraftChatMessage.fromStringOrNull(name);
+ this.getHandle().listName = name.equals(this.getName()) ? null : useMM ? io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(name)) : CraftChatMessage.fromStringOrNull(name); // Purpur
if (this.getHandle().connection == null) return; // Paper - Updates are possible before the player has fully joined
for (ServerPlayer player : (List<ServerPlayer>) this.server.getHandle().players) {
if (player.getBukkitEntity().canSee(this)) {
player.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME, this.getHandle()));
@@ -3289,5 +3294,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3528,5 +3533,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public boolean usesPurpurClient() {
return getHandle().purpurClient;
}
@@ -265,7 +265,7 @@ index 16c05edcd94d8a7ea166a4ab8c72cdeb09f26a73..12012dd42a9c1faffcad55c9786a9f99
// Purpur end
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 7937023274acf3a1efdd21bbdd2f933f4399baeb..3fba9f640ef03219c89a2a405e4d5a5870e366bf 100644
index 940438c4b86d38be618dca8af95e3a7bf97bfa3c..beab078faaa6ea72539fdfd626ec64ff800d030c 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -174,8 +174,18 @@ public class PurpurConfig {
@@ -288,7 +288,7 @@ index 7937023274acf3a1efdd21bbdd2f933f4399baeb..3fba9f640ef03219c89a2a405e4d5a58
public static int barrelRows = 3;
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 27ce55687c7c59fdfdcc4553240ea8b023919b77..3ed1a91c93f659306acaf8bad6820f49208554c8 100644
index e248395ad5f5f012aeefecf367d54f90cade0996..70f53ccb22de2c05c9ead68f8bd29d0b69d0993f 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -90,6 +90,24 @@ public class PurpurWorldConfig {
@@ -317,10 +317,10 @@ index 27ce55687c7c59fdfdcc4553240ea8b023919b77..3ed1a91c93f659306acaf8bad6820f49
public boolean untamedTamablesAreRidable = true;
public boolean useNightVisionWhenRiding = false;
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 14e8e7ad8d742cdc0c50d29d6dade3e338c0463e..d1448f50a9c03bd779f4bcd6b4fc896365316b78 100644
index 3283ed99c35ffed6805567705e0518d9f84feedc..a9a39f0da7b09410d8171172a4219c7d509fdb99 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -203,6 +203,7 @@ public class ActivationRange
@@ -201,6 +201,7 @@ public class ActivationRange
continue;
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Bring back server name
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index c5598adb8cbcbcf7277c2fd4dd72c243d44d9700..cda4544ae96a4fcb5c6c4483df67a59f1b53fd27 100644
index 9d10cdacb3aed2c00dc60aeb6f2cbeb48905e21f..842f382de43df5d5c321422372ec30ccdd7859d7 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -58,6 +58,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
@@ -56,6 +56,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
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", "");
@@ -17,12 +17,12 @@ index c5598adb8cbcbcf7277c2fd4dd72c243d44d9700..cda4544ae96a4fcb5c6c4483df67a59f
public final boolean spawnNpcs = this.get("spawn-npcs", true);
public final boolean pvp = this.get("pvp", true);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2674aede815f8c6d0fbaf22895ccb7ed05f9a714..76d448e18b81fbb4b87c9cc1425fb446d9d6419c 100644
index 26eb9ff0f4e77230d1eae793398869e71999982b..c014528d7d2583fa0a3007c42ea9c16f2d0eb20c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -3152,4 +3152,11 @@ public final class CraftServer implements Server {
@@ -3293,4 +3293,11 @@ public final class CraftServer implements Server {
return this.potionBrewer;
}
// Paper end
+
+ // Purpur start

View File

@@ -5,20 +5,20 @@ Subject: [PATCH] Configurable server mod name
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index edd53077098cfaaa5987dc7df7163b83a5ed3b26..a22dbc34cfd9de6e996eb925c47abfccef13b0e7 100644
index 73b77367039eb6a4445d1ef2d66fb3410e91f4b8..8a6f7681d97c48886f5a78b61763e718e56ec015 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1700,7 +1700,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1925,7 +1925,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
- return "Purpur"; // Purpur - Purpur > Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return org.purpurmc.purpur.PurpurConfig.serverModName; // Purpur - Purpur > Pufferfish - Pufferfish > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
- return "Purpur"; // Purpur - Purpur > // Pufferfish > // Paper
+ return org.purpurmc.purpur.PurpurConfig.serverModName; // Purpur - Purpur > // Pufferfish > // Paper
}
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 3fba9f640ef03219c89a2a405e4d5a5870e366bf..bb7acf61cf2928181d014a17166d4d1414218e01 100644
index 7312ae7323032a0ba3c47aa7bdfe5dffe9674535..881c5654f181ea9b66e1cdf3bc3bf46869e8557f 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -188,6 +188,11 @@ public class PurpurConfig {

View File

@@ -5,30 +5,30 @@ Subject: [PATCH] Lagging threshold
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a22dbc34cfd9de6e996eb925c47abfccef13b0e7..4eeb7a43c8cdcd81fd9f8da4792ab27f54595d14 100644
index 8a6f7681d97c48886f5a78b61763e718e56ec015..dfa332c4ff52033eb95248518bc44bbd22697697 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -301,6 +301,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Spigot end
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations;
public static long currentTickLong = 0L; // Paper
@@ -315,6 +315,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
public static long currentTickLong = 0L; // Paper - track current tick as a long
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
+ public boolean lagging = false; // Purpur
public volatile Thread shutdownThread; // Paper
public volatile boolean abnormalExit = false; // Paper
@@ -1141,6 +1142,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1215,6 +1216,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.recentTps[0] = tps1.getAverage();
this.recentTps[1] = tps5.getAverage();
this.recentTps[2] = tps15.getAverage();
// Paper end
+ lagging = recentTps[0] < org.purpurmc.purpur.PurpurConfig.laggingThreshold; // Purpur
tickSection = curTime;
+ lagging = recentTps[0] < org.purpurmc.purpur.PurpurConfig.laggingThreshold; // Purpur
tickSection = currentTime;
}
// Spigot end
// Paper end - further improve server tick loop
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 76d448e18b81fbb4b87c9cc1425fb446d9d6419c..dbe110d95095e5230d1711181e4b7a762662c2bb 100644
index c014528d7d2583fa0a3007c42ea9c16f2d0eb20c..6d8b433af8596dd5b5a3b04e901527cd50a31dec 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -3158,5 +3158,10 @@ public final class CraftServer implements Server {
@@ -3299,5 +3299,10 @@ public final class CraftServer implements Server {
public String getServerName() {
return this.getProperties().serverName;
}
@@ -40,7 +40,7 @@ index 76d448e18b81fbb4b87c9cc1425fb446d9d6419c..dbe110d95095e5230d1711181e4b7a76
// Purpur end
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index bb7acf61cf2928181d014a17166d4d1414218e01..34afed28faeb56352b48faf8078a5fb07912eb5e 100644
index 881c5654f181ea9b66e1cdf3bc3bf46869e8557f..9c5bba0ae119f8d42274455e322530ceb5f67d9b 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -193,6 +193,11 @@ public class PurpurConfig {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] PlayerSetSpawnerTypeWithEggEvent
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 2561e74ffdf595a9b6ae13dcd738662c772db442..518b927dac087000b5049bc61d43a46a7379e256 100644
index a46bf73c608641bf1f00fd55242de71a0f2ee06e..9b3bf5ac043262c6cd00d83b750c3313122d92a9 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -316,6 +316,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -330,6 +330,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
return (EntityType) Registry.register(BuiltInRegistries.ENTITY_TYPE, id, (EntityType<T>) type.build(id)); // CraftBukkit - decompile error
}
@@ -25,7 +25,7 @@ index 2561e74ffdf595a9b6ae13dcd738662c772db442..518b927dac087000b5049bc61d43a46a
public static ResourceLocation getKey(EntityType<?> type) {
return BuiltInRegistries.ENTITY_TYPE.getKey(type);
}
@@ -531,6 +541,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -537,6 +547,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
return this.category;
}
@@ -43,22 +43,22 @@ index 2561e74ffdf595a9b6ae13dcd738662c772db442..518b927dac087000b5049bc61d43a46a
if (this.descriptionId == null) {
this.descriptionId = Util.makeDescriptionId("entity", BuiltInRegistries.ENTITY_TYPE.getKey(this));
diff --git a/src/main/java/net/minecraft/world/item/SpawnEggItem.java b/src/main/java/net/minecraft/world/item/SpawnEggItem.java
index 741719301e6fc91a598e74342810c4185e6fde26..6fbff9c02fbabf03c9c649a9ea6128021081f9cd 100644
index 9cea8da84f39bb3f687139ef213ccea358724dee..076e6858222b92f8409f1f5cad398582c1fd6bcb 100644
--- a/src/main/java/net/minecraft/world/item/SpawnEggItem.java
+++ b/src/main/java/net/minecraft/world/item/SpawnEggItem.java
@@ -68,6 +68,15 @@ public class SpawnEggItem extends Item {
SpawnerBlockEntity tileentitymobspawner = (SpawnerBlockEntity) tileentity;
EntityType<?> entitytypes = this.getType(itemstack.getTag());
@@ -74,6 +74,15 @@ public class SpawnEggItem extends Item {
Spawner spawner = (Spawner) tileentity;
+ // Purpur start
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ org.purpurmc.purpur.event.PlayerSetSpawnerTypeWithEggEvent event = new org.purpurmc.purpur.event.PlayerSetSpawnerTypeWithEggEvent((org.bukkit.entity.Player) context.getPlayer().getBukkitEntity(), bukkitBlock, (org.bukkit.block.CreatureSpawner) bukkitBlock.getState(), org.bukkit.entity.EntityType.fromName(entitytypes.getName()));
+ if (!event.callEvent()) {
+ return InteractionResult.FAIL;
+ }
+ entitytypes = EntityType.getFromBukkitType(event.getEntityType());
+ // Purpur end
entitytypes = this.getType(itemstack);
+
tileentitymobspawner.setEntityId(entitytypes, world.getRandom());
tileentity.setChanged();
world.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
+ // Purpur start
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ org.purpurmc.purpur.event.PlayerSetSpawnerTypeWithEggEvent event = new org.purpurmc.purpur.event.PlayerSetSpawnerTypeWithEggEvent((org.bukkit.entity.Player) context.getPlayer().getBukkitEntity(), bukkitBlock, (org.bukkit.block.CreatureSpawner) bukkitBlock.getState(), org.bukkit.entity.EntityType.fromName(entitytypes.getName()));
+ if (!event.callEvent()) {
+ return InteractionResult.FAIL;
+ }
+ entitytypes = EntityType.getFromBukkitType(event.getEntityType());
+ // Purpur end
spawner.setEntityId(entitytypes, world.getRandom());
world.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
world.gameEvent((Entity) context.getPlayer(), (Holder) GameEvent.BLOCK_CHANGE, blockposition);

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Anvil API
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index ffd349c1b80df0f1e8c02bda23700184825170fd..29f301bde378bd320d5c44f2c1b6bf9dc185e286 100644
index 32910f677b0522ac8ec513fa0d00b714b52cfae4..f85eef14b91a0ada1f6f4b13ab3966f051ff92d3 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -76,6 +76,7 @@ public abstract class AbstractContainerMenu {
@@ -17,10 +17,10 @@ index ffd349c1b80df0f1e8c02bda23700184825170fd..29f301bde378bd320d5c44f2c1b6bf9d
// CraftBukkit start
public boolean checkReachable = true;
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index e0c3a4ba27e21c3692e601acd0af60873bcbb84c..b500a04b8135604f0159a741b3d228c9e87b2a46 100644
index 2bd91b48eaa06f85a5b9b1ae052c70e966ae8e4c..9036426256f87b3ba4a78e6fa2cea4e028f84481 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -23,6 +23,13 @@ import org.slf4j.Logger;
@@ -25,6 +25,13 @@ import org.slf4j.Logger;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
// CraftBukkit end
@@ -34,7 +34,7 @@ index e0c3a4ba27e21c3692e601acd0af60873bcbb84c..b500a04b8135604f0159a741b3d228c9
public class AnvilMenu extends ItemCombinerMenu {
public static final int INPUT_SLOT = 0;
@@ -51,6 +58,8 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -53,6 +60,8 @@ public class AnvilMenu extends ItemCombinerMenu {
public int maximumRepairCost = 40;
private CraftInventoryView bukkitEntity;
// CraftBukkit end
@@ -43,12 +43,12 @@ index e0c3a4ba27e21c3692e601acd0af60873bcbb84c..b500a04b8135604f0159a741b3d228c9
public AnvilMenu(int syncId, Inventory inventory) {
this(syncId, inventory, ContainerLevelAccess.NULL);
@@ -78,12 +87,15 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -80,12 +89,15 @@ public class AnvilMenu extends ItemCombinerMenu {
@Override
protected boolean mayPickup(Player player, boolean present) {
- return (player.getAbilities().instabuild || player.experienceLevel >= this.cost.get()) && this.cost.get() > AnvilMenu.DEFAULT_DENIED_COST && present; // CraftBukkit - allow cost 0 like a free item
+ return (player.getAbilities().instabuild || player.experienceLevel >= this.cost.get()) && (bypassCost || this.cost.get() > AnvilMenu.DEFAULT_DENIED_COST) && present; // CraftBukkit - allow cost 0 like a free item // Purpur
- return (player.hasInfiniteMaterials() || player.experienceLevel >= this.cost.get()) && this.cost.get() > AnvilMenu.DEFAULT_DENIED_COST && present; // CraftBukkit - allow cost 0 like a free item
+ return (player.hasInfiniteMaterials() || player.experienceLevel >= this.cost.get()) && (bypassCost || this.cost.get() > AnvilMenu.DEFAULT_DENIED_COST) && present; // CraftBukkit - allow cost 0 like a free item // Purpur
}
@Override
@@ -60,7 +60,7 @@ index e0c3a4ba27e21c3692e601acd0af60873bcbb84c..b500a04b8135604f0159a741b3d228c9
player.giveExperienceLevels(-this.cost.get());
}
@@ -134,6 +146,12 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -136,6 +148,12 @@ public class AnvilMenu extends ItemCombinerMenu {
@Override
public void createResult() {
@@ -73,31 +73,30 @@ index e0c3a4ba27e21c3692e601acd0af60873bcbb84c..b500a04b8135604f0159a741b3d228c9
ItemStack itemstack = this.inputSlots.getItem(0);
this.cost.set(1);
@@ -210,7 +228,7 @@ public class AnvilMenu extends ItemCombinerMenu {
int i2 = (Integer) map1.get(enchantment);
@@ -143,7 +161,7 @@ public class AnvilMenu extends ItemCombinerMenu {
long j = 0L;
byte b0 = 0;
i2 = l1 == i2 ? i2 + 1 : Math.max(i2, l1);
- boolean flag3 = enchantment.canEnchant(itemstack);
+ boolean flag3 = canDoUnsafeEnchants || enchantment.canEnchant(itemstack); // Purpur
if (this.player.getAbilities().instabuild || itemstack.is(Items.ENCHANTED_BOOK)) {
flag3 = true;
- if (!itemstack.isEmpty() && EnchantmentHelper.canStoreEnchantments(itemstack)) {
+ if (!itemstack.isEmpty() && canDoUnsafeEnchants || EnchantmentHelper.canStoreEnchantments(itemstack)) { // Purpur
ItemStack itemstack1 = itemstack.copy();
ItemStack itemstack2 = this.inputSlots.getItem(1);
ItemEnchantments.Mutable itemenchantments_a = new ItemEnchantments.Mutable(EnchantmentHelper.getEnchantmentsForCrafting(itemstack1));
@@ -222,7 +240,7 @@ public class AnvilMenu extends ItemCombinerMenu {
Enchantment enchantment1 = (Enchantment) iterator1.next();
Holder<Enchantment> holder1 = (Holder) iterator1.next();
if (enchantment1 != enchantment && !enchantment.isCompatibleWith(enchantment1)) {
- flag3 = false;
+ flag3 = canDoUnsafeEnchants; // Purpur
++i;
}
if (!holder1.equals(holder) && !enchantment.isCompatibleWith((Enchantment) holder1.value())) {
- flag3 = false;
+ flag3 = canDoUnsafeEnchants; // Purpur
++i;
}
@@ -293,6 +311,13 @@ public class AnvilMenu extends ItemCombinerMenu {
}
@@ -280,6 +298,12 @@ public class AnvilMenu extends ItemCombinerMenu {
this.cost.set(this.maximumRepairCost - 1); // CraftBukkit
}
+ // Purpur start
+ if (bypassCost && cost.get() >= maximumRepairCost) {
+ itemstack.addTagElement("Purpur.realCost", IntTag.valueOf(cost.get()));
+ cost.set(maximumRepairCost - 1);
+ }
+ // Purpur end
@@ -105,9 +104,9 @@ index e0c3a4ba27e21c3692e601acd0af60873bcbb84c..b500a04b8135604f0159a741b3d228c9
if (this.cost.get() >= this.maximumRepairCost && !this.player.getAbilities().instabuild) { // CraftBukkit
itemstack1 = ItemStack.EMPTY;
}
@@ -315,6 +340,12 @@ public class AnvilMenu extends ItemCombinerMenu {
@@ -301,6 +325,12 @@ public class AnvilMenu extends ItemCombinerMenu {
org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(this.getBukkitView(), itemstack1); // CraftBukkit
sendAllDataToRemote(); // CraftBukkit - SPIGOT-6686: Always send completed inventory to stay in sync with client
this.sendAllDataToRemote(); // CraftBukkit - SPIGOT-6686: Always send completed inventory to stay in sync with client
this.broadcastChanges();
+ // Purpur start
+ if (canDoUnsafeEnchants && itemstack1 != ItemStack.EMPTY) {
@@ -115,11 +114,11 @@ index e0c3a4ba27e21c3692e601acd0af60873bcbb84c..b500a04b8135604f0159a741b3d228c9
+ ((ServerPlayer) player).connection.send(new ClientboundContainerSetDataPacket(containerId, 0, cost.get()));
+ }
+ // Purpur end
}
}
} else {
org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(this.getBukkitView(), ItemStack.EMPTY); // CraftBukkit
this.cost.set(AnvilMenu.DEFAULT_DENIED_COST); // CraftBukkit - use a variable for set a cost for denied item
diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
index c2cf5a8e788637c6264cf43d712a5be223ff1cc5..a578882b64c581ef4f47fa483a9f2988cfa4c8cf 100644
index 7de5e47f9a54263734eeef855a2dc07ef64d30ea..7215af6cc91f48b040c23c54536d4aac8d293497 100644
--- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java
@@ -178,7 +178,9 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu {
@@ -133,7 +132,7 @@ index c2cf5a8e788637c6264cf43d712a5be223ff1cc5..a578882b64c581ef4f47fa483a9f2988
return itemstack;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java
index 88d3ca586ff6905f18a8ab9f0e229f440ed44088..27dd4eb4781a3c75772860c11db886e1038cecd2 100644
index 9ee14589d63bbfc0880f2eee5e924fe946ee0035..0a5841fa26698e60bdeadbb58b9343fe1ff08a28 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAnvil.java
@@ -9,7 +9,7 @@ import org.bukkit.inventory.AnvilInventory;
@@ -147,7 +146,7 @@ index 88d3ca586ff6905f18a8ab9f0e229f440ed44088..27dd4eb4781a3c75772860c11db886e1
super(inventory, resultInventory);
@@ -57,4 +57,26 @@ public class CraftInventoryAnvil extends CraftResultInventory implements AnvilIn
Preconditions.checkArgument(levels >= 0, "Maximum repair cost must be positive (or 0)");
container.maximumRepairCost = levels;
this.container.maximumRepairCost = levels;
}
+
+ // Purpur start

View File

@@ -1,91 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 5 May 2019 12:58:45 -0500
Subject: [PATCH] LivingEntity safeFallDistance
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 7471edf871522543cb49afef63d2c539b7e871a3..960e6ae3e7ceb981459b87343cacb7458d51eecf 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -253,6 +253,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
private boolean skipDropExperience;
// CraftBukkit start
public int expToDrop;
+ public float safeFallDistance = 3.0F; // Purpur
public boolean forceDrops;
public ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
public final org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
@@ -353,7 +354,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.tryAddSoulSpeed();
}
- if (!this.level().isClientSide && this.fallDistance > 3.0F && onGround && !state.isAir()) {
+ if (!this.level().isClientSide && this.fallDistance > this.safeFallDistance && onGround && !state.isAir()) { // Purpur
double d1 = this.getX();
double d2 = this.getY();
double d3 = this.getZ();
@@ -368,7 +369,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
d3 = (double) landedPosition.getZ() + 0.5D + d5 / d6 * 0.5D;
}
- float f = (float) Mth.ceil(this.fallDistance - 3.0F);
+ float f = (float) Mth.ceil(this.fallDistance - this.safeFallDistance); // Purpur
double d7 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d7);
@@ -2092,7 +2093,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
MobEffectInstance mobeffect = this.getEffect(MobEffects.JUMP);
float f2 = mobeffect == null ? 0.0F : (float) (mobeffect.getAmplifier() + 1);
- return Mth.ceil((fallDistance - 3.0F - f2) * damageMultiplier);
+ return Mth.ceil((fallDistance - this.safeFallDistance - f2) * damageMultiplier); // Purpur
}
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index ad4d4e38a2f0125e0943945c9440a9be80b60257..d3b655ccf40d24b7f5a09383fd5771bb275ac4b7 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -386,7 +386,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@Override
protected int calculateFallDamage(float fallDistance, float damageMultiplier) {
- return Mth.ceil((fallDistance * 0.5F - 3.0F) * damageMultiplier);
+ return Mth.ceil((fallDistance * 0.5F - this.safeFallDistance) * damageMultiplier);
}
protected int getInventorySize() {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Giant.java b/src/main/java/net/minecraft/world/entity/monster/Giant.java
index 2a30499fd6f4a1340f6911f0f7f079bcbe8576a3..c3c0fbe71c9af1125c80698865cb9eaf42d4a1c5 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Giant.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Giant.java
@@ -13,6 +13,7 @@ import net.minecraft.world.level.LevelReader;
public class Giant extends Monster {
public Giant(EntityType<? extends Giant> type, Level world) {
super(type, world);
+ this.safeFallDistance = 10.0F; // Purpur
}
// Purpur start
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 3579715faa33a722cccb13d8d7c86a3de740d6fc..3c65041eed148fe30be3c73e423433e37ae58cc5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1099,4 +1099,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
getHandle().knockback(strength, directionX, directionZ);
};
// Paper end
+
+ // Purpur start
+ @Override
+ public float getSafeFallDistance() {
+ return getHandle().safeFallDistance;
+ }
+
+ @Override
+ public void setSafeFallDistance(float safeFallDistance) {
+ getHandle().safeFallDistance = safeFallDistance;
+ }
+ // Purpur end
}

View File

@@ -5,18 +5,18 @@ Subject: [PATCH] Alternative Keepalive Handling
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 9226fadcf53da5f7d55f4434a660d3e091c0775f..0166107f8b48393a93ac046e6af70f0ff24fbb85 100644
index 4228fd441f8350d43bd545e31c920304f07968bc..3a15085e0421f46800f779066d235ef21b463289 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -51,6 +51,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private long keepAliveTime = Util.getMillis(); // Paper
private boolean keepAlivePending;
@@ -73,6 +73,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private long keepAliveChallenge;
private long closedListenerTime;
private boolean closed = false;
+ private it.unimi.dsi.fastutil.longs.LongList keepAlives = new it.unimi.dsi.fastutil.longs.LongArrayList(); // Purpur
private int latency;
private volatile boolean suspendFlushingOnServerThread = false;
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
@@ -91,6 +92,16 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
@@ -124,6 +125,16 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {
@@ -30,10 +30,10 @@ index 9226fadcf53da5f7d55f4434a660d3e091c0775f..0166107f8b48393a93ac046e6af70f0f
+ }
+ } else
+ // Purpur end
//PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // CraftBukkit // Paper - This shouldn't be on the main thread
//PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // CraftBukkit // Paper - handle ServerboundKeepAlivePacket async
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int i = (int) (Util.getMillis() - this.keepAliveTime);
@@ -204,6 +215,21 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -260,6 +271,21 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
long currentTime = Util.getMillis();
long elapsedTime = currentTime - this.keepAliveTime;
@@ -52,11 +52,11 @@ index 9226fadcf53da5f7d55f4434a660d3e091c0775f..0166107f8b48393a93ac046e6af70f0f
+ } else
+ // Purpur end
+
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
if (!this.isSingleplayerOwner() && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected
if (this.keepAlivePending && !this.processedDisconnect) { // Paper
this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 34afed28faeb56352b48faf8078a5fb07912eb5e..ad239ba9259c5a63b40261ebc44224893496b47d 100644
index 9c5bba0ae119f8d42274455e322530ceb5f67d9b..a14cf3a5dc2ba265de5e400404afcbd9faa3f25a 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -198,6 +198,11 @@ public class PurpurConfig {

View File

@@ -4,72 +4,83 @@ Date: Thu, 9 May 2019 14:27:37 -0500
Subject: [PATCH] Silk touch spawners
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index 96fb69ec6db2e7c8c728435f0c537b076259b2fb..3253361d91e2a2e68d354eaf3dd3e3cd486e191d 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
@@ -219,6 +219,7 @@ public class BlockItem extends Item {
if (tileentity != null) {
if (!world.isClientSide && tileentity.onlyOpCanSetNbt() && (player == null || !(player.canUseGameMasterBlocks() || (player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.nbt.place"))))) { // Spigot - add permission
+ if (!(!world.isClientSide && world.purpurConfig.silkTouchEnabled && tileentity instanceof net.minecraft.world.level.block.entity.SpawnerBlockEntity && player.getBukkitEntity().hasPermission("purpur.drop.spawners")))
return false;
}
diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java
index 5f20e075c532f0f1d413242949d1738c0c152bf7..e6f8cb165f7e3da5f0edfc952d14059516de8acf 100644
index d00b59efb754594cf532f8598f4b6d3b29693232..6467358f5fdf4cd4f7c1e2cc65c834a9da39596a 100644
--- a/src/main/java/net/minecraft/world/item/Items.java
+++ b/src/main/java/net/minecraft/world/item/Items.java
@@ -294,7 +294,7 @@ public class Items {
@@ -338,7 +338,7 @@ public class Items {
public static final Item PURPUR_BLOCK = registerBlock(Blocks.PURPUR_BLOCK);
public static final Item PURPUR_PILLAR = registerBlock(Blocks.PURPUR_PILLAR);
public static final Item PURPUR_STAIRS = registerBlock(Blocks.PURPUR_STAIRS);
- public static final Item SPAWNER = registerBlock(Blocks.SPAWNER);
+ public static final Item SPAWNER = registerBlock(new org.purpurmc.purpur.item.SpawnerItem(Blocks.SPAWNER, new Item.Properties().rarity(Rarity.EPIC))); // Purpur
public static final Item CHEST = registerBlock(Blocks.CHEST);
public static final Item CHEST = registerBlock(Blocks.CHEST, settings -> settings.component(DataComponents.CONTAINER, ItemContainerContents.EMPTY));
public static final Item CRAFTING_TABLE = registerBlock(Blocks.CRAFTING_TABLE);
public static final Item FARMLAND = registerBlock(Blocks.FARMLAND);
diff --git a/src/main/java/net/minecraft/world/level/block/SpawnerBlock.java b/src/main/java/net/minecraft/world/level/block/SpawnerBlock.java
index 936d844a5a246138c9f9ae4ae6e318242b8f1420..93f5f226cf6fd6110e4daa02b3f5d9ad253814a0 100644
index 4f190a40b8474aa06a92c8afcc06d0044120ff7b..66c17bdfecdfbcfb2d853e561432dd51a8f7ed46 100644
--- a/src/main/java/net/minecraft/world/level/block/SpawnerBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SpawnerBlock.java
@@ -40,6 +40,58 @@ public class SpawnerBlock extends BaseEntityBlock {
@@ -42,6 +42,57 @@ public class SpawnerBlock extends BaseEntityBlock {
return createTickerHelper(type, BlockEntityType.MOB_SPAWNER, world.isClientSide ? SpawnerBlockEntity::clientTick : SpawnerBlockEntity::serverTick);
}
+ // Purpur start
+ @Override
+ public void playerDestroy(Level level, net.minecraft.world.entity.player.Player player, BlockPos pos, BlockState state, BlockEntity blockEntity, ItemStack stack, boolean includeDrops) {
+ public void playerDestroy(Level level, net.minecraft.world.entity.player.Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack stack, boolean includeDrops, boolean dropExp) {
+ if (level.purpurConfig.silkTouchEnabled && player.getBukkitEntity().hasPermission("purpur.drop.spawners") && isSilkTouch(level, stack)) {
+ Optional<net.minecraft.world.entity.EntityType<?>> type = net.minecraft.world.entity.EntityType.by(((SpawnerBlockEntity) blockEntity).getSpawner().nextSpawnData.getEntityToSpawn());
+
+ net.minecraft.world.entity.EntityType<?> entityType = type.orElse(null);
+ final net.kyori.adventure.text.Component mobName = io.papermc.paper.adventure.PaperAdventure.asAdventure(entityType == null ? Component.empty() : entityType.getDescription());
+ CompoundTag display = new CompoundTag();
+ CompoundTag tag = new CompoundTag();
+
+ String name = level.purpurConfig.silkTouchSpawnerName;
+ if (name != null && !name.isEmpty() && !name.equals("Monster Spawner")) {
+ net.kyori.adventure.text.Component displayName = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(name, net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.component("mob", mobName));
+ if (name.startsWith("<reset>")) {
+ displayName = displayName.decoration(net.kyori.adventure.text.format.TextDecoration.ITALIC, false);
+ }
+ display.put("Name", net.minecraft.nbt.StringTag.valueOf(io.papermc.paper.adventure.PaperAdventure.asJsonString(displayName, java.util.Locale.ROOT)));
+ tag.put("display", display);
+ }
+
+ List<String> lore = level.purpurConfig.silkTouchSpawnerLore;
+ if (lore != null && !lore.isEmpty()) {
+ net.minecraft.nbt.ListTag list = new net.minecraft.nbt.ListTag();
+ for (String line : lore) {
+ net.kyori.adventure.text.Component lineComponent = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(line, net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.component("mob", mobName));
+ if (line.startsWith("<reset>")) {
+ lineComponent = lineComponent.decoration(net.kyori.adventure.text.format.TextDecoration.ITALIC, false);
+ }
+ list.add(net.minecraft.nbt.StringTag.valueOf(io.papermc.paper.adventure.PaperAdventure.asJsonString(lineComponent, java.util.Locale.ROOT)));
+ }
+ display.put("Lore", list);
+ tag.put("display", display);
+ }
+
+ ItemStack item = new ItemStack(Blocks.SPAWNER.asItem());
+ if (entityType != null) {
+ tag.putString("Purpur.mob_type", entityType.getName());
+ tag.putDouble("HideFlags", 32); // hides the "Interact with Spawn Egg" tooltip
+ item.setTag(tag);
+
+ net.minecraft.world.level.SpawnData nextSpawnData = blockEntity instanceof SpawnerBlockEntity spawnerBlock ? spawnerBlock.getSpawner().nextSpawnData : null;
+ java.util.Optional<net.minecraft.world.entity.EntityType<?>> type = java.util.Optional.empty();
+ if (nextSpawnData != null) {
+ type = net.minecraft.world.entity.EntityType.by(nextSpawnData.getEntityToSpawn());
+ net.minecraft.world.level.SpawnData.CODEC.encodeStart(net.minecraft.nbt.NbtOps.INSTANCE, nextSpawnData).result().ifPresent(tag -> item.set(net.minecraft.core.component.DataComponents.CUSTOM_DATA, net.minecraft.world.item.component.CustomData.EMPTY.update(compoundTag -> compoundTag.put("Purpur.SpawnData", tag))));
+ }
+
+ if (type.isPresent()) {
+ final net.kyori.adventure.text.Component mobName = io.papermc.paper.adventure.PaperAdventure.asAdventure(type.get().getDescription());
+
+ String name = level.purpurConfig.silkTouchSpawnerName;
+ if (name != null && !name.isEmpty() && !name.equals("Monster Spawner")) {
+ net.kyori.adventure.text.Component displayName = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(name, net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.component("mob", mobName));
+ if (name.startsWith("<reset>")) {
+ displayName = displayName.decoration(net.kyori.adventure.text.format.TextDecoration.ITALIC, false);
+ }
+ item.set(net.minecraft.core.component.DataComponents.CUSTOM_NAME, io.papermc.paper.adventure.PaperAdventure.asVanilla(displayName));
+ }
+
+ List<String> lore = level.purpurConfig.silkTouchSpawnerLore;
+ if (lore != null && !lore.isEmpty()) {
+
+ List<Component> loreComponentList = new java.util.ArrayList<>();
+ for (String line : lore) {
+ net.kyori.adventure.text.Component lineComponent = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(line, net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.component("mob", mobName));
+ if (line.startsWith("<reset>")) {
+ lineComponent = lineComponent.decoration(net.kyori.adventure.text.format.TextDecoration.ITALIC, false);
+ }
+ loreComponentList.add(io.papermc.paper.adventure.PaperAdventure.asVanilla(lineComponent));
+ }
+
+ item.set(net.minecraft.core.component.DataComponents.LORE, new net.minecraft.world.item.component.ItemLore(loreComponentList, loreComponentList));
+ }
+ item.set(net.minecraft.core.component.DataComponents.HIDE_ADDITIONAL_TOOLTIP, net.minecraft.util.Unit.INSTANCE);
+ }
+ popResource(level, pos, item);
+ }
+ super.playerDestroy(level, player, pos, state, blockEntity, stack, includeDrops);
+ super.playerDestroy(level, player, pos, state, blockEntity, stack, includeDrops, dropExp);
+ }
+
+ private boolean isSilkTouch(Level level, ItemStack stack) {
@@ -78,9 +89,9 @@ index 936d844a5a246138c9f9ae4ae6e318242b8f1420..93f5f226cf6fd6110e4daa02b3f5d9ad
+ // Purpur end
+
@Override
public void spawnAfterBreak(BlockState state, ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) {
protected void spawnAfterBreak(BlockState state, ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) {
super.spawnAfterBreak(state, world, pos, tool, dropExperience);
@@ -48,6 +100,7 @@ public class SpawnerBlock extends BaseEntityBlock {
@@ -50,6 +101,7 @@ public class SpawnerBlock extends BaseEntityBlock {
@Override
public int getExpDrop(BlockState iblockdata, ServerLevel worldserver, BlockPos blockposition, ItemStack itemstack, boolean flag) {
@@ -89,7 +100,7 @@ index 936d844a5a246138c9f9ae4ae6e318242b8f1420..93f5f226cf6fd6110e4daa02b3f5d9ad
int i = 15 + worldserver.random.nextInt(15) + worldserver.random.nextInt(15);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 3ed1a91c93f659306acaf8bad6820f49208554c8..570abbb70cfb523917de473bd91640719c40a611 100644
index 70f53ccb22de2c05c9ead68f8bd29d0b69d0993f..d4bca5b5f3d10c3a04befd8c365f46433491f299 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -108,6 +108,38 @@ public class PurpurWorldConfig {
@@ -133,18 +144,20 @@ index 3ed1a91c93f659306acaf8bad6820f49208554c8..570abbb70cfb523917de473bd9164071
public boolean useNightVisionWhenRiding = false;
diff --git a/src/main/java/org/purpurmc/purpur/item/SpawnerItem.java b/src/main/java/org/purpurmc/purpur/item/SpawnerItem.java
new file mode 100644
index 0000000000000000000000000000000000000000..c038fb2bbb0f0e78380bc24bbd6348b869669a90
index 0000000000000000000000000000000000000000..ed50cb2115401c9039df4136caf5a087a5f5991c
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/item/SpawnerItem.java
@@ -0,0 +1,36 @@
@@ -0,0 +1,40 @@
+package org.purpurmc.purpur.item;
+
+import net.minecraft.core.BlockPos;
+import net.minecraft.core.component.DataComponents;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.item.BlockItem;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.item.component.CustomData;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.level.block.Block;
+import net.minecraft.world.level.block.entity.BlockEntity;
@@ -161,12 +174,14 @@ index 0000000000000000000000000000000000000000..c038fb2bbb0f0e78380bc24bbd6348b8
+ protected boolean updateCustomBlockEntityTag(BlockPos pos, Level level, Player player, ItemStack stack, BlockState state) {
+ boolean handled = super.updateCustomBlockEntityTag(pos, level, player, stack, state);
+ if (level.purpurConfig.silkTouchEnabled && player.getBukkitEntity().hasPermission("purpur.place.spawners")) {
+ BlockEntity spawner = level.getBlockEntity(pos);
+ if (spawner instanceof SpawnerBlockEntity && stack.hasTag()) {
+ CompoundTag tag = stack.getTag();
+ if (tag.contains("Purpur.mob_type")) {
+ EntityType.byString(tag.getString("Purpur.mob_type")).ifPresent(type ->
+ ((SpawnerBlockEntity) spawner).getSpawner().setEntityId(type, level, level.random, pos));
+ BlockEntity blockEntity = level.getBlockEntity(pos);
+ if (blockEntity instanceof SpawnerBlockEntity spawner) {
+ CompoundTag customData = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY).copyTag();
+ if (customData.contains("Purpur.mob_type")) {
+ EntityType.byString(customData.getString("Purpur.mob_type")).ifPresent(type -> spawner.getSpawner().setEntityId(type, level, level.random, pos));
+ } else if (customData.contains("Purpur.SpawnData")) {
+ net.minecraft.world.level.SpawnData.CODEC.parse(net.minecraft.nbt.NbtOps.INSTANCE, customData.getCompound("Purpur.SpawnData")).result()
+ .ifPresent(spawnData -> spawner.getSpawner().nextSpawnData = spawnData);
+ }
+ }
+ }

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add turtle egg block options
diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
index 07157822659288e76b2fba34db8d5d566506f33b..18feb559f9fd157dd4a01faf2b2bb18df2a64675 100644
index a6f408e56fa6c9de82fd93555fe21e1b11ce1022..c7377d04ceac3ea624117439783a443c6d6f6d08 100644
--- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java
@@ -195,6 +195,25 @@ public class TurtleEggBlock extends Block {
@@ -203,6 +203,25 @@ public class TurtleEggBlock extends Block {
}
private boolean canDestroyEgg(Level world, Entity entity) {
@@ -36,16 +36,16 @@ index 07157822659288e76b2fba34db8d5d566506f33b..18feb559f9fd157dd4a01faf2b2bb18d
}
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 570abbb70cfb523917de473bd91640719c40a611..7a4c1c04b7e3c558ac19b72693d5abe6c14acdfe 100644
index d4bca5b5f3d10c3a04befd8c365f46433491f299..ac44ee7789b96e60e6d1d964d64ca33a3d3c2c62 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -140,6 +140,15 @@ public class PurpurWorldConfig {
});
}
+ public boolean turtleEggsBreakFromExpOrbs = true;
+ public boolean turtleEggsBreakFromItems = true;
+ public boolean turtleEggsBreakFromMinecarts = true;
+ public boolean turtleEggsBreakFromExpOrbs = false;
+ public boolean turtleEggsBreakFromItems = false;
+ public boolean turtleEggsBreakFromMinecarts = false;
+ private void turtleEggSettings() {
+ turtleEggsBreakFromExpOrbs = getBoolean("blocks.turtle_egg.break-from-exp-orbs", turtleEggsBreakFromExpOrbs);
+ turtleEggsBreakFromItems = getBoolean("blocks.turtle_egg.break-from-items", turtleEggsBreakFromItems);

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Logger settings (suppressing pointless logs)
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index e38e2e5a7ddba9c140f362021b6be0b0974f7cd1..0b3a06027f2c600960cd88159803be187c4d0317 100644
index c7e1f2bac3eca9bb72bf1f8c26cccb2905e1ddfc..94893039363b5fe2d7d0622d0592bce2c867b1c3 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -200,6 +200,7 @@ public class PlayerAdvancements {
@@ -199,6 +199,7 @@ public class PlayerAdvancements {
if (advancementholder == null) {
if (!minecraftkey.getNamespace().equals("minecraft")) return; // CraftBukkit
@@ -17,17 +17,17 @@ index e38e2e5a7ddba9c140f362021b6be0b0974f7cd1..0b3a06027f2c600960cd88159803be18
} else {
this.startProgress(advancementholder, advancementprogress);
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index 50ed7cfe1ecef6d075ba484804827cec83ba2bf2..54f9cd80ac925aa95ff4fdb4d52cbcc2b04263a5 100644
index 1351423a12c19a01f602a202832372a399e6a867..1e2025674eafcf56460c741083c91e2e42d61b19 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -318,6 +318,7 @@ public class WorldGenRegion implements WorldGenLevel {
@@ -326,6 +326,7 @@ public class WorldGenRegion implements WorldGenLevel {
return true;
} else {
// Paper start
// Paper start - Buffer OOB setBlock calls
+ if (!org.purpurmc.purpur.PurpurConfig.loggerSuppressSetBlockFarChunk) // Purpur
if (!hasSetFarWarned) {
Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + pos + ", status: " + this.generatingStatus + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
hasSetFarWarned = true;
Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + String.valueOf(pos) + ", status: " + String.valueOf(this.generatingStatus) + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
hasSetFarWarned = true;
diff --git a/src/main/java/net/minecraft/stats/ServerRecipeBook.java b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
index 4103ddf16164e3992fef0765d368282572537e29..a0cb49233b1dbf53ce9d1bcc52b8967829d0530e 100644
--- a/src/main/java/net/minecraft/stats/ServerRecipeBook.java
@@ -41,7 +41,7 @@ index 4103ddf16164e3992fef0765d368282572537e29..a0cb49233b1dbf53ce9d1bcc52b89678
} else {
handler.accept((RecipeHolder) optional.get());
diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
index 2677e21d8239bf0361a3bc5c9a50c328e54d70f6..544a79d5da661aff19e2019f7b83a3a49350bb68 100644
index 71d057dc8c7362f8e7aaca5e31c9f02b2bf3f281..9d9405af0db28c0f3ffff2881b54f1dc84675a9d 100644
--- a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
+++ b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java
@@ -256,6 +256,7 @@ public final class CraftLegacy {
@@ -49,11 +49,11 @@ index 2677e21d8239bf0361a3bc5c9a50c328e54d70f6..544a79d5da661aff19e2019f7b83a3a4
static {
+ if (!org.purpurmc.purpur.PurpurConfig.loggerSuppressInitLegacyMaterialError) // Purpur
LOGGER.warn("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); // Paper - doesn't need to be an error
LOGGER.warn("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); // Paper - Improve logging and errors; doesn't need to be an error
if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) {
new Exception().printStackTrace();
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index ad239ba9259c5a63b40261ebc44224893496b47d..308d7556f5b12c0aa5b2fde5a23ef6fbacb303de 100644
index a14cf3a5dc2ba265de5e400404afcbd9faa3f25a..a14879f4266c71b7493c05e105114590c6709045 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -237,4 +237,15 @@ public class PurpurConfig {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Disable outdated build check
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index a6b1c83e289bd0a9ad59288ed2da88ac3e607c0f..45f63f2fedee7bcab9cd3ebc3117cecd225b89d2 100644
index 66a3b28d7b943d443ff66fdcfbce6e5260b9463e..222865a3cee62f244a566092a7d814efe478ee01 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -300,7 +300,7 @@ public class Main {
@@ -302,7 +302,7 @@ public class Main {
System.setProperty(net.minecrell.terminalconsole.TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper
}

View File

@@ -5,22 +5,19 @@ Subject: [PATCH] Giants AI settings
diff --git a/src/main/java/net/minecraft/world/entity/monster/Giant.java b/src/main/java/net/minecraft/world/entity/monster/Giant.java
index c3c0fbe71c9af1125c80698865cb9eaf42d4a1c5..d014731fe352246299253bf005e23673abe091bc 100644
index 9602e59cbebeedc85ea75d2a41d3e74f0ff45b46..3c1217d36522b1fd3d1a099d3a12d99016f34c4b 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Giant.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Giant.java
@@ -1,14 +1,37 @@
@@ -1,11 +1,34 @@
package net.minecraft.world.entity.monster;
import net.minecraft.core.BlockPos;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.world.Difficulty;
+import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.EquipmentSlot;
+import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.Pose;
+import net.minecraft.world.entity.SpawnGroupData;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
@@ -46,7 +43,7 @@ index c3c0fbe71c9af1125c80698865cb9eaf42d4a1c5..d014731fe352246299253bf005e23673
public class Giant extends Monster {
public Giant(EntityType<? extends Giant> type, Level world) {
@@ -34,8 +57,23 @@ public class Giant extends Monster {
@@ -30,8 +53,23 @@ public class Giant extends Monster {
@Override
protected void registerGoals() {
@@ -70,15 +67,15 @@ index c3c0fbe71c9af1125c80698865cb9eaf42d4a1c5..d014731fe352246299253bf005e23673
+ }
+ }
}
// Purpur end
@@ -46,6 +84,32 @@ public class Giant extends Monster {
this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(this.level().purpurConfig.giantAttackDamage);
@Override
@@ -47,8 +85,34 @@ 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);
}
+ @Override
+ public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData, @Nullable CompoundTag entityNbt) {
+ SpawnGroupData groupData = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
+ public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData) {
+ SpawnGroupData groupData = super.finalizeSpawn(world, difficulty, spawnReason, entityData);
+ if (groupData == null) {
+ populateDefaultEquipmentSlots(this.random, difficulty);
+ populateDefaultEquipmentEnchantments(this.random, difficulty);
@@ -102,11 +99,6 @@ index c3c0fbe71c9af1125c80698865cb9eaf42d4a1c5..d014731fe352246299253bf005e23673
+ return level().purpurConfig.giantJumpHeight;
+ }
+
@Override
protected float getStandingEyeHeight(Pose pose, EntityDimensions dimensions) {
return 10.440001F;
@@ -62,6 +126,6 @@ public class Giant extends Monster {
@Override
public float getWalkTargetValue(BlockPos pos, LevelReader world) {
- return world.getPathfindingCostFromLightLevels(pos);
@@ -114,7 +106,7 @@ index c3c0fbe71c9af1125c80698865cb9eaf42d4a1c5..d014731fe352246299253bf005e23673
}
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 7a4c1c04b7e3c558ac19b72693d5abe6c14acdfe..b18c498b6fd17ef298cc6ee7b2386188f0b75b36 100644
index ac44ee7789b96e60e6d1d964d64ca33a3d3c2c62..fb61cd498955fee2dec15fa584273a6e19ca58c9 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -554,6 +554,10 @@ public class PurpurWorldConfig {

View File

@@ -5,11 +5,11 @@ Subject: [PATCH] Zombie horse naturally spawn
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 19698f13530183b3580a7a6ad720d078b6c791ba..c0f11d06e077c41d65b25396a14a4d81a39993e2 100644
index fc791a66d299905798c2c1ca542467e4c7933caf..b02d9db8442b209a9df27e417be71b11d426878b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1000,10 +1000,18 @@ public class ServerLevel extends Level implements WorldGenLevel {
boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper
@@ -1006,10 +1006,18 @@ public class ServerLevel extends Level implements WorldGenLevel {
boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper - Configurable spawn chances for skeleton horses
if (flag1) {
- SkeletonHorse entityhorseskeleton = (SkeletonHorse) EntityType.SKELETON_HORSE.create(this);
@@ -30,18 +30,18 @@ index 19698f13530183b3580a7a6ad720d078b6c791ba..c0f11d06e077c41d65b25396a14a4d81
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
this.addFreshEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index b18c498b6fd17ef298cc6ee7b2386188f0b75b36..bae186807d44745942faf8919831f82e475a4f63 100644
index fb61cd498955fee2dec15fa584273a6e19ca58c9..41822b9b050f4267cc0151ea85682523f89af57f 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1484,6 +1484,7 @@ public class PurpurWorldConfig {
@@ -1487,6 +1487,7 @@ public class PurpurWorldConfig {
public double zombieHorseJumpStrengthMax = 1.0D;
public double zombieHorseMovementSpeedMin = 0.2D;
public double zombieHorseMovementSpeedMax = 0.2D;
+ public double zombieHorseSpawnChance = 0.0D;
private void zombieHorseSettings() {
zombieHorseRidable = getBoolean("mobs.zombie_horse.ridable", zombieHorseRidable);
zombieHorseRidableInWater = getBoolean("mobs.zombie_horse.ridable-in-water", zombieHorseRidableInWater);
zombieHorseCanSwim = getBoolean("mobs.zombie_horse.can-swim", zombieHorseCanSwim);
@@ -1499,6 +1500,7 @@ public class PurpurWorldConfig {
@@ -1503,6 +1504,7 @@ public class PurpurWorldConfig {
zombieHorseJumpStrengthMax = getDouble("mobs.zombie_horse.attributes.jump_strength.max", zombieHorseJumpStrengthMax);
zombieHorseMovementSpeedMin = getDouble("mobs.zombie_horse.attributes.movement_speed.min", zombieHorseMovementSpeedMin);
zombieHorseMovementSpeedMax = getDouble("mobs.zombie_horse.attributes.movement_speed.max", zombieHorseMovementSpeedMax);

Some files were not shown because too many files have changed in this diff Show More