From c3fc3de622da430debe668faffb89aef4f4fc220 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 7 Jun 2022 21:39:43 -0700
Subject: [PATCH] even moar patches

---
 ...97-Broadcast-join-message-to-console.patch |  1 +
 ...-memory-footprint-of-NBTTagCompound.patch} |  0
 ...ent-opening-inventories-when-frozen.patch} |  6 +-
 ...91-Optimise-ArraySetSorted-removeIf.patch} |  0
 ...entity-collision-code-if-not-needed.patch} |  4 +-
 ...Implement-Player-Client-Options-API.patch} | 10 +--
 ...ayer-is-attempted-to-be-removed-fro.patch} |  0
 ...Chunk-Post-Processing-deadlock-risk.patch} | 10 +--
 ...-Broken-behavior-of-PlayerJoinEvent.patch} | 20 +++---
 ...oad-Chunks-for-Login-Asynchronously.patch} | 66 ++++++++-----------
 ...awn-point-if-spawn-in-unloaded-worl.patch} |  4 +-
 ...layerAttackEntityCooldownResetEvent.patch} |  4 +-
 ...-fire-BlockFade-on-worldgen-threads.patch} |  2 +-
 ...tom-creative-and-insomniac-controls.patch} |  2 +-
 ...-duplication-issues-and-teleport-is.patch} | 30 ++++-----
 .../0403-Villager-Restocks-API.patch}         |  0
 ...ickItem-Packet-and-kick-for-invalid.patch} |  4 +-
 17 files changed, 78 insertions(+), 85 deletions(-)
 rename patches/{unapplied/server => removed/1.19}/0397-Broadcast-join-message-to-console.patch (95%)
 rename patches/{unapplied/server/0391-Reduce-memory-footprint-of-NBTTagCompound.patch => server/0389-Reduce-memory-footprint-of-NBTTagCompound.patch} (100%)
 rename patches/{unapplied/server/0392-Prevent-opening-inventories-when-frozen.patch => server/0390-Prevent-opening-inventories-when-frozen.patch} (94%)
 rename patches/{unapplied/server/0393-Optimise-ArraySetSorted-removeIf.patch => server/0391-Optimise-ArraySetSorted-removeIf.patch} (100%)
 rename patches/{unapplied/server/0394-Don-t-run-entity-collision-code-if-not-needed.patch => server/0392-Don-t-run-entity-collision-code-if-not-needed.patch} (89%)
 rename patches/{unapplied/server/0395-Implement-Player-Client-Options-API.patch => server/0393-Implement-Player-Client-Options-API.patch} (92%)
 rename patches/{unapplied/server/0396-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch => server/0394-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch} (100%)
 rename patches/{unapplied/server/0398-Fix-Chunk-Post-Processing-deadlock-risk.patch => server/0395-Fix-Chunk-Post-Processing-deadlock-risk.patch} (89%)
 rename patches/{unapplied/server/0399-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch => server/0396-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch} (88%)
 rename patches/{unapplied/server/0400-Load-Chunks-for-Login-Asynchronously.patch => server/0397-Load-Chunks-for-Login-Asynchronously.patch} (83%)
 rename patches/{unapplied/server/0401-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch => server/0398-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch} (89%)
 rename patches/{unapplied/server/0402-Add-PlayerAttackEntityCooldownResetEvent.patch => server/0399-Add-PlayerAttackEntityCooldownResetEvent.patch} (92%)
 rename patches/{unapplied/server/0403-Don-t-fire-BlockFade-on-worldgen-threads.patch => server/0400-Don-t-fire-BlockFade-on-worldgen-threads.patch} (94%)
 rename patches/{unapplied/server/0404-Add-phantom-creative-and-insomniac-controls.patch => server/0401-Add-phantom-creative-and-insomniac-controls.patch} (97%)
 rename patches/{unapplied/server/0405-Fix-numerous-item-duplication-issues-and-teleport-is.patch => server/0402-Fix-numerous-item-duplication-issues-and-teleport-is.patch} (90%)
 rename patches/{unapplied/server/0406-Villager-Restocks-API.patch => server/0403-Villager-Restocks-API.patch} (100%)
 rename patches/{unapplied/server/0407-Validate-PickItem-Packet-and-kick-for-invalid.patch => server/0404-Validate-PickItem-Packet-and-kick-for-invalid.patch} (91%)

diff --git a/patches/unapplied/server/0397-Broadcast-join-message-to-console.patch b/patches/removed/1.19/0397-Broadcast-join-message-to-console.patch
similarity index 95%
rename from patches/unapplied/server/0397-Broadcast-join-message-to-console.patch
rename to patches/removed/1.19/0397-Broadcast-join-message-to-console.patch
index 5969707973..df82b82a26 100644
--- a/patches/unapplied/server/0397-Broadcast-join-message-to-console.patch
+++ b/patches/removed/1.19/0397-Broadcast-join-message-to-console.patch
@@ -3,6 +3,7 @@ From: AvrooVulcan <avrovulcan.programming@gmail.com>
 Date: Fri, 17 Apr 2020 00:15:23 +0100
 Subject: [PATCH] Broadcast join message to console
 
+1.19: I think the existing method does this already - MM
 
 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
 index 936742383a6834bfd687ec48db308475f598d216..923d86766ee31f590909e398dc86b69529c29f42 100644
