2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Wed, 27 Mar 2019 22:48:45 -0400
|
|
|
|
Subject: [PATCH] Server Tick Events
|
|
|
|
|
|
|
|
Fires event at start and end of a server tick
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2022-06-03 06:26:56 +02:00
|
|
|
index 067fa77d706a193dd3dcb4cc58d2e1b25840e6f3..dbf70401a93776f422af4386bceaae6fb9883c4f 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2022-03-13 08:47:54 +01:00
|
|
|
@@ -1348,6 +1348,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
2021-06-11 14:02:28 +02:00
|
|
|
});
|
|
|
|
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
|
|
|
|
// Paper end
|
|
|
|
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
|
|
|
|
|
|
|
|
++this.tickCount;
|
|
|
|
this.tickChildren(shouldKeepTicking);
|
2022-03-13 08:47:54 +01:00
|
|
|
@@ -1386,6 +1387,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
2021-11-24 04:42:31 +01:00
|
|
|
this.runAllTasks();
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
// Paper end
|
|
|
|
+ // Paper start
|
|
|
|
+ long endTime = System.nanoTime();
|
|
|
|
+ long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
|
|
|
|
+ new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
|
|
|
|
+ // Paper end
|
|
|
|
this.profiler.push("tallying");
|
|
|
|
long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
|
|
|
|
|