From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrIvanPlays Date: Sun, 16 Aug 2020 13:45:32 +0300 Subject: [PATCH] Add timings for Pathfinder diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java index 67980e1dc186c0b458eca9f00acfea7d2b26d575..e5df5045c7fb9faf692fed894e1a64fe6e1449af 100644 --- a/src/main/java/co/aikar/timings/MinecraftTimings.java +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java @@ -57,6 +57,8 @@ public final class MinecraftTimings { return Timings.ofSafe(taskName); } + public static Timing getPathfinderTiming(String mobName) { return Timings.ofSafe("Pathfinder - " + mobName); } // Yatopia + /** * Gets a timer associated with a plugins tasks. * @param bukkitTask diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java index ac7bad10697c6fde7d512753992d59710aa1e032..0c8f3e424a631aca98f83f570aff91c833aaf4b9 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java @@ -51,6 +51,7 @@ public abstract class NavigationAbstract { private float r; private final Pathfinder s; public Pathfinder getPathfinder() { return this.s; } // Paper - OBFHELPER private boolean t; + private co.aikar.timings.Timing timing; // Yatopia // Tuinity start public boolean isViableForPathRecalculationChecking() { @@ -69,6 +70,7 @@ public abstract class NavigationAbstract { int i = MathHelper.floor(entityinsentient.b(GenericAttributes.FOLLOW_RANGE) * 16.0D); this.s = this.a(i); + timing = co.aikar.timings.MinecraftTimings.getPathfinderTiming(entityinsentient.getClass().getSimpleName()); // Yatopia } public void g() { @@ -253,6 +255,10 @@ public abstract class NavigationAbstract { } public void c() { + // Yatopia start + timing.startTiming(); + try { + // Yatopia end ++this.e; if (this.m) { this.j(); @@ -280,6 +286,11 @@ public abstract class NavigationAbstract { this.a.getControllerMove().a(vec3d.x, this.b.getType(blockposition.down()).isAir() ? vec3d.y : PathfinderNormal.a((IBlockAccess) this.b, blockposition), vec3d.z, this.d); } } + // Yatopia start + } finally { + timing.stopTiming(); + } + // Yatopia end } protected void l() {