diff --git a/patches/unapplied/server/0391-Reduce-memory-footprint-of-NBTTagCompound.patch b/patches/server/0389-Reduce-memory-footprint-of-NBTTagCompound.patch
similarity index 100%
rename from patches/unapplied/server/0391-Reduce-memory-footprint-of-NBTTagCompound.patch
rename to patches/server/0389-Reduce-memory-footprint-of-NBTTagCompound.patch
diff --git a/patches/unapplied/server/0392-Prevent-opening-inventories-when-frozen.patch b/patches/server/0390-Prevent-opening-inventories-when-frozen.patch
similarity index 94%
rename from patches/unapplied/server/0392-Prevent-opening-inventories-when-frozen.patch
rename to patches/server/0390-Prevent-opening-inventories-when-frozen.patch
index 8cc2ba41b0..605c010fe7 100644
--- a/patches/unapplied/server/0392-Prevent-opening-inventories-when-frozen.patch
+++ b/patches/server/0390-Prevent-opening-inventories-when-frozen.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Prevent opening inventories when frozen
 
 
 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index 888e127e7e59a7ceb63f12ec69046916a0e29fc9..45cf2059ea31d3c5c14b9c931a3a65dd3d76c627 100644
+index 3603e169f9195b86553867ddabca2e3ad90a494f..b4d5817998d8aa0c6e6eb3c01af0bc1d804e794b 100644
 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
 +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-@@ -612,7 +612,7 @@ public class ServerPlayer extends Player {
+@@ -619,7 +619,7 @@ public class ServerPlayer extends Player {
              containerUpdateDelay = level.paperConfig.containerUpdateTickRate;
          }
          // Paper end
@@ -17,7 +17,7 @@ index 888e127e7e59a7ceb63f12ec69046916a0e29fc9..45cf2059ea31d3c5c14b9c931a3a65dd
              this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper
              this.containerMenu = this.inventoryMenu;
          }
