Only update time for local players in time update tick

This was done in 1.19.4, but the diff to use getLocalPlayers()
was dropped by accident.

Fixes https://github.com/PaperMC/Folia/issues/114
This commit is contained in:
Spottedleaf 2023-07-01 12:18:44 -07:00
parent d1c9e63470
commit eb2231736b
2 changed files with 4 additions and 3 deletions

View File

@ -11513,7 +11513,7 @@ 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 c7a762abdfdc88fd26ec751c34e7b42bb3514515..26d332a46556416bb70b6276786b43e1a8ec8449 100644
index c7a762abdfdc88fd26ec751c34e7b42bb3514515..c772f5f48b1f0be2c55846154684a5d98f1267b9 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<TickTa
@ -12006,8 +12006,9 @@ index c7a762abdfdc88fd26ec751c34e7b42bb3514515..26d332a46556416bb70b6276786b43e1
final long dayTime = level.getDayTime();
long worldTime = level.getGameTime();
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
for (Player entityhuman : level.players()) {
- for (Player entityhuman : level.players()) {
- if (!(entityhuman instanceof ServerPlayer) || (tickCount + entityhuman.getId()) % 20 != 0) {
+ for (Player entityhuman : level.getLocalPlayers()) { // Folia - region threading
+ if (!(entityhuman instanceof ServerPlayer) || (io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick() + entityhuman.getId()) % 20 != 0) { // Folia - region threading
continue;
}

View File

@ -10,7 +10,7 @@ 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 26d332a46556416bb70b6276786b43e1a8ec8449..11ff1bc559316da426070867f045720ebd8c1962 100644
index c772f5f48b1f0be2c55846154684a5d98f1267b9..d307826380c4bd47ee4602813737a11339cb8357 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2875,6 +2875,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa