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
|
2024-06-19 19:29:03 +02:00
|
|
|
index df5b553b8d1525f14dbb88ea86e1bf9d9c9e6950..ee86f2cb71b2c8dc85c27635efca3666de7a3cbe 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
|
2024-06-13 22:14:13 +02:00
|
|
|
@@ -1435,6 +1435,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
2021-06-11 14:02:28 +02:00
|
|
|
});
|
|
|
|
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
|
|
|
|
// Paper end
|
2024-01-21 13:56:22 +01:00
|
|
|
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper - Server Tick Events
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
++this.tickCount;
|
2023-12-05 23:21:44 +01:00
|
|
|
this.tickRateManager.tick();
|
2024-06-13 22:14:13 +02:00
|
|
|
@@ -1461,6 +1462,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
|
2024-01-21 13:56:22 +01:00
|
|
|
+ // Paper start - Server Tick Events
|
2021-06-11 14:02:28 +02:00
|
|
|
+ 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();
|
2024-01-21 13:56:22 +01:00
|
|
|
+ // Paper end - Server Tick Events
|
2021-06-11 14:02:28 +02:00
|
|
|
this.profiler.push("tallying");
|
2023-12-05 23:21:44 +01:00
|
|
|
long j = Util.getNanos() - i;
|
|
|
|
int k = this.tickCount % 100;
|