From 592816683c6940adf6ed1f3426bfeb51c143f827 Mon Sep 17 00:00:00 2001
From: Bjarne Koll <git@lynxplay.dev>
Date: Wed, 23 Oct 2024 20:15:25 +0200
Subject: [PATCH] 553

---
 ...essage-to-PlayerAdvancementDoneEvent.patch |  4 +-
 .../server/Add-BellRevealRaiderEvent.patch    |  0
 ...Add-Channel-initialization-listeners.patch |  0
 .../Add-ElderGuardianAppearanceEvent.patch    |  6 +--
 ...Add-EntityBlockStorage-clearEntities.patch |  0
 .../server/Add-EntityInsideBlockEvent.patch   | 38 +++++++++----------
 .../server/Add-HiddenPotionEffect-API.patch   |  0
 .../server/Add-Mob-lookAt-API.patch           |  0
 .../server/Add-PlayerBedFailEnterEvent.patch  |  2 +-
 .../server/Add-PlayerDeepSleepEvent.patch     |  0
 .../server/Add-PlayerKickEvent-causes.patch   | 10 ++---
 .../Add-PufferFishStateChangeEvent.patch      |  0
 .../Add-Unix-domain-socket-support.patch      |  0
 ...n-in-sunlight-API-for-Phantoms-and-S.patch |  0
 .../server/Add-basic-Datapack-API.patch       |  0
 .../server/Add-bypass-host-check.patch        |  0
 ...cause-to-Weather-ThunderChangeEvents.patch |  6 +--
 ...nment-variable-to-disable-server-gui.patch |  0
 .../server/Add-more-LimitedRegion-API.patch   |  0
 .../server/Add-more-WanderingTrader-API.patch |  0
 ...n-to-fix-items-merging-through-walls.patch |  0
 ...if-bucket-dispenses-will-succeed-for.patch |  0
 .../Expand-PlayerGameModeChangeEvent.patch    |  4 +-
 ...pawnEvent-fix-passed-parameter-issue.patch |  2 +-
 ...yerBucketEmptyEvent-result-itemstack.patch |  0
 ...PlayerDropItemEvent-using-wrong-item.patch | 18 ++++-----
 .../Fix-invulnerable-end-crystals.patch       |  0
 .../server/Fix-potions-splash-events.patch    | 32 ++++++++--------
 ...s-to-convert-between-Component-and-B.patch |  0
 .../Improve-item-default-attribute-API.patch  |  3 --
 ...eacon-activation-deactivation-events.patch |  2 +-
 .../server/Inventory-close.patch              |  0
 .../server/ItemStack-repair-check-API.patch   |  0
 .../Limit-item-frame-cursors-on-maps.patch    |  0
 .../server/Line-Of-Sight-Changes.patch        |  6 +--
 .../server/Missing-Entity-API.patch           |  9 +++--
 .../server/More-Enchantment-API.patch         |  0
 .../server/More-Lidded-Block-API.patch        |  0
 .../server/More-World-API.patch               |  0
 ...ove-range-check-for-block-placing-up.patch |  0
 ...e-Biome-Mob-Lookups-for-Mob-Spawning.patch |  0
 ...mmands-if-tab-completion-is-disabled.patch |  0
 .../Set-area-affect-cloud-rotation.patch      |  4 +-
 ...ttedContainer-instead-of-ThreadingDe.patch |  0
 .../add-consumeFuel-to-FurnaceBurnEvent.patch |  0
 ...t-set-drop-chance-to-EntityEquipment.patch |  0
 .../add-isDeeplySleeping-to-HumanEntity.patch |  0
 .../server/add-per-world-spawn-limits.patch   |  0
 ...fix-PigZombieAngerEvent-cancellation.patch |  0
 ...fix-PlayerItemHeldEvent-firing-twice.patch |  0
 50 files changed, 70 insertions(+), 76 deletions(-)
 rename patches/{unapplied => }/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch (93%)
 rename patches/{unapplied => }/server/Add-BellRevealRaiderEvent.patch (100%)
 rename patches/{unapplied => }/server/Add-Channel-initialization-listeners.patch (100%)
 rename patches/{unapplied => }/server/Add-ElderGuardianAppearanceEvent.patch (86%)
 rename patches/{unapplied => }/server/Add-EntityBlockStorage-clearEntities.patch (100%)
 rename patches/{unapplied => }/server/Add-EntityInsideBlockEvent.patch (93%)
 rename patches/{unapplied => }/server/Add-HiddenPotionEffect-API.patch (100%)
 rename patches/{unapplied => }/server/Add-Mob-lookAt-API.patch (100%)
 rename patches/{unapplied => }/server/Add-PlayerBedFailEnterEvent.patch (97%)
 rename patches/{unapplied => }/server/Add-PlayerDeepSleepEvent.patch (100%)
 rename patches/{unapplied => }/server/Add-PlayerKickEvent-causes.patch (98%)
 rename patches/{unapplied => }/server/Add-PufferFishStateChangeEvent.patch (100%)
 rename patches/{unapplied => }/server/Add-Unix-domain-socket-support.patch (100%)
 rename patches/{unapplied => }/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch (100%)
 rename patches/{unapplied => }/server/Add-basic-Datapack-API.patch (100%)
 rename patches/{unapplied => }/server/Add-bypass-host-check.patch (100%)
 rename patches/{unapplied => }/server/Add-cause-to-Weather-ThunderChangeEvents.patch (98%)
 rename patches/{unapplied => }/server/Add-environment-variable-to-disable-server-gui.patch (100%)
 rename patches/{unapplied => }/server/Add-more-LimitedRegion-API.patch (100%)
 rename patches/{unapplied => }/server/Add-more-WanderingTrader-API.patch (100%)
 rename patches/{unapplied => }/server/Add-option-to-fix-items-merging-through-walls.patch (100%)
 rename patches/{unapplied => }/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch (100%)
 rename patches/{unapplied => }/server/Expand-PlayerGameModeChangeEvent.patch (97%)
 rename patches/{unapplied => }/server/Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch (90%)
 rename patches/{unapplied => }/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch (100%)
 rename patches/{unapplied => }/server/Fix-PlayerDropItemEvent-using-wrong-item.patch (83%)
 rename patches/{unapplied => }/server/Fix-invulnerable-end-crystals.patch (100%)
 rename patches/{unapplied => }/server/Fix-potions-splash-events.patch (84%)
 rename patches/{unapplied => }/server/Implement-methods-to-convert-between-Component-and-B.patch (100%)
 rename patches/{unapplied => }/server/Improve-item-default-attribute-API.patch (97%)
 rename patches/{unapplied => }/server/Introduce-beacon-activation-deactivation-events.patch (96%)
 rename patches/{unapplied => }/server/Inventory-close.patch (100%)
 rename patches/{unapplied => }/server/ItemStack-repair-check-API.patch (100%)
 rename patches/{unapplied => }/server/Limit-item-frame-cursors-on-maps.patch (100%)
 rename patches/{unapplied => }/server/Line-Of-Sight-Changes.patch (91%)
 rename patches/{unapplied => }/server/Missing-Entity-API.patch (99%)
 rename patches/{unapplied => }/server/More-Enchantment-API.patch (100%)
 rename patches/{unapplied => }/server/More-Lidded-Block-API.patch (100%)
 rename patches/{unapplied => }/server/More-World-API.patch (100%)
 rename patches/{unapplied => }/server/Move-range-check-for-block-placing-up.patch (100%)
 rename patches/{unapplied => }/server/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch (100%)
 rename patches/{unapplied => }/server/Send-empty-commands-if-tab-completion-is-disabled.patch (100%)
 rename patches/{unapplied => }/server/Set-area-affect-cloud-rotation.patch (91%)
 rename patches/{unapplied => }/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch (100%)
 rename patches/{unapplied => }/server/add-consumeFuel-to-FurnaceBurnEvent.patch (100%)
 rename patches/{unapplied => }/server/add-get-set-drop-chance-to-EntityEquipment.patch (100%)
 rename patches/{unapplied => }/server/add-isDeeplySleeping-to-HumanEntity.patch (100%)
 rename patches/{unapplied => }/server/add-per-world-spawn-limits.patch (100%)
 rename patches/{unapplied => }/server/fix-PigZombieAngerEvent-cancellation.patch (100%)
 rename patches/{unapplied => }/server/fix-PlayerItemHeldEvent-firing-twice.patch (100%)

