From 734c1267b98856d7cfbf782dab08baa9f860d612 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Wed, 7 Jun 2023 20:31:32 +0200
Subject: [PATCH] More more work

---
 .../server/Add-BeaconEffectEvent.patch         |  0
 .../server/Add-PlayerInitialSpawnEvent.patch   |  2 +-
 ...e-option-to-load-extra-plugin-jars-no.patch |  0
 ...e-despawn-distances-for-living-entiti.patch |  0
 ...Add-configurable-portal-search-radius.patch |  2 +-
 .../server/Add-exception-reporting-event.patch |  0
 ...-working-with-arrows-stuck-in-living-.patch |  0
 .../server/Add-velocity-warnings.patch         |  4 ++--
 ...dd-version-history-to-version-command.patch |  0
 ...-chunks-are-slime-spawn-chunks-toggle.patch |  0
 .../Allow-for-toggling-of-spawn-chunks.patch   |  0
 ...ed-mobs-to-jump-and-take-water-damage.patch |  4 ++--
 .../server/Always-tick-falling-blocks.patch    |  0
 ...re-informative-in-maxHealth-exception.patch |  0
 ...de-before-converting-and-renaming-pla.patch |  0
 ...gurable-Disabling-Cat-Chest-Detection.patch |  0
 ...nfigurable-baby-zombie-movement-speed.patch |  2 +-
 ...cactus-bamboo-and-reed-growth-heights.patch |  0
 ...nfigurable-container-update-tick-rate.patch |  4 ++--
 .../server/Configurable-end-credits.patch      |  2 +-
 .../Configurable-fishing-time-ranges.patch     |  0
 ...able-inter-world-teleportation-safety.patch |  0
 .../Configurable-mob-spawner-tick-rate.patch   | 10 ----------
 ...onfigurable-top-of-nether-void-damage.patch |  6 +++---
 ...coreboards-for-non-players-by-default.patch | 10 +++++-----
 .../server/Disable-explosion-knockback.patch   |  4 ++--
 .../server/Disable-ice-and-snow.patch          |  2 +-
 .../server/Disable-spigot-tick-limiters.patch  |  0
 .../server/Disable-thunder.patch               |  0
 ...e-don-t-need-to-when-cerealising-text.patch |  0
 ...ock-and-tnt-entities-at-the-specified.patch |  7 +++----
 .../Ensure-commands-are-not-ran-async.patch    |  0
 .../server/Entity-Origin-API.patch             |  0
 .../server/Expose-server-CommandMap.patch      |  0
 ...m-explosions-processing-dead-entities.patch |  0
 .../Further-improve-server-tick-loop.patch     |  8 +-------
 .../Implement-Paper-VersionChecker.patch       |  0
 .../Implement-PlayerLocaleChangeEvent.patch    |  0
 .../Only-refresh-abilities-if-needed.patch     |  0
 .../server/Optimize-explosions.patch           |  0
 .../Player-Tab-List-and-Title-APIs.patch       |  0
 .../server/Player-affects-spawning-API.patch   | 18 +++++++++---------
 ...revent-tile-entity-and-entity-crashes.patch |  0
 ...lient-crashes-server-lists-and-Mojang.patch | 10 +++++-----
 .../Use-UserCache-for-player-heads.patch       |  0
 45 files changed, 39 insertions(+), 56 deletions(-)
 rename patches/{unapplied => }/server/Add-BeaconEffectEvent.patch (100%)
 rename patches/{unapplied => }/server/Add-PlayerInitialSpawnEvent.patch (96%)
 rename patches/{unapplied => }/server/Add-command-line-option-to-load-extra-plugin-jars-no.patch (100%)
 rename patches/{unapplied => }/server/Add-configurable-despawn-distances-for-living-entiti.patch (100%)
 rename patches/{unapplied => }/server/Add-configurable-portal-search-radius.patch (97%)
 rename patches/{unapplied => }/server/Add-exception-reporting-event.patch (100%)
 rename patches/{unapplied => }/server/Add-methods-for-working-with-arrows-stuck-in-living-.patch (100%)
 rename patches/{unapplied => }/server/Add-velocity-warnings.patch (95%)
 rename patches/{unapplied => }/server/Add-version-history-to-version-command.patch (100%)
 rename patches/{unapplied => }/server/All-chunks-are-slime-spawn-chunks-toggle.patch (100%)
 rename patches/{unapplied => }/server/Allow-for-toggling-of-spawn-chunks.patch (100%)
 rename patches/{unapplied => }/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch (96%)
 rename patches/{unapplied => }/server/Always-tick-falling-blocks.patch (100%)
 rename patches/{unapplied => }/server/Be-a-bit-more-informative-in-maxHealth-exception.patch (100%)
 rename patches/{unapplied => }/server/Check-online-mode-before-converting-and-renaming-pla.patch (100%)
 rename patches/{unapplied => }/server/Configurable-Disabling-Cat-Chest-Detection.patch (100%)
 rename patches/{unapplied => }/server/Configurable-baby-zombie-movement-speed.patch (97%)
 rename patches/{unapplied => }/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch (100%)
 rename patches/{unapplied => }/server/Configurable-container-update-tick-rate.patch (87%)
 rename patches/{unapplied => }/server/Configurable-end-credits.patch (90%)
 rename patches/{unapplied => }/server/Configurable-fishing-time-ranges.patch (100%)
 rename patches/{unapplied => }/server/Configurable-inter-world-teleportation-safety.patch (100%)
 rename patches/{unapplied => }/server/Configurable-mob-spawner-tick-rate.patch (70%)
 rename patches/{unapplied => }/server/Configurable-top-of-nether-void-damage.patch (95%)
 rename patches/{unapplied => }/server/Disable-Scoreboards-for-non-players-by-default.patch (72%)
 rename patches/{unapplied => }/server/Disable-explosion-knockback.patch (95%)
 rename patches/{unapplied => }/server/Disable-ice-and-snow.patch (95%)
 rename patches/{unapplied => }/server/Disable-spigot-tick-limiters.patch (100%)
 rename patches/{unapplied => }/server/Disable-thunder.patch (100%)
 rename patches/{unapplied => }/server/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch (100%)
 rename patches/{unapplied => }/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch (94%)
 rename patches/{unapplied => }/server/Ensure-commands-are-not-ran-async.patch (100%)
 rename patches/{unapplied => }/server/Entity-Origin-API.patch (100%)
 rename patches/{unapplied => }/server/Expose-server-CommandMap.patch (100%)
 rename patches/{unapplied => }/server/Fix-lag-from-explosions-processing-dead-entities.patch (100%)
 rename patches/{unapplied => }/server/Further-improve-server-tick-loop.patch (96%)
 rename patches/{unapplied => }/server/Implement-Paper-VersionChecker.patch (100%)
 rename patches/{unapplied => }/server/Implement-PlayerLocaleChangeEvent.patch (100%)
 rename patches/{unapplied => }/server/Only-refresh-abilities-if-needed.patch (100%)
 rename patches/{unapplied => }/server/Optimize-explosions.patch (100%)
 rename patches/{unapplied => }/server/Player-Tab-List-and-Title-APIs.patch (100%)
 rename patches/{unapplied => }/server/Player-affects-spawning-API.patch (84%)
 rename patches/{unapplied => }/server/Prevent-tile-entity-and-entity-crashes.patch (100%)
 rename patches/{unapplied => }/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch (93%)
 rename patches/{unapplied => }/server/Use-UserCache-for-player-heads.patch (100%)

