Remove wall-time / unused skip tick protection (#11412)

Spigot still maintains some partial implementation of "tick skipping", a
practice in which the MinecraftServer.currentTick field is updated not
by an increment of one per actual tick, but instead set to
System.currentTimeMillis() / 50. This behaviour means that the tracked
tick may "skip" a tick value in case a previous tick took more than the
expected 50ms.

To compensate for this in important paths, spigot/craftbukkit
implements "wall-time". Instead of incrementing/decrementing ticks on
block entities/entities by one for each call to their tick() method,
they instead increment/decrement important values, like
an ItemEntity's age or pickupDelay, by the difference of
`currentTick - lastTick`, where `lastTick` is the value of
`currentTick` during the last tick() call.

These "fixes" however do not play nicely with minecraft's simulation
distance as entities/block entities implementing the above behaviour
would "catch up" their values when moving from a non-ticking chunk to a
ticking one as their `lastTick` value remains stuck on the last tick in
a ticking chunk and hence lead to a large "catch up" once ticked again.

Paper completely removes the "tick skipping" behaviour (See patch
"Further-improve-server-tick-loop"), making the above precautions
completely unnecessary, which also rids paper of the previous described
incompatibility with non-ticking chunks.
This commit is contained in:
Bjarne Koll 2024-09-19 16:36:07 +02:00 committed by GitHub
parent 5c82955733
commit c5a10665b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
794 changed files with 402 additions and 282 deletions

View file

@ -170,7 +170,7 @@ index 0000000000000000000000000000000000000000..30a19d10869f73d67b794e8e4c035bc5
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e464349a46eab23eb5b8d4d31f577d78532b3ce1..7f4c9ba88c2d33c2cc23e406a616f9eb35d738ce 100644
index 5d03477919ce892f6dfb4b2304c03733e10e3721..cc0968182ab597892dbae8dd9b3e803fb62b7065 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -3,6 +3,9 @@ package net.minecraft.server;
@ -183,7 +183,7 @@ index e464349a46eab23eb5b8d4d31f577d78532b3ce1..7f4c9ba88c2d33c2cc23e406a616f9eb
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -1517,7 +1520,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1515,7 +1518,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hidesOnlinePlayers()) {
return new ServerStatus.Players(i, list.size(), List.of());
} else {