diff --git a/patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch
similarity index 93%
rename from patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch
rename to patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch
index 0340317d7e..798638390f 100644
--- a/patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch
+++ b/patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch
@@ -24,10 +24,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +                // Paper end
                  advancement.value().rewards().grant(this.player);
                  advancement.value().display().ifPresent((advancementdisplay) -> {
--                    if (advancementdisplay.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
+-                    if (advancementdisplay.shouldAnnounceChat() && this.player.serverLevel().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
 -                        this.playerList.broadcastSystemMessage(advancementdisplay.getType().createAnnouncement(advancement, this.player), false);
 +                    // Paper start - Add Adventure message to PlayerAdvancementDoneEvent
-+                    if (event.message() != null && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
++                    if (event.message() != null && this.player.serverLevel().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
 +                        this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false);
 +                        // Paper end
                      }
diff --git a/patches/unapplied/server/Add-BellRevealRaiderEvent.patch b/patches/server/Add-BellRevealRaiderEvent.patch
similarity index 100%
rename from patches/unapplied/server/Add-BellRevealRaiderEvent.patch
rename to patches/server/Add-BellRevealRaiderEvent.patch
diff --git a/patches/unapplied/server/Add-Channel-initialization-listeners.patch b/patches/server/Add-Channel-initialization-listeners.patch
similarity index 100%
rename from patches/unapplied/server/Add-Channel-initialization-listeners.patch
rename to patches/server/Add-Channel-initialization-listeners.patch
diff --git a/patches/unapplied/server/Add-ElderGuardianAppearanceEvent.patch b/patches/server/Add-ElderGuardianAppearanceEvent.patch
similarity index 86%
rename from patches/unapplied/server/Add-ElderGuardianAppearanceEvent.patch
rename to patches/server/Add-ElderGuardianAppearanceEvent.patch
index 3c9cdce592..d3137b778c 100644
--- a/patches/unapplied/server/Add-ElderGuardianAppearanceEvent.patch
+++ b/patches/server/Add-ElderGuardianAppearanceEvent.patch
@@ -38,11 +38,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
 +++ b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java
 @@ -0,0 +0,0 @@ public class ElderGuardian extends Guardian {
-         super.customServerAiStep();
+         super.customServerAiStep(world);
          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<ServerPlayer> list = MobEffectUtil.addEffectToPlayersAround(world, this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
++            List<ServerPlayer> list = MobEffectUtil.addEffectToPlayersAround(world, 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/Add-EntityBlockStorage-clearEntities.patch b/patches/server/Add-EntityBlockStorage-clearEntities.patch
similarity index 100%
rename from patches/unapplied/server/Add-EntityBlockStorage-clearEntities.patch
rename to patches/server/Add-EntityBlockStorage-clearEntities.patch
diff --git a/patches/unapplied/server/Add-EntityInsideBlockEvent.patch b/patches/server/Add-EntityInsideBlockEvent.patch
similarity index 93%
rename from patches/unapplied/server/Add-EntityInsideBlockEvent.patch
rename to patches/server/Add-EntityInsideBlockEvent.patch
index acbd7ea2b8..df914580b0 100644
--- a/patches/unapplied/server/Add-EntityInsideBlockEvent.patch
+++ b/patches/server/Add-EntityInsideBlockEvent.patch
@@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      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) {
+             if (entity.getRemainingFireTicks() < 0) {
+                 entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
@@ -97,9 +97,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      @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);
-         }
+         if (world instanceof ServerLevel worldserver) {
+             if (entity instanceof Ravager && CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState(), !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
+                 worldserver.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
@@ -133,7 +133,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      @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.canUsePortal(false) && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), state.getShape(world, pos), BooleanOp.AND)) {
+         if (entity.canUsePortal(false)) {
              // 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/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
@@ -193,9 +193,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      @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)) {
+         if (world instanceof ServerLevel worldserver) {
+             if (entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) {
+                 // CraftBukkit start - moved down
 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -217,8 +217,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      @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);
+         if (world instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+             serverLevel.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@@ -243,7 +243,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        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())) {
+             if (world instanceof ServerLevel) {
 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
@@ -255,19 +255,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        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);
+                 this.checkPressed(world, pos, List.of(entity));
 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
 +++ b/src/main/java/net/minecraft/world/level/block/WaterlilyBlock.java
 @@ -0,0 +0,0 @@ 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) {
+         super.entityInside(state, world, pos, entity);
+         if (world instanceof ServerLevel && entity instanceof AbstractBoat) {
              // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/level/block/WebBlock.java
@@ -289,6 +289,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      @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;
+         if (world instanceof ServerLevel worldserver) {
+             if (world.getDifficulty() != Difficulty.PEACEFUL && entity instanceof LivingEntity entityliving) {
+                 if (!entityliving.isInvulnerableTo(worldserver, world.damageSources().wither())) {
diff --git a/patches/unapplied/server/Add-HiddenPotionEffect-API.patch b/patches/server/Add-HiddenPotionEffect-API.patch
similarity index 100%
rename from patches/unapplied/server/Add-HiddenPotionEffect-API.patch
rename to patches/server/Add-HiddenPotionEffect-API.patch
diff --git a/patches/unapplied/server/Add-Mob-lookAt-API.patch b/patches/server/Add-Mob-lookAt-API.patch
similarity index 100%
rename from patches/unapplied/server/Add-Mob-lookAt-API.patch
rename to patches/server/Add-Mob-lookAt-API.patch
diff --git a/patches/unapplied/server/Add-PlayerBedFailEnterEvent.patch b/patches/server/Add-PlayerBedFailEnterEvent.patch
similarity index 97%
rename from patches/unapplied/server/Add-PlayerBedFailEnterEvent.patch
rename to patches/server/Add-PlayerBedFailEnterEvent.patch
index 88703ed557..13dc675245 100644
--- a/patches/unapplied/server/Add-PlayerBedFailEnterEvent.patch
+++ b/patches/server/Add-PlayerBedFailEnterEvent.patch
@@ -33,4 +33,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +                    } // Paper - PlayerBedFailEnterEvent
  
                  });
-                 return InteractionResult.SUCCESS;
+                 return InteractionResult.SUCCESS_SERVER;
diff --git a/patches/unapplied/server/Add-PlayerDeepSleepEvent.patch b/patches/server/Add-PlayerDeepSleepEvent.patch
similarity index 100%
rename from patches/unapplied/server/Add-PlayerDeepSleepEvent.patch
rename to patches/server/Add-PlayerDeepSleepEvent.patch
diff --git a/patches/unapplied/server/Add-PlayerKickEvent-causes.patch b/patches/server/Add-PlayerKickEvent-causes.patch
similarity index 98%
rename from patches/unapplied/server/Add-PlayerKickEvent-causes.patch
rename to patches/server/Add-PlayerKickEvent-causes.patch
index faf7779703..dc760c7989 100644
--- a/patches/unapplied/server/Add-PlayerKickEvent-causes.patch
+++ b/patches/server/Add-PlayerKickEvent-causes.patch
@@ -251,7 +251,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
                  }
              } else {
 @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- 
+         this.dropSpamThrottler.tick();
          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) Component.translatable("multiplayer.disconnect.idling"));
@@ -280,7 +280,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 @@ -0,0 +0,0 @@ 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
+         if (!this.tabSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(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;
@@ -358,8 +358,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
              return optional;
 @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
-         // this.chatSpamTickCount += 20;
-         if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) {
+         // this.chatSpamThrottler.increment();
+         if (!this.chatSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) {
              // CraftBukkit end
 -            this.disconnect((Component) Component.translatable("disconnect.spam"));
 +            this.disconnect((Component) Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
@@ -405,7 +405,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 @@ -0,0 +0,0 @@ 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) {
+             if (!this.recipeSpamPackets.isIncrementAndUnderThreshold()) {
 -                this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam"));
 +                this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
                  return;
diff --git a/patches/unapplied/server/Add-PufferFishStateChangeEvent.patch b/patches/server/Add-PufferFishStateChangeEvent.patch
similarity index 100%
rename from patches/unapplied/server/Add-PufferFishStateChangeEvent.patch
rename to patches/server/Add-PufferFishStateChangeEvent.patch
diff --git a/patches/unapplied/server/Add-Unix-domain-socket-support.patch b/patches/server/Add-Unix-domain-socket-support.patch
similarity index 100%
rename from patches/unapplied/server/Add-Unix-domain-socket-support.patch
rename to patches/server/Add-Unix-domain-socket-support.patch
diff --git a/patches/unapplied/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch
similarity index 100%
rename from patches/unapplied/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch
rename to patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch
diff --git a/patches/unapplied/server/Add-basic-Datapack-API.patch b/patches/server/Add-basic-Datapack-API.patch
similarity index 100%
rename from patches/unapplied/server/Add-basic-Datapack-API.patch
rename to patches/server/Add-basic-Datapack-API.patch
diff --git a/patches/unapplied/server/Add-bypass-host-check.patch b/patches/server/Add-bypass-host-check.patch
similarity index 100%
rename from patches/unapplied/server/Add-bypass-host-check.patch
rename to patches/server/Add-bypass-host-check.patch
diff --git a/patches/unapplied/server/Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/server/Add-cause-to-Weather-ThunderChangeEvents.patch
similarity index 98%
rename from patches/unapplied/server/Add-cause-to-Weather-ThunderChangeEvents.patch
rename to patches/server/Add-cause-to-Weather-ThunderChangeEvents.patch
index bb44a3c296..0ddc7464e6 100644
--- a/patches/unapplied/server/Add-cause-to-Weather-ThunderChangeEvents.patch
+++ b/patches/server/Add-cause-to-Weather-ThunderChangeEvents.patch
@@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
 +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
-@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
          this.serverLevelData.setClearWeatherTime(clearDuration);
          this.serverLevelData.setRainTime(rainDuration);
          this.serverLevelData.setThunderTime(rainDuration);
@@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      }
  
      @Override
-@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
                  this.serverLevelData.setThunderTime(j);
                  this.serverLevelData.setRainTime(k);
                  this.serverLevelData.setClearWeatherTime(i);
@@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              }
  
              this.oThunderLevel = this.thunderLevel;
-@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
+@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
      @VisibleForTesting
      public void resetWeatherCycle() {
          // CraftBukkit start
diff --git a/patches/unapplied/server/Add-environment-variable-to-disable-server-gui.patch b/patches/server/Add-environment-variable-to-disable-server-gui.patch
similarity index 100%
rename from patches/unapplied/server/Add-environment-variable-to-disable-server-gui.patch
rename to patches/server/Add-environment-variable-to-disable-server-gui.patch
diff --git a/patches/unapplied/server/Add-more-LimitedRegion-API.patch b/patches/server/Add-more-LimitedRegion-API.patch
similarity index 100%
rename from patches/unapplied/server/Add-more-LimitedRegion-API.patch
rename to patches/server/Add-more-LimitedRegion-API.patch
diff --git a/patches/unapplied/server/Add-more-WanderingTrader-API.patch b/patches/server/Add-more-WanderingTrader-API.patch
similarity index 100%
rename from patches/unapplied/server/Add-more-WanderingTrader-API.patch
rename to patches/server/Add-more-WanderingTrader-API.patch
diff --git a/patches/unapplied/server/Add-option-to-fix-items-merging-through-walls.patch b/patches/server/Add-option-to-fix-items-merging-through-walls.patch
similarity index 100%
rename from patches/unapplied/server/Add-option-to-fix-items-merging-through-walls.patch
rename to patches/server/Add-option-to-fix-items-merging-through-walls.patch
diff --git a/patches/unapplied/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch b/patches/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch
similarity index 100%
rename from patches/unapplied/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch
rename to patches/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch
diff --git a/patches/unapplied/server/Expand-PlayerGameModeChangeEvent.patch b/patches/server/Expand-PlayerGameModeChangeEvent.patch
similarity index 97%
rename from patches/unapplied/server/Expand-PlayerGameModeChangeEvent.patch
rename to patches/server/Expand-PlayerGameModeChangeEvent.patch
index 81a10562ba..80fa3dab72 100644
--- a/patches/unapplied/server/Expand-PlayerGameModeChangeEvent.patch
+++ b/patches/server/Expand-PlayerGameModeChangeEvent.patch
@@ -138,12 +138,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
 +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
 @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
- 
                      this.player = this.server.getPlayerList().respawn(this.player, false, Entity.RemovalReason.KILLED, RespawnReason.DEATH); // CraftBukkit
+                     this.resetPosition();
                      if (this.server.isHardcore()) {
 -                        this.player.setGameMode(GameType.SPECTATOR);
 +                        this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper - Expand PlayerGameModeChangeEvent
-                         ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.player.serverLevel()); // CraftBukkit - per-world
+                         ((GameRules.BooleanValue) this.player.serverLevel().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.player.serverLevel()); // CraftBukkit - per-world
                      }
                  }
 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
diff --git a/patches/unapplied/server/Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch b/patches/server/Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch
similarity index 90%
rename from patches/unapplied/server/Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch
rename to patches/server/Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch
index 1fc36ff8d1..ba6b41e9ce 100644
--- a/patches/unapplied/server/Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch
+++ b/patches/server/Expand-PlayerRespawnEvent-fix-passed-parameter-issue.patch
@@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
 @@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
          Player respawnPlayer = this.getBukkitEntity();
-         Location location = CraftLocation.toBukkit(dimensionTransition.pos(), dimensionTransition.newLevel().getWorld(), dimensionTransition.yRot(), dimensionTransition.xRot());
+         Location location = CraftLocation.toBukkit(teleportTransition.position(), teleportTransition.newLevel().getWorld(), teleportTransition.yRot(), teleportTransition.xRot());
  
 -        PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn, isAnchorSpawn, reason);
 +        // Paper start - respawn flags
diff --git a/patches/unapplied/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch b/patches/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch
similarity index 100%
rename from patches/unapplied/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch
rename to patches/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch
diff --git a/patches/unapplied/server/Fix-PlayerDropItemEvent-using-wrong-item.patch b/patches/server/Fix-PlayerDropItemEvent-using-wrong-item.patch
similarity index 83%
rename from patches/unapplied/server/Fix-PlayerDropItemEvent-using-wrong-item.patch
rename to patches/server/Fix-PlayerDropItemEvent-using-wrong-item.patch
index 13e20f4fba..550fe50c99 100644
--- a/patches/unapplied/server/Fix-PlayerDropItemEvent-using-wrong-item.patch
+++ b/patches/server/Fix-PlayerDropItemEvent-using-wrong-item.patch
@@ -43,19 +43,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
                  }
  
                  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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/net/minecraft/world/entity/player/Player.java
-+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
-@@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
-             }
- 
+@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
+             return null;
+         } else {
              double d0 = this.getEyeY() - 0.30000001192092896D;
 +            // Paper start
-+            ItemStack tmp = itemstack.copy();
-+            itemstack.setCount(0);
-+            itemstack = tmp;
++            ItemStack tmp = stack.copy();
++            stack.setCount(0);
++            stack = tmp;
 +            // Paper end
-             ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), d0, this.getZ(), itemstack);
+             ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), d0, this.getZ(), stack);
  
              entityitem.setPickUpDelay(40);