diff --git a/patches/unapplied/server/Add-BeaconEffectEvent.patch b/patches/server/Add-BeaconEffectEvent.patch
similarity index 100%
rename from patches/unapplied/server/Add-BeaconEffectEvent.patch
rename to patches/server/Add-BeaconEffectEvent.patch
diff --git a/patches/unapplied/server/Add-PlayerInitialSpawnEvent.patch b/patches/server/Add-PlayerInitialSpawnEvent.patch
similarity index 96%
rename from patches/unapplied/server/Add-PlayerInitialSpawnEvent.patch
rename to patches/server/Add-PlayerInitialSpawnEvent.patch
index f1179469fc..05b222dce5 100644
--- a/patches/unapplied/server/Add-PlayerInitialSpawnEvent.patch
+++ b/patches/server/Add-PlayerInitialSpawnEvent.patch
@@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 @@ -0,0 +0,0 @@ public abstract class PlayerList {
  
          player.spawnIn(worldserver1);
-         player.gameMode.setLevel((ServerLevel) player.level);
+         player.gameMode.setLevel((ServerLevel) player.level());
 -        player.absMoveTo(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
 +        // Paper start - set raw so we aren't fully joined to the world (not added to chunk or world)
 +        player.setPosRaw(loc.getX(), loc.getY(), loc.getZ());
diff --git a/patches/unapplied/server/Add-command-line-option-to-load-extra-plugin-jars-no.patch b/patches/server/Add-command-line-option-to-load-extra-plugin-jars-no.patch
similarity index 100%
rename from patches/unapplied/server/Add-command-line-option-to-load-extra-plugin-jars-no.patch
rename to patches/server/Add-command-line-option-to-load-extra-plugin-jars-no.patch
diff --git a/patches/unapplied/server/Add-configurable-despawn-distances-for-living-entiti.patch b/patches/server/Add-configurable-despawn-distances-for-living-entiti.patch
similarity index 100%
rename from patches/unapplied/server/Add-configurable-despawn-distances-for-living-entiti.patch
rename to patches/server/Add-configurable-despawn-distances-for-living-entiti.patch
diff --git a/patches/unapplied/server/Add-configurable-portal-search-radius.patch b/patches/server/Add-configurable-portal-search-radius.patch
similarity index 97%
rename from patches/unapplied/server/Add-configurable-portal-search-radius.patch
rename to patches/server/Add-configurable-portal-search-radius.patch
index 89d46939ef..4d653fd7af 100644
--- a/patches/unapplied/server/Add-configurable-portal-search-radius.patch
+++ b/patches/server/Add-configurable-portal-search-radius.patch
@@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- 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 {
-                 double d0 = DimensionType.getTeleportationScale(this.level.dimensionType(), destination.dimensionType());
+                 double d0 = DimensionType.getTeleportationScale(this.level().dimensionType(), destination.dimensionType());
                  BlockPos blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0);
                  // CraftBukkit start
 -                CraftPortalEvent event = this.callPortalEvent(this, destination, new PositionImpl(blockposition.getX(), blockposition.getY(), blockposition.getZ()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
diff --git a/patches/unapplied/server/Add-exception-reporting-event.patch b/patches/server/Add-exception-reporting-event.patch
similarity index 100%
rename from patches/unapplied/server/Add-exception-reporting-event.patch
rename to patches/server/Add-exception-reporting-event.patch
diff --git a/patches/unapplied/server/Add-methods-for-working-with-arrows-stuck-in-living-.patch b/patches/server/Add-methods-for-working-with-arrows-stuck-in-living-.patch
similarity index 100%
rename from patches/unapplied/server/Add-methods-for-working-with-arrows-stuck-in-living-.patch
rename to patches/server/Add-methods-for-working-with-arrows-stuck-in-living-.patch
diff --git a/patches/unapplied/server/Add-velocity-warnings.patch b/patches/server/Add-velocity-warnings.patch
similarity index 95%
rename from patches/unapplied/server/Add-velocity-warnings.patch
rename to patches/server/Add-velocity-warnings.patch
index 814b5c62d6..f7fa993bbd 100644
--- a/patches/unapplied/server/Add-velocity-warnings.patch
+++ b/patches/server/Add-velocity-warnings.patch
@@ -65,7 +65,7 @@ diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/spigotmc/WatchdogThread.java
 +++ b/src/main/java/org/spigotmc/WatchdogThread.java
-@@ -0,0 +0,0 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
+@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
                      log.log( Level.SEVERE, "During the run of the server, a physics stackoverflow was supressed" );
                      log.log( Level.SEVERE, "near " + net.minecraft.world.level.Level.lastPhysicsProblem );
                  }
@@ -85,4 +85,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +                // Paper end
                  log.log( Level.SEVERE, "------------------------------" );
                  log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
-                 io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper // Paper - rewrite chunk system
+                 WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
diff --git a/patches/unapplied/server/Add-version-history-to-version-command.patch b/patches/server/Add-version-history-to-version-command.patch
similarity index 100%
rename from patches/unapplied/server/Add-version-history-to-version-command.patch
rename to patches/server/Add-version-history-to-version-command.patch
diff --git a/patches/unapplied/server/All-chunks-are-slime-spawn-chunks-toggle.patch b/patches/server/All-chunks-are-slime-spawn-chunks-toggle.patch
similarity index 100%
rename from patches/unapplied/server/All-chunks-are-slime-spawn-chunks-toggle.patch
rename to patches/server/All-chunks-are-slime-spawn-chunks-toggle.patch
diff --git a/patches/unapplied/server/Allow-for-toggling-of-spawn-chunks.patch b/patches/server/Allow-for-toggling-of-spawn-chunks.patch
similarity index 100%
rename from patches/unapplied/server/Allow-for-toggling-of-spawn-chunks.patch
rename to patches/server/Allow-for-toggling-of-spawn-chunks.patch
diff --git a/patches/unapplied/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/patches/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch
similarity index 96%
rename from patches/unapplied/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch
rename to patches/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch
index ccc17c9d1a..ae125bb085 100644
--- a/patches/unapplied/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch
+++ b/patches/server/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch
@@ -32,9 +32,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +            return;
 +        }
 +        // Paper end
-         this.level.getProfiler().push("sensing");
+         this.level().getProfiler().push("sensing");
          this.sensing.tick();
-         this.level.getProfiler().pop();
+         this.level().getProfiler().pop();
 diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java
diff --git a/patches/unapplied/server/Always-tick-falling-blocks.patch b/patches/server/Always-tick-falling-blocks.patch
similarity index 100%
rename from patches/unapplied/server/Always-tick-falling-blocks.patch
rename to patches/server/Always-tick-falling-blocks.patch
diff --git a/patches/unapplied/server/Be-a-bit-more-informative-in-maxHealth-exception.patch b/patches/server/Be-a-bit-more-informative-in-maxHealth-exception.patch
similarity index 100%
rename from patches/unapplied/server/Be-a-bit-more-informative-in-maxHealth-exception.patch
rename to patches/server/Be-a-bit-more-informative-in-maxHealth-exception.patch
diff --git a/patches/unapplied/server/Check-online-mode-before-converting-and-renaming-pla.patch b/patches/server/Check-online-mode-before-converting-and-renaming-pla.patch
similarity index 100%
rename from patches/unapplied/server/Check-online-mode-before-converting-and-renaming-pla.patch
rename to patches/server/Check-online-mode-before-converting-and-renaming-pla.patch
diff --git a/patches/unapplied/server/Configurable-Disabling-Cat-Chest-Detection.patch b/patches/server/Configurable-Disabling-Cat-Chest-Detection.patch
similarity index 100%
rename from patches/unapplied/server/Configurable-Disabling-Cat-Chest-Detection.patch
rename to patches/server/Configurable-Disabling-Cat-Chest-Detection.patch
diff --git a/patches/unapplied/server/Configurable-baby-zombie-movement-speed.patch b/patches/server/Configurable-baby-zombie-movement-speed.patch
similarity index 97%
rename from patches/unapplied/server/Configurable-baby-zombie-movement-speed.patch
rename to patches/server/Configurable-baby-zombie-movement-speed.patch
index 2af65fafc8..5133328179 100644
--- a/patches/unapplied/server/Configurable-baby-zombie-movement-speed.patch
+++ b/patches/server/Configurable-baby-zombie-movement-speed.patch
@@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
      private static final EntityDataAccessor<Integer> DATA_SPECIAL_TYPE_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.INT);
      public static final EntityDataAccessor<Boolean> DATA_DROWNED_CONVERSION_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN);
 @@ -0,0 +0,0 @@ public class Zombie extends Monster {
-         if (this.level != null && !this.level.isClientSide) {
+         if (this.level() != null && !this.level().isClientSide) {
              AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
  
 -            attributemodifiable.removeModifier(Zombie.SPEED_MODIFIER_BABY);
diff --git a/patches/unapplied/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch b/patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch
similarity index 100%
rename from patches/unapplied/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch
rename to patches/server/Configurable-cactus-bamboo-and-reed-growth-heights.patch
diff --git a/patches/unapplied/server/Configurable-container-update-tick-rate.patch b/patches/server/Configurable-container-update-tick-rate.patch
similarity index 87%
rename from patches/unapplied/server/Configurable-container-update-tick-rate.patch
rename to patches/server/Configurable-container-update-tick-rate.patch
index 12f14df49c..43bdde793f 100644
--- a/patches/unapplied/server/Configurable-container-update-tick-rate.patch
+++ b/patches/server/Configurable-container-update-tick-rate.patch
@@ -24,9 +24,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        // Paper start - Configurable container update tick rate
 +        if (--containerUpdateDelay <= 0) {
 +            this.containerMenu.broadcastChanges();
-+            containerUpdateDelay = level.paperConfig().tickRates.containerUpdate;
++            containerUpdateDelay = this.level().paperConfig().tickRates.containerUpdate;
 +        }
 +        // Paper end
-         if (!this.level.isClientSide && !this.containerMenu.stillValid(this)) {
+         if (!this.level().isClientSide && !this.containerMenu.stillValid(this)) {
              this.closeContainer();
              this.containerMenu = this.inventoryMenu;
diff --git a/patches/unapplied/server/Configurable-end-credits.patch b/patches/server/Configurable-end-credits.patch
similarity index 90%
rename from patches/unapplied/server/Configurable-end-credits.patch
rename to patches/server/Configurable-end-credits.patch
index 91ce344eed..9508553f3a 100644
--- a/patches/unapplied/server/Configurable-end-credits.patch
+++ b/patches/server/Configurable-end-credits.patch
@@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
 @@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
              this.unRide();
-             this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
+             this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
              if (!this.wonGame) {
 +                if (level.paperConfig().misc.disableEndCredits) this.seenCredits = true; // Paper - Toggle to always disable end credits
                  this.wonGame = true;
diff --git a/patches/unapplied/server/Configurable-fishing-time-ranges.patch b/patches/server/Configurable-fishing-time-ranges.patch
similarity index 100%
rename from patches/unapplied/server/Configurable-fishing-time-ranges.patch
rename to patches/server/Configurable-fishing-time-ranges.patch
diff --git a/patches/unapplied/server/Configurable-inter-world-teleportation-safety.patch b/patches/server/Configurable-inter-world-teleportation-safety.patch
similarity index 100%
rename from patches/unapplied/server/Configurable-inter-world-teleportation-safety.patch
rename to patches/server/Configurable-inter-world-teleportation-safety.patch
diff --git a/patches/unapplied/server/Configurable-mob-spawner-tick-rate.patch b/patches/server/Configurable-mob-spawner-tick-rate.patch
similarity index 70%
rename from patches/unapplied/server/Configurable-mob-spawner-tick-rate.patch
rename to patches/server/Configurable-mob-spawner-tick-rate.patch
index a250e7b686..9e09e47df3 100644
--- a/patches/unapplied/server/Configurable-mob-spawner-tick-rate.patch
+++ b/patches/server/Configurable-mob-spawner-tick-rate.patch
@@ -37,13 +37,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              } else {
                  boolean flag = false;
                  RandomSource randomsource = world.getRandom();
-@@ -0,0 +0,0 @@ public abstract class BaseSpawner {
-                                 ((Mob) entity).finalizeSpawn(world, world.getCurrentDifficultyAt(entity.blockPosition()), MobSpawnType.SPAWNER, (SpawnGroupData) null, (CompoundTag) null);
-                             }
-                             // Spigot Start
--                            if ( entityinsentient.level.spigotConfig.nerfSpawnerMobs )
--                            {
-+                            if (entityinsentient.level.spigotConfig.nerfSpawnerMobs) {
-                                 entityinsentient.aware = false;
-                             }
-                             // Spigot End
diff --git a/patches/unapplied/server/Configurable-top-of-nether-void-damage.patch b/patches/server/Configurable-top-of-nether-void-damage.patch
similarity index 95%
rename from patches/unapplied/server/Configurable-top-of-nether-void-damage.patch
rename to patches/server/Configurable-top-of-nether-void-damage.patch
index e4d21e14ed..44b1546ed1 100644
--- a/patches/unapplied/server/Configurable-top-of-nether-void-damage.patch
+++ b/patches/server/Configurable-top-of-nether-void-damage.patch
@@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
      }
  
-     public void checkOutOfWorld() {
--        if (this.getY() < (double) (this.level.getMinBuildHeight() - 64)) {
+     public void checkBelowWorld() {
+-        if (this.getY() < (double) (this.level().getMinBuildHeight() - 64)) {
 +        // Paper start - Configurable nether ceiling damage
 +        if (this.getY() < (double) (this.level.getMinBuildHeight() - 64) || (this.level.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER
 +            && this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v)
 +            && (!(this instanceof Player player) || !player.getAbilities().invulnerable))) {
 +            // Paper end
-             this.outOfWorld();
+             this.onBelowWorld();
          }
  
 diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java
diff --git a/patches/unapplied/server/Disable-Scoreboards-for-non-players-by-default.patch b/patches/server/Disable-Scoreboards-for-non-players-by-default.patch
similarity index 72%
rename from patches/unapplied/server/Disable-Scoreboards-for-non-players-by-default.patch
rename to patches/server/Disable-Scoreboards-for-non-players-by-default.patch
index 8ae2cc3df6..4006436fa0 100644
--- a/patches/unapplied/server/Disable-Scoreboards-for-non-players-by-default.patch
+++ b/patches/server/Disable-Scoreboards-for-non-players-by-default.patch
@@ -18,8 +18,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
      @Nullable
      public Team getTeam() {
-+        if (!this.level.paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper
-         return this.level.getScoreboard().getPlayersTeam(this.getScoreboardName());
++        if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof Player)) { return null; } // Paper
+         return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
      }
  
 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -29,8 +29,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
          if (nbt.contains("Team", 8)) {
              String s = nbt.getString("Team");
-             PlayerTeam scoreboardteam = this.level.getScoreboard().getPlayerTeam(s);
-+            if (!level.paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof net.minecraft.world.entity.player.Player)) { scoreboardteam = null; } // Paper
-             boolean flag = scoreboardteam != null && this.level.getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam);
+             PlayerTeam scoreboardteam = this.level().getScoreboard().getPlayerTeam(s);
++            if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof net.minecraft.world.entity.player.Player)) { scoreboardteam = null; } // Paper
+             boolean flag = scoreboardteam != null && this.level().getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam);
  
              if (!flag) {
diff --git a/patches/unapplied/server/Disable-explosion-knockback.patch b/patches/server/Disable-explosion-knockback.patch
similarity index 95%
rename from patches/unapplied/server/Disable-explosion-knockback.patch
rename to patches/server/Disable-explosion-knockback.patch
index f9aae4f2fb..960725faea 100644
--- a/patches/unapplied/server/Disable-explosion-knockback.patch
+++ b/patches/server/Disable-explosion-knockback.patch
@@ -15,10 +15,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +            boolean knockbackCancelled = level.paperConfig().environment.disableExplosionKnockback && source.is(DamageTypeTags.IS_EXPLOSION) && this instanceof net.minecraft.world.entity.player.Player; // Paper - Disable explosion knockback
              if (flag1) {
                  if (flag) {
-                     this.level.broadcastEntityEvent(this, (byte) 29);
+                     this.level().broadcastEntityEvent(this, (byte) 29);
                  } else {
 +                    if (!knockbackCancelled) // Paper - Disable explosion knockback
-                     this.level.broadcastDamageEvent(this, source);
+                     this.level().broadcastDamageEvent(this, source);
                  }
  
 @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
diff --git a/patches/unapplied/server/Disable-ice-and-snow.patch b/patches/server/Disable-ice-and-snow.patch
similarity index 95%
rename from patches/unapplied/server/Disable-ice-and-snow.patch
rename to patches/server/Disable-ice-and-snow.patch
index c8ee6af325..47f673358b 100644
--- a/patches/unapplied/server/Disable-ice-and-snow.patch
+++ b/patches/server/Disable-ice-and-snow.patch
@@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
 +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
 @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
-         gameprofilerfiller.popPush("iceandsnow");
          int l;
+         int i1;
  
 -        if (this.random.nextInt(16) == 0) {
 +        if (!this.paperConfig().environment.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow
diff --git a/patches/unapplied/server/Disable-spigot-tick-limiters.patch b/patches/server/Disable-spigot-tick-limiters.patch
similarity index 100%
rename from patches/unapplied/server/Disable-spigot-tick-limiters.patch
rename to patches/server/Disable-spigot-tick-limiters.patch
diff --git a/patches/unapplied/server/Disable-thunder.patch b/patches/server/Disable-thunder.patch
similarity index 100%
rename from patches/unapplied/server/Disable-thunder.patch
rename to patches/server/Disable-thunder.patch
diff --git a/patches/unapplied/server/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch b/patches/server/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch
similarity index 100%
rename from patches/unapplied/server/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch
rename to patches/server/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch
diff --git a/patches/unapplied/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch b/patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch
similarity index 94%
rename from patches/unapplied/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch
rename to patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch
index 9a7d8defd7..b6c61e4b0d 100644
--- a/patches/unapplied/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch
+++ b/patches/server/Drop-falling-block-and-tnt-entities-at-the-specified.patch
@@ -13,7 +13,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
              }
  
              this.move(MoverType.SELF, this.getDeltaMovement());
-+
 +            // Paper start - Configurable EntityFallingBlock height nerf
 +            if (this.level.paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) {
 +                if (this.dropItem && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
@@ -24,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +                return;
 +            }
 +            // Paper end
-             if (!this.level.isClientSide) {
+             if (!this.level().isClientSide) {
                  BlockPos blockposition = this.blockPosition();
                  boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock;
 diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -42,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +        }
 +        // Paper end
          this.setDeltaMovement(this.getDeltaMovement().scale(0.98D));
-         if (this.onGround) {
+         if (this.onGround()) {
              this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D));
 diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@@ -59,5 +58,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +            }
 +            // Paper end
              --this.fuse;
-             this.level.addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D);
+             this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D);
          } else if (this.fuse == 0) {
diff --git a/patches/unapplied/server/Ensure-commands-are-not-ran-async.patch b/patches/server/Ensure-commands-are-not-ran-async.patch
similarity index 100%
rename from patches/unapplied/server/Ensure-commands-are-not-ran-async.patch
rename to patches/server/Ensure-commands-are-not-ran-async.patch
diff --git a/patches/unapplied/server/Entity-Origin-API.patch b/patches/server/Entity-Origin-API.patch
similarity index 100%
rename from patches/unapplied/server/Entity-Origin-API.patch
rename to patches/server/Entity-Origin-API.patch
diff --git a/patches/unapplied/server/Expose-server-CommandMap.patch b/patches/server/Expose-server-CommandMap.patch
similarity index 100%
rename from patches/unapplied/server/Expose-server-CommandMap.patch
rename to patches/server/Expose-server-CommandMap.patch
diff --git a/patches/unapplied/server/Fix-lag-from-explosions-processing-dead-entities.patch b/patches/server/Fix-lag-from-explosions-processing-dead-entities.patch
similarity index 100%
rename from patches/unapplied/server/Fix-lag-from-explosions-processing-dead-entities.patch
rename to patches/server/Fix-lag-from-explosions-processing-dead-entities.patch
diff --git a/patches/unapplied/server/Further-improve-server-tick-loop.patch b/patches/server/Further-improve-server-tick-loop.patch
similarity index 96%
rename from patches/unapplied/server/Further-improve-server-tick-loop.patch
rename to patches/server/Further-improve-server-tick-loop.patch
index cd2cdb6f79..062daa4e0b 100644
--- a/patches/unapplied/server/Further-improve-server-tick-loop.patch
+++ b/patches/server/Further-improve-server-tick-loop.patch
@@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +    // Paper End
      // Spigot End
  
-     public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system
+     protected void runServer() {
 @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
  
              // Spigot start
@@ -99,12 +99,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +            long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
 +            lastTick = start - TICK_TIME; // Paper
              while (this.running) {
-                 // Paper start - rewrite chunk system
-                 // guarantee that nothing can stop the server from halting if it can at least still tick
-@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
-                     throw this.chunkSystemCrash;
-                 }
-                 // Paper end - rewrite chunk system
 -                long i = (curTime = Util.getMillis()) - this.nextTickTime;
 +                long i = ((curTime = System.nanoTime()) / (1000L * 1000L)) - this.nextTickTime; // Paper
  
diff --git a/patches/unapplied/server/Implement-Paper-VersionChecker.patch b/patches/server/Implement-Paper-VersionChecker.patch
similarity index 100%
rename from patches/unapplied/server/Implement-Paper-VersionChecker.patch
rename to patches/server/Implement-Paper-VersionChecker.patch
diff --git a/patches/unapplied/server/Implement-PlayerLocaleChangeEvent.patch b/patches/server/Implement-PlayerLocaleChangeEvent.patch
similarity index 100%
rename from patches/unapplied/server/Implement-PlayerLocaleChangeEvent.patch
rename to patches/server/Implement-PlayerLocaleChangeEvent.patch
diff --git a/patches/unapplied/server/Only-refresh-abilities-if-needed.patch b/patches/server/Only-refresh-abilities-if-needed.patch
similarity index 100%
rename from patches/unapplied/server/Only-refresh-abilities-if-needed.patch
rename to patches/server/Only-refresh-abilities-if-needed.patch
diff --git a/patches/unapplied/server/Optimize-explosions.patch b/patches/server/Optimize-explosions.patch
similarity index 100%
rename from patches/unapplied/server/Optimize-explosions.patch
rename to patches/server/Optimize-explosions.patch
diff --git a/patches/unapplied/server/Player-Tab-List-and-Title-APIs.patch b/patches/server/Player-Tab-List-and-Title-APIs.patch
similarity index 100%
rename from patches/unapplied/server/Player-Tab-List-and-Title-APIs.patch
rename to patches/server/Player-Tab-List-and-Title-APIs.patch
diff --git a/patches/unapplied/server/Player-affects-spawning-API.patch b/patches/server/Player-affects-spawning-API.patch
similarity index 84%
rename from patches/unapplied/server/Player-affects-spawning-API.patch
rename to patches/server/Player-affects-spawning-API.patch
index 1877634781..9c76131f1d 100644
--- a/patches/unapplied/server/Player-affects-spawning-API.patch
+++ b/patches/server/Player-affects-spawning-API.patch
@@ -25,11 +25,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/net/minecraft/world/entity/Mob.java
 +++ b/src/main/java/net/minecraft/world/entity/Mob.java
 @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting {
-         if (this.level.getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
+         if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
              this.discard();
          } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
--            Player entityhuman = this.level.getNearestPlayer(this, -1.0D);
-+            Player entityhuman = this.level.findNearbyPlayer(this, -1.0D, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper
+-            Player entityhuman = this.level().getNearestPlayer(this, -1.0D);
++            Player entityhuman = this.level().getNearestPlayer(this, -1.0D, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper
  
              if (entityhuman != null) {
                  double d0 = entityhuman.distanceToSqr((Entity) this);
@@ -41,8 +41,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
  
      @Override
      public boolean canUse() {
--        return this.horse.level.hasNearbyAlivePlayer(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D);
-+        return this.horse.level.hasNearbyAlivePlayerThatAffectsSpawning(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D); // Paper - Affects Spawning API
+-        return this.horse.level().hasNearbyAlivePlayer(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D);
++        return this.horse.level().hasNearbyAlivePlayerThatAffectsSpawning(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D); // Paper - Affects Spawning API
      }
  
      @Override
@@ -65,12 +65,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
 @@ -0,0 +0,0 @@ public class Zombie extends Monster {
  
-                     if (NaturalSpawner.isSpawnPositionOk(entitypositiontypes_surface, this.level, blockposition, entitytypes) && SpawnPlacements.checkSpawnRules(entitytypes, worldserver, MobSpawnType.REINFORCEMENT, blockposition, this.level.random)) {
+                     if (NaturalSpawner.isSpawnPositionOk(entitypositiontypes_surface, this.level(), blockposition, entitytypes) && SpawnPlacements.checkSpawnRules(entitytypes, worldserver, MobSpawnType.REINFORCEMENT, blockposition, this.level().random)) {
                          entityzombie.setPos((double) i1, (double) j1, (double) k1);
--                        if (!this.level.hasNearbyAlivePlayer((double) i1, (double) j1, (double) k1, 7.0D) && this.level.isUnobstructed(entityzombie) && this.level.noCollision((Entity) entityzombie) && !this.level.containsAnyLiquid(entityzombie.getBoundingBox())) {
-+                        if (!this.level.hasNearbyAlivePlayerThatAffectsSpawning((double) i1, (double) j1, (double) k1, 7.0D) && this.level.isUnobstructed(entityzombie) && this.level.noCollision((Entity) entityzombie) && !this.level.containsAnyLiquid(entityzombie.getBoundingBox())) { // Paper - Affects Spawning API
+-                        if (!this.level().hasNearbyAlivePlayer((double) i1, (double) j1, (double) k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) {
++                        if (!this.level().hasNearbyAlivePlayerThatAffectsSpawning((double) i1, (double) j1, (double) k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) { // Paper - Affects Spawning API
                              entityzombie.setTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); // CraftBukkit
-                             entityzombie.finalizeSpawn(worldserver, this.level.getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.REINFORCEMENT, (SpawnGroupData) null, (CompoundTag) null);
+                             entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.REINFORCEMENT, (SpawnGroupData) null, (CompoundTag) null);
                              worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
 diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
diff --git a/patches/unapplied/server/Prevent-tile-entity-and-entity-crashes.patch b/patches/server/Prevent-tile-entity-and-entity-crashes.patch
similarity index 100%
rename from patches/unapplied/server/Prevent-tile-entity-and-entity-crashes.patch
rename to patches/server/Prevent-tile-entity-and-entity-crashes.patch
diff --git a/patches/unapplied/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch
similarity index 93%
rename from patches/unapplied/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch
rename to patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch
index de8ee7d258..3bd592f65c 100644
--- a/patches/unapplied/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch
+++ b/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch
@@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 --- a/src/main/java/org/bukkit/craftbukkit/Main.java
 +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
 @@ -0,0 +0,0 @@ public class Main {
-                     deadline.add(Calendar.DAY_OF_YEAR, -21);
+                     deadline.add(Calendar.DAY_OF_YEAR, -3);
                      if (buildDate.before(deadline.getTime())) {
                          System.err.println("*** Error, this build is outdated ***");
 -                        System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");
@@ -66,7 +66,7 @@ diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/
 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 --- a/src/main/java/org/spigotmc/WatchdogThread.java
 +++ b/src/main/java/org/spigotmc/WatchdogThread.java
-@@ -0,0 +0,0 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
+@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
  
      private WatchdogThread(long timeoutTime, boolean restart)
      {
@@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
          this.timeoutTime = timeoutTime;
          this.restart = restart;
      }
-@@ -0,0 +0,0 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
+@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
              {
                  Logger log = Bukkit.getServer().getLogger();
                  log.log( Level.SEVERE, "------------------------------" );
@@ -93,12 +93,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
                  //
                  if ( net.minecraft.world.level.Level.lastPhysicsProblem != null )
                  {
-@@ -0,0 +0,0 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
+@@ -0,0 +0,0 @@ public class WatchdogThread extends Thread
                  }
                  //
                  log.log( Level.SEVERE, "------------------------------" );
 -                log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Spigot!):" );
 +                log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper
-                 io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper // Paper - rewrite chunk system
                  WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
                  log.log( Level.SEVERE, "------------------------------" );
+                 //
diff --git a/patches/unapplied/server/Use-UserCache-for-player-heads.patch b/patches/server/Use-UserCache-for-player-heads.patch
similarity index 100%
rename from patches/unapplied/server/Use-UserCache-for-player-heads.patch
rename to patches/server/Use-UserCache-for-player-heads.patch