1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-16 18:31:53 +01:00

Optimise chunk tick checking during chunk tick

We don't need to check for this with the chunk system, as
ticking chunks are actually guaranteed to ticking. Additionally,
ticking chunks may only become non-ticking during the chunk holder
manager tick - which will not happen during chunk ticking.
This commit is contained in:
Spottedleaf 2024-07-17 07:43:49 -07:00
parent efa4155840
commit e2a85cf6d9

View file

@ -28888,8 +28888,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
long j = i - this.lastInhabitedUpdate;
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
LevelChunk chunk1 = chunkproviderserver_a.chunk;
ChunkPos chunkcoordintpair = chunk1.getPos();
if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
- if (this.level.isNaturalSpawningAllowed(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) {
+ if (true && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) { // Paper - rewrite chunk system
chunk1.incrementInhabitedTime(j);
if (flag && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot
NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1);
}
- if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
+ if (true) { // Paper - rewrite chunk system
this.level.tickChunk(chunk1, l);
+ // Paper start - rewrite chunk system
+ if ((++chunksTicked & 7L) == 0L) {