2021-06-11 14:02:28 +02:00
|
|
|
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
|
2024-04-12 21:14:06 +02:00
|
|
|
index 79baaf943a01912c423823e1c153c062d5316232..9e51dcaae00967bcfd30615b1d978c333fafaa8f 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
2024-04-12 21:14:06 +02:00
|
|
|
@@ -469,7 +469,12 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
|
|
|
for (int n = -1; n <= 1; n++) {
|
2021-06-12 04:24:43 +02:00
|
|
|
if (l != 0 || n != 0) {
|
|
|
|
pos.set(i + l, j + m, k + n);
|
|
|
|
- BlockState blockState = world.getBlockState(pos);
|
2024-01-23 14:34:17 +01:00
|
|
|
+ // Paper start - Do not load chunks during pathfinding
|
2021-12-06 00:32:02 +01:00
|
|
|
+ BlockState blockState = world.getBlockStateIfLoaded(pos);
|
2021-06-12 04:24:43 +02:00
|
|
|
+ if (blockState == null) {
|
|
|
|
+ return BlockPathTypes.BLOCKED;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ } else {
|
2024-01-23 14:34:17 +01:00
|
|
|
+ // Paper end - Do not load chunks during pathfinding
|
2023-03-14 19:36:39 +01:00
|
|
|
if (blockState.is(Blocks.CACTUS) || blockState.is(Blocks.SWEET_BERRY_BUSH)) {
|
|
|
|
return BlockPathTypes.DANGER_OTHER;
|
2021-06-12 04:24:43 +02:00
|
|
|
}
|
2024-04-12 21:14:06 +02:00
|
|
|
@@ -485,6 +490,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
2023-06-07 20:49:17 +02:00
|
|
|
if (blockState.is(Blocks.WITHER_ROSE) || blockState.is(Blocks.POINTED_DRIPSTONE)) {
|
|
|
|
return BlockPathTypes.DAMAGE_CAUTIOUS;
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+ } // Paper
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-04-12 21:14:06 +02:00
|
|
|
@@ -494,7 +500,8 @@ public class WalkNodeEvaluator extends NodeEvaluator {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
2021-06-12 04:24:43 +02:00
|
|
|
protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) {
|
|
|
|
- BlockState blockState = world.getBlockState(pos);
|
2024-01-23 14:34:17 +01:00
|
|
|
+ BlockState blockState = world.getBlockStateIfLoaded(pos); // Paper - Do not load chunks during pathfinding
|
|
|
|
+ if (blockState == null) return BlockPathTypes.BLOCKED; // Paper - Do not load chunks during pathfinding
|
2021-06-12 04:24:43 +02:00
|
|
|
Block block = blockState.getBlock();
|
|
|
|
if (blockState.isAir()) {
|
2023-06-07 20:49:17 +02:00
|
|
|
return BlockPathTypes.OPEN;
|