Files
Purpur/patches/server/0052-Configurable-TPS-Catchup.patch
BillyGalbreath 4afe68b005 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@9cab01e [ci skip] Update Gradle wrapper to 7.4
PaperMC/Paper@cdb893b Add mid-tick task execution to block ticking
PaperMC/Paper@854f3d3 Put world into worldlist before initing the world
PaperMC/Paper@db81163 Execute mid tick tasks during tile entity ticking
PaperMC/Paper@501834e Fix custom inventory holders (#6199)
PaperMC/Paper@04a337a Add some missing deprecations to the adventure patch (#7500)
PaperMC/Paper@b6dad9c Fix desync on teleporting entity on first tick (#7183)
PaperMC/Paper@2a55e35 Option to have default CustomSpawners in custom worlds (#7493)
PaperMC/Paper@bfa50ad Custom Potion Mixes (#6744)
2022-02-23 09:40:25 -06: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 3e68a5d2a9f187025952a5168a2c44df23565bb0..768247fccab529d2d98e955b27899a37ab183e10 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1277,7 +1277,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 dab104575c5a12857faffb8efc5620a123580a9e..b41d73318d6795c0fa7b9c60431ef141026fa9d6 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -241,4 +241,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);
+ }
}