mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-04 15:41:40 +00:00
42 lines
2.3 KiB
Diff
42 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] Purpur: Configurable TPS Catchup
|
|
|
|
Original license: MIT
|
|
Original project: https://github.com/PurpurMC/Purpur
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index fe25f51ee708c76bcf66e3280bb235713c99f79c..1f3f414ede558f590a5e68256a60d9ca3c3edf32 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1285,6 +1285,13 @@ public abstract class MinecraftServer extends MinecraftServerBlockableEventLoop
|
|
this.tickServer(this::haveTime);
|
|
lastTickProperTime = (System.nanoTime() - tickProperStart) / 1000000L; // Gale - YAPFA - last tick time
|
|
this.setDelayedTasksMaxNextTickTime(Math.max(Util.getMillis() + 50L, this.nextTickTime)); // Gale - base thread pool
|
|
+ // Purpur start - tps catchup
|
|
+ if (org.dreeam.leaf.LeafConfig.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.isReady = true;
|
|
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
|
|
diff --git a/src/main/java/org/dreeam/leaf/LeafConfig.java b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
|
index 81a06fa14b0c47321ad37ad73b59770f1563c883..1beacdeacb712396cd3de1206c9789be800d2761 100644
|
|
--- a/src/main/java/org/dreeam/leaf/LeafConfig.java
|
|
+++ b/src/main/java/org/dreeam/leaf/LeafConfig.java
|
|
@@ -184,8 +184,10 @@ public class LeafConfig {
|
|
}
|
|
|
|
public static double laggingThreshold = 19.0D;
|
|
+ public static boolean tpsCatchup = true;
|
|
private static void performance() {
|
|
laggingThreshold = getDouble("performance.lagging-threshold", laggingThreshold);
|
|
+ tpsCatchup = getBoolean("performance.tps-catchup", tpsCatchup);
|
|
}
|
|
|
|
public static String commandTPSBarOutput = "<green>Tpsbar toggled <onoff> for <target>";
|