PaperMC/patches/server/0082-Do-not-load-chunks-for-Pathfinding.patch

25 lines
1.2 KiB
Diff
Raw Normal View History

2024-04-24 03:25:14 +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-10-22 20:04:31 +02:00
index 448e4d68790e795e1848236e700bf6955098e0d9..c84fd369d92932903c76bb2012602617d3e2d213 100644
2024-04-24 03:25:14 +02:00
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
@@ -478,7 +478,12 @@ public class WalkNodeEvaluator extends NodeEvaluator {
}
protected static PathType getPathTypeFromState(BlockGetter world, BlockPos pos) {
- BlockState blockState = world.getBlockState(pos);
+ // Paper start - Do not load chunks during pathfinding
+ BlockState blockState = world.getBlockStateIfLoaded(pos);
+ if (blockState == null) {
+ return PathType.BLOCKED;
2024-04-24 03:25:14 +02:00
+ }
+ // Paper end
Block block = blockState.getBlock();
if (blockState.isAir()) {
return PathType.OPEN;