diff --git a/patches/server/0005-Threaded-Regions.patch b/patches/server/0005-Threaded-Regions.patch index 1f2d888..65f14b5 100644 --- a/patches/server/0005-Threaded-Regions.patch +++ b/patches/server/0005-Threaded-Regions.patch @@ -11786,9 +11786,18 @@ index d2f0a0755317f5fa9a1ccf7db346aa77fd287d80..b07df826a3028c14b48b09dbaeccc907 // CraftBukkit start - SPIGOT-5477, MC-142590 } else if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3219482b96cab8262e393a790c88d903d7de5166..f5977082a31d44088ab5ba31fad88e823cfe56e0 100644 +index 3219482b96cab8262e393a790c88d903d7de5166..3478d9c1db9acf19165df7308b6ae4461fa8fef7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -242,7 +242,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop {}; +- } +- // Paper end +- return new TickTask(this.tickCount, runnable); ++ throw new UnsupportedOperationException(); // Folia - region threading + } + + protected boolean shouldRun(TickTask ticktask) { +- return ticktask.getTick() + 3 < this.tickCount || this.haveTime(); ++ throw new UnsupportedOperationException(); // Folia - region threading + } @Override public boolean pollTask() { @@ -12043,7 +12083,7 @@ index 3219482b96cab8262e393a790c88d903d7de5166..f5977082a31d44088ab5ba31fad88e82 boolean flag = this.pollTaskInternal(); this.mayHaveDelayedTasks = flag; -@@ -1316,6 +1417,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= 5000000000L) { ++ // Folia - region threading + this.tickChildren(shouldKeepTicking, region); // Folia - region threading + if (region == null && i - this.lastServerStatus >= 5000000000L) { // Folia - region threading - moved to global tick this.lastServerStatus = i; this.status = this.buildServerStatus(); } -@@ -1412,9 +1557,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; ++ final boolean fullSave = autosavePeriod > 0 && io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick() % autosavePeriod == 0; // Folia - region threading + try { + this.isSaving = true; if (playerSaveInterval > 0) { this.playerList.saveAll(playerSaveInterval); } @@ -12141,7 +12189,7 @@ index 3219482b96cab8262e393a790c88d903d7de5166..f5977082a31d44088ab5ba31fad88e82 } } } finally { -@@ -1424,16 +1569,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { return worldserver + " " + worldserver.dimension().location(); -@@ -1543,7 +1694,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop world.getMinBuildHeight()) { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 02cb6b8c1d59855ff4a8aad3024fe12007eca0ee..a719dc69b48ae867ce0b508d3d640e65d2863068 100644 +index 02cb6b8c1d59855ff4a8aad3024fe12007eca0ee..8ea463720fde25954c208d1e91571f1494d24aea 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -135,6 +135,14 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -19172,6 +19248,15 @@ index 02cb6b8c1d59855ff4a8aad3024fe12007eca0ee..a719dc69b48ae867ce0b508d3d640e65 if (entityhuman != null) { double d0 = entityhuman.distanceToSqr((Entity) this); +@@ -903,7 +918,7 @@ public abstract class Mob extends LivingEntity implements Targeting { + this.level.getProfiler().push("sensing"); + this.sensing.tick(); + this.level.getProfiler().pop(); +- int i = this.level.getServer().getTickCount() + this.getId(); ++ int i = this.tickCount + this.getId(); // Folia - region threading + + if (i % 2 != 0 && this.tickCount > 1) { + this.level.getProfiler().push("targetSelector"); @@ -1728,6 +1743,15 @@ public abstract class Mob extends LivingEntity implements Targeting { this.goalSelector.removeAllGoals(predicate); } diff --git a/patches/server/0011-Disable-mid-tick-task-execution.patch b/patches/server/0011-Disable-mid-tick-task-execution.patch index 7c5a7c9..baad64c 100644 --- a/patches/server/0011-Disable-mid-tick-task-execution.patch +++ b/patches/server/0011-Disable-mid-tick-task-execution.patch @@ -10,10 +10,10 @@ the impact from scaling the region threads, but is not a fix to the underlying issue. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f5977082a31d44088ab5ba31fad88e823cfe56e0..f5721f6d719b7055fdccc81d5e67ed758e90cb10 100644 +index 3478d9c1db9acf19165df7308b6ae4461fa8fef7..61bac6fda2d2f4b3db8a3f7e3003f47c84d5c4cd 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2909,6 +2909,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop