mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
Fix up ridable foxes
This commit is contained in:
81
patches/server/0017-Tick-loop-config-options.patch
Normal file
81
patches/server/0017-Tick-loop-config-options.patch
Normal file
@@ -0,0 +1,81 @@
|
||||
From 6c03ff30509c579923792c2f7a114a1dc9bffe7a Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Wed, 22 May 2019 22:30:08 -0500
|
||||
Subject: [PATCH] Tick loop config options
|
||||
|
||||
---
|
||||
.../net/minecraft/server/MinecraftServer.java | 31 +++++++++++++------
|
||||
.../java/net/pl3x/purpur/PurpurConfig.java | 7 +++++
|
||||
2 files changed, 28 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 5bd0a4cc7..67caf83e7 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -864,16 +864,21 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
|
||||
lastTick = start - TICK_TIME; // Paper
|
||||
while (this.isRunning) {
|
||||
- long i = ((curTime = System.nanoTime()) / (1000L * 1000L)) - this.nextTick; // Paper
|
||||
-
|
||||
- if (i > 5000L && this.nextTick - this.lastOverloadTime >= 30000L) { // CraftBukkit
|
||||
- long j = i / 50L;
|
||||
-
|
||||
- if (server.getWarnOnOverload()) // CraftBukkit
|
||||
- MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
|
||||
- this.nextTick += j * 50L;
|
||||
- this.lastOverloadTime = this.nextTick;
|
||||
+ // Purpur start - tick overload
|
||||
+ curTime = System.nanoTime();
|
||||
+ if (net.pl3x.purpur.PurpurConfig.enableTickOverload) {
|
||||
+ long i = ((curTime) / (1000L * 1000L)) - this.nextTick; // Paper
|
||||
+
|
||||
+ if (i > 5000L && this.nextTick - this.lastOverloadTime >= 30000L) { // CraftBukkit
|
||||
+ long j = i / 50L;
|
||||
+
|
||||
+ if (server.getWarnOnOverload()) // CraftBukkit
|
||||
+ MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
|
||||
+ this.nextTick += j * 50L;
|
||||
+ this.lastOverloadTime = this.nextTick;
|
||||
+ }
|
||||
}
|
||||
+ // Purpur end - tick overload
|
||||
|
||||
if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 )
|
||||
{
|
||||
@@ -904,7 +909,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
this.a(this::canSleepForTick);
|
||||
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.enableTPSCatchup) {
|
||||
+ 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 38f9d3a3a..99b7abd6d 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -103,6 +103,13 @@ public class PurpurConfig {
|
||||
return config.getString(path, config.getString(path));
|
||||
}
|
||||
|
||||
+ public static boolean enableTickOverload = false;
|
||||
+ public static boolean enableTPSCatchup = false;
|
||||
+ private static void tickLoopSettings() {
|
||||
+ enableTickOverload = getBoolean("settings.enable-tick-overload", enableTickOverload);
|
||||
+ enableTPSCatchup = getBoolean("settings.enable-tps-catchup", enableTPSCatchup);
|
||||
+ }
|
||||
+
|
||||
public static boolean requireShiftToMount = true;
|
||||
private static void requireShiftToMount() {
|
||||
requireShiftToMount = getBoolean("settings.mobs.require-shift-to-mount", requireShiftToMount);
|
||||
--
|
||||
2.20.1
|
||||
|
||||
Reference in New Issue
Block a user