Paper 1.9
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 18 Jan 2016 00:18:43 -0500
|
||||
Date: Thu, 3 Mar 2016 02:02:07 -0600
|
||||
Subject: [PATCH] Optimize Pathfinding
|
||||
|
||||
Prevents pathfinding from spamming failures for things such as
|
||||
arrow attacks.
|
||||
|
||||
Also remove a duplicate .getType() call and fix .getType() on others
|
||||
to make them use the chunk cache vs chunk lookups
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
||||
@@ -17,10 +14,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
public boolean a(Entity entity, double d0) {
|
||||
+ // PaperSpigot start - Pathfinding optimizations
|
||||
+ if (this.pathfindFailures > 10 && this.d == null && MinecraftServer.currentTick < this.lastFailure + 40) {
|
||||
+ // Paper start - Pathfinding optimizations
|
||||
+ if (this.pathfindFailures > 10 && this.c == null && MinecraftServer.currentTick < this.lastFailure + 40) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
PathEntity pathentity = this.a(entity);
|
||||
|
||||
- return pathentity != null ? this.a(pathentity, d0) : false;
|
||||
@@ -36,31 +34,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
+ private int lastFailure = 0;
|
||||
+ private int pathfindFailures = 0;
|
||||
+ // PaperSpigot end
|
||||
+ // Paper end
|
||||
|
||||
public boolean a(PathEntity pathentity, double d0) {
|
||||
if (pathentity == null) {
|
||||
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
||||
}
|
||||
|
||||
public void n() {
|
||||
+ this.pathfindFailures = 0; this.lastFailure = 0; // PaperSpigot - Pathfinding optimizations
|
||||
this.d = null;
|
||||
public void o() {
|
||||
+ this.pathfindFailures = 0; this.lastFailure = 0; // Paper - Pathfinding optimizations
|
||||
this.c = null;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
|
||||
@@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
flag3 = true;
|
||||
}
|
||||
|
||||
- if (entity.world.getType(blockposition_mutableblockposition).getBlock() instanceof BlockMinecartTrackAbstract) {
|
||||
- if (!(entity.world.getType(blockposition).getBlock() instanceof BlockMinecartTrackAbstract) && !(entity.world.getType(blockposition.down()).getBlock() instanceof BlockMinecartTrackAbstract)) {
|
||||
+ if (block instanceof BlockMinecartTrackAbstract) { // PaperSpigot - Pathfinder optimizations
|
||||
+ if (!(iblockaccess.getType(blockposition).getBlock() instanceof BlockMinecartTrackAbstract) && !(iblockaccess.getType(blockposition.down()).getBlock() instanceof BlockMinecartTrackAbstract)) { // PaperSpigot - Pathfinder optimizations
|
||||
return -3;
|
||||
}
|
||||
} else if (!block.b(iblockaccess, blockposition_mutableblockposition) && (!flag1 || !(block instanceof BlockDoor) || block.getMaterial() != Material.WOOD)) {
|
||||
--
|
||||
Reference in New Issue
Block a user