From 6adb418b324b77034703932af2af70b5d5765e68 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 12 Jun 2021 12:30:37 -0700
Subject: [PATCH] more patches (#5808)

---
 .../Add-Ban-Methods-to-Player-Objects.patch   |  0
 .../Add-EntityKnockbackByEntityEvent.patch    |  0
 .../Add-EntityTeleportEndGatewayEvent.patch   |  0
 .../Add-World.getEntity-UUID-API.patch        |  0
 ...Add-getNearbyXXX-methods-to-Location.patch |  0
 ...-support-to-PaperServerListPingEvent.patch |  0
 ...d-method-to-open-already-placed-sign.patch |  0
 ...tional-world.getNearbyEntities-API-s.patch |  0
 ...lose-Plugin-Class-Loaders-on-Disable.patch |  0
 .../Enderman.teleportRandomly.patch           |  0
 .../EndermanAttackPlayerEvent.patch           |  0
 .../EndermanEscapeEvent.patch                 |  0
 ...ent-consumeArrow-and-getArrowItem-AP.patch |  0
 .../Expand-Explosions-API.patch               |  0
 ...ld.spawnParticle-API-and-add-Builder.patch |  0
 .../InventoryCloseEvent-Reason-API.patch      |  0
 ...PI-additions-for-quantity-flags-lore.patch |  0
 .../ItemStack-getMaxItemUseDuration.patch     |  0
 ...ivingEntity-Hand-Raised-Item-Use-API.patch |  0
 .../Location.isChunkLoaded-API.patch          |  0
 ...ion.toBlockLocation-toCenterLocation.patch |  0
 ...e-shield-blocking-delay-configurable.patch |  0
 .../PlayerReadyArrowEvent.patch               |  0
 .../PotionEffect-clone-methods.patch          |  0
 .../RangedEntity-API.patch                    |  0
 .../WitchConsumePotionEvent.patch             |  0
 .../WitchReadyPotionEvent.patch               |  0
 .../WitchThrowPotionEvent.patch               |  0
 .../getPlayerUniqueId-API.patch               |  0
 .../EndermanAttackPlayerEvent.patch           | 46 ---------
 .../Fix-Dragon-Server-Crashes.patch           | 21 ----
 ...-allowed-colored-signs-to-be-created.patch | 31 ------
 .../Improve-EntityShootBowEvent.patch         | 44 ---------
 ...ed-flag-on-cancel-of-Explosion-Event.patch | 28 ------
 ...to-disable-ender-dragon-legacy-check.patch | 18 ++--
 ...d-method-to-open-already-placed-sign.patch | 14 +--
 ...Item-entities-with-World.spawnEntity.patch |  4 +-
 .../Block-Enderpearl-Travel-Exploit.patch     |  8 +-
 ...ServerListPingEvent-for-legacy-pings.patch |  0
 ...le-Alternative-LootPool-Luck-Formula.patch | 43 ++-------
 ...urable-sprint-interruption-on-attack.patch |  0
 .../Enderman.teleportRandomly.patch           |  9 +-
 .../server/EndermanAttackPlayerEvent.patch    | 30 ++++++
 .../EndermanEscapeEvent.patch                 | 24 ++---
 .../Expand-Explosions-API.patch               |  3 +-
 ...ld.spawnParticle-API-and-add-Builder.patch | 13 +--
 .../Fix-CraftEntity-hashCode.patch            |  0
 ...-allowed-colored-signs-to-be-created.patch | 22 +++++
 .../Flag-to-disable-the-channel-limit.patch   |  6 +-
 ...plement-EntityKnockbackByEntityEvent.patch | 45 +++++----
 ...lement-EntityTeleportEndGatewayEvent.patch | 10 +-
 .../Implement-World.getEntity-UUID-API.patch  |  0
 .../server/Improve-EntityShootBowEvent.patch  | 96 +++++++++++++++++++
 .../InventoryCloseEvent-Reason-API.patch      | 58 +++++------
 .../ItemStack-getMaxItemUseDuration.patch     | 16 +---
 ...ivingEntity-Hand-Raised-Item-Use-API.patch | 32 +------
 ...ke-legacy-ping-handler-more-reliable.patch | 17 +---
 ...Make-player-data-saving-configurable.patch |  0
 ...e-shield-blocking-delay-configurable.patch |  9 +-
 .../PlayerReadyArrowEvent.patch               |  0
 ...sted-Ice-from-loading-holding-chunks.patch | 33 +++++++
 ...ils-when-failing-to-save-player-data.patch |  4 +-
 ...rovide-E-TE-Chunk-count-stat-methods.patch | 15 +--
 .../RangedEntity-API.patch                    | 13 +--
 ...ed-flag-on-cancel-of-Explosion-Event.patch | 19 ++++
 .../WitchConsumePotionEvent.patch             |  2 +-
 .../WitchReadyPotionEvent.patch               |  0
 .../WitchThrowPotionEvent.patch               |  4 +-
 .../getPlayerUniqueId-API.patch               |  0
 69 files changed, 328 insertions(+), 409 deletions(-)
 rename patches/{api-unmapped => api}/Add-Ban-Methods-to-Player-Objects.patch (100%)
 rename patches/{api-unmapped => api}/Add-EntityKnockbackByEntityEvent.patch (100%)
 rename patches/{api-unmapped => api}/Add-EntityTeleportEndGatewayEvent.patch (100%)
 rename patches/{api-unmapped => api}/Add-World.getEntity-UUID-API.patch (100%)
 rename patches/{api-unmapped => api}/Add-getNearbyXXX-methods-to-Location.patch (100%)
 rename patches/{api-unmapped => api}/Add-legacy-ping-support-to-PaperServerListPingEvent.patch (100%)
 rename patches/{api-unmapped => api}/Add-method-to-open-already-placed-sign.patch (100%)
 rename patches/{api-unmapped => api}/Additional-world.getNearbyEntities-API-s.patch (100%)
 rename patches/{api-unmapped => api}/Close-Plugin-Class-Loaders-on-Disable.patch (100%)
 rename patches/{api-unmapped => api}/Enderman.teleportRandomly.patch (100%)
 rename patches/{api-unmapped => api}/EndermanAttackPlayerEvent.patch (100%)
 rename patches/{api-unmapped => api}/EndermanEscapeEvent.patch (100%)
 rename patches/{api-unmapped => api}/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch (100%)
 rename patches/{api-unmapped => api}/Expand-Explosions-API.patch (100%)
 rename patches/{api-unmapped => api}/Expand-World.spawnParticle-API-and-add-Builder.patch (100%)
 rename patches/{api-unmapped => api}/InventoryCloseEvent-Reason-API.patch (100%)
 rename patches/{api-unmapped => api}/ItemStack-API-additions-for-quantity-flags-lore.patch (100%)
 rename patches/{api-unmapped => api}/ItemStack-getMaxItemUseDuration.patch (100%)
 rename patches/{api-unmapped => api}/LivingEntity-Hand-Raised-Item-Use-API.patch (100%)
 rename patches/{api-unmapped => api}/Location.isChunkLoaded-API.patch (100%)
 rename patches/{api-unmapped => api}/Location.toBlockLocation-toCenterLocation.patch (100%)
 rename patches/{api-unmapped => api}/Make-shield-blocking-delay-configurable.patch (100%)
 rename patches/{api-unmapped => api}/PlayerReadyArrowEvent.patch (100%)
 rename patches/{api-unmapped => api}/PotionEffect-clone-methods.patch (100%)
 rename patches/{api-unmapped => api}/RangedEntity-API.patch (100%)
 rename patches/{api-unmapped => api}/WitchConsumePotionEvent.patch (100%)
 rename patches/{api-unmapped => api}/WitchReadyPotionEvent.patch (100%)
 rename patches/{api-unmapped => api}/WitchThrowPotionEvent.patch (100%)
 rename patches/{api-unmapped => api}/getPlayerUniqueId-API.patch (100%)
 delete mode 100644 patches/server-remapped/EndermanAttackPlayerEvent.patch
 delete mode 100644 patches/server-remapped/Fix-Dragon-Server-Crashes.patch
 delete mode 100644 patches/server-remapped/Fix-exploit-that-allowed-colored-signs-to-be-created.patch
 delete mode 100644 patches/server-remapped/Improve-EntityShootBowEvent.patch
 delete mode 100644 patches/server-remapped/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch
 rename patches/{server-remapped => server}/Add-config-to-disable-ender-dragon-legacy-check.patch (73%)
 rename patches/{server-remapped => server}/Add-method-to-open-already-placed-sign.patch (69%)
 rename patches/{server-remapped => server}/Allow-spawning-Item-entities-with-World.spawnEntity.patch (90%)
 rename patches/{server-remapped => server}/Block-Enderpearl-Travel-Exploit.patch (91%)
 rename patches/{server-remapped => server}/Call-PaperServerListPingEvent-for-legacy-pings.patch (100%)
 rename patches/{server-remapped => server}/Configurable-Alternative-LootPool-Luck-Formula.patch (71%)
 rename patches/{server-remapped => server}/Configurable-sprint-interruption-on-attack.patch (100%)
 rename patches/{server-remapped => server}/Enderman.teleportRandomly.patch (84%)
 create mode 100644 patches/server/EndermanAttackPlayerEvent.patch
 rename patches/{server-remapped => server}/EndermanEscapeEvent.patch (74%)
 rename patches/{server-remapped => server}/Expand-Explosions-API.patch (84%)
 rename patches/{server-remapped => server}/Expand-World.spawnParticle-API-and-add-Builder.patch (81%)
 rename patches/{server-remapped => server}/Fix-CraftEntity-hashCode.patch (100%)
 create mode 100644 patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch
 rename patches/{server-remapped => server}/Flag-to-disable-the-channel-limit.patch (80%)
 rename patches/{server-remapped => server}/Implement-EntityKnockbackByEntityEvent.patch (64%)
 rename patches/{server-remapped => server}/Implement-EntityTeleportEndGatewayEvent.patch (78%)
 rename patches/{server-remapped => server}/Implement-World.getEntity-UUID-API.patch (100%)
 create mode 100644 patches/server/Improve-EntityShootBowEvent.patch
 rename patches/{server-remapped => server}/InventoryCloseEvent-Reason-API.patch (81%)
 rename patches/{server-remapped => server}/ItemStack-getMaxItemUseDuration.patch (54%)
 rename patches/{server-remapped => server}/LivingEntity-Hand-Raised-Item-Use-API.patch (50%)
 rename patches/{server-remapped => server}/Make-legacy-ping-handler-more-reliable.patch (85%)
 rename patches/{server-remapped => server}/Make-player-data-saving-configurable.patch (100%)
 rename patches/{server-remapped => server}/Make-shield-blocking-delay-configurable.patch (92%)
 rename patches/{server-remapped => server}/PlayerReadyArrowEvent.patch (100%)
 create mode 100644 patches/server/Prevent-Frosted-Ice-from-loading-holding-chunks.patch
 rename patches/{server-remapped => server}/Print-Error-details-when-failing-to-save-player-data.patch (81%)
 rename patches/{server-remapped => server}/RangedEntity-API.patch (95%)
 create mode 100644 patches/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch
 rename patches/{server-remapped => server}/WitchConsumePotionEvent.patch (95%)
 rename patches/{server-remapped => server}/WitchReadyPotionEvent.patch (100%)
 rename patches/{server-remapped => server}/WitchThrowPotionEvent.patch (92%)
 rename patches/{server-remapped => server}/getPlayerUniqueId-API.patch (100%)

diff --git a/patches/api-unmapped/Add-Ban-Methods-to-Player-Objects.patch b/patches/api/Add-Ban-Methods-to-Player-Objects.patch
similarity index 100%
rename from patches/api-unmapped/Add-Ban-Methods-to-Player-Objects.patch
rename to patches/api/Add-Ban-Methods-to-Player-Objects.patch
diff --git a/patches/api-unmapped/Add-EntityKnockbackByEntityEvent.patch b/patches/api/Add-EntityKnockbackByEntityEvent.patch
similarity index 100%
rename from patches/api-unmapped/Add-EntityKnockbackByEntityEvent.patch
rename to patches/api/Add-EntityKnockbackByEntityEvent.patch
diff --git a/patches/api-unmapped/Add-EntityTeleportEndGatewayEvent.patch b/patches/api/Add-EntityTeleportEndGatewayEvent.patch
similarity index 100%
rename from patches/api-unmapped/Add-EntityTeleportEndGatewayEvent.patch
rename to patches/api/Add-EntityTeleportEndGatewayEvent.patch
diff --git a/patches/api-unmapped/Add-World.getEntity-UUID-API.patch b/patches/api/Add-World.getEntity-UUID-API.patch
similarity index 100%
rename from patches/api-unmapped/Add-World.getEntity-UUID-API.patch
rename to patches/api/Add-World.getEntity-UUID-API.patch
diff --git a/patches/api-unmapped/Add-getNearbyXXX-methods-to-Location.patch b/patches/api/Add-getNearbyXXX-methods-to-Location.patch
similarity index 100%
rename from patches/api-unmapped/Add-getNearbyXXX-methods-to-Location.patch
rename to patches/api/Add-getNearbyXXX-methods-to-Location.patch
diff --git a/patches/api-unmapped/Add-legacy-ping-support-to-PaperServerListPingEvent.patch b/patches/api/Add-legacy-ping-support-to-PaperServerListPingEvent.patch
similarity index 100%
rename from patches/api-unmapped/Add-legacy-ping-support-to-PaperServerListPingEvent.patch
rename to patches/api/Add-legacy-ping-support-to-PaperServerListPingEvent.patch
diff --git a/patches/api-unmapped/Add-method-to-open-already-placed-sign.patch b/patches/api/Add-method-to-open-already-placed-sign.patch
similarity index 100%
rename from patches/api-unmapped/Add-method-to-open-already-placed-sign.patch
rename to patches/api/Add-method-to-open-already-placed-sign.patch
diff --git a/patches/api-unmapped/Additional-world.getNearbyEntities-API-s.patch b/patches/api/Additional-world.getNearbyEntities-API-s.patch
similarity index 100%
rename from patches/api-unmapped/Additional-world.getNearbyEntities-API-s.patch
rename to patches/api/Additional-world.getNearbyEntities-API-s.patch
diff --git a/patches/api-unmapped/Close-Plugin-Class-Loaders-on-Disable.patch b/patches/api/Close-Plugin-Class-Loaders-on-Disable.patch
similarity index 100%
rename from patches/api-unmapped/Close-Plugin-Class-Loaders-on-Disable.patch
rename to patches/api/Close-Plugin-Class-Loaders-on-Disable.patch
diff --git a/patches/api-unmapped/Enderman.teleportRandomly.patch b/patches/api/Enderman.teleportRandomly.patch
similarity index 100%
rename from patches/api-unmapped/Enderman.teleportRandomly.patch
rename to patches/api/Enderman.teleportRandomly.patch
diff --git a/patches/api-unmapped/EndermanAttackPlayerEvent.patch b/patches/api/EndermanAttackPlayerEvent.patch
similarity index 100%
rename from patches/api-unmapped/EndermanAttackPlayerEvent.patch
rename to patches/api/EndermanAttackPlayerEvent.patch
diff --git a/patches/api-unmapped/EndermanEscapeEvent.patch b/patches/api/EndermanEscapeEvent.patch
similarity index 100%
rename from patches/api-unmapped/EndermanEscapeEvent.patch
rename to patches/api/EndermanEscapeEvent.patch
diff --git a/patches/api-unmapped/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch b/patches/api/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch
similarity index 100%
rename from patches/api-unmapped/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch
rename to patches/api/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch
diff --git a/patches/api-unmapped/Expand-Explosions-API.patch b/patches/api/Expand-Explosions-API.patch
similarity index 100%
rename from patches/api-unmapped/Expand-Explosions-API.patch
rename to patches/api/Expand-Explosions-API.patch
diff --git a/patches/api-unmapped/Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/api/Expand-World.spawnParticle-API-and-add-Builder.patch
similarity index 100%
rename from patches/api-unmapped/Expand-World.spawnParticle-API-and-add-Builder.patch
rename to patches/api/Expand-World.spawnParticle-API-and-add-Builder.patch
diff --git a/patches/api-unmapped/InventoryCloseEvent-Reason-API.patch b/patches/api/InventoryCloseEvent-Reason-API.patch
similarity index 100%
rename from patches/api-unmapped/InventoryCloseEvent-Reason-API.patch
rename to patches/api/InventoryCloseEvent-Reason-API.patch
diff --git a/patches/api-unmapped/ItemStack-API-additions-for-quantity-flags-lore.patch b/patches/api/ItemStack-API-additions-for-quantity-flags-lore.patch
similarity index 100%
rename from patches/api-unmapped/ItemStack-API-additions-for-quantity-flags-lore.patch
rename to patches/api/ItemStack-API-additions-for-quantity-flags-lore.patch
diff --git a/patches/api-unmapped/ItemStack-getMaxItemUseDuration.patch b/patches/api/ItemStack-getMaxItemUseDuration.patch
similarity index 100%
rename from patches/api-unmapped/ItemStack-getMaxItemUseDuration.patch
rename to patches/api/ItemStack-getMaxItemUseDuration.patch
diff --git a/patches/api-unmapped/LivingEntity-Hand-Raised-Item-Use-API.patch b/patches/api/LivingEntity-Hand-Raised-Item-Use-API.patch
similarity index 100%
rename from patches/api-unmapped/LivingEntity-Hand-Raised-Item-Use-API.patch
rename to patches/api/LivingEntity-Hand-Raised-Item-Use-API.patch
diff --git a/patches/api-unmapped/Location.isChunkLoaded-API.patch b/patches/api/Location.isChunkLoaded-API.patch
similarity index 100%
rename from patches/api-unmapped/Location.isChunkLoaded-API.patch
rename to patches/api/Location.isChunkLoaded-API.patch
diff --git a/patches/api-unmapped/Location.toBlockLocation-toCenterLocation.patch b/patches/api/Location.toBlockLocation-toCenterLocation.patch
similarity index 100%
rename from patches/api-unmapped/Location.toBlockLocation-toCenterLocation.patch
rename to patches/api/Location.toBlockLocation-toCenterLocation.patch
diff --git a/patches/api-unmapped/Make-shield-blocking-delay-configurable.patch b/patches/api/Make-shield-blocking-delay-configurable.patch
similarity index 100%
rename from patches/api-unmapped/Make-shield-blocking-delay-configurable.patch
rename to patches/api/Make-shield-blocking-delay-configurable.patch
diff --git a/patches/api-unmapped/PlayerReadyArrowEvent.patch b/patches/api/PlayerReadyArrowEvent.patch
similarity index 100%
rename from patches/api-unmapped/PlayerReadyArrowEvent.patch
rename to patches/api/PlayerReadyArrowEvent.patch
diff --git a/patches/api-unmapped/PotionEffect-clone-methods.patch b/patches/api/PotionEffect-clone-methods.patch
similarity index 100%
rename from patches/api-unmapped/PotionEffect-clone-methods.patch
rename to patches/api/PotionEffect-clone-methods.patch
diff --git a/patches/api-unmapped/RangedEntity-API.patch b/patches/api/RangedEntity-API.patch
similarity index 100%
rename from patches/api-unmapped/RangedEntity-API.patch
rename to patches/api/RangedEntity-API.patch
diff --git a/patches/api-unmapped/WitchConsumePotionEvent.patch b/patches/api/WitchConsumePotionEvent.patch
similarity index 100%
rename from patches/api-unmapped/WitchConsumePotionEvent.patch
rename to patches/api/WitchConsumePotionEvent.patch
diff --git a/patches/api-unmapped/WitchReadyPotionEvent.patch b/patches/api/WitchReadyPotionEvent.patch
similarity index 100%
rename from patches/api-unmapped/WitchReadyPotionEvent.patch
rename to patches/api/WitchReadyPotionEvent.patch
diff --git a/patches/api-unmapped/WitchThrowPotionEvent.patch b/patches/api/WitchThrowPotionEvent.patch
similarity index 100%
rename from patches/api-unmapped/WitchThrowPotionEvent.patch
rename to patches/api/WitchThrowPotionEvent.patch
diff --git a/patches/api-unmapped/getPlayerUniqueId-API.patch b/patches/api/getPlayerUniqueId-API.patch
similarity index 100%
rename from patches/api-unmapped/getPlayerUniqueId-API.patch
rename to patches/api/getPlayerUniqueId-API.patch
diff --git a/patches/server-remapped/EndermanAttackPlayerEvent.patch b/patches/server-remapped/EndermanAttackPlayerEvent.patch
deleted file mode 100644
index 58f9ef07ee..0000000000
--- a/patches/server-remapped/EndermanAttackPlayerEvent.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Aikar <aikar@aikar.co>
-Date: Tue, 1 May 2018 20:18:54 -0400
-Subject: [PATCH] EndermanAttackPlayerEvent
-
-Allow control over whether or not an enderman aggros a player.
-
-This allows you to override/extend the pumpkin/stare logic.
-
-diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
-index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
-+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
-@@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob {
-         this.readPersistentAngerSaveData((ServerLevel) this.level, tag);
-     }
- 
-+    // Paper start - OBFHELPER - ok not really, but verify this on updates
-     private boolean isLookingAtMe(Player player) {
--        ItemStack itemstack = (ItemStack) player.inventory.armor.get(3);
-+        boolean shouldAttack = g_real(player);
-+        com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent event = new com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent((org.bukkit.entity.Enderman) getBukkitEntity(), (org.bukkit.entity.Player) player.getBukkitEntity());
-+        event.setCancelled(!shouldAttack);
-+        return event.callEvent();
-+    }
-+    private boolean g_real(Player entityhuman) {
-+        // Paper end
-+        ItemStack itemstack = (ItemStack) entityhuman.inventory.armor.get(3);
- 
-         if (itemstack.getItem() == Blocks.CARVED_PUMPKIN.asItem()) {
-             return false;
-         } else {
--            Vec3 vec3d = player.getViewVector(1.0F).normalize();
--            Vec3 vec3d1 = new Vec3(this.getX() - player.getX(), this.getEyeY() - player.getEyeY(), this.getZ() - player.getZ());
-+            Vec3 vec3d = entityhuman.getViewVector(1.0F).normalize();
-+            Vec3 vec3d1 = new Vec3(this.getX() - entityhuman.getX(), this.getEyeY() - entityhuman.getEyeY(), this.getZ() - entityhuman.getZ());
-             double d0 = vec3d1.length();
- 
-             vec3d1 = vec3d1.normalize();
-             double d1 = vec3d.dot(vec3d1);
- 
--            return d1 > 1.0D - 0.025D / d0 ? player.canSee(this) : false;
-+            return d1 > 1.0D - 0.025D / d0 ? entityhuman.canSee(this) : false;
-         }
-     }
- 
diff --git a/patches/server-remapped/Fix-Dragon-Server-Crashes.patch b/patches/server-remapped/Fix-Dragon-Server-Crashes.patch
deleted file mode 100644
index 1fcdca7603..0000000000
--- a/patches/server-remapped/Fix-Dragon-Server-Crashes.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Aikar <aikar@aikar.co>
-Date: Wed, 21 Mar 2018 20:52:07 -0400
-Subject: [PATCH] Fix Dragon Server Crashes
-
-If the dragon tries to find "ground" and hits a hole, or off edge,
-it will infinitely keep looking for non air and eventually crash.
-
-diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java
-index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java
-+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java
-@@ -0,0 +0,0 @@ public class DragonSittingFlamingPhase extends AbstractDragonSittingPhase {
-             double d3 = d2;
-             BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(d0, d2, d1);
- 
--            while (this.dragon.level.isEmptyBlock(blockposition_mutableblockposition)) {
-+            while (this.dragon.level.isEmptyBlock(blockposition_mutableblockposition ) && d2 > 0) { // Paper
-                 --d3;
-                 if (d3 < 0.0D) {
-                     d3 = d2;
diff --git a/patches/server-remapped/Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/patches/server-remapped/Fix-exploit-that-allowed-colored-signs-to-be-created.patch
deleted file mode 100644
index db3e108852..0000000000
--- a/patches/server-remapped/Fix-exploit-that-allowed-colored-signs-to-be-created.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: 0x22 <0x22@futureclient.net>
-Date: Thu, 26 Apr 2018 04:41:11 -0400
-Subject: [PATCH] Fix exploit that allowed colored signs to be created
-
-
-diff --git a/src/main/java/net/minecraft/SharedConstants.java b/src/main/java/net/minecraft/SharedConstants.java
-index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/net/minecraft/SharedConstants.java
-+++ b/src/main/java/net/minecraft/SharedConstants.java
-@@ -0,0 +0,0 @@ public class SharedConstants {
-         return chr != 167 && chr >= ' ' && chr != 127;
-     }
- 
-+    public static String filterAllowedChatCharacters(String input) { return filterText(input); } // Paper - OBFHELPER
-     public static String filterText(String s) {
-         StringBuilder stringbuilder = new StringBuilder();
-         char[] achar = s.toCharArray();
-diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- 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 implements ServerGamePacketListener {
-             List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>();
- 
-             for (int i = 0; i < list.size(); ++i) {
--                lines.add(net.kyori.adventure.text.Component.text(list.get(i)));
-+                lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterAllowedChatCharacters(list.get(i)))); // Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created.
-             }
-             SignChangeEvent event = new SignChangeEvent(org.bukkit.craftbukkit.block.CraftBlock.at(worldserver, blockposition), this.getPlayer(), lines);
-             this.craftServer.getPluginManager().callEvent(event);
diff --git a/patches/server-remapped/Improve-EntityShootBowEvent.patch b/patches/server-remapped/Improve-EntityShootBowEvent.patch
deleted file mode 100644
index dee12a1fc7..0000000000
--- a/patches/server-remapped/Improve-EntityShootBowEvent.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Aikar <aikar@aikar.co>
-Date: Sat, 15 Jun 2013 19:51:17 -0400
-Subject: [PATCH] Improve EntityShootBowEvent
-
-Adds missing call to Illagers and also adds Arrow ItemStack to skeltons
-
-diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
-index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
-+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
-@@ -0,0 +0,0 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
- 
-         entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4));
-         // CraftBukkit start
--        org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), null, entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true);
-+        org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getOriginalItemStack(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper
-         if (event.isCancelled()) {
-             event.getProjectile().remove();
-             return;
-diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
-index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
-+++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
-@@ -0,0 +0,0 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
-         double d3 = (double) Mth.sqrt(d0 * d0 + d2 * d2);
- 
-         entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4));
-+        // Paper start
-+        org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getOriginalItemStack(), entityarrow, target.getUsedItemHand(), 0.8F, true);
-+        if (event.isCancelled()) {
-+            event.getProjectile().remove();
-+            return;
-+        }
-+
-+        if (event.getProjectile() == entityarrow.getBukkitEntity()) {
-+            this.level.addFreshEntity(entityarrow);
-+        }
-         this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
--        this.level.addFreshEntity(entityarrow);
-+        // Paper end
-     }
- 
-     class IllusionerBlindnessSpellGoal extends SpellcasterIllager.SpellcasterUseSpellGoal {
diff --git a/patches/server-remapped/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch b/patches/server-remapped/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch
deleted file mode 100644
index 7cda8370e4..0000000000
--- a/patches/server-remapped/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Aikar <aikar@aikar.co>
-Date: Sun, 10 Jun 2018 01:18:49 -0400
-Subject: [PATCH] Unset Ignited flag on cancel of Explosion Event
-
-Otherwise the creeper infinite explodes
-
-diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
-index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
-+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
-@@ -0,0 +0,0 @@ public class Creeper extends Monster {
- 
-     private static final EntityDataAccessor<Integer> DATA_SWELL_DIR = SynchedEntityData.defineId(Creeper.class, EntityDataSerializers.INT);
-     private static final EntityDataAccessor<Boolean> DATA_IS_POWERED = SynchedEntityData.defineId(Creeper.class, EntityDataSerializers.BOOLEAN);
--    private static final EntityDataAccessor<Boolean> DATA_IS_IGNITED = SynchedEntityData.defineId(Creeper.class, EntityDataSerializers.BOOLEAN);
-+    private static final EntityDataAccessor<Boolean> DATA_IS_IGNITED = SynchedEntityData.defineId(Creeper.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor<Boolean> isIgnitedDW = DATA_IS_IGNITED; // Paper OBFHELPER
-     private int oldSwell;
-     public int swell; // PAIL
-     public int maxSwell = 30;
-@@ -0,0 +0,0 @@ public class Creeper extends Monster {
-                 this.spawnLingeringCloud();
-             } else {
-                 swell = 0;
-+                this.entityData.set(isIgnitedDW, Boolean.valueOf(false)); // Paper
-             }
-             // CraftBukkit end
-         }
diff --git a/patches/server-remapped/Add-config-to-disable-ender-dragon-legacy-check.patch b/patches/server/Add-config-to-disable-ender-dragon-legacy-check.patch
similarity index 73%
rename from patches/server-remapped/Add-config-to-disable-ender-dragon-legacy-check.patch
rename to patches/server/Add-config-to-disable-ender-dragon-legacy-check.patch
index b18a07ed31..528f6629e5 100644
--- a/patches/server-remapped/Add-config-to-disable-ender-dragon-legacy-check.patch
+++ b/patches/server/Add-config-to-disable-ender-dragon-legacy-check.patch
@@ -23,11 +23,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
 +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
 @@ -0,0 +0,0 @@ public class EndDragonFight {
-     private boolean dragonKilled;
-     private boolean previouslyKilled;
-     public UUID dragonUUID;
--    private boolean needsStateScanning;
-+    private boolean needsStateScanning; private void setScanForLegacyFight(boolean scanForLegacyFight) { this.needsStateScanning = scanForLegacyFight; } private boolean scanForLegacyFight() { return this.needsStateScanning; } // Paper - OBFHELPER
-     public BlockPos portalLocation;
-     public DragonRespawnAnimation respawnStage;
-     private int respawnTime;
+     private List<EndCrystal> respawnCrystals;
+ 
+     public EndDragonFight(ServerLevel world, long gatewaysSeed, CompoundTag nbt) {
++        // Paper start
++        this.needsStateScanning = world.paperConfig.scanForLegacyEnderDragon;
++        if (!this.needsStateScanning) this.dragonKilled = true;
++        // Paper end
+         this.level = world;
+         if (nbt.contains("NeedsStateScanning")) {
+             this.needsStateScanning = nbt.getBoolean("NeedsStateScanning");
diff --git a/patches/server-remapped/Add-method-to-open-already-placed-sign.patch b/patches/server/Add-method-to-open-already-placed-sign.patch
similarity index 69%
rename from patches/server-remapped/Add-method-to-open-already-placed-sign.patch
rename to patches/server/Add-method-to-open-already-placed-sign.patch
index 5f16d1a859..30d2d47b6b 100644
--- a/patches/server-remapped/Add-method-to-open-already-placed-sign.patch
+++ b/patches/server/Add-method-to-open-already-placed-sign.patch
@@ -8,14 +8,6 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
-@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.Blocks;
- import net.minecraft.world.level.block.CraftingTableBlock;
- import net.minecraft.world.level.block.EnchantmentTableBlock;
- import net.minecraft.world.level.block.entity.BlockEntity;
-+import net.minecraft.world.level.block.entity.SignBlockEntity;
- import net.minecraft.world.level.block.state.BlockState;
- import org.bukkit.GameMode;
- import org.bukkit.Location;
 @@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
          }
      }
@@ -25,12 +17,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +    public void openSign(org.bukkit.block.Sign sign) {
 +        org.apache.commons.lang.Validate.isTrue(sign.getWorld().equals(this.getWorld()), "Sign must be in the same world as player is in");
 +        org.bukkit.craftbukkit.block.CraftSign craftSign = (org.bukkit.craftbukkit.block.CraftSign) sign;
-+        SignBlockEntity teSign = craftSign.getTileEntity();
++        net.minecraft.world.level.block.entity.SignBlockEntity teSign = craftSign.getTileEntity();
 +        // Make sign editable temporarily, will be set back to false in PlayerConnection later
 +        teSign.isEditable = true;
-+        getHandle().openTextEdit(teSign);
++        this.getHandle().openTextEdit(teSign);
 +    }
 +    // Paper end
      @Override
      public boolean dropItem(boolean dropAll) {
-         return getHandle().drop(dropAll);
+         return this.getHandle().drop(dropAll);
diff --git a/patches/server-remapped/Allow-spawning-Item-entities-with-World.spawnEntity.patch b/patches/server/Allow-spawning-Item-entities-with-World.spawnEntity.patch
similarity index 90%
rename from patches/server-remapped/Allow-spawning-Item-entities-with-World.spawnEntity.patch
rename to patches/server/Allow-spawning-Item-entities-with-World.spawnEntity.patch
index 26c48c4c39..fd77740787 100644
--- a/patches/server-remapped/Allow-spawning-Item-entities-with-World.spawnEntity.patch
+++ b/patches/server/Allow-spawning-Item-entities-with-World.spawnEntity.patch
@@ -13,12 +13,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 @@ -0,0 +0,0 @@ public class CraftWorld implements World {
          if (Boat.class.isAssignableFrom(clazz)) {
-             entity = new net.minecraft.world.entity.vehicle.Boat(world, x, y, z);
+             entity = new net.minecraft.world.entity.vehicle.Boat(this.world, x, y, z);
              entity.moveTo(x, y, z, yaw, pitch);
 +            // Paper start
 +        } else if (org.bukkit.entity.Item.class.isAssignableFrom(clazz)) {
 +            entity = new ItemEntity(world, x, y, z, new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Item.byBlock(net.minecraft.world.level.block.Blocks.DIRT)));
 +            // Paper end
          } else if (FallingBlock.class.isAssignableFrom(clazz)) {
-             entity = new FallingBlockEntity(world, x, y, z, world.getBlockState(new BlockPos(x, y, z)));
+             entity = new FallingBlockEntity(this.world, x, y, z, this.world.getBlockState(new BlockPos(x, y, z)));
          } else if (Projectile.class.isAssignableFrom(clazz)) {
diff --git a/patches/server-remapped/Block-Enderpearl-Travel-Exploit.patch b/patches/server/Block-Enderpearl-Travel-Exploit.patch
similarity index 91%
rename from patches/server-remapped/Block-Enderpearl-Travel-Exploit.patch
rename to patches/server/Block-Enderpearl-Travel-Exploit.patch
index 193718e885..0f5cc3bc59 100644
--- a/patches/server-remapped/Block-Enderpearl-Travel-Exploit.patch
+++ b/patches/server/Block-Enderpearl-Travel-Exploit.patch
@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
 +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
 @@ -0,0 +0,0 @@ public abstract class Projectile extends Entity {
-     protected void readAdditionalSaveData(CompoundTag tag) {
-         if (tag.hasUUID("Owner")) {
-             this.ownerUUID = tag.getUUID("Owner");
+     protected void readAdditionalSaveData(CompoundTag nbt) {
+         if (nbt.hasUUID("Owner")) {
+             this.ownerUUID = nbt.getUUID("Owner");
 +            if (this instanceof ThrownEnderpearl && this.level != null && this.level.paperConfig.disableEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
          }
  
-         this.leftOwner = tag.getBoolean("LeftOwner");
+         this.leftOwner = nbt.getBoolean("LeftOwner");
diff --git a/patches/server-remapped/Call-PaperServerListPingEvent-for-legacy-pings.patch b/patches/server/Call-PaperServerListPingEvent-for-legacy-pings.patch
similarity index 100%
rename from patches/server-remapped/Call-PaperServerListPingEvent-for-legacy-pings.patch
rename to patches/server/Call-PaperServerListPingEvent-for-legacy-pings.patch
diff --git a/patches/server-remapped/Configurable-Alternative-LootPool-Luck-Formula.patch b/patches/server/Configurable-Alternative-LootPool-Luck-Formula.patch
similarity index 71%
rename from patches/server-remapped/Configurable-Alternative-LootPool-Luck-Formula.patch
rename to patches/server/Configurable-Alternative-LootPool-Luck-Formula.patch
index 0822206707..3dc4ee6675 100644
--- a/patches/server-remapped/Configurable-Alternative-LootPool-Luck-Formula.patch
+++ b/patches/server/Configurable-Alternative-LootPool-Luck-Formula.patch
@@ -56,44 +56,19 @@ diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPo
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java
 +++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java
-@@ -0,0 +0,0 @@ import java.util.List;
- import java.util.function.BiFunction;
- import java.util.function.Consumer;
- import net.minecraft.util.GsonHelper;
--import net.minecraft.util.Mth;
- import net.minecraft.world.item.ItemStack;
- import net.minecraft.world.level.storage.loot.LootContext;
- import net.minecraft.world.level.storage.loot.ValidationContext;
-@@ -0,0 +0,0 @@ import org.apache.commons.lang3.ArrayUtils;
- 
- public abstract class LootPoolSingletonContainer extends LootPoolEntryContainer {
- 
--    protected final int weight;
--    protected final int quality;
-+    protected final int weight; public int getWeight() { return weight; } // Paper - OBFHELPER
-+    protected final int quality; public int getQuality() { return quality; } // Paper - OBFHELPER
-     protected final LootItemFunction[] functions;
-     private final BiFunction<ItemStack, LootContext, ItemStack> compositeFunction;
-     private final LootPoolEntry entry = new LootPoolSingletonContainer.EntryBase() {
 @@ -0,0 +0,0 @@ public abstract class LootPoolSingletonContainer extends LootPoolEntryContainer
- 
-     public abstract class EntryBase implements LootPoolEntry {
- 
--        protected EntryBase() {}
-+        protected EntryBase() {
-+        }
- 
+     protected abstract class EntryBase implements LootPoolEntry {
          @Override
          public int getWeight(float luck) {
--            return Math.max(Mth.floor((float) LootPoolSingletonContainer.this.weight + (float) LootPoolSingletonContainer.this.quality * luck), 0);
+-            return Math.max(Mth.floor((float)LootPoolSingletonContainer.this.weight + (float)LootPoolSingletonContainer.this.quality * luck), 0);
 +            // Paper start - Offer an alternative loot formula to refactor how luck bonus applies
 +            // SEE: https://luckformula.emc.gs for details and data
-+            if (lastLuck != null && lastLuck == luck) {
++            if (LootPoolSingletonContainer.this.lastLuck != null && LootPoolSingletonContainer.this.lastLuck == luck) {
 +                return lastWeight;
 +            }
 +            // This is vanilla
-+            float qualityModifer = (float) getQuality() * luck;
-+            double baseWeight = (getWeight() + qualityModifer);
++            float qualityModifer = (float) LootPoolSingletonContainer.this.quality * luck;
++            double baseWeight = (LootPoolSingletonContainer.this.weight + qualityModifer);
 +            if (com.destroystokyo.paper.PaperConfig.useAlternativeLuckFormula) {
 +                // Random boost to avoid losing precision in the final int cast on return
 +                final int weightBoost = 100;
@@ -107,12 +82,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +                // =B2 - (C2 *($B$7/100))
 +                baseWeight = Math.ceil(baseWeight - (impacted * luckModifier));
 +            }
-+            lastLuck = luck;
-+            lastWeight = (int) Math.max(0, Math.floor(baseWeight));
++            LootPoolSingletonContainer.this.lastLuck = luck;
++            LootPoolSingletonContainer.this.lastWeight = (int) Math.max(Math.floor(baseWeight), 0);
 +            return lastWeight;
          }
      }
 +    private Float lastLuck = null;
 +    private int lastWeight = 0;
 +    // Paper end
- }
+ 
+     @FunctionalInterface
+     protected interface EntryConstructor {
diff --git a/patches/server-remapped/Configurable-sprint-interruption-on-attack.patch b/patches/server/Configurable-sprint-interruption-on-attack.patch
similarity index 100%
rename from patches/server-remapped/Configurable-sprint-interruption-on-attack.patch
rename to patches/server/Configurable-sprint-interruption-on-attack.patch
diff --git a/patches/server-remapped/Enderman.teleportRandomly.patch b/patches/server/Enderman.teleportRandomly.patch
similarity index 84%
rename from patches/server-remapped/Enderman.teleportRandomly.patch
rename to patches/server/Enderman.teleportRandomly.patch
index 368bfec88a..f93e16b993 100644
--- a/patches/server-remapped/Enderman.teleportRandomly.patch
+++ b/patches/server/Enderman.teleportRandomly.patch
@@ -13,10 +13,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          super.customServerAiStep();
      }
  
-+    public final boolean teleportRandomly() { return this.teleport(); } // Paper - OBFHELPER
-     protected boolean teleport() {
+-    protected boolean teleport() {
++    public boolean teleport() { // Paper - protected->public
          if (!this.level.isClientSide() && this.isAlive()) {
              double d0 = this.getX() + (this.random.nextDouble() - 0.5D) * 64.0D;
+             double d1 = this.getY() + (double) (this.random.nextInt(64) - 32);
 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
@@ -25,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          super(server, entity);
      }
  
-+    @Override public boolean teleportRandomly() { return getHandle().teleportRandomly(); } // Paper
++    @Override public boolean teleportRandomly() { return getHandle().teleport(); } // Paper
      @Override
      public MaterialData getCarriedMaterial() {
-         BlockState blockData = getHandle().getCarriedBlock();
+         BlockState blockData = this.getHandle().getCarriedBlock();
diff --git a/patches/server/EndermanAttackPlayerEvent.patch b/patches/server/EndermanAttackPlayerEvent.patch
new file mode 100644
index 0000000000..c2d177ebfa
--- /dev/null
+++ b/patches/server/EndermanAttackPlayerEvent.patch
@@ -0,0 +1,30 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aikar <aikar@aikar.co>
+Date: Tue, 1 May 2018 20:18:54 -0400
+Subject: [PATCH] EndermanAttackPlayerEvent
+
+Allow control over whether or not an enderman aggros a player.
+
+This allows you to override/extend the pumpkin/stare logic.
+
+diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
++++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+@@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob {
+         this.readPersistentAngerSaveData(this.level, nbt);
+     }
+ 
+-    boolean isLookingAtMe(Player player) {
++    // Paper start - EndermanAttackPlayerEvent
++    private boolean isLookingAtMe(Player player) {
++        boolean shouldAttack = isLookingAtMe_check(player);
++        com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent event = new com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent((org.bukkit.entity.Enderman) getBukkitEntity(), (org.bukkit.entity.Player) player.getBukkitEntity());
++        event.setCancelled(!shouldAttack);
++        return event.callEvent();
++    }
++    private boolean isLookingAtMe_check(Player player) {
++        // Paper end
+         ItemStack itemstack = (ItemStack) player.getInventory().armor.get(3);
+ 
+         if (itemstack.is(Blocks.CARVED_PUMPKIN.asItem())) {
diff --git a/patches/server-remapped/EndermanEscapeEvent.patch b/patches/server/EndermanEscapeEvent.patch
similarity index 74%
rename from patches/server-remapped/EndermanEscapeEvent.patch
rename to patches/server/EndermanEscapeEvent.patch
index 89b49dc7fd..51c0d49b0a 100644
--- a/patches/server-remapped/EndermanEscapeEvent.patch
+++ b/patches/server/EndermanEscapeEvent.patch
@@ -11,21 +11,13 @@ diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/sr
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
 +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
-@@ -0,0 +0,0 @@ package net.minecraft.world.entity.monster;
- 
- import java.util.EnumSet;
- import java.util.Optional;
-+import com.destroystokyo.paper.event.entity.EndermanEscapeEvent; // Paper
- import java.util.Random;
- import java.util.UUID;
- import java.util.function.Predicate;
 @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob {
-         setGoalTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
+         this.setGoalTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
      }
  
 +    // Paper start
-+    private boolean tryEscape(EndermanEscapeEvent.Reason reason) {
-+        return new EndermanEscapeEvent((org.bukkit.craftbukkit.entity.CraftEnderman) this.getBukkitEntity(), reason).callEvent();
++    private boolean tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason reason) {
++        return new com.destroystokyo.paper.event.entity.EndermanEscapeEvent((org.bukkit.craftbukkit.entity.CraftEnderman) this.getBukkitEntity(), reason).callEvent();
 +    }
 +    // Paper end
 +
@@ -37,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              float f = this.getBrightness();
  
 -            if (f > 0.5F && this.level.canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
-+            if (f > 0.5F && this.level.canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper
++            if (f > 0.5F && this.level.canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper
                  this.setTarget((LivingEntity) null);
                  this.teleport();
              }
@@ -45,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          if (this.isInvulnerableTo(source)) {
              return false;
          } else if (source instanceof IndirectEntityDamageSource) {
-+            if (this.tryEscape(EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start
++            if (this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start
              for (int i = 0; i < 64; ++i) {
                  if (this.teleport()) {
                      return true;
@@ -58,13 +50,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              boolean flag = super.hurt(source, amount);
  
 -            if (!this.level.isClientSide() && !(source.getEntity() instanceof LivingEntity) && this.random.nextInt(10) != 0) {
-+            if (!this.level.isClientSide() && !(source.getEntity() instanceof LivingEntity) && this.random.nextInt(10) != 0 && this.tryEscape(source == DamageSource.DROWN ? EndermanEscapeEvent.Reason.DROWN : EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - use to be critical hits as else, but mojang removed critical hits in 1.16.2 due to MC-185684
++            if (!this.level.isClientSide() && !(source.getEntity() instanceof LivingEntity) && this.random.nextInt(10) != 0 && this.tryEscape(source == DamageSource.DROWN ? com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.DROWN : com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - use to be critical hits as else, but mojang removed critical hits in 1.16.2 due to MC-185684
                  this.teleport();
              }
  
 @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob {
  
-     static class EndermanLookForPlayerGoal extends NearestAttackableTargetGoal<Player> {
+     private static class EndermanLookForPlayerGoal extends NearestAttackableTargetGoal<Player> {
  
 -        private final EnderMan enderman;
 +        private final EnderMan enderman; public final EnderMan getEnderman() { return this.enderman; } // Paper - OBFHELPER
@@ -76,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
                  if (this.target != null && !this.enderman.isPassenger()) {
                      if (this.enderman.isLookingAtMe((Player) this.target)) {
 -                        if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D) {
-+                        if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D && this.getEnderman().tryEscape(EndermanEscapeEvent.Reason.STARE)) { // Paper
++                        if (this.target.distanceToSqr((Entity) this.enderman) < 16.0D && this.getEnderman().tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.STARE)) { // Paper
                              this.enderman.teleport();
                          }
  
diff --git a/patches/server-remapped/Expand-Explosions-API.patch b/patches/server/Expand-Explosions-API.patch
similarity index 84%
rename from patches/server-remapped/Expand-Explosions-API.patch
rename to patches/server/Expand-Explosions-API.patch
index 8e01abc0ca..abaa81a5a1 100644
--- a/patches/server-remapped/Expand-Explosions-API.patch
+++ b/patches/server/Expand-Explosions-API.patch
@@ -11,9 +11,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 @@ -0,0 +0,0 @@ public class CraftWorld implements World {
      public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) {
-         return !world.explode(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, breakBlocks ? Explosion.BlockInteraction.BREAK : Explosion.BlockInteraction.NONE).wasCanceled;
+         return !this.world.explode(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, breakBlocks ? Explosion.BlockInteraction.BREAK : Explosion.BlockInteraction.NONE).wasCanceled;
      }
 +    // Paper start
++    @Override
 +    public boolean createExplosion(Entity source, Location loc, float power, boolean setFire, boolean breakBlocks) {
 +        return !world.explode(source != null ? ((org.bukkit.craftbukkit.entity.CraftEntity) source).getHandle() : null, loc.getX(), loc.getY(), loc.getZ(), power, setFire, breakBlocks ? Explosion.BlockInteraction.BREAK : Explosion.BlockInteraction.NONE).wasCanceled;
 +    }
diff --git a/patches/server-remapped/Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch
similarity index 81%
rename from patches/server-remapped/Expand-World.spawnParticle-API-and-add-Builder.patch
rename to patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch
index ccd4a8a28c..2da3b724db 100644
--- a/patches/server-remapped/Expand-World.spawnParticle-API-and-add-Builder.patch
+++ b/patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch
@@ -13,15 +13,6 @@ 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 net.minecraft.world.level.Level implements Worl
-     public final Int2ObjectMap<Entity> entitiesById = new Int2ObjectLinkedOpenHashMap();
-     private final Map<UUID, Entity> entitiesByUuid = Maps.newHashMap();
-     private final Queue<Entity> toAddAfterTick = Queues.newArrayDeque();
--    private final List<ServerPlayer> players = Lists.newArrayList();
-+    public final List<ServerPlayer> players = Lists.newArrayList(); // Paper - private -> public
-     public final ServerChunkCache chunkSource; // Paper - public
-     boolean tickingEntities;
-     private final MinecraftServer server;
 @@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
      }
  
@@ -58,9 +49,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          if (data != null && !particle.getDataType().isInstance(data)) {
              throw new IllegalArgumentException("data should be " + particle.getDataType() + " got " + data.getClass());
          }
-         getHandle().sendParticles(
+         this.getHandle().sendParticles(
 -                null, // Sender
-+                receivers == null ? getHandle().players : receivers.stream().map(player -> ((CraftPlayer) player).getHandle()).collect(java.util.stream.Collectors.toList()), // Paper -  Particle API Expansion
++                receivers == null ? getHandle().players() : receivers.stream().map(player -> ((CraftPlayer) player).getHandle()).collect(java.util.stream.Collectors.toList()), // Paper -  Particle API Expansion
 +                sender != null ? ((CraftPlayer) sender).getHandle() : null, // Sender // Paper - Particle API Expansion
                  CraftParticle.toNMS(particle, data), // Particle
                  x, y, z, // Position
diff --git a/patches/server-remapped/Fix-CraftEntity-hashCode.patch b/patches/server/Fix-CraftEntity-hashCode.patch
similarity index 100%
rename from patches/server-remapped/Fix-CraftEntity-hashCode.patch
rename to patches/server/Fix-CraftEntity-hashCode.patch
diff --git a/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch
new file mode 100644
index 0000000000..22843cfba5
--- /dev/null
+++ b/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch
@@ -0,0 +1,22 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: 0x22 <0x22@futureclient.net>
+Date: Thu, 26 Apr 2018 04:41:11 -0400
+Subject: [PATCH] Fix exploit that allowed colored signs to be created
+
+
+diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- 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 implements ServerPlayerConnection, Ser
+ 
+             for (int i = 0; i < list.size(); ++i) {
+                 if (this.player.isTextFilteringEnabled()) {
+-                    lines.add(net.kyori.adventure.text.Component.text(list.get(i).getFiltered()));
++                    lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(list.get(i).getFiltered())));
+                 } else {
+-                    lines.add(net.kyori.adventure.text.Component.text(list.get(i).getRaw()));
++                    lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(list.get(i).getRaw())));
+                 }
+             }
+             SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.cserver.getPlayer(this.player), lines);
diff --git a/patches/server-remapped/Flag-to-disable-the-channel-limit.patch b/patches/server/Flag-to-disable-the-channel-limit.patch
similarity index 80%
rename from patches/server-remapped/Flag-to-disable-the-channel-limit.patch
rename to patches/server/Flag-to-disable-the-channel-limit.patch
index c4e90c1828..e73ce09e34 100644
--- a/patches/server-remapped/Flag-to-disable-the-channel-limit.patch
+++ b/patches/server/Flag-to-disable-the-channel-limit.patch
@@ -24,8 +24,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      }
  
      public void addChannel(String channel) {
--        Preconditions.checkState(channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel);
-+        Preconditions.checkState(DISABLE_CHANNEL_LIMIT || channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel); // Paper - flag to disable channel limit
+-        Preconditions.checkState(this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel);
++        Preconditions.checkState(DISABLE_CHANNEL_LIMIT || this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel); // Paper - flag to disable channel limit
          channel = StandardMessenger.validateAndCorrectChannel(channel);
-         if (channels.add(channel)) {
+         if (this.channels.add(channel)) {
              server.getPluginManager().callEvent(new PlayerRegisterChannelEvent(this, channel));
diff --git a/patches/server-remapped/Implement-EntityKnockbackByEntityEvent.patch b/patches/server/Implement-EntityKnockbackByEntityEvent.patch
similarity index 64%
rename from patches/server-remapped/Implement-EntityKnockbackByEntityEvent.patch
rename to patches/server/Implement-EntityKnockbackByEntityEvent.patch
index 7ef813ae81..bfad137387 100644
--- a/patches/server-remapped/Implement-EntityKnockbackByEntityEvent.patch
+++ b/patches/server/Implement-EntityKnockbackByEntityEvent.patch
@@ -12,9 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
                      }
  
-                     this.hurtDir = (float) (Mth.atan2(d1, d0) * 57.2957763671875D - (double) this.yRot);
--                    this.knockback(0.4F, d0, d1);
-+                    this.doKnockback(0.4F, d0, d1, entity1); // Paper
+                     this.hurtDir = (float) (Mth.atan2(d1, d0) * 57.2957763671875D - (double) this.getYRot());
+-                    this.knockback(0.4000000059604645D, d0, d1);
++                    this.knockback(0.4000000059604645D, d0, d1, entity1);
                  } else {
                      this.hurtDir = (float) ((int) (Math.random() * 2.0D) * 180);
                  }
@@ -22,34 +22,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      }
  
      protected void blockedByShield(LivingEntity target) {
--        target.knockback(0.5F, target.getX() - this.getX(), target.getZ() - this.getZ());
-+        target.doKnockback(0.5F, target.getX() - this.getX(), target.getZ() - this.getZ(), this); // Paper
+-        target.knockback(0.5D, target.getX() - this.getX(), target.getZ() - this.getZ());
++        target.knockback(0.5D, target.getX() - this.getX(), target.getZ() - this.getZ(), this);
      }
  
      private boolean checkTotemDeathProtection(DamageSource source) {
 @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
      }
  
-     public void knockback(float f, double d0, double d1) {
+     public void knockback(double strength, double x, double z) {
 +        // Paper start - add knockbacking entity parameter
-+        this.doKnockback(f, d0, d1, null);
++        this.knockback(strength, x, z, null);
 +    }
-+    public void doKnockback(float f, double d0, double d1, Entity knockingBackEntity) {
++    public void knockback(double strength, double x, double z, Entity knockingBackEntity) {
 +        // Paper end - add knockbacking entity parameter
-         f = (float) ((double) f * (1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)));
-         if (f > 0.0F) {
+         strength *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
+         if (strength > 0.0D) {
              this.hasImpulse = true;
 @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
-             Vec3 vec3d1 = (new Vec3(d0, 0.0D, d1)).normalize().scale((double) f);
+             Vec3 vec3d1 = (new Vec3(x, 0.0D, z)).normalize().scale(strength);
  
-             this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + (double) f) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
-+
+             this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + strength) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
 +            // Paper start - call EntityKnockbackByEntityEvent
-+            Vec3 currentMot = this.getDeltaMovement();
-+            org.bukkit.util.Vector delta = new org.bukkit.util.Vector(currentMot.x - vec3d.x, currentMot.y - vec3d.y, currentMot.z - vec3d.z);
++            Vec3 currentMovement = this.getDeltaMovement();
++            org.bukkit.util.Vector delta = new org.bukkit.util.Vector(currentMovement.x - vec3d.x, currentMovement.y - vec3d.y, currentMovement.z - vec3d.z);
 +            // Restore old velocity to be able to access it in the event
 +            this.setDeltaMovement(vec3d);
-+            if (knockingBackEntity == null || new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent((org.bukkit.entity.LivingEntity) getBukkitEntity(), knockingBackEntity.getBukkitEntity(), f, delta).callEvent()) {
++            if (knockingBackEntity == null || new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent((org.bukkit.entity.LivingEntity) getBukkitEntity(), knockingBackEntity.getBukkitEntity(), (float) strength, delta).callEvent()) {
 +                this.setDeltaMovement(vec3d.x + delta.getX(), vec3d.y + delta.getY(), vec3d.z + delta.getZ());
 +            }
 +            // Paper end
@@ -64,8 +63,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
          if (flag) {
              if (f1 > 0.0F && target instanceof LivingEntity) {
--                ((LivingEntity) target).knockback(f1 * 0.5F, (double) Mth.sin(this.yRot * 0.017453292F), (double) (-Mth.cos(this.yRot * 0.017453292F)));
-+                ((LivingEntity) target).doKnockback(f1 * 0.5F, (double) Mth.sin(this.yRot * 0.017453292F), (double) (-Mth.cos(this.yRot * 0.017453292F)), this); // Paper
+-                ((LivingEntity) target).knockback((double) (f1 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)));
++                ((LivingEntity) target).knockback((double) (f1 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this); // Paper
                  this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
              }
  
@@ -77,17 +76,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
                      if (flag5) {
                          if (i > 0) {
                              if (target instanceof LivingEntity) {
--                                ((LivingEntity) target).knockback((float) i * 0.5F, (double) Mth.sin(this.yRot * 0.017453292F), (double) (-Mth.cos(this.yRot * 0.017453292F)));
-+                                ((LivingEntity) target).doKnockback((float) i * 0.5F, (double) Mth.sin(this.yRot * 0.017453292F), (double) (-Mth.cos(this.yRot * 0.017453292F)), this); // Paper
+-                                ((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)));
++                                ((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this); // Paper
                              } else {
-                                 target.push((double) (-Mth.sin(this.yRot * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.yRot * 0.017453292F) * (float) i * 0.5F));
+                                 target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F));
                              }
 @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
                                  if (entityliving != this && entityliving != target && !this.isAlliedTo(entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
                                      // CraftBukkit start - Only apply knockback if the damage hits
                                      if (entityliving.hurt(DamageSource.playerAttack(this).sweep(), f4)) {
--                                    entityliving.knockback(0.4F, (double) Mth.sin(this.yRot * 0.017453292F), (double) (-Mth.cos(this.yRot * 0.017453292F)));
-+                                    entityliving.doKnockback(0.4F, (double) Mth.sin(this.yRot * 0.017453292F), (double) (-Mth.cos(this.yRot * 0.017453292F)), this); // Paper
+-                                    entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)));
++                                    entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this); // Paper
                                      }
                                      // CraftBukkit end
                                  }
diff --git a/patches/server-remapped/Implement-EntityTeleportEndGatewayEvent.patch b/patches/server/Implement-EntityTeleportEndGatewayEvent.patch
similarity index 78%
rename from patches/server-remapped/Implement-EntityTeleportEndGatewayEvent.patch
rename to patches/server/Implement-EntityTeleportEndGatewayEvent.patch
index d24fdd5b53..c58488a4f5 100644
--- a/patches/server-remapped/Implement-EntityTeleportEndGatewayEvent.patch
+++ b/patches/server/Implement-EntityTeleportEndGatewayEvent.patch
@@ -8,25 +8,25 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayB
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
 +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
-@@ -0,0 +0,0 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity implements
+@@ -0,0 +0,0 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
  
                  }
                  // CraftBukkit end
 +                // Paper start - EntityTeleportEndGatewayEvent - replicated from above
 +                org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity = entity.getBukkitEntity();
-+                org.bukkit.Location location = new Location(level.getWorld(), (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D);
++                org.bukkit.Location location = new Location(world.getWorld(), (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D);
 +                location.setPitch(bukkitEntity.getLocation().getPitch());
 +                location.setYaw(bukkitEntity.getLocation().getYaw());
 +
-+                com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent event = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(bukkitEntity, bukkitEntity.getLocation(), location, new org.bukkit.craftbukkit.block.CraftEndGateway(MCUtil.toLocation(level, this.getBlockPos()).getBlock()));
++                com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent event = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(bukkitEntity, bukkitEntity.getLocation(), location, new org.bukkit.craftbukkit.block.CraftEndGateway(MCUtil.toLocation(world, blockEntity.getBlockPos()).getBlock()));
 +                if (!event.callEvent()) {
 +                    return;
 +                }
 +                // Paper end
  
                  entity1.setPortalCooldown();
--                entity1.teleportToWithTicket((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D);
+-                entity1.teleportToWithTicket((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D);
 +                entity1.teleportToWithTicket(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()); // Paper
              }
  
-             this.triggerCooldown();
+             TheEndGatewayBlockEntity.triggerCooldown(world, pos, state, blockEntity);
diff --git a/patches/server-remapped/Implement-World.getEntity-UUID-API.patch b/patches/server/Implement-World.getEntity-UUID-API.patch
similarity index 100%
rename from patches/server-remapped/Implement-World.getEntity-UUID-API.patch
rename to patches/server/Implement-World.getEntity-UUID-API.patch
diff --git a/patches/server/Improve-EntityShootBowEvent.patch b/patches/server/Improve-EntityShootBowEvent.patch
new file mode 100644
index 0000000000..b5f98ee1c2
--- /dev/null
+++ b/patches/server/Improve-EntityShootBowEvent.patch
@@ -0,0 +1,96 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aikar <aikar@aikar.co>
+Date: Sat, 15 Jun 2013 19:51:17 -0400
+Subject: [PATCH] Improve EntityShootBowEvent
+
+Adds missing call to Illagers and also adds Arrow ItemStack to skeltons
+
+diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
++++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+@@ -0,0 +0,0 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
+ 
+         entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4));
+         // CraftBukkit start
+-        org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), null, entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true);
++        org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper
+         if (event.isCancelled()) {
+             event.getProjectile().remove();
+             return;
+diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
++++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
+@@ -0,0 +0,0 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
+         double d3 = Math.sqrt(d0 * d0 + d2 * d2);
+ 
+         entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4));
++        // Paper start
++        org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, target.getUsedItemHand(), 0.8F, true);
++        if (event.isCancelled()) {
++            event.getProjectile().remove();
++            return;
++        }
++
++        if (event.getProjectile() == entityarrow.getBukkitEntity()) {
++            this.level.addFreshEntity(entityarrow);
++        }
+         this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
+-        this.level.addFreshEntity(entityarrow);
++        // Paper end
+     }
+ 
+     @Override
+diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
++++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+@@ -0,0 +0,0 @@ public abstract class AbstractArrow extends Projectile {
+         }
+     }
+ 
+-    protected abstract ItemStack getPickupItem();
++    public abstract ItemStack getPickupItem(); // Paper - protected -> public
+ 
+     @Override
+     protected Entity.MovementEmission getMovementEmission() {
+diff --git a/src/main/java/net/minecraft/world/entity/projectile/Arrow.java b/src/main/java/net/minecraft/world/entity/projectile/Arrow.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/main/java/net/minecraft/world/entity/projectile/Arrow.java
++++ b/src/main/java/net/minecraft/world/entity/projectile/Arrow.java
+@@ -0,0 +0,0 @@ public class Arrow extends AbstractArrow {
+     }
+ 
+     @Override
+-    protected ItemStack getPickupItem() {
++    public ItemStack getPickupItem() { // Paper - protected -> public
+         if (this.effects.isEmpty() && this.potion == Potions.EMPTY) {
+             return new ItemStack(Items.ARROW);
+         } else {
+diff --git a/src/main/java/net/minecraft/world/entity/projectile/SpectralArrow.java b/src/main/java/net/minecraft/world/entity/projectile/SpectralArrow.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/main/java/net/minecraft/world/entity/projectile/SpectralArrow.java
++++ b/src/main/java/net/minecraft/world/entity/projectile/SpectralArrow.java
+@@ -0,0 +0,0 @@ public class SpectralArrow extends AbstractArrow {
+     }
+ 
+     @Override
+-    protected ItemStack getPickupItem() {
++    public ItemStack getPickupItem() { // Paper - protected -> public
+         return new ItemStack(Items.SPECTRAL_ARROW);
+     }
+ 
+diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
++++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
+@@ -0,0 +0,0 @@ public class ThrownTrident extends AbstractArrow {
+     }
+ 
+     @Override
+-    protected ItemStack getPickupItem() {
++    public ItemStack getPickupItem() { // Paper - protected -> public
+         return this.tridentItem.copy();
+     }
+ 
diff --git a/patches/server-remapped/InventoryCloseEvent-Reason-API.patch b/patches/server/InventoryCloseEvent-Reason-API.patch
similarity index 81%
rename from patches/server-remapped/InventoryCloseEvent-Reason-API.patch
rename to patches/server/InventoryCloseEvent-Reason-API.patch
index bc523d1544..10f05a18e5 100644
--- a/patches/server-remapped/InventoryCloseEvent-Reason-API.patch
+++ b/patches/server/InventoryCloseEvent-Reason-API.patch
@@ -20,19 +20,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              }
          }
 @@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
-         // Spigot Start
-         if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) {
-             for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {
--                h.closeInventory();
-+                h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
+             // Spigot Start
+             if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) {
+                 for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) {
+-                    h.closeInventory();
++                    h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper
+                 }
              }
-         }
-         // Spigot End
+             // Spigot End
 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
 +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
-@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
+@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
          }
          // Paper end
          if (!this.level.isClientSide && !this.containerMenu.stillValid(this)) {
@@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              this.containerMenu = this.inventoryMenu;
          }
  
-@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
+@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
  
          // SPIGOT-943 - only call if they have an inventory open
          if (this.containerMenu != this.inventoryMenu) {
@@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          }
  
          net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure
-@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
+@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
              return OptionalInt.empty();
          } else {
              if (this.containerMenu != this.inventoryMenu) {
@@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              }
  
              this.nextContainerCounter();
-@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
+@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
          }
          // CraftBukkit end
          if (this.containerMenu != this.inventoryMenu) {
@@ -68,15 +68,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          }
  
          // this.nextContainerCounter(); // CraftBukkit - moved up
-@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
+@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
  
      @Override
      public void closeContainer() {
 -        CraftEventFactory.handleInventoryCloseEvent(this); // CraftBukkit
 +        // Paper start
-+        closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNKNOWN);
++        this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNKNOWN);
 +    }
-+    public void closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
++    @Override
++    public void closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
 +        CraftEventFactory.handleInventoryCloseEvent(this, reason); // CraftBukkit
 +        // Paper end
          this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId));
@@ -94,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  import org.bukkit.event.inventory.InventoryCreativeEvent;
  import org.bukkit.event.inventory.InventoryType.SlotType;
  import org.bukkit.event.inventory.SmithItemEvent;
-@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
+@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
  
      @Override
      public void handleContainerClose(ServerboundContainerClosePacket packet) {
@@ -124,7 +125,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +            entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper
          }
  
-         PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), 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())));
+         PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), 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())));
 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
@@ -139,11 +140,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          }
  
 @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity {
-         return 20;
+ 
      }
  
 +    // Paper start - unused code, but to keep signatures aligned
-+    public void closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
++    public void closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
 +        closeContainer();
 +        this.containerMenu = this.inventoryMenu;
 +    }
@@ -157,22 +158,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
 @@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
-         if (((ServerPlayer) getHandle()).connection == null) return;
-         if (getHandle().containerMenu != getHandle().inventoryMenu) {
+         if (((ServerPlayer) this.getHandle()).connection == null) return;
+         if (this.getHandle().containerMenu != this.getHandle().inventoryMenu) {
              // fire INVENTORY_CLOSE if one already open
--            ((ServerPlayer) getHandle()).connection.handleContainerClose(new ServerboundContainerClosePacket(getHandle().containerMenu.containerId));
-+            ((ServerPlayer) getHandle()).connection.handleContainerClose(new ServerboundContainerClosePacket(getHandle().containerMenu.containerId), org.bukkit.event.inventory.InventoryCloseEvent.Reason.OPEN_NEW); // Paper
+-            ((ServerPlayer) this.getHandle()).connection.handleContainerClose(new ServerboundContainerClosePacket(this.getHandle().containerMenu.containerId));
++            ((ServerPlayer) this.getHandle()).connection.handleContainerClose(new ServerboundContainerClosePacket(this.getHandle().containerMenu.containerId), org.bukkit.event.inventory.InventoryCloseEvent.Reason.OPEN_NEW); // Paper
          }
-         ServerPlayer player = (ServerPlayer) getHandle();
+         ServerPlayer player = (ServerPlayer) this.getHandle();
          AbstractContainerMenu container;
 @@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
  
      @Override
      public void closeInventory() {
--        getHandle().closeContainer();
+-        this.getHandle().closeContainer();
++        this.getHandle().closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.PLUGIN);
++        getHandle().closeContainer();
 +        // Paper start
 +        getHandle().closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.PLUGIN);
      }
++    @Override
 +    public void closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
 +        getHandle().closeContainer(reason);
 +    }
@@ -187,9 +191,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
  
          // Close any foreign inventory
-         if (getHandle().containerMenu != getHandle().inventoryMenu) {
--            getHandle().closeContainer();
-+            getHandle().closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.TELEPORT); // Paper
+         if (this.getHandle().containerMenu != this.getHandle().inventoryMenu) {
+-            this.getHandle().closeContainer();
++            this.getHandle().closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.TELEPORT); // Paper
          }
  
          // Check if the fromWorld and toWorld are the same.
diff --git a/patches/server-remapped/ItemStack-getMaxItemUseDuration.patch b/patches/server/ItemStack-getMaxItemUseDuration.patch
similarity index 54%
rename from patches/server-remapped/ItemStack-getMaxItemUseDuration.patch
rename to patches/server/ItemStack-getMaxItemUseDuration.patch
index f99ea6a186..c2e14fceb8 100644
--- a/patches/server-remapped/ItemStack-getMaxItemUseDuration.patch
+++ b/patches/server/ItemStack-getMaxItemUseDuration.patch
@@ -5,30 +5,18 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration
 
 Allows you to determine how long it takes to use a usable/consumable item
 
-diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
-index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/net/minecraft/world/item/ItemStack.java
-+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
-@@ -0,0 +0,0 @@ public final class ItemStack {
-         this.getItem().onCraftedBy(this, world, player);
-     }
- 
-+    public int getItemUseMaxDuration() { return getUseDuration(); } // Paper - OBFHELPER
-     public int getUseDuration() {
-         return this.getItem().getUseDuration(this);
-     }
 diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
 +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
 @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack {
-         return (handle == null) ? Material.AIR.getMaxStackSize() : handle.getItem().getMaxStackSize();
+         return (this.handle == null) ? Material.AIR.getMaxStackSize() : this.handle.getItem().getMaxStackSize();
      }
  
 +    // Paper start
 +    @Override
 +    public int getMaxItemUseDuration() {
-+        return handle == null ? 0 : handle.getItemUseMaxDuration();
++        return handle == null ? 0 : handle.getUseDuration();
 +    }
 +    // Paper end
 +
diff --git a/patches/server-remapped/LivingEntity-Hand-Raised-Item-Use-API.patch b/patches/server/LivingEntity-Hand-Raised-Item-Use-API.patch
similarity index 50%
rename from patches/server-remapped/LivingEntity-Hand-Raised-Item-Use-API.patch
rename to patches/server/LivingEntity-Hand-Raised-Item-Use-API.patch
index 382866e1ab..e948b54b5d 100644
--- a/patches/server-remapped/LivingEntity-Hand-Raised-Item-Use-API.patch
+++ b/patches/server/LivingEntity-Hand-Raised-Item-Use-API.patch
@@ -5,32 +5,6 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API
 
 How long an entity has raised hands to charge an attack or use an item
 
-diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
-index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
-+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
-@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
-     private float speed;
-     private int noJumpDelay;
-     private float absorptionAmount;
--    protected ItemStack useItem;
-+    public ItemStack useItem; // Paper - public
-     protected int useItemRemaining;
-     protected int fallFlyTicks;
-     private BlockPos lastPos;
-@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
-         return this.useItem;
-     }
- 
-+    public int getItemUseRemainingTime() { return this.getUseItemRemainingTicks(); } // Paper - OBFHELPER
-     public int getUseItemRemainingTicks() {
-         return this.useItemRemaining;
-     }
- 
-+    public int getHandRaisedTime() { return this.getTicksUsingItem(); } // Paper - OBFHELPER
-     public int getTicksUsingItem() {
-         return this.isUsingItem() ? this.useItem.getUseDuration() - this.getUseItemRemainingTicks() : 0;
-     }
 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -42,17 +16,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +
 +    @Override
 +    public ItemStack getActiveItem() {
-+        return getHandle().useItem.asBukkitMirror();
++        return getHandle().getUseItem().asBukkitMirror();
 +    }
 +
 +    @Override
 +    public int getItemUseRemainingTime() {
-+        return getHandle().getItemUseRemainingTime();
++        return getHandle().getUseItemRemainingTicks();
 +    }
 +
 +    @Override
 +    public int getHandRaisedTime() {
-+        return getHandle().getHandRaisedTime();
++        return getHandle().getTicksUsingItem();
 +    }
 +
 +    @Override
diff --git a/patches/server-remapped/Make-legacy-ping-handler-more-reliable.patch b/patches/server/Make-legacy-ping-handler-more-reliable.patch
similarity index 85%
rename from patches/server-remapped/Make-legacy-ping-handler-more-reliable.patch
rename to patches/server/Make-legacy-ping-handler-more-reliable.patch
index 10daa114a5..ce41bcd2af 100644
--- a/patches/server-remapped/Make-legacy-ping-handler-more-reliable.patch
+++ b/patches/server/Make-legacy-ping-handler-more-reliable.patch
@@ -32,15 +32,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
 +++ b/src/main/java/net/minecraft/server/network/LegacyQueryHandler.java
 @@ -0,0 +0,0 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
- 
      private static final Logger LOGGER = LogManager.getLogger();
+     public static final int FAKE_PROTOCOL_VERSION = 127;
      private final ServerConnectionListener serverConnectionListener;
 +    private ByteBuf buf; // Paper
  
      public LegacyQueryHandler(ServerConnectionListener networkIo) {
          this.serverConnectionListener = networkIo;
 @@ -0,0 +0,0 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
-     public void channelRead(ChannelHandlerContext channelhandlercontext, Object object) throws Exception {
+     public void channelRead(ChannelHandlerContext channelhandlercontext, Object object) {
          ByteBuf bytebuf = (ByteBuf) object;
  
 +        // Paper start - Make legacy ping handler more reliable
@@ -68,19 +68,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
                      flag1 &= bytebuf.readUnsignedByte() == 250;
 @@ -0,0 +0,0 @@ public class LegacyQueryHandler extends ChannelInboundHandlerAdapter {
-                         return;
-                     }
- 
--                    LegacyQueryHandler.LOGGER.debug("Ping: (1.6) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
--                    String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, minecraftserver.getServerVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()); // CraftBukkit
--                    ByteBuf bytebuf1 = this.createReply(s1);
-+                    LegacyPingHandler.LOGGER.debug("Ping: (1.6) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
-+                    String s1 = String.format("\u00a71\u0000%d\u0000%s\u0000%s\u0000%d\u0000%d", 127, minecraftserver.getVersion(), event.getMotd(), event.getNumPlayers(), event.getMaxPlayers()); // CraftBukkit
-+                    ByteBuf bytebuf1 = this.a(s1);
- 
-                     try {
--                        this.sendFlushAndClose(channelhandlercontext, bytebuf1);
-+                        this.a(channelhandlercontext, bytebuf1);
                      } finally {
                          bytebuf1.release();
                      }
diff --git a/patches/server-remapped/Make-player-data-saving-configurable.patch b/patches/server/Make-player-data-saving-configurable.patch
similarity index 100%
rename from patches/server-remapped/Make-player-data-saving-configurable.patch
rename to patches/server/Make-player-data-saving-configurable.patch
diff --git a/patches/server-remapped/Make-shield-blocking-delay-configurable.patch b/patches/server/Make-shield-blocking-delay-configurable.patch
similarity index 92%
rename from patches/server-remapped/Make-shield-blocking-delay-configurable.patch
rename to patches/server/Make-shield-blocking-delay-configurable.patch
index b761ee1050..8e28491bb0 100644
--- a/patches/server-remapped/Make-shield-blocking-delay-configurable.patch
+++ b/patches/server/Make-shield-blocking-delay-configurable.patch
@@ -31,10 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          } else {
              return false;
          }
-@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity {
-     public void broadcastBreakEvent(InteractionHand hand) {
-         this.broadcastBreakEvent(hand == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND);
      }
+ 
 +    // Paper start
 +    public int shieldBlockingDelay = level.paperConfig.shieldBlockingDelay;
 +
@@ -46,7 +44,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        this.shieldBlockingDelay = shieldBlockingDelay;
 +    }
 +    // Paper end
- }
++
+     public boolean isSuppressingSlidingDownLadder() {
+         return this.isShiftKeyDown();
+     }
 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
diff --git a/patches/server-remapped/PlayerReadyArrowEvent.patch b/patches/server/PlayerReadyArrowEvent.patch
similarity index 100%
rename from patches/server-remapped/PlayerReadyArrowEvent.patch
rename to patches/server/PlayerReadyArrowEvent.patch
diff --git a/patches/server/Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/patches/server/Prevent-Frosted-Ice-from-loading-holding-chunks.patch
new file mode 100644
index 0000000000..96141e1259
--- /dev/null
+++ b/patches/server/Prevent-Frosted-Ice-from-loading-holding-chunks.patch
@@ -0,0 +1,33 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aikar <aikar@aikar.co>
+Date: Sat, 10 Mar 2018 16:33:15 -0500
+Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks
+
+1.17: Shouldn't be needed as blocks no longer tick without at least 1 radius chunk loaded.
+
+diff --git a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
++++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
+@@ -0,0 +0,0 @@ public class FrostedIceBlock extends IceBlock {
+ 
+             for(Direction direction : Direction.values()) {
+                 mutableBlockPos.setWithOffset(pos, direction);
+-                BlockState blockState = world.getBlockState(mutableBlockPos);
++                BlockState blockState = world.getTypeIfLoaded(mutableBlockPos); // Paper
++                if (blockState == null) { continue; } // Paper
+                 if (blockState.is(this) && !this.slightlyMelt(blockState, world, mutableBlockPos)) {
+                     world.getBlockTicks().scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
+                 }
+@@ -0,0 +0,0 @@ public class FrostedIceBlock extends IceBlock {
+ 
+         for(Direction direction : Direction.values()) {
+             mutableBlockPos.setWithOffset(pos, direction);
+-            if (world.getBlockState(mutableBlockPos).is(this)) {
++            // Paper start
++            BlockState blockState = world.getTypeIfLoaded(mutableBlockPos);
++            if (blockState != null && blockState.is(this)) {
++                // Paper end
+                 ++i;
+                 if (i >= maxNeighbors) {
+                     return false;
diff --git a/patches/server-remapped/Print-Error-details-when-failing-to-save-player-data.patch b/patches/server/Print-Error-details-when-failing-to-save-player-data.patch
similarity index 81%
rename from patches/server-remapped/Print-Error-details-when-failing-to-save-player-data.patch
rename to patches/server/Print-Error-details-when-failing-to-save-player-data.patch
index c9f7efb316..73c235e1a0 100644
--- a/patches/server-remapped/Print-Error-details-when-failing-to-save-player-data.patch
+++ b/patches/server/Print-Error-details-when-failing-to-save-player-data.patch
@@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
              Util.safeReplaceFile(file1, file, file2);
          } catch (Exception exception) {
--            PlayerDataStorage.LOGGER.warn("Failed to save player data for {}", entityhuman.getName().getString());
-+            PlayerDataStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getScoreboardName(), exception); // Paper
+-            PlayerDataStorage.LOGGER.warn("Failed to save player data for {}", player.getName().getString());
++            PlayerDataStorage.LOGGER.warn("Failed to save player data for {}", player.getScoreboardName(), exception); // Paper
          }
  
      }
diff --git a/patches/server/Provide-E-TE-Chunk-count-stat-methods.patch b/patches/server/Provide-E-TE-Chunk-count-stat-methods.patch
index f08c8bcb3a..e6b047ed44 100644
--- a/patches/server/Provide-E-TE-Chunk-count-stat-methods.patch
+++ b/patches/server/Provide-E-TE-Chunk-count-stat-methods.patch
@@ -6,19 +6,6 @@ Subject: [PATCH] Provide E/TE/Chunk count stat methods
 Provides counts without the ineffeciency of using .getEntities().size()
 which creates copy of the collections.
 
-diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
-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 net.minecraft.world.level.Level implements Worl
-     public static final BlockPos END_SPAWN_POINT = new BlockPos(100, 50, 0);
-     private static final Logger LOGGER = LogManager.getLogger();
-     private static final int EMPTY_TIME_NO_TICK = 300;
--    final List<ServerPlayer> players;
-+    final List<ServerPlayer> players; public final int getPlayerListSize() { return this.players.size(); } // Paper
-     public final ServerChunkCache chunkSource; // Paper - public
-     private final MinecraftServer server;
-     public final PrimaryLevelData serverLevelData; // CraftBukkit - type
 diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/level/Level.java
@@ -87,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +
 +    @Override
 +    public int getPlayerCount() {
-+        return world.getPlayerListSize();
++        return world.players().size();
 +    }
 +    // Paper end
 +
diff --git a/patches/server-remapped/RangedEntity-API.patch b/patches/server/RangedEntity-API.patch
similarity index 95%
rename from patches/server-remapped/RangedEntity-API.patch
rename to patches/server/RangedEntity-API.patch
index 1442fdbd6a..3bb292c6af 100644
--- a/patches/server-remapped/RangedEntity-API.patch
+++ b/patches/server/RangedEntity-API.patch
@@ -35,10 +35,10 @@ diff --git a/src/main/java/net/minecraft/world/entity/monster/RangedAttackMob.ja
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/entity/monster/RangedAttackMob.java
 +++ b/src/main/java/net/minecraft/world/entity/monster/RangedAttackMob.java
-@@ -0,0 +0,0 @@ import net.minecraft.world.entity.LivingEntity;
+@@ -0,0 +0,0 @@ package net.minecraft.world.entity.monster;
+ import net.minecraft.world.entity.LivingEntity;
  
  public interface RangedAttackMob {
- 
 -    void performRangedAttack(LivingEntity target, float pullProgress);
 +    void performRangedAttack(LivingEntity target, float pullProgress); default void rangedAttack(LivingEntity entityliving, float f) { performRangedAttack(entityliving, f); } // Paper - OBFHELPER
 +
@@ -75,19 +75,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/m
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
-@@ -0,0 +0,0 @@
- package org.bukkit.craftbukkit.entity;
- 
-+import com.destroystokyo.paper.entity.CraftRangedEntity;
- import com.google.common.base.Preconditions;
- import org.bukkit.craftbukkit.CraftServer;
- import org.bukkit.craftbukkit.inventory.CraftInventoryLlama;
 @@ -0,0 +0,0 @@ import org.bukkit.entity.Llama;
  import org.bukkit.entity.Llama.Color;
  import org.bukkit.inventory.LlamaInventory;
  
 -public class CraftLlama extends CraftChestedHorse implements Llama {
-+public class CraftLlama extends CraftChestedHorse implements Llama, CraftRangedEntity<net.minecraft.world.entity.animal.horse.Llama> { // Paper
++public class CraftLlama extends CraftChestedHorse implements Llama, com.destroystokyo.paper.entity.CraftRangedEntity<net.minecraft.world.entity.animal.horse.Llama> { // Paper
  
      public CraftLlama(CraftServer server, net.minecraft.world.entity.animal.horse.Llama entity) {
          super(server, entity);
diff --git a/patches/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch b/patches/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch
new file mode 100644
index 0000000000..9e2b2334bd
--- /dev/null
+++ b/patches/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch
@@ -0,0 +1,19 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aikar <aikar@aikar.co>
+Date: Sun, 10 Jun 2018 01:18:49 -0400
+Subject: [PATCH] Unset Ignited flag on cancel of Explosion Event
+
+Otherwise the creeper infinite explodes
+
+diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
++++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+@@ -0,0 +0,0 @@ public class Creeper extends Monster implements PowerableMob {
+                 this.spawnLingeringCloud();
+             } else {
+                 this.swell = 0;
++                this.entityData.set(DATA_IS_IGNITED, Boolean.valueOf(false)); // Paper
+             }
+             // CraftBukkit end
+         }
diff --git a/patches/server-remapped/WitchConsumePotionEvent.patch b/patches/server/WitchConsumePotionEvent.patch
similarity index 95%
rename from patches/server-remapped/WitchConsumePotionEvent.patch
rename to patches/server/WitchConsumePotionEvent.patch
index b66a826692..c6402c6777 100644
--- a/patches/server-remapped/WitchConsumePotionEvent.patch
+++ b/patches/server/WitchConsumePotionEvent.patch
@@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 @@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob {
  
                      this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
-                     if (itemstack.getItem() == Items.POTION) {
+                     if (itemstack.is(Items.POTION)) {
 -                        List<MobEffectInstance> list = PotionUtils.getMobEffects(itemstack);
 +                        // Paper start
 +                        com.destroystokyo.paper.event.entity.WitchConsumePotionEvent event = new com.destroystokyo.paper.event.entity.WitchConsumePotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
diff --git a/patches/server-remapped/WitchReadyPotionEvent.patch b/patches/server/WitchReadyPotionEvent.patch
similarity index 100%
rename from patches/server-remapped/WitchReadyPotionEvent.patch
rename to patches/server/WitchReadyPotionEvent.patch
diff --git a/patches/server-remapped/WitchThrowPotionEvent.patch b/patches/server/WitchThrowPotionEvent.patch
similarity index 92%
rename from patches/server-remapped/WitchThrowPotionEvent.patch
rename to patches/server/WitchThrowPotionEvent.patch
index 5fefb4eaac..74fc80827d 100644
--- a/patches/server-remapped/WitchThrowPotionEvent.patch
+++ b/patches/server/WitchThrowPotionEvent.patch
@@ -25,6 +25,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 -            entitypotion.setItem(PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), potionregistry));
 +            entitypotion.setItem(potion);
 +            // Paper end
-             entitypotion.xRot -= -20.0F;
-             entitypotion.shoot(d0, d1 + (double) (f1 * 0.2F), d2, 0.75F, 8.0F);
+             entitypotion.setXRot(entitypotion.getXRot() - -20.0F);
+             entitypotion.shoot(d0, d1 + d3 * 0.2D, d2, 0.75F, 8.0F);
              if (!this.isSilent()) {
diff --git a/patches/server-remapped/getPlayerUniqueId-API.patch b/patches/server/getPlayerUniqueId-API.patch
similarity index 100%
rename from patches/server-remapped/getPlayerUniqueId-API.patch
rename to patches/server/getPlayerUniqueId-API.patch