Files
Purpur/patches/server/0112-Configurable-TPS-Catchup.patch
2020-03-29 15:13:05 -05:00

48 lines
2.2 KiB
Diff

From da0f2c744a2d3420ce56d14cc17613c1c76efe10 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
---
src/main/java/net/minecraft/server/MinecraftServer.java | 7 +++++++
src/main/java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
2 files changed, 12 insertions(+)
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5f6852e4ba..ac7604d632 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -958,6 +958,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.methodProfiler.exitEnter("nextTickWait");
this.ac = true;
this.ab = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
+ // Purpur start - tps catchup
+ if (net.pl3x.purpur.PurpurConfig.tpsCatchup) {
+ this.ab = Math.max(SystemUtils.getMonotonicMillis() + 50L, this.nextTick);
+ } else {
+ this.ab = this.nextTick = curTime / 1000000L + 50L;
+ }
+ // Purpur end - tps catchup
this.sleepForTick();
this.methodProfiler.exit();
this.methodProfiler.b();
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
index 0948d67260..850a7ac24d 100644
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
@@ -158,6 +158,11 @@ public class PurpurConfig {
useUPnP = getBoolean("settings.upnp-port-forwarding", useUPnP);
}
+ public static boolean tpsCatchup = true;
+ private static void tpsCatchup() {
+ tpsCatchup = getBoolean("settings.tps-catchup", tpsCatchup);
+ }
+
public static boolean dontSendUselessEntityPackets = false;
public static boolean fixItemPositionDesync = false;
private static void dontSendUselessEntityPackets() {
--
2.24.0