2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-07-15 03:53:17 +02:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Thu, 31 Mar 2016 19:17:58 -0400
|
2018-10-05 05:31:01 +02:00
|
|
|
Subject: [PATCH] Do not load chunks for Pathfinding
|
2018-07-15 03:53:17 +02:00
|
|
|
|
|
|
|
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
2021-03-16 16:50:45 +01:00
|
|
|
index 58225877ce4f2533c19d34e143ae374dc289bce5..d71a6e5991629ce59c8529d7cc8064960e385236 100644
|
2021-03-16 08:19:45 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
2021-03-16 16:50:45 +01:00
|
|
|
@@ -48,7 +48,7 @@ public abstract class NavigationAbstract {
|
2020-06-25 13:00:35 +02:00
|
|
|
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
|
2020-09-11 01:47:58 +02:00
|
|
|
private boolean t;
|
2018-10-05 05:18:46 +02:00
|
|
|
|
|
|
|
public NavigationAbstract(EntityInsentient entityinsentient, World world) {
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java b/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java
|
|
|
|
index 39cd22a820fdc4c75aefb625b45b0c8c6ce1f199..5784be69098805e4d550a0923ac8daa5aada73f9 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java
|
|
|
|
@@ -20,7 +20,7 @@ public class Pathfinder {
|
2020-06-25 13:00:35 +02:00
|
|
|
|
|
|
|
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();
|
2018-10-05 05:18:46 +02:00
|
|
|
|
2019-04-27 05:05:36 +02:00
|
|
|
public Pathfinder(PathfinderAbstract pathfinderabstract, int i) {
|
2021-03-16 08:19:45 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java
|
|
|
|
index ed9c1dfbc84b9573784e6531186b3cd9513ddf75..d14f2800237c2a80912bf6f2d418a9ba9031070d 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java
|
|
|
|
@@ -479,7 +479,12 @@ public class PathfinderNormal extends PathfinderAbstract {
|
2020-06-25 13:00:35 +02:00
|
|
|
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
|
2019-01-01 04:15:55 +01:00
|
|
|
|
2020-06-25 13:00:35 +02:00
|
|
|
if (iblockdata.a(Blocks.CACTUS)) {
|
|
|
|
return PathType.DANGER_CACTUS;
|
2021-03-16 08:19:45 +01:00
|
|
|
@@ -496,6 +501,7 @@ public class PathfinderNormal extends PathfinderAbstract {
|
2020-08-25 04:22:08 +02:00
|
|
|
if (iblockaccess.getFluid(blockposition_mutableblockposition).a((Tag) TagsFluid.WATER)) {
|
|
|
|
return PathType.WATER_BORDER;
|
2020-06-25 13:00:35 +02:00
|
|
|
}
|
|
|
|
+ } // Paper
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-16 08:19:45 +01:00
|
|
|
@@ -505,7 +511,8 @@ public class PathfinderNormal extends PathfinderAbstract {
|
2020-06-25 13:00:35 +02:00
|
|
|
}
|
2018-10-05 05:18:46 +02:00
|
|
|
|
2020-06-25 13:00:35 +02:00
|
|
|
protected static PathType b(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
2018-10-05 05:18:46 +02:00
|
|
|
- IBlockData iblockdata = iblockaccess.getType(blockposition);
|
2019-05-27 08:14:14 +02:00
|
|
|
+ IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper
|
2018-10-05 05:18:46 +02:00
|
|
|
+ if (iblockdata == null) return PathType.BLOCKED; // Paper
|
|
|
|
Block block = iblockdata.getBlock();
|
|
|
|
Material material = iblockdata.getMaterial();
|
2019-01-01 04:15:55 +01:00
|
|
|
|