-@@ -1483,7 +1483,7 @@ public class ServerPlayer extends Player {
+@@ -1492,7 +1492,7 @@ public class ServerPlayer extends Player {
              } else {
                  // CraftBukkit start
                  this.containerMenu = container;
diff --git a/patches/unapplied/server/0393-Optimise-ArraySetSorted-removeIf.patch b/patches/server/0391-Optimise-ArraySetSorted-removeIf.patch
similarity index 100%
rename from patches/unapplied/server/0393-Optimise-ArraySetSorted-removeIf.patch
rename to patches/server/0391-Optimise-ArraySetSorted-removeIf.patch
diff --git a/patches/unapplied/server/0394-Don-t-run-entity-collision-code-if-not-needed.patch b/patches/server/0392-Don-t-run-entity-collision-code-if-not-needed.patch
similarity index 89%
rename from patches/unapplied/server/0394-Don-t-run-entity-collision-code-if-not-needed.patch
rename to patches/server/0392-Don-t-run-entity-collision-code-if-not-needed.patch
index 082bd4030b..e807aebe4f 100644
--- a/patches/unapplied/server/0394-Don-t-run-entity-collision-code-if-not-needed.patch
+++ b/patches/server/0392-Don-t-run-entity-collision-code-if-not-needed.patch
@@ -7,10 +7,10 @@ Will not run if max entity craming is disabled and
 the max collisions per entity is less than or equal to 0
 
 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
-index b28689f2621ee7d5129ab6d1853d9ee8823bf1d0..e9efb18ac776cdf92b967aa400d5d112d0481dfc 100644
+index 70670065642766501918dfca21fdb3ea78a90a31..44b753d0ea66b9099c575e479ade4080efa3b287 100644
 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
 +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
-@@ -3280,10 +3280,16 @@ public abstract class LivingEntity extends Entity {
+@@ -3312,10 +3312,16 @@ public abstract class LivingEntity extends Entity {
      protected void serverAiStep() {}
  
      protected void pushEntities() {
diff --git a/patches/unapplied/server/0395-Implement-Player-Client-Options-API.patch b/patches/server/0393-Implement-Player-Client-Options-API.patch
similarity index 92%
rename from patches/unapplied/server/0395-Implement-Player-Client-Options-API.patch
rename to patches/server/0393-Implement-Player-Client-Options-API.patch
index c6e0a2a198..97e765d622 100644
--- a/patches/unapplied/server/0395-Implement-Player-Client-Options-API.patch
+++ b/patches/server/0393-Implement-Player-Client-Options-API.patch
@@ -85,10 +85,10 @@ index 0000000000000000000000000000000000000000..b6f4400df3d8ec7e06a996de54f8cabb
 +    }
 +}
 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index 45cf2059ea31d3c5c14b9c931a3a65dd3d76c627..bb5b947c92c91768c59bc1ca7c61560a923a1329 100644
+index b4d5817998d8aa0c6e6eb3c01af0bc1d804e794b..108561244fa1062cd98be76fdff471fd8fa170cd 100644
 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
 +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-@@ -1834,6 +1834,7 @@ public class ServerPlayer extends Player {
+@@ -1856,6 +1856,7 @@ public class ServerPlayer extends Player {
      public String locale = null; // CraftBukkit - add, lowercase // Paper - default to null
      public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
      public void updateOptions(ServerboundClientInformationPacket packet) {
@@ -97,12 +97,12 @@ index 45cf2059ea31d3c5c14b9c931a3a65dd3d76c627..bb5b947c92c91768c59bc1ca7c61560a
          if (getMainArm() != packet.mainHand()) {
              PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-index c539620e56e05398d0fd0c6f3d721609398f3834..83a4457d6be91efda74d05268dac83c8194cea78 100644
+index 52b00369facc700079dbddc35291072977c2b8ce..4c3321a0645cfdbb651a87078d577776c62729a3 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
-@@ -577,6 +577,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
+@@ -575,6 +575,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
      public void setSendViewDistance(int viewDistance) {
-         throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
+         throw new UnsupportedOperationException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO
      }
 +
 +    @Override
diff --git a/patches/unapplied/server/0396-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch b/patches/server/0394-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch
similarity index 100%
rename from patches/unapplied/server/0396-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch
rename to patches/server/0394-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch
diff --git a/patches/unapplied/server/0398-Fix-Chunk-Post-Processing-deadlock-risk.patch b/patches/server/0395-Fix-Chunk-Post-Processing-deadlock-risk.patch
similarity index 89%
rename from patches/unapplied/server/0398-Fix-Chunk-Post-Processing-deadlock-risk.patch
rename to patches/server/0395-Fix-Chunk-Post-Processing-deadlock-risk.patch
index 240ccc2344..988c4897ca 100644
--- a/patches/unapplied/server/0398-Fix-Chunk-Post-Processing-deadlock-risk.patch
+++ b/patches/server/0395-Fix-Chunk-Post-Processing-deadlock-risk.patch
@@ -25,10 +25,10 @@ This successfully fixed a reoccurring and highly reproducible crash
 for heightmaps.
 
 diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
-index 7776c22744cdd31459e9634d1d549bdf2876e04f..43e5e148f1289ff5e42311981c597c66d98447aa 100644
+index eb0fbf2126e7c9978f46c92b6999f00c5aea9a58..bfd0398e4bca5458d2913715b742b3c5a0b076f8 100644
 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
 +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
-@@ -178,6 +178,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
+@@ -182,6 +182,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
      };
      // CraftBukkit end
  
@@ -36,7 +36,7 @@ index 7776c22744cdd31459e9634d1d549bdf2876e04f..43e5e148f1289ff5e42311981c597c66
      // Paper start - distance maps
      private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
  
-@@ -995,16 +996,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
+@@ -1021,16 +1022,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
          });
          CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> completablefuture1 = completablefuture.thenApplyAsync((either) -> {
              return either.mapLeft((list) -> {
@@ -60,10 +60,10 @@ index 7776c22744cdd31459e9634d1d549bdf2876e04f..43e5e148f1289ff5e42311981c597c66
          completablefuture1.thenAcceptAsync((either) -> {
              either.ifLeft((chunk) -> {
 diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
-index 8f1609bbb5670d3b4acccb2cb4b9238ce13290bb..cf5a5d98420c3849621bfdfae7bda7d5cb4b2dc9 100644
+index 4581a95a792e8eb157c8577547cb6f76a8e8f883..55b8f9dc3ad2b282e83c912ad8bf46b31cbd3765 100644
 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
 +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
-@@ -1133,6 +1133,7 @@ public class ServerChunkCache extends ChunkSource {
+@@ -1138,6 +1138,7 @@ public class ServerChunkCache extends ChunkSource {
                  return super.pollTask() || execChunkTask; // Paper
              }
          } finally {
diff --git a/patches/unapplied/server/0399-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/patches/server/0396-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch
similarity index 88%
rename from patches/unapplied/server/0399-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch
rename to patches/server/0396-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch
index 7b70d59367..bfc17bbab6 100644
--- a/patches/unapplied/server/0399-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch
+++ b/patches/server/0396-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch
@@ -28,10 +28,10 @@ receives a deterministic result, and should no longer require 1 tick
 delays anymore.
 
 diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
-index 43e5e148f1289ff5e42311981c597c66d98447aa..f4b14d77d5c256852677bd9bc6dbda2bbe5367e3 100644
+index bfd0398e4bca5458d2913715b742b3c5a0b076f8..16cce0feeca7d6f9f67100a07b824930adabcc72 100644
 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
 +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
-@@ -1608,6 +1608,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
+@@ -1651,6 +1651,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
                  .printStackTrace();
              return;
          }
@@ -40,10 +40,10 @@ index 43e5e148f1289ff5e42311981c597c66d98447aa..f4b14d77d5c256852677bd9bc6dbda2b
          if (!(entity instanceof EnderDragonPart)) {
              EntityType<?> entitytypes = entity.getType();
 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index bb5b947c92c91768c59bc1ca7c61560a923a1329..318bf4e1aa11798a80ae1779d744545aaa8aa6ee 100644
+index 108561244fa1062cd98be76fdff471fd8fa170cd..8aed9224deff11aa2717b929f40b2da1dc1de521 100644
 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
 +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-@@ -245,6 +245,7 @@ public class ServerPlayer extends Player {
+@@ -252,6 +252,7 @@ public class ServerPlayer extends Player {
      public double maxHealthCache;
      public boolean joining = true;
      public boolean sentListPacket = false;
@@ -52,10 +52,10 @@ index bb5b947c92c91768c59bc1ca7c61560a923a1329..318bf4e1aa11798a80ae1779d744545a
      public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
      // CraftBukkit end
 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
-index 923d86766ee31f590909e398dc86b69529c29f42..c8f0bed184a0524b18385c6ef44839b90b3549dc 100644
+index 8fa76c3184d7e25339c2de27332ff4d523a4b85e..730a3d84219f374d0a5f978e152b87e30474dec9 100644
 --- a/src/main/java/net/minecraft/server/players/PlayerList.java
 +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
-@@ -276,6 +276,12 @@ public abstract class PlayerList {
+@@ -280,6 +280,12 @@ public abstract class PlayerList {
          this.playersByUUID.put(player.getUUID(), player);
          // this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below
  
@@ -68,7 +68,7 @@ index 923d86766ee31f590909e398dc86b69529c29f42..c8f0bed184a0524b18385c6ef44839b9
          // CraftBukkit start
          CraftPlayer bukkitPlayer = player.getBukkitEntity();
  
-@@ -316,6 +322,8 @@ public abstract class PlayerList {
+@@ -318,6 +324,8 @@ public abstract class PlayerList {
              player.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, new ServerPlayer[]{entityplayer1}));
          }
          player.sentListPacket = true;
@@ -77,7 +77,7 @@ index 923d86766ee31f590909e398dc86b69529c29f42..c8f0bed184a0524b18385c6ef44839b9
          // CraftBukkit end
  
          player.connection.send(new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
-@@ -341,6 +349,11 @@ public abstract class PlayerList {
+@@ -343,6 +351,11 @@ public abstract class PlayerList {
              playerconnection.send(new ClientboundUpdateMobEffectPacket(player.getId(), mobeffect));
          }
  
@@ -89,7 +89,7 @@ index 923d86766ee31f590909e398dc86b69529c29f42..c8f0bed184a0524b18385c6ef44839b9
          if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) {
              CompoundTag nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
              // CraftBukkit start
-@@ -389,6 +402,10 @@ public abstract class PlayerList {
+@@ -391,6 +404,10 @@ public abstract class PlayerList {
              }
          }
  
@@ -100,7 +100,7 @@ index 923d86766ee31f590909e398dc86b69529c29f42..c8f0bed184a0524b18385c6ef44839b9
          player.initInventoryMenu();
          // CraftBukkit - Moved from above, added world
          // Paper start - Add to collideRule team if needed
-@@ -398,6 +415,7 @@ public abstract class PlayerList {
+@@ -400,6 +417,7 @@ public abstract class PlayerList {
              scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
          }
          // Paper end
diff --git a/patches/unapplied/server/0400-Load-Chunks-for-Login-Asynchronously.patch b/patches/server/0397-Load-Chunks-for-Login-Asynchronously.patch
similarity index 83%
rename from patches/unapplied/server/0400-Load-Chunks-for-Login-Asynchronously.patch
rename to patches/server/0397-Load-Chunks-for-Login-Asynchronously.patch
index c143a66dcf..dfb59b494f 100644
--- a/patches/unapplied/server/0400-Load-Chunks-for-Login-Asynchronously.patch
+++ b/patches/server/0397-Load-Chunks-for-Login-Asynchronously.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Load Chunks for Login Asynchronously
 
 
 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-index 318bf4e1aa11798a80ae1779d744545aaa8aa6ee..f8913f10e3e24c4da7c251bc4bc0ab0820807f57 100644
+index 8aed9224deff11aa2717b929f40b2da1dc1de521..1e32ac21998cf7b7987815850fd022a5f282c5e0 100644
 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
 +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-@@ -173,6 +173,7 @@ public class ServerPlayer extends Player {
+@@ -180,6 +180,7 @@ public class ServerPlayer extends Player {
      private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32;
      private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
      public ServerGamePacketListenerImpl connection;
@@ -16,7 +16,7 @@ index 318bf4e1aa11798a80ae1779d744545aaa8aa6ee..f8913f10e3e24c4da7c251bc4bc0ab08
      public final MinecraftServer server;
      public final ServerPlayerGameMode gameMode;
      private final PlayerAdvancements advancements;
-@@ -246,6 +247,7 @@ public class ServerPlayer extends Player {
+@@ -253,6 +254,7 @@ public class ServerPlayer extends Player {
      public boolean joining = true;
      public boolean sentListPacket = false;
      public boolean supressTrackerForLogin = false; // Paper
@@ -37,18 +37,18 @@ index be677d437d17b74c6188ce1bd5fc6fdc228fd92f..78fbb4c3e52e900956ae0811aaf934c8
      public static final TicketType<ChunkPos> UNKNOWN = TicketType.create("unknown", Comparator.comparingLong(ChunkPos::toLong), 1);
      public static final TicketType<Unit> PLUGIN = TicketType.create("plugin", (a, b) -> 0); // CraftBukkit
 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index d5ee915958710a65ecaf8f17d3d07e47060b3eae..31341e74ab18a8ea5110adff1e9d42b7473ca89f 100644
+index 1f90edd5eba696303962523439133d19514ebc32..fbcb22036600c7440e66f30afbdf15ee8683ff6d 100644
 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
 +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -220,6 +220,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
-     private static final int LATENCY_CHECK_INTERVAL = 15000;
+@@ -237,6 +237,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
+     private static final int NO_BLOCK_UPDATES_TO_ACK = -1;
      public final Connection connection;
      private final MinecraftServer server;
 +    public Runnable playerJoinReady; // Paper
      public ServerPlayer player;
      private int tickCount;
-     private long keepAliveTime = Util.getMillis();
-@@ -293,6 +294,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
+     private int ackBlockChangesUpTo = -1;
+@@ -314,6 +315,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
      // CraftBukkit end
  
      public void tick() {
@@ -61,10 +61,10 @@ index d5ee915958710a65ecaf8f17d3d07e47060b3eae..31341e74ab18a8ea5110adff1e9d42b7
 +        // Don't tick if not valid (dead), otherwise we load chunks below
 +        if (this.player.valid) {
 +        // Paper end
-         this.resetPosition();
-         this.player.xo = this.player.getX();
-         this.player.yo = this.player.getY();
-@@ -334,7 +344,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
+         if (this.ackBlockChangesUpTo > -1) {
+             this.send(new ClientboundBlockChangedAckPacket(this.ackBlockChangesUpTo));
+             this.ackBlockChangesUpTo = -1;
+@@ -360,7 +370,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
              this.lastVehicle = null;
              this.clientVehicleIsFloating = false;
              this.aboveGroundVehicleTickCount = 0;
@@ -74,10 +74,10 @@ index d5ee915958710a65ecaf8f17d3d07e47060b3eae..31341e74ab18a8ea5110adff1e9d42b7
          this.server.getProfiler().push("keepAlive");
          // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
 diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
-index 4c06e62e967f28eb844d74237948834e61daeab0..0af65f1698e4ee9d94724f19b0abd61c437f18f2 100644
+index cbb0865b08185d1c9dc95f6dc5507cc39f92f15e..35197aebcc7f00577dc506d022026f1d41168b73 100644
 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
 +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
-@@ -84,7 +84,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
+@@ -94,7 +94,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
              }
              // Paper end
          } else if (this.state == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) {
@@ -86,7 +86,7 @@ index 4c06e62e967f28eb844d74237948834e61daeab0..0af65f1698e4ee9d94724f19b0abd61c
  
              if (entityplayer == null) {
                  this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT;
-@@ -190,7 +190,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
+@@ -193,7 +193,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
              }
  
              this.connection.send(new ClientboundGameProfilePacket(this.gameProfile));
@@ -96,18 +96,10 @@ index 4c06e62e967f28eb844d74237948834e61daeab0..0af65f1698e4ee9d94724f19b0abd61c
              try {
                  ServerPlayer entityplayer1 = this.server.getPlayerList().getPlayerForLogin(this.gameProfile, s); // CraftBukkit - add player reference
 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
-index c8f0bed184a0524b18385c6ef44839b90b3549dc..4ccb008508a008d782f0c639663b423f1a6dfdef 100644
+index 730a3d84219f374d0a5f978e152b87e30474dec9..1b955c9a6f5532d30d58b8a852d7583d3effd53a 100644
 --- a/src/main/java/net/minecraft/server/players/PlayerList.java
 +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
-@@ -40,6 +40,7 @@ import net.minecraft.network.protocol.Packet;
- import net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket;
- import net.minecraft.network.protocol.game.ClientboundChatPacket;
- import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
-+import net.minecraft.network.protocol.game.ClientboundDisconnectPacket;
- import net.minecraft.network.protocol.game.ClientboundEntityEventPacket;
- import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
- import net.minecraft.network.protocol.game.ClientboundInitializeBorderPacket;
-@@ -134,6 +135,7 @@ public abstract class PlayerList {
+@@ -138,6 +138,7 @@ public abstract class PlayerList {
      private final IpBanList ipBans;
      private final ServerOpList ops;
      private final UserWhiteList whitelist;
@@ -115,7 +107,7 @@ index c8f0bed184a0524b18385c6ef44839b90b3549dc..4ccb008508a008d782f0c639663b423f
      // CraftBukkit start
      // private final Map<UUID, ServerStatisticManager> stats;
      // private final Map<UUID, AdvancementDataPlayer> advancements;
-@@ -173,6 +175,11 @@ public abstract class PlayerList {
+@@ -177,6 +178,11 @@ public abstract class PlayerList {
      }
  
      public void placeNewPlayer(Connection connection, ServerPlayer player) {
@@ -127,7 +119,7 @@ index c8f0bed184a0524b18385c6ef44839b90b3549dc..4ccb008508a008d782f0c639663b423f
          player.loginTime = System.currentTimeMillis(); // Paper
          GameProfile gameprofile = player.getGameProfile();
          GameProfileCache usercache = this.server.getProfileCache();
-@@ -186,7 +193,7 @@ public abstract class PlayerList {
+@@ -190,7 +196,7 @@ public abstract class PlayerList {
          if (nbttagcompound != null && nbttagcompound.contains("bukkit")) {
              CompoundTag bukkit = nbttagcompound.getCompound("bukkit");
              s = bukkit.contains("lastKnownName", 8) ? bukkit.getString("lastKnownName") : s;
@@ -136,7 +128,7 @@ index c8f0bed184a0524b18385c6ef44839b90b3549dc..4ccb008508a008d782f0c639663b423f
          // CraftBukkit end
  
          if (nbttagcompound != null) {
-@@ -213,11 +220,15 @@ public abstract class PlayerList {
+@@ -217,11 +223,15 @@ public abstract class PlayerList {
          if (nbttagcompound == null) player.fudgeSpawnLocation(worldserver1); // Paper - only move to spawn on first login, otherwise, stay where you are....
  
          player.setLevel(worldserver1);
@@ -153,7 +145,7 @@ index c8f0bed184a0524b18385c6ef44839b90b3549dc..4ccb008508a008d782f0c639663b423f
  
          // Spigot start - spawn location event
          Player spawnPlayer = player.getBukkitEntity();
-@@ -259,6 +270,52 @@ public abstract class PlayerList {
+@@ -263,6 +273,52 @@ public abstract class PlayerList {
          player.getRecipeBook().sendInitialRecipeBook(player);
          this.updateEntireScoreboard(worldserver1.getScoreboard(), player);
          this.server.invalidateStatus();
@@ -189,8 +181,8 @@ index c8f0bed184a0524b18385c6ef44839b90b3549dc..4ccb008508a008d782f0c639663b423f
 +    }
 +
 +    void disconnectPendingPlayer(ServerPlayer entityplayer) {
-+        TranslatableComponent msg = new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]);
-+        entityplayer.networkManager.send(new ClientboundDisconnectPacket(msg), (future) -> {
++        Component msg = Component.translatable("multiplayer.disconnect.duplicate_login");
++        entityplayer.networkManager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(msg), (future) -> {
 +            entityplayer.networkManager.disconnect(msg);
 +            entityplayer.networkManager = null;
 +        });
@@ -203,10 +195,10 @@ index c8f0bed184a0524b18385c6ef44839b90b3549dc..4ccb008508a008d782f0c639663b423f
 +        }
 +        player.didPlayerJoinEvent = true;
 +        // Paper end
-         TranslatableComponent chatmessage;
+         MutableComponent ichatmutablecomponent;
  
          if (player.getGameProfile().getName().equalsIgnoreCase(s)) {
-@@ -502,6 +559,7 @@ public abstract class PlayerList {
+@@ -504,6 +560,7 @@ public abstract class PlayerList {
  
      protected void save(ServerPlayer player) {
          if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
@@ -214,7 +206,7 @@ index c8f0bed184a0524b18385c6ef44839b90b3549dc..4ccb008508a008d782f0c639663b423f
          this.playerIo.save(player);
          ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit
  
-@@ -529,7 +587,7 @@ public abstract class PlayerList {
+@@ -531,7 +588,7 @@ public abstract class PlayerList {
          }
  
          PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())));
@@ -223,7 +215,7 @@ index c8f0bed184a0524b18385c6ef44839b90b3549dc..4ccb008508a008d782f0c639663b423f
          entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
  
          if (server.isSameThread()) entityplayer.doTick(); // SPIGOT-924 // Paper - don't tick during emergency shutdowns (Watchdog)
-@@ -574,6 +632,13 @@ public abstract class PlayerList {
+@@ -576,6 +633,13 @@ public abstract class PlayerList {
              // this.advancements.remove(uuid);
              // CraftBukkit end
          }
@@ -237,7 +229,7 @@ index c8f0bed184a0524b18385c6ef44839b90b3549dc..4ccb008508a008d782f0c639663b423f
  
          // CraftBukkit start
          // this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer}));
-@@ -591,7 +656,7 @@ public abstract class PlayerList {
+@@ -593,7 +657,7 @@ public abstract class PlayerList {
          this.cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity());
          // CraftBukkit end
  
@@ -246,7 +238,7 @@ index c8f0bed184a0524b18385c6ef44839b90b3549dc..4ccb008508a008d782f0c639663b423f
      }
  
      // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer
-@@ -610,6 +675,13 @@ public abstract class PlayerList {
+@@ -612,6 +676,13 @@ public abstract class PlayerList {
                  list.add(entityplayer);
              }
          }
diff --git a/patches/unapplied/server/0401-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0398-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch
similarity index 89%
rename from patches/unapplied/server/0401-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch
rename to patches/server/0398-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch
index e2b30f446b..835fa68fa4 100644
--- a/patches/unapplied/server/0401-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch
+++ b/patches/server/0398-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch
@@ -7,10 +7,10 @@ The code following this has better support for null worlds to move
 them back to the world spawn.
 
 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
-index 384f4eabb2ebacd459e0f21e268e3dd0cd4b4d20..d387e8cc95f9f54dfbf018d4e52cde5087bfc209 100644
+index 0e36422d3bf2261ee792774b17cfbeadd05f2b1d..60ef82b7811fbb3e579b2f1321ed065404dafeda 100644
 --- a/src/main/java/net/minecraft/world/entity/Entity.java
 +++ b/src/main/java/net/minecraft/world/entity/Entity.java
-@@ -2011,9 +2011,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -2059,9 +2059,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
                      bworld = server.getWorld(worldName);
                  }
  
diff --git a/patches/unapplied/server/0402-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/server/0399-Add-PlayerAttackEntityCooldownResetEvent.patch
similarity index 92%
rename from patches/unapplied/server/0402-Add-PlayerAttackEntityCooldownResetEvent.patch
rename to patches/server/0399-Add-PlayerAttackEntityCooldownResetEvent.patch
index ea4d9caada..80ed154de2 100644
--- a/patches/unapplied/server/0402-Add-PlayerAttackEntityCooldownResetEvent.patch
+++ b/patches/server/0399-Add-PlayerAttackEntityCooldownResetEvent.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
 
 
 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
-index e9efb18ac776cdf92b967aa400d5d112d0481dfc..960f56019313977b336cf0de9495aae8e1dc976a 100644
+index 44b753d0ea66b9099c575e479ade4080efa3b287..efb5cc1705bd0ff50360203d68a564875662299c 100644
 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
 +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
-@@ -2058,7 +2058,16 @@ public abstract class LivingEntity extends Entity {
+@@ -2090,7 +2090,16 @@ public abstract class LivingEntity extends Entity {
  
              EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
              if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) {
diff --git a/patches/unapplied/server/0403-Don-t-fire-BlockFade-on-worldgen-threads.patch b/patches/server/0400-Don-t-fire-BlockFade-on-worldgen-threads.patch
similarity index 94%
rename from patches/unapplied/server/0403-Don-t-fire-BlockFade-on-worldgen-threads.patch
rename to patches/server/0400-Don-t-fire-BlockFade-on-worldgen-threads.patch
index 8a5268c81a..b9aecc5313 100644
--- a/patches/unapplied/server/0403-Don-t-fire-BlockFade-on-worldgen-threads.patch
+++ b/patches/server/0400-Don-t-fire-BlockFade-on-worldgen-threads.patch
@@ -6,7 +6,7 @@ Subject: [PATCH] Don't fire BlockFade on worldgen threads
 Caused a deadlock
 
 diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
-index 33752432af861a708e0dbb1afafcd5968d795931..08bc35b40720ca001d3f6c1185bdd11c61ec9ee1 100644
+index 2188cfc34ab4bd67fac9aedd861a597c137a5c40..5ce5902b13ebb9438433d189f2c03677e4cb54b3 100644
 --- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
 +++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
 @@ -100,6 +100,7 @@ public class FireBlock extends BaseFireBlock {
diff --git a/patches/unapplied/server/0404-Add-phantom-creative-and-insomniac-controls.patch b/patches/server/0401-Add-phantom-creative-and-insomniac-controls.patch
similarity index 97%
rename from patches/unapplied/server/0404-Add-phantom-creative-and-insomniac-controls.patch
rename to patches/server/0401-Add-phantom-creative-and-insomniac-controls.patch
index 98e64e3ede..3923ab7187 100644
--- a/patches/unapplied/server/0404-Add-phantom-creative-and-insomniac-controls.patch
+++ b/patches/server/0401-Add-phantom-creative-and-insomniac-controls.patch
@@ -45,7 +45,7 @@ index 84400bb44d5deb7c79295a83c4c3c6aac88f3175..ca9324381a60fc3072719c39918a1c16
                              return true;
                          }
 diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
-index 891c12b8cfcdc7a2915955bdd08e50b5b9465e02..1e21d6cf2f03219fb2b7217c9a72bdd83c2146f7 100644
+index e9d25aef08103ccdbc6a35c3ab67c1d921e9f45d..9d96235c4697d9a0f045c692a742cdabbd6f8b8a 100644
 --- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
 +++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
 @@ -51,7 +51,7 @@ public class PhantomSpawner implements CustomSpawner {
diff --git a/patches/unapplied/server/0405-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/patches/server/0402-Fix-numerous-item-duplication-issues-and-teleport-is.patch
similarity index 90%
rename from patches/unapplied/server/0405-Fix-numerous-item-duplication-issues-and-teleport-is.patch
rename to patches/server/0402-Fix-numerous-item-duplication-issues-and-teleport-is.patch
index 71e6d1849e..9fb77a6121 100644
--- a/patches/unapplied/server/0405-Fix-numerous-item-duplication-issues-and-teleport-is.patch
+++ b/patches/server/0402-Fix-numerous-item-duplication-issues-and-teleport-is.patch
@@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the
 same item twice because the source was destroyed.
 
 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
-index d387e8cc95f9f54dfbf018d4e52cde5087bfc209..f69bc9d81750feb108119347f984de6bca24ae44 100644
+index 60ef82b7811fbb3e579b2f1321ed065404dafeda..1413acf7029fd690fbdb50c80037d040ef24e24f 100644
 --- a/src/main/java/net/minecraft/world/entity/Entity.java
 +++ b/src/main/java/net/minecraft/world/entity/Entity.java
-@@ -2141,11 +2141,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -2189,11 +2189,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
          } else {
              // CraftBukkit start - Capture drops for death event
              if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
@@ -34,7 +34,7 @@ index d387e8cc95f9f54dfbf018d4e52cde5087bfc209..f69bc9d81750feb108119347f984de6b
  
              entityitem.setDefaultPickUpDelay();
              // CraftBukkit start
-@@ -2910,6 +2911,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -2957,6 +2958,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
      @Nullable
      public Entity teleportTo(ServerLevel worldserver, BlockPos location) {
          // CraftBukkit end
@@ -47,7 +47,7 @@ index d387e8cc95f9f54dfbf018d4e52cde5087bfc209..f69bc9d81750feb108119347f984de6b
          if (this.level instanceof ServerLevel && !this.isRemoved()) {
              this.level.getProfiler().push("changeDimension");
              // CraftBukkit start
-@@ -2936,6 +2943,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -2983,6 +2990,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
                  // CraftBukkit end
  
                  this.level.getProfiler().popPush("reloading");
@@ -59,7 +59,7 @@ index d387e8cc95f9f54dfbf018d4e52cde5087bfc209..f69bc9d81750feb108119347f984de6b
                  Entity entity = this.getType().create(worldserver);
  
                  if (entity != null) {
-@@ -2949,10 +2961,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -2996,10 +3008,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
                      // CraftBukkit start - Forward the CraftEntity to the new entity
                      this.getBukkitEntity().setHandle(entity);
                      entity.bukkitEntity = this.getBukkitEntity();
@@ -70,7 +70,7 @@ index d387e8cc95f9f54dfbf018d4e52cde5087bfc209..f69bc9d81750feb108119347f984de6b
                      // CraftBukkit end
                  }
  
-@@ -3074,7 +3082,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+@@ -3121,7 +3129,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
      }
  
      public boolean canChangeDimensions() {
@@ -80,23 +80,23 @@ index d387e8cc95f9f54dfbf018d4e52cde5087bfc209..f69bc9d81750feb108119347f984de6b
  
      public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
-index 960f56019313977b336cf0de9495aae8e1dc976a..2b63a1cac397d80103b172477a0f3933e030e9a3 100644
+index efb5cc1705bd0ff50360203d68a564875662299c..4cfb5c89538c8d0ce20883bc6d2a5f7dc4967acd 100644
 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
 +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
-@@ -1622,9 +1622,9 @@ public abstract class LivingEntity extends Entity {
+@@ -1643,9 +1643,9 @@ public abstract class LivingEntity extends Entity {
                  // Paper start
-                 org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(source);
+                 org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(damageSource);
                  if (deathEvent == null || !deathEvent.isCancelled()) {
 -                    if (this.deathScore >= 0 && entityliving != null) {
--                        entityliving.awardKillScore(this, this.deathScore, source);
+-                        entityliving.awardKillScore(this, this.deathScore, damageSource);
 -                    }
 +                    // if (this.deathScore >= 0 && entityliving != null) { // Paper moved to be run earlier in #dropAllDeathLoot before destroying the drop items in CraftEventFactory#callEntityDeathEvent
-+                    //     entityliving.awardKillScore(this, this.deathScore, source);
++                    //     entityliving.awardKillScore(this, this.deathScore, damageSource);
 +                    // }
                      // Paper start - clear equipment if event is not cancelled
                      if (this instanceof Mob) {
                          for (EquipmentSlot slot : this.clearedEquipmentSlots) {
-@@ -1721,8 +1721,13 @@ public abstract class LivingEntity extends Entity {
+@@ -1743,8 +1743,13 @@ public abstract class LivingEntity extends Entity {
              this.dropCustomDeathLoot(source, i, flag);
              this.clearEquipmentSlots = prev; // Paper
          }
@@ -113,10 +113,10 @@ index 960f56019313977b336cf0de9495aae8e1dc976a..2b63a1cac397d80103b172477a0f3933
          this.drops = new ArrayList<>();
          // CraftBukkit end
 diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
-index a3a900d10440ed5ebe24370a77ccb6cad911cfc9..0d468631b9c260091e732925da43c177ebda892f 100644
+index a885e4a63f9ffb70b305b6d8c0f0dedf5b3cbeef..b8c0a1b5703460d4c4d8923e18b56ab937b8226c 100644
 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
 +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
-@@ -610,7 +610,7 @@ public class ArmorStand extends LivingEntity {
+@@ -608,7 +608,7 @@ public class ArmorStand extends LivingEntity {
          for (i = 0; i < this.handItems.size(); ++i) {
              itemstack = (ItemStack) this.handItems.get(i);
              if (!itemstack.isEmpty()) {
@@ -125,7 +125,7 @@ index a3a900d10440ed5ebe24370a77ccb6cad911cfc9..0d468631b9c260091e732925da43c177
                  this.handItems.set(i, ItemStack.EMPTY);
              }
          }
-@@ -618,7 +618,7 @@ public class ArmorStand extends LivingEntity {
+@@ -616,7 +616,7 @@ public class ArmorStand extends LivingEntity {
          for (i = 0; i < this.armorItems.size(); ++i) {
              itemstack = (ItemStack) this.armorItems.get(i);
              if (!itemstack.isEmpty()) {
diff --git a/patches/unapplied/server/0406-Villager-Restocks-API.patch b/patches/server/0403-Villager-Restocks-API.patch
similarity index 100%
rename from patches/unapplied/server/0406-Villager-Restocks-API.patch
rename to patches/server/0403-Villager-Restocks-API.patch
diff --git a/patches/unapplied/server/0407-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0404-Validate-PickItem-Packet-and-kick-for-invalid.patch
similarity index 91%
rename from patches/unapplied/server/0407-Validate-PickItem-Packet-and-kick-for-invalid.patch
rename to patches/server/0404-Validate-PickItem-Packet-and-kick-for-invalid.patch
index e232fbefb8..667ffaf373 100644
--- a/patches/unapplied/server/0407-Validate-PickItem-Packet-and-kick-for-invalid.patch
+++ b/patches/server/0404-Validate-PickItem-Packet-and-kick-for-invalid.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid
 
 
 diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 31341e74ab18a8ea5110adff1e9d42b7473ca89f..47e841add3437c9ab271569e00b4b385ce2ced66 100644
+index fbcb22036600c7440e66f30afbdf15ee8683ff6d..59d80414bf8fbf490d9e174a33860f035df3a8ac 100644
 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
 +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -885,7 +885,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
+@@ -917,7 +917,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
      @Override
      public void handlePickItem(ServerboundPickItemPacket packet) {
          PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());