Files
Purpur/patches/server/0045-Configurable-TPS-Catchup.patch
2023-06-09 05:07:46 -07:00

40 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 26 Mar 2020 19:06:22 -0500
Subject: [PATCH] Configurable TPS Catchup
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 75d15b7c157fea129a730a0f48ae9ea71f13d533..d9f3613381cf7166e0b504a4370420e1d0fadc4e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1175,7 +1175,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickServer(this::haveTime);
this.profiler.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
- this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
+ // Purpur start - tps catchup
+ if (org.purpurmc.purpur.PurpurConfig.tpsCatchup) {
+ this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
+ } else {
+ this.delayedTasksMaxNextTickTime = this.nextTickTime = curTime / 1000000L + 50L;
+ }
+ // Purpur end - tps catchup
this.waitUntilNextTick();
this.profiler.pop();
this.endMetricsRecordingTick();
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index c875d0351a32fa5bd75f4f440d6623830febf86b..8c2bbafaef3469b90efa966a5eb1af3fada2a812 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -246,4 +246,9 @@ public class PurpurConfig {
loggerSuppressUnrecognizedRecipeErrors = getBoolean("settings.logger.suppress-unrecognized-recipe-errors", loggerSuppressUnrecognizedRecipeErrors);
loggerSuppressSetBlockFarChunk = getBoolean("settings.logger.suppress-setblock-in-far-chunk-errors", loggerSuppressSetBlockFarChunk);
}
+
+ public static boolean tpsCatchup = true;
+ private static void tpsCatchup() {
+ tpsCatchup = getBoolean("settings.tps-catchup", tpsCatchup);
+ }
}