Fix pathfinding NPE - Fixes #1435

This commit is contained in:
Aikar 2018-09-12 21:17:59 -04:00
parent 8565cb00e3
commit e0374d0ada

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent pathfinding from loading chunks
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
index 4023253f42..b2480301ef 100644
index 4023253f42..113fd9a50f 100644
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
@ -15,15 +15,24 @@ index 4023253f42..b2480301ef 100644
- private Pathfinder r;
+ private Pathfinder r; public Pathfinder getPathfinder() { return r; } // Paper - OBFHELPER
+ private void setWorld() { if (getPathfinder() != null && getPathfinder().getPathfinder() != null) getPathfinder().getPathfinder().world = getEntity().world; } // Paper
public NavigationAbstract(EntityInsentient entityinsentient, World world) {
this.a = entityinsentient;
this.b = world;
this.p = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE);
this.r = this.a();
+ getPathfinder().getPathfinder().world = world; // Paper
+ setWorld(); // Paper
}
public BlockPosition i() {
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
}
public void d() {
+ setWorld(); // Paper
++this.e;
if (this.m) {
this.l();
diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java
index 04c71ac0ef..6e583356ce 100644
--- a/src/main/java/net/minecraft/server/Pathfinder.java