| 
									
										
										
										
											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
 | 
					
						
							| 
									
										
										
										
											2022-02-28 22:43:03 -07:00
										 |  |  | index ca45dfc6c05760e00987c09b697efb1f9ff0e78a..2d42df635b1ce8d975278fb36f00fe9b8b8f060f 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
 | 
					
						
							| 
									
										
										
										
											2022-02-28 22:43:03 -07:00
										 |  |  | @@ -457,7 +457,12 @@ public class WalkNodeEvaluator extends NodeEvaluator {
 | 
					
						
							| 
									
										
										
										
											2021-06-11 19:24:43 -07:00
										 |  |  |                  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);
 | 
					
						
							| 
									
										
										
										
											2021-06-11 14:02:28 +02:00
										 |  |  | +                        // Paper start
 | 
					
						
							| 
									
										
										
										
											2021-12-05 15:32:02 -08:00
										 |  |  | +                        BlockState blockState = world.getBlockStateIfLoaded(pos);
 | 
					
						
							| 
									
										
										
										
											2021-06-11 19:24:43 -07:00
										 |  |  | +                        if (blockState == null) {
 | 
					
						
							|  |  |  | +                            return BlockPathTypes.BLOCKED;
 | 
					
						
							| 
									
										
										
										
											2021-06-11 14:02:28 +02:00
										 |  |  | +                        } else {
 | 
					
						
							|  |  |  | +                        // Paper end
 | 
					
						
							| 
									
										
										
										
											2021-06-11 19:24:43 -07:00
										 |  |  |                          if (blockState.is(Blocks.CACTUS)) { | 
					
						
							| 
									
										
										
										
											2021-06-11 14:02:28 +02:00
										 |  |  |                              return BlockPathTypes.DANGER_CACTUS; | 
					
						
							| 
									
										
										
										
											2021-06-11 19:24:43 -07:00
										 |  |  |                          } | 
					
						
							| 
									
										
										
										
											2022-02-28 22:43:03 -07:00
										 |  |  | @@ -473,6 +478,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
 | 
					
						
							| 
									
										
										
										
											2021-06-11 19:24:43 -07:00
										 |  |  |                          if (world.getFluidState(pos).is(FluidTags.WATER)) { | 
					
						
							| 
									
										
										
										
											2021-06-11 14:02:28 +02:00
										 |  |  |                              return BlockPathTypes.WATER_BORDER; | 
					
						
							|  |  |  |                          } | 
					
						
							|  |  |  | +                        } // Paper
 | 
					
						
							|  |  |  |                      } | 
					
						
							|  |  |  |                  } | 
					
						
							|  |  |  |              } | 
					
						
							| 
									
										
										
										
											2022-02-28 22:43:03 -07:00
										 |  |  | @@ -482,7 +488,8 @@ public class WalkNodeEvaluator extends NodeEvaluator {
 | 
					
						
							| 
									
										
										
										
											2021-06-11 14:02:28 +02:00
										 |  |  |      } | 
					
						
							|  |  |  |   | 
					
						
							| 
									
										
										
										
											2021-06-11 19:24:43 -07:00
										 |  |  |      protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) { | 
					
						
							|  |  |  | -        BlockState blockState = world.getBlockState(pos);
 | 
					
						
							| 
									
										
										
										
											2021-12-05 15:32:02 -08:00
										 |  |  | +        BlockState blockState = world.getBlockStateIfLoaded(pos); // Paper
 | 
					
						
							| 
									
										
										
										
											2021-06-11 19:24:43 -07:00
										 |  |  | +        if (blockState == null) return BlockPathTypes.BLOCKED; // Paper
 | 
					
						
							|  |  |  |          Block block = blockState.getBlock(); | 
					
						
							|  |  |  |          Material material = blockState.getMaterial(); | 
					
						
							|  |  |  |          if (blockState.isAir()) { |