2020-04-21 22:06:30 +00:00
|
|
|
From d5938a4f8bed275a0bf78723ef2e8ed82f8bdeb0 Mon Sep 17 00:00:00 2001
|
2019-03-28 02:49:29 +00:00
|
|
|
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
|
2020-04-21 22:06:30 +00:00
|
|
|
index 4d604bd0..2a8e097f 100644
|
2019-03-28 02:49:29 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2020-04-16 01:48:07 +00:00
|
|
|
@@ -1087,6 +1087,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
|
|
|
});
|
|
|
|
MinecraftTimings.serverOversleep.stopTiming();
|
2019-09-29 20:49:38 +00:00
|
|
|
// Paper end
|
2019-03-28 02:49:29 +00:00
|
|
|
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.ticks+1).callEvent(); // Paper
|
|
|
|
|
|
|
|
++this.ticks;
|
2019-05-05 17:19:34 +00:00
|
|
|
this.b(booleansupplier);
|
2020-04-16 01:48:07 +00:00
|
|
|
@@ -1130,6 +1131,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
2019-07-24 03:20:14 +00:00
|
|
|
}
|
|
|
|
// Paper end
|
2020-04-16 01:48:07 +00:00
|
|
|
|
2019-03-28 02:49:29 +00:00
|
|
|
+ // Paper start
|
|
|
|
+ long endTime = System.nanoTime();
|
|
|
|
+ long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
|
2019-03-28 05:27:39 +00:00
|
|
|
+ new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.ticks, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
|
2019-03-28 02:49:29 +00:00
|
|
|
+ // Paper end
|
2020-04-16 01:48:07 +00:00
|
|
|
+
|
|
|
|
this.methodProfiler.enter("tallying");
|
|
|
|
long l = this.f[this.ticks % 100] = SystemUtils.getMonotonicNanos() - i;
|
2019-03-28 02:49:29 +00:00
|
|
|
|
|
|
|
--
|
2020-04-21 22:06:30 +00:00
|
|
|
2.25.1.windows.1
|
2019-03-28 02:49:29 +00:00
|
|
|
|