Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-26 08:10:06 +01:00
1718f61bf8
Doesn't compile yet. CraftBukkit Changes: 90d6905b Repackage NMS 69cf961d Repackage patches Spigot Changes: 79d53c28 Repackage NMS
69 Zeilen
3.8 KiB
Diff
69 Zeilen
3.8 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/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
|
index 8c699279a3553da2888669c64269a1dfd8152e22..c50d792c3ef3277ecab229e866f052854edac19d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
|
@@ -47,7 +47,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/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 {
|
|
|
|
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/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 {
|
|
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;
|
|
@@ -496,6 +501,7 @@ public class PathfinderNormal extends PathfinderAbstract {
|
|
if (iblockaccess.getFluid(blockposition_mutableblockposition).a((Tag) TagsFluid.WATER)) {
|
|
return PathType.WATER_BORDER;
|
|
}
|
|
+ } // Paper
|
|
}
|
|
}
|
|
}
|
|
@@ -505,7 +511,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();
|
|
|