From e2a85cf6d9e2a91023138116504f9d3341319bcf Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Wed, 17 Jul 2024 07:43:49 -0700 Subject: [PATCH] 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. --- patches/server/Moonrise-optimisation-patches.patch | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/patches/server/Moonrise-optimisation-patches.patch b/patches/server/Moonrise-optimisation-patches.patch index a0890a6d4..817e80db6 100644 --- a/patches/server/Moonrise-optimisation-patches.patch +++ b/patches/server/Moonrise-optimisation-patches.patch @@ -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) {