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.
Dieser Commit ist enthalten in:
Spottedleaf 2024-07-17 07:43:49 -07:00
Ursprung 05ed6a6ff5
Commit 967f98aa81

Datei anzeigen

@ -28561,7 +28561,7 @@ index 3dc1daa3c6a04d3ff1a2353773b465fc380994a2..3575782f13a7f3c52e64dc5046803305
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index be9604a0f267558c95125852d86761a2f175732a..d2cb358c340bcf7532fd25eccdd33c6945d16de4 100644
index be9604a0f267558c95125852d86761a2f175732a..337383b8aa00f5f33e770dcc0b087cda54f9b6c3 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -46,7 +46,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp
@ -28887,9 +28887,19 @@ index be9604a0f267558c95125852d86761a2f175732a..d2cb358c340bcf7532fd25eccdd33c69
long i = this.level.getGameTime();
long j = i - this.lastInhabitedUpdate;
@@ -470,6 +473,11 @@ public class ServerChunkCache extends ChunkSource {
@@ -462,14 +465,19 @@ 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) {