mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 20:16:19 +01:00
4104545b11
"It was from a different time before books were as jank as they are now. As time has gone on they've only proven to be worse and worse."
33 lines
1.5 KiB
Diff
33 lines
1.5 KiB
Diff
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
|
|
index dfbdc5ead05821ebf4c08d6e829a9ce925061e1a..d7ab2d4a470fed4b13bad6cf5811a7ce36e748cc 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -1310,6 +1310,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
});
|
|
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
|
|
// Paper end
|
|
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
|
|
|
|
++this.tickCount;
|
|
this.tickChildren(shouldKeepTicking);
|
|
@@ -1353,6 +1354,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
// 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;
|
|
|