mirror of
https://github.com/PaperMC/Paper.git
synced 2024-08-31 09:09:56 +02:00
43 lines
2.2 KiB
Diff
43 lines
2.2 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/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
|
index be29c3a361415064c418256d5c0eca9e5a7cefd2..c33fda773ec071d27e924461a30a2938db35c231 100644
|
|
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
|
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
|
@@ -453,7 +453,12 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
|
for(int n = -1; n <= 1; ++n) {
|
|
if (l != 0 || n != 0) {
|
|
pos.set(i + l, j + m, k + n);
|
|
- BlockState blockState = world.getBlockState(pos);
|
|
+ // Paper start
|
|
+ BlockState blockState = world.getTypeIfLoaded(pos);
|
|
+ if (blockState == null) {
|
|
+ return BlockPathTypes.BLOCKED;
|
|
+ } else {
|
|
+ // Paper end
|
|
if (blockState.is(Blocks.CACTUS)) {
|
|
return BlockPathTypes.DANGER_CACTUS;
|
|
}
|
|
@@ -469,6 +474,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
|
if (world.getFluidState(pos).is(FluidTags.WATER)) {
|
|
return BlockPathTypes.WATER_BORDER;
|
|
}
|
|
+ } // Paper
|
|
}
|
|
}
|
|
}
|
|
@@ -478,7 +484,8 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
|
}
|
|
|
|
protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) {
|
|
- BlockState blockState = world.getBlockState(pos);
|
|
+ BlockState blockState = world.getTypeIfLoaded(pos); // Paper
|
|
+ if (blockState == null) return BlockPathTypes.BLOCKED; // Paper
|
|
Block block = blockState.getBlock();
|
|
Material material = blockState.getMaterial();
|
|
if (blockState.isAir()) {
|