Update Paper and add configurable region shift

The region shift is configurable under `grid-exponent`, which
allows setting the region shift to any value in [0, 31]. Note
that values above 6 affect the lock shift, as the lock shift
currently is computed as max(ticket shift = 6, region shift).
The shift is left configurable for now as the lower default
shift of 2 may have negative performance impacts.

The default region shift has been adjusted to 2 from 4, and
the empty chunk buffer has been reduced to 8 from 16. These
changes reduce, but do not eliminate, player spread
requirements. The previous block range was around ~1500 blocks
at VD = 10, but is now closer to ~900 blocks at VD = 10. This
roughly reduces the area that each player uses in the regioniser
by 2.5x.
This commit is contained in:
Spottedleaf 2023-12-30 16:32:01 -08:00
parent 9a389a1a5e
commit 6928284a56
10 changed files with 376 additions and 376 deletions

View File

@ -2,7 +2,7 @@ group=dev.folia
version=1.20.4-R0.1-SNAPSHOT
mcVersion=1.20.4
paperRef=1e7dd72f15a1d13b43792367193547c656a16ab6
paperRef=1281f4f5526c0b8bdc32915c41dc6af6b4f9fea2
org.gradle.caching=true
org.gradle.parallel=true

View File

@ -5,13 +5,13 @@ Subject: [PATCH] Build changes
diff --git a/build.gradle.kts b/build.gradle.kts
index b12b5a1e82a5ebf47135a3863a390a45a9d8d8ec..03abea227c555decd559dd58b33913127f3549a4 100644
index 58da26ad2f128ba0b66f86820f60853f4be352f0..38352926640d97449256d50ebdec619ce9e695a0 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -27,8 +27,12 @@ repositories {
@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
val alsoShade: Configuration by configurations.creating
dependencies {
extraRuntime(platform("net.kyori:adventure-bom:4.15.0-SNAPSHOT"))
- implementation(project(":paper-api"))
- implementation(project(":paper-mojangapi"))
+ // Folia start
@ -23,7 +23,7 @@ index b12b5a1e82a5ebf47135a3863a390a45a9d8d8ec..03abea227c555decd559dd58b3391312
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -84,7 +88,7 @@ tasks.jar {
@@ -70,7 +74,7 @@ tasks.jar {
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
@ -32,7 +32,7 @@ index b12b5a1e82a5ebf47135a3863a390a45a9d8d8ec..03abea227c555decd559dd58b3391312
"Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit",
"Specification-Version" to project.version,
@@ -168,7 +172,7 @@ fun TaskContainer.registerRunTask(
@@ -154,7 +158,7 @@ fun TaskContainer.registerRunTask(
name: String,
block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) {
@ -106,7 +106,7 @@ index 34f19ac897a30c0c4e3ab406013fcca1c8b7db93..5ed6c8710b78458031ed6b0273fb2f6a
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e011cfcdda2e0a609d4158b0454bdf046b04c9d9..3e7b9561dd69b634149181be7a537d0546ceb233 100644
index 142d2c48239d4ebe3896218536656d116cd24d7c..d0bddf66a8cbf1cd1348cc40ef8bbc125b7483ed 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -264,7 +264,7 @@ import javax.annotation.Nullable; // Paper

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Max pending logins
Should help the floodgates on launch
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 54aa8ac790f7d23d6404d037105642ddddb7839b..c18fc39db6480f0942128a5512970fdce074b7c6 100644
index 5834d5e10c0b9892f29977666e7b168a9463a3d9..5bac302f6aab2c61cba87ea3e32a260eeb0284b4 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -89,7 +89,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@ -19,7 +19,7 @@ index 54aa8ac790f7d23d6404d037105642ddddb7839b..c18fc39db6480f0942128a5512970fdc
if (this.state == ServerLoginPacketListenerImpl.State.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 0fa69640a699e1c33cb307366b0335ac9bac4282..bc31d4dfd6fca354c093f552901a59e5b83c92d7 100644
index 184057aae74e8918bf05ab03429cb0419ae9ba06..eb797313a13b5a805f834b2e9f08989e381f0761 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -171,6 +171,17 @@ public abstract class PlayerList {

View File

@ -897,7 +897,7 @@ index d657fd2c507a5b215aeab0a5f3e9c2ee892a27c8..9fc90b162aab15a9cd60b02aba563181
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 9a4a7bae17dd554aeeffb0ec4cb0876ef797e097..a47939461fcf3ba9aabcf66d1db9738b9785314a 100644
index 56c7eda0dbfbb8987e1e642936b46e2a320466f7..b3faadd991f6885bfcaf4fd6fa895889670a1bb2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -490,7 +490,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@ -1590,10 +1590,10 @@ index 70b377c03346cb8573827aeb493f3b6eb8efb1f8..b2e8c26162dd5782a0447cd03ca00fb4
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 25ffc92c3d6055285a64d9fe36c0054228fe81dd..f2360767907480b64fd51ac3156932b9bf8ee609 100644
index 1f1ef68a9a449a4a90c284f34a397ab4b6d905f6..9da62ca03e60c8cbe4714c7056c7642cce2c0b9e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -417,6 +417,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -416,6 +416,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().invulnerableTime = ticks;
}
@ -1607,7 +1607,7 @@ index 25ffc92c3d6055285a64d9fe36c0054228fe81dd..f2360767907480b64fd51ac3156932b9
@Override
public int getNoActionTicks() {
return this.getHandle().getNoActionTime();
@@ -430,6 +437,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -429,6 +436,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public net.minecraft.world.entity.LivingEntity getHandle() {
@ -2130,7 +2130,7 @@ index 2638c341bc02f201f7ab17fdebcdbdf3a7ec05bf..0f5c2d31a2dea13a46ba81e353393633
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0566674223e16e34eaa4ab1d21e0e060bd0aeee5..fca4f9a50e57a2b40c7bca92d975b72da1075fa3 100644
index 5a7263da8e82e45c616e6cbf227929813028b136..a288ed0640bfe852677294398474510ab578577a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -616,7 +616,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -2142,7 +2142,7 @@ index 0566674223e16e34eaa4ab1d21e0e060bd0aeee5..fca4f9a50e57a2b40c7bca92d975b72d
final ServerGamePacketListenerImpl connection = this.getHandle().connection;
if (connection != null) {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause);
@@ -2159,9 +2159,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2200,9 +2200,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this;
}
@ -2160,7 +2160,7 @@ index 0566674223e16e34eaa4ab1d21e0e060bd0aeee5..fca4f9a50e57a2b40c7bca92d975b72d
}
public void setHandle(final ServerPlayer entity) {
@@ -3172,7 +3179,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3236,7 +3243,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
{
if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() )
{

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Throw UnsupportedOperationException() for broken APIs
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6e2bbd699d9b168ee9eb89461d588701c0511a24..bea388ced64da6192166f6f8461abdc0921ed7b0 100644
index bfa318486443c61c3734046331fdfeecf9852591..7d1be59d03fa4e46295bc91943fea16bd9c7c802 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1264,6 +1264,7 @@ public final class CraftServer implements Server {
@ -25,7 +25,7 @@ index 6e2bbd699d9b168ee9eb89461d588701c0511a24..bea388ced64da6192166f6f8461abdc0
if (world == null) {
return false;
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
index bd8a5bb2b84daf013750aec9887dcb4b02b382ad..299e7290fea260d739687be70a796c5a4add325b 100644
index e7d3637927e92c181ecc2e21a3456918afb30822..942c2dafbf2b6a0df8415fa9c09747ed313ee209 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java
@@ -45,6 +45,7 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard {

View File

@ -9,10 +9,10 @@ add explicit block update suppression techniques, it's better
than the server crashing.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 91f17ee2b6c9e1413b5bef62adcfe2a0d9537fef..474757fe16986d84f84302a22441c332d622d038 100644
index 48480686e8f1a554818e58890f9a8f3f4afd0a43..b924986c4e3b9e20a4100481c5d6534b040950af 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1764,7 +1764,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1758,7 +1758,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
Direction enumdirection = (Direction) iterator.next();
BlockPos blockposition1 = pos.relative(enumdirection);

View File

@ -9,7 +9,7 @@ data deserialization and is racey even in Vanilla. But in Folia,
some accesses may throw and as such we need to fix this directly.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 08176ffc089fd20f64f98690d0f383f6d91aaf53..0b27e7ffdc6b61b8e64afc253a8470c1ad8791dd 100644
index e479129a977721fc8061be968eefab4daa407f5c..3d2b059254fdc08d1e4f9281946028a46884d7c8 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -644,7 +644,7 @@ public class ServerPlayer extends Player {
@ -22,7 +22,7 @@ index 08176ffc089fd20f64f98690d0f383f6d91aaf53..0b27e7ffdc6b61b8e64afc253a8470c1
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index d74c6ee198daa125d78cd815e1e0d1f7194caeac..15e441ba4d5286e7bf677f7c0ad5fb8f62437d72 100644
index 46b835f65ec64720efa54cc524f16a3fa536e90b..abf455d165004240e0b5fd96543f7da7c520e729 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4360,6 +4360,11 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@ -7,7 +7,7 @@ This allows the player to be re-positioned before logging into
the world without causing thread checks to trip on Folia.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index bc31d4dfd6fca354c093f552901a59e5b83c92d7..72c32a9b4b0606162a0f994b3d8170f0fe4d5022 100644
index eb797313a13b5a805f834b2e9f08989e381f0761..e63ad8ed0318fb99e99a8609ef6a31d16f87e7ff 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -514,7 +514,13 @@ public abstract class PlayerList {

View File

@ -926,10 +926,10 @@ index 0000000000000000000000000000000000000000..95c0e6416afafbb633f0a30ae22df166
+ ) {}
+}
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
index 40411b335e99f67d6a82e70db6e5e4c0372102ec..db4ee79b2345a3be0723416a83251d1c76bf834b 100644
index 30259130f23dc07288a7cbb33456b07bd11f0d56..a4157bc24c36c63502667d69910108a50114f370 100644
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkHolderManager.java
@@ -1470,8 +1470,11 @@ public final class ChunkHolderManager {
@@ -1471,8 +1471,11 @@ public final class ChunkHolderManager {
}
public boolean processTicketUpdates() {
@ -1021,10 +1021,10 @@ index 150610d7bf25416dbbde7f003c47da562acc68ba..865044d40a95d201765435cbc14b0384
public TickThreadRunner(final Runnable run, final String name) {
super(run, name);
diff --git a/src/main/java/io/papermc/paper/threadedregions/TickRegions.java b/src/main/java/io/papermc/paper/threadedregions/TickRegions.java
index 902e82854c89779c7e23c63d1be5b04dad2a61e3..fef65cc17be9fc465b2668b8cfbde104342c9d97 100644
index 924ade31b788b161a7c8f587504b2fc86932a2ee..2ad25dd345ab42125d456f2b9cf67d8c4515c8b7 100644
--- a/src/main/java/io/papermc/paper/threadedregions/TickRegions.java
+++ b/src/main/java/io/papermc/paper/threadedregions/TickRegions.java
@@ -76,6 +76,11 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
@@ -81,6 +81,11 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
@Override
public void onRegionDestroy(final ThreadedRegionizer.ThreadedRegion<TickRegionData, TickRegionSectionData> region) {
// nothing for now
@ -1036,7 +1036,7 @@ index 902e82854c89779c7e23c63d1be5b04dad2a61e3..fef65cc17be9fc465b2668b8cfbde104
}
@Override
@@ -98,13 +103,23 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
@@ -103,13 +108,23 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
@Override
public void preMerge(final ThreadedRegionizer.ThreadedRegion<TickRegionData, TickRegionSectionData> from,
final ThreadedRegionizer.ThreadedRegion<TickRegionData, TickRegionSectionData> into) {
@ -1062,7 +1062,7 @@ index 902e82854c89779c7e23c63d1be5b04dad2a61e3..fef65cc17be9fc465b2668b8cfbde104
}
public static final class TickRegionSectionData implements ThreadedRegionizer.ThreadedRegionSectionData {}
@@ -162,6 +177,8 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
@@ -167,6 +182,8 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
// async-safe read-only region data
private final RegionStats regionStats;
@ -1071,7 +1071,7 @@ index 902e82854c89779c7e23c63d1be5b04dad2a61e3..fef65cc17be9fc465b2668b8cfbde104
private TickRegionData(final ThreadedRegionizer.ThreadedRegion<TickRegionData, TickRegionSectionData> region) {
this.region = region;
this.world = region.regioniser.world;
@@ -367,13 +384,29 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
@@ -372,13 +389,29 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
return this.region.region.markNotTicking();
}
@ -1101,7 +1101,7 @@ index 902e82854c89779c7e23c63d1be5b04dad2a61e3..fef65cc17be9fc465b2668b8cfbde104
final RegionizedTaskQueue.RegionTaskQueueData queue = this.region.taskQueueData;
boolean processedChunkTask = false;
@@ -394,6 +427,7 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
@@ -399,6 +432,7 @@ public final class TickRegions implements ThreadedRegionizer.RegionCallbacks<Tic
this.region.world.chunkTaskScheduler.chunkHolderManager.processTicketUpdates();
}
return true;
@ -1460,10 +1460,10 @@ index 027d95e0763c6e18380b706fcd7f48c09a7cc17a..9ea861c1531c5f9d8a87e45512336eba
} catch (Throwable throwable) {
// Spigot Start
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f640a0b8742a8362401f91a9a0f8fbb31885dca0..50597a8b45bbd7dcc40b361da78358d9d01f5484 100644
index 4bd78902afc1824f3acdeef6067eb45a8f661b65..c0aaa5ff3839698e262270f2bc315d39c31620ea 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -471,16 +471,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -470,16 +470,21 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected void tick(BooleanSupplier shouldKeepTicking) {
@ -1485,7 +1485,7 @@ index f640a0b8742a8362401f91a9a0f8fbb31885dca0..50597a8b45bbd7dcc40b361da78358d9
} // Paper
}
@@ -1093,9 +1098,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1092,9 +1097,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Folia start - region threading - replace entity tracking ticking
private void foliaEntityTrackerTick() {
@ -1500,7 +1500,7 @@ index f640a0b8742a8362401f91a9a0f8fbb31885dca0..50597a8b45bbd7dcc40b361da78358d9
TrackedEntity tracker = entity.tracker;
if (tracker == null) {
continue;
@@ -1105,12 +1115,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1104,12 +1114,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
// process unloads
for (Entity entity : worldData.takeTrackingUnloads()) {
@ -1629,10 +1629,10 @@ index a21cc9c7d5981c742f379affe9c1ef4dcb0fa1e1..88db5ada13329a5fe0d0fb652d2c8a8d
// Folia end - region threading
// Paper end - optimise chunk tick iteration
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e992a8f4c 100644
index 4fad00372277b45aa622e0285a9e3278be082392..fdb5237935a13322d8e7332b199308513b9f8e9b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -893,6 +893,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -898,6 +898,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void tick(BooleanSupplier shouldKeepTicking, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - regionised ticking
final io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = this.getCurrentWorldData(); // Folia - regionised ticking
@ -1640,7 +1640,7 @@ index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e
ProfilerFiller gameprofilerfiller = this.getProfiler();
regionizedWorldData.setHandlingTick(true); // Folia - regionised ticking
@@ -921,9 +922,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -926,9 +927,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!this.isDebug() && flag) {
j = regionizedWorldData.getRedstoneGameTime(); // Folia - region threading
gameprofilerfiller.push("blockTicks");
@ -1654,7 +1654,7 @@ index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e
gameprofilerfiller.pop();
}
this.timings.scheduledBlocks.stopTiming(); // Paper
@@ -931,18 +936,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -936,18 +941,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.popPush("raid");
if (flag) {
this.timings.raids.startTiming(); // Paper - timings
@ -1679,7 +1679,7 @@ index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e
this.timings.doSounds.stopTiming(); // Spigot
}
@@ -958,6 +969,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -963,6 +974,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.push("entities");
this.timings.tickEntities.startTiming(); // Spigot
if (this.dragonFight != null && flag) {
@ -1687,7 +1687,7 @@ index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e
if (io.papermc.paper.util.TickThread.isTickThreadFor(this, this.dragonFight.origin)) { // Folia - region threading
gameprofilerfiller.push("dragonFight");
this.dragonFight.tick();
@@ -970,10 +982,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -975,10 +987,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
fightCenter
);
} // Folia end - region threading
@ -1700,7 +1700,7 @@ index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e
regionizedWorldData.forEachTickingEntity((entity) -> { // Folia - regionised ticking
if (!entity.isRemoved()) {
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
@@ -1001,10 +1015,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1006,10 +1020,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
});
@ -1714,7 +1714,7 @@ index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e
}
gameprofilerfiller.push("entityManagement");
@@ -1064,12 +1081,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1069,12 +1086,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public void tickCustomSpawners(boolean spawnMonsters, boolean spawnAnimals) {
@ -1730,7 +1730,7 @@ index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e
}
}
@@ -1519,6 +1539,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1524,6 +1544,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper start- timings
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity);
timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper
@ -1742,7 +1742,7 @@ index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e
try {
// Paper end - timings
entity.setOldPosAndRot();
@@ -1544,7 +1569,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1549,7 +1574,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Folia end - region threading
} else { entity.inactiveTick(); } // Paper - EAR 2
this.getProfiler().pop();
@ -1751,7 +1751,7 @@ index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e
Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) {
@@ -1568,6 +1593,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1573,6 +1598,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Paper - EAR 2
final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper
@ -1763,7 +1763,7 @@ index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e
try {
// Paper end
passenger.setOldPosAndRot();
@@ -1607,7 +1637,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1612,7 +1642,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(passenger, entity2);
}
@ -1773,10 +1773,10 @@ index 72af30b281f2bb1dd4beee746a1b3f7bebbc7260..8cf413e42d560d90dfcbcb1d61ed410e
} else {
passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 72c32a9b4b0606162a0f994b3d8170f0fe4d5022..dfc0e3ce3ba88c3dbff909524de348fbe76de3a9 100644
index e63ad8ed0318fb99e99a8609ef6a31d16f87e7ff..ded539dd20a2d037fa5d175be06d59dd76660ffe 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1323,6 +1323,7 @@ public abstract class PlayerList {
@@ -1329,6 +1329,7 @@ public abstract class PlayerList {
public void saveAll(int interval) {
io.papermc.paper.util.MCUtil.ensureMain("Save Players" , () -> { // Paper - Ensure main
@ -1784,7 +1784,7 @@ index 72c32a9b4b0606162a0f994b3d8170f0fe4d5022..dfc0e3ce3ba88c3dbff909524de348fb
MinecraftTimings.savePlayers.startTiming(); // Paper
int numSaved = 0;
long now = System.nanoTime(); // Folia - region threading
@@ -1334,7 +1335,9 @@ public abstract class PlayerList {
@@ -1340,7 +1341,9 @@ public abstract class PlayerList {
}
// Folia end - region threading
if (interval == -1 || now - entityplayer.lastSave >= timeInterval) { // Folia - region threading
@ -1826,7 +1826,7 @@ index 940b8d0b89d7e55c938aefbe80ee71b0db3dacb8..a3a6c10f5b4157062a8a8d5ee4638c4e
this.factory = factory;
this.category = spawnGroup;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 474757fe16986d84f84302a22441c332d622d038..9244aaa1be1a4ba2c6eec5bcaeea7c5c0081ac39 100644
index b924986c4e3b9e20a4100481c5d6534b040950af..642cf0b4846cd711958483f72bf85fa7fadd85cb 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -229,6 +229,9 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -1871,7 +1871,7 @@ index 474757fe16986d84f84302a22441c332d622d038..9244aaa1be1a4ba2c6eec5bcaeea7c5c
// Spigot start
// Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator();
boolean flag = this.tickRateManager().runsNormally();
@@ -1347,6 +1357,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1341,6 +1351,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
}
blockEntityTickers.removeAll(toRemove); // Folia - regionised ticking