Fix pathfinding NPE - Fixes #1435

This commit is contained in:
Aikar 2018-09-12 21:17:59 -04:00
parent d59a313d6d
commit fd84aa5c42
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE

View file

@ -1,29 +1,38 @@
From efe00b392d2d7c0ce533572ff47bd7a27cbb2d57 Mon Sep 17 00:00:00 2001 From 89178baf536b0d8aaa0e0cb18e96101509ce62a3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Mon, 10 Sep 2018 23:52:28 -0400 Date: Mon, 10 Sep 2018 23:52:28 -0400
Subject: [PATCH] Prevent pathfinding from loading chunks 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 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 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
@@ -21,13 +21,14 @@ public abstract class NavigationAbstract { @@ -21,13 +21,15 @@ public abstract class NavigationAbstract {
protected long n; protected long n;
protected PathfinderAbstract o; protected PathfinderAbstract o;
private BlockPosition q; private BlockPosition q;
- private Pathfinder r; - private Pathfinder r;
+ private Pathfinder r; public Pathfinder getPathfinder() { return r; } // Paper - OBFHELPER + 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) { public NavigationAbstract(EntityInsentient entityinsentient, World world) {
this.a = entityinsentient; this.a = entityinsentient;
this.b = world; this.b = world;
this.p = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE); this.p = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE);
this.r = this.a(); this.r = this.a();
+ getPathfinder().getPathfinder().world = world; // Paper + setWorld(); // Paper
} }
public BlockPosition i() { public BlockPosition i() {
@@ -166,6 +168,7 @@ 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 diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java
index 04c71ac0ef..6e583356ce 100644 index 04c71ac0ef..6e583356ce 100644
--- a/src/main/java/net/minecraft/server/Pathfinder.java --- a/src/main/java/net/minecraft/server/Pathfinder.java