mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-30 06:33:51 +01:00
63 lines
2.5 KiB
Diff
63 lines
2.5 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: MrIvanPlays <ivan@mrivanplays.com>
|
||
|
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 85b25eace786fa0d7694afa405f9d2bdf4937b6e..2dca961498651b1c06ee61d33507055706afb63e 100644
|
||
|
--- a/src/main/java/co/aikar/timings/MinecraftTimings.java
|
||
|
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
|
||
|
@@ -54,6 +54,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/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||
|
index ed37caf036ef9ae4c39622caf9b582678fecdccf..19753de35a3fef41fedd37eaab9f3ad2d5d91308 100644
|
||
|
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||
|
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||
|
@@ -28,6 +28,7 @@ public abstract class NavigationAbstract {
|
||
|
private int q;
|
||
|
private float r;
|
||
|
private final Pathfinder s; public Pathfinder getPathfinder() { return this.s; } // Paper - OBFHELPER
|
||
|
+ private co.aikar.timings.Timing timing; // Yatopia
|
||
|
|
||
|
// Tuinity start
|
||
|
public boolean isViableForPathRecalculationChecking() {
|
||
|
@@ -46,6 +47,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() {
|
||
|
@@ -229,6 +231,10 @@ public abstract class NavigationAbstract {
|
||
|
}
|
||
|
|
||
|
public void c() {
|
||
|
+ // Yatopia start
|
||
|
+ timing.startTiming();
|
||
|
+ try {
|
||
|
+ // Yatopia end
|
||
|
++this.e;
|
||
|
if (this.m) {
|
||
|
this.j();
|
||
|
@@ -256,6 +262,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() {
|