From 502755d55a58542a92510fb73905d1fcee9895f8 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Wed, 25 Aug 2021 09:59:26 +0200
Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit/Spigot) (#6457)

Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
c9a46ebf #653: Add World#spawn with randomizeData parameter
e49c2e3a Damageable should extend ItemMeta
01ff04f4 SPIGOT-5880, SPIGOT-5567: New ChunkGenerator API
ca5b4b1a SPIGOT-6697: Deprecate generateTree with BlockChangeDelegate as it does not handle tiles

CraftBukkit Changes:
7c8bbcbe SPIGOT-6716: Preserve the order of stored enchantments of enchanted books.
18027d02 #914: Add World#spawn with randomizeData parameter
3cad0316 SPIGOT-6714: Don't fire PlayerBucketEvent when empty
8c6d60cf Fix server crash with BlockPopulator when entities are at a negative chunk border
4f6bcc84 SPIGOT-5880, SPIGOT-5567: New ChunkGenerator API
78d5b35b SPIGOT-6697: Restore generateTree with BlockChangeDelegate behaviour
15792f0d Rebuild patch
c949675e SPIGOT-6713: Cancelling EntityTransformEvent Causes Deceased Slimes To Not Despawn
a955f15c Fix issues with new ChunkGenerator API
a0a37f41 SPIGOT-6630: Replacing an enchantment on an item creates a conflict error

Spigot Changes:
b166a49b Rebuild patches
3c1fc60a SPIGOT-6693: Composters only take in one item at custom hopper speeds
---
 patches/api/Add-Heightmap-API.patch           |  2 +-
 .../api/Add-World.getEntity-UUID-API.patch    |  4 +-
 patches/api/Add-moon-phase-API.patch          |  2 +-
 .../api/Add-more-line-of-sight-methods.patch  |  2 +-
 patches/api/Add-sun-related-API.patch         |  2 +-
 ...tional-world.getNearbyEntities-API-s.patch |  2 +-
 patches/api/Adventure.patch                   |  6 +--
 ...Blocks-to-be-accessed-via-a-long-key.patch |  2 +-
 patches/api/Async-Chunks-API.patch            |  2 +-
 patches/api/Expand-Explosions-API.patch       |  2 +-
 ...ld.spawnParticle-API-and-add-Builder.patch |  2 +-
 patches/api/Implement-Keyed-on-World.patch    |  6 +--
 patches/api/More-World-API.patch              |  2 +-
 ...vide-Chunk-Coordinates-as-a-Long-API.patch |  2 +-
 ...rovide-E-TE-Chunk-count-stat-methods.patch |  2 +-
 patches/api/Spawn-Reason-API.patch            | 50 ++++++++-----------
 patches/api/World-view-distance-api.patch     |  2 +-
 patches/api/isChunkGenerated-API.patch        |  2 +-
 ...-get-a-BlockState-without-a-snapshot.patch |  4 +-
 .../server/Add-Feature-Generation-API.patch   |  4 +-
 patches/server/Add-Heightmap-API.patch        |  2 +-
 ...-Plugin-Tickets-to-API-Chunk-Methods.patch | 12 ++---
 ...cause-to-Weather-ThunderChangeEvents.patch |  4 +-
 .../server/Add-hand-to-bucket-events.patch    |  2 +-
 ...keLighting-call-to-World-spigot-stri.patch |  2 +-
 patches/server/Add-moon-phase-API.patch       |  2 +-
 patches/server/Add-sun-related-API.patch      |  2 +-
 .../Added-WorldGameRuleChangeEvent.patch      |  4 +-
 ...llow-delegation-to-vanilla-chunk-gen.patch | 31 +++++++-----
 ...Item-entities-with-World.spawnEntity.patch | 14 +++---
 patches/server/Anti-Xray.patch                | 28 +++++------
 .../Asynchronous-chunk-IO-and-loading.patch   |  4 +-
 ...e-informative-in-maxHealth-exception.patch |  2 +-
 ...le-Keep-Spawn-Loaded-range-per-world.patch |  2 +-
 ...-PlayerBucketFillEvent-when-no-fluid.patch | 18 -------
 .../server/Entity-Activation-Range-2.0.patch  |  4 +-
 patches/server/Expand-Explosions-API.patch    |  2 +-
 ...ld.spawnParticle-API-and-add-Builder.patch |  2 +-
 ...PI-for-Reason-Source-Triggering-play.patch | 16 +++---
 patches/server/Expose-world-spawn-angle.patch |  2 +-
 ...geEvent-not-firing-for-all-use-cases.patch |  2 +-
 .../Fix-World-isChunkGenerated-calls.patch    |  4 +-
 ...x-and-optimise-world-force-upgrading.patch |  4 +-
 ...hanging-entities-that-are-not-ItemFr.patch | 14 +++---
 patches/server/Generator-Settings.patch       | 39 ++++-----------
 .../Handle-Item-Meta-Inconsistencies.patch    |  6 +--
 patches/server/Implement-Keyed-on-World.patch |  2 +-
 .../Implement-World.getEntity-UUID-API.patch  |  2 +-
 patches/server/Line-Of-Sight-Changes.patch    |  2 +-
 ...Load-Chunks-for-Login-Asynchronously.patch | 13 -----
 patches/server/MC-Utils.patch                 | 10 +++-
 ...loadChunk-int-int-false-load-unconve.patch |  2 +-
 ...ers-respect-inventory-max-stack-size.patch | 15 ------
 patches/server/Mob-Pathfinding-API.patch      |  2 +-
 patches/server/More-Lidded-Block-API.patch    |  2 +-
 patches/server/More-World-API.patch           |  4 +-
 ...No-Tick-view-distance-implementation.patch |  2 +-
 ...timise-IEntityAccess-getPlayerByUUID.patch |  2 +-
 ...imise-TickListServer-by-rewriting-it.patch |  2 +-
 patches/server/Optimize-Hoppers.patch         |  6 +--
 ...hunkMap-memory-use-for-visibleChunks.patch | 10 ++--
 patches/server/Paper-config-files.patch       |  4 +-
 ...rovide-E-TE-Chunk-count-stat-methods.patch |  4 +-
 .../Set-area-affect-cloud-rotation.patch      | 14 +++---
 patches/server/Timings-v2.patch               |  2 +-
 .../server/add-per-world-spawn-limits.patch   |  4 +-
 .../improve-CraftWorld-isChunkLoaded.patch    |  2 +-
 work/Bukkit                                   |  2 +-
 work/CraftBukkit                              |  2 +-
 work/Spigot                                   |  2 +-
 70 files changed, 191 insertions(+), 247 deletions(-)
 delete mode 100644 patches/server/Do-not-fire-PlayerBucketFillEvent-when-no-fluid.patch

diff --git a/patches/api/Add-Heightmap-API.patch b/patches/api/Add-Heightmap-API.patch
index 47c601e9f4..ec46462128 100644
--- a/patches/api/Add-Heightmap-API.patch
+++ b/patches/api/Add-Heightmap-API.patch
@@ -106,7 +106,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
      @NotNull
      public Block getHighestBlockAt(@NotNull Location location);
  
diff --git a/patches/api/Add-World.getEntity-UUID-API.patch b/patches/api/Add-World.getEntity-UUID-API.patch
index efa2fb77c8..b0f7d9ec33 100644
--- a/patches/api/Add-World.getEntity-UUID-API.patch
+++ b/patches/api/Add-World.getEntity-UUID-API.patch
@@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
      @NotNull
      public Collection<Entity> getNearbyEntities(@NotNull Location location, double x, double y, double z);
  
@@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +     * @return the entity with the given UUID, or null if it isn't found
 +     */
 +    @Nullable
-+    public Entity getEntity(@NotNull UUID uuid);
++    public Entity getEntity(@NotNull java.util.UUID uuid);
 +    // Paper end
 +
      /**
diff --git a/patches/api/Add-moon-phase-API.patch b/patches/api/Add-moon-phase-API.patch
index a896539d9f..cd79cb3937 100644
--- a/patches/api/Add-moon-phase-API.patch
+++ b/patches/api/Add-moon-phase-API.patch
@@ -50,7 +50,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
       * @return The amount of Players in this world
       */
      int getPlayerCount();
diff --git a/patches/api/Add-more-line-of-sight-methods.patch b/patches/api/Add-more-line-of-sight-methods.patch
index e6e7e114ac..e98811937d 100644
--- a/patches/api/Add-more-line-of-sight-methods.patch
+++ b/patches/api/Add-more-line-of-sight-methods.patch
@@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
       */
      @NotNull
      io.papermc.paper.world.MoonPhase getMoonPhase();
diff --git a/patches/api/Add-sun-related-API.patch b/patches/api/Add-sun-related-API.patch
index 586c0c4e03..c39ae9ba06 100644
--- a/patches/api/Add-sun-related-API.patch
+++ b/patches/api/Add-sun-related-API.patch
@@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
       */
      public void setFullTime(long time);
  
diff --git a/patches/api/Additional-world.getNearbyEntities-API-s.patch b/patches/api/Additional-world.getNearbyEntities-API-s.patch
index cf3a42a65a..0cc194822a 100644
--- a/patches/api/Additional-world.getNearbyEntities-API-s.patch
+++ b/patches/api/Additional-world.getNearbyEntities-API-s.patch
@@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  import java.util.Collection;
  import java.util.HashMap;
  import java.util.List;
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
      @NotNull
      public Collection<Entity> getEntitiesByClasses(@NotNull Class<?>... classes);
  
diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch
index 892ccb1a38..e3b5eb8366 100644
--- a/patches/api/Adventure.patch
+++ b/patches/api/Adventure.patch
@@ -1083,12 +1083,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  /**
   * Represents a world, which may contain entities, chunks and blocks
   */
--public interface World extends PluginMessageRecipient, Metadatable {
-+public interface World extends PluginMessageRecipient, Metadatable, net.kyori.adventure.audience.ForwardingAudience { // Paper
+-public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable {
++public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, net.kyori.adventure.audience.ForwardingAudience { // Paper
  
      /**
       * Gets the {@link Block} at the given coordinates
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
      @NotNull
      public List<Player> getPlayers();
  
diff --git a/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch b/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch
index 76cd9dcb89..aab2538abd 100644
--- a/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch
+++ b/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch
@@ -51,7 +51,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
      @NotNull
      public Block getBlockAt(@NotNull Location location);
  
diff --git a/patches/api/Async-Chunks-API.patch b/patches/api/Async-Chunks-API.patch
index df58dcaaf7..d85b5b9c0c 100644
--- a/patches/api/Async-Chunks-API.patch
+++ b/patches/api/Async-Chunks-API.patch
@@ -11,7 +11,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
          }
          return nearby;
      }
diff --git a/patches/api/Expand-Explosions-API.patch b/patches/api/Expand-Explosions-API.patch
index 587339b496..e3df4533f5 100644
--- a/patches/api/Expand-Explosions-API.patch
+++ b/patches/api/Expand-Explosions-API.patch
@@ -109,7 +109,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
       */
      public boolean createExplosion(@NotNull Location loc, float power, boolean setFire);
  
diff --git a/patches/api/Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/api/Expand-World.spawnParticle-API-and-add-Builder.patch
index 5c69d18469..fe125337ce 100644
--- a/patches/api/Expand-World.spawnParticle-API-and-add-Builder.patch
+++ b/patches/api/Expand-World.spawnParticle-API-and-add-Builder.patch
@@ -525,7 +525,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
       * @param data the data to use for the particle or null,
       *             the type of this depends on {@link Particle#getDataType()}
       */
diff --git a/patches/api/Implement-Keyed-on-World.patch b/patches/api/Implement-Keyed-on-World.patch
index 3f635ffb2b..a97caf34d9 100644
--- a/patches/api/Implement-Keyed-on-World.patch
+++ b/patches/api/Implement-Keyed-on-World.patch
@@ -57,12 +57,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  /**
   * Represents a world, which may contain entities, chunks and blocks
   */
--public interface World extends PluginMessageRecipient, Metadatable, net.kyori.adventure.audience.ForwardingAudience { // Paper
-+public interface World extends PluginMessageRecipient, Metadatable, net.kyori.adventure.audience.ForwardingAudience, Keyed { // Paper
+-public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, net.kyori.adventure.audience.ForwardingAudience { // Paper
++public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, net.kyori.adventure.audience.ForwardingAudience, Keyed { // Paper
  
      // Paper start
      /**
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
  
      @NotNull
      java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent);
diff --git a/patches/api/More-World-API.patch b/patches/api/More-World-API.patch
index 65b4856be4..9c9c7ab6e8 100644
--- a/patches/api/More-World-API.patch
+++ b/patches/api/More-World-API.patch
@@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
      @Nullable
      public Location locateNearestStructure(@NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored);
  
diff --git a/patches/api/Provide-Chunk-Coordinates-as-a-Long-API.patch b/patches/api/Provide-Chunk-Coordinates-as-a-Long-API.patch
index f06f54f58b..120173a7fb 100644
--- a/patches/api/Provide-Chunk-Coordinates-as-a-Long-API.patch
+++ b/patches/api/Provide-Chunk-Coordinates-as-a-Long-API.patch
@@ -47,7 +47,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
      @NotNull
      public Chunk getChunkAt(@NotNull Block block);
  
diff --git a/patches/api/Provide-E-TE-Chunk-count-stat-methods.patch b/patches/api/Provide-E-TE-Chunk-count-stat-methods.patch
index d60381de60..011613dd1b 100644
--- a/patches/api/Provide-E-TE-Chunk-count-stat-methods.patch
+++ b/patches/api/Provide-E-TE-Chunk-count-stat-methods.patch
@@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +++ b/src/main/java/org/bukkit/World.java
 @@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
   */
- public interface World extends PluginMessageRecipient, Metadatable, net.kyori.adventure.audience.ForwardingAudience { // Paper
+ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient, Metadatable, net.kyori.adventure.audience.ForwardingAudience { // Paper
  
 +    // Paper start
 +    /**
diff --git a/patches/api/Spawn-Reason-API.patch b/patches/api/Spawn-Reason-API.patch
index 5998c94f93..e3f7ebf273 100644
--- a/patches/api/Spawn-Reason-API.patch
+++ b/patches/api/Spawn-Reason-API.patch
@@ -4,53 +4,45 @@ Date: Thu, 10 Apr 2014 23:18:28 -0400
 Subject: [PATCH] Spawn Reason API
 
 
-diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
+diff --git a/src/main/java/org/bukkit/RegionAccessor.java b/src/main/java/org/bukkit/RegionAccessor.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/org/bukkit/World.java
-+++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@
- package org.bukkit;
- 
- import java.io.File;
-+
+--- a/src/main/java/org/bukkit/RegionAccessor.java
++++ b/src/main/java/org/bukkit/RegionAccessor.java
+@@ -0,0 +0,0 @@ import org.bukkit.block.data.BlockData;
+ import org.bukkit.entity.Entity;
+ import org.bukkit.entity.EntityType;
+ import org.bukkit.entity.LivingEntity;
 +import org.bukkit.event.entity.CreatureSpawnEvent;
- import org.bukkit.generator.ChunkGenerator;
- 
- import java.util.ArrayList;
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
-     @NotNull
-     public <T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz) throws IllegalArgumentException;
- 
-+    // Paper start
-+    @NotNull
-+    public default <T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz, @NotNull CreatureSpawnEvent.SpawnReason reason) throws IllegalArgumentException {
-+        return spawn(location, clazz, reason, null);
-+    }
-+
-     /**
-      * Spawn an entity of a specific class at the given {@link Location}, with
-      * the supplied function run before the entity is added to the world.
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+ import org.bukkit.util.Consumer;
+ import org.jetbrains.annotations.NotNull;
+ import org.jetbrains.annotations.Nullable;
+@@ -0,0 +0,0 @@ public interface RegionAccessor {
       *     {@link Entity} requested cannot be spawned
       */
      @NotNull
--    public <T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz, @Nullable Consumer<T> function) throws IllegalArgumentException;
+-    <T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz, @Nullable Consumer<T> function) throws IllegalArgumentException;
++    // Paper start
 +    public default <T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz, @Nullable Consumer<T> function) throws IllegalArgumentException {
 +        return spawn(location, clazz, CreatureSpawnEvent.SpawnReason.CUSTOM, function);
 +    }
 +
 +    @NotNull
++    public default <T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz, @NotNull CreatureSpawnEvent.SpawnReason reason) throws IllegalArgumentException {
++        return spawn(location, clazz, reason, null);
++    }
++
++    @NotNull
 +    public default <T extends Entity> T spawn(@NotNull Location location, @NotNull Class<T> clazz, @NotNull CreatureSpawnEvent.SpawnReason reason, @Nullable Consumer<T> function) throws IllegalArgumentException {
 +        return spawn(location, clazz, function, reason);
 +    }
 +
 +    @NotNull
-+    public default Entity spawnEntity(@NotNull Location loc, @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) {
++    public default Entity spawnEntity(@NotNull Location loc, @NotNull org.bukkit.entity.EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason) {
 +        return spawn(loc, (Class<Entity>) type.getEntityClass(), reason, null);
 +    }
 +
 +    @NotNull
-+    public default Entity spawnEntity(@NotNull Location loc, @NotNull EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason, @Nullable Consumer<Entity> function) {
++    public default Entity spawnEntity(@NotNull Location loc, @NotNull org.bukkit.entity.EntityType type, @NotNull CreatureSpawnEvent.SpawnReason reason, @Nullable Consumer<Entity> function) {
 +        return spawn(loc, (Class<Entity>) type.getEntityClass(), reason, function);
 +    }
 +
@@ -59,4 +51,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +    // Paper end
  
      /**
-      * Spawn a {@link FallingBlock} entity at the given {@link Location} of
+      * Creates a new entity at the given {@link Location} with the supplied
diff --git a/patches/api/World-view-distance-api.patch b/patches/api/World-view-distance-api.patch
index 59775644fe..69f4f91181 100644
--- a/patches/api/World-view-distance-api.patch
+++ b/patches/api/World-view-distance-api.patch
@@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
      int getViewDistance();
      // Spigot end
  
diff --git a/patches/api/isChunkGenerated-API.patch b/patches/api/isChunkGenerated-API.patch
index c2284fe9ca..4579e9a6fa 100644
--- a/patches/api/isChunkGenerated-API.patch
+++ b/patches/api/isChunkGenerated-API.patch
@@ -37,7 +37,7 @@ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/Worl
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/World.java
 +++ b/src/main/java/org/bukkit/World.java
-@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad
+@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
      public default Chunk getChunkAt(long chunkKey) {
          return getChunkAt((int) chunkKey, (int) (chunkKey >> 32));
      }
diff --git a/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch b/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch
index 52a62cf0cc..afd514dd77 100644
--- a/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch
+++ b/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch
@@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
 +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
 @@ -0,0 +0,0 @@ public class CraftBlockEntityState<T extends BlockEntity> extends CraftBlockStat
-         this.tileEntity = tileEntityClass.cast(world.getHandle().getBlockEntity(this.getPosition()));
+         this.tileEntity = tileEntityClass.cast(getWorldHandle().getBlockEntity(this.getPosition()));
          Preconditions.checkState(this.tileEntity != null, "Tile is null, asynchronous access? %s", block);
  
 +        // Paper start
@@ -133,7 +133,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        // Paper end
      }
  
-     private T createSnapshot(T tileEntity) {
+     public void refreshSnapshot() {
 diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
diff --git a/patches/server/Add-Feature-Generation-API.patch b/patches/server/Add-Feature-Generation-API.patch
index 8543c7e935..a03ca95344 100644
--- a/patches/server/Add-Feature-Generation-API.patch
+++ b/patches/server/Add-Feature-Generation-API.patch
@@ -130,8 +130,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
 +++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
 @@ -0,0 +0,0 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
-         if (this.generator.shouldGenerateDecorations()) {
-             this.delegate.applyBiomeDecoration(region, accessor);
+         for (BlockPos lightPosition : craftData.getLights()) {
+             ((ProtoChunk) chunk).addLight(new BlockPos((x << 4) + lightPosition.getX(), lightPosition.getY(), (z << 4) + lightPosition.getZ())); // PAIL rename addLightBlock
          }
 +
 +        // Paper start
diff --git a/patches/server/Add-Heightmap-API.patch b/patches/server/Add-Heightmap-API.patch
index c2d839221c..0ea6b2e7f1 100644
--- a/patches/server/Add-Heightmap-API.patch
+++ b/patches/server/Add-Heightmap-API.patch
@@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
          return this.getHighestBlockYAt(x, z, org.bukkit.HeightMap.MOTION_BLOCKING);
      }
  
diff --git a/patches/server/Add-Plugin-Tickets-to-API-Chunk-Methods.patch b/patches/server/Add-Plugin-Tickets-to-API-Chunk-Methods.patch
index ad599f25f1..ca791146f5 100644
--- a/patches/server/Add-Plugin-Tickets-to-API-Chunk-Methods.patch
+++ b/patches/server/Add-Plugin-Tickets-to-API-Chunk-Methods.patch
@@ -47,7 +47,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
      @Override
      public Chunk getChunkAt(int x, int z) {
@@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
      @Override
      public Chunk getChunkAt(Block block) {
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
      public boolean unloadChunkRequest(int x, int z) {
          org.spigotmc.AsyncCatcher.catchOp("chunk unload"); // Spigot
          if (this.isChunkLoaded(x, z)) {
@@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          }
  
          return true;
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
          org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot
          // Paper start - Optimize this method
          ChunkPos chunkPos = new ChunkPos(x, z);
@@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              if (immediate == null) {
                  immediate = world.getChunkSource().chunkMap.getUnloadingChunk(x, z);
              }
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
                  if (!(immediate instanceof ImposterProtoChunk) && !(immediate instanceof net.minecraft.world.level.chunk.LevelChunk)) {
                      return false; // not full status
                  }
@@ -102,7 +102,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
                  world.getChunk(x, z); // make sure we're at ticket level 32 or lower
                  return true;
              }
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
              // we do this so we do not re-read the chunk data on disk
          }
  
@@ -111,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          world.getChunkSource().getChunk(x, z, ChunkStatus.FULL, true);
          return true;
          // Paper end
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
          return this.world.getChunkSource().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> {
              net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) either.left().orElse(null);
diff --git a/patches/server/Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/server/Add-cause-to-Weather-ThunderChangeEvents.patch
index aa233c2814..e0e07a9f3e 100644
--- a/patches/server/Add-cause-to-Weather-ThunderChangeEvents.patch
+++ b/patches/server/Add-cause-to-Weather-ThunderChangeEvents.patch
@@ -107,7 +107,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
      @Override
      public void setStorm(boolean hasStorm) {
@@ -116,7 +116,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          this.setWeatherDuration(0); // Reset weather duration (legacy behaviour)
          this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands)
      }
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
      @Override
      public void setThundering(boolean thundering) {
diff --git a/patches/server/Add-hand-to-bucket-events.patch b/patches/server/Add-hand-to-bucket-events.patch
index 132441ffe9..1c0ffa0fca 100644
--- a/patches/server/Add-hand-to-bucket-events.patch
+++ b/patches/server/Add-hand-to-bucket-events.patch
@@ -66,9 +66,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/net/minecraft/world/item/BucketItem.java
 +++ b/src/main/java/net/minecraft/world/item/BucketItem.java
 @@ -0,0 +0,0 @@ public class BucketItem extends Item implements DispensibleContainerItem {
-                         BucketPickup ifluidsource = (BucketPickup) iblockdata.getBlock();
                          // CraftBukkit start
                          ItemStack dummyFluid = ifluidsource.pickupBlock(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata);
+                         if (dummyFluid.isEmpty()) return InteractionResultHolder.fail(itemstack); // Don't fire event if the bucket won't be filled.
 -                        PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) world, user, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem());
 +                        PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) world, user, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem(), hand); // Paper - add enumhand
  
diff --git a/patches/server/Add-missing-strikeLighting-call-to-World-spigot-stri.patch b/patches/server/Add-missing-strikeLighting-call-to-World-spigot-stri.patch
index 0b87484b5d..684bdb85d5 100644
--- a/patches/server/Add-missing-strikeLighting-call-to-World-spigot-stri.patch
+++ b/patches/server/Add-missing-strikeLighting-call-to-World-spigot-stri.patch
@@ -9,7 +9,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
              lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() );
              lightning.visualOnly = true;
              lightning.isSilent = isSilent;
diff --git a/patches/server/Add-moon-phase-API.patch b/patches/server/Add-moon-phase-API.patch
index 46bb9a53d6..eab12ecc82 100644
--- a/patches/server/Add-moon-phase-API.patch
+++ b/patches/server/Add-moon-phase-API.patch
@@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
      public int getPlayerCount() {
          return world.players().size();
      }
diff --git a/patches/server/Add-sun-related-API.patch b/patches/server/Add-sun-related-API.patch
index 448a77da13..befa609799 100644
--- a/patches/server/Add-sun-related-API.patch
+++ b/patches/server/Add-sun-related-API.patch
@@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
          }
      }
  
diff --git a/patches/server/Added-WorldGameRuleChangeEvent.patch b/patches/server/Added-WorldGameRuleChangeEvent.patch
index fc31b4135c..383fd97f73 100644
--- a/patches/server/Added-WorldGameRuleChangeEvent.patch
+++ b/patches/server/Added-WorldGameRuleChangeEvent.patch
@@ -67,7 +67,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
          if (!this.isGameRule(rule)) return false;
  
@@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          handle.onChanged(this.getHandle().getServer());
          return true;
      }
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
          if (!this.isGameRule(rule.getName())) return false;
  
diff --git a/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch b/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch
index c0619c0421..ba87373b8e 100644
--- a/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch
+++ b/patches/server/Allow-delegation-to-vanilla-chunk-gen.patch
@@ -9,14 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
 @@ -0,0 +0,0 @@ public final class CraftServer implements Server {
-         return new CraftChunkData(world);
+         return new OldCraftChunkData(world);
      }
  
 +    // Paper start
 +    @Override
 +    public ChunkGenerator.ChunkData createVanillaChunkData(World world, int x, int z) {
 +        // get empty object
-+        CraftChunkData data = (CraftChunkData) createChunkData(world);
++        OldCraftChunkData data = (OldCraftChunkData) createChunkData(world);
 +        // do bunch of vanilla shit
 +        net.minecraft.server.level.ServerLevel nmsWorld = ((CraftWorld) world).getHandle();
 +        net.minecraft.world.level.chunk.ProtoChunk protoChunk = new net.minecraft.world.level.chunk.ProtoChunk(new net.minecraft.world.level.ChunkPos(x, z), null, nmsWorld, nmsWorld);
@@ -41,20 +41,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      @Override
      public BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) {
          return new CraftBossBar(title, color, style, flags);
-diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
+diff --git a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
-+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
-@@ -0,0 +0,0 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
-         return this.sections;
+--- a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
++++ b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
+@@ -0,0 +0,0 @@ import org.bukkit.material.MaterialData;
+ public final class OldCraftChunkData implements ChunkGenerator.ChunkData {
+     private final int minHeight;
+     private final int maxHeight;
+-    private final LevelChunkSection[] sections;
++    private LevelChunkSection[] sections;
+     private Set<BlockPos> tiles;
+     private final Set<BlockPos> lights = new HashSet<>();
+     private World world; // Paper - Anti-Xray - Add parameters
+@@ -0,0 +0,0 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData {
+     Set<BlockPos> getLights() {
+         return this.lights;
      }
- 
++
 +    // Paper start
 +    public void setRawChunkData(LevelChunkSection[] sections) {
 +        this.sections = sections;
 +    }
 +    // Paper end
-+
-     Set<BlockPos> getTiles() {
-         return this.tiles;
-     }
+ }
diff --git a/patches/server/Allow-spawning-Item-entities-with-World.spawnEntity.patch b/patches/server/Allow-spawning-Item-entities-with-World.spawnEntity.patch
index fd77740787..88e5283e5f 100644
--- a/patches/server/Allow-spawning-Item-entities-with-World.spawnEntity.patch
+++ b/patches/server/Allow-spawning-Item-entities-with-World.spawnEntity.patch
@@ -7,18 +7,18 @@ This API has more capabilities than .dropItem with the Consumer function
 
 Item can be set inside of the Consumer pre spawn function.
 
-diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
++++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+@@ -0,0 +0,0 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
          if (Boat.class.isAssignableFrom(clazz)) {
-             entity = new net.minecraft.world.entity.vehicle.Boat(this.world, x, y, z);
+             entity = new net.minecraft.world.entity.vehicle.Boat(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)));
++            entity = new net.minecraft.world.entity.item.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(this.world, x, y, z, this.world.getBlockState(new BlockPos(x, y, z)));
+             entity = new FallingBlockEntity(world, x, y, z, this.getHandle().getBlockState(new BlockPos(x, y, z)));
          } else if (Projectile.class.isAssignableFrom(clazz)) {
diff --git a/patches/server/Anti-Xray.patch b/patches/server/Anti-Xray.patch
index 82f7ad87a5..592bc3392f 100644
--- a/patches/server/Anti-Xray.patch
+++ b/patches/server/Anti-Xray.patch
@@ -1109,10 +1109,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
 @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
      // Add env and gen to constructor, WorldData -> WorldDataServer
-     public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
+     public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
          // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
--        super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, env);
-+        super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, env, executor); // Paper - Anti-Xray - Pass executor
+-        super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, biomeProvider, env);
++        super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, biomeProvider, env, executor); // Paper - Anti-Xray - Pass executor
          this.pvpMode = minecraftserver.isPvpAllowed();
          this.convertable = convertable_conversionsession;
          this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.toFile());
@@ -1154,8 +1154,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          return this.typeKey;
      }
  
--    protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
-+    protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Anti-Xray - Pass executor
+-    protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
++    protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - Anti-Xray - Pass executor
          this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
          this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper
          this.generator = gen;
@@ -1426,28 +1426,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
                  blockids.read(data.getList("Palette", CraftMagicNumbers.NBT.TAG_COMPOUND), data.getLongArray("BlockStates"));
  
                  sectionBlockIDs[i] = blockids;
-diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
+diff --git a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
-+++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java
-@@ -0,0 +0,0 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
-     private LevelChunkSection[] sections;
+--- a/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
++++ b/src/main/java/org/bukkit/craftbukkit/generator/OldCraftChunkData.java
+@@ -0,0 +0,0 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData {
+     private final LevelChunkSection[] sections;
      private Set<BlockPos> tiles;
      private final Set<BlockPos> lights = new HashSet<>();
 +    private World world; // Paper - Anti-Xray - Add parameters
  
-     public CraftChunkData(World world) {
+     public OldCraftChunkData(World world) {
          this(world.getMinHeight(), world.getMaxHeight());
 +        this.world = world; // Paper - Anti-Xray - Add parameters
      }
  
-     /* pp for tests */ CraftChunkData(int minHeight, int maxHeight) {
-@@ -0,0 +0,0 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData {
+     /* pp for tests */ OldCraftChunkData(int minHeight, int maxHeight) {
+@@ -0,0 +0,0 @@ public final class OldCraftChunkData implements ChunkGenerator.ChunkData {
          int offset = (y - this.minHeight) >> 4;
          LevelChunkSection section = this.sections[offset];
          if (create && section == null) {
 -            this.sections[offset] = section = new LevelChunkSection(offset + (this.minHeight >> 4));
-+            this.sections[offset] = section = new LevelChunkSection(offset + (this.minHeight >> 4), null, this.world instanceof org.bukkit.craftbukkit.CraftWorld ? ((org.bukkit.craftbukkit.CraftWorld) this.world).getHandle() : null, true); // Paper - Anti-Xray - Add parameters
++            this.sections[offset] = section = new LevelChunkSection(offset + (this.minHeight >> 4), null, world instanceof org.bukkit.craftbukkit.CraftWorld ? ((org.bukkit.craftbukkit.CraftWorld) this.world).getHandle() : null, true); // Paper - Anti-Xray - Add parameters
          }
          return section;
      }
diff --git a/patches/server/Asynchronous-chunk-IO-and-loading.patch b/patches/server/Asynchronous-chunk-IO-and-loading.patch
index 1cfbb35bca..2624e592bc 100644
--- a/patches/server/Asynchronous-chunk-IO-and-loading.patch
+++ b/patches/server/Asynchronous-chunk-IO-and-loading.patch
@@ -2883,7 +2883,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +    // Paper end
 +
      // Add env and gen to constructor, WorldData -> WorldDataServer
-     public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
+     public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
          // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
 @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
  
@@ -3622,7 +3622,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
      public DragonBattle getEnderDragonBattle() {
          return (this.getHandle().dragonFight() == null) ? null : new CraftDragonBattle(this.getHandle().dragonFight());
      }
diff --git a/patches/server/Be-a-bit-more-informative-in-maxHealth-exception.patch b/patches/server/Be-a-bit-more-informative-in-maxHealth-exception.patch
index a4cf491aa2..d276f706d4 100644
--- a/patches/server/Be-a-bit-more-informative-in-maxHealth-exception.patch
+++ b/patches/server/Be-a-bit-more-informative-in-maxHealth-exception.patch
@@ -19,4 +19,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +                + (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')'));
          }
  
-         this.getHandle().setHealth((float) health);
+         // during world generation, we don't want to run logic for dropping items and xp
diff --git a/patches/server/Configurable-Keep-Spawn-Loaded-range-per-world.patch b/patches/server/Configurable-Keep-Spawn-Loaded-range-per-world.patch
index 026a447123..18651a90e6 100644
--- a/patches/server/Configurable-Keep-Spawn-Loaded-range-per-world.patch
+++ b/patches/server/Configurable-Keep-Spawn-Loaded-range-per-world.patch
@@ -224,7 +224,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
      @Override
      public void setKeepSpawnInMemory(boolean keepLoaded) {
diff --git a/patches/server/Do-not-fire-PlayerBucketFillEvent-when-no-fluid.patch b/patches/server/Do-not-fire-PlayerBucketFillEvent-when-no-fluid.patch
deleted file mode 100644
index 2120eced2a..0000000000
--- a/patches/server/Do-not-fire-PlayerBucketFillEvent-when-no-fluid.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Shane Freeder <theboyetronic@gmail.com>
-Date: Tue, 17 Aug 2021 15:42:21 +0100
-Subject: [PATCH] Do not fire PlayerBucketFillEvent when no fluid
-
-
-diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
-index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/net/minecraft/world/item/BucketItem.java
-+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
-@@ -0,0 +0,0 @@ public class BucketItem extends Item implements DispensibleContainerItem {
-                         BucketPickup ifluidsource = (BucketPickup) iblockdata.getBlock();
-                         // CraftBukkit start
-                         ItemStack dummyFluid = ifluidsource.pickupBlock(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata);
-+                        if (dummyFluid.isEmpty()) return InteractionResultHolder.fail(itemstack); // Paper
-                         PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) world, user, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem(), hand); // Paper - add enumhand
- 
-                         if (event.isCancelled()) {
diff --git a/patches/server/Entity-Activation-Range-2.0.patch b/patches/server/Entity-Activation-Range-2.0.patch
index a9ce6e0b3b..81c947ee51 100644
--- a/patches/server/Entity-Activation-Range-2.0.patch
+++ b/patches/server/Entity-Activation-Range-2.0.patch
@@ -344,8 +344,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
                                  entity.setDeltaMovement(e, g, h);
 +                                // Paper - EAR items stuck in in slime pushed by a piston
-+                                entity.activatedTick = Math.max(entity.activatedTick, net.minecraft.server.MinecraftServer.currentTick + 10); 
-+                                entity.activatedImmunityTick = Math.max(entity.activatedImmunityTick, net.minecraft.server.MinecraftServer.currentTick + 10); 
++                                entity.activatedTick = Math.max(entity.activatedTick, net.minecraft.server.MinecraftServer.currentTick + 10);
++                                entity.activatedImmunityTick = Math.max(entity.activatedImmunityTick, net.minecraft.server.MinecraftServer.currentTick + 10);
 +                                // Paper end
                                  break;
                              }
diff --git a/patches/server/Expand-Explosions-API.patch b/patches/server/Expand-Explosions-API.patch
index abaa81a5a1..728ae0ca6e 100644
--- a/patches/server/Expand-Explosions-API.patch
+++ b/patches/server/Expand-Explosions-API.patch
@@ -9,7 +9,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
      public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) {
          return !this.world.explode(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, breakBlocks ? Explosion.BlockInteraction.BREAK : Explosion.BlockInteraction.NONE).wasCanceled;
      }
diff --git a/patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch
index 89f96b52fa..a27b1ece11 100644
--- a/patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch
+++ b/patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch
@@ -37,7 +37,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
      @Override
      public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) {
diff --git a/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch
index b6c7f851d7..d8de743523 100644
--- a/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch
+++ b/patches/server/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch
@@ -300,19 +300,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      }
  
      @Override
-diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
++++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+@@ -0,0 +0,0 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
          } else if (TNTPrimed.class.isAssignableFrom(clazz)) {
-             entity = new PrimedTnt(this.world, x, y, z, null);
+             entity = new PrimedTnt(world, x, y, z, null);
          } else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
--            entity = new net.minecraft.world.entity.ExperienceOrb(this.world, x, y, z, 0);
-+            entity = new net.minecraft.world.entity.ExperienceOrb(this.world, x, y, z, 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null); // Paper
+-            entity = new net.minecraft.world.entity.ExperienceOrb(world, x, y, z, 0);
++            entity = new net.minecraft.world.entity.ExperienceOrb(world, x, y, z, 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null); // Paper
          } else if (LightningStrike.class.isAssignableFrom(clazz)) {
              entity = net.minecraft.world.entity.EntityType.LIGHTNING_BOLT.create(world);
-         } else if (AreaEffectCloud.class.isAssignableFrom(clazz)) {
+             entity.moveTo(location.getX(), location.getY(), location.getZ());
 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
diff --git a/patches/server/Expose-world-spawn-angle.patch b/patches/server/Expose-world-spawn-angle.patch
index 8e487f56e0..f560934d01 100644
--- a/patches/server/Expose-world-spawn-angle.patch
+++ b/patches/server/Expose-world-spawn-angle.patch
@@ -21,7 +21,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
      @Override
      public Location getSpawnLocation() {
          BlockPos spawn = this.world.getSharedSpawnPos();
diff --git a/patches/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch
index fe490831d1..d585c846b1 100644
--- a/patches/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch
+++ b/patches/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch
@@ -20,7 +20,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
      public boolean setSpawnLocation(int x, int y, int z, float angle) {
          try {
              Location previousLocation = this.getSpawnLocation();
diff --git a/patches/server/Fix-World-isChunkGenerated-calls.patch b/patches/server/Fix-World-isChunkGenerated-calls.patch
index 4445132f02..3dfe05ae09 100644
--- a/patches/server/Fix-World-isChunkGenerated-calls.patch
+++ b/patches/server/Fix-World-isChunkGenerated-calls.patch
@@ -246,7 +246,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  import java.util.function.Predicate;
  import java.util.stream.Collectors;
  import net.minecraft.core.BlockPos;
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
      @Override
      public boolean isChunkGenerated(int x, int z) {
@@ -270,7 +270,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          } catch (IOException ex) {
              throw new RuntimeException(ex);
          }
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
      @Override
      public boolean loadChunk(int x, int z, boolean generate) {
          org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot
diff --git a/patches/server/Fix-and-optimise-world-force-upgrading.patch b/patches/server/Fix-and-optimise-world-force-upgrading.patch
index 7c45919053..4dc49d66d0 100644
--- a/patches/server/Fix-and-optimise-world-force-upgrading.patch
+++ b/patches/server/Fix-and-optimise-world-force-upgrading.patch
@@ -284,7 +284,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              ServerLevelData iworlddataserver = worlddata;
              WorldGenSettings generatorsettings = worlddata.worldGenSettings();
 @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
-                 chunkgenerator = worlddimension.generator();
+                 }
              }
  
 +            // Paper start - fix and optimise world upgrading
@@ -372,7 +372,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          long j = BiomeManager.obfuscateSeed(creator.seed());
          List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));
 @@ -0,0 +0,0 @@ public final class CraftServer implements Server {
-             chunkgenerator = worlddimension.generator();
+             }
          }
  
 +        // Paper start - fix and optimise world upgrading
diff --git a/patches/server/Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch b/patches/server/Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch
index 631d1177ab..4a04a2673b 100644
--- a/patches/server/Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch
+++ b/patches/server/Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch
@@ -5,11 +5,11 @@ Subject: [PATCH] Fix spawning of hanging entities that are not ItemFrames and
  can not face UP or DOWN
 
 
-diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
++++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+@@ -0,0 +0,0 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
                  height = 9;
              }
  
@@ -17,9 +17,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +            // Paper start - In addition to d65a2576e40e58c8e446b330febe6799d13a604f do not check UP/DOWN for non item frames
 +            // BlockFace[] faces = new BlockFace[]{BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH, BlockFace.UP, BlockFace.DOWN};
 +            BlockFace[] faces = (ItemFrame.class.isAssignableFrom(clazz))
-+                    ? new BlockFace[]{BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH, BlockFace.UP, BlockFace.DOWN}
-+                    : new BlockFace[]{BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH};
++                ? new BlockFace[]{BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH, BlockFace.UP, BlockFace.DOWN}
++                : new BlockFace[]{BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH};
 +            // Paper end
              final BlockPos pos = new BlockPos(x, y, z);
              for (BlockFace dir : faces) {
-                 net.minecraft.world.level.block.state.BlockState nmsBlock = this.world.getBlockState(pos.relative(CraftBlock.blockFaceToNotch(dir)));
+                 net.minecraft.world.level.block.state.BlockState nmsBlock = this.getHandle().getBlockState(pos.relative(CraftBlock.blockFaceToNotch(dir)));
diff --git a/patches/server/Generator-Settings.patch b/patches/server/Generator-Settings.patch
index 593ad7f324..e50598426d 100644
--- a/patches/server/Generator-Settings.patch
+++ b/patches/server/Generator-Settings.patch
@@ -136,37 +136,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
 +++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
 @@ -0,0 +0,0 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
-             for(BlockPos blockPos : BlockPos.betweenClosed(i, 0, j, i + 15, 0, j + 15)) {
-                 if (bl) {
-                     for(int q = 0; q < 5; ++q) {
--                        if (q <= random.nextInt(5)) {
-+                        if (q <= (chunk.generateFlatBedrock() ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock roof
-                             chunk.setBlockState(mutableBlockPos.set(blockPos.getX(), m - q, blockPos.getZ()), Blocks.BEDROCK.defaultBlockState(), false);
+ 
+                 if (flag1) {
+                     for (l1 = 0; l1 < 5; ++l1) {
+-                        if (l1 <= random.nextInt(5)) {
++                        if (l1 <= (chunk.generateFlatBedrock() ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock roof
+                             chunk.setBlockState(blockposition_mutableblockposition.set(blockposition.getX(), i1 - l1, blockposition.getZ()), Blocks.BEDROCK.defaultBlockState(), false);
                          }
                      }
 @@ -0,0 +0,0 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
  
-                 if (bl2) {
-                     for(int r = 4; r >= 0; --r) {
--                        if (r <= random.nextInt(5)) {
-+                        if (r <= (chunk.generateFlatBedrock() ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock floor
-                             chunk.setBlockState(mutableBlockPos.set(blockPos.getX(), l + r, blockPos.getZ()), Blocks.BEDROCK.defaultBlockState(), false);
+                 if (flag2) {
+                     for (l1 = 4; l1 >= 0; --l1) {
+-                        if (l1 <= random.nextInt(5)) {
++                        if (l1 <= (chunk.generateFlatBedrock() ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock floor{
+                             chunk.setBlockState(blockposition_mutableblockposition.set(blockposition.getX(), l + l1, blockposition.getZ()), Blocks.BEDROCK.defaultBlockState(), false);
                          }
                      }
-@@ -0,0 +0,0 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
-         if (l <= 0) {
-             return CompletableFuture.completedFuture(chunk);
-         } else {
--            int m = chunk.getSectionIndex(l * this.cellHeight - 1 + i);
-+            int mStart = chunk.getSectionIndex(l * this.cellHeight - 1 + i); // Paper - decompile fix
-             int n = chunk.getSectionIndex(i);
-             return CompletableFuture.supplyAsync(() -> {
-                 Set<LevelChunkSection> set = Sets.newHashSet();
- 
-                 ChunkAccess var16;
-                 try {
--                    for(int m = m; m >= n; --m) {
-+                    for(int m = mStart; m >= n; --m) { // Paper - decompile fix
-                         LevelChunkSection levelChunkSection = chunk.getOrCreateSection(m);
-                         levelChunkSection.acquire();
-                         set.add(levelChunkSection);
diff --git a/patches/server/Handle-Item-Meta-Inconsistencies.patch b/patches/server/Handle-Item-Meta-Inconsistencies.patch
index d15c588c31..727d88f187 100644
--- a/patches/server/Handle-Item-Meta-Inconsistencies.patch
+++ b/patches/server/Handle-Item-Meta-Inconsistencies.patch
@@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 -import net.minecraft.world.item.enchantment.EnchantmentHelper;
  import org.apache.commons.lang.Validate;
  import org.bukkit.Material;
- import org.bukkit.configuration.serialization.DelegateDeserialization;
+ import org.bukkit.NamespacedKey;
 @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack {
      public void addUnsafeEnchantment(Enchantment ench, int level) {
          Validate.notNull(ench, "Cannot add null enchantment");
@@ -107,7 +107,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 -        for (int i = 0; i < size; i++) {
 -            CompoundTag tag = (CompoundTag) list.get(i);
 -            String id = tag.getString(ENCHANTMENTS_ID.NBT);
--            if (id.equals(ench.getKey().toString())) {
+-            if (ench.getKey().equals(NamespacedKey.fromString(id))) {
 -                tag.putShort(ENCHANTMENTS_LVL.NBT, (short) level);
 -                return;
 -            }
@@ -157,7 +157,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 -        for (int i = 0; i < size; i++) {
 -            CompoundTag enchantment = (CompoundTag) list.get(i);
 -            String id = enchantment.getString(ENCHANTMENTS_ID.NBT);
--            if (id.equals(ench.getKey().toString())) {
+-            if (ench.getKey().equals(NamespacedKey.fromString(id))) {
 -                index = i;
 -                level = 0xffff & enchantment.getShort(ENCHANTMENTS_LVL.NBT);
 -                break;
diff --git a/patches/server/Implement-Keyed-on-World.patch b/patches/server/Implement-Keyed-on-World.patch
index 4e27476c78..aa530bacc5 100644
--- a/patches/server/Implement-Keyed-on-World.patch
+++ b/patches/server/Implement-Keyed-on-World.patch
@@ -37,7 +37,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
              return java.util.concurrent.CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk());
          }, net.minecraft.server.MinecraftServer.getServer());
      }
diff --git a/patches/server/Implement-World.getEntity-UUID-API.patch b/patches/server/Implement-World.getEntity-UUID-API.patch
index 401e353db7..f1dbc00226 100644
--- a/patches/server/Implement-World.getEntity-UUID-API.patch
+++ b/patches/server/Implement-World.getEntity-UUID-API.patch
@@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
          return list;
      }
  
diff --git a/patches/server/Line-Of-Sight-Changes.patch b/patches/server/Line-Of-Sight-Changes.patch
index 166f27aa4f..dd2ecd7cec 100644
--- a/patches/server/Line-Of-Sight-Changes.patch
+++ b/patches/server/Line-Of-Sight-Changes.patch
@@ -22,7 +22,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
      public io.papermc.paper.world.MoonPhase getMoonPhase() {
          return io.papermc.paper.world.MoonPhase.getPhase(getFullTime() / 24000L);
      }
diff --git a/patches/server/Load-Chunks-for-Login-Asynchronously.patch b/patches/server/Load-Chunks-for-Login-Asynchronously.patch
index 636f8a6802..4b5080012a 100644
--- a/patches/server/Load-Chunks-for-Login-Asynchronously.patch
+++ b/patches/server/Load-Chunks-for-Login-Asynchronously.patch
@@ -243,16 +243,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
          Iterator iterator = list.iterator();
  
-diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
-index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/net/minecraft/world/entity/Entity.java
-+++ b/src/main/java/net/minecraft/world/entity/Entity.java
-@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
-         this.yo = y;
-         this.zo = d4;
-         this.setPos(d3, y, d4);
--        this.level.getChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4); // CraftBukkit
-+        if (valid) this.level.getChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4); // CraftBukkit // Paper
-     }
- 
-     public void moveTo(Vec3 pos) {
diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch
index b43b7aac9b..062e19837a 100644
--- a/patches/server/MC-Utils.patch
+++ b/patches/server/MC-Utils.patch
@@ -4112,11 +4112,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +import org.bukkit.command.Command;
 +import org.bukkit.command.CommandSender;
 +import org.bukkit.configuration.file.FileConfiguration;
++import org.bukkit.generator.BiomeProvider;
 +import org.bukkit.generator.ChunkGenerator;
 +import org.bukkit.plugin.PluginBase;
 +import org.bukkit.plugin.PluginDescriptionFile;
 +import org.bukkit.plugin.PluginLoader;
 +import org.bukkit.plugin.PluginLogger;
++import org.jetbrains.annotations.NotNull;
++import org.jetbrains.annotations.Nullable;
 +
 +import java.io.File;
 +import java.io.InputStream;
@@ -4228,6 +4231,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +    }
 +
 +    @Override
++    public @Nullable BiomeProvider getDefaultBiomeProvider(@NotNull String worldName, @Nullable String id) {
++        throw new UnsupportedOperationException("Not supported.");
++    }
++
++    @Override
 +    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 +        throw new UnsupportedOperationException("Not supported.");
 +    }
@@ -4241,7 +4249,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
 +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
-@@ -0,0 +0,0 @@ public class DummyGeneratorAccess implements LevelAccessor {
+@@ -0,0 +0,0 @@ public class DummyGeneratorAccess implements WorldGenLevel {
      public FluidState getFluidState(BlockPos pos) {
          return Fluids.EMPTY.defaultFluidState(); // SPIGOT-6634
      }
diff --git a/patches/server/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch b/patches/server/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch
index 1a744c2c68..d694faff70 100644
--- a/patches/server/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch
+++ b/patches/server/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch
@@ -9,7 +9,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
      @Override
      public boolean loadChunk(int x, int z, boolean generate) {
          org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot
diff --git a/patches/server/Make-hoppers-respect-inventory-max-stack-size.patch b/patches/server/Make-hoppers-respect-inventory-max-stack-size.patch
index 228c85fbd1..aee7f0d876 100644
--- a/patches/server/Make-hoppers-respect-inventory-max-stack-size.patch
+++ b/patches/server/Make-hoppers-respect-inventory-max-stack-size.patch
@@ -9,22 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
 +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
 @@ -0,0 +0,0 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
-             boolean flag1 = to.isEmpty();
- 
-             if (itemstack1.isEmpty()) {
-+                int originalCount = stack.getCount(); // Paper
-+                stack.setCount(Math.min(to.getMaxStackSize(), stack.getCount())); // Paper
-                 IGNORE_TILE_UPDATES = true; // Paper
-                 to.setItem(slot, stack);
-                 IGNORE_TILE_UPDATES = false; // Paper
-+                if (originalCount - stack.getCount() == 0) { // Paper
                  stack = ItemStack.EMPTY;
-+                // Paper start
-+                } else {
-+                    stack = stack.copy(); // Paper - copy stack to return leftover stack
-+                    stack.setCount(originalCount - stack.getCount());
-+                }
-+                // Paper end
                  flag = true;
              } else if (HopperBlockEntity.canMergeItems(itemstack1, stack)) {
 -                int j = stack.getMaxStackSize() - itemstack1.getCount();
diff --git a/patches/server/Mob-Pathfinding-API.patch b/patches/server/Mob-Pathfinding-API.patch
index e9e3d5e4a8..fa70f48b51 100644
--- a/patches/server/Mob-Pathfinding-API.patch
+++ b/patches/server/Mob-Pathfinding-API.patch
@@ -177,4 +177,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +    @Override public com.destroystokyo.paper.entity.Pathfinder getPathfinder() { return paperPathfinder; } // Paper
      @Override
      public void setTarget(LivingEntity target) {
-         net.minecraft.world.entity.Mob entity = this.getHandle();
+         Preconditions.checkState(!this.getHandle().generation, "Cannot set target during world generation");
diff --git a/patches/server/More-Lidded-Block-API.patch b/patches/server/More-Lidded-Block-API.patch
index eeef00dd63..b68df38173 100644
--- a/patches/server/More-Lidded-Block-API.patch
+++ b/patches/server/More-Lidded-Block-API.patch
@@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
 +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftShulkerBox.java
 @@ -0,0 +0,0 @@ public class CraftShulkerBox extends CraftLootable<ShulkerBoxBlockEntity> implem
-         if (getTileEntity().opened) {
+         if (getTileEntity().opened && getWorldHandle() instanceof net.minecraft.world.level.Level) {
              Level world = getTileEntity().getLevel();
              world.blockEvent(getPosition(), getTileEntity().getBlockState().getBlock(), 1, 0);
 -            world.playSound(null, getPosition(), SoundEvents.SHULKER_BOX_OPEN, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
diff --git a/patches/server/More-World-API.patch b/patches/server/More-World-API.patch
index d55b35955d..0a2e2bd78e 100644
--- a/patches/server/More-World-API.patch
+++ b/patches/server/More-World-API.patch
@@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
          return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ());
      }
  
@@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +    @Override
 +    public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) {
 +        BlockPos originPos = new BlockPos(origin.getX(), origin.getY(), origin.getZ());
-+        BlockPos nearest = getHandle().findNearestBiome(CraftBlock.biomeToBiomeBase(getHandle().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), biome), originPos, radius, step);
++        BlockPos nearest = getHandle().findNearestBiome(CraftBlock.biomeToBiomeBase(getHandle().registryAccess().registryOrThrow(net.minecraft.core.Registry.BIOME_REGISTRY), biome), originPos, radius, step);
 +        return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ());
 +    }
 +
diff --git a/patches/server/No-Tick-view-distance-implementation.patch b/patches/server/No-Tick-view-distance-implementation.patch
index c1351898a7..61736d75b6 100644
--- a/patches/server/No-Tick-view-distance-implementation.patch
+++ b/patches/server/No-Tick-view-distance-implementation.patch
@@ -661,7 +661,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
      // Spigot start
      @Override
      public int getViewDistance() {
diff --git a/patches/server/Optimise-IEntityAccess-getPlayerByUUID.patch b/patches/server/Optimise-IEntityAccess-getPlayerByUUID.patch
index 1ee5931c3b..23b4014629 100644
--- a/patches/server/Optimise-IEntityAccess-getPlayerByUUID.patch
+++ b/patches/server/Optimise-IEntityAccess-getPlayerByUUID.patch
@@ -22,5 +22,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +    // Paper end
 +
      // Add env and gen to constructor, WorldData -> WorldDataServer
-     public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
+     public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
          // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
diff --git a/patches/server/Optimise-TickListServer-by-rewriting-it.patch b/patches/server/Optimise-TickListServer-by-rewriting-it.patch
index 14e381dacb..5a00d081b1 100644
--- a/patches/server/Optimise-TickListServer-by-rewriting-it.patch
+++ b/patches/server/Optimise-TickListServer-by-rewriting-it.patch
@@ -966,7 +966,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +    // Paper end - rewrite ticklistserver
 +
      // Add env and gen to constructor, WorldData -> WorldDataServer
-     public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
+     public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
          // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
 @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
          DefaultedRegistry registryblocks = Registry.BLOCK;
diff --git a/patches/server/Optimize-Hoppers.patch b/patches/server/Optimize-Hoppers.patch
index f5e3505355..99a9a60e71 100644
--- a/patches/server/Optimize-Hoppers.patch
+++ b/patches/server/Optimize-Hoppers.patch
@@ -425,9 +425,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          if (event.isCancelled()) {
              return false;
 @@ -0,0 +0,0 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
-             boolean flag1 = to.isEmpty();
- 
-             if (itemstack1.isEmpty()) {
+                     stack = stack.split(to.getMaxStackSize());
+                 }
+                 // Spigot end
 +                IGNORE_TILE_UPDATES = true; // Paper
                  to.setItem(slot, stack);
 +                IGNORE_TILE_UPDATES = false; // Paper
diff --git a/patches/server/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch b/patches/server/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch
index ada2cc60d0..8005786ce3 100644
--- a/patches/server/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch
+++ b/patches/server/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch
@@ -249,7 +249,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
      @Override
      public int getTileEntityCount() {
@@ -257,7 +257,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          // We don't use the full world tile entity list, so we must iterate chunks
          Long2ObjectLinkedOpenHashMap<ChunkHolder> chunks = world.getChunkSource().chunkMap.visibleChunkMap;
          int size = 0;
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
              size += chunk.blockEntities.size();
          }
          return size;
@@ -265,7 +265,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      }
  
      @Override
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
      @Override
      public int getChunkCount() {
@@ -273,7 +273,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          int ret = 0;
  
          for (ChunkHolder chunkHolder : world.getChunkSource().chunkMap.visibleChunkMap.values()) {
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
              }
          }
  
@@ -282,7 +282,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      }
  
      @Override
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
      @Override
      public Chunk[] getLoadedChunks() {
diff --git a/patches/server/Paper-config-files.patch b/patches/server/Paper-config-files.patch
index c100da3b13..5b2d1bcf51 100644
--- a/patches/server/Paper-config-files.patch
+++ b/patches/server/Paper-config-files.patch
@@ -674,11 +674,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      private org.spigotmc.TickLimiter entityLimiter;
 @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
  
-     protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
+     protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, final DimensionType dimensionmanager, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
          this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
 +        this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper
          this.generator = gen;
-         this.world = new CraftWorld((ServerLevel) this, gen, env);
+         this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
          this.ticksPerAnimalSpawns = this.getCraftServer().getTicksPerAnimalSpawns(); // CraftBukkit
 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
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 e6b047ed44..131510c186 100644
--- a/patches/server/Provide-E-TE-Chunk-count-stat-methods.patch
+++ b/patches/server/Provide-E-TE-Chunk-count-stat-methods.patch
@@ -23,7 +23,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
      private int waterAmbientSpawn = -1;
      private int ambientSpawn = -1;
  
@@ -80,4 +80,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +
      private static final Random rand = new Random();
  
-     public CraftWorld(ServerLevel world, ChunkGenerator gen, Environment env) {
+     public CraftWorld(ServerLevel world, ChunkGenerator gen, BiomeProvider biomeProvider, Environment env) {
diff --git a/patches/server/Set-area-affect-cloud-rotation.patch b/patches/server/Set-area-affect-cloud-rotation.patch
index b3da40d3d8..4eaba65e59 100644
--- a/patches/server/Set-area-affect-cloud-rotation.patch
+++ b/patches/server/Set-area-affect-cloud-rotation.patch
@@ -4,15 +4,15 @@ Date: Mon, 5 Apr 2021 16:58:20 -0400
 Subject: [PATCH] Set area affect cloud rotation
 
 
-diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
-             entity = net.minecraft.world.entity.EntityType.LIGHTNING_BOLT.create(world);
+--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
++++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+@@ -0,0 +0,0 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
+             entity.moveTo(location.getX(), location.getY(), location.getZ());
          } else if (AreaEffectCloud.class.isAssignableFrom(clazz)) {
-             entity = new net.minecraft.world.entity.AreaEffectCloud(this.world, x, y, z);
+             entity = new net.minecraft.world.entity.AreaEffectCloud(world, x, y, z);
 +            entity.moveTo(x, y, z, yaw, pitch); // Paper - Set area effect cloud Rotation
          } else if (EvokerFangs.class.isAssignableFrom(clazz)) {
-             entity = new net.minecraft.world.entity.projectile.EvokerFangs(this.world, x, y, z, (float) Math.toRadians(yaw), 0, null);
+             entity = new net.minecraft.world.entity.projectile.EvokerFangs(world, x, y, z, (float) Math.toRadians(yaw), 0, null);
          } else if (Marker.class.isAssignableFrom(clazz)) {
diff --git a/patches/server/Timings-v2.patch b/patches/server/Timings-v2.patch
index bcfc37e99d..979f41029b 100644
--- a/patches/server/Timings-v2.patch
+++ b/patches/server/Timings-v2.patch
@@ -775,7 +775,7 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/server/MinecraftServer.java
 +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
-@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.Main;
+@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.generator.CustomWorldChunkManager;
  import org.bukkit.event.server.ServerLoadEvent;
  // CraftBukkit end
  
diff --git a/patches/server/add-per-world-spawn-limits.patch b/patches/server/add-per-world-spawn-limits.patch
index d039827a05..d03ce9a33f 100644
--- a/patches/server/add-per-world-spawn-limits.patch
+++ b/patches/server/add-per-world-spawn-limits.patch
@@ -33,8 +33,8 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
-         this.generator = gen;
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
+         this.biomeProvider = biomeProvider;
  
          this.environment = env;
 +        // Paper start - per world spawn limits
diff --git a/patches/server/improve-CraftWorld-isChunkLoaded.patch b/patches/server/improve-CraftWorld-isChunkLoaded.patch
index 706c993b65..d11973a8ef 100644
--- a/patches/server/improve-CraftWorld-isChunkLoaded.patch
+++ b/patches/server/improve-CraftWorld-isChunkLoaded.patch
@@ -12,7 +12,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
-@@ -0,0 +0,0 @@ public class CraftWorld implements World {
+@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
  
      @Override
      public boolean isChunkLoaded(int x, int z) {
diff --git a/work/Bukkit b/work/Bukkit
index 974452512a..ca5b4b1ae6 160000
--- a/work/Bukkit
+++ b/work/Bukkit
@@ -1 +1 @@
-Subproject commit 974452512a4638f2692cc7baff5baf77401349ba
+Subproject commit ca5b4b1ae6c3d22ce76f57bec97d298c8914c466
diff --git a/work/CraftBukkit b/work/CraftBukkit
index 61e4ca7b9e..a0a37f416c 160000
--- a/work/CraftBukkit
+++ b/work/CraftBukkit
@@ -1 +1 @@
-Subproject commit 61e4ca7b9e7dbc0ee899140a7b194248edc3f493
+Subproject commit a0a37f416ca6c9be007f65e1b8ef5efea9b50cb5
diff --git a/work/Spigot b/work/Spigot
index ff89b973e6..3c1fc60ae7 160000
--- a/work/Spigot
+++ b/work/Spigot
@@ -1 +1 @@
-Subproject commit ff89b973e62ca3b6085aeeb474f2568e45ac02be
+Subproject commit 3c1fc60ae715a3007908fd34968f5acdf482a46a