aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/unapplied
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2024-06-13 16:32:45 -0700
committerJake Potrebic <[email protected]>2024-06-13 16:32:45 -0700
commitba163e10bb7465950c28cc2e903f7ad26e5a6906 (patch)
tree76f102492bf18c3607802503ebbd6d464b2939f5 /patches/unapplied
parented2ea4538e11b2ae70374fc99fb43bc6c2fd6082 (diff)
downloadPaper-ba163e10bb7465950c28cc2e903f7ad26e5a6906.tar.gz
Paper-ba163e10bb7465950c28cc2e903f7ad26e5a6906.zip
585/1053
Diffstat (limited to 'patches/unapplied')
-rw-r--r--patches/unapplied/server/0545-Move-range-check-for-block-placing-up.patch22
-rw-r--r--patches/unapplied/server/0546-Add-Mob-lookAt-API.patch64
-rw-r--r--patches/unapplied/server/0547-Correctly-check-if-bucket-dispenses-will-succeed-for.patch28
-rw-r--r--patches/unapplied/server/0548-Add-Unix-domain-socket-support.patch137
-rw-r--r--patches/unapplied/server/0549-Add-EntityInsideBlockEvent.patch282
-rw-r--r--patches/unapplied/server/0550-Improve-item-default-attribute-API.patch92
-rw-r--r--patches/unapplied/server/0551-Add-cause-to-Weather-ThunderChangeEvents.patch118
-rw-r--r--patches/unapplied/server/0552-More-Lidded-Block-API.patch79
-rw-r--r--patches/unapplied/server/0553-Limit-item-frame-cursors-on-maps.patch30
-rw-r--r--patches/unapplied/server/0554-Add-PlayerKickEvent-causes.patch539
-rw-r--r--patches/unapplied/server/0555-Add-PufferFishStateChangeEvent.patch50
-rw-r--r--patches/unapplied/server/0556-Fix-PlayerBucketEmptyEvent-result-itemstack.patch42
-rw-r--r--patches/unapplied/server/0557-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch91
-rw-r--r--patches/unapplied/server/0558-Add-option-to-fix-items-merging-through-walls.patch25
-rw-r--r--patches/unapplied/server/0559-Add-BellRevealRaiderEvent.patch33
-rw-r--r--patches/unapplied/server/0560-Fix-invulnerable-end-crystals.patch65
-rw-r--r--patches/unapplied/server/0561-Add-ElderGuardianAppearanceEvent.patch48
-rw-r--r--patches/unapplied/server/0562-Fix-dangerous-end-portal-logic.patch88
-rw-r--r--patches/unapplied/server/0563-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch53
-rw-r--r--patches/unapplied/server/0564-Line-Of-Sight-Changes.patch74
-rw-r--r--patches/unapplied/server/0565-add-per-world-spawn-limits.patch24
-rw-r--r--patches/unapplied/server/0566-Fix-potions-splash-events.patch181
-rw-r--r--patches/unapplied/server/0567-Add-more-LimitedRegion-API.patch56
-rw-r--r--patches/unapplied/server/0568-Fix-PlayerDropItemEvent-using-wrong-item.patch61
-rw-r--r--patches/unapplied/server/0569-Missing-Entity-API.patch1409
-rw-r--r--patches/unapplied/server/0570-Ensure-disconnect-for-book-edit-is-called-on-main.patch19
-rw-r--r--patches/unapplied/server/0571-Fix-return-value-of-Block-applyBoneMeal-always-being.patch19
-rw-r--r--patches/unapplied/server/0572-Use-getChunkIfLoadedImmediately-in-places.patch53
-rw-r--r--patches/unapplied/server/0573-Fix-commands-from-signs-not-firing-command-events.patch120
-rw-r--r--patches/unapplied/server/0574-Add-PlayerArmSwingEvent.patch19
-rw-r--r--patches/unapplied/server/0575-Fix-kick-event-leave-message-not-being-sent.patch113
-rw-r--r--patches/unapplied/server/0576-Don-t-apply-cramming-damage-to-players.patch33
-rw-r--r--patches/unapplied/server/0577-Rate-options-and-timings-for-sensors-and-behaviors.patch134
-rw-r--r--patches/unapplied/server/0578-Add-missing-forceDrop-toggles.patch124
-rw-r--r--patches/unapplied/server/0579-Stinger-API.patch57
-rw-r--r--patches/unapplied/server/0580-Add-System.out-err-catcher.patch118
-rw-r--r--patches/unapplied/server/0581-Prevent-AFK-kick-while-watching-end-credits.patch19
-rw-r--r--patches/unapplied/server/0582-Allow-skipping-writing-of-comments-to-server.propert.patch69
-rw-r--r--patches/unapplied/server/0583-Add-PlayerSetSpawnEvent.patch204
-rw-r--r--patches/unapplied/server/0584-Make-hoppers-respect-inventory-max-stack-size.patch30
-rw-r--r--patches/unapplied/server/0585-Optimize-entity-tracker-passenger-checks.patch19
41 files changed, 0 insertions, 4841 deletions
diff --git a/patches/unapplied/server/0545-Move-range-check-for-block-placing-up.patch b/patches/unapplied/server/0545-Move-range-check-for-block-placing-up.patch
deleted file mode 100644
index 44913b8c49..0000000000
--- a/patches/unapplied/server/0545-Move-range-check-for-block-placing-up.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Nassim Jahnke <[email protected]>
-Date: Wed, 8 Jun 2022 10:52:18 +0200
-Subject: [PATCH] Move range check for block placing up
-
-
-diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 4a5553335cd6bbad8d3a05694710d95c96f62b9d..a04c7677ded862890e6e809db610817b4cfff56a 100644
---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -1734,6 +1734,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- if (itemstack.isItemEnabled(worldserver.enabledFeatures())) {
- BlockHitResult movingobjectpositionblock = packet.getHitResult();
- Vec3 vec3d = movingobjectpositionblock.getLocation();
-+ // Paper start - improve distance check
-+ if (!Double.isFinite(vec3d.x) || !Double.isFinite(vec3d.y) || !Double.isFinite(vec3d.z)) {
-+ return;
-+ }
-+ // Paper end - improve distance check
- BlockPos blockposition = movingobjectpositionblock.getBlockPos();
-
- if (this.player.canInteractWithBlock(blockposition, 1.0D)) {
diff --git a/patches/unapplied/server/0546-Add-Mob-lookAt-API.patch b/patches/unapplied/server/0546-Add-Mob-lookAt-API.patch
deleted file mode 100644
index 3139490a61..0000000000
--- a/patches/unapplied/server/0546-Add-Mob-lookAt-API.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: BillyGalbreath <[email protected]>
-Date: Fri, 14 May 2021 13:42:17 -0500
-Subject: [PATCH] Add Mob#lookAt API
-
-
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
-index 2a8596e4f9d7be966c18e867c2c7b5bfbea9742c..60d09655c5b8b9ff289291ee6badfb5aadf8533e 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
-@@ -96,5 +96,53 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
- public boolean isInDaylight() {
- return getHandle().isSunBurnTick();
- }
-+
-+ @Override
-+ public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.Location location) {
-+ com.google.common.base.Preconditions.checkNotNull(location, "location cannot be null");
-+ com.google.common.base.Preconditions.checkArgument(location.getWorld().equals(getWorld()), "location in a different world");
-+ getHandle().getLookControl().setLookAt(location.getX(), location.getY(), location.getZ());
-+ }
-+
-+ @Override
-+ public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.Location location, float headRotationSpeed, float maxHeadPitch) {
-+ com.google.common.base.Preconditions.checkNotNull(location, "location cannot be null");
-+ com.google.common.base.Preconditions.checkArgument(location.getWorld().equals(getWorld()), "location in a different world");
-+ getHandle().getLookControl().setLookAt(location.getX(), location.getY(), location.getZ(), headRotationSpeed, maxHeadPitch);
-+ }
-+
-+ @Override
-+ public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.entity.Entity entity) {
-+ com.google.common.base.Preconditions.checkNotNull(entity, "entity cannot be null");
-+ com.google.common.base.Preconditions.checkArgument(entity.getWorld().equals(getWorld()), "entity in a different world");
-+ getHandle().getLookControl().setLookAt(((CraftEntity) entity).getHandle());
-+ }
-+
-+ @Override
-+ public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.entity.Entity entity, float headRotationSpeed, float maxHeadPitch) {
-+ com.google.common.base.Preconditions.checkNotNull(entity, "entity cannot be null");
-+ com.google.common.base.Preconditions.checkArgument(entity.getWorld().equals(getWorld()), "entity in a different world");
-+ getHandle().getLookControl().setLookAt(((CraftEntity) entity).getHandle(), headRotationSpeed, maxHeadPitch);
-+ }
-+
-+ @Override
-+ public void lookAt(double x, double y, double z) {
-+ getHandle().getLookControl().setLookAt(x, y, z);
-+ }
-+
-+ @Override
-+ public void lookAt(double x, double y, double z, float headRotationSpeed, float maxHeadPitch) {
-+ getHandle().getLookControl().setLookAt(x, y, z, headRotationSpeed, maxHeadPitch);
-+ }
-+
-+ @Override
-+ public int getHeadRotationSpeed() {
-+ return getHandle().getHeadRotSpeed();
-+ }
-+
-+ @Override
-+ public int getMaxHeadPitch() {
-+ return getHandle().getMaxHeadXRot();
-+ }
- // Paper end
- }
diff --git a/patches/unapplied/server/0547-Correctly-check-if-bucket-dispenses-will-succeed-for.patch b/patches/unapplied/server/0547-Correctly-check-if-bucket-dispenses-will-succeed-for.patch
deleted file mode 100644
index faa6d5c514..0000000000
--- a/patches/unapplied/server/0547-Correctly-check-if-bucket-dispenses-will-succeed-for.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Mon, 1 Jan 2024 12:57:19 -0800
-Subject: [PATCH] Correctly check if bucket dispenses will succeed for event
-
-Upstream incorrectly checks if the bucket place will succeed
-in order to fire the BlockDispenseEvent. This patch corrects
-that.
-
-diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
-index 6c0ec15d47c8174976b40555cf5d3b00d7f97b20..dc68ade2ed576020a4a40608243059d6d9d82f19 100644
---- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
-+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
-@@ -405,7 +405,13 @@ public interface DispenseItemBehavior {
- int y = blockposition.getY();
- int z = blockposition.getZ();
- BlockState iblockdata = worldserver.getBlockState(blockposition);
-- if (iblockdata.isAir() || iblockdata.canBeReplaced() || (dispensiblecontaineritem instanceof BucketItem && iblockdata.getBlock() instanceof LiquidBlockContainer && ((LiquidBlockContainer) iblockdata.getBlock()).canPlaceLiquid((Player) null, worldserver, blockposition, iblockdata, ((BucketItem) dispensiblecontaineritem).content))) {
-+ // Paper start - correctly check if the bucket place will succeed
-+ /* Taken from SolidBucketItem#emptyContents */
-+ boolean willEmptyContentsSolidBucketItem = dispensiblecontaineritem instanceof net.minecraft.world.item.SolidBucketItem && worldserver.isInWorldBounds(blockposition) && iblockdata.isAir();
-+ /* Taken from BucketItem#emptyContents */
-+ boolean willEmptyBucketItem = dispensiblecontaineritem instanceof final BucketItem bucketItem && bucketItem.content instanceof net.minecraft.world.level.material.FlowingFluid && (iblockdata.isAir() || iblockdata.canBeReplaced(bucketItem.content) || (iblockdata.getBlock() instanceof LiquidBlockContainer liquidBlockContainer && liquidBlockContainer.canPlaceLiquid(null, worldserver, blockposition, iblockdata, bucketItem.content)));
-+ if (willEmptyContentsSolidBucketItem || willEmptyBucketItem) {
-+ // Paper end - correctly check if the bucket place will succeed
- org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos());
- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack);
-
diff --git a/patches/unapplied/server/0548-Add-Unix-domain-socket-support.patch b/patches/unapplied/server/0548-Add-Unix-domain-socket-support.patch
deleted file mode 100644
index 712854840a..0000000000
--- a/patches/unapplied/server/0548-Add-Unix-domain-socket-support.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Andrew Steinborn <[email protected]>
-Date: Tue, 11 May 2021 17:39:22 -0400
-Subject: [PATCH] Add Unix domain socket support
-
-
-diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
-index c0261c3cd6de850edbd197272c2d1c52f76e6ebe..b8043b7e778792153620923ea228c1a211c27969 100644
---- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
-+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
-@@ -232,6 +232,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
- this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist);
- // this.worldData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading
- DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
-+ // Paper start - Unix domain socket support
-+ java.net.SocketAddress bindAddress;
-+ if (this.getLocalIp().startsWith("unix:")) {
-+ if (!io.netty.channel.epoll.Epoll.isAvailable()) {
-+ DedicatedServer.LOGGER.error("**** INVALID CONFIGURATION!");
-+ DedicatedServer.LOGGER.error("You are trying to use a Unix domain socket but you're not on a supported OS.");
-+ return false;
-+ } else if (!io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled && !org.spigotmc.SpigotConfig.bungee) {
-+ DedicatedServer.LOGGER.error("**** INVALID CONFIGURATION!");
-+ DedicatedServer.LOGGER.error("Unix domain sockets require IPs to be forwarded from a proxy.");
-+ return false;
-+ }
-+ bindAddress = new io.netty.channel.unix.DomainSocketAddress(this.getLocalIp().substring("unix:".length()));
-+ } else {
- InetAddress inetaddress = null;
-
- if (!this.getLocalIp().isEmpty()) {
-@@ -241,12 +255,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
- if (this.getPort() < 0) {
- this.setPort(dedicatedserverproperties.serverPort);
- }
-+ bindAddress = new java.net.InetSocketAddress(inetaddress, this.getPort());
-+ }
-+ // Paper end - Unix domain socket support
-
- this.initializeKeyPair();
- DedicatedServer.LOGGER.info("Starting Minecraft server on {}:{}", this.getLocalIp().isEmpty() ? "*" : this.getLocalIp(), this.getPort());
-
- try {
-- this.getConnection().startTcpServerListener(inetaddress, this.getPort());
-+ this.getConnection().bind(bindAddress); // Paper - Unix domain socket support
- } catch (IOException ioexception) {
- DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!");
- DedicatedServer.LOGGER.warn("The exception was: {}", ioexception.toString());
-diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
-index d6d7f1c446ba5507f67038ff27775ba75156f4a7..c63c194c44646e6bc1a59426552787011fc2ced5 100644
---- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
-+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
-@@ -76,7 +76,12 @@ public class ServerConnectionListener {
- this.running = true;
- }
-
-+ // Paper start - Unix domain socket support
- public void startTcpServerListener(@Nullable InetAddress address, int port) throws IOException {
-+ bind(new java.net.InetSocketAddress(address, port));
-+ }
-+ public void bind(java.net.SocketAddress address) throws IOException {
-+ // Paper end - Unix domain socket support
- List list = this.channels;
-
- synchronized (this.channels) {
-@@ -84,7 +89,13 @@ public class ServerConnectionListener {
- EventLoopGroup eventloopgroup;
-
- if (Epoll.isAvailable() && this.server.isEpollEnabled()) {
-+ // Paper start - Unix domain socket support
-+ if (address instanceof io.netty.channel.unix.DomainSocketAddress) {
-+ oclass = io.netty.channel.epoll.EpollServerDomainSocketChannel.class;
-+ } else {
- oclass = EpollServerSocketChannel.class;
-+ }
-+ // Paper end - Unix domain socket support
- eventloopgroup = (EventLoopGroup) ServerConnectionListener.SERVER_EPOLL_EVENT_GROUP.get();
- ServerConnectionListener.LOGGER.info("Using epoll channel type");
- } else {
-@@ -117,7 +128,7 @@ public class ServerConnectionListener {
- ((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object));
- io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper - Add Channel initialization listeners
- }
-- }).group(eventloopgroup).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit
-+ }).group(eventloopgroup).localAddress(address)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit // Paper - Unix domain socket support
- }
- }
-
-diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index a04c7677ded862890e6e809db610817b4cfff56a..f4c6e815253f3e49577c554bf632e5c9f4f578ff 100644
---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -2534,6 +2534,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- // Spigot Start
- public SocketAddress getRawAddress()
- {
-+ // Paper start - Unix domain socket support; this can be nullable in the case of a Unix domain socket, so if it is, fake something
-+ if (connection.channel.remoteAddress() == null) {
-+ return new java.net.InetSocketAddress(java.net.InetAddress.getLoopbackAddress(), 0);
-+ }
-+ // Paper end - Unix domain socket support
- return this.connection.channel.remoteAddress();
- }
- // Spigot End
-diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
-index b5d8ef9dd24687b99f5cf547574351c359fb85ba..45a2683c9489bee6d67a1f3d702c17f2e9dc02e4 100644
---- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
-+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
-@@ -80,6 +80,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
- this.connection.setupOutboundProtocol(LoginProtocols.CLIENTBOUND);
- // CraftBukkit start - Connection throttle
- try {
-+ if (!(this.connection.channel.localAddress() instanceof io.netty.channel.unix.DomainSocketAddress)) { // Paper - Unix domain socket support; the connection throttle is useless when you have a Unix domain socket
- long currentTime = System.currentTimeMillis();
- long connectionThrottle = this.server.server.getConnectionThrottle();
- InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress();
-@@ -108,6 +109,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
- }
- }
- }
-+ } // Paper - Unix domain socket support
- } catch (Throwable t) {
- org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t);
- }
-@@ -165,8 +167,11 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
- if (!handledByEvent && proxyLogicEnabled) { // Paper
- // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
- if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper - Add bypass host check
-+ // Paper start - Unix domain socket support
-+ java.net.SocketAddress socketAddress = this.connection.getRemoteAddress();
- this.connection.hostname = split[0];
-- this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort());
-+ this.connection.address = new java.net.InetSocketAddress(split[1], socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0);
-+ // Paper end - Unix domain socket support
- this.connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] );
- } else
- {
diff --git a/patches/unapplied/server/0549-Add-EntityInsideBlockEvent.patch b/patches/unapplied/server/0549-Add-EntityInsideBlockEvent.patch
deleted file mode 100644
index 26d32bc8bf..0000000000
--- a/patches/unapplied/server/0549-Add-EntityInsideBlockEvent.patch
+++ /dev/null
@@ -1,282 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Sat, 8 May 2021 18:02:36 -0700
-Subject: [PATCH] Add EntityInsideBlockEvent
-
-
-diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
-index 83f48d543eac94276ee4d7f7a4c21abdfa8eb8e6..39a92a25c55fb16f1371b0dfe2fb94258e4b7f0d 100644
---- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
-@@ -124,6 +124,7 @@ public abstract class BaseFireBlock extends Block {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (!entity.fireImmune()) {
- entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
- if (entity.getRemainingFireTicks() == 0) {
-diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
-index 2b6e126f57cf67cd719f67e925fee97b2485f73f..8b33e35c843e5c0b8988a2ef2a38a2673035292f 100644
---- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
-@@ -77,6 +77,7 @@ public abstract class BasePressurePlateBlock extends Block {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (!world.isClientSide) {
- int i = this.getSignalForState(state);
-
-diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
-index c1f020efdc5a1170fc43b2579531be8bdcacc83b..8240c32d676a88aa23dcd052ee0136767e54fb0d 100644
---- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java
-@@ -178,6 +178,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (!world.isClientSide) {
- if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) {
- // CraftBukkit start - tilt dripleaf
-diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
-index 7c70c98ee27a6a09e73942ff4dc0f88ceb77936f..4c1f20fafdbd86011959cc2d4983b6c2f8e87a5f 100644
---- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
-@@ -47,6 +47,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- BlockState blockState = world.getBlockState(pos.above());
- if (blockState.isAir()) {
- entity.onAboveBubbleCol(state.getValue(DRAG_DOWN));
-diff --git a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
-index dc9dca35ec406b8046372719392d20acc3f5dac9..776357342c76127af0868591a56a059f89a55f20 100644
---- a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java
-@@ -206,6 +206,7 @@ public class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (!world.isClientSide && this.type.canButtonBeActivatedByArrows() && !(Boolean) state.getValue(ButtonBlock.POWERED)) {
- this.checkPressed(state, world, pos);
- }
-diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
-index fd344c5cf0d6d523abe34d5e3f8d939106942cbb..ff4dda48116a2969704b355ff96407ba869b466e 100644
---- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
-@@ -121,6 +121,7 @@ public class CactusBlock extends Block {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- entity.hurt(world.damageSources().cactus().directBlock(world, pos), 1.0F); // CraftBukkit
- }
-
-diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
-index 47f1f2fec847ff19b994c98d0f5b01d063f37067..d6fffb0953494e8667cc456137cac0f5deebfbb6 100644
---- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java
-@@ -105,6 +105,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if ((Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) {
- entity.hurt(world.damageSources().inFire().directBlock(world, pos), (float) this.fireDamage); // CraftBukkit
- }
-diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
-index fcaf6b4bb7371ce9f00a7d4306f7b2b6884b7c4c..73595922dcff8e7a8595fcf033ab238bc4096630 100644
---- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
-@@ -174,6 +174,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (entity instanceof Ravager && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
- world.destroyBlock(pos, true, entity);
- }
-diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
-index 55a97da8786ec0ae98abe56876c00f4678ba0007..9d69e439ff853465303c2abd896e6c5314752e1e 100644
---- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
-@@ -51,6 +51,7 @@ public class DetectorRailBlock extends BaseRailBlock {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (!world.isClientSide) {
- if (!(Boolean) state.getValue(DetectorRailBlock.POWERED)) {
- this.checkPressed(world, pos, state);
-diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
-index 6845beea2a10adf5eab08744c7eef63c0bd42254..a2de13a366e4a462b746dab035372838127f4994 100644
---- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
-@@ -52,6 +52,7 @@ public class EndPortalBlock extends BaseEntityBlock {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (world instanceof ServerLevel && entity.canChangeDimensions() && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), state.getShape(world, pos), BooleanOp.AND)) {
- ResourceKey<Level> resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
- ServerLevel worldserver = ((ServerLevel) world).getServer().getLevel(resourcekey);
-diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
-index d7a6d4f11325791767be8fcb2355916ca2f63f11..a3339b47165814238351d307c729af14d5e5d1ff 100644
---- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
-@@ -79,6 +79,7 @@ public class FrogspawnBlock extends Block {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (entity.getType().equals(EntityType.FALLING_BLOCK)) {
- this.destroyBlock(world, pos);
- }
-diff --git a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
-index 1ed883c62be357d32365ef182e391e96172d2b56..c6f7815b5fad3aad4635208aa2e5c6739e13cb45 100644
---- a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java
-@@ -60,6 +60,7 @@ public class HoneyBlock extends HalfTransparentBlock {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (this.isSlidingDown(pos, entity)) {
- this.maybeDoSlideAchievement(entity, pos);
- this.doSlideMovement(entity);
-diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
-index 089ead2d55c4fbe361255391f553822715269c38..86e5617d445ce762aa374e236a0ccdfe5901fce5 100644
---- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
-@@ -187,6 +187,7 @@ public class HopperBlock extends BaseEntityBlock {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- BlockEntity blockEntity = world.getBlockEntity(pos);
- if (blockEntity instanceof HopperBlockEntity) {
- HopperBlockEntity.entityInside(world, pos, state, entity, (HopperBlockEntity)blockEntity);
-diff --git a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
-index 7bf2c33a194517d4e52511fe32a8434cbed0361f..d29a62775913922ffb8e3c58ae0db7e37f77226e 100644
---- a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java
-@@ -32,6 +32,7 @@ public class LavaCauldronBlock extends AbstractCauldronBlock {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (this.isEntityInsideContent(state, pos, entity)) {
- entity.lavaHurt();
- }
-diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
-index 5f778ea22efa76ced1ba4455d50b94b3519113fc..7c67efa6e344870b764eb39d5508190349e2e911 100644
---- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
-@@ -66,6 +66,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (!world.isClientSide && entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) {
- // CraftBukkit start
- if (entity.mayInteract(world, pos)) {
-diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
-index d3f2c0e3107a781b462a2b67c10cd1e5f05feefb..a9e3078cefcae8cc4672d514a7add162590d48df 100644
---- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
-@@ -90,6 +90,7 @@ public class NetherPortalBlock extends Block {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (entity.canChangeDimensions()) {
- // CraftBukkit start - Entity in portal
- EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
-diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
-index 15696602249465fa1d13eaec3b8b06574ec06f07..c9ed129db2cadd0a33d69993961f43088725c3cb 100644
---- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java
-@@ -98,6 +98,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl
-
- @Override
- public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (entity instanceof Ravager && world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
- world.destroyBlock(pos, true, entity);
- }
-diff --git a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
-index 1f9cab69fb19c96fb01fff0d7a5ecfdfff46a5d4..a6e6545402904141ffc6218a0158b0e9c67217c8 100644
---- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java
-@@ -63,6 +63,7 @@ public class PowderSnowBlock extends Block implements BucketPickup {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (!(entity instanceof LivingEntity) || entity.getInBlockState().is((Block) this)) {
- entity.makeStuckInBlock(state, new Vec3(0.8999999761581421D, 1.5D, 0.8999999761581421D));
- if (world.isClientSide) {
-diff --git a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
-index 49fce6000ffafc6f53767c971db951b20261b91d..6008c634c408c4eed563815da4d57b2eef69835c 100644
---- a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java
-@@ -85,6 +85,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (entity instanceof LivingEntity && entity.getType() != EntityType.FOX && entity.getType() != EntityType.BEE) {
- entity.makeStuckInBlock(state, new Vec3(0.800000011920929D, 0.75D, 0.800000011920929D));
- if (!world.isClientSide && (Integer) state.getValue(SweetBerryBushBlock.AGE) > 0 && (entity.xOld != entity.getX() || entity.zOld != entity.getZ())) {
-diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
-index 65b30286020b65e23d05307aade344cde827fcf2..e032d8907045c653c3dd449f65e93e40fd0bb6be 100644
---- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
-@@ -135,6 +135,7 @@ public class TripWireBlock extends Block {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (!world.isClientSide) {
- if (!(Boolean) state.getValue(TripWireBlock.POWERED)) {
- this.checkPressed(world, pos);
-diff --git a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
-index 7f5e092e400c3a8422b677ca246031a945a0d359..edc20745649b0837f1371c8d29e71fc0c8e5528f 100644
---- a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
-@@ -34,6 +34,7 @@ public class WaterlilyBlock extends BushBlock {
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
- super.entityInside(state, world, pos, entity);
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (world instanceof ServerLevel && entity instanceof Boat) {
- // CraftBukkit start
- if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState())) {
-diff --git a/src/main/java/net/minecraft/world/level/block/WebBlock.java b/src/main/java/net/minecraft/world/level/block/WebBlock.java
-index 4b621793da3d6fbc44f90df863b099ba992930fb..fc209fab3ed1ccb35706a5529ec23ad8b902e491 100644
---- a/src/main/java/net/minecraft/world/level/block/WebBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/WebBlock.java
-@@ -24,6 +24,7 @@ public class WebBlock extends Block {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- Vec3 vec3 = new Vec3(0.25, 0.05F, 0.25);
- if (entity instanceof LivingEntity livingEntity && livingEntity.hasEffect(MobEffects.WEAVING)) {
- vec3 = new Vec3(0.5, 0.25, 0.5);
-diff --git a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
-index e861cf48aae27a8299437d76f6a84336cdcaddb7..3445916c2915b42967eb396b50b62d1912e3a49f 100644
---- a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java
-@@ -62,6 +62,7 @@ public class WitherRoseBlock extends FlowerBlock {
-
- @Override
- protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
-+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
- if (!world.isClientSide && world.getDifficulty() != Difficulty.PEACEFUL) {
- if (entity instanceof LivingEntity) {
- LivingEntity entityliving = (LivingEntity) entity;
diff --git a/patches/unapplied/server/0550-Improve-item-default-attribute-API.patch b/patches/unapplied/server/0550-Improve-item-default-attribute-API.patch
deleted file mode 100644
index af803064cb..0000000000
--- a/patches/unapplied/server/0550-Improve-item-default-attribute-API.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Sat, 8 May 2021 15:01:54 -0700
-Subject: [PATCH] Improve item default attribute API
-
-Also fixes an issue where upstream isn't
-actually getting the correct default attributes
-
-diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
-index 8afbb8e0cb368e95f23bb78c1261f9aa9b8abd86..0a18983151d17b8e1460b82326b0380087e13795 100644
---- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
-+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
-@@ -74,7 +74,7 @@ public class CraftAttributeInstance implements AttributeInstance {
- return new AttributeModifier(nms.id(), nms.name, nms.amount(), AttributeModifier.Operation.values()[nms.operation().ordinal()]);
- }
-
-- public static AttributeModifier convert(net.minecraft.world.entity.ai.attributes.AttributeModifier nms, EquipmentSlot slot) {
-- return new AttributeModifier(nms.id(), nms.name, nms.amount(), AttributeModifier.Operation.values()[nms.operation().ordinal()], slot);
-+ public static AttributeModifier convert(net.minecraft.world.entity.ai.attributes.AttributeModifier nms, net.minecraft.world.entity.EquipmentSlotGroup slot) { // Paper
-+ return new AttributeModifier(nms.id(), nms.name, nms.amount(), AttributeModifier.Operation.values()[nms.operation().ordinal()], org.bukkit.craftbukkit.CraftEquipmentSlot.getSlot(slot)); // Paper
- }
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
-index 1218163a4d803288aeb1c9254f8cd03013a9fbcc..5fcf64a30a798a516cd3b30123d16cc5c420e45f 100644
---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
-+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
-@@ -199,15 +199,34 @@ public class CraftItemType<M extends ItemMeta> implements ItemType.Typed<M>, Han
- // return CraftEquipmentSlot.getSlot(EntityInsentient.getEquipmentSlotForItem(CraftItemStack.asNMSCopy(ItemStack.of(this))));
- // }
-
-+ // Paper start - improve default attribute API
-+ @Override
-+ public @NotNull Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers() {
-+ return this.getDefaultAttributeModifiers(sg -> true);
-+ }
-+ // Paper end - improve default attribute API
-+
- @Override
- public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot slot) {
-- ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
-+ // Paper start - improve/fix item default attribute API
-+ final net.minecraft.world.entity.EquipmentSlot nmsSlot = CraftEquipmentSlot.getNMS(slot);
-+ return this.getDefaultAttributeModifiers(sg -> sg.test(nmsSlot));
-+ }
-
-- ItemAttributeModifiers nmsDefaultAttributes = this.item.getDefaultAttributeModifiers();
-- nmsDefaultAttributes.forEach(CraftEquipmentSlot.getNMS(slot), (key, value) -> {
-- Attribute attribute = CraftAttribute.minecraftToBukkit(key.value());
-- defaultAttributes.put(attribute, CraftAttributeInstance.convert(value, slot));
-- });
-+ private Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(final java.util.function.Predicate<net.minecraft.world.entity.EquipmentSlotGroup> slotPredicate) {
-+ final ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
-+ ItemAttributeModifiers nmsDefaultAttributes = this.item.components().getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY);
-+ if (nmsDefaultAttributes.modifiers().isEmpty()) {
-+ // we have to check both places cause for some reason vanilla puts default modifiers for armor in a different place
-+ nmsDefaultAttributes = this.item.getDefaultAttributeModifiers();
-+ }
-+ for (final net.minecraft.world.item.component.ItemAttributeModifiers.Entry entry : nmsDefaultAttributes.modifiers()) {
-+ if (!slotPredicate.test(entry.slot())) continue;
-+ final Attribute attribute = CraftAttribute.minecraftHolderToBukkit(entry.attribute());
-+ final AttributeModifier modifier = CraftAttributeInstance.convert(entry.modifier(), entry.slot());
-+ defaultAttributes.put(attribute, modifier);
-+ }
-+ // Paper end - improve/fix item default attribute API
-
- return defaultAttributes.build();
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
-index 206f7fff1be676bebef086a0c1b5350cfd175e33..44e3e4c8326dc93292f482c136fe2d6e6b8eb0b6 100644
---- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
-+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
-@@ -400,15 +400,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
-
- @Override
- public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(Material material, EquipmentSlot slot) {
-- ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
--
-- ItemAttributeModifiers nmsDefaultAttributes = CraftMagicNumbers.getItem(material).getDefaultAttributeModifiers();
-- nmsDefaultAttributes.forEach(CraftEquipmentSlot.getNMS(slot), (key, value) -> {
-- Attribute attribute = CraftAttribute.minecraftToBukkit(key.value());
-- defaultAttributes.put(attribute, CraftAttributeInstance.convert(value, slot));
-- });
--
-- return defaultAttributes.build();
-+ // Paper start - delegate to method on ItemType
-+ final org.bukkit.inventory.ItemType item = material.asItemType();
-+ Preconditions.checkArgument(item != null, material + " is not an item and does not have default attributes");
-+ return item.getDefaultAttributeModifiers(slot);
-+ // Paper end - delegate to method on ItemType
- }
-
- @Override
diff --git a/patches/unapplied/server/0551-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/unapplied/server/0551-Add-cause-to-Weather-ThunderChangeEvents.patch
deleted file mode 100644
index c1bd804863..0000000000
--- a/patches/unapplied/server/0551-Add-cause-to-Weather-ThunderChangeEvents.patch
+++ /dev/null
@@ -1,118 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Wed, 2 Dec 2020 18:23:26 -0800
-Subject: [PATCH] Add cause to Weather/ThunderChangeEvents
-
-
-diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 3816b445279fcd562acc06f08b8cd04bffa49592..3e935df2de58bd57b061c33b00f9d2ea4134ca80 100644
---- a/src/main/java/net/minecraft/server/level/ServerLevel.java
-+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -440,8 +440,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
- this.serverLevelData.setClearWeatherTime(clearDuration);
- this.serverLevelData.setRainTime(rainDuration);
- this.serverLevelData.setThunderTime(rainDuration);
-- this.serverLevelData.setRaining(raining);
-- this.serverLevelData.setThundering(thundering);
-+ this.serverLevelData.setRaining(raining, org.bukkit.event.weather.WeatherChangeEvent.Cause.COMMAND); // Paper - Add cause to Weather/ThunderChangeEvents
-+ this.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.COMMAND); // Paper - Add cause to Weather/ThunderChangeEvents
- }
-
- @Override
-@@ -874,8 +874,8 @@ public class ServerLevel extends Level implements WorldGenLevel {
- this.serverLevelData.setThunderTime(j);
- this.serverLevelData.setRainTime(k);
- this.serverLevelData.setClearWeatherTime(i);
-- this.serverLevelData.setThundering(flag1);
-- this.serverLevelData.setRaining(flag2);
-+ this.serverLevelData.setThundering(flag1, org.bukkit.event.weather.ThunderChangeEvent.Cause.NATURAL); // Paper - Add cause to Weather/ThunderChangeEvents
-+ this.serverLevelData.setRaining(flag2, org.bukkit.event.weather.WeatherChangeEvent.Cause.NATURAL); // Paper - Add cause to Weather/ThunderChangeEvents
- }
-
- this.oThunderLevel = this.thunderLevel;
-@@ -942,14 +942,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
- @VisibleForTesting
- public void resetWeatherCycle() {
- // CraftBukkit start
-- this.serverLevelData.setRaining(false);
-+ this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
- // If we stop due to everyone sleeping we should reset the weather duration to some other random value.
- // Not that everyone ever manages to get the whole server to sleep at the same time....
- if (!this.serverLevelData.isRaining()) {
- this.serverLevelData.setRainTime(0);
- }
- // CraftBukkit end
-- this.serverLevelData.setThundering(false);
-+ this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
- // CraftBukkit start
- // If we stop due to everyone sleeping we should reset the weather duration to some other random value.
- // Not that everyone ever manages to get the whole server to sleep at the same time....
-diff --git a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
-index e50ad48658193f889d65d37c57b1e30ce46758b7..efd0bcfebb3b4f63018d4e20a6a89f79192898d1 100644
---- a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
-+++ b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java
-@@ -337,6 +337,11 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
-
- @Override
- public void setThundering(boolean thundering) {
-+ // Paper start - Add cause to Weather/ThunderChangeEvents
-+ this.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.UNKNOWN);
-+ }
-+ public void setThundering(boolean thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause cause) {
-+ // Paper end - Add cause to Weather/ThunderChangeEvents
- // CraftBukkit start
- if (this.thundering == thundering) {
- return;
-@@ -344,7 +349,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
-
- org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
- if (world != null) {
-- ThunderChangeEvent thunder = new ThunderChangeEvent(world, thundering);
-+ ThunderChangeEvent thunder = new ThunderChangeEvent(world, thundering, cause); // Paper - Add cause to Weather/ThunderChangeEvents
- Bukkit.getServer().getPluginManager().callEvent(thunder);
- if (thunder.isCancelled()) {
- return;
-@@ -371,6 +376,12 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
-
- @Override
- public void setRaining(boolean raining) {
-+ // Paper start - Add cause to Weather/ThunderChangeEvents
-+ this.setRaining(raining, org.bukkit.event.weather.WeatherChangeEvent.Cause.UNKNOWN);
-+ }
-+
-+ public void setRaining(boolean raining, org.bukkit.event.weather.WeatherChangeEvent.Cause cause) {
-+ // Paper end - Add cause to Weather/ThunderChangeEvents
- // CraftBukkit start
- if (this.raining == raining) {
- return;
-@@ -378,7 +389,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData {
-
- org.bukkit.World world = Bukkit.getWorld(this.getLevelName());
- if (world != null) {
-- WeatherChangeEvent weather = new WeatherChangeEvent(world, raining);
-+ WeatherChangeEvent weather = new WeatherChangeEvent(world, raining, cause); // Paper - Add cause to Weather/ThunderChangeEvents
- Bukkit.getServer().getPluginManager().callEvent(weather);
- if (weather.isCancelled()) {
- return;
-diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index 0f1f5e4cbe476f45f9473cc9ce4e50f837eba652..e75d2970329dd92263bc57c7452d0c46afa3da16 100644
---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -1231,7 +1231,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
-
- @Override
- public void setStorm(boolean hasStorm) {
-- this.world.levelData.setRaining(hasStorm);
-+ this.world.serverLevelData.setRaining(hasStorm, org.bukkit.event.weather.WeatherChangeEvent.Cause.PLUGIN); // Paper - Add cause to Weather/ThunderChangeEvents
- this.setWeatherDuration(0); // Reset weather duration (legacy behaviour)
- this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
- }
-@@ -1253,7 +1253,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
-
- @Override
- public void setThundering(boolean thundering) {
-- this.world.serverLevelData.setThundering(thundering);
-+ this.world.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.PLUGIN); // Paper - Add cause to Weather/ThunderChangeEvents
- this.setThunderDuration(0); // Reset weather duration (legacy behaviour)
- this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
- }
diff --git a/patches/unapplied/server/0552-More-Lidded-Block-API.patch b/patches/unapplied/server/0552-More-Lidded-Block-API.patch
deleted file mode 100644
index 437434c525..0000000000
--- a/patches/unapplied/server/0552-More-Lidded-Block-API.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: LemonCaramel <[email protected]>
-Date: Sun, 23 May 2021 17:49:51 +0900
-Subject: [PATCH] More Lidded Block API
-
-
-diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java
-index f4b480e3041fc79060c5fa6ce517047104b280d5..6063f0e1fdc232d063105971359ae688168a2bc4 100644
---- a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java
-+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java
-@@ -73,4 +73,11 @@ public class CraftBarrel extends CraftLootable<BarrelBlockEntity> implements Bar
- public CraftBarrel copy(Location location) {
- return new CraftBarrel(this, location);
- }
-+
-+ // Paper start - More Lidded Block API
-+ @Override
-+ public boolean isOpen() {
-+ return getTileEntity().openersCounter.opened;
-+ }
-+ // Paper end - More Lidded Block API
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
-index 2b6a93a944b27290745278957a3577772b7b8212..6e98a00d526b734992ce39b15768c5820dce4ca8 100644
---- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
-+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
-@@ -92,4 +92,11 @@ public class CraftChest extends CraftLootable<ChestBlockEntity> implements Chest
- public CraftChest copy(Location location) {
- return new CraftChest(this, location);
- }
-+
-+ // Paper start - More Lidded Block API
-+ @Override
-+ public boolean isOpen() {
-+ return getTileEntity().openersCounter.opened;
-+ }
-+ // Paper end - More Lidded Block API
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java
-index 07b63ce5f5e152f6a644134989ffa03af8a12cdf..b64adbba3e52d32d439e64a243cb74f3fbca2ce3 100644
---- a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java
-+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java
-@@ -51,4 +51,11 @@ public class CraftEnderChest extends CraftBlockEntityState<EnderChestBlockEntity
- public CraftEnderChest copy(Location location) {
- return new CraftEnderChest(this, location);
- }
-+
-+ // Paper start - More Lidded Block API
-+ @Override
-+ public boolean isOpen() {
-+ return getTileEntity().openersCounter.opened;
-+ }
-+ // Paper end - More Lidded Block API
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
-index 7676313493bcb6327c2a9c026645fe060733c6ac..f7b199fbc7a740de3ee6952ce12ef2c35f057d7a 100644
---- a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
-+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
-@@ -59,7 +59,7 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
- if (this.getTileEntity().opened && this.getWorldHandle() instanceof net.minecraft.world.level.Level) {
- net.minecraft.world.level.Level world = this.getTileEntity().getLevel();
- world.blockEvent(this.getPosition(), this.getTileEntity().getBlockState().getBlock(), 1, 0);
-- world.playSound(null, this.getPosition(), SoundEvents.SHULKER_BOX_OPEN, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
-+ world.playSound(null, this.getPosition(), SoundEvents.SHULKER_BOX_CLOSE, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); // Paper - More Lidded Block API (Wrong sound)
- }
- this.getTileEntity().opened = false;
- }
-@@ -73,4 +73,11 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
- public CraftShulkerBox copy(Location location) {
- return new CraftShulkerBox(this, location);
- }
-+
-+ // Paper start - More Lidded Block API
-+ @Override
-+ public boolean isOpen() {
-+ return getTileEntity().opened;
-+ }
-+ // Paper end - More Lidded Block API
- }
diff --git a/patches/unapplied/server/0553-Limit-item-frame-cursors-on-maps.patch b/patches/unapplied/server/0553-Limit-item-frame-cursors-on-maps.patch
deleted file mode 100644
index 6072cb5269..0000000000
--- a/patches/unapplied/server/0553-Limit-item-frame-cursors-on-maps.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Yive <[email protected]>
-Date: Wed, 26 May 2021 15:09:33 -0700
-Subject: [PATCH] Limit item frame cursors on maps
-
-
-diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
-index 38c0855a6f9398f8d075f304288cf9e9f695770a..ad24a79e190d07c75d8e29e816fc398894771c2c 100644
---- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
-+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
-@@ -321,8 +321,10 @@ public class MapItemSavedData extends SavedData {
-
- MapFrame worldmapframe1 = new MapFrame(blockposition, entityitemframe.getDirection().get2DDataValue() * 90, entityitemframe.getId());
-
-+ if (this.decorations.size() < player.level().paperConfig().maps.itemFrameCursorLimit) { // Paper - Limit item frame cursors on maps
- this.addDecoration(MapDecorationTypes.FRAME, player.level(), "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null);
- this.frameMarkers.put(worldmapframe1.getId(), worldmapframe1);
-+ } // Paper - Limit item frame cursors on maps
- }
-
- MapDecorations mapdecorations = (MapDecorations) stack.getOrDefault(DataComponents.MAP_DECORATIONS, MapDecorations.EMPTY);
-@@ -487,7 +489,7 @@ public class MapItemSavedData extends SavedData {
- return true;
- }
-
-- if (!this.isTrackedCountOverLimit(256)) {
-+ if (!this.isTrackedCountOverLimit(((Level) world).paperConfig().maps.itemFrameCursorLimit)) { // Paper - Limit item frame cursors on maps
- this.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
- this.addDecoration(mapiconbanner.getDecoration(), world, mapiconbanner.getId(), d0, d1, 180.0D, (Component) mapiconbanner.name().orElse(null)); // CraftBukkit - decompile error
- return true;
diff --git a/patches/unapplied/server/0554-Add-PlayerKickEvent-causes.patch b/patches/unapplied/server/0554-Add-PlayerKickEvent-causes.patch
deleted file mode 100644
index 4229938b0b..0000000000
--- a/patches/unapplied/server/0554-Add-PlayerKickEvent-causes.patch
+++ /dev/null
@@ -1,539 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Sat, 15 May 2021 20:30:45 -0700
-Subject: [PATCH] Add PlayerKickEvent causes
-
-
-diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
-index dbcf183483766f39334d7f7e8336033906625f3f..300929a406905f5ff1ede664d5b99fb0938d4d2e 100644
---- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
-+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
-@@ -40,14 +40,14 @@ public class SignedMessageChain {
- if (signature == null) {
- throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.MISSING_PROFILE_KEY);
- } else if (playerPublicKey.data().hasExpired()) {
-- throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.EXPIRED_PROFILE_KEY);
-+ throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.EXPIRED_PROFILE_KEY, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes
- } else {
- SignedMessageLink signedMessageLink = SignedMessageChain.this.nextLink;
- if (signedMessageLink == null) {
- throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.CHAIN_BROKEN);
- } else if (body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp)) {
- this.setChainBroken();
-- throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT);
-+ throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes
- } else {
- SignedMessageChain.this.lastTimeStamp = body.timeStamp();
- PlayerChatMessage playerChatMessage = new PlayerChatMessage(signedMessageLink, signature, body, null, FilterMask.PASS_THROUGH);
-@@ -80,8 +80,15 @@ public class SignedMessageChain {
- static final Component INVALID_SIGNATURE = Component.translatable("chat.disabled.invalid_signature");
- static final Component OUT_OF_ORDER_CHAT = Component.translatable("chat.disabled.out_of_order_chat");
-
-- public DecodeException(Component message) {
-+ // Paper start
-+ public final org.bukkit.event.player.PlayerKickEvent.Cause kickCause;
-+ public DecodeException(Component message, org.bukkit.event.player.PlayerKickEvent.Cause event) {
- super(message);
-+ this.kickCause = event;
-+ }
-+ // Paper end
-+ public DecodeException(Component message) {
-+ this(message, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); // Paper
- }
- }
-
-diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
-index 5c47573843c25b0d15037a28e55b616c829f694d..cdbdacee826c424177096ee78427eaf80131b5fd 100644
---- a/src/main/java/net/minecraft/server/MinecraftServer.java
-+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
-@@ -2266,7 +2266,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
- ServerPlayer entityplayer = (ServerPlayer) iterator.next();
-
- if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420)
-- entityplayer.connection.disconnect(org.spigotmc.SpigotConfig.whitelistMessage); // Paper - use configurable message
-+ entityplayer.connection.disconnect(org.spigotmc.SpigotConfig.whitelistMessage, org.bukkit.event.player.PlayerKickEvent.Cause.WHITELIST); // Paper - use configurable message
- }
- }
-
-diff --git a/src/main/java/net/minecraft/server/commands/BanIpCommands.java b/src/main/java/net/minecraft/server/commands/BanIpCommands.java
-index b451f98aaa5b694cfd9fadebcb5a4441951e9e87..b23dca02fe85a299d13353706915db2aec3467a6 100644
---- a/src/main/java/net/minecraft/server/commands/BanIpCommands.java
-+++ b/src/main/java/net/minecraft/server/commands/BanIpCommands.java
-@@ -66,7 +66,7 @@ public class BanIpCommands {
- }
-
- for (ServerPlayer serverPlayer : list) {
-- serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.ip_banned"));
-+ serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.ip_banned"), org.bukkit.event.player.PlayerKickEvent.Cause.IP_BANNED); // Paper - kick event cause
- }
-
- return list.size();
-diff --git a/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java b/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java
-index e63a03a419061edc6a1305f6469d2282d960d6d1..be436480873ac914d67dac36061ac087b7389ab1 100644
---- a/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java
-+++ b/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java
-@@ -55,7 +55,7 @@ public class BanPlayerCommands {
- );
- ServerPlayer serverPlayer = source.getServer().getPlayerList().getPlayer(gameProfile.getId());
- if (serverPlayer != null) {
-- serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.banned"));
-+ serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.banned"), org.bukkit.event.player.PlayerKickEvent.Cause.BANNED); // Paper - kick event cause
- }
- }
- }
-diff --git a/src/main/java/net/minecraft/server/commands/KickCommand.java b/src/main/java/net/minecraft/server/commands/KickCommand.java
-index d1caaecfdfba1cdeba032f0bc38c06541fa61633..6468b3a25c7527a2fde6899e4812b5cb79ce4b1d 100644
---- a/src/main/java/net/minecraft/server/commands/KickCommand.java
-+++ b/src/main/java/net/minecraft/server/commands/KickCommand.java
-@@ -48,7 +48,7 @@ public class KickCommand {
-
- for (ServerPlayer serverPlayer : targets) {
- if (!source.getServer().isSingleplayerOwner(serverPlayer.getGameProfile())) {
-- serverPlayer.connection.disconnect(reason);
-+ serverPlayer.connection.disconnect(reason, org.bukkit.event.player.PlayerKickEvent.Cause.KICK_COMMAND); // Paper - kick event cause
- source.sendSuccess(() -> Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason), true);
- i++;
- }
-diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
-index 661765a9fe1c2e49299262190501ee3b3294a2f1..7659a3f50f5a90814dc7331ea00d6251dcf32600 100644
---- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
-+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
-@@ -127,7 +127,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
- } else if (!this.isSingleplayerOwner()) {
- // Paper start - This needs to be handled on the main thread for plugins
- server.submit(() -> {
-- this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE);
-+ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
- });
- // Paper end - This needs to be handled on the main thread for plugins
- }
-@@ -163,7 +163,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
- }
- } catch (Exception ex) {
- ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
-- this.disconnect("Invalid payload REGISTER!");
-+ this.disconnect("Invalid payload REGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
- }
- } else if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER)) {
- try {
-@@ -173,7 +173,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
- }
- } catch (Exception ex) {
- ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
-- this.disconnect("Invalid payload UNREGISTER!");
-+ this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
- }
- } else {
- try {
-@@ -191,7 +191,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
- this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data);
- } catch (Exception ex) {
- ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
-- this.disconnect("Invalid custom payload!");
-+ this.disconnect("Invalid custom payload!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause
- }
- }
-
-@@ -207,7 +207,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
- PacketUtils.ensureRunningOnSameThread(packet, this, (BlockableEventLoop) this.server);
- if (packet.action() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
- ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id());
-- this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"));
-+ this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - kick event cause
- }
- // Paper start - adventure pack callbacks
- // call the callbacks before the previously-existing event so the event has final say
-@@ -237,7 +237,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
- return;
- }
- // CraftBukkit end
-- this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY);
-+ this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY, org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_COOKIE); // Paper - kick event cause
- }
-
- protected void keepConnectionAlive() {
-@@ -249,7 +249,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
-
- if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets
- if (this.keepAlivePending && !this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected
-- this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE);
-+ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
- } else if (this.checkIfClosed(currentTime)) { // Paper
- this.keepAlivePending = true;
- this.keepAliveTime = currentTime;
-@@ -265,7 +265,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
- private boolean checkIfClosed(long time) {
- if (this.closed) {
- if (time - this.closedListenerTime >= 15000L) {
-- this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE);
-+ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
- }
-
- return false;
-@@ -316,18 +316,28 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
- }
-
- // CraftBukkit start
-- @Deprecated
-+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
- public void disconnect(String s) { // Paper
-- this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); // Paper
-+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); // Paper
- }
- // CraftBukkit end
-
-+ // Paper start - kick event cause
-+ public void disconnect(String s, PlayerKickEvent.Cause cause) {
-+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), cause);
-+ }
-+
- // Paper start
-+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
- public void disconnect(final Component reason) {
-- this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason));
-+ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
-+ }
-+
-+ public void disconnect(final Component reason, PlayerKickEvent.Cause cause) {
-+ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason), cause);
- }
-
-- public void disconnect(net.kyori.adventure.text.Component reason) {
-+ public void disconnect(net.kyori.adventure.text.Component reason, org.bukkit.event.player.PlayerKickEvent.Cause cause) { // Paper - kick event cause
- // Paper end
- // CraftBukkit start - fire PlayerKickEvent
- if (this.processedDisconnect) {
-@@ -337,7 +347,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
- Waitable waitable = new Waitable() {
- @Override
- protected Object evaluate() {
-- ServerCommonPacketListenerImpl.this.disconnect(reason); // Paper - adventure
-+ ServerCommonPacketListenerImpl.this.disconnect(reason, cause); // Paper - adventure
- return null;
- }
- };
-@@ -356,7 +366,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
-
- net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
-
-- PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - adventure
-+ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage, cause); // Paper - adventure
-
- if (this.cserver.getServer().isRunning()) {
- this.cserver.getPluginManager().callEvent(event);
-diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index f4c6e815253f3e49577c554bf632e5c9f4f578ff..1f6e123fbd146129e5460631fdd88de9dd60bdca 100644
---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -349,7 +349,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) {
- if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) {
- ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
-- this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer); // Paper - use configurable kick message
-+ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_PLAYER); // Paper - use configurable kick message & kick event cause
- return;
- }
- } else {
-@@ -368,7 +368,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) {
- if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) {
- ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
-- this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle); // Paper - use configurable kick message
-+ this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle, org.bukkit.event.player.PlayerKickEvent.Cause.FLYING_VEHICLE); // Paper - use configurable kick message & kick event cause
- return;
- }
- } else {
-@@ -399,7 +399,7 @@ 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.resetLastActionTime(); // CraftBukkit - SPIGOT-854
-- this.disconnect(Component.translatable("multiplayer.disconnect.idling"));
-+ this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
- }
-
- }
-@@ -481,7 +481,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) {
- PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
- if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) {
-- this.disconnect(Component.translatable("multiplayer.disconnect.invalid_vehicle_movement"));
-+ this.disconnect(Component.translatable("multiplayer.disconnect.invalid_vehicle_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_VEHICLE_MOVEMENT); // Paper - kick event cause
- } else {
- Entity entity = this.player.getRootVehicle();
-
-@@ -683,7 +683,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
- if (packet.getId() == this.awaitingTeleport) {
- if (this.awaitingPositionFromClient == null) {
-- this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"));
-+ this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
- return;
- }
-
-@@ -741,7 +741,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async
- // CraftBukkit start
- if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper - configurable tab spam limits
-- this.disconnect(Component.translatable("disconnect.spam"));
-+ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause
- return;
- }
- // CraftBukkit end
-@@ -906,7 +906,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- // Paper start - validate pick item position
- if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) {
- ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
-- this.disconnect("Invalid hotbar selection (Hacking?)");
-+ this.disconnect("Invalid hotbar selection (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
- return;
- }
- this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed
-@@ -1085,7 +1085,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
- if (byteLength > 256 * 4) {
- ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!");
-- server.scheduleOnMain(() -> this.disconnect("Book too large!"));
-+ server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
- return;
- }
- byteTotal += byteLength;
-@@ -1108,14 +1108,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
-
- if (byteTotal > byteAllowed) {
- ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size());
-- server.scheduleOnMain(() -> this.disconnect("Book too large!"));
-+ server.scheduleOnMain(() -> this.disconnect("Book too large!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
- return;
- }
- }
- // Paper end - Book size limits
- // CraftBukkit start
- if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
-- this.disconnect("Book edited too quickly!");
-+ this.disconnect("Book edited too quickly!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
- return;
- }
- this.lastBookTick = MinecraftServer.currentTick;
-@@ -1227,7 +1227,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- public void handleMovePlayer(ServerboundMovePlayerPacket packet) {
- PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
- if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) {
-- this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"));
-+ this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
- } else {
- ServerLevel worldserver = this.player.serverLevel();
-
-@@ -1656,7 +1656,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- this.dropCount++;
- if (this.dropCount >= 20) {
- ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
-- this.disconnect("You dropped your items too quickly (Hacking?)");
-+ this.disconnect("You dropped your items too quickly (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
- return;
- }
- }
-@@ -1939,7 +1939,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- this.player.resetLastActionTime();
- } else {
- ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
-- this.disconnect("Invalid hotbar selection (Hacking?)"); // CraftBukkit
-+ this.disconnect("Invalid hotbar selection (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // CraftBukkit // Paper - kick event cause
- }
- }
-
-@@ -2137,7 +2137,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
-
- private void tryHandleChat(String s, Runnable runnable, boolean sync) { // CraftBukkit
- if (ServerGamePacketListenerImpl.isChatMessageIllegal(s)) {
-- this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"));
-+ this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper
- } else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales
- this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false));
- } else {
-@@ -2160,7 +2160,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
-
- if (optional.isEmpty()) {
- ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
-- this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED);
-+ this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
- }
-
- return optional;
-@@ -2346,7 +2346,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- // this.chatSpamTickCount += 20;
- if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
- // CraftBukkit end
-- this.disconnect(Component.translatable("disconnect.spam"));
-+ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
- }
-
- }
-@@ -2358,7 +2358,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- synchronized (this.lastSeenMessages) {
- if (!this.lastSeenMessages.applyOffset(packet.offset())) {
- ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
-- this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED);
-+ this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
- }
-
- }
-@@ -2506,7 +2506,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- }
-
- if (i > 4096) {
-- this.disconnect(Component.translatable("multiplayer.disconnect.too_many_pending_chats"));
-+ this.disconnect(Component.translatable("multiplayer.disconnect.too_many_pending_chats"), org.bukkit.event.player.PlayerKickEvent.Cause.TOO_MANY_PENDING_CHATS); // Paper - kick event cause
- }
-
- }
-@@ -2564,7 +2564,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- // Spigot Start
- if ( entity == this.player && !this.player.isSpectator() )
- {
-- this.disconnect( "Cannot interact with self!" );
-+ this.disconnect( "Cannot interact with self!" , org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - kick event cause
- return;
- }
- // Spigot End
-@@ -2678,7 +2678,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- }
- }
-
-- ServerGamePacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.invalid_entity_attacked"));
-+ ServerGamePacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.invalid_entity_attacked"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_ENTITY_ATTACKED); // Paper - add cause
- ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
- }
- });
-@@ -3075,7 +3075,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- // Paper start - auto recipe limit
- if (!org.bukkit.Bukkit.isPrimaryThread()) {
- if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
-- this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam")));
-+ this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
- return;
- }
- }
-@@ -3317,7 +3317,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
-
- if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) {
- if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) {
-- this.disconnect(ProfilePublicKey.EXPIRED_PROFILE_PUBLIC_KEY);
-+ this.disconnect(ProfilePublicKey.EXPIRED_PROFILE_PUBLIC_KEY, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes
- } else {
- try {
- SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator();
-@@ -3330,7 +3330,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
- } catch (ProfilePublicKey.ValidationException profilepublickey_b) {
- ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
-- this.disconnect(profilepublickey_b.getComponent());
-+ this.disconnect(profilepublickey_b.getComponent(), profilepublickey_b.kickCause); // Paper - kick event causes
- }
-
- }
-diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
-index 40d1451b43228b802aabe8c021ad781ceb8d8df8..709cf6655e5ccb17caf0b8a735ae957cb0509f2c 100644
---- a/src/main/java/net/minecraft/server/players/PlayerList.java
-+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
-@@ -681,7 +681,7 @@ public abstract class PlayerList {
- while (iterator.hasNext()) {
- entityplayer = (ServerPlayer) iterator.next();
- this.save(entityplayer); // CraftBukkit - Force the player's inventory to be saved
-- entityplayer.connection.disconnect(Component.translatable("multiplayer.disconnect.duplicate_login"));
-+ entityplayer.connection.disconnect(Component.translatable("multiplayer.disconnect.duplicate_login"), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause
- }
-
- // Instead of kicking then returning, we need to store the kick reason
-@@ -1318,8 +1318,8 @@ public abstract class PlayerList {
- // Paper end
- // CraftBukkit start - disconnect safely
- for (ServerPlayer player : this.players) {
-- if (isRestarting) player.connection.disconnect(org.spigotmc.SpigotConfig.restartMessage); else // Paper
-- player.connection.disconnect(this.server.server.shutdownMessage()); // CraftBukkit - add custom shutdown message // Paper - Adventure
-+ if (isRestarting) player.connection.disconnect(org.spigotmc.SpigotConfig.restartMessage, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); else // Paper - kick event cause (cause is never used here)
-+ player.connection.disconnect(this.server.server.shutdownMessage(), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); // CraftBukkit - add custom shutdown message // Paper - Adventure & KickEventCause (cause is never used here)
- }
- // CraftBukkit end
-
-diff --git a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java
-index f472dea0bd4f834c0c8f0aa59ae7cdae082b14af..2fa51c3a70f43cd23b8f494fc643d66cecfda7d2 100644
---- a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java
-+++ b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java
-@@ -24,7 +24,7 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) {
-
- public static ProfilePublicKey createValidated(SignatureValidator servicesSignatureVerifier, UUID playerUuid, ProfilePublicKey.Data publicKeyData) throws ProfilePublicKey.ValidationException {
- if (!publicKeyData.validateSignature(servicesSignatureVerifier, playerUuid)) {
-- throw new ProfilePublicKey.ValidationException(INVALID_SIGNATURE);
-+ throw new ProfilePublicKey.ValidationException(INVALID_SIGNATURE, org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PUBLIC_KEY_SIGNATURE); // Paper - kick event causes
- } else {
- return new ProfilePublicKey(publicKeyData);
- }
-@@ -88,8 +88,16 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) {
- }
-
- public static class ValidationException extends ThrowingComponent {
-+ public final org.bukkit.event.player.PlayerKickEvent.Cause kickCause; // Paper
-+ @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper
- public ValidationException(Component messageText) {
-+ // Paper start
-+ this(messageText, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN);
-+ }
-+ public ValidationException(Component messageText, org.bukkit.event.player.PlayerKickEvent.Cause kickCause) {
-+ // Paper end
- super(messageText);
-+ this.kickCause = kickCause; // Paper
- }
- }
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-index 9a3ba0011f306a3cd1e3c60fcc329ab93011ebd8..eee0c49bbf9bc768fcf7275c29536b4f16b1d421 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-@@ -633,7 +633,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
- org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot
- if (this.getHandle().connection == null) return;
-
-- this.getHandle().connection.disconnect(message == null ? "" : message);
-+ this.getHandle().connection.disconnect(message == null ? "" : message, org.bukkit.event.player.PlayerKickEvent.Cause.PLUGIN); // Paper - kick event cause
- }
-
- // Paper start
-@@ -645,10 +645,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
-
- @Override
- public void kick(final net.kyori.adventure.text.Component message) {
-+ kick(message, org.bukkit.event.player.PlayerKickEvent.Cause.PLUGIN);
-+ }
-+
-+ @Override
-+ public void kick(net.kyori.adventure.text.Component message, org.bukkit.event.player.PlayerKickEvent.Cause cause) {
- org.spigotmc.AsyncCatcher.catchOp("player kick");
- final ServerGamePacketListenerImpl connection = this.getHandle().connection;
- if (connection != null) {
-- connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message);
-+ connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause);
- }
- }
-
-@@ -707,7 +712,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
-
- // Paper start - Improve chat handling
- if (ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) {
-- this.getHandle().connection.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"));
-+ this.getHandle().connection.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - kick event causes
- } else {
- if (msg.startsWith("/")) {
- this.getHandle().connection.handleCommand(msg);
-diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java
-index 051b9e3a5d29a5840d596468e3ddd013bedc8da3..e3b262add194a126e731c68e68f3139a00cacacb 100644
---- a/src/main/java/org/spigotmc/RestartCommand.java
-+++ b/src/main/java/org/spigotmc/RestartCommand.java
-@@ -73,7 +73,7 @@ public class RestartCommand extends Command
- // Kick all players
- for ( ServerPlayer p : com.google.common.collect.ImmutableList.copyOf( MinecraftServer.getServer().getPlayerList().players ) )
- {
-- p.connection.disconnect(SpigotConfig.restartMessage);
-+ p.connection.disconnect(SpigotConfig.restartMessage, org.bukkit.event.player.PlayerKickEvent.Cause.RESTART_COMMAND); // Paper - kick event reason (cause is never used))
- }
- // Give the socket a chance to send the packets
- try
diff --git a/patches/unapplied/server/0555-Add-PufferFishStateChangeEvent.patch b/patches/unapplied/server/0555-Add-PufferFishStateChangeEvent.patch
deleted file mode 100644
index 87e61bb2a3..0000000000
--- a/patches/unapplied/server/0555-Add-PufferFishStateChangeEvent.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: HexedHero <[email protected]>
-Date: Mon, 10 May 2021 16:59:05 +0100
-Subject: [PATCH] Add PufferFishStateChangeEvent
-
-
-diff --git a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
-index 9498bac12196637c187961424ef23ecb77eddff8..3f0fad476fe573c3ba946a9436d1b3f7c5260ee2 100644
---- a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
-+++ b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java
-@@ -101,25 +101,39 @@ public class Pufferfish extends AbstractFish {
- public void tick() {
- if (!this.level().isClientSide && this.isAlive() && this.isEffectiveAi()) {
- if (this.inflateCounter > 0) {
-+ boolean increase = true; // Paper - Add PufferFishStateChangeEvent
- if (this.getPuffState() == 0) {
-+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 1).callEvent()) { // Paper - Add PufferFishStateChangeEvent
- this.makeSound(SoundEvents.PUFFER_FISH_BLOW_UP);
- this.setPuffState(1);
-+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
- } else if (this.inflateCounter > 40 && this.getPuffState() == 1) {
-+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 2).callEvent()) { // Paper - Add PufferFishStateChangeEvent
- this.makeSound(SoundEvents.PUFFER_FISH_BLOW_UP);
- this.setPuffState(2);
-+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
- }
-
-+ if (increase) { // Paper - Add PufferFishStateChangeEvent
- ++this.inflateCounter;
-+ } // Paper - Add PufferFishStateChangeEvent
- } else if (this.getPuffState() != 0) {
-+ boolean increase = true; // Paper - Add PufferFishStateChangeEvent
- if (this.deflateTimer > 60 && this.getPuffState() == 2) {
-+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 1).callEvent()) { // Paper - Add PufferFishStateChangeEvent
- this.makeSound(SoundEvents.PUFFER_FISH_BLOW_OUT);
- this.setPuffState(1);
-+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
- } else if (this.deflateTimer > 100 && this.getPuffState() == 1) {
-+ if (new io.papermc.paper.event.entity.PufferFishStateChangeEvent((org.bukkit.entity.PufferFish) getBukkitEntity(), 0).callEvent()) { // Paper - Add PufferFishStateChangeEvent
- this.makeSound(SoundEvents.PUFFER_FISH_BLOW_OUT);
- this.setPuffState(0);
-+ } else { increase = false; } // Paper - Add PufferFishStateChangeEvent
- }
-
-+ if (increase) { // Paper - Add PufferFishStateChangeEvent
- ++this.deflateTimer;
-+ } // Paper - Add PufferFishStateChangeEvent
- }
- }
-
diff --git a/patches/unapplied/server/0556-Fix-PlayerBucketEmptyEvent-result-itemstack.patch b/patches/unapplied/server/0556-Fix-PlayerBucketEmptyEvent-result-itemstack.patch
deleted file mode 100644
index 6e70197163..0000000000
--- a/patches/unapplied/server/0556-Fix-PlayerBucketEmptyEvent-result-itemstack.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Thu, 20 May 2021 22:16:37 -0700
-Subject: [PATCH] Fix PlayerBucketEmptyEvent result itemstack
-
-Fixes SPIGOT-2560: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-2560
-
-diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
-index b20263db1988529dd6e7969d65ee30096f10d591..6d494b80ae002aea00afa44adf83dad1ae5bbbc1 100644
---- a/src/main/java/net/minecraft/world/item/BucketItem.java
-+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
-@@ -40,6 +40,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
-
- public class BucketItem extends Item implements DispensibleContainerItem {
-
-+ private static @Nullable ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper - Fix PlayerBucketEmptyEvent result itemstack
-+
- public final Fluid content;
-
- public BucketItem(Fluid fluid, Item.Properties settings) {
-@@ -123,6 +125,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
- }
-
- public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
-+ // Paper start - Fix PlayerBucketEmptyEvent result itemstack
-+ if (itemLeftInHandAfterPlayerBucketEmptyEvent != null) {
-+ ItemStack itemInHand = itemLeftInHandAfterPlayerBucketEmptyEvent;
-+ itemLeftInHandAfterPlayerBucketEmptyEvent = null;
-+ return itemInHand;
-+ }
-+ // Paper end - Fix PlayerBucketEmptyEvent result itemstack
- return !player.hasInfiniteMaterials() ? new ItemStack(Items.BUCKET) : stack;
- }
-
-@@ -180,6 +189,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
- ((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
- return false;
- }
-+ itemLeftInHandAfterPlayerBucketEmptyEvent = event.getItemStack() != null ? event.getItemStack().equals(CraftItemStack.asNewCraftStack(net.minecraft.world.item.Items.BUCKET)) ? null : CraftItemStack.asNMSCopy(event.getItemStack()) : ItemStack.EMPTY; // Paper - Fix PlayerBucketEmptyEvent result itemstack
- }
- // CraftBukkit end
- if (!flag2) {
diff --git a/patches/unapplied/server/0557-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch b/patches/unapplied/server/0557-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch
deleted file mode 100644
index 04a6d787b6..0000000000
--- a/patches/unapplied/server/0557-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Aikar <[email protected]>
-Date: Fri, 29 May 2020 20:29:02 -0400
-Subject: [PATCH] Synchronize PalettedContainer instead of
- ThreadingDetector/Semaphore
-
-Mojang has flaws in their logic about chunks being concurrently
-wrote to. So we constantly see crashes around multiple threads writing.
-
-Additionally, java has optimized synchronization so well that its
-in many times faster than trying to manage read write locks for low
-contention situations.
-
-And this is extremely a low contention situation.
-
-diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
-index 2e5afbd2a69c4eeabd9a48bff6a37a7004565716..2fa0097a9374a89177e4f1068d1bfed30b8ff122 100644
---- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
-+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
-@@ -30,14 +30,14 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
- public final IdMap<T> registry;
- private volatile PalettedContainer.Data<T> data;
- private final PalettedContainer.Strategy strategy;
-- private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer");
-+ // private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer"); // Paper - unused
-
- public void acquire() {
-- this.threadingDetector.checkAndLock();
-+ // this.threadingDetector.checkAndLock(); // Paper - disable this - use proper synchronization
- }
-
- public void release() {
-- this.threadingDetector.checkAndUnlock();
-+ // this.threadingDetector.checkAndUnlock(); // Paper - disable this
- }
-
- public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) {
-@@ -104,7 +104,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
- }
-
- @Override
-- public int onResize(int newBits, T object) {
-+ public synchronized int onResize(int newBits, T object) { // Paper - synchronize
- PalettedContainer.Data<T> data = this.data;
- PalettedContainer.Data<T> data2 = this.createOrReuseData(data, newBits);
- data2.copyFrom(data.palette, data.storage);
-@@ -129,7 +129,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
- return this.getAndSet(this.strategy.getIndex(x, y, z), value);
- }
-
-- private T getAndSet(int index, T value) {
-+ private synchronized T getAndSet(int index, T value) { // Paper - synchronize
- int i = this.data.palette.idFor(value);
- int j = this.data.storage.getAndSet(index, i);
- return this.data.palette.valueFor(j);
-@@ -145,7 +145,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
- }
- }
-
-- private void set(int index, T value) {
-+ private synchronized void set(int index, T value) { // Paper - synchronize
- int i = this.data.palette.idFor(value);
- this.data.storage.set(index, i);
- }
-@@ -168,7 +168,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
- intSet.forEach(id -> action.accept(palette.valueFor(id)));
- }
-
-- public void read(FriendlyByteBuf buf) {
-+ public synchronized void read(FriendlyByteBuf buf) { // Paper - synchronize
- this.acquire();
-
- try {
-@@ -183,7 +183,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
- }
-
- @Override
-- public void write(FriendlyByteBuf buf) {
-+ public synchronized void write(FriendlyByteBuf buf) { // Paper - synchronize
- this.acquire();
-
- try {
-@@ -231,7 +231,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
- }
-
- @Override
-- public PalettedContainerRO.PackedData<T> pack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider) {
-+ public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider) { // Paper - synchronize
- this.acquire();
-
- PalettedContainerRO.PackedData var12;
diff --git a/patches/unapplied/server/0558-Add-option-to-fix-items-merging-through-walls.patch b/patches/unapplied/server/0558-Add-option-to-fix-items-merging-through-walls.patch
deleted file mode 100644
index 05969fb324..0000000000
--- a/patches/unapplied/server/0558-Add-option-to-fix-items-merging-through-walls.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: GioSDA <[email protected]>
-Date: Wed, 10 Mar 2021 10:06:45 -0800
-Subject: [PATCH] Add option to fix items merging through walls
-
-
-diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
-index a6dc7c7aab40a9b21c7debd0f9a1619238cff94c..1817e8876f13695578b0a5b2f75e738b3286db48 100644
---- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
-+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
-@@ -283,6 +283,14 @@ public class ItemEntity extends Entity implements TraceableEntity {
- ItemEntity entityitem = (ItemEntity) iterator.next();
-
- if (entityitem.isMergable()) {
-+ // Paper start - Fix items merging through walls
-+ if (this.level().paperConfig().fixes.fixItemsMergingThroughWalls) {
-+ if (this.level().clipDirect(this.position(), entityitem.position(),
-+ net.minecraft.world.phys.shapes.CollisionContext.of(this)) == net.minecraft.world.phys.HitResult.Type.BLOCK) {
-+ continue;
-+ }
-+ }
-+ // Paper end - Fix items merging through walls
- this.tryToMerge(entityitem);
- if (this.isRemoved()) {
- break;
diff --git a/patches/unapplied/server/0559-Add-BellRevealRaiderEvent.patch b/patches/unapplied/server/0559-Add-BellRevealRaiderEvent.patch
deleted file mode 100644
index 871aa2a198..0000000000
--- a/patches/unapplied/server/0559-Add-BellRevealRaiderEvent.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Owen1212055 <[email protected]>
-Date: Wed, 26 May 2021 17:09:07 -0400
-Subject: [PATCH] Add BellRevealRaiderEvent
-
-
-diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
-index 86dac3f82da065bf79d94da9df192f51ce4665e2..946c9dbfabf154db53d811906fd98d17992167d1 100644
---- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
-+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java
-@@ -156,7 +156,7 @@ public class BellBlockEntity extends BlockEntity {
- return BellBlockEntity.isRaiderWithinRange(pos, entityliving);
- }).map((entity) -> (org.bukkit.entity.LivingEntity) entity.getBukkitEntity()).collect(java.util.stream.Collectors.toCollection(java.util.ArrayList::new)); // CraftBukkit
-
-- org.bukkit.craftbukkit.event.CraftEventFactory.handleBellResonateEvent(world, pos, entities).forEach(BellBlockEntity::glow);
-+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBellResonateEvent(world, pos, entities).forEach(entity -> glow(entity, pos)); // Paper - Add BellRevealRaiderEvent
- // CraftBukkit end
- }
-
-@@ -189,6 +189,13 @@ public class BellBlockEntity extends BlockEntity {
- }
-
- private static void glow(LivingEntity entity) {
-+ // Paper start - Add BellRevealRaiderEvent
-+ glow(entity, null);
-+ }
-+
-+ private static void glow(LivingEntity entity, @javax.annotation.Nullable BlockPos pos) {
-+ if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(org.bukkit.craftbukkit.block.CraftBlock.at(entity.level(), pos), (org.bukkit.entity.Raider) entity.getBukkitEntity()).callEvent()) return;
-+ // Paper end - Add BellRevealRaiderEvent
- entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60));
- }
-
diff --git a/patches/unapplied/server/0560-Fix-invulnerable-end-crystals.patch b/patches/unapplied/server/0560-Fix-invulnerable-end-crystals.patch
deleted file mode 100644
index bddc6ec149..0000000000
--- a/patches/unapplied/server/0560-Fix-invulnerable-end-crystals.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Max Lee <[email protected]>
-Date: Thu, 27 May 2021 14:52:30 -0700
-Subject: [PATCH] Fix invulnerable end crystals
-
-MC-108513
-
-diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
-index dd0c441fef3b4db28d6ba52118095600512ffe9c..d8e440e14b72dc48ae97244f1bed2c06abd997ab 100644
---- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
-+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
-@@ -30,6 +30,7 @@ public class EndCrystal extends Entity {
- private static final EntityDataAccessor<Optional<BlockPos>> DATA_BEAM_TARGET = SynchedEntityData.defineId(EndCrystal.class, EntityDataSerializers.OPTIONAL_BLOCK_POS);
- private static final EntityDataAccessor<Boolean> DATA_SHOW_BOTTOM = SynchedEntityData.defineId(EndCrystal.class, EntityDataSerializers.BOOLEAN);
- public int time;
-+ public boolean generatedByDragonFight = false; // Paper - Fix invulnerable end crystals
-
- public EndCrystal(EntityType<? extends EndCrystal> type, Level world) {
- super(type, world);
-@@ -66,6 +67,17 @@ public class EndCrystal extends Entity {
- }
- // CraftBukkit end
- }
-+ // Paper start - Fix invulnerable end crystals
-+ if (this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
-+ if (!java.util.Objects.equals(((ServerLevel) this.level()).uuid, this.getOriginWorld())
-+ || ((ServerLevel) this.level()).getDragonFight() == null
-+ || ((ServerLevel) this.level()).getDragonFight().respawnStage == null
-+ || ((ServerLevel) this.level()).getDragonFight().respawnStage.ordinal() > net.minecraft.world.level.dimension.end.DragonRespawnAnimation.SUMMONING_DRAGON.ordinal()) {
-+ this.setInvulnerable(false);
-+ this.setBeamTarget(null);
-+ }
-+ }
-+ // Paper end - Fix invulnerable end crystals
- }
-
- }
-@@ -77,6 +89,7 @@ public class EndCrystal extends Entity {
- }
-
- nbt.putBoolean("ShowBottom", this.showsBottom());
-+ if (this.generatedByDragonFight) nbt.putBoolean("Paper.GeneratedByDragonFight", this.generatedByDragonFight); // Paper - Fix invulnerable end crystals
- }
-
- @Override
-@@ -85,6 +98,7 @@ public class EndCrystal extends Entity {
- if (nbt.contains("ShowBottom", 1)) {
- this.setShowBottom(nbt.getBoolean("ShowBottom"));
- }
-+ if (nbt.contains("Paper.GeneratedByDragonFight", 1)) this.generatedByDragonFight = nbt.getBoolean("Paper.GeneratedByDragonFight"); // Paper - Fix invulnerable end crystals
-
- }
-
-diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
-index c3bf90178abe89ccc987718237d472ed10c70d69..260c3a7dc592fba220ad4a7febb43ee2c9279115 100644
---- a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
-+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
-@@ -114,6 +114,7 @@ public class SpikeFeature extends Feature<SpikeConfiguration> {
- endCrystal.moveTo(
- (double)spike.getCenterX() + 0.5, (double)(spike.getHeight() + 1), (double)spike.getCenterZ() + 0.5, random.nextFloat() * 360.0F, 0.0F
- );
-+ endCrystal.generatedByDragonFight = true; // Paper - Fix invulnerable end crystals
- world.addFreshEntity(endCrystal);
- BlockPos blockPos2 = endCrystal.blockPosition();
- this.setBlock(world, blockPos2.below(), Blocks.BEDROCK.defaultBlockState());
diff --git a/patches/unapplied/server/0561-Add-ElderGuardianAppearanceEvent.patch b/patches/unapplied/server/0561-Add-ElderGuardianAppearanceEvent.patch
deleted file mode 100644
index d9bc14356d..0000000000
--- a/patches/unapplied/server/0561-Add-ElderGuardianAppearanceEvent.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Owen1212055 <[email protected]>
-Date: Fri, 19 Mar 2021 23:39:09 -0400
-Subject: [PATCH] Add ElderGuardianAppearanceEvent
-
-
-diff --git a/src/main/java/net/minecraft/world/effect/MobEffectUtil.java b/src/main/java/net/minecraft/world/effect/MobEffectUtil.java
-index f8026eb1d9b10e468d28ee2e1296653e873c87db..23977c2074b920b646a639bef79c0f625b284bea 100644
---- a/src/main/java/net/minecraft/world/effect/MobEffectUtil.java
-+++ b/src/main/java/net/minecraft/world/effect/MobEffectUtil.java
-@@ -55,10 +55,23 @@ public final class MobEffectUtil {
- }
-
- public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel worldserver, @Nullable Entity entity, Vec3 vec3d, double d0, MobEffectInstance mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause) {
-+ // Paper start - Add ElderGuardianAppearanceEvent
-+ return addEffectToPlayersAround(worldserver, entity, vec3d, d0, mobeffect, i, cause, null);
-+ }
-+
-+ public static List<ServerPlayer> addEffectToPlayersAround(ServerLevel worldserver, @Nullable Entity entity, Vec3 vec3d, double d0, MobEffectInstance mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause, @Nullable java.util.function.Predicate<ServerPlayer> playerPredicate) {
-+ // Paper end - Add ElderGuardianAppearanceEvent
- // CraftBukkit end
- Holder<MobEffect> holder = mobeffect.getEffect();
- List<ServerPlayer> list = worldserver.getPlayers((entityplayer) -> {
-- return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(holder) || entityplayer.getEffect(holder).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(holder).endsWithin(i - 1));
-+ // Paper start - Add ElderGuardianAppearanceEvent
-+ boolean condition = entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(holder) || entityplayer.getEffect(holder).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(holder).endsWithin(i - 1));
-+ if (condition) {
-+ return playerPredicate == null || playerPredicate.test(entityplayer); // Only test the player AFTER it is true
-+ } else {
-+ return false;
-+ }
-+ // Paper ned - Add ElderGuardianAppearanceEvent
- });
-
- list.forEach((entityplayer) -> {
-diff --git a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
-index 4e4b68904151d0d851b13f14f89c1c305e95fd5a..fd995b1f29c47884e9db2cb92f1dd615d62ae032 100644
---- a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
-+++ b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
-@@ -67,7 +67,7 @@ public class ElderGuardian extends Guardian {
- super.customServerAiStep();
- if ((this.tickCount + this.getId()) % 1200 == 0) {
- MobEffectInstance mobeffect = new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 6000, 2);
-- List<ServerPlayer> list = MobEffectUtil.addEffectToPlayersAround((ServerLevel) this.level(), this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
-+ List<ServerPlayer> list = MobEffectUtil.addEffectToPlayersAround((ServerLevel) this.level(), this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK, (player) -> new io.papermc.paper.event.entity.ElderGuardianAppearanceEvent((org.bukkit.entity.ElderGuardian) this.getBukkitEntity(), player.getBukkitEntity()).callEvent()); // CraftBukkit // Paper - Add ElderGuardianAppearanceEvent
-
- list.forEach((entityplayer) -> {
- entityplayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));
diff --git a/patches/unapplied/server/0562-Fix-dangerous-end-portal-logic.patch b/patches/unapplied/server/0562-Fix-dangerous-end-portal-logic.patch
deleted file mode 100644
index 88c7e811e1..0000000000
--- a/patches/unapplied/server/0562-Fix-dangerous-end-portal-logic.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Spottedleaf <[email protected]>
-Date: Fri, 4 Jun 2021 17:06:52 -0400
-Subject: [PATCH] Fix dangerous end portal logic
-
-End portals could teleport entities during move calls. Stupid
-logic given the caller will never expect that kind of thing,
-and will result in all kinds of dupes.
-
-Move the tick logic into the post tick, where portaling was
-designed to happen in the first place.
-
-diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
-index 21150f44e4f71aba3801d5392e45243112d012c0..b4670fc653721283f95bb61ac57c306b224b7fb7 100644
---- a/src/main/java/net/minecraft/world/entity/Entity.java
-+++ b/src/main/java/net/minecraft/world/entity/Entity.java
-@@ -422,6 +422,36 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
- return this.originWorld;
- }
- // Paper end - Entity origin API
-+ // Paper start - make end portalling safe
-+ public BlockPos portalBlock;
-+ public ServerLevel portalWorld;
-+ public void tickEndPortal() {
-+ BlockPos pos = this.portalBlock;
-+ ServerLevel world = this.portalWorld;
-+ this.portalBlock = null;
-+ this.portalWorld = null;
-+
-+ if (pos == null || world == null || world != this.level) {
-+ return;
-+ }
-+
-+ if (this.isPassenger() || this.isVehicle() || !this.canChangeDimensions() || this.isRemoved() || !this.valid || !this.isAlive()) {
-+ return;
-+ }
-+
-+ ResourceKey<Level> resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
-+ ServerLevel worldserver = world.getServer().getLevel(resourcekey);
-+
-+ org.bukkit.event.entity.EntityPortalEnterEvent event = new org.bukkit.event.entity.EntityPortalEnterEvent(this.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
-+ event.callEvent();
-+
-+ if (this instanceof ServerPlayer) {
-+ ((ServerPlayer) this).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
-+ return;
-+ }
-+ this.teleportTo(worldserver, null);
-+ }
-+ // Paper end - make end portalling safe
- public float getBukkitYaw() {
- return this.yRot;
- }
-@@ -2833,6 +2863,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
- }
-
- this.processPortalCooldown();
-+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation) this.tickEndPortal(); // Paper - make end portalling safe
- }
- }
-
-diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
-index a2de13a366e4a462b746dab035372838127f4994..7272d70c672b54dcf595beafd7a2ed33c96e35cb 100644
---- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
-@@ -61,16 +61,13 @@ public class EndPortalBlock extends BaseEntityBlock {
- // return; // CraftBukkit - always fire event in case plugins wish to change it
- }
-
-- // CraftBukkit start - Entity in portal
-- EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
-- world.getCraftServer().getPluginManager().callEvent(event);
--
-- if (entity instanceof ServerPlayer) {
-- ((ServerPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
-- return;
-+ // Paper start - move all of this logic into portal tick
-+ entity.portalWorld = ((ServerLevel)world);
-+ entity.portalBlock = pos.immutable();
-+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation) {
-+ entity.tickEndPortal();
- }
-- // CraftBukkit end
-- entity.changeDimension(worldserver);
-+ // Paper end - move all of this logic into portal tick
- }
-
- }
diff --git a/patches/unapplied/server/0563-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/patches/unapplied/server/0563-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch
deleted file mode 100644
index 3d03f4c4d2..0000000000
--- a/patches/unapplied/server/0563-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Aikar <[email protected]>
-Date: Wed, 12 Sep 2018 21:47:01 -0400
-Subject: [PATCH] Optimize Biome Mob Lookups for Mob Spawning
-
-Uses an EnumMap as well as a Set paired List for O(1) contains calls.
-
-diff --git a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
-index d6ebd2ebc3a4a184f1237b00c6c4e709c61d2eec..cb7465ed9bdebe1b31f02d11725e75ff8b44ca66 100644
---- a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
-+++ b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
-@@ -75,8 +75,40 @@ public class MobSpawnSettings {
- }
-
- public static class Builder {
-+ // Paper start - Perf: keep track of data in a pair set to give O(1) contains calls - we have to hook removals incase plugins mess with it
-+ public static class MobList extends java.util.ArrayList<MobSpawnSettings.SpawnerData> {
-+ java.util.Set<MobSpawnSettings.SpawnerData> biomes = new java.util.HashSet<>();
-+
-+ @Override
-+ public boolean contains(Object o) {
-+ return biomes.contains(o);
-+ }
-+
-+ @Override
-+ public boolean add(MobSpawnSettings.SpawnerData BiomeSettingsMobs) {
-+ biomes.add(BiomeSettingsMobs);
-+ return super.add(BiomeSettingsMobs);
-+ }
-+
-+ @Override
-+ public MobSpawnSettings.SpawnerData remove(int index) {
-+ MobSpawnSettings.SpawnerData removed = super.remove(index);
-+ if (removed != null) {
-+ biomes.remove(removed);
-+ }
-+ return removed;
-+ }
-+
-+ @Override
-+ public void clear() {
-+ biomes.clear();
-+ super.clear();
-+ }
-+ }
-+ // use toImmutableEnumMap collector
- private final Map<MobCategory, List<MobSpawnSettings.SpawnerData>> spawners = Stream.of(MobCategory.values())
-- .collect(ImmutableMap.toImmutableMap(mobCategory -> (MobCategory)mobCategory, mobCategory -> Lists.newArrayList()));
-+ .collect(Maps.toImmutableEnumMap(mobCategory -> (MobCategory)mobCategory, mobCategory -> new MobList())); // Use MobList instead of ArrayList
-+ // Paper end - Perf: keep track of data in a pair set to give O(1) contains calls
- private final Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> mobSpawnCosts = Maps.newLinkedHashMap();
- private float creatureGenerationProbability = 0.1F;
-
diff --git a/patches/unapplied/server/0564-Line-Of-Sight-Changes.patch b/patches/unapplied/server/0564-Line-Of-Sight-Changes.patch
deleted file mode 100644
index fd1932cb3f..0000000000
--- a/patches/unapplied/server/0564-Line-Of-Sight-Changes.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: TwoLeggedCat <[email protected]>
-Date: Sat, 29 May 2021 14:33:25 -0500
-Subject: [PATCH] Line Of Sight Changes
-
-
-diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
-index 5b03665a04a68dc49fb0100b58148ffa2d8f6000..f6febeb8f24b227520cda80efac7e43c023f1b10 100644
---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
-+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
-@@ -3704,7 +3704,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
- Vec3 vec3d = new Vec3(this.getX(), this.getEyeY(), this.getZ());
- Vec3 vec3d1 = new Vec3(entity.getX(), entity.getEyeY(), entity.getZ());
-
-- return vec3d1.distanceTo(vec3d) > 128.0D ? false : this.level().clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS;
-+ // Paper - diff on change - used in CraftLivingEntity#hasLineOfSight(Location) and CraftWorld#lineOfSightExists
-+ return vec3d1.distanceToSqr(vec3d) > 128.0D * 128.0D ? false : this.level().clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getType() == HitResult.Type.MISS; // Paper - Perf: Use distance squared
- }
- }
-
-diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
-index 9bf4d9eaa961196873b3be89c2ca05e701025871..54a79d802806d5354db74d27c04458e8baedfa0c 100644
---- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
-+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
-@@ -519,5 +519,21 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
- public org.bukkit.NamespacedKey getKey() {
- return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(this.getHandle().getLevel().dimension().location());
- }
-+
-+ public boolean lineOfSightExists(Location from, Location to) {
-+ Preconditions.checkArgument(from != null, "from parameter in lineOfSightExists cannot be null");
-+ Preconditions.checkArgument(to != null, "to parameter in lineOfSightExists cannot be null");
-+ if (from.getWorld() != to.getWorld()) {
-+ return false;
-+ }
-+
-+ net.minecraft.world.phys.Vec3 start = new net.minecraft.world.phys.Vec3(from.getX(), from.getY(), from.getZ());
-+ net.minecraft.world.phys.Vec3 end = new net.minecraft.world.phys.Vec3(to.getX(), to.getY(), to.getZ());
-+ if (end.distanceToSqr(start) > 128D * 128D) {
-+ return false; // Return early if the distance is greater than 128 blocks
-+ }
-+
-+ return this.getHandle().clip(new net.minecraft.world.level.ClipContext(start, end, net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, net.minecraft.world.phys.shapes.CollisionContext.empty())).getType() == net.minecraft.world.phys.HitResult.Type.MISS;
-+ }
- // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
-index 2701e53086f4be07c341cd1e4fcd7a351e77c486..1cfc3d18fb785410f5acfcf3c338776858efe25a 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
-@@ -627,6 +627,23 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
- return this.getHandle().hasLineOfSight(((CraftEntity) other).getHandle());
- }
-
-+ // Paper start
-+ @Override
-+ public boolean hasLineOfSight(Location loc) {
-+ if (this.getHandle().level() != ((CraftWorld) loc.getWorld()).getHandle()) {
-+ return false;
-+ }
-+
-+ net.minecraft.world.phys.Vec3 start = new net.minecraft.world.phys.Vec3(this.getHandle().getX(), this.getHandle().getEyeY(), this.getHandle().getZ());
-+ net.minecraft.world.phys.Vec3 end = new net.minecraft.world.phys.Vec3(loc.getX(), loc.getY(), loc.getZ());
-+ if (end.distanceToSqr(start) > 128D * 128D) {
-+ return false; // Return early if the distance is greater than 128 blocks
-+ }
-+
-+ return this.getHandle().level().clipDirect(start, end, net.minecraft.world.phys.shapes.CollisionContext.of(this.getHandle())) == net.minecraft.world.phys.HitResult.Type.MISS;
-+ }
-+ // Paper end
-+
- @Override
- public boolean getRemoveWhenFarAway() {
- return this.getHandle() instanceof Mob && !((Mob) this.getHandle()).isPersistenceRequired();
diff --git a/patches/unapplied/server/0565-add-per-world-spawn-limits.patch b/patches/unapplied/server/0565-add-per-world-spawn-limits.patch
deleted file mode 100644
index c77624fa6d..0000000000
--- a/patches/unapplied/server/0565-add-per-world-spawn-limits.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: chase <[email protected]>
-Date: Wed, 2 Dec 2020 22:43:39 -0800
-Subject: [PATCH] add per world spawn limits
-
-
-diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-index e75d2970329dd92263bc57c7452d0c46afa3da16..e10043db80ee5dc6468c8caa16d55ad418fa3670 100644
---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -222,6 +222,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
- this.biomeProvider = biomeProvider;
-
- this.environment = env;
-+ // Paper start - per world spawn limits
-+ for (SpawnCategory spawnCategory : SpawnCategory.values()) {
-+ if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
-+ setSpawnLimit(spawnCategory, this.world.paperConfig().entities.spawning.spawnLimits.getInt(CraftSpawnCategory.toNMS(spawnCategory)));
-+ }
-+ }
-+ // Paper end - per world spawn limits
- }
-
- @Override
diff --git a/patches/unapplied/server/0566-Fix-potions-splash-events.patch b/patches/unapplied/server/0566-Fix-potions-splash-events.patch
deleted file mode 100644
index 6cc585bcf8..0000000000
--- a/patches/unapplied/server/0566-Fix-potions-splash-events.patch
+++ /dev/null
@@ -1,181 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Thu, 20 May 2021 20:40:53 -0700
-Subject: [PATCH] Fix potions splash events
-
-Fix PotionSplashEvent for water splash potions
-Fixes SPIGOT-6221: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-6221
-Fix splash events cancellation that still show particles/sound
-
-diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
-index d7fe99e55b64b66af7795c2d0aeca69023f93bae..bf627d66310f201172d3cd3ea12f1d321cd3cd62 100644
---- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
-+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
-@@ -104,55 +104,76 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
- ItemStack itemstack = this.getItem();
- PotionContents potioncontents = (PotionContents) itemstack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY);
-
-+ boolean showParticles = true; // Paper - Fix potions splash events
- if (potioncontents.is(Potions.WATER)) {
-- this.applyWater();
-+ showParticles = this.applyWater(hitResult); // Paper - Fix potions splash events
- } else if (true || potioncontents.hasEffects()) { // CraftBukkit - Call event even if no effects to apply
- if (this.isLingering()) {
-- this.makeAreaOfEffectCloud(potioncontents, hitResult); // CraftBukkit - Pass MovingObjectPosition
-+ showParticles = this.makeAreaOfEffectCloud(potioncontents, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper
- } else {
-- this.applySplash(potioncontents.getAllEffects(), hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition
-+ showParticles = this.applySplash(potioncontents.getAllEffects(), hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper
- }
- }
-
-+ if (showParticles) { // Paper - Fix potions splash events
- int i = potioncontents.potion().isPresent() && ((Potion) ((Holder) potioncontents.potion().get()).value()).hasInstantEffects() ? 2007 : 2002;
-
- this.level().levelEvent(i, this.blockPosition(), potioncontents.getColor());
-+ } // Paper - Fix potions splash events
- this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
- }
- }
-
-- private void applyWater() {
-+ private static final Predicate<net.minecraft.world.entity.LivingEntity> APPLY_WATER_GET_ENTITIES_PREDICATE = ThrownPotion.WATER_SENSITIVE_OR_ON_FIRE.or(Axolotl.class::isInstance); // Paper - Fix potions splash events
-+ private boolean applyWater(@Nullable HitResult hitResult) { // Paper - Fix potions splash events
- AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
-- List<net.minecraft.world.entity.LivingEntity> list = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb, ThrownPotion.WATER_SENSITIVE_OR_ON_FIRE);
-+ // Paper start - Fix potions splash events
-+ List<net.minecraft.world.entity.LivingEntity> list = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb, ThrownPotion.APPLY_WATER_GET_ENTITIES_PREDICATE);
-+ Map<LivingEntity, Double> affected = new HashMap<>();
-+ java.util.Set<LivingEntity> rehydrate = new java.util.HashSet<>();
-+ java.util.Set<LivingEntity> extinguish = new java.util.HashSet<>();
- Iterator iterator = list.iterator();
-
- while (iterator.hasNext()) {
- net.minecraft.world.entity.LivingEntity entityliving = (net.minecraft.world.entity.LivingEntity) iterator.next();
-+ if (entityliving instanceof Axolotl axolotl) {
-+ rehydrate.add(((org.bukkit.entity.Axolotl) axolotl.getBukkitEntity()));
-+ }
- double d0 = this.distanceToSqr((Entity) entityliving);
-
- if (d0 < 16.0D) {
- if (entityliving.isSensitiveToWater()) {
-- entityliving.hurt(this.damageSources().indirectMagic(this, this.getOwner()), 1.0F);
-+ affected.put(entityliving.getBukkitLivingEntity(), 1.0);
- }
-
- if (entityliving.isOnFire() && entityliving.isAlive()) {
-- entityliving.extinguishFire();
-+ extinguish.add(entityliving.getBukkitLivingEntity());
- }
- }
- }
-
-- List<Axolotl> list1 = this.level().getEntitiesOfClass(Axolotl.class, axisalignedbb);
-- Iterator iterator1 = list1.iterator();
--
-- while (iterator1.hasNext()) {
-- Axolotl axolotl = (Axolotl) iterator1.next();
--
-- axolotl.rehydrate();
-+ io.papermc.paper.event.entity.WaterBottleSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callWaterBottleSplashEvent(
-+ this, hitResult, affected, rehydrate, extinguish
-+ );
-+ if (!event.isCancelled()) {
-+ for (LivingEntity affectedEntity : event.getToDamage()) {
-+ ((CraftLivingEntity) affectedEntity).getHandle().hurt(this.damageSources().indirectMagic(this, this.getOwner()), 1.0F);
-+ }
-+ for (LivingEntity toExtinguish : event.getToExtinguish()) {
-+ ((CraftLivingEntity) toExtinguish).getHandle().extinguishFire();
-+ }
-+ for (LivingEntity toRehydrate : event.getToRehydrate()) {
-+ if (((CraftLivingEntity) toRehydrate).getHandle() instanceof Axolotl axolotl) {
-+ axolotl.rehydrate();
-+ }
-+ }
-+ // Paper end - Fix potions splash events
- }
-+ return !event.isCancelled(); // Paper - Fix potions splash events
-
- }
-
-- private void applySplash(Iterable<MobEffectInstance> iterable, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
-+ private boolean applySplash(Iterable<MobEffectInstance> iterable, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events
- AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
- List<net.minecraft.world.entity.LivingEntity> list = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb);
- Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit
-@@ -170,6 +191,7 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
- if (d0 < 16.0D) {
- double d1;
-
-+ // Paper - diff on change, used when calling the splash event for water splash potions
- if (entityliving == entity) {
- d1 = 1.0D;
- } else {
-@@ -225,10 +247,11 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
- }
- }
- }
-+ return !event.isCancelled(); // Paper - Fix potions splash events
-
- }
-
-- private void makeAreaOfEffectCloud(PotionContents potioncontents, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
-+ private boolean makeAreaOfEffectCloud(PotionContents potioncontents, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
- AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
- Entity entity = this.getOwner();
-
-@@ -241,14 +264,16 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
- entityareaeffectcloud.setWaitTime(10);
- entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / (float) entityareaeffectcloud.getDuration());
- entityareaeffectcloud.setPotionContents(potioncontents);
-+ boolean noEffects = potioncontents.hasEffects(); // Paper - Fix potions splash events
- // CraftBukkit start
- org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, position, entityareaeffectcloud);
-- if (!(event.isCancelled() || entityareaeffectcloud.isRemoved())) {
-+ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved() || (noEffects && !entityareaeffectcloud.potionContents.hasEffects()))) { // Paper - don't spawn area effect cloud if the effects were empty and not changed during the event handling
- this.level().addFreshEntity(entityareaeffectcloud);
- } else {
- entityareaeffectcloud.discard(null); // CraftBukkit - add Bukkit remove cause
- }
- // CraftBukkit end
-+ return !event.isCancelled(); // Paper - Fix potions splash events
- }
-
- public boolean isLingering() {
-diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
-index b3aceea0a7f57f32da3924ed73231a0dc65ccc51..3102324bfdaa82826eead1f40d24bf13553f6506 100644
---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
-+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
-@@ -875,6 +875,32 @@ public class CraftEventFactory {
- return event;
- }
-
-+ // Paper start - Fix potions splash events
-+ public static io.papermc.paper.event.entity.WaterBottleSplashEvent callWaterBottleSplashEvent(net.minecraft.world.entity.projectile.ThrownPotion potion, @Nullable HitResult hitResult, Map<LivingEntity, Double> affectedEntities, java.util.Set<LivingEntity> rehydrate, java.util.Set<LivingEntity> extinguish) {
-+ ThrownPotion thrownPotion = (ThrownPotion) potion.getBukkitEntity();
-+
-+ Block hitBlock = null;
-+ BlockFace hitFace = null;
-+ org.bukkit.entity.Entity hitEntity = null;
-+
-+ if (hitResult != null) {
-+ if (hitResult.getType() == HitResult.Type.BLOCK) {
-+ BlockHitResult blockHitResult = (BlockHitResult) hitResult;
-+ hitBlock = CraftBlock.at(potion.level(), blockHitResult.getBlockPos());
-+ hitFace = CraftBlock.notchToBlockFace(blockHitResult.getDirection());
-+ } else if (hitResult.getType() == HitResult.Type.ENTITY) {
-+ hitEntity = ((EntityHitResult) hitResult).getEntity().getBukkitEntity();
-+ }
-+ }
-+
-+ io.papermc.paper.event.entity.WaterBottleSplashEvent event = new io.papermc.paper.event.entity.WaterBottleSplashEvent(
-+ thrownPotion, hitEntity, hitBlock, hitFace, affectedEntities, rehydrate, extinguish
-+ );
-+ event.callEvent();
-+ return event;
-+ }
-+ // Paper end - Fix potions splash events
-+
- /**
- * BlockFadeEvent
- */
diff --git a/patches/unapplied/server/0567-Add-more-LimitedRegion-API.patch b/patches/unapplied/server/0567-Add-more-LimitedRegion-API.patch
deleted file mode 100644
index 6e183e954e..0000000000
--- a/patches/unapplied/server/0567-Add-more-LimitedRegion-API.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: dfsek <[email protected]>
-Date: Sat, 19 Jun 2021 20:15:59 -0700
-Subject: [PATCH] Add more LimitedRegion API
-
-
-diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
-index e7266835946c3bf49dbd83fe677481e8eddd16e5..7d6ee60b1d3e023e1eabc59eb591c3ae3d8ac043 100644
---- a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
-+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java
-@@ -254,4 +254,45 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe
- public void addEntityWithPassengers(net.minecraft.world.entity.Entity entity, CreatureSpawnEvent.SpawnReason reason) {
- this.entities.add(entity);
- }
-+
-+ // Paper start - Add more LimitedRegion API
-+ @Override
-+ public void setBlockState(int x, int y, int z, BlockState state) {
-+ BlockPos pos = new BlockPos(x, y, z);
-+ if (!state.getBlockData().matches(getHandle().getBlockState(pos).createCraftBlockData())) {
-+ throw new IllegalArgumentException("BlockData does not match! Expected " + state.getBlockData().getAsString(false) + ", got " + getHandle().getBlockState(pos).createCraftBlockData().getAsString(false));
-+ }
-+ getHandle().getBlockEntity(pos).loadWithComponents(((org.bukkit.craftbukkit.block.CraftBlockEntityState<?>) state).getSnapshotNBT(), this.getHandle().registryAccess());
-+ }
-+
-+ @Override
-+ public void scheduleBlockUpdate(int x, int y, int z) {
-+ BlockPos position = new BlockPos(x, y, z);
-+ getHandle().scheduleTick(position, getHandle().getBlockState(position).getBlock(), 0);
-+ }
-+
-+ @Override
-+ public void scheduleFluidUpdate(int x, int y, int z) {
-+ BlockPos position = new BlockPos(x, y, z);
-+ getHandle().scheduleTick(position, getHandle().getFluidState(position).getType(), 0);
-+ }
-+
-+ @Override
-+ public World getWorld() {
-+ // reading/writing the returned Minecraft world causes a deadlock.
-+ // By implementing this, and covering it in warnings, we're assuming people won't be stupid, and
-+ // if they are stupid, they'll figure it out pretty fast.
-+ return getHandle().getMinecraftWorld().getWorld();
-+ }
-+
-+ @Override
-+ public int getCenterChunkX() {
-+ return centerChunkX;
-+ }
-+
-+ @Override
-+ public int getCenterChunkZ() {
-+ return centerChunkZ;
-+ }
-+ // Paper end - Add more LimitedRegion API
- }
diff --git a/patches/unapplied/server/0568-Fix-PlayerDropItemEvent-using-wrong-item.patch b/patches/unapplied/server/0568-Fix-PlayerDropItemEvent-using-wrong-item.patch
deleted file mode 100644
index a15f10ca2a..0000000000
--- a/patches/unapplied/server/0568-Fix-PlayerDropItemEvent-using-wrong-item.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Spottedleaf <[email protected]>
-Date: Sun, 20 Jun 2021 21:55:59 -0700
-Subject: [PATCH] Fix PlayerDropItemEvent using wrong item
-
-
-diff --git a/src/main/java/net/minecraft/server/commands/GiveCommand.java b/src/main/java/net/minecraft/server/commands/GiveCommand.java
-index c81fd3e1108fb0a02f9240263404af2b968c8494..0d9de4c61c7b26a6ff37c12fde629161fd0c3d5a 100644
---- a/src/main/java/net/minecraft/server/commands/GiveCommand.java
-+++ b/src/main/java/net/minecraft/server/commands/GiveCommand.java
-@@ -38,6 +38,7 @@ public class GiveCommand {
-
- private static int giveItem(CommandSourceStack source, ItemInput item, Collection<ServerPlayer> targets, int count) throws CommandSyntaxException {
- ItemStack itemstack = item.createItemStack(1, false);
-+ final Component displayName = itemstack.getDisplayName(); // Paper - get display name early
- int j = itemstack.getMaxStackSize();
- int k = j * 100;
-
-@@ -79,11 +80,11 @@ public class GiveCommand {
-
- if (targets.size() == 1) {
- source.sendSuccess(() -> {
-- return Component.translatable("commands.give.success.single", count, itemstack.getDisplayName(), ((ServerPlayer) targets.iterator().next()).getDisplayName());
-+ return Component.translatable("commands.give.success.single", count, displayName, ((ServerPlayer) targets.iterator().next()).getDisplayName()); // Paper - use cached display name
- }, true);
- } else {
- source.sendSuccess(() -> {
-- return Component.translatable("commands.give.success.single", count, itemstack.getDisplayName(), targets.size());
-+ return Component.translatable("commands.give.success.single", count, displayName, targets.size()); // Paper - use cached display name
- }, true);
- }
-
-diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index 2ff11c9aff04f404d45e0b267285e2b4a2a23b6f..b342516707448ab5f0f1e763bf6be3f004b9e4b4 100644
---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
-+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-@@ -2434,7 +2434,7 @@ public class ServerPlayer extends Player {
-
- if (retainOwnership) {
- if (!itemstack1.isEmpty()) {
-- this.awardStat(Stats.ITEM_DROPPED.get(itemstack1.getItem()), stack.getCount());
-+ this.awardStat(Stats.ITEM_DROPPED.get(itemstack1.getItem()), itemstack1.getCount()); // Paper - Fix PlayerDropItemEvent using wrong item
- }
-
- this.awardStat(Stats.DROP);
-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 444e226a32062efff45e3d3d42fdc756787bc6ac..56f7a753d2167504b6d91219093097323a9081c5 100644
---- a/src/main/java/net/minecraft/world/entity/player/Player.java
-+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
-@@ -726,6 +726,11 @@ public abstract class Player extends LivingEntity {
- }
-
- double d0 = this.getEyeY() - 0.30000001192092896D;
-+ // Paper start
-+ ItemStack tmp = itemstack.copy();
-+ itemstack.setCount(0);
-+ itemstack = tmp;
-+ // Paper end
- ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), d0, this.getZ(), itemstack);
-
- entityitem.setPickUpDelay(40);
diff --git a/patches/unapplied/server/0569-Missing-Entity-API.patch b/patches/unapplied/server/0569-Missing-Entity-API.patch
deleted file mode 100644
index 6de7b2998d..0000000000
--- a/patches/unapplied/server/0569-Missing-Entity-API.patch
+++ /dev/null
@@ -1,1409 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Owen1212055 <[email protected]>
-Date: Mon, 21 Jun 2021 23:56:07 -0400
-Subject: [PATCH] Missing Entity API
-
-== AT ==
-public net.minecraft.world.entity.animal.Fox isDefending()Z
-public net.minecraft.world.entity.animal.Fox setDefending(Z)V
-public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V
-public net.minecraft.world.entity.animal.Panda getEatCounter()I
-public net.minecraft.world.entity.animal.Panda setEatCounter(I)V
-public net.minecraft.world.entity.animal.Bee isRolling()Z
-public net.minecraft.world.entity.animal.Bee setRolling(Z)V
-public net.minecraft.world.entity.animal.Bee numCropsGrownSincePollination
-public net.minecraft.world.entity.animal.Bee ticksWithoutNectarSinceExitingHive
-public net.minecraft.world.entity.monster.piglin.Piglin isChargingCrossbow()Z
-public net.minecraft.world.entity.ambient.Bat targetPosition
-public net.minecraft.world.entity.monster.Ravager attackTick
-public net.minecraft.world.entity.monster.Ravager stunnedTick
-public net.minecraft.world.entity.monster.Ravager roarTick
-public net.minecraft.world.entity.vehicle.MinecartTNT explode(D)V
-public net.minecraft.world.entity.vehicle.MinecartTNT fuse
-public net.minecraft.world.entity.monster.Endermite life
-public net.minecraft.world.entity.projectile.AbstractArrow soundEvent
-public net.minecraft.world.entity.monster.Phantom anchorPoint
-public net.minecraft.world.entity.npc.WanderingTrader getWanderTarget()Lnet/minecraft/core/BlockPos;
-public net.minecraft.world.entity.animal.AbstractSchoolingFish leader
-public net.minecraft.world.entity.animal.AbstractSchoolingFish schoolSize
-public net.minecraft.world.entity.animal.Rabbit moreCarrotTicks
-public net.minecraft.world.entity.AreaEffectCloud ownerUUID
-public net.minecraft.world.entity.animal.MushroomCow stewEffects
-public net.minecraft.world.entity.Entity FLAG_INVISIBLE
-public net.minecraft.world.entity.animal.Cat setRelaxStateOne(Z)V
-public net.minecraft.world.entity.animal.Cat isRelaxStateOne()Z
-
-Co-authored-by: Nassim Jahnke <[email protected]>
-Co-authored-by: Jake Potrebic <[email protected]>
-Co-authored-by: William Blake Galbreath <[email protected]>
-Co-authored-by: SoSeDiK <[email protected]>
-Co-authored-by: booky10 <[email protected]>
-Co-authored-by: Amin <[email protected]>
-Co-authored-by: TrollyLoki <[email protected]>
-Co-authored-by: FireInstall <[email protected]>
-Co-authored-by: maxcom1 <[email protected]>
-Co-authored-by: TotalledZebra <[email protected]>
-
-diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
-index 3f8cca8027051694cb0440373e75f418f73edf87..06455d65c4605ce092bf5300d432087f24186741 100644
---- a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
-+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
-@@ -165,7 +165,7 @@ public class MobGoalHelper {
- bukkitMap.put(net.minecraft.world.entity.monster.Endermite.class, Endermite.class);
- bukkitMap.put(net.minecraft.world.entity.monster.Evoker.class, Evoker.class);
- bukkitMap.put(AbstractFish.class, Fish.class);
-- bukkitMap.put(AbstractSchoolingFish.class, Fish.class); // close enough
-+ bukkitMap.put(AbstractSchoolingFish.class, io.papermc.paper.entity.SchoolableFish.class);
- bukkitMap.put(FlyingMob.class, Flying.class);
- bukkitMap.put(net.minecraft.world.entity.animal.Fox.class, Fox.class);
- bukkitMap.put(net.minecraft.world.entity.monster.Ghast.class, Ghast.class);
-diff --git a/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java b/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java
-new file mode 100644
-index 0000000000000000000000000000000000000000..41bf71d116ffc5431586ce54abba7f8def6c1dcf
---- /dev/null
-+++ b/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java
-@@ -0,0 +1,52 @@
-+package io.papermc.paper.entity;
-+
-+import net.minecraft.world.entity.animal.AbstractSchoolingFish;
-+import org.bukkit.craftbukkit.CraftServer;
-+import org.bukkit.craftbukkit.entity.CraftFish;
-+import org.jetbrains.annotations.NotNull;
-+
-+public class PaperSchoolableFish extends CraftFish implements SchoolableFish {
-+
-+ public PaperSchoolableFish(CraftServer server, AbstractSchoolingFish entity) {
-+ super(server, entity);
-+ }
-+
-+ @Override
-+ public AbstractSchoolingFish getHandle() {
-+ return (AbstractSchoolingFish) super.getHandle();
-+ }
-+
-+ @Override
-+ public void startFollowing(@NotNull SchoolableFish fish) {
-+ if (this.getHandle().isFollower()) { // If following a fish already, properly remove the old one
-+ this.stopFollowing();
-+ }
-+
-+ this.getHandle().startFollowing(((PaperSchoolableFish) fish).getHandle());
-+ }
-+
-+ @Override
-+ public void stopFollowing() {
-+ this.getHandle().stopFollowing();
-+ }
-+
-+ @Override
-+ public int getSchoolSize() {
-+ return this.getHandle().schoolSize;
-+ }
-+
-+ @Override
-+ public int getMaxSchoolSize() {
-+ return this.getHandle().getMaxSchoolSize();
-+ }
-+
-+ @Override
-+ public SchoolableFish getSchoolLeader() {
-+ AbstractSchoolingFish leader = this.getHandle().leader;
-+ if (leader == null) {
-+ return null;
-+ }
-+
-+ return (SchoolableFish) leader.getBukkitEntity();
-+ }
-+}
-diff --git a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
-index 2cd61138dfaa82fa698ef8d32d690f51f621ee3b..957eb2ba3f647f70522243fedf36b921e58142bd 100644
---- a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
-+++ b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
-@@ -51,6 +51,7 @@ public abstract class AbstractSchoolingFish extends AbstractFish {
- }
-
- public void stopFollowing() {
-+ if (this.leader == null) return; // Avoid NPE, plugins can now set the leader and certain fish goals might cause this method to be called
- this.leader.removeFollower();
- this.leader = null;
- }
-diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
-index d4389172c3c006ebec5d9cd8213cdd499ab39b68..d317b8500e8d2c280e52140440cf2b9cb61c3b28 100644
---- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
-+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
-@@ -543,11 +543,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
- this.setFlag(4, hasStung);
- }
-
-+ public net.kyori.adventure.util.TriState rollingOverride = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Rolling override
- public boolean isRolling() {
- return this.getFlag(2);
- }
-
- public void setRolling(boolean nearTarget) {
-+ nearTarget = rollingOverride.toBooleanOrElse(nearTarget); // Paper - Rolling override
- this.setFlag(2, nearTarget);
- }
-
-diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
-index 864cb9bd4c71e41cf2ed165e5d252ccb613de6cb..290d41136f5ec7671bc4990dfe50da0a770c124d 100644
---- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
-+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
-@@ -50,6 +50,7 @@ public class Tadpole extends AbstractFish {
- public int age;
- protected static final ImmutableList<SensorType<? extends Sensor<? super Tadpole>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.HURT_BY, SensorType.FROG_TEMPTATIONS);
- protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.NEAREST_VISIBLE_ADULT, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.BREED_TARGET, MemoryModuleType.IS_PANICKING);
-+ public boolean ageLocked; // Paper
-
- public Tadpole(EntityType<? extends AbstractFish> type, Level world) {
- super(type, world);
-@@ -100,7 +101,7 @@ public class Tadpole extends AbstractFish {
- @Override
- public void aiStep() {
- super.aiStep();
-- if (!this.level().isClientSide) {
-+ if (!this.level().isClientSide && !this.ageLocked) { // Paper
- this.setAge(this.age + 1);
- }
-
-@@ -110,12 +111,14 @@ public class Tadpole extends AbstractFish {
- public void addAdditionalSaveData(CompoundTag nbt) {
- super.addAdditionalSaveData(nbt);
- nbt.putInt("Age", this.age);
-+ nbt.putBoolean("AgeLocked", this.ageLocked); // Paper
- }
-
- @Override
- public void readAdditionalSaveData(CompoundTag nbt) {
- super.readAdditionalSaveData(nbt);
- this.setAge(nbt.getInt("Age"));
-+ this.ageLocked = nbt.getBoolean("AgeLocked"); // Paper
- }
-
- @Nullable
-@@ -167,6 +170,7 @@ public class Tadpole extends AbstractFish {
- Bucketable.saveDefaultDataToBucketTag(this, stack);
- CustomData.update(DataComponents.BUCKET_ENTITY_DATA, stack, (nbttagcompound) -> {
- nbttagcompound.putInt("Age", this.getAge());
-+ nbttagcompound.putBoolean("AgeLocked", this.ageLocked); // Paper
- });
- }
-
-@@ -177,6 +181,7 @@ public class Tadpole extends AbstractFish {
- this.setAge(nbt.getInt("Age"));
- }
-
-+ this.ageLocked = nbt.getBoolean("AgeLocked"); // Paper
- }
-
- @Override
-@@ -208,6 +213,7 @@ public class Tadpole extends AbstractFish {
- }
-
- private void ageUp(int seconds) {
-+ if (this.ageLocked) return; // Paper
- this.setAge(this.age + seconds * 20);
- }
-
-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 d53ef42e64d87790ea86d806153f047005accb9f..57952ad65c905265799ba2d8f99cc4cf4aa69f94 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
-@@ -753,6 +753,15 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
-
- }
-
-+ // Paper start - Horse API
-+ public void setMouthOpen(boolean open) {
-+ this.setFlag(FLAG_OPEN_MOUTH, open);
-+ }
-+ public boolean isMouthOpen() {
-+ return this.getFlag(FLAG_OPEN_MOUTH);
-+ }
-+ // Paper end - Horse API
-+
- @Override
- public InteractionResult mobInteract(Player player, InteractionHand hand) {
- if (!this.isVehicle() && !this.isBaby()) {
-@@ -795,6 +804,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
- this.setFlag(16, eatingGrass);
- }
-
-+ // Paper start - Horse API
-+ public void setForceStanding(boolean standing) {
-+ this.setFlag(FLAG_STANDING, standing);
-+ }
-+ // Paper end - Horse API
- public void setStanding(boolean angry) {
- if (angry) {
- this.setEating(false);
-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 37da58385ecf40baeb4665a0d9c262da03c01763..b6574ffbe3b9fac6ce0f4d398508c9914139f7ec 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
-@@ -74,10 +74,11 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
- @Nullable
- private Llama caravanHead;
- @Nullable
-- private Llama caravanTail;
-+ public Llama caravanTail; // Paper
-
- public Llama(EntityType<? extends Llama> type, Level world) {
- super(type, world);
-+ this.maxDomestication = 30; // Paper - Missing entity API; configure max temper instead of a hardcoded value
- }
-
- public boolean isTraderLlama() {
-@@ -318,7 +319,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
-
- @Override
- public int getMaxTemper() {
-- return 30;
-+ return super.getMaxTemper(); // Paper - Missing entity API; delegate to parent
- }
-
- @Override
-diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
-index b0ac85dc3c67d2e4d70dfb09d4e8fc349aba14d2..b5cb4e4682f66ac9423af8d1547d0f1a4f9e6c5d 100644
---- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
-+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
-@@ -88,6 +88,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
- return !entityliving.getType().is(EntityTypeTags.WITHER_FRIENDS) && entityliving.attackable();
- };
- private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0D).selector(WitherBoss.LIVING_ENTITY_SELECTOR);
-+ // Paper start
-+ private boolean canPortal = false;
-+
-+ public void setCanTravelThroughPortals(boolean canPortal) { this.canPortal = canPortal; }
-+ // Paper end
-
- public WitherBoss(EntityType<? extends WitherBoss> type, Level world) {
- super(type, world);
-@@ -594,7 +599,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
-
- @Override
- public boolean canChangeDimensions() {
-- return false;
-+ return super.canChangeDimensions() && canPortal; // Paper
- }
-
- @Override
-diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
-index 853d65025d5e049467c1f1e7322580880506c347..57f84a0eccbdb051adddc25a1a7126f60c7c274b 100644
---- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
-+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
-@@ -440,6 +440,16 @@ public class EnderMan extends Monster implements NeutralMob {
- this.entityData.set(EnderMan.DATA_STARED_AT, true);
- }
-
-+ // Paper start
-+ public void setCreepy(boolean creepy) {
-+ this.entityData.set(EnderMan.DATA_CREEPY, creepy);
-+ }
-+
-+ public void setHasBeenStaredAt(boolean hasBeenStaredAt) {
-+ this.entityData.set(EnderMan.DATA_STARED_AT, hasBeenStaredAt);
-+ }
-+ // Paper end
-+
- @Override
- public boolean requiresCustomPersistence() {
- return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
-diff --git a/src/main/java/net/minecraft/world/entity/monster/Ghast.java b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
-index ba7104784cbbbb6eeacf0ca333af20212f6c47b0..373a4f036157017b0d95e8f1849780582235a549 100644
---- a/src/main/java/net/minecraft/world/entity/monster/Ghast.java
-+++ b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
-@@ -65,6 +65,12 @@ public class Ghast extends FlyingMob implements Enemy {
- return this.explosionPower;
- }
-
-+ // Paper start
-+ public void setExplosionPower(int explosionPower) {
-+ this.explosionPower = explosionPower;
-+ }
-+ // Paper end
-+
- @Override
- protected boolean shouldDespawnInPeaceful() {
- return true;
-diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
-index b6653a942b07c2d1f7774054a68bf04d547d7cc0..deedc707971be0bd1b7757f4e9b6d2729cc669d0 100644
---- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
-+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
-@@ -202,6 +202,12 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
- }
-
- public void startConverting(@Nullable UUID uuid, int delay) {
-+ // Paper start - missing entity behaviour api - converting without entity event
-+ this.startConverting(uuid, delay, true);
-+ }
-+
-+ public void startConverting(@Nullable UUID uuid, int delay, boolean broadcastEntityEvent) {
-+ // Paper end - missing entity behaviour api - converting without entity event
- this.conversionStarter = uuid;
- this.villagerConversionTime = delay;
- this.getEntityData().set(ZombieVillager.DATA_CONVERTING_ID, true);
-@@ -209,7 +215,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
- this.removeEffect(MobEffects.WEAKNESS, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
- this.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, delay, Math.min(this.level().getDifficulty().getId() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
- // CraftBukkit end
-- this.level().broadcastEntityEvent(this, (byte) 16);
-+ if (broadcastEntityEvent) this.level().broadcastEntityEvent(this, (byte) 16); // Paper - missing entity behaviour api - converting without entity event
- }
-
- @Override
-diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
-index 636638bfee54618b36b09d49a76a46d47e1d09b4..c75ac52f302e8e29e0bdea32c85ccf6713257a9b 100644
---- a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
-+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
-@@ -105,6 +105,20 @@ public class ThrownTrident extends AbstractArrow {
- return (Boolean) this.entityData.get(ThrownTrident.ID_FOIL);
- }
-
-+ // Paper start
-+ public void setFoil(boolean foil) {
-+ this.entityData.set(ThrownTrident.ID_FOIL, foil);
-+ }
-+
-+ public int getLoyalty() {
-+ return this.entityData.get(ThrownTrident.ID_LOYALTY);
-+ }
-+
-+ public void setLoyalty(byte loyalty) {
-+ this.entityData.set(ThrownTrident.ID_LOYALTY, loyalty);
-+ }
-+ // Paper end
-+
- @Nullable
- @Override
- protected EntityHitResult findHitEntity(Vec3 currentPosition, Vec3 nextPosition) {
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
-index 3952e52b94c1cc97e1d2d3885f59d7690efb74ad..9bcc0931510607b8fbd01233e2b3c346369b214d 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
-@@ -114,4 +114,36 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
- public AbstractHorseInventory getInventory() {
- return new CraftSaddledInventory(getHandle().inventory);
- }
-+
-+ // Paper start - Horse API
-+ @Override
-+ public boolean isEatingGrass() {
-+ return this.getHandle().isEating();
-+ }
-+
-+ @Override
-+ public void setEatingGrass(boolean eating) {
-+ this.getHandle().setEating(eating);
-+ }
-+
-+ @Override
-+ public boolean isRearing() {
-+ return this.getHandle().isStanding();
-+ }
-+
-+ @Override
-+ public void setRearing(boolean rearing) {
-+ this.getHandle().setForceStanding(rearing);
-+ }
-+
-+ @Override
-+ public boolean isEating() {
-+ return this.getHandle().isMouthOpen();
-+ }
-+
-+ @Override
-+ public void setEating(boolean eating) {
-+ this.getHandle().setMouthOpen(eating);
-+ }
-+ // Paper end - Horse API
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
-index 2f99fc44de05bfbb5c9a8c859312cb7d32310d62..81f5e1d866128af8fb2acc13aca715580fdf9886 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
-@@ -229,4 +229,17 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
- this.getHandle().setOwner(null);
- }
- }
-+
-+ // Paper start - owner API
-+ @Override
-+ public java.util.UUID getOwnerUniqueId() {
-+ return this.getHandle().ownerUUID;
-+ }
-+
-+ @Override
-+ public void setOwnerUniqueId(final java.util.UUID ownerUuid) {
-+ this.getHandle().setOwner(null);
-+ this.getHandle().ownerUUID = ownerUuid;
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java
-index b0a3531476f5a05ae846b68d825eddc35ebddea9..1bb72f28085f3885bec068b586ec222111044884 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java
-@@ -27,4 +27,25 @@ public class CraftBat extends CraftAmbient implements Bat {
- public void setAwake(boolean state) {
- this.getHandle().setResting(!state);
- }
-+ // Paper start
-+ @Override
-+ public org.bukkit.Location getTargetLocation() {
-+ net.minecraft.core.BlockPos pos = this.getHandle().targetPosition;
-+ if (pos == null) {
-+ return null;
-+ }
-+
-+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
-+ }
-+
-+ @Override
-+ public void setTargetLocation(org.bukkit.Location location) {
-+ net.minecraft.core.BlockPos pos = null;
-+ if (location != null) {
-+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(location);
-+ }
-+
-+ this.getHandle().targetPosition = pos;
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java
-index cfff1be6a4a4936a2dadb2590abc3d33c123d048..3dac93b0ab5d5acf5b33dc4b0efed60319eb657b 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java
-@@ -86,4 +86,42 @@ public class CraftBee extends CraftAnimals implements Bee {
- public void setCannotEnterHiveTicks(int ticks) {
- this.getHandle().setStayOutOfHiveCountdown(ticks);
- }
-+ // Paper start
-+ @Override
-+ public void setRollingOverride(net.kyori.adventure.util.TriState rolling) {
-+ this.getHandle().rollingOverride = rolling;
-+
-+ this.getHandle().setRolling(this.getHandle().isRolling()); // Refresh rolling state
-+ }
-+
-+ @Override
-+ public boolean isRolling() {
-+ return this.getRollingOverride().toBooleanOrElse(this.getHandle().isRolling());
-+ }
-+
-+ @Override
-+ public net.kyori.adventure.util.TriState getRollingOverride() {
-+ return this.getHandle().rollingOverride;
-+ }
-+
-+ @Override
-+ public void setCropsGrownSincePollination(int crops) {
-+ this.getHandle().numCropsGrownSincePollination = crops;
-+ }
-+
-+ @Override
-+ public int getCropsGrownSincePollination() {
-+ return this.getHandle().numCropsGrownSincePollination;
-+ }
-+
-+ @Override
-+ public void setTicksSincePollination(int ticks) {
-+ this.getHandle().ticksWithoutNectarSinceExitingHive = ticks;
-+ }
-+
-+ @Override
-+ public int getTicksSincePollination() {
-+ return this.getHandle().ticksWithoutNectarSinceExitingHive;
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
-index 760e8a59fd1a13d3af722bc18999f943a05151fe..a565ac47b3dc9a27e043fc9cb00b6dea950f08cf 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
-@@ -84,4 +84,26 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
- + ", this can happen if a plugin creates its own cat variant with out properly registering it.");
- }
- }
-+
-+ // Paper start - More cat api
-+ @Override
-+ public void setLyingDown(boolean lyingDown) {
-+ this.getHandle().setLying(lyingDown);
-+ }
-+
-+ @Override
-+ public boolean isLyingDown() {
-+ return this.getHandle().isLying();
-+ }
-+
-+ @Override
-+ public void setHeadUp(boolean headUp) {
-+ this.getHandle().setRelaxStateOne(headUp);
-+ }
-+
-+ @Override
-+ public boolean isHeadUp() {
-+ return this.getHandle().isRelaxStateOne();
-+ }
-+ // Paper end - More cat api
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java
-index 64b75682a936e071353707f7615d6ff512fd617d..96f6e2fd9c6b20d34122abfe5c7fba732502d5a0 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java
-@@ -18,4 +18,26 @@ public class CraftChicken extends CraftAnimals implements Chicken {
- public String toString() {
- return "CraftChicken";
- }
-+
-+ // Paper start
-+ @Override
-+ public boolean isChickenJockey() {
-+ return this.getHandle().isChickenJockey();
-+ }
-+
-+ @Override
-+ public void setIsChickenJockey(boolean isChickenJockey) {
-+ this.getHandle().setChickenJockey(isChickenJockey);
-+ }
-+
-+ @Override
-+ public int getEggLayTime() {
-+ return this.getHandle().eggTime;
-+ }
-+
-+ @Override
-+ public void setEggLayTime(int eggLayTime) {
-+ this.getHandle().eggTime = eggLayTime;
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
-index fa0bf7db880063427ba12df1df1c72240fff93e9..63e6b07e3b159c74d9ef17be20b5ab43d07f0f5f 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
-@@ -3,7 +3,7 @@ package org.bukkit.craftbukkit.entity;
- import org.bukkit.craftbukkit.CraftServer;
- import org.bukkit.entity.Cod;
-
--public class CraftCod extends CraftFish implements Cod {
-+public class CraftCod extends io.papermc.paper.entity.PaperSchoolableFish implements Cod { // Paper - School Fish API
-
- public CraftCod(CraftServer server, net.minecraft.world.entity.animal.Cod entity) {
- super(server, entity);
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
-index af432f9a1d255a56c31c3b97aeb4457d17f37e3e..f93f8f6509b12eb9b1e07c829278bb0822dd7988 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
-@@ -18,4 +18,36 @@ public class CraftDolphin extends CraftWaterMob implements Dolphin {
- public String toString() {
- return "CraftDolphin";
- }
-+
-+ // Paper start - Missing Dolphin API
-+ @Override
-+ public int getMoistness() {
-+ return this.getHandle().getMoistnessLevel();
-+ }
-+
-+ @Override
-+ public void setMoistness(int moistness) {
-+ this.getHandle().setMoisntessLevel(moistness);
-+ }
-+
-+ @Override
-+ public void setHasFish(boolean hasFish) {
-+ this.getHandle().setGotFish(hasFish);
-+ }
-+
-+ @Override
-+ public boolean hasFish() {
-+ return this.getHandle().gotFish();
-+ }
-+
-+ @Override
-+ public org.bukkit.Location getTreasureLocation() {
-+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), this.getHandle().getTreasurePos());
-+ }
-+
-+ @Override
-+ public void setTreasureLocation(org.bukkit.Location location) {
-+ this.getHandle().setTreasurePos(io.papermc.paper.util.MCUtil.toBlockPosition(location));
-+ }
-+ // Paper end - Missing Dolphin API
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java
-index cc4194ac9d7501b5d15655674dade14d59cb6733..33ae03b78b01c005a291a343b42507fb539e81a6 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java
-@@ -51,6 +51,13 @@ public class CraftEnderDragonPart extends CraftComplexPart implements EnderDrago
- this.getParent().setHealth(health);
- }
-
-+ // Paper start - entity heal API
-+ @Override
-+ public void heal(final double amount, final org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason) {
-+ this.getParent().heal(amount, reason);
-+ }
-+ // Paper end - entity heal API
-+
- @Override
- public double getAbsorptionAmount() {
- return this.getParent().getAbsorptionAmount();
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
-index 21dc209e6f98b6306833b41e2763e746047d5a94..983b9d6ddb58eff297e96e5c8b28ec427efa267d 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
-@@ -40,6 +40,28 @@ public class CraftEnderman extends CraftMonster implements Enderman {
- this.getHandle().setCarriedBlock(blockData == null ? null : ((CraftBlockData) blockData).getState());
- }
-
-+ // Paper start
-+ @Override
-+ public boolean isScreaming() {
-+ return this.getHandle().isCreepy();
-+ }
-+
-+ @Override
-+ public void setScreaming(boolean screaming) {
-+ this.getHandle().setCreepy(screaming);
-+ }
-+
-+ @Override
-+ public boolean hasBeenStaredAt() {
-+ return this.getHandle().hasBeenStaredAt();
-+ }
-+
-+ @Override
-+ public void setHasBeenStaredAt(boolean hasBeenStaredAt) {
-+ this.getHandle().setHasBeenStaredAt(hasBeenStaredAt);
-+ }
-+ // Paper end
-+
- @Override
- public EnderMan getHandle() {
- return (EnderMan) this.entity;
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
-index fc0f0e841dc974d080e1abb9bbafb5165801131f..d657fd2c507a5b215aeab0a5f3e9c2ee892a27c8 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
-@@ -28,4 +28,15 @@ public class CraftEndermite extends CraftMonster implements Endermite {
- public void setPlayerSpawned(boolean playerSpawned) {
- // Nop
- }
-+ // Paper start
-+ @Override
-+ public void setLifetimeTicks(int ticks) {
-+ this.getHandle().life = ticks;
-+ }
-+
-+ @Override
-+ public int getLifetimeTicks() {
-+ return this.getHandle().life;
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
-index d30e1dd1b4525674c8a52da9b677c09a251b2467..9edcdc71b28cf08e42fbe44723ba540e8d4f7808 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
-@@ -1067,4 +1067,27 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
- return set;
- }
- // Paper end - tracked players API
-+
-+ // Paper start - missing entity api
-+ @Override
-+ public boolean isInvisible() { // Paper - moved up from LivingEntity
-+ return this.getHandle().isInvisible();
-+ }
-+
-+ @Override
-+ public void setInvisible(boolean invisible) { // Paper - moved up from LivingEntity
-+ this.getHandle().persistentInvisibility = invisible;
-+ this.getHandle().setSharedFlag(Entity.FLAG_INVISIBLE, invisible);
-+ }
-+
-+ @Override
-+ public void setNoPhysics(boolean noPhysics) {
-+ this.getHandle().noPhysics = noPhysics;
-+ }
-+
-+ @Override
-+ public boolean hasNoPhysics() {
-+ return this.getHandle().noPhysics;
-+ }
-+ // Paper end - missing entity api
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
-index 763cfa6cfc8447c5a963e79f128e734efe542f89..b0a02c9ca4349ab56ceceae8b78559e20a9b0af5 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
-@@ -84,6 +84,18 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
- return new Vector(this.getHandle().xPower, this.getHandle().yPower, this.getHandle().zPower);
- }
-
-+ // Paper start - Expose power on fireball projectiles
-+ @Override
-+ public void setPower(final Vector power) {
-+ this.setAcceleration(power);
-+ }
-+
-+ @Override
-+ public Vector getPower() {
-+ return this.getAcceleration();
-+ }
-+ // Paper end - Expose power on fireball projectiles
-+
- @Override
- public AbstractHurtingProjectile getHandle() {
- return (AbstractHurtingProjectile) this.entity;
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
-index 17164811bbcf983bef62c47bc99330074762267b..c455deb4fd2a7684bcc01a8212c362a2375c190b 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
-@@ -113,4 +113,41 @@ public class CraftFox extends CraftAnimals implements Fox {
- public boolean isFaceplanted() {
- return this.getHandle().isFaceplanted();
- }
-+
-+ // Paper start - Add more fox behavior API
-+ @Override
-+ public void setInterested(boolean interested) {
-+ this.getHandle().setIsInterested(interested);
-+ }
-+
-+ @Override
-+ public boolean isInterested() {
-+ return this.getHandle().isInterested();
-+ }
-+
-+ @Override
-+ public void setLeaping(boolean leaping) {
-+ this.getHandle().setIsPouncing(leaping);
-+ }
-+
-+ @Override
-+ public boolean isLeaping() {
-+ return this.getHandle().isPouncing();
-+ }
-+
-+ @Override
-+ public void setDefending(boolean defending) {
-+ this.getHandle().setDefending(defending);
-+ }
-+
-+ @Override
-+ public boolean isDefending() {
-+ return this.getHandle().isDefending();
-+ }
-+
-+ @Override
-+ public void setFaceplanted(boolean faceplanted) {
-+ this.getHandle().setFaceplanted(faceplanted);
-+ }
-+ // Paper end - Add more fox behavior API
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java
-index 2cec61a1bb050c1ef81c5fc3d0afafe9ff29d459..97fa4e1e70203194bd939618b2fad92665af6d59 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java
-@@ -28,4 +28,17 @@ public class CraftGhast extends CraftFlying implements Ghast, CraftEnemy {
- public void setCharging(boolean flag) {
- this.getHandle().setCharging(flag);
- }
-+
-+ // Paper start
-+ @Override
-+ public int getExplosionPower() {
-+ return this.getHandle().getExplosionPower();
-+ }
-+
-+ @Override
-+ public void setExplosionPower(int explosionPower) {
-+ com.google.common.base.Preconditions.checkArgument(explosionPower >= 0 && explosionPower <= 127, "The explosion power has to be between 0 and 127");
-+ this.getHandle().setExplosionPower(explosionPower);
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
-index 1cfc3d18fb785410f5acfcf3c338776858efe25a..e549c827d68ca96afea1ffdabf6802275c3328d1 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
-@@ -122,6 +122,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
- }
- }
-
-+ // Paper start - entity heal API
-+ @Override
-+ public void heal(final double amount, final org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason) {
-+ this.getHandle().heal((float) amount, reason);
-+ }
-+ // Paper end - entity heal API
-+
- @Override
- public double getAbsorptionAmount() {
- return this.getHandle().getAbsorptionAmount();
-@@ -906,14 +913,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
-
- @Override
- public boolean isInvisible() {
-- return this.getHandle().isInvisible();
-+ return super.isInvisible(); // Paper - move invisibility up to Entity - diff on change
- }
-
- @Override
- public void setInvisible(boolean invisible) {
-- this.getHandle().persistentInvisibility = invisible;
-- this.getHandle().setSharedFlag(5, invisible);
-+ super.setInvisible(invisible); // Paper - move invisibility up to Entity
- }
-+ // Paper start
-+ @Override
-+ public float getSidewaysMovement() {
-+ return this.getHandle().xxa;
-+ }
-+
-+ @Override
-+ public float getForwardsMovement() {
-+ return this.getHandle().zza;
-+ }
-+
-+ @Override
-+ public float getUpwardsMovement() {
-+ return this.getHandle().yya;
-+ }
-+ // Paper end
-
- // Paper start
- @Override
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
-index bf297388c75521266c93580a9caafe6bad70ab45..351f42842b780d053cd2e5bad9ae299449141b10 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
-@@ -58,4 +58,36 @@ public class CraftLlama extends CraftChestedHorse implements Llama, com.destroys
- public String toString() {
- return "CraftLlama";
- }
-+
-+ // Paper start
-+ @Override
-+ public boolean inCaravan() {
-+ return this.getHandle().inCaravan();
-+ }
-+
-+ @Override
-+ public void joinCaravan(@org.jetbrains.annotations.NotNull Llama llama) {
-+ this.getHandle().joinCaravan(((CraftLlama) llama).getHandle());
-+ }
-+
-+ @Override
-+ public void leaveCaravan() {
-+ this.getHandle().leaveCaravan();
-+ }
-+
-+ @Override
-+ public boolean hasCaravanTail() {
-+ return this.getHandle().hasCaravanTail();
-+ }
-+
-+ @Override
-+ public Llama getCaravanHead() {
-+ return this.getHandle().getCaravanHead() == null ? null : (Llama) this.getHandle().getCaravanHead().getBukkitEntity();
-+ }
-+
-+ @Override
-+ public Llama getCaravanTail() {
-+ return this.getHandle().caravanTail == null ? null : (Llama) this.getHandle().caravanTail.getBukkitEntity();
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
-index 17f5684cba9d3ed22d9925d1951520cc4751dfe2..3a3563a1bdbc0d84d973b3a04b50b78b4bc3d379 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
-@@ -33,4 +33,20 @@ public final class CraftMinecartHopper extends CraftMinecartContainer implements
- public void setEnabled(boolean enabled) {
- ((MinecartHopper) this.getHandle()).setEnabled(enabled);
- }
-+ // Paper start
-+ @Override
-+ public net.minecraft.world.entity.vehicle.MinecartHopper getHandle() {
-+ return (net.minecraft.world.entity.vehicle.MinecartHopper) super.getHandle();
-+ }
-+
-+ @Override
-+ public int getPickupCooldown() {
-+ throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns");
-+ }
-+
-+ @Override
-+ public void setPickupCooldown(int cooldown) {
-+ throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns");
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
-index 60d09655c5b8b9ff289291ee6badfb5aadf8533e..fb29afb6517b009b81285adc9e6dca2eb7f74aee 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
-@@ -145,4 +145,16 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
- return getHandle().getMaxHeadXRot();
- }
- // Paper end
-+
-+ // Paper start
-+ @Override
-+ public boolean isAggressive() {
-+ return this.getHandle().isAggressive();
-+ }
-+
-+ @Override
-+ public void setAggressive(boolean aggressive) {
-+ this.getHandle().setAggressive(aggressive);
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
-index 5467e4a74b70ff57b49d9e6bc686c493178f8511..01d104d91de9e1319d27e39d3f474318c7809486 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
-@@ -41,6 +41,38 @@ public class CraftPanda extends CraftAnimals implements Panda {
- this.getHandle().setHiddenGene(CraftPanda.toNms(gene));
- }
-
-+ // Paper start - Panda API
-+ @Override
-+ public void setSneezeTicks(int ticks) {
-+ this.getHandle().setSneezeCounter(ticks);
-+ }
-+
-+ @Override
-+ public int getSneezeTicks() {
-+ return this.getHandle().getSneezeCounter();
-+ }
-+
-+ @Override
-+ public void setEatingTicks(int ticks) {
-+ this.getHandle().setEatCounter(ticks);
-+ }
-+
-+ @Override
-+ public int getEatingTicks() {
-+ return this.getHandle().getEatCounter();
-+ }
-+
-+ @Override
-+ public void setUnhappyTicks(int ticks) {
-+ this.getHandle().setUnhappyCounter(ticks);
-+ }
-+
-+ @Override
-+ public Gene getCombinedGene() {
-+ return CraftPanda.fromNms(this.getHandle().getVariant());
-+ }
-+ // Paper end - Panda API
-+
- @Override
- public boolean isRolling() {
- return this.getHandle().isRolling();
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
-index 9304e201db1ec96d0916aa8ea781f3e4bc7991e6..8338effd39b1709dbe578e247710a8e58d83e3aa 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
-@@ -44,5 +44,25 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy {
- public void setShouldBurnInDay(boolean shouldBurnInDay) {
- getHandle().setShouldBurnInDay(shouldBurnInDay);
- }
-+
-+ @Override
-+ public org.bukkit.Location getAnchorLocation() {
-+ net.minecraft.core.BlockPos pos = this.getHandle().anchorPoint;
-+ if (pos == null) {
-+ return null;
-+ }
-+
-+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
-+ }
-+
-+ @Override
-+ public void setAnchorLocation(org.bukkit.Location location) {
-+ net.minecraft.core.BlockPos pos = null;
-+ if (location != null) {
-+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(location);
-+ }
-+
-+ this.getHandle().anchorPoint = pos;
-+ }
- // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
-index f5ecb8c1dc92e5a4b123effd2859123b17a586d3..5124a383b60b2c8de89fa992547d0c61db760c21 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
-@@ -84,4 +84,37 @@ public class CraftPiglin extends CraftPiglinAbstract implements Piglin, com.dest
- public String toString() {
- return "CraftPiglin";
- }
-+ // Paper start
-+ @Override
-+ public void setChargingCrossbow(boolean chargingCrossbow) {
-+ this.getHandle().setChargingCrossbow(chargingCrossbow);
-+ }
-+
-+ @Override
-+ public boolean isChargingCrossbow() {
-+ return this.getHandle().isChargingCrossbow();
-+ }
-+
-+ @Override
-+ public void setDancing(boolean dancing) {
-+ if (dancing) {
-+ this.getHandle().getBrain().setMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.DANCING, true);
-+ this.getHandle().getBrain().setMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.CELEBRATE_LOCATION, this.getHandle().getOnPos());
-+ } else {
-+ this.getHandle().getBrain().eraseMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.DANCING);
-+ this.getHandle().getBrain().eraseMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.CELEBRATE_LOCATION);
-+ }
-+ }
-+
-+ @Override
-+ public void setDancing(long duration) {
-+ this.getHandle().getBrain().setMemoryWithExpiry(net.minecraft.world.entity.ai.memory.MemoryModuleType.DANCING, true, duration);
-+ this.getHandle().getBrain().setMemoryWithExpiry(net.minecraft.world.entity.ai.memory.MemoryModuleType.CELEBRATE_LOCATION, this.getHandle().getOnPos(), duration);
-+ }
-+
-+ @Override
-+ public boolean isDancing() {
-+ return this.getHandle().isDancing();
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java
-index c7aec6f28e5d3546235b30f6b1112440a76163c5..fe075cfdf3097d6cb768e71b8cc360abb8eaf367 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java
-@@ -17,4 +17,16 @@ public class CraftPolarBear extends CraftAnimals implements PolarBear {
- public String toString() {
- return "CraftPolarBear";
- }
-+
-+ // Paper start
-+ @Override
-+ public boolean isStanding() {
-+ return this.getHandle().isStanding();
-+ }
-+
-+ @Override
-+ public void setStanding(boolean standing) {
-+ this.getHandle().setStanding(standing);
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
-index 6b48b117a9cba12aae055c0ea981dfb5bc03a86e..519ef701a7d6534f7cb516f6296b95ee521f661d 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
-@@ -29,4 +29,15 @@ public class CraftRabbit extends CraftAnimals implements Rabbit {
- public void setRabbitType(Type type) {
- this.getHandle().setVariant(net.minecraft.world.entity.animal.Rabbit.Variant.values()[type.ordinal()]);
- }
-+ // Paper start
-+ @Override
-+ public void setMoreCarrotTicks(int ticks) {
-+ this.getHandle().moreCarrotTicks = ticks;
-+ }
-+
-+ @Override
-+ public int getMoreCarrotTicks() {
-+ return this.getHandle().moreCarrotTicks;
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java
-index cae59f77c704a5b9515dc4917ed5fdc89631ecfb..09796ce15658e3f7c223a265a547a51ee729ed40 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java
-@@ -18,4 +18,35 @@ public class CraftRavager extends CraftRaider implements Ravager {
- public String toString() {
- return "CraftRavager";
- }
-+ // Paper start - Missing Entity Behavior
-+ @Override
-+ public int getAttackTicks() {
-+ return this.getHandle().getAttackTick();
-+ }
-+
-+ @Override
-+ public void setAttackTicks(int ticks) {
-+ this.getHandle().attackTick = ticks;
-+ }
-+
-+ @Override
-+ public int getStunnedTicks() {
-+ return this.getHandle().getStunnedTick();
-+ }
-+
-+ @Override
-+ public void setStunnedTicks(int ticks) {
-+ this.getHandle().stunnedTick = ticks;
-+ }
-+
-+ @Override
-+ public int getRoarTicks() {
-+ return this.getHandle().getRoarTick();
-+ }
-+
-+ @Override
-+ public void setRoarTicks(int ticks) {
-+ this.getHandle().roarTick = ticks;
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
-index b8140aa25a25870259b5644091c6643da1e14b54..d4d8ce60098c74508e2de9541bf6534988779764 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
-@@ -3,7 +3,7 @@ package org.bukkit.craftbukkit.entity;
- import org.bukkit.craftbukkit.CraftServer;
- import org.bukkit.entity.Salmon;
-
--public class CraftSalmon extends CraftFish implements Salmon {
-+public class CraftSalmon extends io.papermc.paper.entity.PaperSchoolableFish implements Salmon { // Paper - Schooling Fish API
-
- public CraftSalmon(CraftServer server, net.minecraft.world.entity.animal.Salmon entity) {
- super(server, entity);
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
-index 3f32c683ddc6999b89f2e4051eb6ae784b296b8f..dac3d34677688ac560bc1be2087a08479ef71b87 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
-@@ -67,4 +67,17 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
- this.getHandle().owner = null;
- }
- }
-+
-+ // Paper start
-+ @Override
-+ public void setBlockData(org.bukkit.block.data.BlockData data) {
-+ com.google.common.base.Preconditions.checkArgument(data != null, "The visual block data of this tnt cannot be null. To reset it just set to the TNT default block data");
-+ this.getHandle().setBlockState(((org.bukkit.craftbukkit.block.data.CraftBlockData) data).getState());
-+ }
-+
-+ @Override
-+ public org.bukkit.block.data.BlockData getBlockData() {
-+ return org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(this.getHandle().getBlockState());
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java
-index 451a9bfd9b9b6945e224f1bb05c7951ed934b4e3..d7c6a0bbc5671ea8f2488230c94df5146a1e98b9 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java
-@@ -28,4 +28,15 @@ public class CraftTadpole extends CraftFish implements org.bukkit.entity.Tadpole
- public void setAge(int age) {
- this.getHandle().age = age;
- }
-+ // Paper start
-+ @Override
-+ public void setAgeLock(boolean lock) {
-+ this.getHandle().ageLocked = lock;
-+ }
-+
-+ @Override
-+ public boolean getAgeLock() {
-+ return this.getHandle().ageLocked;
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
-index 33d6e8121755ad6cddacb4fc69e795f9831c27bd..e374b9f40eddca13b30855d25a2030f8df98138f 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
-@@ -31,4 +31,27 @@ public class CraftTrident extends CraftAbstractArrow implements Trident {
- public String toString() {
- return "CraftTrident";
- }
-+
-+ // Paper start
-+ @Override
-+ public boolean hasGlint() {
-+ return this.getHandle().isFoil();
-+ }
-+
-+ @Override
-+ public void setGlint(boolean glint) {
-+ this.getHandle().setFoil(glint);
-+ }
-+
-+ @Override
-+ public int getLoyaltyLevel() {
-+ return this.getHandle().getLoyalty();
-+ }
-+
-+ @Override
-+ public void setLoyaltyLevel(int loyaltyLevel) {
-+ com.google.common.base.Preconditions.checkArgument(loyaltyLevel >= 0 && loyaltyLevel <= 127, "The loyalty level has to be between 0 and 127");
-+ this.getHandle().setLoyalty((byte) loyaltyLevel);
-+ }
-+ // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
-index e3bde6d1c0e03407af1382a61748470063bb2e18..9e53c30801c700719c78c0fd521fd615c94e02c8 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
-@@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.CraftServer;
- import org.bukkit.entity.TropicalFish;
- import org.bukkit.entity.TropicalFish.Pattern;
-
--public class CraftTropicalFish extends CraftFish implements TropicalFish {
-+public class CraftTropicalFish extends io.papermc.paper.entity.PaperSchoolableFish implements TropicalFish { // Paper - Schooling Fish API
-
- public CraftTropicalFish(CraftServer server, net.minecraft.world.entity.animal.TropicalFish entity) {
- super(server, entity);
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
-index 1cfbe9c476f4a254edf3edf4b70696bbaba78558..e9ec3455eabc473e104b5342a615a38c1ac25a4f 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
-@@ -29,6 +29,26 @@ public class CraftVex extends CraftMonster implements Vex {
- public void setSummoner(org.bukkit.entity.Mob summoner) {
- getHandle().setOwner(summoner == null ? null : ((CraftMob) summoner).getHandle());
- }
-+
-+ @Override
-+ public boolean hasLimitedLifetime() {
-+ return this.getHandle().hasLimitedLife;
-+ }
-+
-+ @Override
-+ public void setLimitedLifetime(boolean hasLimitedLifetime) {
-+ this.getHandle().hasLimitedLife = hasLimitedLifetime;
-+ }
-+
-+ @Override
-+ public int getLimitedLifetimeTicks() {
-+ return this.getHandle().limitedLifeTicks;
-+ }
-+
-+ @Override
-+ public void setLimitedLifetimeTicks(int ticks) {
-+ this.getHandle().limitedLifeTicks = ticks;
-+ }
- // Paper end
-
- @Override
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java
-index e2a0c11867abee6add8775259c54f2052de7b1ad..3aa23d9f22d5cd22231293fd7d1ca4cb79eb7cb3 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java
-@@ -60,13 +60,20 @@ public class CraftVillagerZombie extends CraftZombie implements ZombieVillager {
-
- @Override
- public void setConversionTime(int time) {
-+ // Paper start - missing entity behaviour api - converting without entity event
-+ this.setConversionTime(time, true);
-+ }
-+
-+ @Override
-+ public void setConversionTime(int time, boolean broadcastEntityEvent) {
-+ // Paper end - missing entity behaviour api - converting without entity event
- if (time < 0) {
- this.getHandle().villagerConversionTime = -1;
- this.getHandle().getEntityData().set(net.minecraft.world.entity.monster.ZombieVillager.DATA_CONVERTING_ID, false);
- this.getHandle().conversionStarter = null;
- this.getHandle().removeEffect(MobEffects.DAMAGE_BOOST, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
- } else {
-- this.getHandle().startConverting(null, time);
-+ this.getHandle().startConverting(null, time, broadcastEntityEvent); // Paper - missing entity behaviour api - converting without entity event
- }
- }
-
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
-index 0e597394a3dd08f022614fc9777302fea581eb55..3cceefa0d6278924a19641a49bdf16bcdacb2233 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
-@@ -49,5 +49,25 @@ public class CraftWanderingTrader extends CraftAbstractVillager implements Wande
- public boolean canDrinkMilk() {
- return getHandle().canDrinkMilk;
- }
-+
-+ @Override
-+ public org.bukkit.Location getWanderingTowards() {
-+ net.minecraft.core.BlockPos pos = this.getHandle().getWanderTarget();
-+ if (pos == null) {
-+ return null;
-+ }
-+
-+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
-+ }
-+
-+ @Override
-+ public void setWanderingTowards(org.bukkit.Location location) {
-+ net.minecraft.core.BlockPos pos = null;
-+ if (location != null) {
-+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(location);
-+ }
-+
-+ this.getHandle().setWanderTarget(pos);
-+ }
- // Paper end
- }
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
-index 794e4fe0a3fbd967f665b2707865c15491370c76..c284eb96a1e330078076cbe61f0f6e2ff4ed89bd 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
-@@ -37,6 +37,13 @@ public class CraftWarden extends CraftMonster implements org.bukkit.entity.Warde
- return this.getHandle().getAngerManagement().getActiveAnger(((CraftEntity) entity).getHandle());
- }
-
-+ // Paper start
-+ @Override
-+ public int getHighestAnger() {
-+ return this.getHandle().getAngerManagement().getActiveAnger(null);
-+ }
-+ // Paper end
-+
- @Override
- public void increaseAnger(Entity entity, int increase) {
- Preconditions.checkArgument(entity != null, "Entity cannot be null");
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
-index 1113533d281ed159bb735040fb1f913482debf3a..7a8ce6956db56061af93ba9761f5d1057a90bc49 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
-@@ -67,4 +67,36 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok
-
- this.getHandle().setInvulnerableTicks(ticks);
- }
-+
-+ // Paper start
-+ @Override
-+ public boolean isCharged() {
-+ return getHandle().isPowered();
-+ }
-+
-+ @Override
-+ public int getInvulnerableTicks() {
-+ return getHandle().getInvulnerableTicks();
-+ }
-+
-+ @Override
-+ public void setInvulnerableTicks(int ticks) {
-+ getHandle().setInvulnerableTicks(ticks);
-+ }
-+
-+ @Override
-+ public boolean canTravelThroughPortals() {
-+ return getHandle().canChangeDimensions();
-+ }
-+
-+ @Override
-+ public void setCanTravelThroughPortals(boolean value) {
-+ getHandle().setCanTravelThroughPortals(value);
-+ }
-+
-+ @Override
-+ public void enterInvulnerabilityPhase() {
-+ this.getHandle().makeInvulnerable();
-+ }
-+ // Paper end
- }
diff --git a/patches/unapplied/server/0570-Ensure-disconnect-for-book-edit-is-called-on-main.patch b/patches/unapplied/server/0570-Ensure-disconnect-for-book-edit-is-called-on-main.patch
deleted file mode 100644
index 09e73af027..0000000000
--- a/patches/unapplied/server/0570-Ensure-disconnect-for-book-edit-is-called-on-main.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Shane Freeder <[email protected]>
-Date: Tue, 22 Jun 2021 19:58:53 +0100
-Subject: [PATCH] Ensure disconnect for book edit is called on main
-
-
-diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 1f6e123fbd146129e5460631fdd88de9dd60bdca..66d6bd361edfb04eeed4076feb20cb8861d48874 100644
---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -1115,7 +1115,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- // Paper end - Book size limits
- // CraftBukkit start
- if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
-- this.disconnect("Book edited too quickly!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
-+ server.scheduleOnMain(() -> this.disconnect("Book edited too quickly!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause // Paper - Also ensure this is called on main
- return;
- }
- this.lastBookTick = MinecraftServer.currentTick;
diff --git a/patches/unapplied/server/0571-Fix-return-value-of-Block-applyBoneMeal-always-being.patch b/patches/unapplied/server/0571-Fix-return-value-of-Block-applyBoneMeal-always-being.patch
deleted file mode 100644
index a5c4eefb9a..0000000000
--- a/patches/unapplied/server/0571-Fix-return-value-of-Block-applyBoneMeal-always-being.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jason Penilla <[email protected]>
-Date: Mon, 28 Jun 2021 18:16:52 -0700
-Subject: [PATCH] Fix return value of Block#applyBoneMeal always being false
-
-
-diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
-index 2034858a53c4c887da334cdc7713997daa01124f..ce297420f695404356655b1df2847a32fb98ec59 100644
---- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
-+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
-@@ -558,7 +558,7 @@ public class CraftBlock implements Block {
- }
- }
-
-- return result == InteractionResult.SUCCESS && (event == null || !event.isCancelled());
-+ return result == InteractionResult.CONSUME && (event == null || !event.isCancelled()); // Paper - CONSUME is returned on success server-side (see BoneMealItem.applyBoneMeal and InteractionResult.sidedSuccess(boolean))
- }
-
- @Override
diff --git a/patches/unapplied/server/0572-Use-getChunkIfLoadedImmediately-in-places.patch b/patches/unapplied/server/0572-Use-getChunkIfLoadedImmediately-in-places.patch
deleted file mode 100644
index c72ab8a129..0000000000
--- a/patches/unapplied/server/0572-Use-getChunkIfLoadedImmediately-in-places.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Spottedleaf <[email protected]>
-Date: Mon, 8 Jul 2019 00:13:36 -0700
-Subject: [PATCH] Use getChunkIfLoadedImmediately in places
-
-This prevents us from hitting chunk loads for chunks at or less-than
-ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
-load in that case).
-
-diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-index 3e935df2de58bd57b061c33b00f9d2ea4134ca80..eecc5704582ce7c9a45adee8057d8297eae03a86 100644
---- a/src/main/java/net/minecraft/server/level/ServerLevel.java
-+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -230,7 +230,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
- public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
-
- public LevelChunk getChunkIfLoaded(int x, int z) {
-- return this.chunkSource.getChunk(x, z, false);
-+ return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
- }
-
- @Override
-diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
-index 88b09635590958b4edf992490dd30616c35d4d6d..fd5dc0e09c89f4e21fde5d06b0fc0d4d45e52280 100644
---- a/src/main/java/net/minecraft/world/level/Level.java
-+++ b/src/main/java/net/minecraft/world/level/Level.java
-@@ -179,6 +179,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
- return (CraftServer) Bukkit.getServer();
- }
-
-+ // Paper start - Use getChunkIfLoadedImmediately
-+ @Override
-+ public boolean hasChunk(int chunkX, int chunkZ) {
-+ return this.getChunkIfLoaded(chunkX, chunkZ) != null;
-+ }
-+ // Paper end - Use getChunkIfLoadedImmediately
-+
- public abstract ResourceKey<LevelStem> getTypeKey();
-
- 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) { // Paper - create paper world config
-diff --git a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
-index 13b34e89bd3e55df1bb1d4d0cf013bafae43f502..df6c97be1b278c97a20390be5d3e60f429383702 100644
---- a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
-+++ b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java
-@@ -56,7 +56,7 @@ public class GameEventDispatcher {
-
- for (int l1 = j; l1 <= i1; ++l1) {
- for (int i2 = l; i2 <= k1; ++i2) {
-- LevelChunk chunk = this.level.getChunkSource().getChunkNow(l1, i2);
-+ LevelChunk chunk = (LevelChunk) this.level.getChunkIfLoadedImmediately(l1, i2); // Paper - Use getChunkIfLoadedImmediately
-
- if (chunk != null) {
- for (int j2 = k; j2 <= j1; ++j2) {
diff --git a/patches/unapplied/server/0573-Fix-commands-from-signs-not-firing-command-events.patch b/patches/unapplied/server/0573-Fix-commands-from-signs-not-firing-command-events.patch
deleted file mode 100644
index b86e341359..0000000000
--- a/patches/unapplied/server/0573-Fix-commands-from-signs-not-firing-command-events.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Fri, 9 Jul 2021 13:50:48 -0700
-Subject: [PATCH] Fix commands from signs not firing command events
-
-This patch changes sign command logic so that `run_command` click events:
- - are logged to the console
- - fire PlayerCommandPreprocessEvent
- - work with double-slash commands like `//wand`
- - sends failure messages to the player who clicked the sign
-
-diff --git a/src/main/java/io/papermc/paper/commands/DelegatingCommandSource.java b/src/main/java/io/papermc/paper/commands/DelegatingCommandSource.java
-new file mode 100644
-index 0000000000000000000000000000000000000000..01a2bc1feec808790bb93618ce46adb9bea5a9c8
---- /dev/null
-+++ b/src/main/java/io/papermc/paper/commands/DelegatingCommandSource.java
-@@ -0,0 +1,42 @@
-+package io.papermc.paper.commands;
-+
-+import net.minecraft.commands.CommandSource;
-+import net.minecraft.commands.CommandSourceStack;
-+import net.minecraft.network.chat.Component;
-+import org.bukkit.command.CommandSender;
-+
-+import java.util.UUID;
-+
-+public class DelegatingCommandSource implements CommandSource {
-+
-+ private final CommandSource delegate;
-+
-+ public DelegatingCommandSource(CommandSource delegate) {
-+ this.delegate = delegate;
-+ }
-+
-+ @Override
-+ public void sendSystemMessage(Component message) {
-+ delegate.sendSystemMessage(message);
-+ }
-+
-+ @Override
-+ public boolean acceptsSuccess() {
-+ return delegate.acceptsSuccess();
-+ }
-+
-+ @Override
-+ public boolean acceptsFailure() {
-+ return delegate.acceptsFailure();
-+ }
-+
-+ @Override
-+ public boolean shouldInformAdmins() {
-+ return delegate.shouldInformAdmins();
-+ }
-+
-+ @Override
-+ public CommandSender getBukkitSender(CommandSourceStack wrapper) {
-+ return delegate.getBukkitSender(wrapper);
-+ }
-+}
-diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
-index 87e272cfb145c37d26b0bf56f97ec784a9bfd98e..bfe8029852385875af4ebe73c63e688f61042021 100644
---- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
-+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
-@@ -274,7 +274,17 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
- ClickEvent chatclickable = chatmodifier.getClickEvent();
-
- if (chatclickable != null && chatclickable.getAction() == ClickEvent.Action.RUN_COMMAND) {
-- player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(player, world, pos), chatclickable.getValue());
-+ // Paper start - Fix commands from signs not firing command events
-+ String command = chatclickable.getValue().startsWith("/") ? chatclickable.getValue() : "/" + chatclickable.getValue();
-+ if (org.spigotmc.SpigotConfig.logCommands) {
-+ LOGGER.info("{} issued server command: {}", player.getScoreboardName(), command);
-+ }
-+ io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent event = new io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent((org.bukkit.entity.Player) player.getBukkitEntity(), command, new org.bukkit.craftbukkit.util.LazyPlayerSet(player.getServer()), (org.bukkit.block.Sign) CraftBlock.at(this.level, this.worldPosition).getState(), front ? Side.FRONT : Side.BACK);
-+ if (!event.callEvent()) {
-+ return false;
-+ }
-+ player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
-+ // Paper end - Fix commands from signs not firing command events
- flag1 = true;
- }
- }
-@@ -311,8 +321,23 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
- String s = player == null ? "Sign" : player.getName().getString();
- Object object = player == null ? Component.literal("Sign") : player.getDisplayName();
-
-+ // Paper start - Fix commands from signs not firing command events
-+ CommandSource commandSource = this.level.paperConfig().misc.showSignClickCommandFailureMsgsToPlayer ? new io.papermc.paper.commands.DelegatingCommandSource(this) {
-+ @Override
-+ public void sendSystemMessage(Component message) {
-+ if (player != null) {
-+ player.sendSystemMessage(message);
-+ }
-+ }
-+
-+ @Override
-+ public boolean acceptsFailure() {
-+ return true;
-+ }
-+ } : this;
-+ // Paper end - Fix commands from signs not firing command events
- // CraftBukkit - this
-- return new CommandSourceStack(this, Vec3.atCenterOf(pos), Vec2.ZERO, (ServerLevel) world, 2, s, (Component) object, world.getServer(), player);
-+ return new CommandSourceStack(commandSource, Vec3.atCenterOf(pos), Vec2.ZERO, (ServerLevel) world, 2, s, (Component) object, world.getServer(), player); // Paper - Fix commands from signs not firing command events
- }
-
- @Override
-diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
-index d113e54a30db16e2ad955170df6030d15de530d6..21b6f90cf5bd7087d1a0f512289d971f2c3e1afa 100644
---- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
-+++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java
-@@ -61,7 +61,7 @@ public class BukkitCommandWrapper implements com.mojang.brigadier.Command<Comman
- CommandSender sender = context.getSource().getBukkitSender();
-
- try {
-- return this.server.dispatchCommand(sender, context.getInput()) ? 1 : 0;
-+ return this.server.dispatchCommand(sender, context.getRange().get(context.getInput())) ? 1 : 0; // Paper - Fix commands from signs not firing command events; actually use the StringRange from context
- } catch (CommandException ex) {
- sender.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command");
- this.server.getLogger().log(Level.SEVERE, null, ex);
diff --git a/patches/unapplied/server/0574-Add-PlayerArmSwingEvent.patch b/patches/unapplied/server/0574-Add-PlayerArmSwingEvent.patch
deleted file mode 100644
index 0c66804f9a..0000000000
--- a/patches/unapplied/server/0574-Add-PlayerArmSwingEvent.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Fri, 12 Mar 2021 19:22:21 -0800
-Subject: [PATCH] Add PlayerArmSwingEvent
-
-
-diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 66d6bd361edfb04eeed4076feb20cb8861d48874..dd3767f482929d7d8105a4164c27651099935a89 100644
---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -2396,7 +2396,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- } // Paper end - Call interact event
-
- // Arm swing animation
-- PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING);
-+ io.papermc.paper.event.player.PlayerArmSwingEvent event = new io.papermc.paper.event.player.PlayerArmSwingEvent(this.getCraftPlayer(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(packet.getHand())); // Paper - Add PlayerArmSwingEvent
- this.cserver.getPluginManager().callEvent(event);
-
- if (event.isCancelled()) return;
diff --git a/patches/unapplied/server/0575-Fix-kick-event-leave-message-not-being-sent.patch b/patches/unapplied/server/0575-Fix-kick-event-leave-message-not-being-sent.patch
deleted file mode 100644
index 0aebdf0ac4..0000000000
--- a/patches/unapplied/server/0575-Fix-kick-event-leave-message-not-being-sent.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Wed, 7 Jul 2021 16:19:41 -0700
-Subject: [PATCH] Fix kick event leave message not being sent
-
-
-diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index b342516707448ab5f0f1e763bf6be3f004b9e4b4..ea2c8c91408cb65b3b6a520877c9273dbffd0ac1 100644
---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
-+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-@@ -285,7 +285,6 @@ public class ServerPlayer extends Player {
- public boolean joining = true;
- public boolean sentListPacket = false;
- public boolean supressTrackerForLogin = false; // Paper - Fire PlayerJoinEvent when Player is actually ready
-- public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
- // CraftBukkit end
- public boolean isRealPlayer; // Paper
- public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
-diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
-index 7659a3f50f5a90814dc7331ea00d6251dcf32600..308aef9c4933b2bcdd622a34b68efab4a220fe4d 100644
---- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
-+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
-@@ -109,6 +109,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
-
- @Override
- public void onDisconnect(Component reason) {
-+ // Paper start - Fix kick event leave message not being sent
-+ this.onDisconnect(reason, null);
-+ }
-+ public void onDisconnect(Component reason, @Nullable net.kyori.adventure.text.Component quitMessage) {
-+ // Paper end - Fix kick event leave message not being sent
- if (this.isSingleplayerOwner()) {
- ServerCommonPacketListenerImpl.LOGGER.info("Stopping singleplayer server as player logged out");
- this.server.halt(false);
-@@ -376,7 +381,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
- // Do not kick the player
- return;
- }
-- this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent
- // Send the possibly modified leave message
- final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
- // CraftBukkit end
-@@ -385,7 +389,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
- this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
- this.connection.disconnect(ichatbasecomponent);
- }));
-- this.onDisconnect(ichatbasecomponent); // CraftBukkit - fire quit instantly
-+ this.onDisconnect(ichatbasecomponent, event.leaveMessage()); // CraftBukkit - fire quit instantly // Paper - use kick event leave message
- this.connection.setReadOnly();
- MinecraftServer minecraftserver = this.server;
- Connection networkmanager = this.connection;
-diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index dd3767f482929d7d8105a4164c27651099935a89..5ba7340d3860975b826dc878385e0879a9f07957 100644
---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -1878,6 +1878,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
-
- @Override
- public void onDisconnect(Component reason) {
-+ // Paper start - Fix kick event leave message not being sent
-+ this.onDisconnect(reason, null);
-+ }
-+ @Override
-+ public void onDisconnect(Component reason, @Nullable net.kyori.adventure.text.Component quitMessage) {
-+ // Paper end - Fix kick event leave message not being sent
- // CraftBukkit start - Rarely it would send a disconnect line twice
- if (this.processedDisconnect) {
- return;
-@@ -1886,11 +1892,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- }
- // CraftBukkit end
- ServerGamePacketListenerImpl.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), reason.getString());
-- this.removePlayerFromWorld();
-- super.onDisconnect(reason);
-+ this.removePlayerFromWorld(quitMessage); // Paper - Fix kick event leave message not being sent
-+ super.onDisconnect(reason, quitMessage); // Paper - Fix kick event leave message not being sent
- }
-
-+ // Paper start - Fix kick event leave message not being sent
- private void removePlayerFromWorld() {
-+ this.removePlayerFromWorld(null);
-+ }
-+
-+ private void removePlayerFromWorld(@Nullable net.kyori.adventure.text.Component quitMessage) {
-+ // Paper end - Fix kick event leave message not being sent
- this.chatMessageChain.close();
- // CraftBukkit start - Replace vanilla quit message handling with our own.
- /*
-@@ -1900,7 +1912,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
-
- this.player.disconnect();
- // Paper start - Adventure
-- net.kyori.adventure.text.Component quitMessage = this.server.getPlayerList().remove(this.player);
-+ quitMessage = quitMessage == null ? this.server.getPlayerList().remove(this.player) : this.server.getPlayerList().remove(this.player, quitMessage); // Paper - pass in quitMessage to fix kick message not being used
- if ((quitMessage != null) && !quitMessage.equals(net.kyori.adventure.text.Component.empty())) {
- this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
- // Paper end
-diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
-index 709cf6655e5ccb17caf0b8a735ae957cb0509f2c..2b7ad2b9cd525814c9f91d22606c42aa82ce9f94 100644
---- a/src/main/java/net/minecraft/server/players/PlayerList.java
-+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
-@@ -567,6 +567,11 @@ public abstract class PlayerList {
- }
-
- public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // CraftBukkit - return string // Paper - return Component
-+ // Paper start - Fix kick event leave message not being sent
-+ return this.remove(entityplayer, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName())));
-+ }
-+ public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
-+ // Paper end - Fix kick event leave message not being sent
- ServerLevel worldserver = entityplayer.serverLevel();
-
- entityplayer.awardStat(Stats.LEAVE_GAME);
diff --git a/patches/unapplied/server/0576-Don-t-apply-cramming-damage-to-players.patch b/patches/unapplied/server/0576-Don-t-apply-cramming-damage-to-players.patch
deleted file mode 100644
index dcfd508e6b..0000000000
--- a/patches/unapplied/server/0576-Don-t-apply-cramming-damage-to-players.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Phoenix616 <[email protected]>
-Date: Sun, 20 Jun 2021 16:35:42 +0100
-Subject: [PATCH] Don't apply cramming damage to players
-
-It does not make a lot of sense to damage players if they get crammed,
- especially as the usecase of teleporting lots of players to the same
- location isn't too uncommon and killing all those players isn't
- really what one would expect to happen.
-
-For those who really want it a config option is provided.
-
-diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index ea2c8c91408cb65b3b6a520877c9273dbffd0ac1..bb0ac7db0467ec8468fcbf63b8f22580ed11e723 100644
---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
-+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-@@ -98,6 +98,7 @@ import net.minecraft.util.Mth;
- import net.minecraft.util.RandomSource;
- import net.minecraft.util.Unit;
- import net.minecraft.world.damagesource.DamageSource;
-+import net.minecraft.world.damagesource.DamageSources;
- import net.minecraft.world.effect.MobEffectInstance;
- import net.minecraft.world.effect.MobEffects;
- import net.minecraft.world.entity.Entity;
-@@ -1507,7 +1508,7 @@ public class ServerPlayer extends Player {
-
- @Override
- public boolean isInvulnerableTo(DamageSource damageSource) {
-- return super.isInvulnerableTo(damageSource) || this.isChangingDimension();
-+ return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || !this.level().paperConfig().collisions.allowPlayerCrammingDamage && damageSource == damageSources().cramming(); // Paper - disable player cramming
- }
-
- @Override
diff --git a/patches/unapplied/server/0577-Rate-options-and-timings-for-sensors-and-behaviors.patch b/patches/unapplied/server/0577-Rate-options-and-timings-for-sensors-and-behaviors.patch
deleted file mode 100644
index d74af14524..0000000000
--- a/patches/unapplied/server/0577-Rate-options-and-timings-for-sensors-and-behaviors.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Phoenix616 <[email protected]>
-Date: Mon, 28 Jun 2021 22:38:29 +0100
-Subject: [PATCH] Rate options and timings for sensors and behaviors
-
-This adds config options to specify the tick rate for sensors
- and behaviors of different entity types as well as timings
- for those in order to be able to have some metrics as to which
- ones might need tweaking.
-
-diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
-index 4bd813161a5d76a83cdbd0a9209b9ea9e60ffe1b..e2764186bd6b838ed5cd86c15597a08d079ef984 100644
---- a/src/main/java/co/aikar/timings/MinecraftTimings.java
-+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
-@@ -115,6 +115,14 @@ public final class MinecraftTimings {
- return Timings.ofSafe("Minecraft", "## tickEntity - " + entityType + " - " + type, tickEntityTimer);
- }
-
-+ public static Timing getBehaviorTimings(String type) {
-+ return Timings.ofSafe("## Behavior - " + type);
-+ }
-+
-+ public static Timing getSensorTimings(String type, int rate) {
-+ return Timings.ofSafe("## Sensor - " + type + " (Default rate: " + rate + ")");
-+ }
-+
- /**
- * Get a named timer for the specified tile entity type to track type specific timings.
- * @param entity
-diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
-index f639cafa64d98a001e622882c647701547f5c3ac..9379dd4056018b52c93ed4888dcdc94579bd9691 100644
---- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
-+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java
-@@ -14,6 +14,10 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro
- private long endTimestamp;
- private final int minDuration;
- private final int maxDuration;
-+ // Paper start - configurable behavior tick rate and timings
-+ private final String configKey;
-+ private final co.aikar.timings.Timing timing;
-+ // Paper end - configurable behavior tick rate and timings
-
- public Behavior(Map<MemoryModuleType<?>, MemoryStatus> requiredMemoryState) {
- this(requiredMemoryState, 60);
-@@ -27,6 +31,15 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro
- this.minDuration = minRunTime;
- this.maxDuration = maxRunTime;
- this.entryCondition = requiredMemoryState;
-+ // Paper start - configurable behavior tick rate and timings
-+ String key = io.papermc.paper.util.MappingEnvironment.reobf() ? io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(this.getClass().getName()) : this.getClass().getName();
-+ int lastSeparator = key.lastIndexOf('.');
-+ if (lastSeparator != -1) {
-+ key = key.substring(lastSeparator + 1);
-+ }
-+ this.configKey = key.toLowerCase(java.util.Locale.ROOT);
-+ this.timing = co.aikar.timings.MinecraftTimings.getBehaviorTimings(configKey);
-+ // Paper end - configurable behavior tick rate and timings
- }
-
- @Override
-@@ -36,11 +49,19 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro
-
- @Override
- public final boolean tryStart(ServerLevel world, E entity, long time) {
-+ // Paper start - configurable behavior tick rate and timings
-+ int tickRate = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.behavior.get(entity.getType(), this.configKey), -1);
-+ if (tickRate > -1 && time < this.endTimestamp + tickRate) {
-+ return false;
-+ }
-+ // Paper end - configurable behavior tick rate and timings
- if (this.hasRequiredMemories(entity) && this.checkExtraStartConditions(world, entity)) {
- this.status = Behavior.Status.RUNNING;
- int i = this.minDuration + world.getRandom().nextInt(this.maxDuration + 1 - this.minDuration);
- this.endTimestamp = time + (long)i;
-+ this.timing.startTiming(); // Paper - behavior timings
- this.start(world, entity, time);
-+ this.timing.stopTiming(); // Paper - behavior timings
- return true;
- } else {
- return false;
-@@ -52,11 +73,13 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro
-
- @Override
- public final void tickOrStop(ServerLevel world, E entity, long time) {
-+ this.timing.startTiming(); // Paper - behavior timings
- if (!this.timedOut(time) && this.canStillUse(world, entity, time)) {
- this.tick(world, entity, time);
- } else {
- this.doStop(world, entity, time);
- }
-+ this.timing.stopTiming(); // Paper - behavior timings
- }
-
- protected void tick(ServerLevel world, E entity, long time) {
-diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
-index 671fc7725d7c801a2ba009da5bd1bc1a9530f187..85b4b24361e785acf75571ff98f924c00ae80748 100644
---- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
-+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
-@@ -26,8 +26,21 @@ public abstract class Sensor<E extends LivingEntity> {
- .ignoreInvisibilityTesting();
- private final int scanRate;
- private long timeToTick;
-+ // Paper start - configurable sensor tick rate and timings
-+ private final String configKey;
-+ private final co.aikar.timings.Timing timing;
-+ // Paper end
-
- public Sensor(int senseInterval) {
-+ // Paper start - configurable sensor tick rate and timings
-+ String key = io.papermc.paper.util.MappingEnvironment.reobf() ? io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(this.getClass().getName()) : this.getClass().getName();
-+ int lastSeparator = key.lastIndexOf('.');
-+ if (lastSeparator != -1) {
-+ key = key.substring(lastSeparator + 1);
-+ }
-+ this.configKey = key.toLowerCase(java.util.Locale.ROOT);
-+ this.timing = co.aikar.timings.MinecraftTimings.getSensorTimings(configKey, senseInterval);
-+ // Paper end
- this.scanRate = senseInterval;
- this.timeToTick = (long)RANDOM.nextInt(senseInterval);
- }
-@@ -38,8 +51,12 @@ public abstract class Sensor<E extends LivingEntity> {
-
- public final void tick(ServerLevel world, E entity) {
- if (--this.timeToTick <= 0L) {
-- this.timeToTick = (long)this.scanRate;
-+ // Paper start - configurable sensor tick rate and timings
-+ this.timeToTick = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate);
-+ this.timing.startTiming();
-+ // Paper end
- this.doTick(world, entity);
-+ this.timing.stopTiming(); // Paper - sensor timings
- }
- }
-
diff --git a/patches/unapplied/server/0578-Add-missing-forceDrop-toggles.patch b/patches/unapplied/server/0578-Add-missing-forceDrop-toggles.patch
deleted file mode 100644
index b89de7428a..0000000000
--- a/patches/unapplied/server/0578-Add-missing-forceDrop-toggles.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Tue, 20 Jul 2021 21:25:35 -0700
-Subject: [PATCH] Add missing forceDrop toggles
-
-
-diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
-index b9c2b41d9c46c871bab44cfb1d454f4141f1627b..d975b349aa81327c6b6c23e83e9552159217f11e 100644
---- a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
-+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
-@@ -86,7 +86,9 @@ public class WorkAtComposter extends WorkAtPoi {
- simpleContainer.removeItemType(Items.WHEAT, m);
- ItemStack itemStack = simpleContainer.addItem(new ItemStack(Items.BREAD, l));
- if (!itemStack.isEmpty()) {
-+ entity.forceDrops = true; // Paper - Add missing forceDrop toggles
- entity.spawnAtLocation(itemStack, 0.5F);
-+ entity.forceDrops = false; // Paper - Add missing forceDrop toggles
- }
- }
- }
-diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
-index fb4c7220c4edad54813036d62db7e3eefeda92a3..83d8a09980c4ab3c7c97b07c3dcdb3d7dab9e1aa 100644
---- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
-+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
-@@ -549,11 +549,13 @@ public class Panda extends Animal {
- List<ItemStack> list1 = loottable.getRandomItems(lootparams);
- Iterator iterator1 = list1.iterator();
-
-+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
- while (iterator1.hasNext()) {
- ItemStack itemstack = (ItemStack) iterator1.next();
-
- this.spawnAtLocation(itemstack);
- }
-+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
- }
-
- }
-@@ -677,7 +679,9 @@ public class Panda extends Animal {
- ItemStack itemstack1 = this.getItemBySlot(EquipmentSlot.MAINHAND);
-
- if (!itemstack1.isEmpty() && !player.hasInfiniteMaterials()) {
-+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
- this.spawnAtLocation(itemstack1);
-+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
- }
-
- this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(itemstack.getItem(), 1));
-@@ -959,7 +963,9 @@ public class Panda extends Animal {
- ItemStack itemstack = Panda.this.getItemBySlot(EquipmentSlot.MAINHAND);
-
- if (!itemstack.isEmpty()) {
-+ Panda.this.forceDrops = true; // Paper - Add missing forceDrop toggles
- Panda.this.spawnAtLocation(itemstack);
-+ Panda.this.forceDrops = false; // Paper - Add missing forceDrop toggles
- Panda.this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
- int i = Panda.this.isLazy() ? Panda.this.random.nextInt(50) + 10 : Panda.this.random.nextInt(150) + 10;
-
-diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
-index 11f4a2e15d42a029406fe8399b8d93ae136f0295..5ebf49a565af4ab3bead60a83bca2e6561e6a29c 100644
---- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
-+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
-@@ -468,7 +468,9 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
- this.playSound(SoundEvents.ARMOR_UNEQUIP_WOLF);
- itemstack1 = this.getBodyArmorItem();
- this.setBodyArmorItem(ItemStack.EMPTY);
-+ this.forceDrops = true; // Paper - add missing forceDrops toggles
- this.spawnAtLocation(itemstack1);
-+ this.forceDrops = false; // Paper - add missing forceDrops toggles
- return InteractionResult.SUCCESS;
- } else if (((Ingredient) ((ArmorMaterial) ArmorMaterials.ARMADILLO.value()).repairIngredient().get()).test(itemstack) && this.isInSittingPose() && this.hasArmor() && this.isOwnedBy(player) && this.getBodyArmorItem().isDamaged()) {
- itemstack.shrink(1);
-diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
-index e1f2425ae6d3737302f6a7e010b172a62b41a018..20d9690127aed9c8ae2632bcf497ba0e473b7bea 100644
---- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
-+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
-@@ -311,7 +311,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
- @Override
- protected void finishConversion(ServerLevel world) {
- PiglinAi.cancelAdmiring(this);
-+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
- this.inventory.removeAllItems().forEach(this::spawnAtLocation);
-+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
- super.finishConversion(world);
- }
-
-diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
-index a3df3798ebbbc2ccdf29d9f5ddc62d5e395fb8e5..31bb652c7ef35e7d61df2b1b60589fbb5c845bb0 100644
---- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
-+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
-@@ -271,7 +271,9 @@ public class PiglinAi {
-
- private static void holdInOffhand(Piglin piglin, ItemStack stack) {
- if (PiglinAi.isHoldingItemInOffHand(piglin)) {
-+ piglin.forceDrops = true; // Paper - Add missing forceDrop toggles
- piglin.spawnAtLocation(piglin.getItemInHand(InteractionHand.OFF_HAND));
-+ piglin.forceDrops = false; // Paper - Add missing forceDrop toggles
- }
-
- piglin.holdInOffHand(stack);
-@@ -331,7 +333,9 @@ public class PiglinAi {
-
- protected static void cancelAdmiring(Piglin piglin) {
- if (PiglinAi.isAdmiringItem(piglin) && !piglin.getOffhandItem().isEmpty()) {
-+ piglin.forceDrops = true; // Paper - Add missing forceDrop toggles
- piglin.spawnAtLocation(piglin.getOffhandItem());
-+ piglin.forceDrops = false; // Paper - Add missing forceDrop toggles
- piglin.setItemInHand(InteractionHand.OFF_HAND, ItemStack.EMPTY);
- }
-
-diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
-index 9f54e46b870e78d1d360ea79604708db08276ae3..d3fef00a351a6c6ae6af1f1dcf793c5954fd3485 100644
---- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
-+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
-@@ -272,7 +272,9 @@ public abstract class Raider extends PatrollingMonster {
- double d0 = (double) this.getEquipmentDropChance(enumitemslot);
-
- if (!itemstack1.isEmpty() && (double) Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d0) {
-+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
- this.spawnAtLocation(itemstack1);
-+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
- }
-
- this.onItemPickup(item);
diff --git a/patches/unapplied/server/0579-Stinger-API.patch b/patches/unapplied/server/0579-Stinger-API.patch
deleted file mode 100644
index fe0a993d6a..0000000000
--- a/patches/unapplied/server/0579-Stinger-API.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Owen1212055 <[email protected]>
-Date: Tue, 22 Jun 2021 23:15:44 -0400
-Subject: [PATCH] Stinger API
-
-
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
-index e549c827d68ca96afea1ffdabf6802275c3328d1..f4574527cb1dddb97dba1fa2dfe1c17b89728015 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
-@@ -360,6 +360,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
- }
- // Paper end
- }
-+ // Paper start - Bee Stinger API
-+ @Override
-+ public int getBeeStingerCooldown() {
-+ return getHandle().removeStingerTime;
-+ }
-
- // Paper start - Add methods for working with arrows stuck in living entities
- @Override
-@@ -374,6 +379,34 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
- }
- // Paper end - Add methods for working with arrows stuck in living entities
-
-+ @Override
-+ public void setBeeStingerCooldown(int ticks) {
-+ getHandle().removeStingerTime = ticks;
-+ }
-+
-+ @Override
-+ public int getBeeStingersInBody() {
-+ return getHandle().getStingerCount();
-+ }
-+
-+ @Override
-+ public void setBeeStingersInBody(int count) {
-+ Preconditions.checkArgument(count >= 0, "New bee stinger amount must be >= 0");
-+ getHandle().setStingerCount(count);
-+ }
-+
-+ @Override
-+ public void setNextBeeStingerRemoval(final int ticks) {
-+ Preconditions.checkArgument(ticks >= 0, "New amount of ticks before next bee stinger removal must be >= 0");
-+ this.getHandle().removeStingerTime = ticks;
-+ }
-+
-+ @Override
-+ public int getNextBeeStingerRemoval() {
-+ return this.getHandle().removeStingerTime;
-+ }
-+ // Paper end - Bee Stinger API
-+
- @Override
- public void damage(double amount) {
- this.damage(amount, this.getHandle().damageSources().generic());
diff --git a/patches/unapplied/server/0580-Add-System.out-err-catcher.patch b/patches/unapplied/server/0580-Add-System.out-err-catcher.patch
deleted file mode 100644
index 5c508e1929..0000000000
--- a/patches/unapplied/server/0580-Add-System.out-err-catcher.patch
+++ /dev/null
@@ -1,118 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: underscore11code <[email protected]>
-Date: Fri, 23 Jul 2021 23:01:42 -0700
-Subject: [PATCH] Add System.out/err catcher
-
-
-diff --git a/src/main/java/io/papermc/paper/logging/SysoutCatcher.java b/src/main/java/io/papermc/paper/logging/SysoutCatcher.java
-new file mode 100644
-index 0000000000000000000000000000000000000000..a8e813ca89b033f061e695288b3383bdcf128531
---- /dev/null
-+++ b/src/main/java/io/papermc/paper/logging/SysoutCatcher.java
-@@ -0,0 +1,94 @@
-+package io.papermc.paper.logging;
-+
-+import org.bukkit.Bukkit;
-+import org.bukkit.plugin.java.JavaPlugin;
-+import org.jetbrains.annotations.NotNull;
-+import org.jetbrains.annotations.Nullable;
-+
-+import java.io.OutputStream;
-+import java.io.PrintStream;
-+import java.util.Objects;
-+import java.util.concurrent.ConcurrentHashMap;
-+import java.util.concurrent.ConcurrentMap;
-+import java.util.concurrent.TimeUnit;
-+import java.util.logging.Level;
-+
-+public final class SysoutCatcher {
-+ private static final boolean SUPPRESS_NAGS = Boolean.getBoolean("io.papermc.paper.suppress.sout.nags");
-+ // Nanoseconds between nag at most; if interval is caught first, this is reset.
-+ // <= 0 for disabling.
-+ private static final long NAG_TIMEOUT = TimeUnit.MILLISECONDS.toNanos(
-+ Long.getLong("io.papermc.paper.sout.nags.timeout", TimeUnit.MINUTES.toMillis(5L)));
-+ // Count since last nag; if timeout is first, this is reset.
-+ // <= 0 for disabling.
-+ private static final long NAG_INTERVAL = Long.getLong("io.papermc.paper.sout.nags.interval", 200L);
-+
-+ // We don't particularly care about how correct this is at any given moment; let's do it on a best attempt basis.
-+ // The records are also pretty small, so let's just go for a size of 64 to start...
-+ //
-+ // Content: Plugin name => nag object
-+ // Why plugin name?: This doesn't store a reference to the plugin; keeps the reload ability.
-+ // Why not clean on reload?: Effort.
-+ private final ConcurrentMap<String, PluginNag> nagRecords = new ConcurrentHashMap<>(64);
-+
-+ public SysoutCatcher() {
-+ System.setOut(new WrappedOutStream(System.out, Level.INFO, "[STDOUT] "));
-+ System.setErr(new WrappedOutStream(System.err, Level.SEVERE, "[STDERR] "));
-+ }
-+
-+ private final class WrappedOutStream extends PrintStream {
-+ private static final StackWalker STACK_WALKER = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
-+ private final Level level;
-+ private final String prefix;
-+
-+ public WrappedOutStream(@NotNull final OutputStream out, final Level level, final String prefix) {
-+ super(out);
-+ this.level = level;
-+ this.prefix = prefix;
-+ }
-+
-+ @Override
-+ public void println(@Nullable final String line) {
-+ final Class<?> clazz = STACK_WALKER.getCallerClass();
-+ try {
-+ final JavaPlugin plugin = JavaPlugin.getProvidingPlugin(clazz);
-+
-+ // Instead of just printing the message, send it to the plugin's logger
-+ plugin.getLogger().log(this.level, this.prefix + line);
-+
-+ if (SysoutCatcher.SUPPRESS_NAGS) {
-+ return;
-+ }
-+ if (SysoutCatcher.NAG_INTERVAL > 0 || SysoutCatcher.NAG_TIMEOUT > 0) {
-+ final PluginNag nagRecord = SysoutCatcher.this.nagRecords.computeIfAbsent(plugin.getName(), k -> new PluginNag());
-+ final boolean hasTimePassed = SysoutCatcher.NAG_TIMEOUT > 0
-+ && (nagRecord.lastNagTimestamp == Long.MIN_VALUE
-+ || nagRecord.lastNagTimestamp + SysoutCatcher.NAG_TIMEOUT <= System.nanoTime());
-+ final boolean hasMessagesPassed = SysoutCatcher.NAG_INTERVAL > 0
-+ && (nagRecord.messagesSinceNag == Long.MIN_VALUE
-+ || ++nagRecord.messagesSinceNag >= SysoutCatcher.NAG_INTERVAL);
-+ if (!hasMessagesPassed && !hasTimePassed) {
-+ return;
-+ }
-+ nagRecord.lastNagTimestamp = System.nanoTime();
-+ nagRecord.messagesSinceNag = 0;
-+ }
-+ Bukkit.getLogger().warning(
-+ String.format("Nag author(s): '%s' of '%s' about their usage of System.out/err.print. "
-+ + "Please use your plugin's logger instead (JavaPlugin#getLogger).",
-+ plugin.getPluginMeta().getAuthors(),
-+ plugin.getPluginMeta().getDisplayName())
-+ );
-+ } catch (final IllegalArgumentException | IllegalStateException e) {
-+ // If anything happens, the calling class doesn't exist, there is no JavaPlugin that "owns" the calling class, etc
-+ // Just print out normally, with some added information
-+ Bukkit.getLogger().log(this.level, String.format("%s[%s] %s", this.prefix, clazz.getName(), line));
-+ }
-+ }
-+ }
-+
-+ private static class PluginNag {
-+ private long lastNagTimestamp = Long.MIN_VALUE;
-+ private long messagesSinceNag = Long.MIN_VALUE;
-+ }
-+}
-diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
-index 14616e4be1cfd4961fdb0d990310bf625cc821a9..54820a8d11bb12c516d4138fb0bf77c16f053f3f 100644
---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
-+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
-@@ -305,6 +305,7 @@ public final class CraftServer implements Server {
- public Set<String> activeCompatibilities = Collections.emptySet();
- private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper
- public static Exception excessiveVelEx; // Paper - Velocity warnings
-+ private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher(); // Paper
-
- static {
- ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
diff --git a/patches/unapplied/server/0581-Prevent-AFK-kick-while-watching-end-credits.patch b/patches/unapplied/server/0581-Prevent-AFK-kick-while-watching-end-credits.patch
deleted file mode 100644
index 92d95bf1df..0000000000
--- a/patches/unapplied/server/0581-Prevent-AFK-kick-while-watching-end-credits.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Noah van der Aa <[email protected]>
-Date: Sat, 24 Jul 2021 16:54:11 +0200
-Subject: [PATCH] Prevent AFK kick while watching end credits
-
-
-diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 5ba7340d3860975b826dc878385e0879a9f07957..40d2c7bfc8ba8b8b366f23e53cf37f331e19ccf7 100644
---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -397,7 +397,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- --this.dropSpamTickCount;
- }
-
-- if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L) {
-+ 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
- this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
- this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
- }
diff --git a/patches/unapplied/server/0582-Allow-skipping-writing-of-comments-to-server.propert.patch b/patches/unapplied/server/0582-Allow-skipping-writing-of-comments-to-server.propert.patch
deleted file mode 100644
index 1fce522892..0000000000
--- a/patches/unapplied/server/0582-Allow-skipping-writing-of-comments-to-server.propert.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Professor Bloodstone <[email protected]>
-Date: Fri, 23 Jul 2021 02:32:04 +0200
-Subject: [PATCH] Allow skipping writing of comments to server.properties
-
-Makes less git noise, as it won't update the date every single time
-
-Use -DPaper.skipServerPropertiesComments=true flag to disable writing it
-
-diff --git a/src/main/java/net/minecraft/server/dedicated/Settings.java b/src/main/java/net/minecraft/server/dedicated/Settings.java
-index 0ec3b546db0cf3858dd9cd9ea067d1d6713a8491..d7bd235ef2815890e038091dd625177049d253a5 100644
---- a/src/main/java/net/minecraft/server/dedicated/Settings.java
-+++ b/src/main/java/net/minecraft/server/dedicated/Settings.java
-@@ -29,6 +29,7 @@ public abstract class Settings<T extends Settings<T>> {
-
- private static final Logger LOGGER = LogUtils.getLogger();
- public final Properties properties;
-+ private static final boolean skipComments = Boolean.getBoolean("Paper.skipServerPropertiesComments"); // Paper - allow skipping server.properties comments
- // CraftBukkit start
- private OptionSet options = null;
-
-@@ -123,7 +124,46 @@ public abstract class Settings<T extends Settings<T>> {
- return;
- }
- // CraftBukkit end
-- BufferedWriter bufferedwriter = Files.newBufferedWriter(path, StandardCharsets.UTF_8);
-+ // Paper start - allow skipping server.properties comments
-+ java.io.OutputStream outputstream = Files.newOutputStream(path);
-+ java.io.BufferedOutputStream bufferedOutputStream = !skipComments ? new java.io.BufferedOutputStream(outputstream) : new java.io.BufferedOutputStream(outputstream) {
-+ private boolean isRightAfterNewline = true; // If last written char was newline
-+ private boolean isComment = false; // Are we writing comment currently?
-+
-+ @Override
-+ public void write(@org.jetbrains.annotations.NotNull byte[] b) throws IOException {
-+ this.write(b, 0, b.length);
-+ }
-+
-+ @Override
-+ public void write(@org.jetbrains.annotations.NotNull byte[] bbuf, int off, int len) throws IOException {
-+ int latest_offset = off; // The latest offset, updated when comment ends
-+ for (int index = off; index < off + len; ++index ) {
-+ byte c = bbuf[index];
-+ boolean isNewline = (c == '\n' || c == '\r');
-+ if (isNewline && this.isComment) {
-+ // Comment has ended
-+ this.isComment = false;
-+ latest_offset = index+1;
-+ }
-+ if (c == '#' && this.isRightAfterNewline) {
-+ this.isComment = true;
-+ if (index != latest_offset) {
-+ // We got some non-comment data earlier
-+ super.write(bbuf, latest_offset, index-latest_offset);
-+ }
-+ }
-+ this.isRightAfterNewline = isNewline; // Store for next iteration
-+
-+ }
-+ if (latest_offset < off+len && !this.isComment) {
-+ // We have some unwritten data, that isn't part of a comment
-+ super.write(bbuf, latest_offset, (off + len) - latest_offset);
-+ }
-+ }
-+ };
-+ BufferedWriter bufferedwriter = new BufferedWriter(new java.io.OutputStreamWriter(bufferedOutputStream, java.nio.charset.StandardCharsets.UTF_8.newEncoder()));
-+ // Paper end - allow skipping server.properties comments
-
- try {
- this.properties.store(bufferedwriter, "Minecraft server properties");
diff --git a/patches/unapplied/server/0583-Add-PlayerSetSpawnEvent.patch b/patches/unapplied/server/0583-Add-PlayerSetSpawnEvent.patch
deleted file mode 100644
index 28d5ca16f6..0000000000
--- a/patches/unapplied/server/0583-Add-PlayerSetSpawnEvent.patch
+++ /dev/null
@@ -1,204 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Wed, 19 May 2021 18:59:10 -0700
-Subject: [PATCH] Add PlayerSetSpawnEvent
-
-
-diff --git a/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java b/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java
-index a2d0699e8427b2262a2396495111125eccafbb66..15db9368227dbc29d07d74e85bd126b345b526b6 100644
---- a/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java
-+++ b/src/main/java/net/minecraft/server/commands/SetSpawnCommand.java
-@@ -38,24 +38,34 @@ public class SetSpawnCommand {
- ResourceKey<Level> resourcekey = source.getLevel().dimension();
- Iterator iterator = targets.iterator();
-
-+ final Collection<ServerPlayer> actualTargets = new java.util.ArrayList<>(); // Paper - Add PlayerSetSpawnEvent
- while (iterator.hasNext()) {
- ServerPlayer entityplayer = (ServerPlayer) iterator.next();
-
-- entityplayer.setRespawnPosition(resourcekey, pos, angle, true, false, org.bukkit.event.player.PlayerSpawnChangeEvent.Cause.COMMAND); // CraftBukkit
-+ // Paper start - Add PlayerSetSpawnEvent
-+ if (entityplayer.setRespawnPosition(resourcekey, pos, angle, true, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.COMMAND)) {
-+ actualTargets.add(entityplayer);
-+ }
-+ // Paper end - Add PlayerSetSpawnEvent
- }
-+ // Paper start - Add PlayerSetSpawnEvent
-+ if (actualTargets.isEmpty()) {
-+ return 0;
-+ }
-+ // Paper end - Add PlayerSetSpawnEvent
-
- String s = resourcekey.location().toString();
-
-- if (targets.size() == 1) {
-+ if (actualTargets.size() == 1) { // Paper - Add PlayerSetSpawnEvent
- source.sendSuccess(() -> {
-- return Component.translatable("commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, s, ((ServerPlayer) targets.iterator().next()).getDisplayName());
-+ return Component.translatable("commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, s, ((ServerPlayer) actualTargets.iterator().next()).getDisplayName()); // Paper - Add PlayerSetSpawnEvent
- }, true);
- } else {
- source.sendSuccess(() -> {
-- return Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, s, targets.size());
-+ return Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, s, actualTargets.size()); // Paper - Add PlayerSetSpawnEvent
- }, true);
- }
-
-- return targets.size();
-+ return actualTargets.size(); // Paper - Add PlayerSetSpawnEvent
- }
- }
-diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index bb0ac7db0467ec8468fcbf63b8f22580ed11e723..b90b525faa5bba684c783a56f136532a8195de84 100644
---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
-+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-@@ -1384,7 +1384,7 @@ public class ServerPlayer extends Player {
- } else if (this.bedBlocked(blockposition, enumdirection)) {
- return Either.left(Player.BedSleepingProblem.OBSTRUCTED);
- } else {
-- this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true, PlayerSpawnChangeEvent.Cause.BED); // CraftBukkit
-+ this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.BED); // Paper - Add PlayerSetSpawnEvent
- if (this.level().isDay()) {
- return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW);
- } else {
-@@ -2354,44 +2354,50 @@ public class ServerPlayer extends Player {
- return this.respawnForced;
- }
-
-+ @Deprecated // Paper - Add PlayerSetSpawnEvent
- public void setRespawnPosition(ResourceKey<Level> dimension, @Nullable BlockPos pos, float angle, boolean forced, boolean sendMessage) {
-- // CraftBukkit start
-- this.setRespawnPosition(dimension, pos, angle, forced, sendMessage, PlayerSpawnChangeEvent.Cause.UNKNOWN);
-- }
--
-- public void setRespawnPosition(ResourceKey<Level> resourcekey, @Nullable BlockPos blockposition, float f, boolean flag, boolean flag1, PlayerSpawnChangeEvent.Cause cause) {
-- ServerLevel newWorld = this.server.getLevel(resourcekey);
-- Location newSpawn = (blockposition != null) ? CraftLocation.toBukkit(blockposition, newWorld.getWorld(), f, 0) : null;
--
-- PlayerSpawnChangeEvent event = new PlayerSpawnChangeEvent(this.getBukkitEntity(), newSpawn, flag, cause);
-- Bukkit.getServer().getPluginManager().callEvent(event);
-- if (event.isCancelled()) {
-- return;
-- }
-- newSpawn = event.getNewSpawn();
-- flag = event.isForced();
--
-- if (newSpawn != null) {
-- resourcekey = ((CraftWorld) newSpawn.getWorld()).getHandle().dimension();
-- blockposition = BlockPos.containing(newSpawn.getX(), newSpawn.getY(), newSpawn.getZ());
-- f = newSpawn.getYaw();
-- } else {
-- resourcekey = Level.OVERWORLD;
-- blockposition = null;
-- f = 0.0F;
-+ // Paper start - Add PlayerSetSpawnEvent
-+ this.setRespawnPosition(dimension, pos, angle, forced, sendMessage, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.UNKNOWN);
-+ }
-+ @Deprecated
-+ public boolean setRespawnPosition(ResourceKey<Level> dimension, @Nullable BlockPos pos, float angle, boolean forced, boolean sendMessage, PlayerSpawnChangeEvent.Cause cause) {
-+ return this.setRespawnPosition(dimension, pos, angle, forced, sendMessage, cause == PlayerSpawnChangeEvent.Cause.RESET ?
-+ com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN : com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.valueOf(cause.name()));
-+ }
-+ public boolean setRespawnPosition(ResourceKey<Level> dimension, @Nullable BlockPos pos, float angle, boolean forced, boolean sendMessage, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause cause) {
-+ Location spawnLoc = null;
-+ boolean willNotify = false;
-+ if (pos != null) {
-+ boolean flag2 = pos.equals(this.respawnPosition) && dimension.equals(this.respawnDimension);
-+ spawnLoc = io.papermc.paper.util.MCUtil.toLocation(this.getServer().getLevel(dimension), pos);
-+ spawnLoc.setYaw(angle);
-+ willNotify = sendMessage && !flag2;
-+ }
-+
-+ PlayerSpawnChangeEvent dumbEvent = new PlayerSpawnChangeEvent(this.getBukkitEntity(), spawnLoc, forced,
-+ cause == com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN ? PlayerSpawnChangeEvent.Cause.RESET : PlayerSpawnChangeEvent.Cause.valueOf(cause.name()));
-+ dumbEvent.callEvent();
-+
-+ com.destroystokyo.paper.event.player.PlayerSetSpawnEvent event = new com.destroystokyo.paper.event.player.PlayerSetSpawnEvent(this.getBukkitEntity(), cause, dumbEvent.getNewSpawn(), dumbEvent.isForced(), willNotify, willNotify ? net.kyori.adventure.text.Component.translatable("block.minecraft.set_spawn") : null);
-+ event.setCancelled(dumbEvent.isCancelled());
-+ if (!event.callEvent()) {
-+ return false;
- }
-- // CraftBukkit end
-- if (blockposition != null) {
-- boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension);
-+ if (event.getLocation() != null) {
-+ dimension = event.getLocation().getWorld() != null ? ((CraftWorld) event.getLocation().getWorld()).getHandle().dimension() : dimension;
-+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(event.getLocation());
-+ angle = event.getLocation().getYaw();
-+ forced = event.isForced();
-+ // Paper end - Add PlayerSetSpawnEvent
-
-- if (flag1 && !flag2) {
-- this.sendSystemMessage(Component.translatable("block.minecraft.set_spawn"));
-+ if (event.willNotifyPlayer() && event.getNotification() != null) { // Paper - Add PlayerSetSpawnEvent
-+ this.sendSystemMessage(PaperAdventure.asVanilla(event.getNotification())); // Paper - Add PlayerSetSpawnEvent
- }
-
-- this.respawnPosition = blockposition;
-- this.respawnDimension = resourcekey;
-- this.respawnAngle = f;
-- this.respawnForced = flag;
-+ this.respawnPosition = pos;
-+ this.respawnDimension = dimension;
-+ this.respawnAngle = angle;
-+ this.respawnForced = forced;
- } else {
- this.respawnPosition = null;
- this.respawnDimension = Level.OVERWORLD;
-@@ -2399,6 +2405,7 @@ public class ServerPlayer extends Player {
- this.respawnForced = false;
- }
-
-+ return true; // Paper - Add PlayerSetSpawnEvent
- }
-
- public SectionPos getLastSectionPos() {
-diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
-index 2b7ad2b9cd525814c9f91d22606c42aa82ce9f94..d7bbdcc97745246718c92c9aba56d9f926897975 100644
---- a/src/main/java/net/minecraft/server/players/PlayerList.java
-+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
-@@ -870,7 +870,7 @@ public abstract class PlayerList {
- location = CraftLocation.toBukkit(vec3d, worldserver1.getWorld(), f1, 0.0F);
- } else if (blockposition != null) {
- entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
-- entityplayer1.setRespawnPosition(null, null, 0f, false, false, PlayerSpawnChangeEvent.Cause.RESET); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed
-+ entityplayer1.setRespawnPosition(null, null, 0f, false, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed // Paper - Add PlayerSetSpawnEvent
- }
- }
-
-diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
-index ba22ad1e4253477572d10d71db6db0ebc14d6755..94d067e9eeee73183de25165d8c97043fe256103 100644
---- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
-+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
-@@ -89,9 +89,14 @@ public class RespawnAnchorBlock extends Block {
- ServerPlayer entityplayer = (ServerPlayer) player;
-
- if (entityplayer.getRespawnDimension() != world.dimension() || !pos.equals(entityplayer.getRespawnPosition())) {
-- entityplayer.setRespawnPosition(world.dimension(), pos, 0.0F, false, true, org.bukkit.event.player.PlayerSpawnChangeEvent.Cause.RESPAWN_ANCHOR); // CraftBukkit
-+ if (entityplayer.setRespawnPosition(world.dimension(), pos, 0.0F, false, true, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.RESPAWN_ANCHOR)) { // Paper - Add PlayerSetSpawnEvent
- world.playSound((Player) null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, SoundEvents.RESPAWN_ANCHOR_SET_SPAWN, SoundSource.BLOCKS, 1.0F, 1.0F);
- return InteractionResult.SUCCESS;
-+ // Paper start - Add PlayerSetSpawnEvent
-+ } else {
-+ return InteractionResult.FAIL;
-+ }
-+ // Paper end - Add PlayerSetSpawnEvent
- }
- }
-
-diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-index eee0c49bbf9bc768fcf7275c29536b4f16b1d421..634da85870b31a9fc09d53f5670239e18bcb3d47 100644
---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-@@ -1399,9 +1399,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
- @Override
- public void setRespawnLocation(Location location, boolean override) {
- if (location == null) {
-- this.getHandle().setRespawnPosition(null, null, 0.0F, override, false, PlayerSpawnChangeEvent.Cause.PLUGIN);
-+ this.getHandle().setRespawnPosition(null, null, 0.0F, override, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLUGIN); // Paper - Add PlayerSetSpawnEvent
- } else {
-- this.getHandle().setRespawnPosition(((CraftWorld) location.getWorld()).getHandle().dimension(), CraftLocation.toBlockPosition(location), location.getYaw(), override, false, PlayerSpawnChangeEvent.Cause.PLUGIN);
-+ this.getHandle().setRespawnPosition(((CraftWorld) location.getWorld()).getHandle().dimension(), CraftLocation.toBlockPosition(location), location.getYaw(), override, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLUGIN); // Paper - Add PlayerSetSpawnEvent
- }
- }
-
diff --git a/patches/unapplied/server/0584-Make-hoppers-respect-inventory-max-stack-size.patch b/patches/unapplied/server/0584-Make-hoppers-respect-inventory-max-stack-size.patch
deleted file mode 100644
index c5f669b979..0000000000
--- a/patches/unapplied/server/0584-Make-hoppers-respect-inventory-max-stack-size.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Jake Potrebic <[email protected]>
-Date: Wed, 7 Jul 2021 16:30:17 -0700
-Subject: [PATCH] Make hoppers respect inventory max stack size
-
-
-diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
-index dfb57192105d5e05e4c2e32da5eadb7c701a763a..92086ca118d55ec49cefa5bf18977f8706e3e4b4 100644
---- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
-+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
-@@ -485,15 +485,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
-
- if (itemstack1.isEmpty()) {
- // Spigot start - SPIGOT-6693, InventorySubcontainer#setItem
-+ ItemStack leftover = ItemStack.EMPTY; // Paper - Make hoppers respect inventory max stack size
- if (!stack.isEmpty() && stack.getCount() > to.getMaxStackSize()) {
-+ leftover = stack; // Paper - Make hoppers respect inventory max stack size
- stack = stack.split(to.getMaxStackSize());
- }
- // Spigot end
- to.setItem(slot, stack);
-- stack = ItemStack.EMPTY;
-+ stack = leftover; // Paper - Make hoppers respect inventory max stack size
- flag = true;
- } else if (HopperBlockEntity.canMergeItems(itemstack1, stack)) {
-- int j = stack.getMaxStackSize() - itemstack1.getCount();
-+ int j = Math.min(stack.getMaxStackSize(), to.getMaxStackSize()) - itemstack1.getCount(); // Paper - Make hoppers respect inventory max stack size
- int k = Math.min(stack.getCount(), j);
-
- stack.shrink(k);
diff --git a/patches/unapplied/server/0585-Optimize-entity-tracker-passenger-checks.patch b/patches/unapplied/server/0585-Optimize-entity-tracker-passenger-checks.patch
deleted file mode 100644
index a764dcd8ab..0000000000
--- a/patches/unapplied/server/0585-Optimize-entity-tracker-passenger-checks.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Andrew Steinborn <[email protected]>
-Date: Sun, 8 Aug 2021 00:52:54 -0400
-Subject: [PATCH] Optimize entity tracker passenger checks
-
-
-diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
-index 002c73c7dc7c72968ed8692a67e1bce4236f7214..56408fa2603137819f47e7bd9b53b0b5f647edd6 100644
---- a/src/main/java/net/minecraft/server/level/ServerEntity.java
-+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
-@@ -83,7 +83,7 @@ public class ServerEntity {
- this.trackedPlayers = trackedPlayers;
- // CraftBukkit end
- this.ap = Vec3.ZERO;
-- this.lastPassengers = Collections.emptyList();
-+ this.lastPassengers = com.google.common.collect.ImmutableList.of(); // Paper - optimize passenger checks
- this.level = worldserver;
- this.broadcast = consumer;
- this.entity = entity;