mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 06:24:06 +01:00
7ae47d4eb3
Mojang fixed it in MC-63720
69 lines
3.6 KiB
Diff
69 lines
3.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Thu, 31 Mar 2016 19:17:58 -0400
|
|
Subject: [PATCH] Do not load chunks for Pathfinding
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
|
index 48cf95db7226b23fc688aba47aea3b378faec14c..5a8fbad220ed535a79539a4e25830c370ca1c89c 100644
|
|
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
|
@@ -27,7 +27,7 @@ public abstract class NavigationAbstract {
|
|
private BlockPosition p;
|
|
private int q;
|
|
private float r;
|
|
- private final Pathfinder s;
|
|
+ private final Pathfinder s; public Pathfinder getPathfinder() { return this.s; } // Paper - OBFHELPER
|
|
private boolean t;
|
|
|
|
public NavigationAbstract(EntityInsentient entityinsentient, World world) {
|
|
diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java
|
|
index 8ba6dd459a863717c91dd59f3f2ee5e3a5ed8170..b31d1f73ce0f067e352868b53eab7557c34b17eb 100644
|
|
--- a/src/main/java/net/minecraft/server/Pathfinder.java
|
|
+++ b/src/main/java/net/minecraft/server/Pathfinder.java
|
|
@@ -17,7 +17,7 @@ public class Pathfinder {
|
|
|
|
private final PathPoint[] a = new PathPoint[32];
|
|
private final int b;
|
|
- private final PathfinderAbstract c;
|
|
+ private final PathfinderAbstract c; public PathfinderAbstract getPathfinder() { return this.c; } // Paper - OBFHELPER
|
|
private final Path d = new Path();
|
|
|
|
public Pathfinder(PathfinderAbstract pathfinderabstract, int i) {
|
|
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
|
|
index 449665f52c5f241d2119919abe4d4cde638ebe6f..07b021bd1fb174d1c1a0c83b415c84e582c4f681 100644
|
|
--- a/src/main/java/net/minecraft/server/PathfinderNormal.java
|
|
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
|
|
@@ -456,7 +456,12 @@ public class PathfinderNormal extends PathfinderAbstract {
|
|
for (int j1 = -1; j1 <= 1; ++j1) {
|
|
if (l != 0 || j1 != 0) {
|
|
blockposition_mutableblockposition.d(i + l, j + i1, k + j1);
|
|
- IBlockData iblockdata = iblockaccess.getType(blockposition_mutableblockposition);
|
|
+ // Paper start
|
|
+ IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition_mutableblockposition);
|
|
+ if (iblockdata == null) {
|
|
+ pathtype = PathType.BLOCKED;
|
|
+ } else {
|
|
+ // Paper end
|
|
|
|
if (iblockdata.a(Blocks.CACTUS)) {
|
|
return PathType.DANGER_CACTUS;
|
|
@@ -473,6 +478,7 @@ public class PathfinderNormal extends PathfinderAbstract {
|
|
if (iblockaccess.getFluid(blockposition_mutableblockposition).a((Tag) TagsFluid.WATER)) {
|
|
return PathType.WATER_BORDER;
|
|
}
|
|
+ } // Paper
|
|
}
|
|
}
|
|
}
|
|
@@ -482,7 +488,8 @@ public class PathfinderNormal extends PathfinderAbstract {
|
|
}
|
|
|
|
protected static PathType b(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
|
- IBlockData iblockdata = iblockaccess.getType(blockposition);
|
|
+ IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper
|
|
+ if (iblockdata == null) return PathType.BLOCKED; // Paper
|
|
Block block = iblockdata.getBlock();
|
|
Material material = iblockdata.getMaterial();
|
|
|