--- a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
@@ -477,7 +477,12 @@
                 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.getBlockStateIfLoaded(pos);
+                        if (blockState == null) {
+                            return BlockPathTypes.BLOCKED;
+                        } else {
+                        // Paper end
                         if (blockState.is(Blocks.CACTUS)) {
                             return BlockPathTypes.DANGER_CACTUS;
                         }
@@ -490,9 +495,10 @@
                             return BlockPathTypes.DANGER_FIRE;
                         }
 
-                        if (world.getFluidState(pos).is(FluidTags.WATER)) {
+                        if (blockState.getFluidState().is(FluidTags.WATER)) {
                             return BlockPathTypes.WATER_BORDER;
                         }
+                        } // Paper
                     }
                 }
             }
@@ -502,7 +508,8 @@
     }
 
     protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) {
-        BlockState blockState = world.getBlockState(pos);
+        BlockState blockState = world.getBlockStateIfLoaded(pos); // Paper
+        if (blockState == null) return BlockPathTypes.BLOCKED; // Paper
         Block block = blockState.getBlock();
         Material material = blockState.getMaterial();
         if (blockState.isAir()) {
@@ -519,7 +526,7 @@
             } else if (blockState.is(Blocks.COCOA)) {
                 return BlockPathTypes.COCOA;
             } else {
-                FluidState fluidState = world.getFluidState(pos);
+                FluidState fluidState = blockState.getFluidState(); // Paper - remove another get type call
                 if (fluidState.is(FluidTags.LAVA)) {
                     return BlockPathTypes.LAVA;
                 } else if (isBurningBlock(blockState)) {
