Paper/Spigot-Server-Patches/0362-Server-Tick-Events.patch
Shane Freeder e4602b6d48
Drop Ignore-Missing-Recipes-in-RecipeBook-to-avoid-data-e.patch
This patch appears to be no longer relevant, and is seemingly a leading
cause of datapack performance being horrific
2020-03-15 20:03:36 +00:00

35 lines
1.5 KiB
Diff

From 4e6377ff36d7ddf7bd38316944c2d7bb737c3da7 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 2a01e609c..2801a3ee6 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1086,6 +1086,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
// Paper end
this.slackActivityAccountant.tickStarted(); // Spigot
long i = SystemUtils.getMonotonicNanos();
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.ticks+1).callEvent(); // Paper
++this.ticks;
this.b(booleansupplier);
@@ -1137,6 +1138,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.executeAll();
}
// Paper end
+ // Paper start
+ long endTime = System.nanoTime();
+ long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
+ new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.ticks, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
+ // Paper end
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
}
--
2.25.1