[ci skip] Add more identifying patch comments

This commit is contained in:
Nassim Jahnke
2024-01-21 12:11:43 +01:00
parent dee90322eb
commit f6609428b6
46 changed files with 136 additions and 140 deletions

View File

@@ -14,20 +14,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.moveTo(this.createPath(x, y, z, 1), speed);
}
+ // Paper start - optimise pathfinding
+ // Paper start - Perf: Optimise pathfinding
+ private int lastFailure = 0;
+ private int pathfindFailures = 0;
+ // Paper end
+ // Paper end - Perf: Optimise pathfinding
+
public boolean moveTo(Entity entity, double speed) {
+ // Paper start - Pathfinding optimizations
+ // Paper start - Perf: Optimise pathfinding
+ if (this.pathfindFailures > 10 && this.path == null && net.minecraft.server.MinecraftServer.currentTick < this.lastFailure + 40) {
+ return false;
+ }
+ // Paper end
+ // Paper end - Perf: Optimise pathfinding
Path path = this.createPath(entity, 1);
- return path != null && this.moveTo(path, speed);
+ // Paper start - Pathfinding optimizations
+ // Paper start - Perf: Optimise pathfinding
+ if (path != null && this.moveTo(path, speed)) {
+ this.lastFailure = 0;
+ this.pathfindFailures = 0;
@@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.lastFailure = net.minecraft.server.MinecraftServer.currentTick;
+ return false;
+ }
+ // Paper end
+ // Paper end - Perf: Optimise pathfinding
}
public boolean moveTo(@Nullable Path path, double speed) {