--- a/net/minecraft/server/network/PlayerChunkSender.java
+++ b/net/minecraft/server/network/PlayerChunkSender.java
@@ -43,11 +43,23 @@
 
     public void dropChunk(ServerPlayer player, ChunkPos pos) {
         if (!this.pendingChunks.remove(pos.toLong()) && player.isAlive()) {
-            player.connection.send(new ClientboundForgetLevelChunkPacket(pos));
+            // Paper start - rewrite player chunk loader
+           dropChunkStatic(player, pos);
         }
     }
+    public static void dropChunkStatic(ServerPlayer player, ChunkPos pos) {
+            player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(pos.toLong()).removePlayer(player);
+            player.connection.send(new ClientboundForgetLevelChunkPacket(pos));
+            // Paper start - PlayerChunkUnloadEvent
+            if (io.papermc.paper.event.packet.PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0) {
+                new io.papermc.paper.event.packet.PlayerChunkUnloadEvent(player.getBukkitEntity().getWorld().getChunkAt(pos.longKey), player.getBukkitEntity()).callEvent();
+            }
+            // Paper end - PlayerChunkUnloadEvent
+    }
+    // Paper end - rewrite player chunk loader
 
     public void sendNextChunks(ServerPlayer player) {
+        if (true) return; // Paper - rewrite player chunk loader
         if (this.unacknowledgedBatches < this.maxUnacknowledgedBatches) {
             float f = Math.max(1.0F, this.desiredChunksPerTick);
             this.batchQuota = Math.min(this.batchQuota + this.desiredChunksPerTick, f);
@@ -73,8 +85,17 @@
         }
     }
 
-    private static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) {
-        handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null));
+    public static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { // Paper - rewrite chunk loader - public
+        handler.player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(chunk.getPos().toLong()).addPlayer(handler.player);
+        // Paper start - Anti-Xray
+        final boolean shouldModify = world.chunkPacketBlockController.shouldModify(handler.player, chunk);
+        handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null, shouldModify));
+        // Paper end - Anti-Xray
+        // Paper start - PlayerChunkLoadEvent
+        if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) {
+            new io.papermc.paper.event.packet.PlayerChunkLoadEvent(new org.bukkit.craftbukkit.CraftChunk(chunk), handler.getPlayer().getBukkitEntity()).callEvent();
+        }
+        // Paper end - PlayerChunkLoadEvent
         ChunkPos chunkPos = chunk.getPos();
         DebugPackets.sendPoiPacketsForChunk(world, chunkPos);
     }
@@ -108,6 +129,7 @@
     }
 
     public void onChunkBatchReceivedByClient(float desiredBatchSize) {
+        if (true) return; // Paper - rewrite player chunk loader
         this.unacknowledgedBatches--;
         this.desiredChunksPerTick = Double.isNaN((double)desiredBatchSize) ? 0.01F : Mth.clamp(desiredBatchSize, 0.01F, 64.0F);
         if (this.unacknowledgedBatches == 0) {