diff --git a/patches/unapplied/server/Fix-invulnerable-end-crystals.patch b/patches/server/Fix-invulnerable-end-crystals.patch
similarity index 100%
rename from patches/unapplied/server/Fix-invulnerable-end-crystals.patch
rename to patches/server/Fix-invulnerable-end-crystals.patch
diff --git a/patches/unapplied/server/Fix-potions-splash-events.patch b/patches/server/Fix-potions-splash-events.patch
similarity index 84%
rename from patches/unapplied/server/Fix-potions-splash-events.patch
rename to patches/server/Fix-potions-splash-events.patch
index d9481f9a93..19147190e1 100644
--- a/patches/unapplied/server/Fix-potions-splash-events.patch
+++ b/patches/server/Fix-potions-splash-events.patch
@@ -11,36 +11,36 @@ diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.ja
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
 +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
-@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
+@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile {
              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
+-                this.applyWater(worldserver);
++                showParticles = this.applyWater(worldserver, 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
+-                    this.applySplash(worldserver, potioncontents.getAllEffects(), hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition
++                    showParticles = this.applySplash(worldserver, 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());
+             worldserver.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 void applyWater(ServerLevel world) {
 +    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
++    private boolean applyWater(ServerLevel world, @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
@@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
              if (d0 < 16.0D) {
                  if (entityliving.isSensitiveToWater()) {
--                    entityliving.hurt(this.damageSources().indirectMagic(this, this.getOwner()), 1.0F);
+-                    entityliving.hurtServer(world, this.damageSources().indirectMagic(this, this.getOwner()), 1.0F);
 +                    affected.put(entityliving.getBukkitLivingEntity(), 1.0);
                  }
  
@@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        );
 +        if (!event.isCancelled()) {
 +            for (LivingEntity affectedEntity : event.getToDamage()) {
-+                ((CraftLivingEntity) affectedEntity).getHandle().hurt(this.damageSources().indirectMagic(this, this.getOwner()), 1.0F);
++                ((CraftLivingEntity) affectedEntity).getHandle().hurtServer(world, this.damageSources().indirectMagic(this, this.getOwner()), 1.0F);
 +            }
 +            for (LivingEntity toExtinguish : event.getToExtinguish()) {
 +                ((CraftLivingEntity) toExtinguish).getHandle().extinguishFire();
@@ -98,12 +98,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
      }
  
--    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
+-    private void applySplash(ServerLevel worldserver, Iterable<MobEffectInstance> iterable, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
++    private boolean applySplash(ServerLevel worldserver, 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);
+         List<net.minecraft.world.entity.LivingEntity> list = worldserver.getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb);
          Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit
-@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
+@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile {
                      if (d0 < 16.0D) {
                          double d1;
  
@@ -111,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
                          if (entityliving == entity) {
                              d1 = 1.0D;
                          } else {
-@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
+@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile {
                  }
              }
          }
@@ -124,7 +124,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
          Entity entity = this.getOwner();
  
-@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
+@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile {
          entityareaeffectcloud.setWaitTime(10);
          entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / (float) entityareaeffectcloud.getDuration());
          entityareaeffectcloud.setPotionContents(potioncontents);
diff --git a/patches/unapplied/server/Implement-methods-to-convert-between-Component-and-B.patch b/patches/server/Implement-methods-to-convert-between-Component-and-B.patch
similarity index 100%
rename from patches/unapplied/server/Implement-methods-to-convert-between-Component-and-B.patch
rename to patches/server/Implement-methods-to-convert-between-Component-and-B.patch
diff --git a/patches/unapplied/server/Improve-item-default-attribute-API.patch b/patches/server/Improve-item-default-attribute-API.patch
similarity index 97%
rename from patches/unapplied/server/Improve-item-default-attribute-API.patch
rename to patches/server/Improve-item-default-attribute-API.patch
index 6bf8372375..1aa1367c4f 100644
--- a/patches/unapplied/server/Improve-item-default-attribute-API.patch
+++ b/patches/server/Improve-item-default-attribute-API.patch
@@ -45,9 +45,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
  
          ItemAttributeModifiers nmsDefaultAttributes = this.item.components().getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY);
-         if (nmsDefaultAttributes.modifiers().isEmpty()) {
-             nmsDefaultAttributes = this.item.getDefaultAttributeModifiers();
-         }
 -
 -        nmsDefaultAttributes.forEach(CraftEquipmentSlot.getNMS(slot), (key, value) -> {
 -            Attribute attribute = CraftAttribute.minecraftToBukkit(key.value());
diff --git a/patches/unapplied/server/Introduce-beacon-activation-deactivation-events.patch b/patches/server/Introduce-beacon-activation-deactivation-events.patch
similarity index 96%
rename from patches/unapplied/server/Introduce-beacon-activation-deactivation-events.patch
rename to patches/server/Introduce-beacon-activation-deactivation-events.patch
index 36cfb53312..c9682dc421 100644
--- a/patches/unapplied/server/Introduce-beacon-activation-deactivation-events.patch
+++ b/patches/server/Introduce-beacon-activation-deactivation-events.patch
@@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        // Paper end - beacon activation/deactivation events
  
          if (blockEntity.lastCheckY >= l) {
-             blockEntity.lastCheckY = world.getMinBuildHeight() - 1;
+             blockEntity.lastCheckY = world.getMinY() - 1;
 @@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
  
      @Override
diff --git a/patches/unapplied/server/Inventory-close.patch b/patches/server/Inventory-close.patch
similarity index 100%
rename from patches/unapplied/server/Inventory-close.patch
rename to patches/server/Inventory-close.patch
diff --git a/patches/unapplied/server/ItemStack-repair-check-API.patch b/patches/server/ItemStack-repair-check-API.patch
similarity index 100%
rename from patches/unapplied/server/ItemStack-repair-check-API.patch
rename to patches/server/ItemStack-repair-check-API.patch
diff --git a/patches/unapplied/server/Limit-item-frame-cursors-on-maps.patch b/patches/server/Limit-item-frame-cursors-on-maps.patch
similarity index 100%
rename from patches/unapplied/server/Limit-item-frame-cursors-on-maps.patch
rename to patches/server/Limit-item-frame-cursors-on-maps.patch
diff --git a/patches/unapplied/server/Line-Of-Sight-Changes.patch b/patches/server/Line-Of-Sight-Changes.patch
similarity index 91%
rename from patches/unapplied/server/Line-Of-Sight-Changes.patch
rename to patches/server/Line-Of-Sight-Changes.patch
index 11ab979d47..9724f1fb8b 100644
--- a/patches/unapplied/server/Line-Of-Sight-Changes.patch
+++ b/patches/server/Line-Of-Sight-Changes.patch
@@ -10,11 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
 @@ -0,0 +0,0 @@ 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());
+             Vec3 vec3d1 = new Vec3(entity.getX(), entityY.getAsDouble(), 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;
+-            return vec3d1.distanceTo(vec3d) > 128.0D ? false : this.level().clip(new ClipContext(vec3d, vec3d1, shapeType, fluidHandling, 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
++            return vec3d1.distanceToSqr(vec3d) > 128.0D * 128.0D ? false : this.level().clip(new ClipContext(vec3d, vec3d1, shapeType, fluidHandling, this)).getType() == HitResult.Type.MISS; // Paper - Perf: Use distance squared
          }
      }
  
diff --git a/patches/unapplied/server/Missing-Entity-API.patch b/patches/server/Missing-Entity-API.patch
similarity index 99%
rename from patches/unapplied/server/Missing-Entity-API.patch
rename to patches/server/Missing-Entity-API.patch
index 6c793aa8b1..8ba76e3fc7 100644
--- a/patches/unapplied/server/Missing-Entity-API.patch
+++ b/patches/server/Missing-Entity-API.patch
@@ -250,6 +250,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
      public Llama(EntityType<? extends Llama> type, Level world) {
          super(type, world);
+         this.getNavigation().setRequiredPathLength(40.0F);
 +        this.maxDomestication = 30; // Paper - Missing entity API; configure max temper instead of a hardcoded value
      }
  
@@ -267,7 +268,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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
-@@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
+@@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements 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);
@@ -279,7 +280,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
      public WitherBoss(EntityType<? extends WitherBoss> type, Level world) {
          super(type, world);
-@@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
+@@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements RangedAttackMob {
  
      @Override
      public boolean canUsePortal(boolean allowVehicles) {
@@ -596,7 +597,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java b/src
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
-@@ -0,0 +0,0 @@ public class CraftDolphin extends CraftWaterMob implements Dolphin {
+@@ -0,0 +0,0 @@ public class CraftDolphin extends CraftAgeable implements Dolphin {
      public String toString() {
          return "CraftDolphin";
      }
@@ -1157,7 +1158,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java b/src/
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
-@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.entity;
+@@ -0,0 +0,0 @@ import com.google.common.base.Preconditions;
  import org.bukkit.craftbukkit.CraftServer;
  import org.bukkit.entity.Salmon;
  
diff --git a/patches/unapplied/server/More-Enchantment-API.patch b/patches/server/More-Enchantment-API.patch
similarity index 100%
rename from patches/unapplied/server/More-Enchantment-API.patch
rename to patches/server/More-Enchantment-API.patch
diff --git a/patches/unapplied/server/More-Lidded-Block-API.patch b/patches/server/More-Lidded-Block-API.patch
similarity index 100%
rename from patches/unapplied/server/More-Lidded-Block-API.patch
rename to patches/server/More-Lidded-Block-API.patch
diff --git a/patches/unapplied/server/More-World-API.patch b/patches/server/More-World-API.patch
similarity index 100%
rename from patches/unapplied/server/More-World-API.patch
rename to patches/server/More-World-API.patch
diff --git a/patches/unapplied/server/Move-range-check-for-block-placing-up.patch b/patches/server/Move-range-check-for-block-placing-up.patch
similarity index 100%
rename from patches/unapplied/server/Move-range-check-for-block-placing-up.patch
rename to patches/server/Move-range-check-for-block-placing-up.patch
diff --git a/patches/unapplied/server/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/patches/server/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch
similarity index 100%
rename from patches/unapplied/server/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch
rename to patches/server/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch
diff --git a/patches/unapplied/server/Send-empty-commands-if-tab-completion-is-disabled.patch b/patches/server/Send-empty-commands-if-tab-completion-is-disabled.patch
similarity index 100%
rename from patches/unapplied/server/Send-empty-commands-if-tab-completion-is-disabled.patch
rename to patches/server/Send-empty-commands-if-tab-completion-is-disabled.patch
diff --git a/patches/unapplied/server/Set-area-affect-cloud-rotation.patch b/patches/server/Set-area-affect-cloud-rotation.patch
similarity index 91%
rename from patches/unapplied/server/Set-area-affect-cloud-rotation.patch
rename to patches/server/Set-area-affect-cloud-rotation.patch
index fad8ac9961..e48e5bd41d 100644
--- a/patches/unapplied/server/Set-area-affect-cloud-rotation.patch
+++ b/patches/server/Set-area-affect-cloud-rotation.patch
@@ -14,6 +14,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          ));
 -        register(new EntityTypeData<>(EntityType.AREA_EFFECT_CLOUD, AreaEffectCloud.class, CraftAreaEffectCloud::new, spawnData -> new net.minecraft.world.entity.AreaEffectCloud(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z())));
 +        register(new EntityTypeData<>(EntityType.AREA_EFFECT_CLOUD, AreaEffectCloud.class, CraftAreaEffectCloud::new, createAndMove(net.minecraft.world.entity.EntityType.AREA_EFFECT_CLOUD))); // Paper - set area effect cloud rotation
-         register(new EntityTypeData<>(EntityType.EGG, Egg.class, CraftEgg::new, spawnData -> new ThrownEgg(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z())));
+         register(new EntityTypeData<>(EntityType.EGG, Egg.class, CraftEgg::new, spawnData -> new ThrownEgg(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), new net.minecraft.world.item.ItemStack(Items.EGG))));
          register(new EntityTypeData<>(EntityType.LEASH_KNOT, LeashHitch.class, CraftLeash::new, spawnData -> new LeashFenceKnotEntity(spawnData.minecraftWorld(), BlockPos.containing(spawnData.x(), spawnData.y(), spawnData.z())))); // SPIGOT-5732: LeashHitch has no direction and is always centered at a block
-         register(new EntityTypeData<>(EntityType.SNOWBALL, Snowball.class, CraftSnowball::new, spawnData -> new net.minecraft.world.entity.projectile.Snowball(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z())));
+         register(new EntityTypeData<>(EntityType.SNOWBALL, Snowball.class, CraftSnowball::new, spawnData -> new net.minecraft.world.entity.projectile.Snowball(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), new net.minecraft.world.item.ItemStack(Items.SNOWBALL))));
diff --git a/patches/unapplied/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch b/patches/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch
similarity index 100%
rename from patches/unapplied/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch
rename to patches/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch
diff --git a/patches/unapplied/server/add-consumeFuel-to-FurnaceBurnEvent.patch b/patches/server/add-consumeFuel-to-FurnaceBurnEvent.patch
similarity index 100%
rename from patches/unapplied/server/add-consumeFuel-to-FurnaceBurnEvent.patch
rename to patches/server/add-consumeFuel-to-FurnaceBurnEvent.patch
diff --git a/patches/unapplied/server/add-get-set-drop-chance-to-EntityEquipment.patch b/patches/server/add-get-set-drop-chance-to-EntityEquipment.patch
similarity index 100%
rename from patches/unapplied/server/add-get-set-drop-chance-to-EntityEquipment.patch
rename to patches/server/add-get-set-drop-chance-to-EntityEquipment.patch
diff --git a/patches/unapplied/server/add-isDeeplySleeping-to-HumanEntity.patch b/patches/server/add-isDeeplySleeping-to-HumanEntity.patch
similarity index 100%
rename from patches/unapplied/server/add-isDeeplySleeping-to-HumanEntity.patch
rename to patches/server/add-isDeeplySleeping-to-HumanEntity.patch
diff --git a/patches/unapplied/server/add-per-world-spawn-limits.patch b/patches/server/add-per-world-spawn-limits.patch
similarity index 100%
rename from patches/unapplied/server/add-per-world-spawn-limits.patch
rename to patches/server/add-per-world-spawn-limits.patch
diff --git a/patches/unapplied/server/fix-PigZombieAngerEvent-cancellation.patch b/patches/server/fix-PigZombieAngerEvent-cancellation.patch
similarity index 100%
rename from patches/unapplied/server/fix-PigZombieAngerEvent-cancellation.patch
rename to patches/server/fix-PigZombieAngerEvent-cancellation.patch
diff --git a/patches/unapplied/server/fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/fix-PlayerItemHeldEvent-firing-twice.patch
similarity index 100%
rename from patches/unapplied/server/fix-PlayerItemHeldEvent-firing-twice.patch
rename to patches/server/fix-PlayerItemHeldEvent-firing-twice.patch