mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-03 14:22:26 +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 9fe91c7d5949fcd1c764e79fa937f62a5a2ee23b..8cd54a95609df0c5497c00d1a254c22d47e80a15 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1286,6 +1286,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 d16699e35a17b78364f7d47d69cbeb4ab76c00a1..8fce40f92fb9113e01080ef9b67cf61557f19263 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>";
|